All of lore.kernel.org
 help / color / mirror / Atom feed
* [igt-dev] [PATCH i-g-t 0/6] VDSC YCbCr420 + Fractional BPP
@ 2022-11-25 11:58 Swati Sharma
  2022-11-25 11:58 ` [igt-dev] [PATCH i-g-t 1/6] lib/kms: Add helpers for VDSC YCbCr420 debugfs entry Swati Sharma
                   ` (6 more replies)
  0 siblings, 7 replies; 12+ messages in thread
From: Swati Sharma @ 2022-11-25 11:58 UTC (permalink / raw)
  To: igt-dev

In this series, fractional BPP patches are added
on top of VDSC YCbCr420 from
https://patchwork.freedesktop.org/series/110336/

Swati Sharma (6):
  lib/kms: Add helpers for VDSC YCbCr420 debugfs entry
  tests/i915/kms_dsc: Prep work for extending val support for VDSC
    YCbCr420
  tests/i915/kms_dsc: Enable validation for VDSC YCbCr420
  lib/kms: Add helpers for VDSC Fractional BPP debugfs entry
  tests/i915/kms_dsc: Enable validation for VDSC Fractional BPP
  tests/i915/kms_dsc: Add test summary

 lib/igt_kms.c        | 145 ++++++++++++++++++++
 lib/igt_kms.h        |  11 +-
 tests/i915/kms_dsc.c | 312 +++++++++++++++++++++++++++++++++++--------
 3 files changed, 411 insertions(+), 57 deletions(-)

-- 
2.25.1

^ permalink raw reply	[flat|nested] 12+ messages in thread

* [igt-dev] [PATCH i-g-t 1/6] lib/kms: Add helpers for VDSC YCbCr420 debugfs entry
  2022-11-25 11:58 [igt-dev] [PATCH i-g-t 0/6] VDSC YCbCr420 + Fractional BPP Swati Sharma
@ 2022-11-25 11:58 ` Swati Sharma
  2022-11-25 11:58 ` [igt-dev] [PATCH i-g-t 2/6] tests/i915/kms_dsc: Prep work for extending val support for VDSC YCbCr420 Swati Sharma
                   ` (5 subsequent siblings)
  6 siblings, 0 replies; 12+ messages in thread
From: Swati Sharma @ 2022-11-25 11:58 UTC (permalink / raw)
  To: igt-dev

Helper functions are added for getting/setting VDSC YCbCr420 debugfs entry.

Signed-off-by: Swati Sharma <swati2.sharma@intel.com>
---
 lib/igt_kms.c | 67 +++++++++++++++++++++++++++++++++++++++++++++++++++
 lib/igt_kms.h |  7 ++++--
 2 files changed, 72 insertions(+), 2 deletions(-)

diff --git a/lib/igt_kms.c b/lib/igt_kms.c
index b4a98ae17..c7135790b 100644
--- a/lib/igt_kms.c
+++ b/lib/igt_kms.c
@@ -5578,6 +5578,20 @@ bool check_dsc_debugfs(int drmfd, char *connector_name,
 	return strstr(buf, check_str);
 }
 
+static
+bool check_dsc_ycbcr420_debugfs(int drmfd, char *connector_name,
+                                const char *check_str)
+{
+	char file_name[128] = {0};
+	char buf[512];
+
+	sprintf(file_name, "%s/i915_dsc_ycbcr420", connector_name);
+
+	igt_debugfs_read(drmfd, file_name, buf);
+
+	return strstr(buf, check_str);
+}
+
 static
 int write_dsc_debugfs(int drmfd, char *connector_name,
 		      const char *file_name,
@@ -5609,6 +5623,18 @@ bool igt_is_dsc_supported(int drmfd, char *connector_name)
 	return check_dsc_debugfs(drmfd, connector_name, "DSC_Sink_Support: yes");
 }
 
+/*
+ * igt_is_dsc_ycbcr420_supported:
+ * @drmfd: A drm file descriptor
+ * @connector_name: Name of the libdrm connector we're going to use
+ *
+ * Returns: True if DSC YCbCr420 is supported for the given connector, false otherwise.
+ */
+bool igt_is_dsc_ycbcr420_supported(int drmfd, char *connector_name)
+{
+	return check_dsc_debugfs(drmfd, connector_name, "DSC_YCBCR420_Sink_Support: yes");
+}
+
 /*
  * igt_is_fec_supported:
  * @drmfd: A drm file descriptor
@@ -5646,6 +5672,19 @@ bool igt_is_force_dsc_enabled(int drmfd, char *connector_name)
 	return check_dsc_debugfs(drmfd, connector_name, "Force_DSC_Enable: yes");
 }
 
+/*
+ * igt_is_force_dsc_ycbcr420_enabled:
+ * @drmfd: A drm file descriptor
+ * @connector_name: Name of the libdrm connector we're going to use
+ *
+ * Returns: True if DSC YCbCr420 is force enabled (via debugfs) for the given connector,
+ * false otherwise.
+ */
+bool igt_is_force_dsc_ycbcr420_enabled(int drmfd, char *connector_name)
+{
+	return check_dsc_ycbcr420_debugfs(drmfd, connector_name, "Force_DSC_YCBCR420_Enable: yes");
+}
+
 /*
  * igt_force_dsc_enable:
  * @drmfd: A drm file descriptor
@@ -5658,6 +5697,18 @@ int igt_force_dsc_enable(int drmfd, char *connector_name)
 	return write_dsc_debugfs(drmfd, connector_name, "i915_dsc_fec_support", "1");
 }
 
+/*
+ * igt_force_dsc_ycbcr420_enable:
+ * @drmfd: A drm file descriptor
+ * @connector_name: Name of the libdrm connector we're going to use
+ *
+ * Returns: 1 on success or negative error code, in case of failure.
+ */
+int igt_force_dsc_ycbcr420_enable(int drmfd, char *connector_name)
+{
+	return write_dsc_debugfs(drmfd, connector_name, "i915_dsc_ycbcr420", "1");
+}
+
 /*
  * igt_force_dsc_enable_bpc:
  * @drmfd: A drm file descriptor
@@ -5691,6 +5742,22 @@ int igt_get_dsc_debugfs_fd(int drmfd, char *connector_name)
 	return openat(igt_debugfs_dir(drmfd), file_name, O_WRONLY);
 }
 
+/*
+ * igt_get_dsc_ycbcr420_debugfs_fd:
+ * @drmfd: A drm file descriptor
+ * @connector_name: Name of the libdrm connector we're going to use
+ *
+ * Returns: fd of the DSC YCbCr420 debugfs for the given connector, else returns -1.
+ */
+int igt_get_dsc_ycbcr420_debugfs_fd(int drmfd, char *connector_name)
+{
+	char file_name[128] = {0};
+
+	sprintf(file_name, "%s/i915_dsc_ycbcr420", connector_name);
+
+	return openat(igt_debugfs_dir(drmfd), file_name, O_WRONLY);
+}
+
 /*
  * igt_get_output_max_bpc:
  * @drmfd: A drm file descriptor
diff --git a/lib/igt_kms.h b/lib/igt_kms.h
index 7a00d2045..ccd8adf2c 100644
--- a/lib/igt_kms.h
+++ b/lib/igt_kms.h
@@ -976,13 +976,16 @@ void igt_dump_crtcs_fd(int drmfd);
 bool igt_override_all_active_output_modes_to_fit_bw(igt_display_t *display);
 
 bool igt_is_dsc_supported(int drmfd, char *connector_name);
+bool igt_is_dsc_ycbcr420_supported(int drmfd, char *connector_name);
 bool igt_is_fec_supported(int drmfd, char *connector_name);
 bool igt_is_dsc_enabled(int drmfd, char *connector_name);
 bool igt_is_force_dsc_enabled(int drmfd, char *connector_name);
+bool igt_is_force_dsc_ycbcr420_enabled(int drmfd, char *connector_name);
 int igt_force_dsc_enable(int drmfd, char *connector_name);
-int igt_force_dsc_enable_bpc(int drmfd, char *connector_name,
-			     int bpc);
+int igt_force_dsc_enable_bpc(int drmfd, char *connector_name, int bpc);
+int igt_force_dsc_ycbcr420_enable(int drmfd, char *connector_name);
 int igt_get_dsc_debugfs_fd(int drmfd, char *connector_name);
+int igt_get_dsc_ycbcr420_debugfs_fd(int drmfd, char *connector_name);
 
 unsigned int igt_get_output_max_bpc(int drmfd, char *connector_name);
 unsigned int igt_get_pipe_current_bpc(int drmfd, enum pipe pipe);
-- 
2.25.1

^ permalink raw reply related	[flat|nested] 12+ messages in thread

* [igt-dev] [PATCH i-g-t 2/6] tests/i915/kms_dsc: Prep work for extending val support for VDSC YCbCr420
  2022-11-25 11:58 [igt-dev] [PATCH i-g-t 0/6] VDSC YCbCr420 + Fractional BPP Swati Sharma
  2022-11-25 11:58 ` [igt-dev] [PATCH i-g-t 1/6] lib/kms: Add helpers for VDSC YCbCr420 debugfs entry Swati Sharma
