am 3e4c8ccc: Merge "SF: Add colorTransform to DisplayInfo" into mnc-dr-dev

* commit '3e4c8ccc3e5d037688ed8a1f8b69764c526e0d2f':
  SF: Add colorTransform to DisplayInfo
This commit is contained in:
Dan Stoza 2015-09-03 22:03:03 +00:00 committed by Android Git Automerger
commit f090d5985a
4 changed files with 27 additions and 3 deletions

View File

@ -36,6 +36,7 @@ struct DisplayInfo {
bool secure; bool secure;
nsecs_t appVsyncOffset; nsecs_t appVsyncOffset;
nsecs_t presentationDeadline; nsecs_t presentationDeadline;
int colorTransform;
}; };
/* Display orientations as defined in Surface.java and ISurfaceComposer.h. */ /* Display orientations as defined in Surface.java and ISurfaceComposer.h. */

View File

@ -336,10 +336,20 @@ static const uint32_t DISPLAY_ATTRIBUTES[] = {
HWC_DISPLAY_HEIGHT, HWC_DISPLAY_HEIGHT,
HWC_DISPLAY_DPI_X, HWC_DISPLAY_DPI_X,
HWC_DISPLAY_DPI_Y, HWC_DISPLAY_DPI_Y,
HWC_DISPLAY_COLOR_TRANSFORM,
HWC_DISPLAY_NO_ATTRIBUTE, HWC_DISPLAY_NO_ATTRIBUTE,
}; };
#define NUM_DISPLAY_ATTRIBUTES (sizeof(DISPLAY_ATTRIBUTES) / sizeof(DISPLAY_ATTRIBUTES)[0]) #define NUM_DISPLAY_ATTRIBUTES (sizeof(DISPLAY_ATTRIBUTES) / sizeof(DISPLAY_ATTRIBUTES)[0])
static const uint32_t PRE_HWC15_DISPLAY_ATTRIBUTES[] = {
HWC_DISPLAY_VSYNC_PERIOD,
HWC_DISPLAY_WIDTH,
HWC_DISPLAY_HEIGHT,
HWC_DISPLAY_DPI_X,
HWC_DISPLAY_DPI_Y,
HWC_DISPLAY_NO_ATTRIBUTE,
};
status_t HWComposer::queryDisplayProperties(int disp) { status_t HWComposer::queryDisplayProperties(int disp) {
LOG_ALWAYS_FATAL_IF(!mHwc || !hwcHasApiVersion(mHwc, HWC_DEVICE_API_VERSION_1_1)); LOG_ALWAYS_FATAL_IF(!mHwc || !hwcHasApiVersion(mHwc, HWC_DEVICE_API_VERSION_1_1));
@ -362,6 +372,12 @@ status_t HWComposer::queryDisplayProperties(int disp) {
for (size_t c = 0; c < numConfigs; ++c) { for (size_t c = 0; c < numConfigs; ++c) {
err = mHwc->getDisplayAttributes(mHwc, disp, configs[c], err = mHwc->getDisplayAttributes(mHwc, disp, configs[c],
DISPLAY_ATTRIBUTES, values); DISPLAY_ATTRIBUTES, values);
// If this is a pre-1.5 HWC, it may not know about color transform, so
// try again with a smaller set of attributes
if (err != NO_ERROR) {
err = mHwc->getDisplayAttributes(mHwc, disp, configs[c],
PRE_HWC15_DISPLAY_ATTRIBUTES, values);
}
if (err != NO_ERROR) { if (err != NO_ERROR) {
// we can't get this display's info. turn it off. // we can't get this display's info. turn it off.
mDisplayData[disp].connected = false; mDisplayData[disp].connected = false;
@ -386,6 +402,9 @@ status_t HWComposer::queryDisplayProperties(int disp) {
case HWC_DISPLAY_DPI_Y: case HWC_DISPLAY_DPI_Y:
config.ydpi = values[i] / 1000.0f; config.ydpi = values[i] / 1000.0f;
break; break;
case HWC_DISPLAY_COLOR_TRANSFORM:
config.colorTransform = values[i];
break;
default: default:
ALOG_ASSERT(false, "unknown display attribute[%zu] %#x", ALOG_ASSERT(false, "unknown display attribute[%zu] %#x",
i, DISPLAY_ATTRIBUTES[i]); i, DISPLAY_ATTRIBUTES[i]);
@ -1162,9 +1181,11 @@ void HWComposer::dump(String8& result) const {
result.appendFormat(" Display[%zd] configurations (* current):\n", i); result.appendFormat(" Display[%zd] configurations (* current):\n", i);
for (size_t c = 0; c < disp.configs.size(); ++c) { for (size_t c = 0; c < disp.configs.size(); ++c) {
const DisplayConfig& config(disp.configs[c]); const DisplayConfig& config(disp.configs[c]);
result.appendFormat(" %s%zd: %ux%u, xdpi=%f, ydpi=%f, refresh=%" PRId64 "\n", result.appendFormat(" %s%zd: %ux%u, xdpi=%f, ydpi=%f"
c == disp.currentConfig ? "* " : "", c, config.width, config.height, ", refresh=%" PRId64 ", colorTransform=%d\n",
config.xdpi, config.ydpi, config.refresh); c == disp.currentConfig ? "* " : "", c,
config.width, config.height, config.xdpi, config.ydpi,
config.refresh, config.colorTransform);
} }
if (disp.list) { if (disp.list) {

View File

@ -257,6 +257,7 @@ public:
float xdpi; float xdpi;
float ydpi; float ydpi;
nsecs_t refresh; nsecs_t refresh;
int colorTransform;
}; };
// Query display parameters. Pass in a display index (e.g. // Query display parameters. Pass in a display index (e.g.

View File

@ -632,6 +632,7 @@ status_t SurfaceFlinger::getDisplayConfigs(const sp<IBinder>& display,
info.ydpi = ydpi; info.ydpi = ydpi;
info.fps = float(1e9 / hwConfig.refresh); info.fps = float(1e9 / hwConfig.refresh);
info.appVsyncOffset = VSYNC_EVENT_PHASE_OFFSET_NS; info.appVsyncOffset = VSYNC_EVENT_PHASE_OFFSET_NS;
info.colorTransform = hwConfig.colorTransform;
// This is how far in advance a buffer must be queued for // This is how far in advance a buffer must be queued for
// presentation at a given time. If you want a buffer to appear // presentation at a given time. If you want a buffer to appear