Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit fca547f4 authored by Peiyong Lin's avatar Peiyong Lin
Browse files

[SurfaceFlinger] Recognize BT2020 color modes as wide color gamut.

BUG: 111208295
Test: Build, flash and play Youtube HDR.
Change-Id: I33c3ad19897eb776fe3fee97701a823775b4c48c
parent b7d63893
Loading
Loading
Loading
Loading
+30 −8
Original line number Original line Diff line number Diff line
@@ -114,6 +114,33 @@ using ui::Hdr;
using ui::RenderIntent;
using ui::RenderIntent;


namespace {
namespace {

#pragma clang diagnostic push
#pragma clang diagnostic error "-Wswitch-enum"

bool isWideColorMode(const ColorMode colorMode) {
    switch (colorMode) {
        case ColorMode::DISPLAY_P3:
        case ColorMode::ADOBE_RGB:
        case ColorMode::DCI_P3:
        case ColorMode::BT2020:
        case ColorMode::BT2100_PQ:
        case ColorMode::BT2100_HLG:
            return true;
        case ColorMode::NATIVE:
        case ColorMode::STANDARD_BT601_625:
        case ColorMode::STANDARD_BT601_625_UNADJUSTED:
        case ColorMode::STANDARD_BT601_525:
        case ColorMode::STANDARD_BT601_525_UNADJUSTED:
        case ColorMode::STANDARD_BT709:
        case ColorMode::SRGB:
            return false;
    }
    return false;
}

#pragma clang diagnostic pop

class ConditionalLock {
class ConditionalLock {
public:
public:
    ConditionalLock(Mutex& mutex, bool lock) : mMutex(mutex), mLocked(lock) {
    ConditionalLock(Mutex& mutex, bool lock) : mMutex(mutex), mLocked(lock) {
@@ -126,6 +153,7 @@ private:
    Mutex& mMutex;
    Mutex& mMutex;
    bool mLocked;
    bool mLocked;
};
};

}  // namespace anonymous
}  // namespace anonymous


// ---------------------------------------------------------------------------
// ---------------------------------------------------------------------------
@@ -2262,14 +2290,8 @@ sp<DisplayDevice> SurfaceFlinger::setupNewDisplayDeviceInternal(
    if (hasWideColorDisplay) {
    if (hasWideColorDisplay) {
        std::vector<ColorMode> modes = getHwComposer().getColorModes(displayId);
        std::vector<ColorMode> modes = getHwComposer().getColorModes(displayId);
        for (ColorMode colorMode : modes) {
        for (ColorMode colorMode : modes) {
            switch (colorMode) {
            if (isWideColorMode(colorMode)) {
                case ColorMode::DISPLAY_P3:
                case ColorMode::ADOBE_RGB:
                case ColorMode::DCI_P3:
                hasWideColorGamut = true;
                hasWideColorGamut = true;
                    break;
                default:
                    break;
            }
            }


            std::vector<RenderIntent> renderIntents =
            std::vector<RenderIntent> renderIntents =