@ 2022-11-25 11:58 ` Swati Sharma
  2022-11-25 11:58 ` [igt-dev] [PATCH i-g-t 3/6] tests/i915/kms_dsc: Enable validation " Swati Sharma
                   ` (4 subsequent siblings)
  6 siblings, 0 replies; 12+ messages in thread
From: Swati Sharma @ 2022-11-25 11:58 UTC (permalink / raw)
  To: igt-dev

Functions are modified to accommodate changes for VDSC YCbCr420.

Signed-off-by: Swati Sharma <swati2.sharma@intel.com>
---
 tests/i915/kms_dsc.c | 25 +++++++++++++++++--------
 1 file changed, 17 insertions(+), 8 deletions(-)

diff --git a/tests/i915/kms_dsc.c b/tests/i915/kms_dsc.c
index 330fc050b..6fef764de 100644
--- a/tests/i915/kms_dsc.c
+++ b/tests/i915/kms_dsc.c
@@ -61,6 +61,7 @@ typedef struct {
 	igt_output_t *output;
 	int input_bpc;
 	int n_pipes;
+	int disp_ver;
 	enum pipe pipe;
 } data_t;
 
@@ -91,7 +92,7 @@ static void force_dsc_enable(data_t *data)
 	igt_debug("Forcing DSC enable on %s\n", data->output->name);
 	ret = igt_force_dsc_enable(data->drm_fd,
 				   data->output->name);
-	igt_assert_f(ret > 0, "debugfs_write failed");
+	igt_assert_f(ret > 0, "forcing dsc enable debugfs_write failed\n");
 }
 
 static void force_dsc_enable_bpc(data_t *data)
@@ -103,7 +104,7 @@ static void force_dsc_enable_bpc(data_t *data)
 	ret = igt_force_dsc_enable_bpc(data->drm_fd,
 				       data->output->name,
 				       data->input_bpc);
-	igt_assert_f(ret > 0, "debugfs_write failed");
+	igt_assert_f(ret > 0, "forcing input dsc bpc debugfs_write failed\n");
 }
 
 static void save_force_dsc_en(data_t *data)
@@ -222,7 +223,8 @@ static void test_cleanup(data_t *data)
 }
 
 /* re-probe connectors and do a modeset with DSC */
-static void update_display(data_t *data, enum dsc_test_type test_type, unsigned int plane_format)
+static void update_display(data_t *data, enum dsc_test_type test_type,
+			   unsigned int plane_format)
 {
 	bool enabled;
 	igt_plane_t *primary;
@@ -324,6 +326,12 @@ static void test_dsc(data_t *data, enum dsc_test_type test_type, int bpc,
 	}
 }
 
+static void run_test(data_t *data, enum dsc_test_type test_type, int bpc,
+		     unsigned int plane_format)
+{
+	test_dsc(data, test_type, bpc, plane_format);
+}
+
 igt_main
 {
 	data_t data = {};
@@ -332,11 +340,12 @@ igt_main
 	igt_fixture {
 		data.drm_fd = drm_open_driver_master(DRIVER_INTEL);
 		data.devid = intel_get_drm_devid(data.drm_fd);
+		data.disp_ver = intel_display_ver(data.devid);
 		kmstest_set_vt_graphics_mode();
 		igt_install_exit_handler(kms_dsc_exit_handler);
 		igt_display_require(&data.display, data.drm_fd);
 		igt_display_require_output(&data.display);
-		igt_require(intel_display_ver(data.devid) >= 11);
+		igt_require(data.disp_ver >= 11);
 		data.n_pipes = 0;
 		for_each_pipe(&data.display, i)
 			data.n_pipes++;
@@ -346,14 +355,14 @@ igt_main
 		     "by a connector by forcing DSC on all connectors that support it "
 		     "with default parameters");
 	igt_subtest_with_dynamic("basic-dsc")
-			test_dsc(&data, TEST_DSC_BASIC, 0, DRM_FORMAT_XRGB8888);
+			run_test(&data, TEST_DSC_BASIC, 0, DRM_FORMAT_XRGB8888);
 
 	igt_describe("Tests basic display stream compression functionality if supported "
 		     "by a connector by forcing DSC on all connectors that support it "
 		     "with default parameters and creating fb with diff formats");
 	igt_subtest_with_dynamic("dsc-with-formats") {
 		for (int k = 0; k < ARRAY_SIZE(format_list); k++)
-			test_dsc(&data, TEST_DSC_BASIC, 0, format_list[k].format);
+			run_test(&data, TEST_DSC_BASIC, 0, format_list[k].format);
 	}
 
 	igt_describe("Tests basic display stream compression functionality if supported "
@@ -361,7 +370,7 @@ igt_main
 		     "with certain input BPC for the connector");
 	igt_subtest_with_dynamic("dsc-with-bpc") {
 		for (int j = 0; j < ARRAY_SIZE(bpc_list); j++)
-			test_dsc(&data, TEST_DSC_BPC, bpc_list[j], DRM_FORMAT_XRGB8888);
+			run_test(&data, TEST_DSC_BPC, bpc_list[j], DRM_FORMAT_XRGB8888);
 	}
 
 	igt_describe("Tests basic display stream compression functionality if supported "
@@ -370,7 +379,7 @@ igt_main
 	igt_subtest_with_dynamic("dsc-with-bpc-formats") {
 		for (int j = 0; j < ARRAY_SIZE(bpc_list); j++) {
 			for (int k = 0; k < ARRAY_SIZE(format_list); k++) {
-				test_dsc(&data, TEST_DSC_BPC, bpc_list[j], format_list[k].format);
+				run_test(&data, TEST_DSC_BPC, bpc_list[j], format_list[k].format);
 			}
 		}
 	}
-- 
2.25.1

^ permalink raw reply related	[flat|nested] 12+ messages in thread

* [igt-dev] [PATCH i-g-t 3/6] tests/i915/kms_dsc: Enable validation for VDSC YCbCr420
  2022-11-25 11:58 [igt-dev] [PATCH i-g-t 0/6] VDSC YCbCr420 + Fractional BPP Swati Sharma
  2022-11-25 11:58 ` [igt-dev] [PATCH i-g-t 1/6] lib/kms: Add helpers for VDSC YCbCr420 debugfs entry Swati Sharma
  2022-11-25 11:58 ` [igt-dev] [PATCH i-g-t 2/6] tests/i915/kms_dsc: Prep work for extending val support for VDSC YCbCr420 Swati Sharma
@ 2022-11-25 11:58 ` Swati Sharma
  2022-12-23 11:39   ` Nautiyal, Ankit K
  2022-11-25 11:58 ` [igt-dev] [PATCH i-g-t 4/6] lib/kms: Add helpers for VDSC Fractional BPP debugfs entry Swati Sharma
                   ` (3 subsequent siblings)
  6 siblings, 1 reply; 12+ messages in thread
From: Swati Sharma @ 2022-11-25 11:58 UTC (permalink / raw)
  To: igt-dev

Existing i-g-t is extended to enable validation for VDSC YCbCr420.
If a mode is supported in both RGB and YCbCr420 output formats by the
sink, i915 driver policy is to try RGB first and fall back to YCbCr420, if
mode cannot be shown using RGB. To test YCbCr420, we need a debugfs
entry (force_dsc_ycbcr420) to force this output format; so that YCbCr420 code
gets executed.
From i-g-t, we have set this debugfs entry. However, before setting
debugfs entry, we have checked capability i.e. YCbCr420 is supported by
both platform (D14+) and sink.
Also, all the modes doesn't support both YCbCr420 and RGB formats; so if
sink and platform supports YCbCr420 we will do try commit with each mode
till we get a successful commit.

v2: -used is_dsc_ycbcr420_supported() (Ankit)
    -handled try-commit correctly (Ankit)
    -instead of flag use enum for output formats (Ankit)

Signed-off-by: Swati Sharma <swati2.sharma@intel.com>
---
 tests/i915/kms_dsc.c | 195 ++++++++++++++++++++++++++++++++-----------
 1 file changed, 147 insertions(+), 48 deletions(-)

diff --git a/tests/i915/kms_dsc.c b/tests/i915/kms_dsc.c
index 6fef764de..6a3eecdb4 100644
--- a/tests/i915/kms_dsc.c
+++ b/tests/i915/kms_dsc.c
@@ -53,6 +53,11 @@ enum dsc_test_type {
 	TEST_DSC_BPC
 };
 
+enum dsc_output_format {
+	DSC_FORMAT_RGB444,
+	DSC_FORMAT_YCBCR420
+};
+
 typedef struct {
 	int drm_fd;
 	uint32_t devid;
@@ -66,7 +71,10 @@ typedef struct {
 } data_t;
 
 bool force_dsc_en_orig;
+bool force_dsc_ycbcr420_en_orig;
 int force_dsc_restore_fd = -1;
+int force_dsc_ycbcr420_restore_fd = -1;
+static int count = 0;
 
 const struct {
 	const int format;
@@ -107,6 +115,16 @@ static void force_dsc_enable_bpc(data_t *data)
 	igt_assert_f(ret > 0, "forcing input dsc bpc debugfs_write failed\n");
 }
 
+static void force_dsc_ycbcr420_enable(data_t *data)
+{
+	int ret;
+
+	igt_debug("Forcing DSC YCbCr420 on %s\n", data->output->name);
+	ret = igt_force_dsc_ycbcr420_enable(data->drm_fd,
+					    data->output->name);
+	igt_assert_f(ret > 0, "forcing dsc ycbcr420 debugfs_write failed\n");
+}
+
 static void save_force_dsc_en(data_t *data)
 {
 	force_dsc_en_orig =
@@ -130,9 +148,34 @@ static void restore_force_dsc_en(void)
 	force_dsc_restore_fd = -1;
 }
 
+static void save_force_dsc_ycbcr420_en(data_t *data)
+{
+	force_dsc_ycbcr420_en_orig =
+		igt_is_force_dsc_ycbcr420_enabled(data->drm_fd,
+						  data->output->name);
+	force_dsc_ycbcr420_restore_fd =
+		igt_get_dsc_ycbcr420_debugfs_fd(data->drm_fd,
+						data->output->name);
+	igt_assert(force_dsc_ycbcr420_restore_fd >= 0);
+}
+
+static void restore_force_dsc_ycbcr420_en(void)
+{
+	if (force_dsc_ycbcr420_restore_fd < 0)
+		return;
+
+	igt_debug("Restoring DSC YCbCr420 enable\n");
+	igt_assert(write(force_dsc_ycbcr420_restore_fd, force_dsc_ycbcr420_en_orig ? "1" : "0", 1) == 1);
+
+	close(force_dsc_ycbcr420_restore_fd);
+	force_dsc_ycbcr420_restore_fd = -1;
+}
+
+
 static void kms_dsc_exit_handler(int sig)
 {
 	restore_force_dsc_en();
+	restore_force_dsc_ycbcr420_en();
 }
 
 static drmModeModeInfo *get_highres_mode(igt_output_t *output)
@@ -147,6 +190,20 @@ static drmModeModeInfo *get_highres_mode(igt_output_t *output)
 	return highest_mode;
 }
 
+static drmModeModeInfo *get_next_mode(igt_output_t *output)
+{
+	drmModeConnector *connector = output->config.connector;
+	drmModeModeInfo *next_mode = NULL;
+
+	for (int i = count; i < connector->count_modes; i++) {
+		next_mode = &connector->modes[i];
+		count ++;
+		break;
+	}
+
+	return next_mode;
+}
+
 static bool check_dsc_on_connector(data_t *data)
 {
 	igt_output_t *output = data->output;
@@ -167,6 +224,19 @@ static bool check_dsc_on_connector(data_t *data)
 	return true;
 }
 
+static bool is_dsc_ycbcr420_supported(data_t *data)
+{
+	igt_output_t *output = data->output;
+
+	if (!igt_is_dsc_ycbcr420_supported(data->drm_fd, output->name)) {
+		igt_debug("DSC YCbCr420 not supported on connector %s\n",
+			  output->name);
+		return false;
+	}
+
+	return true;
+}
+
 static bool check_big_joiner_pipe_constraint(data_t *data)
 {
 	igt_output_t *output = data->output;
@@ -224,75 +294,100 @@ static void test_cleanup(data_t *data)
 
 /* re-probe connectors and do a modeset with DSC */
 static void update_display(data_t *data, enum dsc_test_type test_type,
-			   unsigned int plane_format)
+			   unsigned int plane_format, enum dsc_output_format output_format)
 {
+	int ret;
 	bool enabled;
 	igt_plane_t *primary;
 	drmModeModeInfo *mode;
+	bool test_complete = false;
 	igt_output_t *output = data->output;
 	igt_display_t *display = &data->display;
 
-	/* sanitize the state before starting the subtest */
-	igt_display_reset(display);
-	igt_display_commit(display);
+	count = 0;
+	while (!test_complete) {
+		/* sanitize the state before starting the subtest */
+		igt_display_reset(display);
+		igt_display_commit(display);
 
-	igt_debug("DSC is supported on %s\n", data->output->name);
-	save_force_dsc_en(data);
-	force_dsc_enable(data);
+		igt_debug("DSC is supported on %s\n", data->output->name);
+		save_force_dsc_en(data);
+		force_dsc_enable(data);
 
-	if (test_type == TEST_DSC_BPC) {
-		igt_debug("Trying to set input BPC to %d\n", data->input_bpc);
-		force_dsc_enable_bpc(data);
-	}
+		if (output_format == DSC_FORMAT_YCBCR420) {
+			igt_debug("DSC YCbCr420 is supported on %s\n", data->output->name);
+			save_force_dsc_ycbcr420_en(data);
+			force_dsc_ycbcr420_enable(data);
+		}
 
-	igt_output_set_pipe(output, data->pipe);
+		if (test_type == TEST_DSC_BPC) {
+			igt_debug("Trying to set input BPC to %d\n", data->input_bpc);
+			force_dsc_enable_bpc(data);
+		}
 
-	mode = get_highres_mode(output);
-	igt_require(mode != NULL);
-	igt_output_override_mode(output, mode);
+		igt_output_set_pipe(output, data->pipe);
 
-	primary = igt_output_get_plane_type(output, DRM_PLANE_TYPE_PRIMARY);
+		if (output_format == DSC_FORMAT_YCBCR420)
+			mode = get_next_mode(output);
+		else
+			mode = get_highres_mode(output);
 
-	igt_skip_on(!igt_plane_has_format_mod(primary, plane_format,
-		    DRM_FORMAT_MOD_LINEAR));
+		igt_require(mode != NULL);
+		igt_output_override_mode(output, mode);
 
-	igt_create_pattern_fb(data->drm_fd,
-			      mode->hdisplay,
-			      mode->vdisplay,
-			      plane_format,
-			      DRM_FORMAT_MOD_LINEAR,
-			      &data->fb_test_pattern);
+		primary = igt_output_get_plane_type(output, DRM_PLANE_TYPE_PRIMARY);
 
-	igt_plane_set_fb(primary, &data->fb_test_pattern);
-	igt_display_commit(display);
+		igt_skip_on(!igt_plane_has_format_mod(primary, plane_format,
+			    DRM_FORMAT_MOD_LINEAR));
 
-	/* until we have CRC check support, manually check if RGB test
-	 * pattern has no corruption.
-	 */
-	manual("RGB test pattern without corruption");
+		igt_create_pattern_fb(data->drm_fd,
+				      mode->hdisplay,
+				      mode->vdisplay,
+				      plane_format,
+				      DRM_FORMAT_MOD_LINEAR,
+				      &data->fb_test_pattern);
 
-	enabled = igt_is_dsc_enabled(data->drm_fd, output->name);
-	igt_info("Current mode is: %dx%d @%dHz -- DSC is: %s\n",
-				mode->hdisplay,
-				mode->vdisplay,
-				mode->vrefresh,
-				enabled ? "ON" : "OFF");
+		igt_plane_set_fb(primary, &data->fb_test_pattern);
+		ret = igt_display_try_commit_atomic(display, DRM_MODE_ATOMIC_ALLOW_MODESET, NULL);
+		if (ret == 0) {
+			igt_display_commit(display);
+			test_complete = true;
+		} else if (output_format == DSC_FORMAT_YCBCR420) {
+			continue;
+		}
 
-	restore_force_dsc_en();
-	igt_debug("Reset compression BPC\n");
-	data->input_bpc = 0;
-	force_dsc_enable_bpc(data);
+		igt_assert_eq(ret, 0);
+
+		/* until we have CRC check support, manually check if RGB test
+		 * pattern has no corruption.
+		 */
+		manual("RGB test pattern without corruption");
+
+		enabled = igt_is_dsc_enabled(data->drm_fd, output->name);
+		igt_info("Current mode is: %dx%d @%dHz -- DSC is: %s\n",
+					mode->hdisplay,
+					mode->vdisplay,
+					mode->vrefresh,
+					enabled ? "ON" : "OFF");
+
+		restore_force_dsc_en();
+		if (output_format == DSC_FORMAT_YCBCR420)
+			restore_force_dsc_ycbcr420_en();
+		igt_debug("Reset compression BPC\n");
+		data->input_bpc = 0;
+		force_dsc_enable_bpc(data);
 
-	igt_assert_f(enabled,
-		     "Default DSC enable failed on connector: %s pipe: %s\n",
-		     output->name,
-		     kmstest_pipe_name(data->pipe));
+		igt_assert_f(enabled,
+			    "Default DSC enable failed on connector: %s pipe: %s\n",
+			    output->name,
+			    kmstest_pipe_name(data->pipe));
 
-	test_cleanup(data);
+		test_cleanup(data);
+	}
 }
 
 static void test_dsc(data_t *data, enum dsc_test_type test_type, int bpc,
-		     unsigned int plane_format)
+		     unsigned int plane_format, enum dsc_output_format output_format)
 {
 	igt_display_t *display = &data->display;
 	igt_output_t *output;
@@ -322,14 +417,18 @@ static void test_dsc(data_t *data, enum dsc_test_type test_type, int bpc,
 			snprintf(name, sizeof(name), "-%s", igt_format_str(plane_format));
 
 		igt_dynamic_f("pipe-%s-%s%s",  kmstest_pipe_name(data->pipe), data->output->name, name)
-			update_display(data, test_type, plane_format);
+			update_display(data, test_type, plane_format, output_format);
 	}
 }
 
 static void run_test(data_t *data, enum dsc_test_type test_type, int bpc,
 		     unsigned int plane_format)
 {
-	test_dsc(data, test_type, bpc, plane_format);
+	test_dsc(data, test_type, bpc, plane_format, DSC_FORMAT_RGB444);
+
+	/* YCbCr420 DSC is supported on display version 14+ */
+	if ((data->disp_ver >= 14) && (is_dsc_ycbcr420_supported(data)))
+		test_dsc(data, test_type, bpc, plane_format, DSC_FORMAT_YCBCR420);
 }
 
 igt_main
-- 
2.25.1

^ permalink raw reply related	[flat|nested] 12+ messages in thread

* [igt-dev] [PATCH i-g-t 4/6] lib/kms: Add helpers for VDSC Fractional BPP debugfs entry
  2022-11-25 11:58 [igt-dev] [PATCH i-g-t 0/6] VDSC YCbCr420 + Fractional BPP Swati Sharma
                   ` (2 preceding siblings ...)
  2022-11-25 11:58 ` [igt-dev] [PATCH i-g-t 3/6] tests/i915/kms_dsc: Enable validation " Swati Sharma
@ 2022-11-25 11:58 ` Swati Sharma
  2022-12-23 12:06   ` Nautiyal, Ankit K
  2022-12-26  6:05   ` Nautiyal, Ankit K
  2022-11-25 11:58 ` [igt-dev] [PATCH i-g-t 5/6] tests/i915/kms_dsc: Enable validation for VDSC Fractional BPP Swati Sharma
                   ` (2 subsequent siblings)
  6 siblings, 2 replies; 12+ messages in thread
