[i-g-t 16/17] WIP: tests/kms_color: Add tests for Custom 1D LUT & 3x3 CTM

Bhanuprakash Modem bhanuprakash.modem at intel.com
Fri Jan 12 09:53:02 UTC 2024


Add tests for Custom 1D Lut and 3x3 CTM.

Signed-off-by: Bhanuprakash Modem <bhanuprakash.modem at intel.com>
---
 include/drm-uapi/drm_mode.h |  29 ++++
 lib/igt_kms.c               |   3 +-
 lib/igt_kms.h               |   1 +
 tests/kms_color.c           | 279 +++++++++++++++++++++++++++++++++++-
 tests/kms_color_helper.c    | 137 +++++++++++++++++-
 tests/kms_color_helper.h    |  35 ++++-
 6 files changed, 471 insertions(+), 13 deletions(-)

diff --git a/include/drm-uapi/drm_mode.h b/include/drm-uapi/drm_mode.h
index 476c1a7be..fd475d9d0 100644
--- a/include/drm-uapi/drm_mode.h
+++ b/include/drm-uapi/drm_mode.h
@@ -874,8 +874,37 @@ struct drm_color_lut {
 	__u16 reserved;
 };
 
+/*
+ * Creating 64 bit palette entries for better data
+ * precision. This will be required for HDR and
+ * similar color processing usecases.
+ */
+struct drm_color_lut_ext {
+    /*
+     * Data is U32.32 fixed point format.
+     */
+    __u64 red;
+    __u64 green;
+    __u64 blue;
+    __u64 reserved;
+};
+
+struct drm_color_lut_range {
+    /* DRM_MODE_LUT_* */
+    __u32 flags;
+    /* number of points on the curve */
+    __u16 count;
+    /* input/output bits per component */
+    __u8 input_bpc, output_bpc;
+    /* input start/end values */
+    __s32 start, end;
+    /* output min/max values */
+    __s32 min, max;
+};
+
 enum drm_colorop_type {
 	DRM_COLOROP_1D_CURVE,
+	DRM_COLOROP_1D_LUT,
 	DRM_COLOROP_CTM_3X3,
 	DRM_COLOROP_CTM_3X4,
 };
diff --git a/lib/igt_kms.c b/lib/igt_kms.c
index a2415aa38..157b6199c 100644
--- a/lib/igt_kms.c
+++ b/lib/igt_kms.c
@@ -90,7 +90,7 @@
 #define MAX_CONNECTORS 32
 #define MAX_EDID 2
 #define DISPLAY_TILE_BLOCK 0x12
