@@ -800,6 +800,9 @@ static void drm_atomic_colorop_print_state(struct drm_printer *p,
drm_get_colorop_lut1d_interpolation_name(colorop->lut1d_interpolation));
drm_printf(p, "\tdata blob id=%d\n", state->data ? state->data->base.id : 0);
break;
+ case DRM_COLOROP_CTM_3X3:
+ drm_printf(p, "\tdata blob id=%d\n", state->data ? state->data->base.id : 0);
+ break;
case DRM_COLOROP_CTM_3X4:
drm_printf(p, "\tdata blob id=%d\n", state->data ? state->data->base.id : 0);
break;
@@ -708,6 +708,9 @@ static int drm_atomic_color_set_data_property(struct drm_colorop *colorop,
case DRM_COLOROP_CTM_3X4:
size = sizeof(struct drm_color_ctm_3x4);
break;
+ case DRM_COLOROP_CTM_3X3:
+ size = sizeof(struct drm_color_ctm);
+ break;
case DRM_COLOROP_3D_LUT:
size = colorop->lut_size * colorop->lut_size * colorop->lut_size *
sizeof(struct drm_color_lut);
@@ -362,6 +362,35 @@ int drm_colorop_ctm_3x4_init(struct drm_device *dev, struct drm_colorop *colorop
}
EXPORT_SYMBOL(drm_colorop_ctm_3x4_init);
+/**
+ * drm_colorop_ctm_3x3_init - Initialize a DRM_COLOROP_CTM_3X3
+ *
+ * @dev: DRM device
+ * @colorop: The drm_colorop object to initialize
+ * @plane: The associated drm_plane
+ * @allow_bypass: true if BYPASS property should be created, false if bypass of
+ * this colorop is not possible
+ * @return zero on success, -E value on failure
+ */
+int drm_colorop_ctm_3x3_init(struct drm_device *dev, struct drm_colorop *colorop,
+ struct drm_plane *plane, bool allow_bypass)
+{
+ int ret;
+
+ ret = drm_colorop_init(dev, colorop, plane, DRM_COLOROP_CTM_3X3, allow_bypass);
+ if (ret)
+ return ret;
+
+ ret = drm_colorop_create_data_prop(dev, colorop);
+ if (ret)
+ return ret;
+
+ drm_colorop_reset(colorop);
+
+ return 0;
+}
+EXPORT_SYMBOL(drm_colorop_ctm_3x3_init);
+
/**
* drm_colorop_mult_init - Initialize a DRM_COLOROP_MULTIPLIER
*
@@ -156,6 +156,14 @@ struct drm_colorop_state {
* |G| = |4 5 6 7 | x | G |
* |B| |8 9 10 12| | B |
*
+ * For 3x3 matrix (DRM_COLOROP_CTM_3X3), the blob is of type struct drm_color_ctm
+ * which represents the Conversion matrix in S31.32 sign-magnitude
+ * (not two's complement!) format.
+ * out matrix in
+ * |R| |0 1 2| |R|
+ * |G| = |3 4 5| x |G|
+ * |B| |6 7 8| |B|
+ *
* For 3D LUTs (DRM_COLOROP_3D_LUT), the blob is a 3D array of
* struct drm_color_lut with dimension length of "lut_size".
* The LUT elements are traversed like so:
@@ -376,6 +384,8 @@ int drm_colorop_curve_1d_lut_init(struct drm_device *dev, struct drm_colorop *co
struct drm_plane *plane, uint32_t lut_size,
enum drm_colorop_lut1d_interpolation_type lut1d_interpolation,
bool allow_bypass);
+int drm_colorop_ctm_3x3_init(struct drm_device *dev, struct drm_colorop *colorop,
+ struct drm_plane *plane, bool allow_bypass);
int drm_colorop_ctm_3x4_init(struct drm_device *dev, struct drm_colorop *colorop,
struct drm_plane *plane, bool allow_bypass);
int drm_colorop_mult_init(struct drm_device *dev, struct drm_colorop *colorop,
@@ -905,6 +905,14 @@ enum drm_colorop_type {
*/
DRM_COLOROP_CTM_3X4,
+ /**
+ * @DRM_COLOROP_CTM_3X3:
+ *
+ * A 3x3 matrix. Its values are specified via the
+ * &drm_color_ctm struct provided via the DATA property.
+ */
+ DRM_COLOROP_CTM_3X3,
+
/**
* @DRM_COLOROP_MULTIPLIER:
*