From: Swati Sharma @ 2022-11-25 11:58 UTC (permalink / raw)
  To: igt-dev

Helper functions are added for getting/setting VDSC Fractional BPP
debugfs entry.

Signed-off-by: Swati Sharma <swati2.sharma@intel.com>
---
 lib/igt_kms.c | 78 +++++++++++++++++++++++++++++++++++++++++++++++++++
 lib/igt_kms.h |  4 +++
 2 files changed, 82 insertions(+)

diff --git a/lib/igt_kms.c b/lib/igt_kms.c
index c7135790b..93f45410c 100644
--- a/lib/igt_kms.c
+++ b/lib/igt_kms.c
@@ -5592,6 +5592,20 @@ bool check_dsc_ycbcr420_debugfs(int drmfd, char *connector_name,
 	return strstr(buf, check_str);
 }
 
+static
+bool check_dsc_fractional_bpp_debugfs(int drmfd, char *connector_name,
+				      const char *check_str)
+{
+	char file_name[128] = {0};
+	char buf[512];
+
+	sprintf(file_name, "%s/i915_dsc_fractional_bpp", connector_name);
+
+	igt_debugfs_read(drmfd, file_name, buf);
+
+	return strstr(buf, check_str);
+}
+
 static
 int write_dsc_debugfs(int drmfd, char *connector_name,
 		      const char *file_name,
@@ -5623,6 +5637,29 @@ bool igt_is_dsc_supported(int drmfd, char *connector_name)
 	return check_dsc_debugfs(drmfd, connector_name, "DSC_Sink_Support: yes");
 }
 
