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

Commit 9a3a98a0 authored by TreeHugger Robot's avatar TreeHugger Robot Committed by Android (Google) Code Review
Browse files

Merge "[SurfaceFlinger] Allow force a supported color mode."

parents 0065a81c a3ea559c
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -303,7 +303,7 @@ void DisplayColorProfile::populateColorModes(
    }

    // add all known HDR combinations
    for (auto intent : sHdrRenderIntents) {
    for (auto intent : hdrRenderIntents) {
        for (auto mode : sHdrColorModes) {
            addColorMode(hwcColorModes, mode, intent);
        }
+109 −111

File changed.

Preview size limit exceeded, changes collapsed.

+14 −0
Original line number Diff line number Diff line
@@ -771,6 +771,9 @@ void SurfaceFlinger::readPersistentProperties() {

    property_get("persist.sys.sf.native_mode", value, "0");
    mDisplayColorSetting = static_cast<DisplayColorSetting>(atoi(value));

    property_get("persist.sys.sf.color_mode", value, "0");
    mForceColorMode = static_cast<ColorMode>(atoi(value));
}

void SurfaceFlinger::startBootAnim() {
@@ -2498,6 +2501,17 @@ void SurfaceFlinger::pickColorMode(const sp<DisplayDevice>& display, ColorMode*

    auto* profile = display->getCompositionDisplay()->getDisplayColorProfile();

    switch (mForceColorMode) {
        case ColorMode::SRGB:
            bestDataSpace = Dataspace::V0_SRGB;
            break;
        case ColorMode::DISPLAY_P3:
            bestDataSpace = Dataspace::DISPLAY_P3;
            break;
        default:
            break;
    }

    // respect hdrDataSpace only when there is no legacy HDR support
    const bool isHdr =
            hdrDataSpace != Dataspace::UNKNOWN && !profile->hasLegacyHdrSupport(hdrDataSpace);
+9 −0
Original line number Diff line number Diff line
@@ -1089,6 +1089,15 @@ private:

    DisplayColorSetting mDisplayColorSetting = DisplayColorSetting::ENHANCED;

    // Color mode forced by setting persist.sys.sf.color_mode, it must:
    //     1. not be NATIVE color mode, NATIVE color mode means no forced color mode;
    //     2. be one of the supported color modes returned by hardware composer, otherwise
    //        it will not be respected.
    // persist.sys.sf.color_mode will only take effect when persist.sys.sf.native_mode
    // is not set to 1.
    // This property can be used to force SurfaceFlinger to always pick a certain color mode.
    ui::ColorMode mForceColorMode = ui::ColorMode::NATIVE;

    ui::Dataspace mDefaultCompositionDataspace;
    ui::Dataspace mWideColorGamutCompositionDataspace;