-#define MAX_NUM_COLOROPS 32
+#define MAX_NUM_COLOROPS 64
 
 static struct {
 	uint32_t connector_type;
@@ -689,6 +689,7 @@ const char * const igt_colorop_prop_names[IGT_NUM_COLOROP_PROPS] = {
 	[IGT_COLOROP_TYPE] = "TYPE",
 	[IGT_COLOROP_BYPASS] = "BYPASS",
 	[IGT_COLOROP_CURVE_1D_TYPE] = "CURVE_1D_TYPE",
+	[IGT_COLOROP_HWLUT_CAPS] = "HWLUT_CAPS",
 	[IGT_COLOROP_DATA] = "DATA",
 	[IGT_COLOROP_NEXT] = "NEXT",
 };
diff --git a/lib/igt_kms.h b/lib/igt_kms.h
index 5c2fca33d..b586dc815 100644
--- a/lib/igt_kms.h
+++ b/lib/igt_kms.h
@@ -352,6 +352,7 @@ enum igt_atomic_colorop_properties {
        IGT_COLOROP_TYPE,
        IGT_COLOROP_BYPASS,
        IGT_COLOROP_CURVE_1D_TYPE,
+       IGT_COLOROP_HWLUT_CAPS,
        IGT_COLOROP_DATA,
        IGT_COLOROP_NEXT,
        IGT_NUM_COLOROP_PROPS
diff --git a/tests/kms_color.c b/tests/kms_color.c
index bdb80a4ad..6c8e933e9 100644
--- a/tests/kms_color.c
+++ b/tests/kms_color.c
@@ -78,6 +78,22 @@
  * @gamma-lut:          Gamma LUT
  */
 
+/**
+ * SUBTEST: %s
+ * Description: Test plane color pipeline with colorops: %arg[1].
+ *
+ * arg[1]:
+ *
+ * @lut1d:		1D LUT
+ * @ctm3x3:		3X3 CTM
+ * @lut1d-ctm3x3:	1D LUT --> 3X3 CTM
+ * @ctm3x3-lut1d:	3X3 CTM --> 1D LUT
+ * @lut1d-lut1d:	1D LUT --> 1D LUT
+ * @lut1d-ctm3x3-lut1d: 1D LUT --> 3X3 CTM --> 1D LUT
+ */
+
+#define MAX_COLOROPS 5
+
 IGT_TEST_DESCRIPTION("Test Color Features at Pipe level");
 
 static bool test_pipe_degamma(data_t *data,
@@ -611,6 +627,138 @@ static bool test_pipe_ctm(data_t *data,
 	return ret;
 }
 
+static void clear_lut_data(kms_colorop_t *colorops[])
+{
+	int i;
+
+	for (i = 0; colorops[i]; i++) {
+		if (colorops[i]->type != KMS_COLOROP_CUSTOM_LUT1D)
+			continue;
+
+		if (colorops[i]->custom_lut1d_info.lut)
+			free(colorops[i]->custom_lut1d_info.lut);
+	}
+}
+
+static void prepare_lut_data(data_t *data, kms_colorop_t *colorops[])
+{
+	int i;
+
+	for (i = 0; colorops[i]; i++) {
+		uint64_t hwlut_caps = 0;
+		segment_data_t *segment_info;
+
+		if (colorops[i]->type != KMS_COLOROP_CUSTOM_LUT1D)
+			continue;
+
+		hwlut_caps = igt_colorop_get_prop(&data->display, colorops[i]->colorop, IGT_COLOROP_HWLUT_CAPS);
+		segment_info = get_segment_data(data->drm_fd, hwlut_caps);
+
+		igt_info("Lut size (%s): %d\n", colorops[i]->name, segment_info->entries_count);
+
+		colorops[i]->custom_lut1d_info.lut_size = segment_info->entries_count;
+		colorops[i]->custom_lut1d_info.lut =
+			malloc(sizeof(struct drm_color_lut_ext) * colorops[i]->custom_lut1d_info.lut_size);
+		igt_assert(colorops[i]->custom_lut1d_info.lut);
+
+		switch (colorops[i]->custom_lut1d_info.lut_type) {
+			case KMS_COLOROP_CUSTOM_LUT1D_ZERO:
+				create_zero_lut(segment_info, colorops[i]->custom_lut1d_info.lut);
+				break;
+			case KMS_COLOROP_CUSTOM_LUT1D_LINEAR:
+				create_unity_lut(segment_info, colorops[i]->custom_lut1d_info.lut);
+				break;
+			case KMS_COLOROP_CUSTOM_LUT1D_MAX:
+			default:
+				create_max_lut(segment_info, colorops[i]->custom_lut1d_info.lut);
+		}
+
+		clear_segment_data(segment_info);
+	}
+}
+
+static bool ctm_colorop_only(kms_colorop_t *colorops[])
+{
+	int i;
+
+	for (i = 0; colorops[i]; i++)
+		if (colorops[i]->type != KMS_COLOROP_CTM_3X3)
+			return false;
+	return true;
+}
+
+static bool test_plane_colorops(data_t *data, igt_plane_t *plane,
+				const color_t *fb_colors,
+				const color_t *exp_colors,
+				kms_colorop_t *colorops[])
+{
+	igt_output_t *output = data->output;
+	igt_display_t *display = &data->display;
+	drmModeModeInfo *mode = data->mode;
+	struct igt_fb fb;
+	bool ret;
+	igt_colorop_t *color_pipeline = get_color_pipeline(display, plane, colorops);
+	igt_crc_t crc_gamma, crc_fullcolors;
+
+	igt_critical("Bhanu debug--> Color pipeline: %d\n", color_pipeline->id);
+
+	igt_output_set_pipe(output, plane->pipe->pipe);
+	mode = igt_output_get_mode(output);
+
+	/* Create a framebuffer at the size of the output. */
+	igt_assert(igt_create_fb(data->drm_fd,
+			      mode->hdisplay,
+			      mode->vdisplay,
+			      DRM_FORMAT_XRGB8888,
+			      DRM_FORMAT_MOD_LINEAR,
+			      &fb));
+	igt_plane_set_fb(plane, &fb);
+
+	/* Disable Pipe color props. */
+	disable_ctm(plane->pipe);
+	disable_degamma(plane->pipe);
+	disable_gamma(plane->pipe);
+	igt_display_commit2(display, COMMIT_ATOMIC);
+
+	set_color_pipeline_bypass(plane);
+	paint_rectangles(data, mode, exp_colors, &fb);
+	igt_plane_set_fb(plane, &fb);
+	igt_display_commit2(display, COMMIT_ATOMIC);
+	igt_wait_for_vblank(data->drm_fd,
+		display->pipes[plane->pipe->pipe].crtc_offset);
+	igt_pipe_crc_collect_crc(data->pipe_crc, &crc_fullcolors);
+
+	/*
+	 * Draw gradient colors with LUT to remap all
+	 * values to max red/green/blue.
+	 */
+	prepare_lut_data(data, colorops);
+	set_color_pipeline(display, plane, colorops, color_pipeline);
+	if (ctm_colorop_only(colorops))
+		paint_rectangles(data, mode, fb_colors, &fb);
+	else
+		paint_gradient_rectangles(data, mode, fb_colors, &fb);
+	igt_plane_set_fb(plane, &fb);
+	igt_display_commit2(display, COMMIT_ATOMIC);
+	igt_wait_for_vblank(data->drm_fd,
+			display->pipes[plane->pipe->pipe].crtc_offset);
+	igt_pipe_crc_collect_crc(data->pipe_crc, &crc_gamma);
+
+	/*
+	 * Verify that the CRC of the software computed output is
+	 * equal to the CRC of the gamma LUT transformation output.
+	 */
+	ret = igt_check_crc_equal(&crc_gamma, &crc_fullcolors);
+
+	clear_lut_data(colorops);
+	clear_color_pipeline(display, plane, colorops, color_pipeline);
+	igt_plane_set_fb(plane, NULL);
+	igt_output_set_pipe(output, PIPE_NONE);
+	igt_display_commit2(display, COMMIT_ATOMIC);
+
+	return ret;
+}
+
 /*
  * Hardware computes CRC based on the number of bits it is working with (8,
  * 10, 12, 16 bits), meaning with a framebuffer of 8bits per color will
@@ -861,6 +1009,47 @@ out:
 	test_cleanup(data);
 }
 
+static void run_plane_color_tests(data_t *data,
+				  const color_t *fb_colors,
+				  const color_t *exp_colors,
+				  kms_colorop_t *colorops[])
+{
+	enum pipe pipe;
+
+	data->color_depth = 8;
+	data->drm_format = DRM_FORMAT_XRGB8888;
+
+	for_each_pipe(&data->display, pipe) {
+		igt_plane_t *plane;
+
+		test_setup(data, pipe);
+
+		data->mode = igt_output_get_mode(data->output);
+
+		if (!pipe_output_combo_valid(data, pipe)){
+			test_cleanup(data);
+			continue;
+		}
+
+		for_each_plane_on_pipe(&data->display, pipe, plane) {
+			if (!igt_plane_has_prop(plane, IGT_PLANE_COLOR_PIPELINE) &&
+			    !get_color_pipeline(&data->display, plane, colorops))
+				continue;
+
+			igt_dynamic_f("pipe-%s-%s-plane-%d",
+				      kmstest_pipe_name(pipe),
+				      igt_output_name(data->output),
+				      plane->index)
+				igt_assert(test_plane_colorops(data, plane, fb_colors, exp_colors, colorops));
+
+			/* TODO: Extend to run on multiple planes. */
+			break;
+		}
+	}
+
+	test_cleanup(data);
+}
+
 static void
 run_deep_color_tests_for_pipe(data_t *data, enum pipe p)
 {
@@ -1151,13 +1340,91 @@ run_tests_for_pipe(data_t *data)
 		}
 	}
 
