diff options
author | Chia-I Wu <olv@google.com> | 2018-06-06 21:59:29 +0000 |
---|---|---|
committer | Android (Google) Code Review <android-gerrit@google.com> | 2018-06-06 21:59:29 +0000 |
commit | b583b3bb0195e964e46e3879ddce09bde8ec7db5 (patch) | |
tree | 836ab80df1a621127c107816e18f7437ed382bf8 | |
parent | 3e273065386bde56c4c7710de2ceb585a5eb4784 (diff) | |
parent | 07376a98a6c66c4e48bdebe82616f0ae47e5f805 (diff) | |
download | native-b583b3bb0195e964e46e3879ddce09bde8ec7db5.tar.gz |
Merge "surfaceflinger: force client composition for Y410" into pi-dev
-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 cdd9c1804f..87baf8c8a8 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); } |