+/*
+ * igt_get_dsc_fractional_bpp_supported:
+ * @drmfd: A drm file descriptor
+ * @connector_name: Name of the libdrm connector we're going to use
+ *
+ * Returns: The dsc sink bpp precision.
+ */
+int igt_get_dsc_fractional_bpp_supported(int drmfd, char *connector_name)
+{
+	char file_name[128] = {0};
+	char buf[24];
+	char *start_loc;
+	int bpp_prec;
+
+	sprintf(file_name, "%s/i915_dsc_fec_support", connector_name);
+	igt_debugfs_read(drmfd, file_name, buf);
+
+	igt_assert(start_loc = strstr(buf, "DSC_Sink_BPP_Precision: "));
+	igt_assert_eq(sscanf(start_loc, "DSC_Sink_BPP_Precision: %d", &bpp_prec), 1);
+
+	return bpp_prec;
+}
+
 /*
  * igt_is_dsc_ycbcr420_supported:
  * @drmfd: A drm file descriptor
@@ -5685,6 +5722,19 @@ bool igt_is_force_dsc_ycbcr420_enabled(int drmfd, char *connector_name)
 	return check_dsc_ycbcr420_debugfs(drmfd, connector_name, "Force_DSC_YCBCR420_Enable: yes");
 }
 
+/*
+ * igt_is_force_dsc_fractional_bpp_enabled:
+ * @drmfd: A drm file descriptor
+ * @connector_name: Name of the libdrm connector we're going to use
+ *
+ * Returns: True if DSC Fractional BPP is force enabled (via debugfs) for the given connector,
+ * false otherwise.
+ */
+bool igt_is_force_dsc_fractional_bpp_enabled(int drmfd, char *connector_name)
+{
+	return check_dsc_fractional_bpp_debugfs(drmfd, connector_name, "Force_DSC_Fractional_BPP_Enable: yes");
+}
+
 /*
  * igt_force_dsc_enable:
  * @drmfd: A drm file descriptor
@@ -5709,6 +5759,18 @@ int igt_force_dsc_ycbcr420_enable(int drmfd, char *connector_name)
 	return write_dsc_debugfs(drmfd, connector_name, "i915_dsc_ycbcr420", "1");
 }
 
+/*
+ * igt_force_dsc_fractional_bpp_enable:
+ * @drmfd: A drm file descriptor
+ * @connector_name: Name of the libdrm connector we're going to use
+ *
+ * Returns: 1 on success or negative error code, in case of failure.
+ */
+int igt_force_dsc_fractional_bpp_enable(int drmfd, char *connector_name)
+{
+	return write_dsc_debugfs(drmfd, connector_name, "i915_dsc_fractional_bpp", "1");
+}
+
 /*
  * igt_force_dsc_enable_bpc:
  * @drmfd: A drm file descriptor
@@ -5758,6 +5820,22 @@ int igt_get_dsc_ycbcr420_debugfs_fd(int drmfd, char *connector_name)
 	return openat(igt_debugfs_dir(drmfd), file_name, O_WRONLY);
 }
 
+/*
+ * igt_get_dsc_fractional_bpp_debugfs_fd:
+ * @drmfd: A drm file descriptor
+ * @connector_name: Name of the libdrm connector we're going to use
+ *
+ * Returns: fd of the DSC Fractional BPP debugfs for the given connector, else returns -1.
+ */
+int igt_get_dsc_fractional_bpp_debugfs_fd(int drmfd, char *connector_name)
+{
+	char file_name[128] = {0};
+
+	sprintf(file_name, "%s/i915_dsc_fractional_bpp", connector_name);
+
+	return openat(igt_debugfs_dir(drmfd), file_name, O_WRONLY);
+}
+
 /*
  * igt_get_output_max_bpc:
  * @drmfd: A drm file descriptor
diff --git a/lib/igt_kms.h b/lib/igt_kms.h
index ccd8adf2c..990157bbc 100644
--- a/lib/igt_kms.h
+++ b/lib/igt_kms.h
@@ -977,15 +977,19 @@ bool igt_override_all_active_output_modes_to_fit_bw(igt_display_t *display);
 
 bool igt_is_dsc_supported(int drmfd, char *connector_name);
 bool igt_is_dsc_ycbcr420_supported(int drmfd, char *connector_name);
+int igt_get_dsc_fractional_bpp_supported(int drmfd, char *connector_name);
 bool igt_is_fec_supported(int drmfd, char *connector_name);
 bool igt_is_dsc_enabled(int drmfd, char *connector_name);
 bool igt_is_force_dsc_enabled(int drmfd, char *connector_name);
 bool igt_is_force_dsc_ycbcr420_enabled(int drmfd, char *connector_name);
+bool igt_is_force_dsc_fractional_bpp_enabled(int drmfd, char *connector_name);
 int igt_force_dsc_enable(int drmfd, char *connector_name);
 int igt_force_dsc_enable_bpc(int drmfd, char *connector_name, int bpc);
 int igt_force_dsc_ycbcr420_enable(int drmfd, char *connector_name);
+int igt_force_dsc_fractional_bpp_enable(int drmfd, char *connector_name);
 int igt_get_dsc_debugfs_fd(int drmfd, char *connector_name);
 int igt_get_dsc_ycbcr420_debugfs_fd(int drmfd, char *connector_name);
+int igt_get_dsc_fractional_bpp_debugfs_fd(int drmfd, char *connector_name);
 
 unsigned int igt_get_output_max_bpc(int drmfd, char *connector_name);
 unsigned int igt_get_pipe_current_bpc(int drmfd, enum pipe pipe);
-- 
2.25.1

^ permalink raw reply related	[flat|nested] 12+ messages in thread

* [igt-dev] [PATCH i-g-t 5/6] tests/i915/kms_dsc: Enable validation for VDSC Fractional BPP
  2022-11-25 11:58 [igt-dev] [PATCH i-g-t 0/6] VDSC YCbCr420 + Fractional BPP Swati Sharma
                   ` (3 preceding siblings ...)
  2022-11-25 11:58 ` [igt-dev] [PATCH i-g-t 4/6] lib/kms: Add helpers for VDSC Fractional BPP debugfs entry Swati Sharma
@ 2022-11-25 11:58 ` Swati Sharma
  2022-12-26  7:00   ` Nautiyal, Ankit K
  2022-11-25 11:58 ` [igt-dev] [PATCH i-g-t 6/6] tests/i915/kms_dsc: Add test summary Swati Sharma
  2022-11-25 12:39 ` [igt-dev] ✓ Fi.CI.BAT: success for VDSC YCbCr420 + Fractional BPP Patchwork
  6 siblings, 1 reply; 12+ messages in thread
From: Swati Sharma @ 2022-11-25 11:58 UTC (permalink / raw)
  To: igt-dev

Fractional BPP support comes from DSC1.2. To test Fractional BPP, debugfs entry
(force_dsc_fractional_bpp) is introduced. From the IGT; we are setting this
debugfs entry. However, before setting this debugfs entry, we are checking
capability i.e. Fractional BPP is supported by platform and sink both. In driver,
if force_dsc_fractional_bpp is set then while iterating over output bpp with
fractional step size we will continue if output_bpp is computed as integer and
allow DSC iff compressed bpp is fractional.

Signed-off-by: Swati Sharma <swati2.sharma@intel.com>
---
 tests/i915/kms_dsc.c | 91 ++++++++++++++++++++++++++++++++++++++++++--
 1 file changed, 87 insertions(+), 4 deletions(-)

diff --git a/tests/i915/kms_dsc.c b/tests/i915/kms_dsc.c
index 6a3eecdb4..a85066bb9 100644
--- a/tests/i915/kms_dsc.c
+++ b/tests/i915/kms_dsc.c
@@ -50,7 +50,8 @@ IGT_TEST_DESCRIPTION("Test to validate display stream compression");
 
 enum dsc_test_type {
 	TEST_DSC_BASIC,
-	TEST_DSC_BPC
+	TEST_DSC_BPC,
+	TEST_DSC_FRACTIONAL_BPP
 };
 
 enum dsc_output_format {
@@ -72,8 +73,10 @@ typedef struct {
 
 bool force_dsc_en_orig;
 bool force_dsc_ycbcr420_en_orig;
+bool force_dsc_fractional_bpp_en_orig;
 int force_dsc_restore_fd = -1;
 int force_dsc_ycbcr420_restore_fd = -1;
+int force_dsc_fractional_bpp_restore_fd = -1;
 static int count = 0;
 
 const struct {
@@ -125,6 +128,16 @@ static void force_dsc_ycbcr420_enable(data_t *data)
 	igt_assert_f(ret > 0, "forcing dsc ycbcr420 debugfs_write failed\n");
 }
 
+static void force_dsc_fractional_bpp_enable(data_t *data)
+{
+	int ret;
+
+	igt_debug("Forcing DSC Fractional BPP on %s\n", data->output->name);
+	ret = igt_force_dsc_fractional_bpp_enable(data->drm_fd,
+						  data->output->name);
+	igt_assert_f(ret > 0, "forcing dsc fractional bpp debugfs_write failed\n");
+}
+
 static void save_force_dsc_en(data_t *data)
 {
 	force_dsc_en_orig =
@@ -171,11 +184,34 @@ static void restore_force_dsc_ycbcr420_en(void)
 	force_dsc_ycbcr420_restore_fd = -1;
 }
 
+static void save_force_dsc_fractional_bpp_en(data_t *data)
+{
+	force_dsc_fractional_bpp_en_orig =
+		igt_is_force_dsc_fractional_bpp_enabled(data->drm_fd,
+							data->output->name);
+	force_dsc_fractional_bpp_restore_fd =
+		igt_get_dsc_fractional_bpp_debugfs_fd(data->drm_fd,
+						      data->output->name);
+	igt_assert(force_dsc_fractional_bpp_restore_fd >= 0);
+}
+
+static void restore_force_dsc_fractional_bpp_en(void)
+{
+	if (force_dsc_fractional_bpp_restore_fd < 0)
+		return;
+
+	igt_debug("Restoring DSC Fractional BPP enable\n");
+	igt_assert(write(force_dsc_fractional_bpp_restore_fd, force_dsc_fractional_bpp_en_orig ? "1" : "0", 1) == 1);
+
+	close(force_dsc_fractional_bpp_restore_fd);
+	force_dsc_fractional_bpp_restore_fd = -1;
+}
 
 static void kms_dsc_exit_handler(int sig)
 {
 	restore_force_dsc_en();
 	restore_force_dsc_ycbcr420_en();
+	restore_force_dsc_fractional_bpp_en();
 }
 
 static drmModeModeInfo *get_highres_mode(igt_output_t *output)
@@ -224,6 +260,34 @@ static bool check_dsc_on_connector(data_t *data)
 	return true;
 }
 
+static bool is_dsc_fractional_bpp_supported(int drmfd, char *connector_name)
+{
+	int bpp_prec;
+
+	bpp_prec = igt_get_dsc_fractional_bpp_supported(drmfd, connector_name);
+
+	if (bpp_prec == 1)
+		return false;
+
+	return true;
+}
+
+static bool check_dsc_fractional_bpp_on_connector(data_t *data)
+{
+	igt_output_t *output = data->output;
+
+	if (data->disp_ver >= 14) {
+		if (!is_dsc_fractional_bpp_supported(data->drm_fd, output->name)) {
+			igt_debug("DSC fractional bpp not supported on connector %s\n",
+				   output->name);
+			return false;
+		} else
+			return true;
+	}
+
+	return false;
+}
+
 static bool is_dsc_ycbcr420_supported(data_t *data)
 {
 	igt_output_t *output = data->output;
@@ -323,6 +387,10 @@ static void update_display(data_t *data, enum dsc_test_type test_type,
 		if (test_type == TEST_DSC_BPC) {
 			igt_debug("Trying to set input BPC to %d\n", data->input_bpc);
 			force_dsc_enable_bpc(data);
+		} else if (test_type == TEST_DSC_FRACTIONAL_BPP) {
+			igt_debug("DSC fractional bpp is supported on %s\n", data->output->name);
+			save_force_dsc_fractional_bpp_en(data);
+			force_dsc_fractional_bpp_enable(data);
 		}
 
 		igt_output_set_pipe(output, data->pipe);
@@ -371,11 +439,16 @@ static void update_display(data_t *data, enum dsc_test_type test_type,
 					enabled ? "ON" : "OFF");
 
 		restore_force_dsc_en();
+
 		if (output_format == DSC_FORMAT_YCBCR420)
 			restore_force_dsc_ycbcr420_en();
-		igt_debug("Reset compression BPC\n");
-		data->input_bpc = 0;
-		force_dsc_enable_bpc(data);
+
+		if (test_type == TEST_DSC_BPC) {
+			igt_debug("Reset compression BPC\n");
+			data->input_bpc = 0;
+			force_dsc_enable_bpc(data);
+		} else if (test_type == TEST_DSC_FRACTIONAL_BPP)
+			restore_force_dsc_fractional_bpp_en();
 
 		igt_assert_f(enabled,
 			    "Default DSC enable failed on connector: %s pipe: %s\n",
@@ -411,6 +484,9 @@ static void test_dsc(data_t *data, enum dsc_test_type test_type, int bpc,
 		if (!check_big_joiner_pipe_constraint(data))
 			continue;
 
+		if ((test_type == TEST_DSC_FRACTIONAL_BPP) && !(check_dsc_fractional_bpp_on_connector(data)))
+			continue;
+
 		if (test_type == TEST_DSC_BPC)
 			snprintf(name, sizeof(name), "-%dbpc-%s", data->input_bpc, igt_format_str(plane_format));
 		else
@@ -483,6 +559,13 @@ igt_main
 		}
 	}
 
+	igt_describe("Tests fractional compressed bpp functionality if supported "
+		     "by a connector by forcing fractional_bpp on all connectors that support it "
+		     "with default parameter. Driver will continue if output_bpp "
+		     "is computed as integer and allow DSC iff compressed bpp is fractional");
+	igt_subtest_with_dynamic("dsc-fractional-bpp")
+			run_test(&data, TEST_DSC_FRACTIONAL_BPP, 0, DRM_FORMAT_XRGB8888);
+
 	igt_fixture {
 		igt_display_fini(&data.display);
 		close(data.drm_fd);
-- 
2.25.1

^ permalink raw reply related	[flat|nested] 12+ messages in thread

* [igt-dev] [PATCH i-g-t 6/6] tests/i915/kms_dsc: Add test summary
  2022-11-25 11:58 [igt-dev] [PATCH i-g-t 0/6] VDSC YCbCr420 + Fractional BPP Swati Sharma
                   ` (4 preceding siblings ...)
  2022-11-25 11:58 ` [igt-dev] [PATCH i-g-t 5/6] tests/i915/kms_dsc: Enable validation for VDSC Fractional BPP Swati Sharma
@ 2022-11-25 11:58 ` Swati Sharma
  2022-11-25 12:39 ` [igt-dev] ✓ Fi.CI.BAT: success for VDSC YCbCr420 + Fractional BPP Patchwork
  6 siblings, 0 replies; 12+ messages in thread
From: Swati Sharma @ 2022-11-25 11:58 UTC (permalink / raw)
  To: igt-dev

Add test summary giving overall view of what all is being validated
in the test.

Signed-off-by: Swati Sharma <swati2.sharma@intel.com>
---
 tests/i915/kms_dsc.c | 11 +++++++++++
 1 file changed, 11 insertions(+)

diff --git a/tests/i915/kms_dsc.c b/tests/i915/kms_dsc.c
index a85066bb9..ee5d0434c 100644
--- a/tests/i915/kms_dsc.c
+++ b/tests/i915/kms_dsc.c
@@ -48,6 +48,17 @@
 
 IGT_TEST_DESCRIPTION("Test to validate display stream compression");
 
+/*
+ * i915 driver supports DSC1.1 from gen11+. To validate DSC, we have
+ * different scenarios
+ * (i) basic modeset (ii) input bpc (iii) formats (iv) fractional bpp
+ * These tests will check for basic DSC support by the connector and
+ * few other gen specific constraints. Fractional bpp got introduced
+ * with DSC1.2 from MTL. By default, tests will get executed on RGB444
+ * output format. However, if sink and platform supports YCBCR420, all the
+ * tests will get executed with this format too.
+ */
+
 enum dsc_test_type {
 	TEST_DSC_BASIC,
 	TEST_DSC_BPC,
-- 
2.25.1

^ permalink raw reply related	[flat|nested] 12+ messages in thread

* [igt-dev] ✓ Fi.CI.BAT: success for VDSC YCbCr420 + Fractional BPP
  2022-11-25 11:58 [igt-dev] [PATCH i-g-t 0/6] VDSC YCbCr420 + Fractional BPP Swati Sharma
                   ` (5 preceding siblings ...)
  2022-11-25 11:58 ` [igt-dev] [PATCH i-g-t 6/6] tests/i915/kms_dsc: Add test summary Swati Sharma
@ 2022-11-25 12:39 ` Patchwork
  6 siblings, 0 replies; 12+ messages in thread
From: Patchwork @ 2022-11-25 12:39 UTC (permalink / raw)
  To: Swati Sharma; +Cc: igt-dev

[-- Attachment #1: Type: text/plain, Size: 12333 bytes --]

== Series Details ==

Series: VDSC YCbCr420 + Fractional BPP
URL   : https://patchwork.freedesktop.org/series/111342/
State : success

== Summary ==

CI Bug Log - changes from CI_DRM_12434 -> IGTPW_8156
====================================================

Summary
-------

  **SUCCESS**

  No regressions found.

  External URL: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_8156/index.html

Participating hosts (36 -> 37)
------------------------------

  Additional (4): fi-bdw-gvtdvm fi-cfl-guc fi-tgl-dsi bat-dg1-6 
  Missing    (3): fi-ctg-p8600 bat-dg2-11 fi-rkl-11600 

Known issues
------------

  Here are the changes found in IGTPW_8156 that come from known issues:

### IGT changes ###

#### Issues hit ####

  * igt@core_hotunplug@unbind-rebind:
    - fi-apl-guc:         [PASS][1] -> [INCOMPLETE][2] ([i915#7073])
   [1]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_12434/fi-apl-guc/igt@core_hotunplug@unbind-rebind.html
   [2]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_8156/fi-apl-guc/igt@core_hotunplug@unbind-rebind.html

  * igt@gem_lmem_swapping@verify-random:
    - fi-cfl-guc:         NOTRUN -> [SKIP][3] ([fdo#109271] / [i915#4613]) +3 similar issues
   [3]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_8156/fi-cfl-guc/igt@gem_lmem_swapping@verify-random.html

  * igt@gem_mmap@basic:
    - bat-dg1-6:          NOTRUN -> [SKIP][4] ([i915#4083])
   [4]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_8156/bat-dg1-6/igt@gem_mmap@basic.html

  * igt@gem_render_tiled_blits@basic:
    - bat-dg1-6:          NOTRUN -> [SKIP][5] ([i915#4079]) +1 similar issue
   [5]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_8156/bat-dg1-6/igt@gem_render_tiled_blits@basic.html

  * igt@gem_tiled_fence_blits@basic:
    - bat-dg1-6:          NOTRUN -> [SKIP][6] ([i915#4077]) +2 similar issues
   [6]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_8156/bat-dg1-6/igt@gem_tiled_fence_blits@basic.html

  * igt@i915_pm_backlight@basic-brightness:
    - bat-dg1-6:          NOTRUN -> [SKIP][7] ([i915#7561])
   [7]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_8156/bat-dg1-6/igt@i915_pm_backlight@basic-brightness.html

  * igt@i915_pm_rps@basic-api:
    - bat-dg1-6:          NOTRUN -> [SKIP][8] ([i915#6621])
   [8]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_8156/bat-dg1-6/igt@i915_pm_rps@basic-api.html

  * igt@i915_suspend@basic-s2idle-without-i915:
    - fi-bdw-gvtdvm:      NOTRUN -> [INCOMPLETE][9] ([i915#146])
   [9]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_8156/fi-bdw-gvtdvm/igt@i915_suspend@basic-s2idle-without-i915.html

  * igt@kms_addfb_basic@basic-y-tiled-legacy:
    - bat-dg1-6:          NOTRUN -> [SKIP][10] ([i915#4215])
   [10]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_8156/bat-dg1-6/igt@kms_addfb_basic@basic-y-tiled-legacy.html

  * igt@kms_addfb_basic@tile-pitch-mismatch:
    - bat-dg1-6:          NOTRUN -> [SKIP][11] ([i915#4212]) +7 similar issues
   [11]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_8156/bat-dg1-6/igt@kms_addfb_basic@tile-pitch-mismatch.html

  * igt@kms_chamelium@common-hpd-after-suspend:
    - bat-adlp-4:         NOTRUN -> [SKIP][12] ([fdo#111827])
   [12]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_8156/bat-adlp-4/igt@kms_chamelium@common-hpd-after-suspend.html

  * igt@kms_chamelium@dp-crc-fast:
    - fi-cfl-guc:         NOTRUN -> [SKIP][13] ([fdo#109271] / [fdo#111827]) +8 similar issues
   [13]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_8156/fi-cfl-guc/igt@kms_chamelium@dp-crc-fast.html

  * igt@kms_chamelium@hdmi-crc-fast:
    - bat-dg1-6:          NOTRUN -> [SKIP][14] ([fdo#111827]) +8 similar issues
   [14]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_8156/bat-dg1-6/igt@kms_chamelium@hdmi-crc-fast.html

  * igt@kms_chamelium@hdmi-hpd-fast:
    - fi-bdw-gvtdvm:      NOTRUN -> [SKIP][15] ([fdo#109271] / [fdo#111827]) +7 similar issues
   [15]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_8156/fi-bdw-gvtdvm/igt@kms_chamelium@hdmi-hpd-fast.html

  * igt@kms_cursor_legacy@basic-busy-flip-before-cursor:
    - bat-dg1-6:          NOTRUN -> [SKIP][16] ([i915#4103] / [i915#4213])
   [16]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_8156/bat-dg1-6/igt@kms_cursor_legacy@basic-busy-flip-before-cursor.html

  * igt@kms_cursor_legacy@basic-busy-flip-before-cursor@atomic-transitions:
    - fi-bsw-kefka:       [PASS][17] -> [FAIL][18] ([i915#6298])
   [17]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_12434/fi-bsw-kefka/igt@kms_cursor_legacy@basic-busy-flip-before-cursor@atomic-transitions.html
   [18]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_8156/fi-bsw-kefka/igt@kms_cursor_legacy@basic-busy-flip-before-cursor@atomic-transitions.html

  * igt@kms_flip@basic-plain-flip:
    - fi-bdw-gvtdvm:      NOTRUN -> [SKIP][19] ([fdo#109271]) +38 similar issues
   [19]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_8156/fi-bdw-gvtdvm/igt@kms_flip@basic-plain-flip.html

  * igt@kms_force_connector_basic@force-load-detect:
    - bat-dg1-6:          NOTRUN -> [SKIP][20] ([fdo#109285])
   [20]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_8156/bat-dg1-6/igt@kms_force_connector_basic@force-load-detect.html

  * igt@kms_pipe_crc_basic@suspend-read-crc:
    - bat-adlp-4:         NOTRUN -> [SKIP][21] ([i915#3546])
   [21]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_8156/bat-adlp-4/igt@kms_pipe_crc_basic@suspend-read-crc.html

  * igt@kms_psr@sprite_plane_onoff:
    - bat-dg1-6:          NOTRUN -> [SKIP][22] ([i915#1072] / [i915#4078]) +3 similar issues
   [22]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_8156/bat-dg1-6/igt@kms_psr@sprite_plane_onoff.html

  * igt@kms_setmode@basic-clone-single-crtc:
    - bat-dg1-6:          NOTRUN -> [SKIP][23] ([i915#3555])
   [23]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_8156/bat-dg1-6/igt@kms_setmode@basic-clone-single-crtc.html

  * igt@prime_vgem@basic-gtt:
    - bat-dg1-6:          NOTRUN -> [SKIP][24] ([i915#3708] / [i915#4077]) +1 similar issue
   [24]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_8156/bat-dg1-6/igt@prime_vgem@basic-gtt.html

  * igt@prime_vgem@basic-read:
    - bat-dg1-6:          NOTRUN -> [SKIP][25] ([i915#3708]) +3 similar issues
   [25]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_8156/bat-dg1-6/igt@prime_vgem@basic-read.html

  * igt@prime_vgem@basic-userptr:
    - fi-cfl-guc:         NOTRUN -> [SKIP][26] ([fdo#109271]) +9 similar issues
   [26]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_8156/fi-cfl-guc/igt@prime_vgem@basic-userptr.html
    - bat-dg1-6:          NOTRUN -> [SKIP][27] ([i915#3708] / [i915#4873])
   [27]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_8156/bat-dg1-6/igt@prime_vgem@basic-userptr.html

  
#### Possible fixes ####

  * igt@gem_exec_gttfill@basic:
    - fi-pnv-d510:        [FAIL][28] ([i915#7229]) -> [PASS][29]
   [28]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_12434/fi-pnv-d510/igt@gem_exec_gttfill@basic.html
   [29]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_8156/fi-pnv-d510/igt@gem_exec_gttfill@basic.html

  * igt@gem_exec_suspend@basic-s0@smem:
    - {fi-ehl-2}:         [DMESG-WARN][30] ([i915#5122]) -> [PASS][31]
   [30]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_12434/fi-ehl-2/igt@gem_exec_suspend@basic-s0@smem.html
   [31]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_8156/fi-ehl-2/igt@gem_exec_suspend@basic-s0@smem.html

  * igt@i915_selftest@live@gt_pm:
    - {bat-adln-1}:       [DMESG-FAIL][32] ([i915#4258]) -> [PASS][33]
   [32]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_12434/bat-adln-1/igt@i915_selftest@live@gt_pm.html
   [33]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_8156/bat-adln-1/igt@i915_selftest@live@gt_pm.html

  * igt@i915_selftest@live@migrate:
    - bat-adlp-4:         [INCOMPLETE][34] ([i915#7308] / [i915#7348]) -> [PASS][35]
   [34]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_12434/bat-adlp-4/igt@i915_selftest@live@migrate.html
   [35]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_8156/bat-adlp-4/igt@i915_selftest@live@migrate.html

  * igt@kms_frontbuffer_tracking@basic:
    - {bat-rpls-2}:       [SKIP][36] ([i915#1849]) -> [PASS][37]
   [36]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_12434/bat-rpls-2/igt@kms_frontbuffer_tracking@basic.html
   [37]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_8156/bat-rpls-2/igt@kms_frontbuffer_tracking@basic.html

  * igt@prime_vgem@basic-fence-flip:
    - {bat-rpls-2}:       [SKIP][38] ([fdo#109295] / [i915#1845] / [i915#3708]) -> [PASS][39]
   [38]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_12434/bat-rpls-2/igt@prime_vgem@basic-fence-flip.html
   [39]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_8156/bat-rpls-2/igt@prime_vgem@basic-fence-flip.html

  
  {name}: This element is suppressed. This means it is ignored when computing
          the status of the difference (SUCCESS, WARNING, or FAILURE).

  [fdo#109271]: https://bugs.freedesktop.org/show_bug.cgi?id=109271
  [fdo#109284]: https://bugs.freedesktop.org/show_bug.cgi?id=109284
  [fdo#109285]: https://bugs.freedesktop.org/show_bug.cgi?id=109285
  [fdo#109295]: https://bugs.freedesktop.org/show_bug.cgi?id=109295
  [fdo#110189]: https://bugs.freedesktop.org/show_bug.cgi?id=110189
  [fdo#111827]: https://bugs.freedesktop.org/show_bug.cgi?id=111827
  [i915#1072]: https://gitlab.freedesktop.org/drm/intel/issues/1072
  [i915#146]: https://gitlab.freedesktop.org/drm/intel/issues/146
  [i915#1759]: https://gitlab.freedesktop.org/drm/intel/issues/1759
  [i915#1845]: https://gitlab.freedesktop.org/drm/intel/issues/1845
  [i915#1849]: https://gitlab.freedesktop.org/drm/intel/issues/1849
  [i915#2190]: https://gitlab.freedesktop.org/drm/intel/issues/2190
  [i915#3301]: https://gitlab.freedesktop.org/drm/intel/issues/3301
  [i915#3546]: https://gitlab.freedesktop.org/drm/intel/issues/3546
  [i915#3555]: https://gitlab.freedesktop.org/drm/intel/issues/3555
  [i915#3708]: https://gitlab.freedesktop.org/drm/intel/issues/3708
  [i915#4077]: https://gitlab.freedesktop.org/drm/intel/issues/4077
  [i915#4078]: https://gitlab.freedesktop.org/drm/intel/issues/4078
  [i915#4079]: https://gitlab.freedesktop.org/drm/intel/issues/4079
  [i915#4083]: https://gitlab.freedesktop.org/drm/intel/issues/4083
  [i915#4103]: https://gitlab.freedesktop.org/drm/intel/issues/4103
  [i915#4212]: https://gitlab.freedesktop.org/drm/intel/issues/4212
  [i915#4213]: https://gitlab.freedesktop.org/drm/intel/issues/4213
  [i915#4215]: https://gitlab.freedesktop.org/drm/intel/issues/4215
  [i915#4258]: https://gitlab.freedesktop.org/drm/intel/issues/4258
  [i915#4312]: https://gitlab.freedesktop.org/drm/intel/issues/4312
  [i915#4613]: https://gitlab.freedesktop.org/drm/intel/issues/4613
  [i915#4873]: https://gitlab.freedesktop.org/drm/intel/issues/4873
  [i915#4983]: https://gitlab.freedesktop.org/drm/intel/issues/4983
  [i915#5122]: https://gitlab.freedesktop.org/drm/intel/issues/5122
  [i915#6257]: https://gitlab.freedesktop.org/drm/intel/issues/6257
  [i915#6298]: https://gitlab.freedesktop.org/drm/intel/issues/6298
  [i915#6434]: https://gitlab.freedesktop.org/drm/intel/issues/6434
  [i915#6621]: https://gitlab.freedesktop.org/drm/intel/issues/6621
  [i915#6949]: https://gitlab.freedesktop.org/drm/intel/issues/6949
  [i915#7058]: https://gitlab.freedesktop.org/drm/intel/issues/7058
  [i915#7073]: https://gitlab.freedesktop.org/drm/intel/issues/7073
  [i915#7229]: https://gitlab.freedesktop.org/drm/intel/issues/7229
  [i915#7308]: https://gitlab.freedesktop.org/drm/intel/issues/7308
  [i915#7346]: https://gitlab.freedesktop.org/drm/intel/issues/7346
  [i915#7348]: https://gitlab.freedesktop.org/drm/intel/issues/7348
  [i915#7456]: https://gitlab.freedesktop.org/drm/intel/issues/7456
  [i915#7561]: https://gitlab.freedesktop.org/drm/intel/issues/7561


Build changes
-------------

  * CI: CI-20190529 -> None
  * IGT: IGT_7072 -> IGTPW_8156

  CI-20190529: 20190529
  CI_DRM_12434: 985931f189852e505af573997ddbf63bfbe2570b @ git://anongit.freedesktop.org/gfx-ci/linux
  IGTPW_8156: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_8156/index.html
  IGT_7072: 69ba7163475925cdc69aebbdfa0e87453ae165c7 @ https://gitlab.freedesktop.org/drm/igt-gpu-tools.git


Testlist changes
----------------

+igt@kms_dsc@dsc-fractional-bpp

== Logs ==

For more details see: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_8156/index.html

[-- Attachment #2: Type: text/html, Size: 13551 bytes --]

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [igt-dev] [PATCH i-g-t 3/6] tests/i915/kms_dsc: Enable validation for VDSC YCbCr420
  2022-11-25 11:58 ` [igt-dev] [PATCH i-g-t 3/6] tests/i915/kms_dsc: Enable validation " Swati Sharma
@ 2022-12-23 11:39   ` Nautiyal, Ankit K
  0 siblings, 0 replies; 12+ messages in thread
From: Nautiyal, Ankit K @ 2022-12-23 11:39 UTC (permalink / raw)
  To: Swati Sharma, igt-dev

Hi Swati,

This looks better now. Few suggestions/comments inline:

On 11/25/2022 5:28 PM, Swati Sharma wrote:
> Existing i-g-t is extended to enable validation for VDSC YCbCr420.
> If a mode is supported in both RGB and YCbCr420 output formats by the
> sink, i915 driver policy is to try RGB first and fall back to YCbCr420, if
> mode cannot be shown using RGB. To test YCbCr420, we need a debugfs
> entry (force_dsc_ycbcr420) to force this output format; so that YCbCr420 code
> gets executed.
>  From i-g-t, we have set this debugfs entry. However, before setting
> debugfs entry, we have checked capability i.e. YCbCr420 is supported by
> both platform (D14+) and sink.
> Also, all the modes doesn't support both YCbCr420 and RGB formats; so if
> sink and platform supports YCbCr420 we will do try commit with each mode
> till we get a successful commit.
>
> v2: -used is_dsc_ycbcr420_supported() (Ankit)
>      -handled try-commit correctly (Ankit)
>      -instead of flag use enum for output formats (Ankit)
>
> Signed-off-by: Swati Sharma <swati2.sharma@intel.com>
> ---
>   tests/i915/kms_dsc.c | 195 ++++++++++++++++++++++++++++++++-----------
>   1 file changed, 147 insertions(+), 48 deletions(-)
>
> diff --git a/tests/i915/kms_dsc.c b/tests/i915/kms_dsc.c
> index 6fef764de..6a3eecdb4 100644
> --- a/tests/i915/kms_dsc.c
> +++ b/tests/i915/kms_dsc.c
> @@ -53,6 +53,11 @@ enum dsc_test_type {
>   	TEST_DSC_BPC
>   };
>   
> +enum dsc_output_format {
> +	DSC_FORMAT_RGB444,
> +	DSC_FORMAT_YCBCR420
> +};
> +
>   typedef struct {
>   	int drm_fd;
>   	uint32_t devid;
> @@ -66,7 +71,10 @@ typedef struct {
>   } data_t;
>   
>   bool force_dsc_en_orig;
> +bool force_dsc_ycbcr420_en_orig;
>   int force_dsc_restore_fd = -1;
> +int force_dsc_ycbcr420_restore_fd = -1;
> +static int count = 0;
>   
>   const struct {
>   	const int format;
> @@ -107,6 +115,16 @@ static void force_dsc_enable_bpc(data_t *data)
>   	igt_assert_f(ret > 0, "forcing input dsc bpc debugfs_write failed\n");
>   }
>   
> +static void force_dsc_ycbcr420_enable(data_t *data)
> +{
> +	int ret;
> +
> +	igt_debug("Forcing DSC YCbCr420 on %s\n", data->output->name);
> +	ret = igt_force_dsc_ycbcr420_enable(data->drm_fd,
> +					    data->output->name);
> +	igt_assert_f(ret > 0, "forcing dsc ycbcr420 debugfs_write failed\n");
> +}
> +
>   static void save_force_dsc_en(data_t *data)
>   {
>   	force_dsc_en_orig =
> @@ -130,9 +148,34 @@ static void restore_force_dsc_en(void)
>   	force_dsc_restore_fd = -1;
>   }
>   
> +static void save_force_dsc_ycbcr420_en(data_t *data)
> +{
> +	force_dsc_ycbcr420_en_orig =
> +		igt_is_force_dsc_ycbcr420_enabled(data->drm_fd,
> +						  data->output->name);
> +	force_dsc_ycbcr420_restore_fd =
> +		igt_get_dsc_ycbcr420_debugfs_fd(data->drm_fd,
> +						data->output->name);
> +	igt_assert(force_dsc_ycbcr420_restore_fd >= 0);
> +}
> +
> +static void restore_force_dsc_ycbcr420_en(void)
> +{
> +	if (force_dsc_ycbcr420_restore_fd < 0)
> +		return;
> +
> +	igt_debug("Restoring DSC YCbCr420 enable\n");
> +	igt_assert(write(force_dsc_ycbcr420_restore_fd, force_dsc_ycbcr420_en_orig ? "1" : "0", 1) == 1);
> +
> +	close(force_dsc_ycbcr420_restore_fd);
> +	force_dsc_ycbcr420_restore_fd = -1;
> +}
> +
> +
>   static void kms_dsc_exit_handler(int sig)
>   {
>   	restore_force_dsc_en();
> +	restore_force_dsc_ycbcr420_en();
>   }
>   
>   static drmModeModeInfo *get_highres_mode(igt_output_t *output)
> @@ -147,6 +190,20 @@ static drmModeModeInfo *get_highres_mode(igt_output_t *output)
>   	return highest_mode;
>   }
>   
> +static drmModeModeInfo *get_next_mode(igt_output_t *output)
> +{
> +	drmModeConnector *connector = output->config.connector;
> +	drmModeModeInfo *next_mode = NULL;
> +
> +	for (int i = count; i < connector->count_modes; i++) {
> +		next_mode = &connector->modes[i];
> +		count ++;

No space before the unary increment operator.


> +		break;
> +	}
> +
> +	return next_mode;
> +}
> +
>   static bool check_dsc_on_connector(data_t *data)
>   {
>   	igt_output_t *output = data->output;
> @@ -167,6 +224,19 @@ static bool check_dsc_on_connector(data_t *data)
>   	return true;
>   }
>   
> +static bool is_dsc_ycbcr420_supported(data_t *data)
> +{
> +	igt_output_t *output = data->output;
> +
> +	if (!igt_is_dsc_ycbcr420_supported(data->drm_fd, output->name)) {
> +		igt_debug("DSC YCbCr420 not supported on connector %s\n",
> +			  output->name);
> +		return false;
> +	}
> +
> +	return true;
> +}
> +
>   static bool check_big_joiner_pipe_constraint(data_t *data)
>   {
>   	igt_output_t *output = data->output;
> @@ -224,75 +294,100 @@ static void test_cleanup(data_t *data)
>   
>   /* re-probe connectors and do a modeset with DSC */
>   static void update_display(data_t *data, enum dsc_test_type test_type,
> -			   unsigned int plane_format)
> +			   unsigned int plane_format, enum dsc_output_format output_format)
>   {
> +	int ret;
>   	bool enabled;
>   	igt_plane_t *primary;
>   	drmModeModeInfo *mode;
> +	bool test_complete = false;
>   	igt_output_t *output = data->output;
>   	igt_display_t *display = &data->display;
>   
> -	/* sanitize the state before starting the subtest */
> -	igt_display_reset(display);
> -	igt_display_commit(display);
> +	count = 0;
> +	while (!test_complete) {
> +		/* sanitize the state before starting the subtest */
> +		igt_display_reset(display);
> +		igt_display_commit(display);
>   
> -	igt_debug("DSC is supported on %s\n", data->output->name);
> -	save_force_dsc_en(data);
> -	force_dsc_enable(data);
> +		igt_debug("DSC is supported on %s\n", data->output->name);
> +		save_force_dsc_en(data);
> +		force_dsc_enable(data);
>   
> -	if (test_type == TEST_DSC_BPC) {
> -		igt_debug("Trying to set input BPC to %d\n", data->input_bpc);
> -		force_dsc_enable_bpc(data);
> -	}
> +		if (output_format == DSC_FORMAT_YCBCR420) {
> +			igt_debug("DSC YCbCr420 is supported on %s\n", data->output->name);
> +			save_force_dsc_ycbcr420_en(data);
> +			force_dsc_ycbcr420_enable(data);
> +		}
>   
> -	igt_output_set_pipe(output, data->pipe);
> +		if (test_type == TEST_DSC_BPC) {
> +			igt_debug("Trying to set input BPC to %d\n", data->input_bpc);
> +			force_dsc_enable_bpc(data);
> +		}
>   
> -	mode = get_highres_mode(output);
> -	igt_require(mode != NULL);
> -	igt_output_override_mode(output, mode);
> +		igt_output_set_pipe(output, data->pipe);
>   
> -	primary = igt_output_get_plane_type(output, DRM_PLANE_TYPE_PRIMARY);
> +		if (output_format == DSC_FORMAT_YCBCR420)
> +			mode = get_next_mode(output);

If we pass the count, or to be precise the current mode index, we can 
avoid having a global count.


> +		else
> +			mode = get_highres_mode(output);
>   
> -	igt_skip_on(!igt_plane_has_format_mod(primary, plane_format,
> -		    DRM_FORMAT_MOD_LINEAR));
> +		igt_require(mode != NULL);
> +		igt_output_override_mode(output, mode);
>   
> -	igt_create_pattern_fb(data->drm_fd,
> -			      mode->hdisplay,
> -			      mode->vdisplay,
> -			      plane_format,
> -			      DRM_FORMAT_MOD_LINEAR,
> -			      &data->fb_test_pattern);
> +		primary = igt_output_get_plane_type(output, DRM_PLANE_TYPE_PRIMARY);
>   
> -	igt_plane_set_fb(primary, &data->fb_test_pattern);
> -	igt_display_commit(display);
> +		igt_skip_on(!igt_plane_has_format_mod(primary, plane_format,
> +			    DRM_FORMAT_MOD_LINEAR));
>   
> -	/* until we have CRC check support, manually check if RGB test
> -	 * pattern has no corruption.
> -	 */
> -	manual("RGB test pattern without corruption");
> +		igt_create_pattern_fb(data->drm_fd,
> +				      mode->hdisplay,
> +				      mode->vdisplay,
> +				      plane_format,
> +				      DRM_FORMAT_MOD_LINEAR,
> +				      &data->fb_test_pattern);
>   
> -	enabled = igt_is_dsc_enabled(data->drm_fd, output->name);
> -	igt_info("Current mode is: %dx%d @%dHz -- DSC is: %s\n",
> -				mode->hdisplay,
> -				mode->vdisplay,
> -				mode->vrefresh,
> -				enabled ? "ON" : "OFF");
> +		igt_plane_set_fb(primary, &data->fb_test_pattern);
> +		ret = igt_display_try_commit_atomic(display, DRM_MODE_ATOMIC_ALLOW_MODESET, NULL);
> +		if (ret == 0) {
> +			igt_display_commit(display);
> +			test_complete = true;
> +		} else if (output_format == DSC_FORMAT_YCBCR420) {
> +			continue;
> +		}
>   
> -	restore_force_dsc_en();
> -	igt_debug("Reset compression BPC\n");
> -	data->input_bpc = 0;
> -	force_dsc_enable_bpc(data);
> +		igt_assert_eq(ret, 0);
> +
> +		/* until we have CRC check support, manually check if RGB test
> +		 * pattern has no corruption.
> +		 */
> +		manual("RGB test pattern without corruption");
> +
> +		enabled = igt_is_dsc_enabled(data->drm_fd, output->name);
> +		igt_info("Current mode is: %dx%d @%dHz -- DSC is: %s\n",
> +					mode->hdisplay,
> +					mode->vdisplay,
> +					mode->vrefresh,
> +					enabled ? "ON" : "OFF");

I think we can print the output_format with which DSC was used here

Thanks & Regards,

Ankit

> +
> +		restore_force_dsc_en();
> +		if (output_format == DSC_FORMAT_YCBCR420)
> +			restore_force_dsc_ycbcr420_en();
> +		igt_debug("Reset compression BPC\n");
> +		data->input_bpc = 0;
> +		force_dsc_enable_bpc(data);
>   
> -	igt_assert_f(enabled,
> -		     "Default DSC enable failed on connector: %s pipe: %s\n",
> -		     output->name,
> -		     kmstest_pipe_name(data->pipe));
> +		igt_assert_f(enabled,
> +			    "Default DSC enable failed on connector: %s pipe: %s\n",
> +			    output->name,
> +			    kmstest_pipe_name(data->pipe));
>   
> -	test_cleanup(data);
> +		test_cleanup(data);
> +	}
>   }
>   
>   static void test_dsc(data_t *data, enum dsc_test_type test_type, int bpc,
> -		     unsigned int plane_format)
> +		     unsigned int plane_format, enum dsc_output_format output_format)
>   {
>   	igt_display_t *display = &data->display;
>   	igt_output_t *output;
> @@ -322,14 +417,18 @@ static void test_dsc(data_t *data, enum dsc_test_type test_type, int bpc,
>   			snprintf(name, sizeof(name), "-%s", igt_format_str(plane_format));
>   
>   		igt_dynamic_f("pipe-%s-%s%s",  kmstest_pipe_name(data->pipe), data->output->name, name)
> -			update_display(data, test_type, plane_format);
> +			update_display(data, test_type, plane_format, output_format);
>   	}
>   }
>   
>   static void run_test(data_t *data, enum dsc_test_type test_type, int bpc,
>   		     unsigned int plane_format)
>   {
> -	test_dsc(data, test_type, bpc, plane_format);
> +	test_dsc(data, test_type, bpc, plane_format, DSC_FORMAT_RGB444);
> +
> +	/* YCbCr420 DSC is supported on display version 14+ */
> +	if ((data->disp_ver >= 14) && (is_dsc_ycbcr420_supported(data)))
> +		test_dsc(data, test_type, bpc, plane_format, DSC_FORMAT_YCBCR420);
>   }
>   
>   igt_main

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [igt-dev] [PATCH i-g-t 4/6] lib/kms: Add helpers for VDSC Fractional BPP debugfs entry
  2022-11-25 11:58 ` [igt-dev] [PATCH i-g-t 4/6] lib/kms: Add helpers for VDSC Fractional BPP debugfs entry Swati Sharma
@ 2022-12-23 12:06   ` Nautiyal, Ankit K
  2022-12-26  6:05   ` Nautiyal, Ankit K
  1 sibling, 0 replies; 12+ messages in thread
From: Nautiyal, Ankit K @ 2022-12-23 12:06 UTC (permalink / raw)
  To: Swati Sharma, igt-dev


On 11/25/2022 5:28 PM, Swati Sharma wrote:
> Helper functions are added for getting/setting VDSC Fractional BPP
> debugfs entry.
>
> Signed-off-by: Swati Sharma <swati2.sharma@intel.com>
> ---
>   lib/igt_kms.c | 78 +++++++++++++++++++++++++++++++++++++++++++++++++++
>   lib/igt_kms.h |  4 +++
>   2 files changed, 82 insertions(+)
>
> diff --git a/lib/igt_kms.c b/lib/igt_kms.c
> index c7135790b..93f45410c 100644
> --- a/lib/igt_kms.c
> +++ b/lib/igt_kms.c
> @@ -5592,6 +5592,20 @@ bool check_dsc_ycbcr420_debugfs(int drmfd, char *connector_name,
>   	return strstr(buf, check_str);
>   }
>   
> +static
> +bool check_dsc_fractional_bpp_debugfs(int drmfd, char *connector_name,
> +				      const char *check_str)
> +{
> +	char file_name[128] = {0};
> +	char buf[512];
> +
> +	sprintf(file_name, "%s/i915_dsc_fractional_bpp", connector_name);
> +
> +	igt_debugfs_read(drmfd, file_name, buf);
> +
> +	return strstr(buf, check_str);
> +}
> +
>   static
>   int write_dsc_debugfs(int drmfd, char *connector_name,
>   		      const char *file_name,
> @@ -5623,6 +5637,29 @@ bool igt_is_dsc_supported(int drmfd, char *connector_name)
>   	return check_dsc_debugfs(drmfd, connector_name, "DSC_Sink_Support: yes");
>   }
>   
> +/*
> + * igt_get_dsc_fractional_bpp_supported:
> + * @drmfd: A drm file descriptor
> + * @connector_name: Name of the libdrm connector we're going to use
> + *
> + * Returns: The dsc sink bpp precision.

Perhaps need to specify precision value of 16 means 1/16, 8 means 1/8 
and so on.

A value of 1 means fractional bpp not supported.


> + */
> +int igt_get_dsc_fractional_bpp_supported(int drmfd, char *connector_name)
> +{
> +	char file_name[128] = {0};
> +	char buf[24];

This size is not sufficient to store the contents of the debugfs entry.


Thanks & Regards,

Ankit


> +	char *start_loc;
> +	int bpp_prec;
> +
> +	sprintf(file_name, "%s/i915_dsc_fec_support", connector_name);
> +	igt_debugfs_read(drmfd, file_name, buf);
> +
> +	igt_assert(start_loc = strstr(buf, "DSC_Sink_BPP_Precision: "));
> +	igt_assert_eq(sscanf(start_loc, "DSC_Sink_BPP_Precision: %d", &bpp_prec), 1);
> +
> +	return bpp_prec;
> +}
> +
>   /*
>    * igt_is_dsc_ycbcr420_supported:
>    * @drmfd: A drm file descriptor
> @@ -5685,6 +5722,19 @@ bool igt_is_force_dsc_ycbcr420_enabled(int drmfd, char *connector_name)
>   	return check_dsc_ycbcr420_debugfs(drmfd, connector_name, "Force_DSC_YCBCR420_Enable: yes");
>   }
>   
> +/*
> + * igt_is_force_dsc_fractional_bpp_enabled:
> + * @drmfd: A drm file descriptor
> + * @connector_name: Name of the libdrm connector we're going to use
> + *
> + * Returns: True if DSC Fractional BPP is force enabled (via debugfs) for the given connector,
> + * false otherwise.
> + */
> +bool igt_is_force_dsc_fractional_bpp_enabled(int drmfd, char *connector_name)
> +{
> +	return check_dsc_fractional_bpp_debugfs(drmfd, connector_name, "Force_DSC_Fractional_BPP_Enable: yes");
> +}
> +
>   /*
>    * igt_force_dsc_enable:
>    * @drmfd: A drm file descriptor
> @@ -5709,6 +5759,18 @@ int igt_force_dsc_ycbcr420_enable(int drmfd, char *connector_name)
>   	return write_dsc_debugfs(drmfd, connector_name, "i915_dsc_ycbcr420", "1");
>   }
>   
> +/*
> + * igt_force_dsc_fractional_bpp_enable:
> + * @drmfd: A drm file descriptor
> + * @connector_name: Name of the libdrm connector we're going to use
> + *
> + * Returns: 1 on success or negative error code, in case of failure.
> + */
> +int igt_force_dsc_fractional_bpp_enable(int drmfd, char *connector_name)
> +{
> +	return write_dsc_debugfs(drmfd, connector_name, "i915_dsc_fractional_bpp", "1");
> +}
> +
>   /*
>    * igt_force_dsc_enable_bpc:
>    * @drmfd: A drm file descriptor
> @@ -5758,6 +5820,22 @@ int igt_get_dsc_ycbcr420_debugfs_fd(int drmfd, char *connector_name)
>   	return openat(igt_debugfs_dir(drmfd), file_name, O_WRONLY);
>   }
>   
> +/*
> + * igt_get_dsc_fractional_bpp_debugfs_fd:
> + * @drmfd: A drm file descriptor
> + * @connector_name: Name of the libdrm connector we're going to use
> + *
> + * Returns: fd of the DSC Fractional BPP debugfs for the given connector, else returns -1.
> + */
> +int igt_get_dsc_fractional_bpp_debugfs_fd(int drmfd, char *connector_name)
> +{
> +	char file_name[128] = {0};
> +
> +	sprintf(file_name, "%s/i915_dsc_fractional_bpp", connector_name);
> +
> +	return openat(igt_debugfs_dir(drmfd), file_name, O_WRONLY);
> +}
> +
>   /*
>    * igt_get_output_max_bpc:
>    * @drmfd: A drm file descriptor
> diff --git a/lib/igt_kms.h b/lib/igt_kms.h
> index ccd8adf2c..990157bbc 100644
> --- a/lib/igt_kms.h
> +++ b/lib/igt_kms.h
> @@ -977,15 +977,19 @@ bool igt_override_all_active_output_modes_to_fit_bw(igt_display_t *display);
>   
>   bool igt_is_dsc_supported(int drmfd, char *connector_name);
>   bool igt_is_dsc_ycbcr420_supported(int drmfd, char *connector_name);
> +int igt_get_dsc_fractional_bpp_supported(int drmfd, char *connector_name);
>   bool igt_is_fec_supported(int drmfd, char *connector_name);
>   bool igt_is_dsc_enabled(int drmfd, char *connector_name);
>   bool igt_is_force_dsc_enabled(int drmfd, char *connector_name);
>   bool igt_is_force_dsc_ycbcr420_enabled(int drmfd, char *connector_name);
> +bool igt_is_force_dsc_fractional_bpp_enabled(int drmfd, char *connector_name);
>   int igt_force_dsc_enable(int drmfd, char *connector_name);
>   int igt_force_dsc_enable_bpc(int drmfd, char *connector_name, int bpc);
>   int igt_force_dsc_ycbcr420_enable(int drmfd, char *connector_name);
> +int igt_force_dsc_fractional_bpp_enable(int drmfd, char *connector_name);
>   int igt_get_dsc_debugfs_fd(int drmfd, char *connector_name);
>   int igt_get_dsc_ycbcr420_debugfs_fd(int drmfd, char *connector_name);
> +int igt_get_dsc_fractional_bpp_debugfs_fd(int drmfd, char *connector_name);
>   
>   unsigned int igt_get_output_max_bpc(int drmfd, char *connector_name);
>   unsigned int igt_get_pipe_current_bpc(int drmfd, enum pipe pipe);

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [igt-dev] [PATCH i-g-t 4/6] lib/kms: Add helpers for VDSC Fractional BPP debugfs entry
  2022-11-25 11:58 ` [igt-dev] [PATCH i-g-t 4/6] lib/kms: Add helpers for VDSC Fractional BPP debugfs entry Swati Sharma
  2022-12-23 12:06   ` Nautiyal, Ankit K
@ 2022-12-26  6:05   ` Nautiyal, Ankit K
  1 sibling, 0 replies; 12+ messages in thread
From: Nautiyal, Ankit K @ 2022-12-26  6:05 UTC (permalink / raw)
  To: Swati Sharma, igt-dev


On 11/25/2022 5:28 PM, Swati Sharma wrote:
> Helper functions are added for getting/setting VDSC Fractional BPP
> debugfs entry.
>
> Signed-off-by: Swati Sharma <swati2.sharma@intel.com>
> ---
>   lib/igt_kms.c | 78 +++++++++++++++++++++++++++++++++++++++++++++++++++
>   lib/igt_kms.h |  4 +++
>   2 files changed, 82 insertions(+)
>
> diff --git a/lib/igt_kms.c b/lib/igt_kms.c
> index c7135790b..93f45410c 100644
> --- a/lib/igt_kms.c
> +++ b/lib/igt_kms.c
> @@ -5592,6 +5592,20 @@ bool check_dsc_ycbcr420_debugfs(int drmfd, char *connector_name,
>   	return strstr(buf, check_str);
>   }
>   
> +static
> +bool check_dsc_fractional_bpp_debugfs(int drmfd, char *connector_name,
> +				      const char *check_str)
> +{
> +	char file_name[128] = {0};
> +	char buf[512];
> +
> +	sprintf(file_name, "%s/i915_dsc_fractional_bpp", connector_name);
> +
> +	igt_debugfs_read(drmfd, file_name, buf);
> +
> +	return strstr(buf, check_str);
> +}
> +
>   static
>   int write_dsc_debugfs(int drmfd, char *connector_name,
>   		      const char *file_name,
> @@ -5623,6 +5637,29 @@ bool igt_is_dsc_supported(int drmfd, char *connector_name)
>   	return check_dsc_debugfs(drmfd, connector_name, "DSC_Sink_Support: yes");
>   }
>   
> +/*
> + * igt_get_dsc_fractional_bpp_supported:
> + * @drmfd: A drm file descriptor
> + * @connector_name: Name of the libdrm connector we're going to use
> + *
> + * Returns: The dsc sink bpp precision.
> + */
> +int igt_get_dsc_fractional_bpp_supported(int drmfd, char *connector_name)
> +{
> +	char file_name[128] = {0};
> +	char buf[24];
> +	char *start_loc;
> +	int bpp_prec;
> +
> +	sprintf(file_name, "%s/i915_dsc_fec_support", connector_name);
> +	igt_debugfs_read(drmfd, file_name, buf);
> +
> +	igt_assert(start_loc = strstr(buf, "DSC_Sink_BPP_Precision: "));
> +	igt_assert_eq(sscanf(start_loc, "DSC_Sink_BPP_Precision: %d", &bpp_prec), 1);

I think we should assert for bpp_prec > 0 here.

Regards,

Ankit

> +
> +	return bpp_prec;
> +}
> +
>   /*
>    * igt_is_dsc_ycbcr420_supported:
>    * @drmfd: A drm file descriptor
> @@ -5685,6 +5722,19 @@ bool igt_is_force_dsc_ycbcr420_enabled(int drmfd, char *connector_name)
>   	return check_dsc_ycbcr420_debugfs(drmfd, connector_name, "Force_DSC_YCBCR420_Enable: yes");
>   }
>   
> +/*
> + * igt_is_force_dsc_fractional_bpp_enabled:
> + * @drmfd: A drm file descriptor
> + * @connector_name: Name of the libdrm connector we're going to use
> + *
> + * Returns: True if DSC Fractional BPP is force enabled (via debugfs) for the given connector,
> + * false otherwise.
> + */
> +bool igt_is_force_dsc_fractional_bpp_enabled(int drmfd, char *connector_name)
> +{
> +	return check_dsc_fractional_bpp_debugfs(drmfd, connector_name, "Force_DSC_Fractional_BPP_Enable: yes");
> +}
> +
>   /*
>    * igt_force_dsc_enable:
>    * @drmfd: A drm file descriptor
> @@ -5709,6 +5759,18 @@ int igt_force_dsc_ycbcr420_enable(int drmfd, char *connector_name)
>   	return write_dsc_debugfs(drmfd, connector_name, "i915_dsc_ycbcr420", "1");
>   }
>   
> +/*
> + * igt_force_dsc_fractional_bpp_enable:
> + * @drmfd: A drm file descriptor
> + * @connector_name: Name of the libdrm connector we're going to use
> + *
> + * Returns: 1 on success or negative error code, in case of failure.
> + */
> +int igt_force_dsc_fractional_bpp_enable(int drmfd, char *connector_name)
> +{
> +	return write_dsc_debugfs(drmfd, connector_name, "i915_dsc_fractional_bpp", "1");
> +}
> +
>   /*
>    * igt_force_dsc_enable_bpc:
>    * @drmfd: A drm file descriptor
> @@ -5758,6 +5820,22 @@ int igt_get_dsc_ycbcr420_debugfs_fd(int drmfd, char *connector_name)
>   	return openat(igt_debugfs_dir(drmfd), file_name, O_WRONLY);
>   }
>   
> +/*
> + * igt_get_dsc_fractional_bpp_debugfs_fd:
> + * @drmfd: A drm file descriptor
> + * @connector_name: Name of the libdrm connector we're going to use
> + *
> + * Returns: fd of the DSC Fractional BPP debugfs for the given connector, else returns -1.
> + */
> +int igt_get_dsc_fractional_bpp_debugfs_fd(int drmfd, char *connector_name)
> +{
> +	char file_name[128] = {0};
> +
> +	sprintf(file_name, "%s/i915_dsc_fractional_bpp", connector_name);
> +
> +	return openat(igt_debugfs_dir(drmfd), file_name, O_WRONLY);
> +}
> +
>   /*
>    * igt_get_output_max_bpc:
>    * @drmfd: A drm file descriptor
> diff --git a/lib/igt_kms.h b/lib/igt_kms.h
> index ccd8adf2c..990157bbc 100644
> --- a/lib/igt_kms.h
> +++ b/lib/igt_kms.h
> @@ -977,15 +977,19 @@ bool igt_override_all_active_output_modes_to_fit_bw(igt_display_t *display);
>   
>   bool igt_is_dsc_supported(int drmfd, char *connector_name);
>   bool igt_is_dsc_ycbcr420_supported(int drmfd, char *connector_name);
> +int igt_get_dsc_fractional_bpp_supported(int drmfd, char *connector_name);
>   bool igt_is_fec_supported(int drmfd, char *connector_name);
>   bool igt_is_dsc_enabled(int drmfd, char *connector_name);
>   bool igt_is_force_dsc_enabled(int drmfd, char *connector_name);
>   bool igt_is_force_dsc_ycbcr420_enabled(int drmfd, char *connector_name);
> +bool igt_is_force_dsc_fractional_bpp_enabled(int drmfd, char *connector_name);
>   int igt_force_dsc_enable(int drmfd, char *connector_name);
>   int igt_force_dsc_enable_bpc(int drmfd, char *connector_name, int bpc);
>   int igt_force_dsc_ycbcr420_enable(int drmfd, char *connector_name);
> +int igt_force_dsc_fractional_bpp_enable(int drmfd, char *connector_name);
>   int igt_get_dsc_debugfs_fd(int drmfd, char *connector_name);
>   int igt_get_dsc_ycbcr420_debugfs_fd(int drmfd, char *connector_name);
> +int igt_get_dsc_fractional_bpp_debugfs_fd(int drmfd, char *connector_name);
>   
>   unsigned int igt_get_output_max_bpc(int drmfd, char *connector_name);
>   unsigned int igt_get_pipe_current_bpc(int drmfd, enum pipe pipe);

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [igt-dev] [PATCH i-g-t 5/6] tests/i915/kms_dsc: Enable validation for VDSC Fractional BPP
  2022-11-25 11:58 ` [igt-dev] [PATCH i-g-t 5/6] tests/i915/kms_dsc: Enable validation for VDSC Fractional BPP Swati Sharma
@ 2022-12-26  7:00   ` Nautiyal, Ankit K
  0 siblings, 0 replies; 12+ messages in thread
From: Nautiyal, Ankit K @ 2022-12-26  7:00 UTC (permalink / raw)
  To: Swati Sharma, igt-dev


On 11/25/2022 5:28 PM, Swati Sharma wrote:
> Fractional BPP support comes from DSC1.2. To test Fractional BPP, debugfs entry
> (force_dsc_fractional_bpp) is introduced. From the IGT; we are setting this
> debugfs entry. However, before setting this debugfs entry, we are checking
> capability i.e. Fractional BPP is supported by platform and sink both. In driver,
> if force_dsc_fractional_bpp is set then while iterating over output bpp with
> fractional step size we will continue if output_bpp is computed as integer and
> allow DSC iff compressed bpp is fractional.
>
> Signed-off-by: Swati Sharma <swati2.sharma@intel.com>
> ---
>   tests/i915/kms_dsc.c | 91 ++++++++++++++++++++++++++++++++++++++++++--
>   1 file changed, 87 insertions(+), 4 deletions(-)
>
> diff --git a/tests/i915/kms_dsc.c b/tests/i915/kms_dsc.c
> index 6a3eecdb4..a85066bb9 100644
> --- a/tests/i915/kms_dsc.c
> +++ b/tests/i915/kms_dsc.c
> @@ -50,7 +50,8 @@ IGT_TEST_DESCRIPTION("Test to validate display stream compression");
>   
>   enum dsc_test_type {
>   	TEST_DSC_BASIC,
> -	TEST_DSC_BPC
> +	TEST_DSC_BPC,
> +	TEST_DSC_FRACTIONAL_BPP
>   };
>   
>   enum dsc_output_format {
> @@ -72,8 +73,10 @@ typedef struct {
>   
>   bool force_dsc_en_orig;
>   bool force_dsc_ycbcr420_en_orig;
> +bool force_dsc_fractional_bpp_en_orig;
>   int force_dsc_restore_fd = -1;
>   int force_dsc_ycbcr420_restore_fd = -1;
> +int force_dsc_fractional_bpp_restore_fd = -1;
>   static int count = 0;
>   
>   const struct {
> @@ -125,6 +128,16 @@ static void force_dsc_ycbcr420_enable(data_t *data)
>   	igt_assert_f(ret > 0, "forcing dsc ycbcr420 debugfs_write failed\n");
>   }
>   
> +static void force_dsc_fractional_bpp_enable(data_t *data)
> +{
> +	int ret;
> +
> +	igt_debug("Forcing DSC Fractional BPP on %s\n", data->output->name);
> +	ret = igt_force_dsc_fractional_bpp_enable(data->drm_fd,
> +						  data->output->name);
> +	igt_assert_f(ret > 0, "forcing dsc fractional bpp debugfs_write failed\n");
> +}
> +
>   static void save_force_dsc_en(data_t *data)
>   {
>   	force_dsc_en_orig =
> @@ -171,11 +184,34 @@ static void restore_force_dsc_ycbcr420_en(void)
>   	force_dsc_ycbcr420_restore_fd = -1;
>   }
>   
> +static void save_force_dsc_fractional_bpp_en(data_t *data)
> +{
> +	force_dsc_fractional_bpp_en_orig =
> +		igt_is_force_dsc_fractional_bpp_enabled(data->drm_fd,
> +							data->output->name);
> +	force_dsc_fractional_bpp_restore_fd =
> +		igt_get_dsc_fractional_bpp_debugfs_fd(data->drm_fd,
> +						      data->output->name);
> +	igt_assert(force_dsc_fractional_bpp_restore_fd >= 0);
> +}
> +
> +static void restore_force_dsc_fractional_bpp_en(void)
> +{
> +	if (force_dsc_fractional_bpp_restore_fd < 0)
> +		return;
> +
> +	igt_debug("Restoring DSC Fractional BPP enable\n");
> +	igt_assert(write(force_dsc_fractional_bpp_restore_fd, force_dsc_fractional_bpp_en_orig ? "1" : "0", 1) == 1);
> +
> +	close(force_dsc_fractional_bpp_restore_fd);
> +	force_dsc_fractional_bpp_restore_fd = -1;
> +}
>   
>   static void kms_dsc_exit_handler(int sig)
>   {
>   	restore_force_dsc_en();
>   	restore_force_dsc_ycbcr420_en();
> +	restore_force_dsc_fractional_bpp_en();
>   }
>   
>   static drmModeModeInfo *get_highres_mode(igt_output_t *output)
> @@ -224,6 +260,34 @@ static bool check_dsc_on_connector(data_t *data)
>   	return true;
>   }
>   
> +static bool is_dsc_fractional_bpp_supported(int drmfd, char *connector_name)
> +{
> +	int bpp_prec;
> +
> +	bpp_prec = igt_get_dsc_fractional_bpp_supported(drmfd, connector_name);
> +
> +	if (bpp_prec == 1)
> +		return false;
> +
> +	return true;
> +}
> +
> +static bool check_dsc_fractional_bpp_on_connector(data_t *data)
> +{
> +	igt_output_t *output = data->output;
> +
> +	if (data->disp_ver >= 14) {
> +		if (!is_dsc_fractional_bpp_supported(data->drm_fd, output->name)) {
> +			igt_debug("DSC fractional bpp not supported on connector %s\n",
> +				   output->name);
> +			return false;
> +		} else
> +			return true;
> +	}
> +
> +	return false;
> +}
> +
>   static bool is_dsc_ycbcr420_supported(data_t *data)
>   {
>   	igt_output_t *output = data->output;
> @@ -323,6 +387,10 @@ static void update_display(data_t *data, enum dsc_test_type test_type,
>   		if (test_type == TEST_DSC_BPC) {
>   			igt_debug("Trying to set input BPC to %d\n", data->input_bpc);
>   			force_dsc_enable_bpc(data);
> +		} else if (test_type == TEST_DSC_FRACTIONAL_BPP) {
> +			igt_debug("DSC fractional bpp is supported on %s\n", data->output->name);
> +			save_force_dsc_fractional_bpp_en(data);
> +			force_dsc_fractional_bpp_enable(data);
>   		}
>   
>   		igt_output_set_pipe(output, data->pipe);
> @@ -371,11 +439,16 @@ static void update_display(data_t *data, enum dsc_test_type test_type,
>   					enabled ? "ON" : "OFF");
>   
>   		restore_force_dsc_en();
> +
>   		if (output_format == DSC_FORMAT_YCBCR420)
>   			restore_force_dsc_ycbcr420_en();
> -		igt_debug("Reset compression BPC\n");
> -		data->input_bpc = 0;
> -		force_dsc_enable_bpc(data);
> +
> +		if (test_type == TEST_DSC_BPC) {
> +			igt_debug("Reset compression BPC\n");
> +			data->input_bpc = 0;
> +			force_dsc_enable_bpc(data);
> +		} else if (test_type == TEST_DSC_FRACTIONAL_BPP)
> +			restore_force_dsc_fractional_bpp_en();
>   
>   		igt_assert_f(enabled,
>   			    "Default DSC enable failed on connector: %s pipe: %s\n",
> @@ -411,6 +484,9 @@ static void test_dsc(data_t *data, enum dsc_test_type test_type, int bpc,
>   		if (!check_big_joiner_pipe_constraint(data))
>   			continue;
>   
> +		if ((test_type == TEST_DSC_FRACTIONAL_BPP) && !(check_dsc_fractional_bpp_on_connector(data)))
> +			continue;
> +
>   		if (test_type == TEST_DSC_BPC)
>   			snprintf(name, sizeof(name), "-%dbpc-%s", data->input_bpc, igt_format_str(plane_format));
>   		else
> @@ -483,6 +559,13 @@ igt_main
>   		}
>   	}
>   
> +	igt_describe("Tests fractional compressed bpp functionality if supported "
> +		     "by a connector by forcing fractional_bpp on all connectors that support it "
> +		     "with default parameter. Driver will continue if output_bpp "
> +		     "is computed as integer and allow DSC iff compressed bpp is fractional");

Perhaps can be rephrased as:

While finding the optimum compressed bpp, driver will skip over the 
compressed bpps with integer values.

It will go ahead with DSC, iff compressed bpp is fractional, failing in 
which, it will fail the commit.


Overall patch looks good to me:

Reviewed-by: Ankit Nautiyal <ankit.k.nautiyal@intel.com>


Regards,

Ankit

> +	igt_subtest_with_dynamic("dsc-fractional-bpp")
> +			run_test(&data, TEST_DSC_FRACTIONAL_BPP, 0, DRM_FORMAT_XRGB8888);
> +
>   	igt_fixture {
>   		igt_display_fini(&data.display);
>   		close(data.drm_fd);

^ permalink raw reply	[flat|nested] 12+ messages in thread

end of thread, other threads:[~2022-12-26  7:00 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-11-25 11:58 [igt-dev] [PATCH i-g-t 0/6] VDSC YCbCr420 + Fractional BPP Swati Sharma
2022-11-25 11:58 ` [igt-dev] [PATCH i-g-t 1/6] lib/kms: Add helpers for VDSC YCbCr420 debugfs entry Swati Sharma
2022-11-25 11:58 ` [igt-dev] [PATCH i-g-t 2/6] tests/i915/kms_dsc: Prep work for extending val support for VDSC YCbCr420 Swati Sharma
2022-11-25 11:58 ` [igt-dev] [PATCH i-g-t 3/6] tests/i915/kms_dsc: Enable validation " Swati Sharma
2022-12-23 11:39   ` Nautiyal, Ankit K
2022-11-25 11:58 ` [igt-dev] [PATCH i-g-t 4/6] lib/kms: Add helpers for VDSC Fractional BPP debugfs entry Swati Sharma
2022-12-23 12:06   ` Nautiyal, Ankit K
2022-12-26  6:05   ` Nautiyal, Ankit K
2022-11-25 11:58 ` [igt-dev] [PATCH i-g-t 5/6] tests/i915/kms_dsc: Enable validation for VDSC Fractional BPP Swati Sharma
2022-12-26  7:00   ` Nautiyal, Ankit K
2022-11-25 11:58 ` [igt-dev] [PATCH i-g-t 6/6] tests/i915/kms_dsc: Add test summary Swati Sharma
2022-11-25 12:39 ` [igt-dev] ✓ Fi.CI.BAT: success for VDSC YCbCr420 + Fractional BPP Patchwork

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.