-	igt_fixture
-		igt_require(data->display.is_atomic);
+	igt_subtest_group {
+		static const color_t colors_red_to_blue[] = {
+			{ 0.0, 0.0, 1.0 },
+			{ 0.0, 1.0, 0.0 },
+			{ 0.0, 0.0, 1.0 },
+		};
+		const struct drm_color_ctm ctm_red_to_blue = { {
+			0.0, 0.0, 0.0,
+			0.0, 1.0, 0.0,
+			1.0, 0.0, 1.0
+		} };
+		kms_colorop_t lut1d_linear = {
+			.type = KMS_COLOROP_CUSTOM_LUT1D,
+			.name = "Pre/Post CSC GAMMA (linear LUT)",
+			.custom_lut1d_info = {
+				.lut_type = KMS_COLOROP_CUSTOM_LUT1D_LINEAR,
+			},
+		};
+		kms_colorop_t lut1d_max = {
+			.type = KMS_COLOROP_CUSTOM_LUT1D,
+			.name = "Pre/Post CSC GAMMA (max LUT)",
+			.custom_lut1d_info = {
+				.lut_type = KMS_COLOROP_CUSTOM_LUT1D_MAX,
+			},
+		};
+		kms_colorop_t ctm_3x3 = {
+			.type = KMS_COLOROP_CTM_3X3,
+			.name = "CTM 3X3 (red to blue)",
+			.matrix_3x3 = &ctm_red_to_blue,
+		};
+		struct {
+			const char *name;
+			const color_t *fb_colors;
+			const color_t *exp_colors;
+			kms_colorop_t *colorops[MAX_COLOROPS];
+		} plane_colorops_tests[] = {
+			{ .name = "lut1d",
+			  .fb_colors = colors_rgb,
+			  .exp_colors = colors_rgb,
+			  .colorops = { &lut1d_max, NULL },
+			},
+			{ .name = "ctm3x3",
+			  .fb_colors = colors_rgb,
+			  .exp_colors = colors_red_to_blue,
+			  .colorops = { &ctm_3x3, NULL },
+			},
+			{ .name = "lut1d-ctm3x3",
+			  .fb_colors = colors_rgb,
+			  .exp_colors = colors_red_to_blue,
+			  .colorops = { &lut1d_max, &ctm_3x3, NULL },
+			},
+			{ .name = "ctm3x3-lut1d",
+			  .fb_colors = colors_rgb,
+			  .exp_colors = colors_red_to_blue,
+			  .colorops = { &ctm_3x3, &lut1d_max, NULL },
+			},
+			{ .name = "lut1d-lut1d",
+			  .fb_colors = colors_rgb,
+			  .exp_colors = colors_rgb,
+			  .colorops = { &lut1d_linear, &lut1d_max, NULL },
+			},
+			{ .name = "lut1d-ctm3x3-lut1d",
+			  .fb_colors = colors_rgb,
+			  .exp_colors = colors_red_to_blue,
+			  .colorops = { &lut1d_linear, &ctm_3x3, &lut1d_max, NULL },
+			},
+		};
 
-	igt_describe("Verify that deep color works correctly");
-	igt_subtest_with_dynamic("deep-color") {
-		for_each_pipe(&data->display, pipe) {
-			run_deep_color_tests_for_pipe(data, pipe);
+		igt_fixture
+			igt_require(data->display.is_atomic);
+
+		for (i = 0; i < ARRAY_SIZE(plane_colorops_tests); i++) {
+			igt_describe_f("Test plane color pipeline with colorops: %s", plane_colorops_tests[i].name);
+			igt_subtest_with_dynamic_f("%s", plane_colorops_tests[i].name)
+				run_plane_color_tests(data,
+						      plane_colorops_tests[i].fb_colors,
+						      plane_colorops_tests[i].exp_colors,
+						      plane_colorops_tests[i].colorops);
+		}
+
+		igt_describe("Verify that deep color works correctly");
+		igt_subtest_with_dynamic("deep-color") {
+			for_each_pipe(&data->display, pipe) {
+				run_deep_color_tests_for_pipe(data, pipe);
+			}
 		}
 	}
 }
diff --git a/tests/kms_color_helper.c b/tests/kms_color_helper.c
index fb9ced57c..bc1582cbc 100644
--- a/tests/kms_color_helper.c
+++ b/tests/kms_color_helper.c
@@ -24,6 +24,9 @@
 
 #include "kms_color_helper.h"
 
+#define MIN(a, b)	((a) < (b) ? (a) : (b))
+#define MAX_COLOROPS 5
+
 bool pipe_output_combo_valid(data_t *data, enum pipe pipe)
 {
 	bool ret = true;
@@ -399,6 +402,7 @@ static bool can_use_colorop(igt_display_t *display, igt_colorop_t *colorop, kms_
 	case KMS_COLOROP_CTM_3X4:
 		return (igt_colorop_get_prop(display, colorop, IGT_COLOROP_TYPE) == DRM_COLOROP_CTM_3X4);
 	case KMS_COLOROP_CUSTOM_LUT1D:
+		return (igt_colorop_get_prop(display, colorop, IGT_COLOROP_TYPE) == DRM_COLOROP_1D_LUT);
 	case KMS_COLOROP_LUT3D:
 	default:
 		return false;
@@ -424,6 +428,7 @@ static bool map_to_pipeline(igt_display_t *display,
 
 	i++;
 	while (next) {
+		igt_critical("Bhanu debug--> Colorop: %d \n", next->id);
 		if (can_use_colorop(display, next, current_op)) {
 			current_op->colorop = next;
 			current_op = colorops[i];
@@ -467,6 +472,24 @@ igt_colorop_t *get_color_pipeline(igt_display_t *display,
 	return colorop;
 }
 
+void clear_colorop(igt_display_t *display, kms_colorop_t *colorop)
+{
+	igt_assert(colorop->colorop);
+	igt_colorop_set_prop_value(colorop->colorop, IGT_COLOROP_BYPASS, 1);
+
+	switch (colorop->type) {
+	case KMS_COLOROP_CTM_3X3:
+	case KMS_COLOROP_CTM_3X4:
+	case KMS_COLOROP_CUSTOM_LUT1D:
+		igt_colorop_replace_prop_blob(colorop->colorop, IGT_COLOROP_DATA, NULL, 0);
+		break;
+	case KMS_COLOROP_ENUMERATED_LUT1D:
+	case KMS_COLOROP_LUT3D:
+	default:
+		return;
+	}
+}
+
 void set_colorop(igt_display_t *display, kms_colorop_t *colorop)
 {
 	igt_assert(colorop->colorop);
@@ -495,12 +518,26 @@ void set_colorop(igt_display_t *display, kms_colorop_t *colorop)
 		igt_colorop_set_ctm_3x4(display, colorop->colorop, colorop->matrix_3x4);
 		break;
 	case KMS_COLOROP_CUSTOM_LUT1D:
+		igt_colorop_set_custom_lut_1d(display, colorop->colorop, colorop->custom_lut1d_info);
+		break;
 	case KMS_COLOROP_LUT3D:
 	default:
 		igt_fail(IGT_EXIT_FAILURE);
 	}
 }
 
+void clear_color_pipeline(igt_display_t *display,
+			  igt_plane_t *plane,
+			  kms_colorop_t *colorops[],
+			  igt_colorop_t *color_pipeline)
+{
+	int i;
+
+	set_color_pipeline_bypass(plane);
+	for(i = 0; colorops[i]; i++)
+		clear_colorop(display, colorops[i]);
+}
+
 void set_color_pipeline(igt_display_t *display,
 			igt_plane_t *plane,
 			kms_colorop_t *colorops[],
@@ -530,24 +567,116 @@ void set_color_pipeline(igt_display_t *display,
 	}
 }
 
+void create_zero_lut(segment_data_t *info, struct drm_color_lut_ext *lut)
+{
+	int i;
+
+	for (i = 0; i < info->entries_count; i++)
+		lut[i].red = lut[i].green = lut[i].blue = 0;
+}
+
+void create_unity_lut(segment_data_t *info, struct drm_color_lut_ext *lut)
+{
+	uint32_t val, segment, entry, index = 0;
+	uint32_t max_val = 0xffffffff;
+
+	for (segment = 0; segment < info->segment_count; segment++) {
+		uint32_t entry_count = info->segment_data[segment].count;
+		uint32_t start = info->segment_data[segment].start;
+		uint32_t end = info->segment_data[segment].end;
+
+		for (entry = 1; entry <= entry_count; entry++) {
+			val = start + entry * ((end - start) * 1.0 / entry_count);
+			lut[index].red = lut[index].green = lut[index].blue =
+				(index == 0) ? 0 : MIN(val, max_val);
+
+			index++;
+		}
+	}
+}
+
+void create_max_lut(segment_data_t *info, struct drm_color_lut_ext *lut)
+{
+	int i;
+	uint32_t max_val = 0xffffffff;
+
+	for (i = 0; i < info->entries_count; i++)
+		lut[i].red = lut[i].green = lut[i].blue = (i == 0) ? 0 : max_val;
+}
+
+void clear_segment_data(segment_data_t *info)
+{
+	if (!info)
+		return;
+
+	free(info->segment_data);
+	free(info);
+}
+
+segment_data_t *get_segment_data(int drm_fd, uint64_t blob_id)
+{
+	drmModePropertyBlobPtr blob;
+	struct drm_color_lut_range *lut_range = NULL;
+	segment_data_t *info = NULL;
+	uint32_t i;
+
+	blob = drmModeGetPropertyBlob(drm_fd, blob_id);
+	igt_assert(blob);
+	igt_assert(blob->length);
+
+	info = malloc(sizeof(segment_data_t));
+	igt_assert(info);
+
+	lut_range = (struct drm_color_lut_range *) blob->data;
+	info->segment_count = blob->length / sizeof(lut_range[0]);
+	igt_assert(info->segment_count);
+
+	info->segment_data = malloc(sizeof(struct drm_color_lut_range) * info->segment_count);
+	igt_assert(info->segment_data);
+
+	info->entries_count = 0;
+	for (i = 0; i < info->segment_count; i++) {
+		info->entries_count += lut_range[i].count;
+		info->segment_data[i] = lut_range[i];
+	}
+
+	drmModeFreePropertyBlob(blob);
+
+	return info;
+}
+
+void igt_colorop_set_custom_lut_1d(igt_display_t *display,
+				   igt_colorop_t *colorop,
+				   const kms_colorop_custom_lut1d_info_t lut_info)
+{
+	/* set blob property */
+	for (int i = 0; i < lut_info.lut_size; i++)
+		igt_info("Lut[%d]: 0x%llx 0x%llx 0x%llx\n",
+			 i, lut_info.lut[i].red, lut_info.lut[i].green, lut_info.lut[i].blue);
+
+	igt_colorop_replace_prop_blob(colorop, IGT_COLOROP_DATA,
+			lut_info.lut, sizeof(struct drm_color_lut_ext) * lut_info.lut_size);
+}
+
 void igt_colorop_set_ctm_3x3(igt_display_t *display,
 			     igt_colorop_t *colorop,
-			     const igt_matrix_3x3_t *matrix)
+			     const struct drm_color_ctm *matrix)
 {
 	struct drm_color_ctm ctm;
 	int i;
 
 	for (i = 0; i < ARRAY_SIZE(ctm.matrix); i++) {
-		if (matrix->m[i] < 0) {
+		if (matrix->matrix[i] < 0) {
 			ctm.matrix[i] =
-				(int64_t) (-matrix->m[i] *
+				(int64_t) (-matrix->matrix[i] *
 				((int64_t) 1L << 32));
 			ctm.matrix[i] |= 1ULL << 63;
 		} else {
 			ctm.matrix[i] =
-				(int64_t) (matrix->m[i] *
+				(int64_t) (matrix->matrix[i] *
 				((int64_t) 1L << 32));
 		}
+		igt_info("CTM[%d]: %llx\n", i, ctm.matrix[i]);
 	}
 
 	/* set blob property */
diff --git a/tests/kms_color_helper.h b/tests/kms_color_helper.h
index 0b5296a40..724f74438 100644
--- a/tests/kms_color_helper.h
+++ b/tests/kms_color_helper.h
@@ -122,6 +122,18 @@ void invalid_gamma_lut_sizes(data_t *data, enum pipe p);
 void invalid_degamma_lut_sizes(data_t *data, enum pipe p);
 void invalid_ctm_matrix_sizes(data_t *data, enum pipe p);
 
+typedef struct {
+  uint32_t segment_count;
+  struct drm_color_lut_range *segment_data;
+  uint32_t entries_count;
+} segment_data_t;
+
+void create_zero_lut(segment_data_t *info, struct drm_color_lut_ext *lut);
+void create_unity_lut(segment_data_t *info, struct drm_color_lut_ext *lut);
+void create_max_lut(segment_data_t *info, struct drm_color_lut_ext *lut);
+void clear_segment_data(segment_data_t *info);
+segment_data_t *get_segment_data(int drm_fd, uint64_t blob_id);
+
 /* Colorops Test version definitions */
 typedef enum kms_colorop_type {
 	KMS_COLOROP_ENUMERATED_LUT1D,
@@ -142,13 +154,26 @@ typedef struct kms_colorop_enumerated_lut1d_info {
 	kms_colorop_lut1d_tf_t tf;
 } kms_colorop_enumerated_lut1d_info_t;
 
+typedef enum kms_colorop_custom_lut1d_tf {
+  KMS_COLOROP_CUSTOM_LUT1D_ZERO,
+  KMS_COLOROP_CUSTOM_LUT1D_LINEAR,
+  KMS_COLOROP_CUSTOM_LUT1D_MAX,
+} kms_colorop_custom_lut1d_tf_t;
+
+typedef struct kms_colorop_custom_lut1d_info {
+  uint32_t lut_size;
+  kms_colorop_custom_lut1d_tf_t lut_type;
+  struct drm_color_lut_ext *lut;
+} kms_colorop_custom_lut1d_info_t;
+
 typedef struct kms_colorop {
 	kms_colorop_type_t type;
 
 	union {
 		kms_colorop_enumerated_lut1d_info_t enumerated_lut1d_info;
+		kms_colorop_custom_lut1d_info_t custom_lut1d_info;
 		const igt_matrix_3x4_t *matrix_3x4;
-		const igt_matrix_3x3_t *matrix_3x3;
+		const struct drm_color_ctm *matrix_3x3;
 	};
 
 	const char *name;
@@ -173,9 +198,12 @@ extern kms_colorop_t kms_colorop_ctm_3x4_bt709_enc;
 extern kms_colorop_t kms_colorop_ctm_3x4_bt709_dec;
 
 /* colorop helpers */
+void igt_colorop_set_custom_lut_1d(igt_display_t *display,
+			     igt_colorop_t *colorop,
+			     const kms_colorop_custom_lut1d_info_t custom_lut1d_info);
 void igt_colorop_set_ctm_3x3(igt_display_t *display,
 			     igt_colorop_t *colorop,
-			     const igt_matrix_3x3_t *matrix);
+			     const struct drm_color_ctm *matrix);
 void igt_colorop_set_ctm_3x4(igt_display_t *display,
 			     igt_colorop_t *colorop,
 			     const igt_matrix_3x4_t *matrix);
@@ -184,6 +212,9 @@ igt_colorop_t *get_color_pipeline(igt_display_t *display, igt_plane_t *plane,
 void set_colorop(igt_display_t *display, kms_colorop_t *colorop);
 void set_color_pipeline(igt_display_t *display, igt_plane_t *plane,
 			      kms_colorop_t *colorops[], igt_colorop_t *color_pipeline);
+void clear_colorop(igt_display_t *display, kms_colorop_t *colorop);
+void clear_color_pipeline(igt_display_t *display, igt_plane_t *plane,
+			      kms_colorop_t *colorops[], igt_colorop_t *color_pipeline);
 
 #define set_color_pipeline_bypass(plane)  igt_plane_set_prop_enum((plane), IGT_PLANE_COLOR_PIPELINE, "Bypass")
 
-- 
2.40.0



More information about the Intel-gfx-trybot mailing list