Loading services/surfaceflinger/DisplayHardware/DisplayMode.h +16 −4 Original line number Original line Diff line number Diff line Loading @@ -31,10 +31,11 @@ #include <common/FlagManager.h> #include <common/FlagManager.h> #include <scheduler/Fps.h> #include <scheduler/Fps.h> #include "DisplayHardware/Hal.h" #include "Hal.h" namespace android { namespace android { using aidl::android::hardware::graphics::composer3::OutputType; namespace hal = android::hardware::graphics::composer::hal; namespace hal = android::hardware::graphics::composer::hal; class DisplayMode; class DisplayMode; Loading Loading @@ -114,6 +115,11 @@ public: return *this; return *this; } } Builder& setHdrOutputType(OutputType type) { mDisplayMode->mHdrOutputType = type; return *this; } private: private: float getDefaultDensity() { float getDefaultDensity() { // Default density is based on TVs: 1080p displays get XHIGH density, lower- // Default density is based on TVs: 1080p displays get XHIGH density, lower- Loading Loading @@ -166,6 +172,8 @@ public: // without visual interruptions such as a black screen. // without visual interruptions such as a black screen. int32_t getGroup() const { return mGroup; } int32_t getGroup() const { return mGroup; } OutputType getHdrOutputType() const { return mHdrOutputType; } private: private: explicit DisplayMode(hal::HWConfigId id) : mHwcId(id) {} explicit DisplayMode(hal::HWConfigId id) : mHwcId(id) {} Loading @@ -179,21 +187,25 @@ private: Dpi mDpi; Dpi mDpi; int32_t mGroup = -1; int32_t mGroup = -1; std::optional<hal::VrrConfig> mVrrConfig; std::optional<hal::VrrConfig> mVrrConfig; OutputType mHdrOutputType; }; }; inline bool equalsExceptDisplayModeId(const DisplayMode& lhs, const DisplayMode& rhs) { inline bool equalsExceptDisplayModeId(const DisplayMode& lhs, const DisplayMode& rhs) { return lhs.getHwcId() == rhs.getHwcId() && lhs.getResolution() == rhs.getResolution() && return lhs.getHwcId() == rhs.getHwcId() && lhs.getResolution() == rhs.getResolution() && lhs.getVsyncRate().getPeriodNsecs() == rhs.getVsyncRate().getPeriodNsecs() && 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) { inline std::string to_string(const DisplayMode& mode) { return base::StringPrintf("{id=%d, hwcId=%d, resolution=%dx%d, vsyncRate=%s, " 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(), ftl::to_underlying(mode.getId()), mode.getHwcId(), mode.getWidth(), mode.getHeight(), to_string(mode.getVsyncRate()).c_str(), mode.getHeight(), to_string(mode.getVsyncRate()).c_str(), mode.getDpi().x, mode.getDpi().y, mode.getGroup(), 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> template <typename... DisplayModePtrs> Loading services/surfaceflinger/DisplayHardware/HWComposer.cpp +2 −1 Original line number Original line Diff line number Diff line Loading @@ -336,7 +336,8 @@ std::vector<HWComposer::HWCDisplayMode> HWComposer::getModesFromDisplayConfigura .height = config.height, .height = config.height, .vsyncPeriod = config.vsyncPeriod, .vsyncPeriod = config.vsyncPeriod, .configGroup = config.configGroup, .configGroup = config.configGroup, .vrrConfig = config.vrrConfig}; .vrrConfig = config.vrrConfig, .hdrOutputType = config.hdrOutputType}; const DisplayConfiguration::Dpi estimatedDPI = const DisplayConfiguration::Dpi estimatedDPI = getEstimatedDotsPerInchFromSize(hwcDisplayId, hwcMode); getEstimatedDotsPerInchFromSize(hwcDisplayId, hwcMode); Loading services/surfaceflinger/DisplayHardware/HWComposer.h +4 −1 Original line number Original line Diff line number Diff line Loading @@ -55,6 +55,7 @@ #include <aidl/android/hardware/graphics/composer3/DisplayCapability.h> #include <aidl/android/hardware/graphics/composer3/DisplayCapability.h> #include <aidl/android/hardware/graphics/composer3/DisplayLuts.h> #include <aidl/android/hardware/graphics/composer3/DisplayLuts.h> #include <aidl/android/hardware/graphics/composer3/LutProperties.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> #include <aidl/android/hardware/graphics/composer3/OverlayProperties.h> namespace android { namespace android { Loading Loading @@ -112,12 +113,14 @@ public: float dpiY = -1.f; float dpiY = -1.f; int32_t configGroup = -1; int32_t configGroup = -1; std::optional<hal::VrrConfig> vrrConfig; std::optional<hal::VrrConfig> vrrConfig; OutputType hdrOutputType; friend std::ostream& operator<<(std::ostream& os, const HWCDisplayMode& mode) { friend std::ostream& operator<<(std::ostream& os, const HWCDisplayMode& mode) { return os << "id=" << mode.hwcId << " res=" << mode.width << "x" << mode.height return os << "id=" << mode.hwcId << " res=" << mode.width << "x" << mode.height << " vsyncPeriod=" << mode.vsyncPeriod << " dpi=" << mode.dpiX << "x" << " vsyncPeriod=" << mode.vsyncPeriod << " dpi=" << mode.dpiX << "x" << mode.dpiY << " group=" << mode.configGroup << mode.dpiY << " group=" << mode.configGroup << " vrrConfig=" << to_string(mode.vrrConfig).c_str(); << " vrrConfig=" << to_string(mode.vrrConfig).c_str() << " hdrOutputType=" << toString(mode.hdrOutputType); } } }; }; Loading services/surfaceflinger/SurfaceFlinger.cpp +5 −0 Original line number Original line Diff line number Diff line Loading @@ -172,6 +172,7 @@ #include <aidl/android/hardware/graphics/common/DisplayDecorationSupport.h> #include <aidl/android/hardware/graphics/common/DisplayDecorationSupport.h> #include <aidl/android/hardware/graphics/composer3/DisplayCapability.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> #include <aidl/android/hardware/graphics/composer3/RenderIntent.h> #undef NO_THREAD_SAFETY_ANALYSIS #undef NO_THREAD_SAFETY_ANALYSIS Loading Loading @@ -3509,6 +3510,9 @@ std::pair<DisplayModes, DisplayModePtr> SurfaceFlinger::loadDisplayModes( DisplayModes newModes; DisplayModes newModes; for (const auto& hwcMode : hwcModes) { for (const auto& hwcMode : hwcModes) { const auto id = nextModeId++; const auto id = nextModeId++; OutputType hdrOutputType = FlagManager::getInstance().connected_display_hdr() ? hwcMode.hdrOutputType : OutputType::INVALID; newModes.try_emplace(id, newModes.try_emplace(id, DisplayMode::Builder(hwcMode.hwcId) DisplayMode::Builder(hwcMode.hwcId) .setId(id) .setId(id) Loading @@ -3519,6 +3523,7 @@ std::pair<DisplayModes, DisplayModePtr> SurfaceFlinger::loadDisplayModes( .setDpiX(hwcMode.dpiX) .setDpiX(hwcMode.dpiX) .setDpiY(hwcMode.dpiY) .setDpiY(hwcMode.dpiY) .setGroup(hwcMode.configGroup) .setGroup(hwcMode.configGroup) .setHdrOutputType(hdrOutputType) .build()); .build()); } } Loading services/surfaceflinger/common/FlagManager.cpp +1 −1 Original line number Original line Diff line number Diff line Loading @@ -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(force_compile_graphite_renderengine, ""); FLAG_MANAGER_ACONFIG_FLAG(true_hdr_screenshots, "debug.sf.true_hdr_screenshots"); FLAG_MANAGER_ACONFIG_FLAG(true_hdr_screenshots, "debug.sf.true_hdr_screenshots"); FLAG_MANAGER_ACONFIG_FLAG(display_config_error_hal, ""); 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(deprecate_frame_tracker, ""); FLAG_MANAGER_ACONFIG_FLAG(skip_invisible_windows_in_input, ""); FLAG_MANAGER_ACONFIG_FLAG(skip_invisible_windows_in_input, ""); FLAG_MANAGER_ACONFIG_FLAG(begone_bright_hlg, "debug.sf.begone_bright_hlg"); FLAG_MANAGER_ACONFIG_FLAG(begone_bright_hlg, "debug.sf.begone_bright_hlg"); Loading Loading
services/surfaceflinger/DisplayHardware/DisplayMode.h +16 −4 Original line number Original line Diff line number Diff line Loading @@ -31,10 +31,11 @@ #include <common/FlagManager.h> #include <common/FlagManager.h> #include <scheduler/Fps.h> #include <scheduler/Fps.h> #include "DisplayHardware/Hal.h" #include "Hal.h" namespace android { namespace android { using aidl::android::hardware::graphics::composer3::OutputType; namespace hal = android::hardware::graphics::composer::hal; namespace hal = android::hardware::graphics::composer::hal; class DisplayMode; class DisplayMode; Loading Loading @@ -114,6 +115,11 @@ public: return *this; return *this; } } Builder& setHdrOutputType(OutputType type) { mDisplayMode->mHdrOutputType = type; return *this; } private: private: float getDefaultDensity() { float getDefaultDensity() { // Default density is based on TVs: 1080p displays get XHIGH density, lower- // Default density is based on TVs: 1080p displays get XHIGH density, lower- Loading Loading @@ -166,6 +172,8 @@ public: // without visual interruptions such as a black screen. // without visual interruptions such as a black screen. int32_t getGroup() const { return mGroup; } int32_t getGroup() const { return mGroup; } OutputType getHdrOutputType() const { return mHdrOutputType; } private: private: explicit DisplayMode(hal::HWConfigId id) : mHwcId(id) {} explicit DisplayMode(hal::HWConfigId id) : mHwcId(id) {} Loading @@ -179,21 +187,25 @@ private: Dpi mDpi; Dpi mDpi; int32_t mGroup = -1; int32_t mGroup = -1; std::optional<hal::VrrConfig> mVrrConfig; std::optional<hal::VrrConfig> mVrrConfig; OutputType mHdrOutputType; }; }; inline bool equalsExceptDisplayModeId(const DisplayMode& lhs, const DisplayMode& rhs) { inline bool equalsExceptDisplayModeId(const DisplayMode& lhs, const DisplayMode& rhs) { return lhs.getHwcId() == rhs.getHwcId() && lhs.getResolution() == rhs.getResolution() && return lhs.getHwcId() == rhs.getHwcId() && lhs.getResolution() == rhs.getResolution() && lhs.getVsyncRate().getPeriodNsecs() == rhs.getVsyncRate().getPeriodNsecs() && 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) { inline std::string to_string(const DisplayMode& mode) { return base::StringPrintf("{id=%d, hwcId=%d, resolution=%dx%d, vsyncRate=%s, " 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(), ftl::to_underlying(mode.getId()), mode.getHwcId(), mode.getWidth(), mode.getHeight(), to_string(mode.getVsyncRate()).c_str(), mode.getHeight(), to_string(mode.getVsyncRate()).c_str(), mode.getDpi().x, mode.getDpi().y, mode.getGroup(), 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> template <typename... DisplayModePtrs> Loading
services/surfaceflinger/DisplayHardware/HWComposer.cpp +2 −1 Original line number Original line Diff line number Diff line Loading @@ -336,7 +336,8 @@ std::vector<HWComposer::HWCDisplayMode> HWComposer::getModesFromDisplayConfigura .height = config.height, .height = config.height, .vsyncPeriod = config.vsyncPeriod, .vsyncPeriod = config.vsyncPeriod, .configGroup = config.configGroup, .configGroup = config.configGroup, .vrrConfig = config.vrrConfig}; .vrrConfig = config.vrrConfig, .hdrOutputType = config.hdrOutputType}; const DisplayConfiguration::Dpi estimatedDPI = const DisplayConfiguration::Dpi estimatedDPI = getEstimatedDotsPerInchFromSize(hwcDisplayId, hwcMode); getEstimatedDotsPerInchFromSize(hwcDisplayId, hwcMode); Loading
services/surfaceflinger/DisplayHardware/HWComposer.h +4 −1 Original line number Original line Diff line number Diff line Loading @@ -55,6 +55,7 @@ #include <aidl/android/hardware/graphics/composer3/DisplayCapability.h> #include <aidl/android/hardware/graphics/composer3/DisplayCapability.h> #include <aidl/android/hardware/graphics/composer3/DisplayLuts.h> #include <aidl/android/hardware/graphics/composer3/DisplayLuts.h> #include <aidl/android/hardware/graphics/composer3/LutProperties.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> #include <aidl/android/hardware/graphics/composer3/OverlayProperties.h> namespace android { namespace android { Loading Loading @@ -112,12 +113,14 @@ public: float dpiY = -1.f; float dpiY = -1.f; int32_t configGroup = -1; int32_t configGroup = -1; std::optional<hal::VrrConfig> vrrConfig; std::optional<hal::VrrConfig> vrrConfig; OutputType hdrOutputType; friend std::ostream& operator<<(std::ostream& os, const HWCDisplayMode& mode) { friend std::ostream& operator<<(std::ostream& os, const HWCDisplayMode& mode) { return os << "id=" << mode.hwcId << " res=" << mode.width << "x" << mode.height return os << "id=" << mode.hwcId << " res=" << mode.width << "x" << mode.height << " vsyncPeriod=" << mode.vsyncPeriod << " dpi=" << mode.dpiX << "x" << " vsyncPeriod=" << mode.vsyncPeriod << " dpi=" << mode.dpiX << "x" << mode.dpiY << " group=" << mode.configGroup << mode.dpiY << " group=" << mode.configGroup << " vrrConfig=" << to_string(mode.vrrConfig).c_str(); << " vrrConfig=" << to_string(mode.vrrConfig).c_str() << " hdrOutputType=" << toString(mode.hdrOutputType); } } }; }; Loading
services/surfaceflinger/SurfaceFlinger.cpp +5 −0 Original line number Original line Diff line number Diff line Loading @@ -172,6 +172,7 @@ #include <aidl/android/hardware/graphics/common/DisplayDecorationSupport.h> #include <aidl/android/hardware/graphics/common/DisplayDecorationSupport.h> #include <aidl/android/hardware/graphics/composer3/DisplayCapability.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> #include <aidl/android/hardware/graphics/composer3/RenderIntent.h> #undef NO_THREAD_SAFETY_ANALYSIS #undef NO_THREAD_SAFETY_ANALYSIS Loading Loading @@ -3509,6 +3510,9 @@ std::pair<DisplayModes, DisplayModePtr> SurfaceFlinger::loadDisplayModes( DisplayModes newModes; DisplayModes newModes; for (const auto& hwcMode : hwcModes) { for (const auto& hwcMode : hwcModes) { const auto id = nextModeId++; const auto id = nextModeId++; OutputType hdrOutputType = FlagManager::getInstance().connected_display_hdr() ? hwcMode.hdrOutputType : OutputType::INVALID; newModes.try_emplace(id, newModes.try_emplace(id, DisplayMode::Builder(hwcMode.hwcId) DisplayMode::Builder(hwcMode.hwcId) .setId(id) .setId(id) Loading @@ -3519,6 +3523,7 @@ std::pair<DisplayModes, DisplayModePtr> SurfaceFlinger::loadDisplayModes( .setDpiX(hwcMode.dpiX) .setDpiX(hwcMode.dpiX) .setDpiY(hwcMode.dpiY) .setDpiY(hwcMode.dpiY) .setGroup(hwcMode.configGroup) .setGroup(hwcMode.configGroup) .setHdrOutputType(hdrOutputType) .build()); .build()); } } Loading
services/surfaceflinger/common/FlagManager.cpp +1 −1 Original line number Original line Diff line number Diff line Loading @@ -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(force_compile_graphite_renderengine, ""); FLAG_MANAGER_ACONFIG_FLAG(true_hdr_screenshots, "debug.sf.true_hdr_screenshots"); FLAG_MANAGER_ACONFIG_FLAG(true_hdr_screenshots, "debug.sf.true_hdr_screenshots"); FLAG_MANAGER_ACONFIG_FLAG(display_config_error_hal, ""); 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(deprecate_frame_tracker, ""); FLAG_MANAGER_ACONFIG_FLAG(skip_invisible_windows_in_input, ""); FLAG_MANAGER_ACONFIG_FLAG(skip_invisible_windows_in_input, ""); FLAG_MANAGER_ACONFIG_FLAG(begone_bright_hlg, "debug.sf.begone_bright_hlg"); FLAG_MANAGER_ACONFIG_FLAG(begone_bright_hlg, "debug.sf.begone_bright_hlg"); Loading