diff options
author | Chia-I Wu <olv@google.com> | 2018-06-05 15:46:58 -0700 |
---|---|---|
committer | Chia-I Wu <olv@google.com> | 2018-06-06 12:20:10 -0700 |
commit | 07376a98a6c66c4e48bdebe82616f0ae47e5f805 (patch) | |
tree | 92cbc6e5913bae741d5e1261de708e1dedf02144 | |
parent | 4f80b867b3433ddc16d416809c7e9cd5d6deb88b (diff) | |
download | native-07376a98a6c66c4e48bdebe82616f0ae47e5f805.tar.gz |
surfaceflinger: force client composition for Y410
When the pixel format is Y410 masquerading as RGBA_1010102, always
force client composition.
Bug: 80509363
Test: no effect on Pixel devices
Change-Id: I31996eeda1559b0557a5acb53d593fd4f395ccaf
Merged-In: I31996eeda1559b0557a5acb53d593fd4f395ccaf
-rw-r--r-- | services/surfaceflinger/BufferLayer.cpp | 11 | ||||
-rw-r--r-- | services/surfaceflinger/BufferLayer.h | 2 | ||||
-rw-r--r-- | services/surfaceflinger/Layer.h | 2 | ||||
-rw-r--r-- | services/surfaceflinger/SurfaceFlinger.cpp | 11 |
4 files changed, 18 insertions, 8 deletions
diff --git a/services/surfaceflinger/BufferLayer.cpp b/services/surfaceflinger/BufferLayer.cpp index 17ed9aa00c..fda7906744 100644 --- a/services/surfaceflinger/BufferLayer.cpp +++ b/services/surfaceflinger/BufferLayer.cpp @@ -815,6 +815,13 @@ bool BufferLayer::getOpacityForFormat(uint32_t format) { return true; } +bool BufferLayer::isHdrY410() const { + // pixel format is HDR Y410 masquerading as RGBA_1010102 + return (mCurrentDataSpace == ui::Dataspace::BT2020_ITU_PQ && + mConsumer->getCurrentApi() == NATIVE_WINDOW_API_MEDIA && + getBE().compositionInfo.mBuffer->getPixelFormat() == HAL_PIXEL_FORMAT_RGBA_1010102); +} + void BufferLayer::drawWithOpenGL(const RenderArea& renderArea, bool useIdentityTransform) const { ATRACE_CALL(); const State& s(getDrawingState()); @@ -868,9 +875,7 @@ void BufferLayer::drawWithOpenGL(const RenderArea& renderArea, bool useIdentityT getColor()); engine.setSourceDataSpace(mCurrentDataSpace); - if (mCurrentDataSpace == ui::Dataspace::BT2020_ITU_PQ && - mConsumer->getCurrentApi() == NATIVE_WINDOW_API_MEDIA && - getBE().compositionInfo.mBuffer->getPixelFormat() == HAL_PIXEL_FORMAT_RGBA_1010102) { + if (isHdrY410()) { engine.setSourceY410BT2020(true); } diff --git a/services/surfaceflinger/BufferLayer.h b/services/surfaceflinger/BufferLayer.h index 6b02f8c128..bf0ca69253 100644 --- a/services/surfaceflinger/BufferLayer.h +++ b/services/surfaceflinger/BufferLayer.h @@ -129,6 +129,8 @@ public: bool isBufferLatched() const override { return mRefreshPending; } void setDefaultBufferSize(uint32_t w, uint32_t h) override; + bool isHdrY410() const override; + void setPerFrameData(const sp<const DisplayDevice>& displayDevice) override; bool isOpaque(const Layer::State& s) const override; diff --git a/services/surfaceflinger/Layer.h b/services/surfaceflinger/Layer.h index ae80043a5d..34811fb152 100644 --- a/services/surfaceflinger/Layer.h +++ b/services/surfaceflinger/Layer.h @@ -378,6 +378,8 @@ protected: public: virtual void setDefaultBufferSize(uint32_t /*w*/, uint32_t /*h*/) {} + virtual bool isHdrY410() const { return false; } + void setGeometry(const sp<const DisplayDevice>& displayDevice, uint32_t z); void forceClientComposition(int32_t hwcId); bool getForceClientComposition(int32_t hwcId); diff --git a/services/surfaceflinger/SurfaceFlinger.cpp b/services/surfaceflinger/SurfaceFlinger.cpp index 97edd357ed..c97ae19315 100644 --- a/services/surfaceflinger/SurfaceFlinger.cpp +++ b/services/surfaceflinger/SurfaceFlinger.cpp @@ -2031,13 +2031,14 @@ void SurfaceFlinger::setUpHWComposer() { "display %zd: %d", displayId, result); } for (auto& layer : displayDevice->getVisibleLayersSortedByZ()) { - if ((layer->getDataSpace() == Dataspace::BT2020_PQ || - layer->getDataSpace() == Dataspace::BT2020_ITU_PQ) && + if (layer->isHdrY410()) { + layer->forceClientComposition(hwcId); + } else if ((layer->getDataSpace() == Dataspace::BT2020_PQ || + layer->getDataSpace() == Dataspace::BT2020_ITU_PQ) && !displayDevice->hasHDR10Support()) { layer->forceClientComposition(hwcId); - } - if ((layer->getDataSpace() == Dataspace::BT2020_HLG || - layer->getDataSpace() == Dataspace::BT2020_ITU_HLG) && + } else if ((layer->getDataSpace() == Dataspace::BT2020_HLG || + layer->getDataSpace() == Dataspace::BT2020_ITU_HLG) && !displayDevice->hasHLGSupport()) { layer->forceClientComposition(hwcId); } |