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

Bhanuprakash Modem bhanuprakash.modem at intel.com
Fri Jul 31 15:16:46 UTC 2020


For panels with 12 BPC, and Input is greater than 12 BPC, then driver
should enable the dithering next to the color conversion (CC) blocks.

For panels with less than 12 BPC, dithering will be at the end of the
pipe (legacy).

This patch will add IGT support to validate the newly added dithering
after all CC blocks.

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: Petri Latvala <petri.latvala at intel.com>
Cc: Arkadiusz Hiler <arkadiusz.hiler at intel.com>
Signed-off-by: Bhanuprakash Modem <bhanuprakash.modem at intel.com>
---
 tests/kms_dither.c | 102 ++++++++++++++++++++++++++++++++++++---------
 1 file changed, 82 insertions(+), 20 deletions(-)

diff --git a/tests/kms_dither.c b/tests/kms_dither.c
index 0ff50035..b63a613c 100644
--- a/tests/kms_dither.c
+++ b/tests/kms_dither.c
@@ -49,6 +49,12 @@ enum {
 	TEST_SUSPEND = 1 << 1,
 };
 
+/* Dither at different places */
+typedef struct dither {
+	bool end_of_pipe;
+	bool after_cc;
+} dither_t;
+
 /* Common test data. */
 typedef struct data {
 	igt_display_t display;
@@ -85,13 +91,14 @@ static void prepare_test(data_t *data, igt_output_t *output, enum pipe pipe)
 }
 
 /* Returns the current state of dithering from the crtc debugfs. */
-static bool get_dither_state(data_t *data)
+static dither_t get_dither_state(data_t *data)
 {
 	char buf[256];
 	char crtc_name[7];
 	char *start_loc;
 	int fd, res;
 	unsigned int status;
+	dither_t dither;
 
 	snprintf(crtc_name, 7, "crtc-%d", data->pipe_id);
 	fd = igt_debugfs_open(data->drm_fd, crtc_name, O_RDONLY);
@@ -103,8 +110,13 @@ static bool get_dither_state(data_t *data)
 
 	igt_assert(start_loc = strstr(buf, "Dither: "));
 	igt_assert_eq(sscanf(start_loc, "Dither: %u", &status), 1);
+	dither.end_of_pipe = !!status;
+
+	igt_assert(start_loc = strstr(buf, "Dither_CC: "));
+	igt_assert_eq(sscanf(start_loc, "Dither_CC: %u", &status), 1);
+	dither.after_cc = !!status;
 
-	return !!status;
+	return dither;
 }
 
 /* Returns the maximum bpc from the connector debugfs. */
