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

Commit 9758ae05 authored by Valerie Hau's avatar Valerie Hau
Browse files

Support DISPLAY_P3 dataspace to BT2020 in SF

Adding support to fallback to ColorMode BT2020 with
SRGB when P3 layers are present when external display supports BT2020 with SRGB
transfer function.  (Before fallback was to BT709_sRGB)

Bug: 115335239
Test: ./libsurfaceflinger_unittest --gtest_filter=GetBestColorModeTest.*
Change-Id: Iec7154d411cb3dcc4fd1158199bc45207799bb27
parent 5a3a2312
Loading
Loading
Loading
Loading
+2 −2
Original line number Original line Diff line number Diff line
@@ -78,7 +78,7 @@ cc_library_shared {


    shared_libs: [
    shared_libs: [
        "android.hardware.graphics.allocator@2.0",
        "android.hardware.graphics.allocator@2.0",
        "android.hardware.graphics.common@1.1",
        "android.hardware.graphics.common@1.2",
        "android.hardware.graphics.mapper@2.0",
        "android.hardware.graphics.mapper@2.0",
        "android.hardware.graphics.mapper@2.1",
        "android.hardware.graphics.mapper@2.1",
        "android.hardware.configstore@1.0",
        "android.hardware.configstore@1.0",
@@ -97,7 +97,7 @@ cc_library_shared {
    ],
    ],


    export_shared_lib_headers: [
    export_shared_lib_headers: [
        "android.hardware.graphics.common@1.1",
        "android.hardware.graphics.common@1.2",
    ],
    ],


    static_libs: [
    static_libs: [
+3 −0
Original line number Original line Diff line number Diff line
@@ -234,6 +234,9 @@ std::string decodeColorMode(ColorMode colorMode) {
        case ColorMode::BT2020:
        case ColorMode::BT2020:
            return std::string("ColorMode::BT2020");
            return std::string("ColorMode::BT2020");


        case ColorMode::DISPLAY_BT2020:
            return std::string("ColorMode::DISPLAY_BT2020");

        case ColorMode::BT2100_PQ:
        case ColorMode::BT2100_PQ:
            return std::string("ColorMode::BT2100_PQ");
            return std::string("ColorMode::BT2100_PQ");


+3 −2
Original line number Original line Diff line number Diff line
@@ -17,6 +17,7 @@
#pragma once
#pragma once


#include <android/hardware/graphics/common/1.1/types.h>
#include <android/hardware/graphics/common/1.1/types.h>
#include <android/hardware/graphics/common/1.2/types.h>
#include <system/graphics.h>
#include <system/graphics.h>


// android::ui::* in this header file will alias different types as
// android::ui::* in this header file will alias different types as
@@ -25,10 +26,10 @@ namespace android {
namespace ui {
namespace ui {


using android::hardware::graphics::common::V1_0::Hdr;
using android::hardware::graphics::common::V1_0::Hdr;
using android::hardware::graphics::common::V1_1::ColorMode;
using android::hardware::graphics::common::V1_1::Dataspace;
using android::hardware::graphics::common::V1_1::PixelFormat;
using android::hardware::graphics::common::V1_1::PixelFormat;
using android::hardware::graphics::common::V1_1::RenderIntent;
using android::hardware::graphics::common::V1_1::RenderIntent;
using android::hardware::graphics::common::V1_2::ColorMode;
using android::hardware::graphics::common::V1_2::Dataspace;


}  // namespace ui
}  // namespace ui
}  // namespace android
}  // namespace android
+2 −0
Original line number Original line Diff line number Diff line
@@ -30,6 +30,7 @@ cc_defaults {
        "android.hardware.configstore@1.1",
        "android.hardware.configstore@1.1",
        "android.hardware.configstore@1.2",
        "android.hardware.configstore@1.2",
        "android.hardware.graphics.allocator@2.0",
        "android.hardware.graphics.allocator@2.0",
        "android.hardware.graphics.common@1.2",
        "android.hardware.graphics.composer@2.1",
        "android.hardware.graphics.composer@2.1",
        "android.hardware.graphics.composer@2.2",
        "android.hardware.graphics.composer@2.2",
        "android.hardware.graphics.composer@2.3",
        "android.hardware.graphics.composer@2.3",
@@ -79,6 +80,7 @@ cc_defaults {
    ],
    ],
    export_shared_lib_headers: [
    export_shared_lib_headers: [
        "android.hardware.graphics.allocator@2.0",
        "android.hardware.graphics.allocator@2.0",
        "android.hardware.graphics.common@1.2",
        "android.hardware.graphics.composer@2.1",
        "android.hardware.graphics.composer@2.1",
        "android.hardware.graphics.composer@2.2",
        "android.hardware.graphics.composer@2.2",
        "android.hardware.graphics.composer@2.3",
        "android.hardware.graphics.composer@2.3",
+5 −2
Original line number Original line Diff line number Diff line
@@ -37,8 +37,8 @@
#include <ui/DebugUtils.h>
#include <ui/DebugUtils.h>
#include <ui/DisplayInfo.h>
#include <ui/DisplayInfo.h>
#include <ui/PixelFormat.h>
#include <ui/PixelFormat.h>
#include <utils/RefBase.h>
#include <utils/Log.h>
#include <utils/Log.h>
#include <utils/RefBase.h>


#include "DisplayHardware/DisplaySurface.h"
#include "DisplayHardware/DisplaySurface.h"
#include "DisplayHardware/HWComposer.h"
#include "DisplayHardware/HWComposer.h"
@@ -66,7 +66,8 @@ uint32_t DisplayDevice::sPrimaryDisplayOrientation = 0;
namespace {
namespace {


// ordered list of known SDR color modes
// ordered list of known SDR color modes
const std::array<ColorMode, 2> sSdrColorModes = {
const std::array<ColorMode, 3> sSdrColorModes = {
        ColorMode::DISPLAY_BT2020,
        ColorMode::DISPLAY_P3,
        ColorMode::DISPLAY_P3,
        ColorMode::SRGB,
        ColorMode::SRGB,
};
};
@@ -96,6 +97,8 @@ Dataspace colorModeToDataspace(ColorMode mode) {
            return Dataspace::SRGB;
            return Dataspace::SRGB;
        case ColorMode::DISPLAY_P3:
        case ColorMode::DISPLAY_P3:
            return Dataspace::DISPLAY_P3;
            return Dataspace::DISPLAY_P3;
        case ColorMode::DISPLAY_BT2020:
            return Dataspace::DISPLAY_BT2020;
        case ColorMode::BT2100_HLG:
        case ColorMode::BT2100_HLG:
            return Dataspace::BT2020_HLG;
            return Dataspace::BT2020_HLG;
        case ColorMode::BT2100_PQ:
        case ColorMode::BT2100_PQ:
Loading