summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'services/surfaceflinger/DisplayHardware/HWComposer.cpp')
-rw-r--r--services/surfaceflinger/DisplayHardware/HWComposer.cpp27
1 files changed, 24 insertions, 3 deletions
diff --git a/services/surfaceflinger/DisplayHardware/HWComposer.cpp b/services/surfaceflinger/DisplayHardware/HWComposer.cpp
index 320899045..d37fcb2b8 100644
--- a/services/surfaceflinger/DisplayHardware/HWComposer.cpp
+++ b/services/surfaceflinger/DisplayHardware/HWComposer.cpp
@@ -336,10 +336,20 @@ static const uint32_t DISPLAY_ATTRIBUTES[] = {
336 HWC_DISPLAY_HEIGHT, 336 HWC_DISPLAY_HEIGHT,
337 HWC_DISPLAY_DPI_X, 337 HWC_DISPLAY_DPI_X,
338 HWC_DISPLAY_DPI_Y, 338 HWC_DISPLAY_DPI_Y,
339 HWC_DISPLAY_COLOR_TRANSFORM,
339 HWC_DISPLAY_NO_ATTRIBUTE, 340 HWC_DISPLAY_NO_ATTRIBUTE,
340}; 341};
341#define NUM_DISPLAY_ATTRIBUTES (sizeof(DISPLAY_ATTRIBUTES) / sizeof(DISPLAY_ATTRIBUTES)[0]) 342#define NUM_DISPLAY_ATTRIBUTES (sizeof(DISPLAY_ATTRIBUTES) / sizeof(DISPLAY_ATTRIBUTES)[0])
342 343
344static const uint32_t PRE_HWC15_DISPLAY_ATTRIBUTES[] = {
345 HWC_DISPLAY_VSYNC_PERIOD,
346 HWC_DISPLAY_WIDTH,
347 HWC_DISPLAY_HEIGHT,
348 HWC_DISPLAY_DPI_X,
349 HWC_DISPLAY_DPI_Y,
350 HWC_DISPLAY_NO_ATTRIBUTE,
351};
352
343status_t HWComposer::queryDisplayProperties(int disp) { 353status_t HWComposer::queryDisplayProperties(int disp) {
344 354
345 LOG_ALWAYS_FATAL_IF(!mHwc || !hwcHasApiVersion(mHwc, HWC_DEVICE_API_VERSION_1_1)); 355 LOG_ALWAYS_FATAL_IF(!mHwc || !hwcHasApiVersion(mHwc, HWC_DEVICE_API_VERSION_1_1));
@@ -362,6 +372,12 @@ status_t HWComposer::queryDisplayProperties(int disp) {
362 for (size_t c = 0; c < numConfigs; ++c) { 372 for (size_t c = 0; c < numConfigs; ++c) {
363 err = mHwc->getDisplayAttributes(mHwc, disp, configs[c], 373 err = mHwc->getDisplayAttributes(mHwc, disp, configs[c],
364 DISPLAY_ATTRIBUTES, values); 374 DISPLAY_ATTRIBUTES, values);
375 // If this is a pre-1.5 HWC, it may not know about color transform, so
376 // try again with a smaller set of attributes
377 if (err != NO_ERROR) {
378 err = mHwc->getDisplayAttributes(mHwc, disp, configs[c],
379 PRE_HWC15_DISPLAY_ATTRIBUTES, values);
380 }
365 if (err != NO_ERROR) { 381 if (err != NO_ERROR) {
366 // we can't get this display's info. turn it off. 382 // we can't get this display's info. turn it off.
367 mDisplayData[disp].connected = false; 383 mDisplayData[disp].connected = false;
@@ -386,6 +402,9 @@ status_t HWComposer::queryDisplayProperties(int disp) {
386 case HWC_DISPLAY_DPI_Y: 402 case HWC_DISPLAY_DPI_Y:
387 config.ydpi = values[i] / 1000.0f; 403 config.ydpi = values[i] / 1000.0f;
388 break; 404 break;
405 case HWC_DISPLAY_COLOR_TRANSFORM:
406 config.colorTransform = values[i];
407 break;
389 default: 408 default:
390 ALOG_ASSERT(false, "unknown display attribute[%zu] %#x", 409 ALOG_ASSERT(false, "unknown display attribute[%zu] %#x",
391 i, DISPLAY_ATTRIBUTES[i]); 410 i, DISPLAY_ATTRIBUTES[i]);
@@ -1147,9 +1166,11 @@ void HWComposer::dump(String8& result) const {
1147 result.appendFormat(" Display[%zd] configurations (* current):\n", i); 1166 result.appendFormat(" Display[%zd] configurations (* current):\n", i);
1148 for (size_t c = 0; c < disp.configs.size(); ++c) { 1167 for (size_t c = 0; c < disp.configs.size(); ++c) {
1149 const DisplayConfig& config(disp.configs[c]); 1168 const DisplayConfig& config(disp.configs[c]);
1150 result.appendFormat(" %s%zd: %ux%u, xdpi=%f, ydpi=%f, refresh=%" PRId64 "\n", 1169 result.appendFormat(" %s%zd: %ux%u, xdpi=%f, ydpi=%f"
1151 c == disp.currentConfig ? "* " : "", c, config.width, config.height, 1170 ", refresh=%" PRId64 ", colorTransform=%d\n",
1152 config.xdpi, config.ydpi, config.refresh); 1171 c == disp.currentConfig ? "* " : "", c,
1172 config.width, config.height, config.xdpi, config.ydpi,
1173 config.refresh, config.colorTransform);
1153 } 1174 }
1154 1175
1155 if (disp.list) { 1176 if (disp.list) {