@@ -134,7 +146,7 @@ static void test_dithering(data_t *data, enum pipe pipe,
 			   int output_bpc, uint32_t flags)
 {
 	igt_display_t *display = &data->display;
-	bool enabled;
+	dither_t dither;
 
 	igt_info("Dithering test execution on %s PIPE_%s\n",
 			output->name, kmstest_pipe_name(pipe));
@@ -153,24 +165,71 @@ static void test_dithering(data_t *data, enum pipe pipe,
 		igt_system_suspend_autoresume(SUSPEND_STATE_MEM,
 					      SUSPEND_TEST_NONE);
 
+	dither = get_dither_state(data);
+
+	igt_info("FB BPC:%d, Panel BPC:%d, Dither status (after CC, end of pipe): (%u,%u)\n",
+                          fb_bpc, output_bpc, dither.after_cc_1, dither.end_of_pipe);
+
 	/*
-	 * Check the status of Dithering block:
-	 * If fb_bpc is greater than output_bpc, Dithering should be enabled
-	 * Else disabled
+	 * If framebuffer or input BPC is greater than the panel BPC, then Dithering
+	 * should be enabled.
+	 *
+	 * Example:
+	 *     For panels with 12 BPC, and Input is greater than 12 BPC, then driver
+	 *     should enable the dithering next to the color conversion (CC) blocks.
+	 *     For panels with less than 12 BPC, dithering will be at the end of the
+	 *     pipe.
+	 *
+	 * Below is the truth table:
+	 *
+	 * |----------------|---------|-------------|-------------|
+	 * |  Frame buffer  |  Panel  |  Dithering  |  Dithering  |
+	 * |                |         |  (After CC) |(end of pipe)|
+	 * |----------------|---------|-------------|-------------|
+	 * |      8 BPC     |  6 BPC  |     No      |     Yes     |
+	 * |----------------|---------|-------------|-------------|
+	 * |      8 BPC     |  8 BPC  |     No      |     No      |
+	 * |----------------|---------|-------------|-------------|
+	 * |      8 BPC     | 10 BPC  |     No      |     No      |
+	 * |----------------|---------|-------------|-------------|
+	 * |      8 BPC     | 12 BPC  |     No      |     No      |
+	 * |----------------|---------|-------------|-------------|
+	 * |     10 BPC     |  6 BPC  |     No      |     Yes     |
+	 * |----------------|---------|-------------|-------------|
+	 * |     10 BPC     |  8 BPC  |     No      |     Yes     |
+	 * |----------------|---------|-------------|-------------|
+	 * |     10 BPC     | 10 BPC  |     No      |     No      |
+	 * |----------------|---------|-------------|-------------|
+	 * |     10 BPC     | 12 BPC  |     No      |     No      |
+	 * |----------------|---------|-------------|-------------|
+	 * |     16 BPC     |  6 BPC  |     No      |     Yes     |
+	 * |----------------|---------|-------------|-------------|
+	 * |     16 BPC     |  8 BPC  |     No      |     Yes     |
+	 * |----------------|---------|-------------|-------------|
+	 * |     16 BPC     | 10 BPC  |     No      |     Yes     |
+	 * |----------------|---------|-------------|-------------|
+	 * |     16 BPC     | 12 BPC  |     Yes     |     No      |
+	 * |----------------|---------|-------------|-------------|
+	 *
 	 */
-	enabled = get_dither_state(data);
 
-	igt_debug("FB BPC:%d, Panel BPC:%d, Expected Dither:%s, Actual result:%s\n",
-		  fb_bpc, output_bpc,
-		  (fb_bpc > output_bpc) ? "Enable": "Disable",
-		  enabled ? "Enable": "Disable");
-
-	if (fb_bpc > output_bpc)
-		igt_assert_f(enabled, "(fb_%dbpc > output_%dbpc): Dither should be enabled\n",
-				fb_bpc, output_bpc);
-	else
-		igt_assert_f(!enabled, "(fb_%dbpc <= output_%dbpc): Dither should be disabled\n",
-				fb_bpc, output_bpc);
+	if (fb_bpc > output_bpc) {
+		if (output_bpc == IGT_CONNECTOR_BPC_12)
+			igt_assert_f((!dither.end_of_pipe && dither.after_cc),
+				     "(fb_%dbpc > output_%dbpc): Dither should be enabled after CC "
+				     "& disabled at end of the pipe\n",
+				     fb_bpc, output_bpc);
+		else
+			igt_assert_f((dither.end_of_pipe && !dither.after_cc),
+				     "(fb_%dbpc > output_%dbpc): Dither should be disabled after CC "
+				     "& enabled at end of the pipe\n",
+				     fb_bpc, output_bpc);
+	}
+	else {
+		igt_assert_f((!dither.end_of_pipe && !dither.after_cc),
+			     "(fb_%dbpc <= output_%dbpc): Dither should be disabled\n",
+			     fb_bpc, output_bpc);
+	}
 
 	igt_plane_set_fb(data->primary, NULL);
 	igt_output_set_pipe(output, PIPE_NONE);
@@ -230,7 +289,8 @@ igt_main
 	int output_bpc[] = {
 		IGT_CONNECTOR_BPC_6,
 		IGT_CONNECTOR_BPC_8,
-		IGT_CONNECTOR_BPC_10
+		IGT_CONNECTOR_BPC_10,
+		IGT_CONNECTOR_BPC_12
 	};
 	int i, j;
 	data_t data = { 0 };
@@ -245,8 +305,10 @@ igt_main
 
 	for (i = 0; i < ARRAY_SIZE(fb_formats); i++) {
 		for (j = 0; j < ARRAY_SIZE(output_bpc); j++) {
-			igt_describe_f("Framebuffer BPC:%d, Panel BPC:%d, Expected Dither:%s\n",
+			igt_describe_f("Framebuffer BPC:%d, Panel BPC:%d, Expected Dither (%s):%s\n",
 				       fb_formats[i].bpc, output_bpc[j],
+				       (output_bpc[j] == IGT_CONNECTOR_BPC_12) ?
+							"after CC blocks" : "at end of the pipe",
 				       (fb_formats[i].bpc > output_bpc[j]) ? "Enable": "Disable");
 
 			igt_subtest_with_dynamic_f("FB-%dBPC-Vs-Panel-%dBPC",
-- 
2.20.1



More information about the Intel-gfx-trybot mailing list