drm_hwcomposer: Add support for color transform matrix
1. Add and wire-up CRTC CTM property support.
2. Add custom Android property to select behavior for cases
where DRM can't handle color transform matrix.
The "vendor.hwc.drm.ctm" property can be set to:
- DRM_OR_GPU (default) - Use GPU if CTM is not supported by DRM.
- DRM_OR_IGNORE - Ignore CTM if DRM doesn't support it.
The last option is useful for Android 13 and later where default
color transformation matrix is not an identity matrix.
At the moment I do not have any devices with CTM support, therefore
I can test only DRM_OR_IGNORE option.
Signed-off-by: Roman Stratiienko <r.stratiienko@gmail.com>
diff --git a/drm/ResourceManager.h b/drm/ResourceManager.h
index 60b6b16..7fa3fc6 100644
--- a/drm/ResourceManager.h
+++ b/drm/ResourceManager.h
@@ -26,6 +26,11 @@
namespace android {
+enum class CtmHandling {
+ kDrmOrGpu, /* Handled by DRM is possible, otherwise by GPU */
+ kDrmOrIgnore, /* Handled by DRM is possible, otherwise displayed as is */
+};
+
class PipelineToFrontendBindingInterface {
public:
virtual ~PipelineToFrontendBindingInterface() = default;
@@ -52,6 +57,10 @@
return scale_with_gpu_;
}
+ auto &GetCtmHandling() const {
+ return ctm_handling_;
+ }
+
auto &GetMainLock() {
return main_lock_;
}
@@ -65,7 +74,9 @@
std::vector<std::unique_ptr<DrmDevice>> drms_;
+ // Android properties:
bool scale_with_gpu_{};
+ CtmHandling ctm_handling_{};
std::shared_ptr<UEventListener> uevent_listener_;