diff options
| author | 2018-04-17 15:09:44 -0700 | |
|---|---|---|
| committer | 2018-05-07 15:38:57 -0700 | |
| commit | d6fa4a70ba70393816176eda0b64e2b576ce6d6b (patch) | |
| tree | e034d4940c7d58a9d2f2dfb4091d7a6d41e3a686 /services/surfaceflinger/DisplayDevice.cpp | |
| parent | 84d1fb6d373c36974a7ee69b48afb7e5f2831e0d (diff) | |
[SurfaceFlinger] Add BT2100_PQ and BT2100_HLG color mode.
When hardware composer has native HDR10/HLG support, SurfaceFlinger will always
pass the layer to hardware composer. When hardware composer doesn't have native
HDR10/HLG support, but has BT2100_PQ or BT2100_HLG color mode with render
intent, SurfaceFlinger will always set the color mode to BT2100_PQ and
BT2100_HLG respectively, and set the render intent to TONE_MAP_ENHANCE if
supported, or TONE_MAP_COLORIMETRIC. Otherwise, SurfaceFlinger will set the
color mode to Display P3 and simulate PQ/HLG in RenderEngine.
Since SurfaceFlinger now can simulate HLG support in Display P3 mode, when apps
query HDR capability from platform, we also return HLG support.
BUG: 73825729
Test: build, flash
Change-Id: I53696360f2b3d986aa9191ff42866e275ba4fd0b
Merged-In: I53696360f2b3d986aa9191ff42866e275ba4fd0b
Diffstat (limited to 'services/surfaceflinger/DisplayDevice.cpp')
| -rw-r--r-- | services/surfaceflinger/DisplayDevice.cpp | 35 |
1 files changed, 34 insertions, 1 deletions
diff --git a/services/surfaceflinger/DisplayDevice.cpp b/services/surfaceflinger/DisplayDevice.cpp index 00f8cc9c5c..2b1e5775ba 100644 --- a/services/surfaceflinger/DisplayDevice.cpp +++ b/services/surfaceflinger/DisplayDevice.cpp @@ -80,6 +80,7 @@ DisplayDevice::DisplayDevice( bool hasWideColorGamut, const HdrCapabilities& hdrCapabilities, const int32_t supportedPerFrameMetadata, + const std::unordered_map<ui::ColorMode, std::vector<ui::RenderIntent>>& hdrAndRenderIntents, int initialPowerMode) : lastCompositionHadVisibleLayers(false), mFlinger(flinger), @@ -105,7 +106,11 @@ DisplayDevice::DisplayDevice( mHasHdr10(false), mHasHLG(false), mHasDolbyVision(false), - mSupportedPerFrameMetadata(supportedPerFrameMetadata) + mSupportedPerFrameMetadata(supportedPerFrameMetadata), + mHasBT2100PQColorimetric(false), + mHasBT2100PQEnhance(false), + mHasBT2100HLGColorimetric(false), + mHasBT2100HLGEnhance(false) { // clang-format on std::vector<Hdr> types = hdrCapabilities.getSupportedHdrTypes(); @@ -145,6 +150,18 @@ DisplayDevice::DisplayDevice( } mHdrCapabilities = HdrCapabilities(types, maxLuminance, maxAverageLuminance, minLuminance); + auto iter = hdrAndRenderIntents.find(ColorMode::BT2100_PQ); + if (iter != hdrAndRenderIntents.end()) { + hasToneMapping(iter->second, + &mHasBT2100PQColorimetric, &mHasBT2100PQEnhance); + } + + iter = hdrAndRenderIntents.find(ColorMode::BT2100_HLG); + if (iter != hdrAndRenderIntents.end()) { + hasToneMapping(iter->second, + &mHasBT2100HLGColorimetric, &mHasBT2100HLGEnhance); + } + // initialize the display orientation transform. setProjection(DisplayState::eOrientationDefault, mViewport, mFrame); } @@ -529,6 +546,22 @@ void DisplayDevice::dump(String8& result) const { result.append(surfaceDump); } +void DisplayDevice::hasToneMapping(const std::vector<RenderIntent>& renderIntents, + bool* outColorimetric, bool *outEnhance) { + for (auto intent : renderIntents) { + switch (intent) { + case RenderIntent::TONE_MAP_COLORIMETRIC: + *outColorimetric = true; + break; + case RenderIntent::TONE_MAP_ENHANCE: + *outEnhance = true; + break; + default: + break; + } + } +} + std::atomic<int32_t> DisplayDeviceState::nextDisplayId(1); DisplayDeviceState::DisplayDeviceState(DisplayDevice::DisplayType type, bool isSecure) |