[i-g-t V6 40/41] tests/kms_color_helper: Add helpers to clear colorops data

Bhanuprakash Modem bhanuprakash.modem at intel.com
Wed Apr 24 10:26:48 UTC 2024


- Clear the DATA blob
- Set the BYPASS prop true

v2:
 - Rebase

Signed-off-by: Bhanuprakash Modem <bhanuprakash.modem at intel.com>
---
 tests/kms_color_helper.c | 33 +++++++++++++++++++++++++++++++++
 tests/kms_color_helper.h |  3 +++
 2 files changed, 36 insertions(+)

diff --git a/tests/kms_color_helper.c b/tests/kms_color_helper.c
index ccfde7ba8..091eae684 100644
--- a/tests/kms_color_helper.c
+++ b/tests/kms_color_helper.c
@@ -501,6 +501,28 @@ static void fill_custom_1dlut(igt_display_t *display, kms_colorop_t *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:
+	case KMS_COLOROP_MULTSEG_LUT1D:
+		igt_colorop_replace_prop_blob(colorop->colorop, IGT_COLOROP_DATA, NULL, 0);
+		break;
+	case KMS_COLOROP_MULTIPLIER:
+		igt_colorop_set_prop_value(colorop->colorop, IGT_COLOROP_MULTIPLIER, 1);
+		break;
+	case KMS_COLOROP_ENUMERATED_LUT1D:
+	case KMS_COLOROP_LUT3D:
+	default:
+		return;
+	}
+}
+
 void set_colorop(igt_display_t *display, kms_colorop_t *colorop)
 {
 	uint64_t lut_size = 0;
@@ -538,6 +560,17 @@ void set_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)
+{
+	int i;
+
+	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[],
diff --git a/tests/kms_color_helper.h b/tests/kms_color_helper.h
index e925bc1bd..93576b0ae 100644
--- a/tests/kms_color_helper.h
+++ b/tests/kms_color_helper.h
@@ -188,6 +188,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);
 void igt_colorop_set_ctm_3x3(igt_display_t *display,
 			     igt_colorop_t *colorop,
 			     const struct drm_color_ctm *matrix);
-- 
2.43.2



More information about the Intel-gfx-trybot mailing list