diff options
| -rw-r--r-- | libs/gui/tests/Surface_test.cpp | 2 | ||||
| -rw-r--r-- | opengl/libs/EGL/egl_platform_entries.cpp | 2 | ||||
| -rw-r--r-- | services/surfaceflinger/BufferLayer.cpp | 27 | ||||
| -rw-r--r-- | services/surfaceflinger/DisplayDevice.cpp | 4 | ||||
| -rw-r--r-- | services/surfaceflinger/SurfaceFlinger.cpp | 36 | ||||
| -rw-r--r-- | services/surfaceflinger/SurfaceFlinger.h | 2 | ||||
| -rw-r--r-- | services/surfaceflinger/tests/unittests/DisplayTransactionTest.cpp | 2 |
7 files changed, 20 insertions, 55 deletions
diff --git a/libs/gui/tests/Surface_test.cpp b/libs/gui/tests/Surface_test.cpp index d37b81096b..67afbd6a52 100644 --- a/libs/gui/tests/Surface_test.cpp +++ b/libs/gui/tests/Surface_test.cpp @@ -207,7 +207,7 @@ TEST_F(SurfaceTest, QueryConsumerUsage) { } TEST_F(SurfaceTest, QueryDefaultBuffersDataSpace) { - const android_dataspace TEST_DATASPACE = HAL_DATASPACE_SRGB; + const android_dataspace TEST_DATASPACE = HAL_DATASPACE_V0_SRGB; sp<IGraphicBufferProducer> producer; sp<IGraphicBufferConsumer> consumer; BufferQueue::createBufferQueue(&producer, &consumer); diff --git a/opengl/libs/EGL/egl_platform_entries.cpp b/opengl/libs/EGL/egl_platform_entries.cpp index 4ebd8bd347..79166a75c3 100644 --- a/opengl/libs/EGL/egl_platform_entries.cpp +++ b/opengl/libs/EGL/egl_platform_entries.cpp @@ -461,7 +461,7 @@ static android_dataspace dataSpaceFromEGLColorSpace(EGLint colorspace) { if (colorspace == EGL_GL_COLORSPACE_LINEAR_KHR) { return HAL_DATASPACE_UNKNOWN; } else if (colorspace == EGL_GL_COLORSPACE_SRGB_KHR) { - return HAL_DATASPACE_SRGB; + return HAL_DATASPACE_V0_SRGB; } else if (colorspace == EGL_GL_COLORSPACE_DISPLAY_P3_EXT) { return HAL_DATASPACE_DISPLAY_P3; } else if (colorspace == EGL_GL_COLORSPACE_DISPLAY_P3_LINEAR_EXT) { diff --git a/services/surfaceflinger/BufferLayer.cpp b/services/surfaceflinger/BufferLayer.cpp index 9b1c0dbc53..4e4d7dd371 100644 --- a/services/surfaceflinger/BufferLayer.cpp +++ b/services/surfaceflinger/BufferLayer.cpp @@ -431,26 +431,25 @@ Region BufferLayer::latchBuffer(bool& recomputeVisibleRegions, nsecs_t latchTime } ui::Dataspace dataSpace = getDrawingDataSpace(); - // treat modern dataspaces as legacy dataspaces whenever possible, until - // we can trust the buffer producers + // translate legacy dataspaces to modern dataspaces switch (dataSpace) { - case ui::Dataspace::V0_SRGB: - dataSpace = ui::Dataspace::SRGB; + case ui::Dataspace::SRGB: + dataSpace = ui::Dataspace::V0_SRGB; break; - case ui::Dataspace::V0_SRGB_LINEAR: - dataSpace = ui::Dataspace::SRGB_LINEAR; + case ui::Dataspace::SRGB_LINEAR: + dataSpace = ui::Dataspace::V0_SRGB_LINEAR; break; - case ui::Dataspace::V0_JFIF: - dataSpace = ui::Dataspace::JFIF; + case ui::Dataspace::JFIF: + dataSpace = ui::Dataspace::V0_JFIF; break; - case ui::Dataspace::V0_BT601_625: - dataSpace = ui::Dataspace::BT601_625; + case ui::Dataspace::BT601_625: + dataSpace = ui::Dataspace::V0_BT601_625; break; - case ui::Dataspace::V0_BT601_525: - dataSpace = ui::Dataspace::BT601_525; + case ui::Dataspace::BT601_525: + dataSpace = ui::Dataspace::V0_BT601_525; break; - case ui::Dataspace::V0_BT709: - dataSpace = ui::Dataspace::BT709; + case ui::Dataspace::BT709: + dataSpace = ui::Dataspace::V0_BT709; break; default: break; diff --git a/services/surfaceflinger/DisplayDevice.cpp b/services/surfaceflinger/DisplayDevice.cpp index 48fd47fdbe..2963a97608 100644 --- a/services/surfaceflinger/DisplayDevice.cpp +++ b/services/surfaceflinger/DisplayDevice.cpp @@ -98,7 +98,7 @@ const std::array<RenderIntent, 2> sHdrRenderIntents = { Dataspace colorModeToDataspace(ColorMode mode) { switch (mode) { case ColorMode::SRGB: - return Dataspace::SRGB; + return Dataspace::V0_SRGB; case ColorMode::DISPLAY_P3: return Dataspace::DISPLAY_P3; case ColorMode::DISPLAY_BT2020: @@ -817,7 +817,7 @@ void DisplayDevice::populateColorModes( bool DisplayDevice::hasRenderIntent(RenderIntent intent) const { // assume a render intent is supported when SRGB supports it; we should // get rid of that assumption. - auto iter = mColorModes.find(getColorModeKey(Dataspace::SRGB, intent)); + auto iter = mColorModes.find(getColorModeKey(Dataspace::V0_SRGB, intent)); return iter != mColorModes.end() && iter->second.renderIntent == intent; } diff --git a/services/surfaceflinger/SurfaceFlinger.cpp b/services/surfaceflinger/SurfaceFlinger.cpp index a142928153..a14ca2d2a2 100644 --- a/services/surfaceflinger/SurfaceFlinger.cpp +++ b/services/surfaceflinger/SurfaceFlinger.cpp @@ -734,24 +734,6 @@ void SurfaceFlinger::init() { ALOGE("Run StartPropertySetThread failed!"); } - // This is a hack. Per definition of getDataspaceSaturationMatrix, the returned matrix - // is used to saturate legacy sRGB content. However, to make sure the same color under - // Display P3 will be saturated to the same color, we intentionally break the API spec - // and apply this saturation matrix on Display P3 content. Unless the risk of applying - // such saturation matrix on Display P3 is understood fully, the API should always return - // identify matrix. - mEnhancedSaturationMatrix = - getHwComposer().getDataspaceSaturationMatrix(*display->getId(), Dataspace::SRGB_LINEAR); - - // we will apply this on Display P3. - if (mEnhancedSaturationMatrix != mat4()) { - ColorSpace srgb(ColorSpace::sRGB()); - ColorSpace displayP3(ColorSpace::DisplayP3()); - mat4 srgbToP3 = mat4(ColorSpaceConnector(srgb, displayP3).getTransform()); - mat4 p3ToSrgb = mat4(ColorSpaceConnector(displayP3, srgb).getTransform()); - mEnhancedSaturationMatrix = srgbToP3 * mEnhancedSaturationMatrix * p3ToSrgb; - } - ALOGV("Done initializing"); } @@ -2106,7 +2088,7 @@ void SurfaceFlinger::rebuildLayerStacks() { // - Dataspace::BT2020_PQ Dataspace SurfaceFlinger::getBestDataspace(const sp<const DisplayDevice>& display, Dataspace* outHdrDataSpace) const { - Dataspace bestDataSpace = Dataspace::SRGB; + Dataspace bestDataSpace = Dataspace::V0_SRGB; *outHdrDataSpace = Dataspace::UNKNOWN; for (const auto& layer : display->getVisibleLayersSortedByZ()) { @@ -2431,7 +2413,7 @@ sp<DisplayDevice> SurfaceFlinger::setupNewDisplayDeviceInternal( Dataspace defaultDataSpace = Dataspace::UNKNOWN; if (display->hasWideColorGamut()) { defaultColorMode = ColorMode::SRGB; - defaultDataSpace = Dataspace::SRGB; + defaultDataSpace = Dataspace::V0_SRGB; } setActiveColorModeInternal(display, defaultColorMode, defaultDataSpace, RenderIntent::COLORIMETRIC); @@ -3085,7 +3067,6 @@ bool SurfaceFlinger::doComposeSurfaces(const sp<DisplayDevice>& display) { mat4 colorMatrix; bool applyColorMatrix = false; - bool needsEnhancedColorMatrix = false; // Framebuffer will live in this scope for GPU composition. std::unique_ptr<renderengine::BindNativeBufferAsFramebuffer> fbo; @@ -3132,16 +3113,6 @@ bool SurfaceFlinger::doComposeSurfaces(const sp<DisplayDevice>& display) { colorMatrix = mDrawingState.colorMatrix; } - // The current enhanced saturation matrix is designed to enhance Display P3, - // thus we only apply this matrix when the render intent is not colorimetric - // and the output color space is Display P3. - needsEnhancedColorMatrix = - (display->getActiveRenderIntent() >= RenderIntent::ENHANCE && - outputDataspace == Dataspace::DISPLAY_P3); - if (needsEnhancedColorMatrix) { - colorMatrix *= mEnhancedSaturationMatrix; - } - display->setViewportAndProjection(); // Never touch the framebuffer if we don't have any framebuffer layers @@ -3216,9 +3187,6 @@ bool SurfaceFlinger::doComposeSurfaces(const sp<DisplayDevice>& display) { tmpMatrix = mDrawingState.colorMatrix; } tmpMatrix *= layer->getColorTransform(); - if (needsEnhancedColorMatrix) { - tmpMatrix *= mEnhancedSaturationMatrix; - } getRenderEngine().setColorTransform(tmpMatrix); } else { getRenderEngine().setColorTransform(colorMatrix); diff --git a/services/surfaceflinger/SurfaceFlinger.h b/services/surfaceflinger/SurfaceFlinger.h index 9f520583fe..4977ca08d2 100644 --- a/services/surfaceflinger/SurfaceFlinger.h +++ b/services/surfaceflinger/SurfaceFlinger.h @@ -986,8 +986,6 @@ private: std::thread::id mMainThreadId; DisplayColorSetting mDisplayColorSetting = DisplayColorSetting::ENHANCED; - // Applied on Display P3 layers when the render intent is non-colorimetric. - mat4 mEnhancedSaturationMatrix; ui::Dataspace mDefaultCompositionDataspace; ui::Dataspace mWideColorGamutCompositionDataspace; diff --git a/services/surfaceflinger/tests/unittests/DisplayTransactionTest.cpp b/services/surfaceflinger/tests/unittests/DisplayTransactionTest.cpp index 34cee3e81f..02aa5ce8ca 100644 --- a/services/surfaceflinger/tests/unittests/DisplayTransactionTest.cpp +++ b/services/surfaceflinger/tests/unittests/DisplayTransactionTest.cpp @@ -1144,7 +1144,7 @@ TEST_F(GetBestColorModeTest, DataspaceDisplayP3_ColorModeSRGB) { getBestColorMode(); - ASSERT_EQ(ui::Dataspace::SRGB, mOutDataspace); + ASSERT_EQ(ui::Dataspace::V0_SRGB, mOutDataspace); ASSERT_EQ(ui::ColorMode::SRGB, mOutColorMode); ASSERT_EQ(ui::RenderIntent::COLORIMETRIC, mOutRenderIntent); } |