diff options
Diffstat (limited to 'services/surfaceflinger/DisplayHardware')
4 files changed, 28 insertions, 3 deletions
diff --git a/services/surfaceflinger/DisplayHardware/FramebufferSurface.cpp b/services/surfaceflinger/DisplayHardware/FramebufferSurface.cpp index 6ef3295..70af656 100644 --- a/services/surfaceflinger/DisplayHardware/FramebufferSurface.cpp +++ b/services/surfaceflinger/DisplayHardware/FramebufferSurface.cpp @@ -67,6 +67,7 @@ FramebufferSurface::FramebufferSurface(HWComposer& hwc, int disp, mConsumer->setDefaultBufferFormat(mHwc.getFormat(disp)); mConsumer->setDefaultBufferSize(mHwc.getWidth(disp), mHwc.getHeight(disp)); mConsumer->setDefaultMaxBufferCount(NUM_FRAMEBUFFER_SURFACE_BUFFERS); + mConsumer->setMaxAcquiredBufferCount(NUM_FRAMEBUFFER_SURFACE_BUFFERS - 1); } status_t FramebufferSurface::beginFrame(bool /*mustRecompose*/) { diff --git a/services/surfaceflinger/DisplayHardware/HWComposer.cpp b/services/surfaceflinger/DisplayHardware/HWComposer.cpp index 33a09f8..b60687f 100644 --- a/services/surfaceflinger/DisplayHardware/HWComposer.cpp +++ b/services/surfaceflinger/DisplayHardware/HWComposer.cpp @@ -344,10 +344,20 @@ static const uint32_t DISPLAY_ATTRIBUTES[] = { HWC_DISPLAY_HEIGHT, HWC_DISPLAY_DPI_X, HWC_DISPLAY_DPI_Y, + HWC_DISPLAY_COLOR_TRANSFORM, HWC_DISPLAY_NO_ATTRIBUTE, }; #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) { LOG_ALWAYS_FATAL_IF(!mHwc || !hwcHasApiVersion(mHwc, HWC_DEVICE_API_VERSION_1_1)); @@ -375,6 +385,12 @@ status_t HWComposer::queryDisplayProperties(int disp) { for (size_t c = 0; c < numConfigs; ++c) { err = mHwc->getDisplayAttributes(mHwc, disp, configs[c], 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) { // we can't get this display's info. turn it off. mDisplayData[disp].connected = false; @@ -399,6 +415,9 @@ status_t HWComposer::queryDisplayProperties(int disp) { case HWC_DISPLAY_DPI_Y: config.ydpi = values[i] / 1000.0f; break; + case HWC_DISPLAY_COLOR_TRANSFORM: + config.colorTransform = values[i]; + break; default: ALOG_ASSERT(false, "unknown display attribute[%zu] %#x", i, DISPLAY_ATTRIBUTES[i]); @@ -1210,9 +1229,11 @@ void HWComposer::dump(String8& result) const { result.appendFormat(" Display[%zd] configurations (* current):\n", i); for (size_t c = 0; c < disp.configs.size(); ++c) { const DisplayConfig& config(disp.configs[c]); - result.appendFormat(" %s%zd: %ux%u, xdpi=%f, ydpi=%f, refresh=%" PRId64 "\n", - c == disp.currentConfig ? "* " : "", c, config.width, config.height, - config.xdpi, config.ydpi, config.refresh); + result.appendFormat(" %s%zd: %ux%u, xdpi=%f, ydpi=%f" + ", refresh=%" PRId64 ", colorTransform=%d\n", + c == disp.currentConfig ? "* " : "", c, + config.width, config.height, config.xdpi, config.ydpi, + config.refresh, config.colorTransform); } if (disp.list) { diff --git a/services/surfaceflinger/DisplayHardware/HWComposer.h b/services/surfaceflinger/DisplayHardware/HWComposer.h index 89ed4e9..9bdb7de 100644 --- a/services/surfaceflinger/DisplayHardware/HWComposer.h +++ b/services/surfaceflinger/DisplayHardware/HWComposer.h @@ -265,6 +265,7 @@ public: float xdpi; float ydpi; nsecs_t refresh; + int colorTransform; }; // Query display parameters. Pass in a display index (e.g. diff --git a/services/surfaceflinger/DisplayHardware/VirtualDisplaySurface.h b/services/surfaceflinger/DisplayHardware/VirtualDisplaySurface.h index 8b153d3..3d0e412 100644 --- a/services/surfaceflinger/DisplayHardware/VirtualDisplaySurface.h +++ b/services/surfaceflinger/DisplayHardware/VirtualDisplaySurface.h @@ -72,7 +72,9 @@ class VirtualDisplaySurface : public DisplaySurface, public BnGraphicBufferProducer, private ConsumerBase { public: +#ifdef QTI_BSP friend class ExVirtualDisplaySurface; +#endif VirtualDisplaySurface(HWComposer& hwc, int32_t dispId, const sp<IGraphicBufferProducer>& sink, |