diff options
| author | 2019-05-20 22:00:48 -0700 | |
|---|---|---|
| committer | 2019-05-20 22:00:48 -0700 | |
| commit | 3ceda1d7aa36c0410e22dfb66351d455e30d9bfa (patch) | |
| tree | 70100042004ee7f91ae699408cd964b6e83b6e5b | |
| parent | 65cc165ee5e128a14c3623f6da53a04f5a1ff0e5 (diff) | |
| parent | 20d5739bb5f44413357ee316b30d2d0796c9b255 (diff) | |
Merge "[SurfaceFlinger] Filter out wide color modes for built-in display when necessary." into qt-dev
am: 20d5739bb5
Change-Id: If9caf8111d2b4e88913604cc40834bc23488e314
| -rw-r--r-- | services/surfaceflinger/SurfaceFlinger.cpp | 23 |
1 files changed, 21 insertions, 2 deletions
diff --git a/services/surfaceflinger/SurfaceFlinger.cpp b/services/surfaceflinger/SurfaceFlinger.cpp index 820ccc5de0..dd75868443 100644 --- a/services/surfaceflinger/SurfaceFlinger.cpp +++ b/services/surfaceflinger/SurfaceFlinger.cpp @@ -1049,6 +1049,7 @@ status_t SurfaceFlinger::getDisplayColorModes(const sp<IBinder>& displayToken, } std::vector<ColorMode> modes; + bool isInternalDisplay = false; { ConditionalLock lock(mStateLock, std::this_thread::get_id() != mMainThreadId); @@ -1058,9 +1059,20 @@ status_t SurfaceFlinger::getDisplayColorModes(const sp<IBinder>& displayToken, } modes = getHwComposer().getColorModes(*displayId); + isInternalDisplay = displayId == getInternalDisplayIdLocked(); } outColorModes->clear(); - std::copy(modes.cbegin(), modes.cend(), std::back_inserter(*outColorModes)); + + // If it's built-in display and the configuration claims it's not wide color capable, + // filter out all wide color modes. The typical reason why this happens is that the + // hardware is not good enough to support GPU composition of wide color, and thus the + // OEMs choose to disable this capability. + if (isInternalDisplay && !hasWideColorDisplay) { + std::remove_copy_if(modes.cbegin(), modes.cend(), std::back_inserter(*outColorModes), + isWideColorMode); + } else { + std::copy(modes.cbegin(), modes.cend(), std::back_inserter(*outColorModes)); + } return NO_ERROR; } @@ -1207,6 +1219,13 @@ status_t SurfaceFlinger::isWideColorDisplay(const sp<IBinder>& displayToken, if (!display) { return BAD_VALUE; } + + // Use hasWideColorDisplay to override built-in display. + const auto displayId = display->getId(); + if (displayId && displayId == getInternalDisplayIdLocked()) { + *outIsWideColorDisplay = hasWideColorDisplay; + return NO_ERROR; + } *outIsWideColorDisplay = display->hasWideColorGamut(); return NO_ERROR; } @@ -4746,7 +4765,7 @@ void SurfaceFlinger::dumpDisplayIdentificationData(std::string& result) const { } void SurfaceFlinger::dumpWideColorInfo(std::string& result) const { - StringAppendF(&result, "Device has wide color display: %d\n", hasWideColorDisplay); + StringAppendF(&result, "Device has wide color built-in display: %d\n", hasWideColorDisplay); StringAppendF(&result, "Device uses color management: %d\n", useColorManagement); StringAppendF(&result, "DisplayColorSetting: %s\n", decodeDisplayColorSetting(mDisplayColorSetting).c_str()); |