diff options
10 files changed, 48 insertions, 23 deletions
diff --git a/include/android/display_luts.h b/include/android/display_luts.h index 08dfb12d6c..eae2bfd351 100644 --- a/include/android/display_luts.h +++ b/include/android/display_luts.h @@ -43,6 +43,7 @@ typedef enum ADisplayLuts_Dimension ADisplayLuts_Dimension; enum ADisplayLuts_SamplingKey : int32_t { ADISPLAYLUTS_SAMPLINGKEY_RGB = 0, ADISPLAYLUTS_SAMPLINGKEY_MAX_RGB = 1, + ADISPLAYLUTS_SAMPLINGKEY_CIE_Y = 2, }; typedef enum ADisplayLuts_SamplingKey ADisplayLuts_SamplingKey; @@ -74,7 +75,8 @@ typedef struct ADisplayLuts ADisplayLuts; * @return a new \a ADisplayLutsEntry instance. */ ADisplayLutsEntry* _Nonnull ADisplayLutsEntry_createEntry(float* _Nonnull buffer, - int32_t length, int32_t dimension, int32_t key) __INTRODUCED_IN(36); + int32_t length, ADisplayLuts_Dimension dimension, ADisplayLuts_SamplingKey key) + __INTRODUCED_IN(36); /** * Destroy the \a ADisplayLutsEntry instance. diff --git a/include/private/display_luts_private.h b/include/private/display_luts_private.h index 240e1f98cf..c347a0c85d 100644 --- a/include/private/display_luts_private.h +++ b/include/private/display_luts_private.h @@ -16,6 +16,7 @@ #pragma once +#include <android/display_luts.h> #include <stdint.h> #include <vector> #include <utils/RefBase.h> @@ -29,9 +30,9 @@ struct ADisplayLutsEntry_buffer { }; struct ADisplayLutsEntry_properties { - int32_t dimension; + ADisplayLuts_Dimension dimension; int32_t size; - int32_t samplingKey; + ADisplayLuts_SamplingKey samplingKey; }; struct ADisplayLutsEntry: public RefBase { diff --git a/services/surfaceflinger/DisplayHardware/AidlComposerHal.cpp b/services/surfaceflinger/DisplayHardware/AidlComposerHal.cpp index b83f2ab9bb..25f6513ffa 100644 --- a/services/surfaceflinger/DisplayHardware/AidlComposerHal.cpp +++ b/services/surfaceflinger/DisplayHardware/AidlComposerHal.cpp @@ -37,10 +37,6 @@ namespace android { -using hardware::hidl_handle; -using hardware::hidl_vec; -using hardware::Return; - using aidl::android::hardware::graphics::composer3::BnComposerCallback; using aidl::android::hardware::graphics::composer3::Capability; using aidl::android::hardware::graphics::composer3::ClientTargetPropertyWithBrightness; @@ -524,11 +520,15 @@ Error AidlComposer::getColorModes(Display display, std::vector<ColorMode>* outMo Error AidlComposer::getDisplayAttribute(Display display, Config config, IComposerClient::Attribute attribute, int32_t* outValue) { +#pragma clang diagnostic push +#pragma clang diagnostic ignored "-Wdeprecated-declarations" const auto status = mAidlComposerClient->getDisplayAttribute(translate<int64_t>(display), translate<int32_t>(config), static_cast<AidlDisplayAttribute>(attribute), outValue); +#pragma clang diagnostic pop + if (!status.isOk()) { ALOGE("getDisplayAttribute failed %s", status.getDescription().c_str()); return static_cast<Error>(status.getServiceSpecificError()); @@ -538,8 +538,13 @@ Error AidlComposer::getDisplayAttribute(Display display, Config config, Error AidlComposer::getDisplayConfigs(Display display, std::vector<Config>* outConfigs) { std::vector<int32_t> configs; + +#pragma clang diagnostic push +#pragma clang diagnostic ignored "-Wdeprecated-declarations" const auto status = mAidlComposerClient->getDisplayConfigs(translate<int64_t>(display), &configs); +#pragma clang diagnostic pop + if (!status.isOk()) { ALOGE("getDisplayConfigs failed %s", status.getDescription().c_str()); return static_cast<Error>(status.getServiceSpecificError()); diff --git a/services/surfaceflinger/DisplayHardware/AidlComposerHal.h b/services/surfaceflinger/DisplayHardware/AidlComposerHal.h index db63d3e359..6b5ebc59a3 100644 --- a/services/surfaceflinger/DisplayHardware/AidlComposerHal.h +++ b/services/surfaceflinger/DisplayHardware/AidlComposerHal.h @@ -27,11 +27,6 @@ #include <utility> #include <vector> -// TODO(b/129481165): remove the #pragma below and fix conversion issues -#pragma clang diagnostic push -#pragma clang diagnostic ignored "-Wconversion" -#pragma clang diagnostic ignored "-Wextra" - #include <android/hardware/graphics/composer/2.4/IComposer.h> #include <android/hardware/graphics/composer/2.4/IComposerClient.h> @@ -43,9 +38,6 @@ #include <aidl/android/hardware/graphics/composer3/Composition.h> #include <aidl/android/hardware/graphics/composer3/DisplayCapability.h> -// TODO(b/129481165): remove the #pragma below and fix conversion issues -#pragma clang diagnostic pop // ignored "-Wconversion -Wextra" - namespace android::Hwc2 { using aidl::android::hardware::graphics::common::DisplayDecorationSupport; diff --git a/services/surfaceflinger/DisplayHardware/DisplayMode.h b/services/surfaceflinger/DisplayHardware/DisplayMode.h index 224f50e78e..e90b5b70cb 100644 --- a/services/surfaceflinger/DisplayHardware/DisplayMode.h +++ b/services/surfaceflinger/DisplayHardware/DisplayMode.h @@ -31,10 +31,11 @@ #include <common/FlagManager.h> #include <scheduler/Fps.h> -#include "DisplayHardware/Hal.h" +#include "Hal.h" namespace android { +using aidl::android::hardware::graphics::composer3::OutputType; namespace hal = android::hardware::graphics::composer::hal; class DisplayMode; @@ -114,6 +115,11 @@ public: return *this; } + Builder& setHdrOutputType(OutputType type) { + mDisplayMode->mHdrOutputType = type; + return *this; + } + private: float getDefaultDensity() { // Default density is based on TVs: 1080p displays get XHIGH density, lower- @@ -166,6 +172,8 @@ public: // without visual interruptions such as a black screen. int32_t getGroup() const { return mGroup; } + OutputType getHdrOutputType() const { return mHdrOutputType; } + private: explicit DisplayMode(hal::HWConfigId id) : mHwcId(id) {} @@ -179,21 +187,25 @@ private: Dpi mDpi; int32_t mGroup = -1; std::optional<hal::VrrConfig> mVrrConfig; + OutputType mHdrOutputType; }; inline bool equalsExceptDisplayModeId(const DisplayMode& lhs, const DisplayMode& rhs) { return lhs.getHwcId() == rhs.getHwcId() && lhs.getResolution() == rhs.getResolution() && lhs.getVsyncRate().getPeriodNsecs() == rhs.getVsyncRate().getPeriodNsecs() && - lhs.getDpi() == rhs.getDpi() && lhs.getGroup() == rhs.getGroup(); + lhs.getDpi() == rhs.getDpi() && lhs.getGroup() == rhs.getGroup() && + lhs.getVrrConfig() == rhs.getVrrConfig() && + lhs.getHdrOutputType() == rhs.getHdrOutputType(); } inline std::string to_string(const DisplayMode& mode) { return base::StringPrintf("{id=%d, hwcId=%d, resolution=%dx%d, vsyncRate=%s, " - "dpi=%.2fx%.2f, group=%d, vrrConfig=%s}", + "dpi=%.2fx%.2f, group=%d, vrrConfig=%s, supportedHdrTypes=%s}", ftl::to_underlying(mode.getId()), mode.getHwcId(), mode.getWidth(), mode.getHeight(), to_string(mode.getVsyncRate()).c_str(), mode.getDpi().x, mode.getDpi().y, mode.getGroup(), - to_string(mode.getVrrConfig()).c_str()); + to_string(mode.getVrrConfig()).c_str(), + toString(mode.getHdrOutputType()).c_str()); } template <typename... DisplayModePtrs> diff --git a/services/surfaceflinger/DisplayHardware/HWComposer.cpp b/services/surfaceflinger/DisplayHardware/HWComposer.cpp index 9943856297..55ccdefa7a 100644 --- a/services/surfaceflinger/DisplayHardware/HWComposer.cpp +++ b/services/surfaceflinger/DisplayHardware/HWComposer.cpp @@ -336,7 +336,8 @@ std::vector<HWComposer::HWCDisplayMode> HWComposer::getModesFromDisplayConfigura .height = config.height, .vsyncPeriod = config.vsyncPeriod, .configGroup = config.configGroup, - .vrrConfig = config.vrrConfig}; + .vrrConfig = config.vrrConfig, + .hdrOutputType = config.hdrOutputType}; const DisplayConfiguration::Dpi estimatedDPI = getEstimatedDotsPerInchFromSize(hwcDisplayId, hwcMode); diff --git a/services/surfaceflinger/DisplayHardware/HWComposer.h b/services/surfaceflinger/DisplayHardware/HWComposer.h index e21ce1d095..52662cffbb 100644 --- a/services/surfaceflinger/DisplayHardware/HWComposer.h +++ b/services/surfaceflinger/DisplayHardware/HWComposer.h @@ -55,6 +55,7 @@ #include <aidl/android/hardware/graphics/composer3/DisplayCapability.h> #include <aidl/android/hardware/graphics/composer3/DisplayLuts.h> #include <aidl/android/hardware/graphics/composer3/LutProperties.h> +#include <aidl/android/hardware/graphics/composer3/OutputType.h> #include <aidl/android/hardware/graphics/composer3/OverlayProperties.h> namespace android { @@ -112,12 +113,14 @@ public: float dpiY = -1.f; int32_t configGroup = -1; std::optional<hal::VrrConfig> vrrConfig; + OutputType hdrOutputType; friend std::ostream& operator<<(std::ostream& os, const HWCDisplayMode& mode) { return os << "id=" << mode.hwcId << " res=" << mode.width << "x" << mode.height << " vsyncPeriod=" << mode.vsyncPeriod << " dpi=" << mode.dpiX << "x" << mode.dpiY << " group=" << mode.configGroup - << " vrrConfig=" << to_string(mode.vrrConfig).c_str(); + << " vrrConfig=" << to_string(mode.vrrConfig).c_str() + << " hdrOutputType=" << toString(mode.hdrOutputType); } }; diff --git a/services/surfaceflinger/SurfaceFlinger.cpp b/services/surfaceflinger/SurfaceFlinger.cpp index 4b36edc696..3d5002e009 100644 --- a/services/surfaceflinger/SurfaceFlinger.cpp +++ b/services/surfaceflinger/SurfaceFlinger.cpp @@ -172,6 +172,7 @@ #include <aidl/android/hardware/graphics/common/DisplayDecorationSupport.h> #include <aidl/android/hardware/graphics/composer3/DisplayCapability.h> +#include <aidl/android/hardware/graphics/composer3/OutputType.h> #include <aidl/android/hardware/graphics/composer3/RenderIntent.h> #undef NO_THREAD_SAFETY_ANALYSIS @@ -3509,6 +3510,9 @@ std::pair<DisplayModes, DisplayModePtr> SurfaceFlinger::loadDisplayModes( DisplayModes newModes; for (const auto& hwcMode : hwcModes) { const auto id = nextModeId++; + OutputType hdrOutputType = FlagManager::getInstance().connected_display_hdr() + ? hwcMode.hdrOutputType + : OutputType::INVALID; newModes.try_emplace(id, DisplayMode::Builder(hwcMode.hwcId) .setId(id) @@ -3519,6 +3523,7 @@ std::pair<DisplayModes, DisplayModePtr> SurfaceFlinger::loadDisplayModes( .setDpiX(hwcMode.dpiX) .setDpiY(hwcMode.dpiY) .setGroup(hwcMode.configGroup) + .setHdrOutputType(hdrOutputType) .build()); } diff --git a/services/surfaceflinger/common/FlagManager.cpp b/services/surfaceflinger/common/FlagManager.cpp index 3960bf6773..e28a0c1ebc 100644 --- a/services/surfaceflinger/common/FlagManager.cpp +++ b/services/surfaceflinger/common/FlagManager.cpp @@ -259,7 +259,7 @@ FLAG_MANAGER_ACONFIG_FLAG(flush_buffer_slots_to_uncache, ""); FLAG_MANAGER_ACONFIG_FLAG(force_compile_graphite_renderengine, ""); FLAG_MANAGER_ACONFIG_FLAG(true_hdr_screenshots, "debug.sf.true_hdr_screenshots"); FLAG_MANAGER_ACONFIG_FLAG(display_config_error_hal, ""); -FLAG_MANAGER_ACONFIG_FLAG(connected_display_hdr, ""); +FLAG_MANAGER_ACONFIG_FLAG(connected_display_hdr, "debug.sf.connected_display_hdr"); FLAG_MANAGER_ACONFIG_FLAG(deprecate_frame_tracker, ""); FLAG_MANAGER_ACONFIG_FLAG(skip_invisible_windows_in_input, ""); FLAG_MANAGER_ACONFIG_FLAG(begone_bright_hlg, "debug.sf.begone_bright_hlg"); diff --git a/services/surfaceflinger/tests/unittests/HWComposerTest.cpp b/services/surfaceflinger/tests/unittests/HWComposerTest.cpp index 30bce2e472..ba2d3e28ad 100644 --- a/services/surfaceflinger/tests/unittests/HWComposerTest.cpp +++ b/services/surfaceflinger/tests/unittests/HWComposerTest.cpp @@ -384,6 +384,7 @@ TEST_F(HWComposerTest, getModesWithDisplayConfigurations_VRR_ON) { const ui::Size size = info->preferredDetailedTimingDescriptor->physicalSizeInMm; const float expectedDpiX = (kWidth * kMmPerInch / size.width); const float expectedDpiY = (kHeight * kMmPerInch / size.height); + const OutputType hdrOutputType = OutputType::SYSTEM; const hal::VrrConfig vrrConfig = hal::VrrConfig{.minFrameIntervalNs = static_cast<Fps>(120_Hz).getPeriodNsecs(), .notifyExpectedPresentConfig = hal::VrrConfig:: @@ -394,7 +395,8 @@ TEST_F(HWComposerTest, getModesWithDisplayConfigurations_VRR_ON) { .height = kHeight, .configGroup = kConfigGroup, .vsyncPeriod = kVsyncPeriod, - .vrrConfig = vrrConfig}; + .vrrConfig = vrrConfig, + .hdrOutputType = hdrOutputType}; EXPECT_CALL(*mHal, getDisplayConfigurations(kHwcDisplayId, _, _)) .WillOnce(DoAll(SetArgPointee<2>(std::vector<hal::DisplayConfiguration>{ @@ -410,6 +412,7 @@ TEST_F(HWComposerTest, getModesWithDisplayConfigurations_VRR_ON) { EXPECT_EQ(modes.front().configGroup, kConfigGroup); EXPECT_EQ(modes.front().vsyncPeriod, kVsyncPeriod); EXPECT_EQ(modes.front().vrrConfig, vrrConfig); + EXPECT_EQ(modes.front().hdrOutputType, hdrOutputType); if (!FlagManager::getInstance().correct_dpi_with_display_size()) { EXPECT_EQ(modes.front().dpiX, -1); EXPECT_EQ(modes.front().dpiY, -1); @@ -435,6 +438,7 @@ TEST_F(HWComposerTest, getModesWithDisplayConfigurations_VRR_ON) { EXPECT_EQ(modes.front().configGroup, kConfigGroup); EXPECT_EQ(modes.front().vsyncPeriod, kVsyncPeriod); EXPECT_EQ(modes.front().vrrConfig, vrrConfig); + EXPECT_EQ(modes.front().hdrOutputType, hdrOutputType); EXPECT_EQ(modes.front().dpiX, kDpi); EXPECT_EQ(modes.front().dpiY, kDpi); |