drm_hwcomposer: Add getter/setter for content_type
Optionally, get the content_type drm property. Add implementation to
HwcDisplay::SetContentType to set this property.
Change-Id: I910e064876d13205abc7caaac342daaff8f38599
Signed-off-by: Sasha McIntosh <sashamcintosh@google.com>
diff --git a/hwc2_device/HwcDisplay.cpp b/hwc2_device/HwcDisplay.cpp
index 9a9761b..be3e90d 100644
--- a/hwc2_device/HwcDisplay.cpp
+++ b/hwc2_device/HwcDisplay.cpp
@@ -462,6 +462,7 @@
}
a_args.color_matrix = color_matrix_;
+ a_args.content_type = content_type_;
uint32_t prev_vperiod_ns = 0;
GetDisplayVsyncPeriod(&prev_vperiod_ns);
@@ -916,12 +917,13 @@
}
HWC2::Error HwcDisplay::SetContentType(int32_t contentType) {
- if (contentType != HWC2_CONTENT_TYPE_NONE)
- return HWC2::Error::Unsupported;
-
- /* TODO: Map to the DRM Connector property:
- * https://elixir.bootlin.com/linux/v5.4-rc5/source/drivers/gpu/drm/drm_connector.c#L809
+ /* Maps exactly to the content_type DRM connector property:
+ * https://elixir.bootlin.com/linux/v6.11/source/include/uapi/drm/drm_mode.h#L107
*/
+ if (contentType < HWC2_CONTENT_TYPE_NONE || contentType > HWC2_CONTENT_TYPE_GAME)
+ return HWC2::Error::BadParameter;
+
+ content_type_ = contentType;
return HWC2::Error::None;
}