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/DrmAtomicStateManager.cpp b/drm/DrmAtomicStateManager.cpp
index 58a5523..4ff16e2 100644
--- a/drm/DrmAtomicStateManager.cpp
+++ b/drm/DrmAtomicStateManager.cpp
@@ -107,6 +107,20 @@
     }
   }
 
+  if (args.color_matrix && crtc->GetCtmProperty()) {
+    auto blob = drm->RegisterUserPropertyBlob(args.color_matrix.get(),
+                                              sizeof(drm_color_ctm));
+    new_frame_state.ctm_blob = std::move(blob);
+
+    if (!new_frame_state.ctm_blob) {
+      ALOGE("Failed to create CTM blob");
+      return -EINVAL;
+    }
+
+    if (!crtc->GetCtmProperty().AtomicSet(*pset, *new_frame_state.ctm_blob))
+      return -EINVAL;
+  }
+
   auto unused_planes = new_frame_state.used_planes;
 
   if (args.composition) {