[PATCH i-g-t 2/3] tests/kms_dither: Validate dither after CC blocks

Bhanuprakash Modem bhanuprakash.modem at intel.com
Tue Jun 15 21:14:06 UTC 2021


Dithering after all CC blocks will be enabled only if the panel
supports 12 BPC (or more) and the Framebuffer BPC is greater than
12 BPC. And legacy dither block (at the end of PIPE) should be
disabled to avoid double dithering.

This patch will extend the support to validate Dither after all
color conversion (CC) blocks.

V2:
* Identify the dithering block, then check the status (Uma)

Cc: Swati Sharma <swati2.sharma at intel.com>
Cc: Karthik B S <karthik.b.s at intel.com>
Cc: Uma Shankar <uma.shankar at intel.com>
Cc: Nischal Varide <nischal.varide at intel.com>
Cc: Petri Latvala <petri.latvala at intel.com>
Signed-off-by: Bhanuprakash Modem <bhanuprakash.modem at intel.com>
---
 tests/kms_dither.c | 48 +++++++++++++++++++++++++++++++++++-----------
 1 file changed, 37 insertions(+), 11 deletions(-)

diff --git a/tests/kms_dither.c b/tests/kms_dither.c
index dbff337bc1..bb07be8019 100644
--- a/tests/kms_dither.c
+++ b/tests/kms_dither.c
@@ -52,12 +52,14 @@ typedef struct data {
 	drmModeModeInfo *mode;
 	enum pipe pipe_id;
 	int drm_fd;
+	uint32_t devid;
 	igt_fb_t fb;
 } data_t;
 
 typedef struct {
 	unsigned int bpc;
-	unsigned int dither;
+	unsigned int legacy;
+	unsigned int cc1;
 } dither_status_t;
 
 /* Prepare test data. */
@@ -104,7 +106,15 @@ static dither_status_t get_dither_state(data_t *data)
 
 	igt_assert(start_loc = strstr(buf, ", dither="));
 	igt_assert_eq(sscanf(start_loc, ", dither=%s", tmp), 1);
-	status.dither = !strcmp(tmp, "yes,");
+	status.legacy = !strcmp(tmp, "yes,");
+
+	igt_assert(start_loc = strstr(buf, ", dither_cc1="));
+	if (start_loc) {
+		igt_assert_eq(sscanf(start_loc, ", dither_cc1=%s", tmp), 1);
+		status.cc1 = !strcmp(tmp, "yes,");
+	} else {
+		status.cc1 = 0;
+	}
 
 	return status;
 }
@@ -141,10 +151,10 @@ static void test_dithering(data_t *data, enum pipe pipe,
 	 */
 	status = get_dither_state(data);
 
-	igt_debug("FB BPC:%d, Panel BPC:%d, Pipe BPC:%d, Expected Dither:%s, Actual result:%s\n",
-		  fb_bpc, output_bpc, status.bpc,
-		  (fb_bpc > output_bpc) ? "Enable": "Disable",
-		  status.dither ? "Enable": "Disable");
+	igt_debug("FB BPC:%d, Panel BPC:%d, Pipe BPC:%d, "
+		  "Dither at end of the pipe:%u, Dither after CC1:%u\n",
+			fb_bpc, output_bpc, status.bpc,
+			status.legacy, status.cc1);
 
        /*
 	* We must update the Connector max_bpc property back
@@ -163,12 +173,26 @@ static void test_dithering(data_t *data, enum pipe pipe,
 				output->name, status.bpc, output_bpc);
 
 	/* Compute the result. */
-	if (fb_bpc > output_bpc)
-		igt_assert_f(status.dither, "(fb_%dbpc > output_%dbpc): Dither should be enabled\n",
-				fb_bpc, output_bpc);
-	else
-		igt_assert_f(!status.dither, "(fb_%dbpc <= output_%dbpc): Dither should be disabled\n",
+	if (fb_bpc > output_bpc) {
+		if (output_bpc >= IGT_CONNECTOR_BPC_12 &&
+		    intel_display_ver(data->devid) >= 13)
+			igt_assert_f((!status.legacy && status.cc1),
+					"(fb_%dbpc > output_%dbpc): Dither should be "
+					"disabled at end of the PIPE & "
+					"enabled at the CC1.\n",
+					fb_bpc, output_bpc);
+		else
+			igt_assert_f((status.legacy && !status.cc1),
+					"(fb_%dbpc > output_%dbpc): Dither should be "
+					"enabled at end of the PIPE & "
+					"disbaled at the CC1.\n",
+					fb_bpc, output_bpc);
+	} else {
+		igt_assert_f((!status.legacy && !status.cc1),
+				"(fb_%dbpc <= output_%dbpc): Dither should be "
+				"disabled at both places (end of the PIPE & CC1).\n",
 				fb_bpc, output_bpc);
+	}
 
 	return;
 }
@@ -220,6 +244,7 @@ igt_main
 	} tests[] = {
 		{ IGT_FRAME_BUFFER_BPC_8, DRM_FORMAT_XRGB8888, IGT_CONNECTOR_BPC_6 },
 		{ IGT_FRAME_BUFFER_BPC_8, DRM_FORMAT_XRGB8888, IGT_CONNECTOR_BPC_8 },
+		{ IGT_FRAME_BUFFER_BPC_16, DRM_FORMAT_XRGB16161616F, IGT_CONNECTOR_BPC_12 },
 	};
 	int i;
 	data_t data = { 0 };
@@ -227,6 +252,7 @@ igt_main
 	igt_fixture {
 		data.drm_fd = drm_open_driver_master(DRIVER_INTEL);
 		kmstest_set_vt_graphics_mode();
+		data.devid = intel_get_drm_devid(data.drm_fd);
 
 		igt_display_require(&data.display, data.drm_fd);
 		igt_display_require_output(&data.display);
-- 
2.20.1



More information about the Intel-gfx-trybot mailing list