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

Commit a0c93e10 authored by Courtney Goeltzenleuchter's avatar Courtney Goeltzenleuchter
Browse files

Check board config for wide-color color spaces

Check that board config allows wide-color color
spaces.
Test: make tests in libs/gui/tests/
Test: adb sync
Test: adb shell /data/nativetest/libgui_test/libgui_test --gtest_filter="SurfaceTest.GetWideColorSupport"

bug #35996305

Change-Id: Ia5b8116bc25befb6491e72e67cd8ed3c90ca5698
parent 79dd190c
Loading
Loading
Loading
Loading
+4 −0
Original line number Original line Diff line number Diff line
@@ -112,9 +112,11 @@ cc_library_shared {
        "libnativewindow",
        "libnativewindow",
        "liblog",
        "liblog",
        "libhidlbase",
        "libhidlbase",
        "libhidltransport",
        "android.hidl.base@1.0",
        "android.hidl.base@1.0",
        "android.hidl.token@1.0-utils",
        "android.hidl.token@1.0-utils",
        "android.hardware.graphics.bufferqueue@1.0",
        "android.hardware.graphics.bufferqueue@1.0",
        "android.hardware.configstore@1.0",
    ],
    ],


    export_shared_lib_headers: [
    export_shared_lib_headers: [
@@ -123,6 +125,8 @@ cc_library_shared {
        "android.hidl.token@1.0-utils",
        "android.hidl.token@1.0-utils",
        "android.hardware.graphics.bufferqueue@1.0",
        "android.hardware.graphics.bufferqueue@1.0",
    ],
    ],

    header_libs: ["android.hardware.configstore-utils"],
}
}


subdirs = ["tests"]
subdirs = ["tests"]
+13 −1
Original line number Original line Diff line number Diff line
@@ -37,6 +37,9 @@
#include <gui/ISurfaceComposer.h>
#include <gui/ISurfaceComposer.h>
#include <private/gui/ComposerService.h>
#include <private/gui/ComposerService.h>


#include <android/hardware/configstore/1.0/ISurfaceFlingerConfigs.h>
#include <configstore/Utils.h>

namespace android {
namespace android {


Surface::Surface(
Surface::Surface(
@@ -289,6 +292,9 @@ status_t Surface::getFrameTimestamps(uint64_t frameNumber,
    return NO_ERROR;
    return NO_ERROR;
}
}


using namespace android::hardware::configstore;
using namespace android::hardware::configstore::V1_0;

status_t Surface::getWideColorSupport(bool* supported) {
status_t Surface::getWideColorSupport(bool* supported) {
    ATRACE_CALL();
    ATRACE_CALL();


@@ -301,13 +307,19 @@ status_t Surface::getWideColorSupport(bool* supported) {
    if (err)
    if (err)
        return err;
        return err;


    bool wideColorBoardConfig =
        getBool<ISurfaceFlingerConfigs,
                &ISurfaceFlingerConfigs::hasWideColorDisplay>(false);

    *supported = false;
    *supported = false;
    for (android_color_mode_t colorMode : colorModes) {
    for (android_color_mode_t colorMode : colorModes) {
        switch (colorMode) {
        switch (colorMode) {
            case HAL_COLOR_MODE_DISPLAY_P3:
            case HAL_COLOR_MODE_DISPLAY_P3:
            case HAL_COLOR_MODE_ADOBE_RGB:
            case HAL_COLOR_MODE_ADOBE_RGB:
            case HAL_COLOR_MODE_DCI_P3:
            case HAL_COLOR_MODE_DCI_P3:
                if (wideColorBoardConfig) {
                    *supported = true;
                    *supported = true;
                }
                break;
                break;
            default:
            default:
                break;
                break;