SF,HDR: Add HDR output type to modes
Add hdr output types to display configuration and display mode. This
will be used by HWC to infer the minimum bits per color required for the
link.
If we do not specify the minimum bit depth for HDR displays, we may run
into bandwidth contention, resulting in a low quality visual experience.
Bug: 374183675
Test: HWComposerTest#getModesWithDisplayConfigurations*
Flag: com.android.graphics.surfaceflinger.flags.connected_display_hdr
Change-Id: I2d680d257ed9fbd7aad00282363a2e784da4cce5
Signed-off-by: Sasha McIntosh <sashamcintosh@google.com>
diff --git a/services/surfaceflinger/DisplayHardware/DisplayMode.h b/services/surfaceflinger/DisplayHardware/DisplayMode.h
index 224f50e..e90b5b7 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 @@
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 @@
// 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 @@
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>