Igt-dev Archive on lore.kernel.org
 help / color / mirror / Atom feed
* [igt-dev] [v4 00/10] DSC Fractional BPP Val Support
@ 2023-07-28  7:49 Swati Sharma
  2023-07-28  7:49 ` [igt-dev] [v4 01/10] tests/i915/kms_dsc: add new test flag Swati Sharma
                   ` (9 more replies)
  0 siblings, 10 replies; 12+ messages in thread
From: Swati Sharma @ 2023-07-28  7:49 UTC (permalink / raw)
  To: igt-dev

Existing i-g-t is extended to enable validation for dsc
fractional bpp.
This series is split from
https://patchwork.freedesktop.org/series/111342/

v2: addressed review comments from Ankit
v3: addressed review comments from Ankit
v4: fixed if() (Ankit)

Swati Sharma (10):
  tests/i915/kms_dsc: add new test flag
  tests/i915/kms_dsc: use uint32_t test flag
  tests/i915/kms_dsc: use #define for default bpc
  tests/i915/kms_dsc: update if condition
  tests/i915/kms_dsc: use igt_get_pipe_current_bpc()
  tests/i915/kms_dsc: add test validating output formats with input bpc
  lib/dsc: add helpers for vdsc fractional bpp debugfs entry
  tests/i915/kms_dsc: enable validation for vdsc fractional bpp
  tests/i915/kms_dsc: add test to validate fractional bpp with input bpc
  tests/i915/kms_dsc: add test summary

 lib/igt_dsc.c               |  84 ++++++++++++++++++++++
 lib/igt_dsc.h               |   5 ++
 tests/i915/kms_dsc.c        | 137 +++++++++++++++++++++++++++++-------
 tests/i915/kms_dsc_helper.c |  71 +++++++++++++++++++
 tests/i915/kms_dsc_helper.h |   4 ++
 5 files changed, 274 insertions(+), 27 deletions(-)

-- 
2.25.1

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

* [igt-dev] [v4 01/10] tests/i915/kms_dsc: add new test flag
  2023-07-28  7:49 [igt-dev] [v4 00/10] DSC Fractional BPP Val Support Swati Sharma
@ 2023-07-28  7:49 ` Swati Sharma
  2023-07-28  7:49 ` [igt-dev] [v4 02/10] tests/i915/kms_dsc: use uint32_t " Swati Sharma
                   ` (8 subsequent siblings)
  9 siblings, 0 replies; 12+ messages in thread
From: Swati Sharma @ 2023-07-28  7:49 UTC (permalink / raw)
  To: igt-dev

Add new test flag TEST_DSC_FORMAT. This flag is added to
differentiate the basic dsc test and the tests where we want to
change different plane pixel formats.

v2: -update commit message (Ankit)

Signed-off-by: Swati Sharma <swati2.sharma@intel.com>
Reviewed-by: Ankit Nautiyal <ankit.k.nautiyal@intel.com>
---
 tests/i915/kms_dsc.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/tests/i915/kms_dsc.c b/tests/i915/kms_dsc.c
index 0a3e29924..23ccbca00 100644
--- a/tests/i915/kms_dsc.c
+++ b/tests/i915/kms_dsc.c
@@ -37,6 +37,7 @@ IGT_TEST_DESCRIPTION("Test to validate display stream compression");
 enum dsc_test_type {
 	TEST_DSC_BASIC,
 	TEST_DSC_BPC,
+	TEST_DSC_FORMAT,
 	TEST_DSC_OUTPUT_FORMAT,
 };
 
@@ -302,7 +303,7 @@ igt_main_args("l", NULL, help_str, opt_handler, &data)
 		     "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,
+			test_dsc(&data, TEST_DSC_FORMAT, 0,
 				 format_list[k], DSC_FORMAT_RGB);
 	}
 
-- 
2.25.1

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

* [igt-dev] [v4 02/10] tests/i915/kms_dsc: use uint32_t test flag
  2023-07-28  7:49 [igt-dev] [v4 00/10] DSC Fractional BPP Val Support Swati Sharma
  2023-07-28  7:49 ` [igt-dev] [v4 01/10] tests/i915/kms_dsc: add new test flag Swati Sharma
@ 2023-07-28  7:49 ` Swati Sharma
  2023-07-28  7:49 ` [igt-dev] [v4 03/10] tests/i915/kms_dsc: use #define for default bpc Swati Sharma
                   ` (7 subsequent siblings)
  9 siblings, 0 replies; 12+ messages in thread
From: Swati Sharma @ 2023-07-28  7:49 UTC (permalink / raw)
  To: igt-dev

Instead of using enum, use uinit32_t test flag. It is helpful,
if we need to implement feature combination tests.

v2: -use #define (Ankit)
    -use 2D char array (Ankit)

Signed-off-by: Swati Sharma <swati2.sharma@intel.com>
Reviewed-by: Ankit Nautiyal <ankit.k.nautiyal@intel.com>
---
 tests/i915/kms_dsc.c | 50 +++++++++++++++++++++++++-------------------
 1 file changed, 28 insertions(+), 22 deletions(-)

diff --git a/tests/i915/kms_dsc.c b/tests/i915/kms_dsc.c
index 23ccbca00..99d35a7ff 100644
--- a/tests/i915/kms_dsc.c
+++ b/tests/i915/kms_dsc.c
@@ -34,12 +34,12 @@
 
 IGT_TEST_DESCRIPTION("Test to validate display stream compression");
 
-enum dsc_test_type {
-	TEST_DSC_BASIC,
-	TEST_DSC_BPC,
-	TEST_DSC_FORMAT,
-	TEST_DSC_OUTPUT_FORMAT,
-};
+#define LEN		20
+
+#define TEST_DSC_BASIC		(0<<0)
+#define TEST_DSC_BPC		(1<<0)
+#define TEST_DSC_FORMAT		(1<<1)
+#define TEST_DSC_OUTPUT_FORMAT	(1<<2)
 
 typedef struct {
 	int drm_fd;
@@ -111,7 +111,7 @@ 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)
+static void update_display(data_t *data, uint32_t test_type)
 {
 	int ret;
 	bool enabled;
@@ -130,12 +130,12 @@ static void update_display(data_t *data, enum dsc_test_type test_type)
 	save_force_dsc_en(data->drm_fd, data->output);
 	force_dsc_enable(data->drm_fd, data->output);
 
-	if (test_type == TEST_DSC_BPC) {
+	if (test_type & TEST_DSC_BPC) {
 		igt_debug("Trying to set input BPC to %d\n", data->input_bpc);
 		force_dsc_enable_bpc(data->drm_fd, data->output, data->input_bpc);
 	}
 
-	if (test_type == TEST_DSC_OUTPUT_FORMAT) {
+	if (test_type & TEST_DSC_OUTPUT_FORMAT) {
 		igt_debug("Trying to set DSC %s output format\n",
 			   kmstest_dsc_output_format_str(data->output_format));
 		force_dsc_output_format(data->drm_fd, data->output, data->output_format);
@@ -214,13 +214,18 @@ reset:
 	igt_assert_eq(ret, 0);
 }
 
-static void test_dsc(data_t *data, enum dsc_test_type test_type, int bpc,
-		     unsigned int plane_format, enum dsc_output_format output_format)
+static void test_dsc(data_t *data, uint32_t test_type, int bpc,
+		     unsigned int plane_format,
+		     enum dsc_output_format output_format)
 {
 	igt_display_t *display = &data->display;
 	igt_output_t *output;
-	char name[20];
 	enum pipe pipe;
+	char name[3][LEN] = {
+				{0},
+				{0},
+				{0},
+			    };
 
 	for_each_pipe_with_valid_output(display, pipe, output) {
 		data->output_format = output_format;
@@ -242,15 +247,15 @@ static void test_dsc(data_t *data, enum dsc_test_type test_type, int bpc,
 		if (!check_gen11_bpc_constraint(data->drm_fd, data->output, data->input_bpc))
 			continue;
 
-		if (test_type == TEST_DSC_BPC)
-			snprintf(name, sizeof(name), "-%dbpc-%s", data->input_bpc, igt_format_str(data->plane_format));
-		else if (test_type == TEST_DSC_OUTPUT_FORMAT)
-			snprintf(name, sizeof(name), "-%s-%s", kmstest_dsc_output_format_str(data->output_format),
-							       igt_format_str(data->plane_format));
-		else
-			snprintf(name, sizeof(name), "-%s", igt_format_str(data->plane_format));
+		if (test_type & TEST_DSC_OUTPUT_FORMAT)
+			snprintf(&name[0][0], LEN, "-%s", kmstest_dsc_output_format_str(data->output_format));
+		if (test_type & TEST_DSC_FORMAT)
+			snprintf(&name[1][0], LEN, "-%s", igt_format_str(data->plane_format));
+		if (test_type & TEST_DSC_BPC)
+			snprintf(&name[2][0], LEN, "-%dbpc", data->input_bpc);
 
-		igt_dynamic_f("pipe-%s-%s%s",  kmstest_pipe_name(data->pipe), data->output->name, name)
+		igt_dynamic_f("pipe-%s-%s%s%s%s",  kmstest_pipe_name(data->pipe), data->output->name,
+			      &name[0][0], &name[1][0], &name[2][0])
 			update_display(data, test_type);
 
 		if (data->limited)
@@ -322,8 +327,9 @@ igt_main_args("l", NULL, help_str, opt_handler, &data)
 	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], DSC_FORMAT_RGB);
+				test_dsc(&data, TEST_DSC_BPC | TEST_DSC_FORMAT,
+				bpc_list[j], format_list[k],
+				DSC_FORMAT_RGB);
 			}
 		}
 	}
-- 
2.25.1

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

* [igt-dev] [v4 03/10] tests/i915/kms_dsc: use #define for default bpc
  2023-07-28  7:49 [igt-dev] [v4 00/10] DSC Fractional BPP Val Support Swati Sharma
  2023-07-28  7:49 ` [igt-dev] [v4 01/10] tests/i915/kms_dsc: add new test flag Swati Sharma
  2023-07-28  7:49 ` [igt-dev] [v4 02/10] tests/i915/kms_dsc: use uint32_t " Swati Sharma
@ 2023-07-28  7:49 ` Swati Sharma
  2023-07-28  7:49 ` [igt-dev] [v4 04/10] tests/i915/kms_dsc: update if condition Swati Sharma
                   ` (6 subsequent siblings)
  9 siblings, 0 replies; 12+ messages in thread
From: Swati Sharma @ 2023-07-28  7:49 UTC (permalink / raw)
  To: igt-dev

For default bpc, use #define. By setting bpc as 0, means driver
will set its own value and we are not enforcing input bpc.

Signed-off-by: Swati Sharma <swati2.sharma@intel.com>
Reviewed-by: Ankit Nautiyal <ankit.k.nautiyal@intel.com>
---
 tests/i915/kms_dsc.c | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/tests/i915/kms_dsc.c b/tests/i915/kms_dsc.c
index 99d35a7ff..7b9bae91a 100644
--- a/tests/i915/kms_dsc.c
+++ b/tests/i915/kms_dsc.c
@@ -35,6 +35,7 @@
 IGT_TEST_DESCRIPTION("Test to validate display stream compression");
 
 #define LEN		20
+#define DEFAULT_BPC	0
 
 #define TEST_DSC_BASIC		(0<<0)
 #define TEST_DSC_BPC		(1<<0)
@@ -300,7 +301,7 @@ igt_main_args("l", NULL, help_str, opt_handler, &data)
 		     "by a connector by forcing DSC on all connectors that support it "
 		     "with default parameters");
 	igt_subtest_with_dynamic("dsc-basic")
-			test_dsc(&data, TEST_DSC_BASIC, 0,
+			test_dsc(&data, TEST_DSC_BASIC, DEFAULT_BPC,
 				 DRM_FORMAT_XRGB8888, DSC_FORMAT_RGB);
 
 	igt_describe("Tests basic display stream compression functionality if supported "
@@ -308,7 +309,7 @@ igt_main_args("l", NULL, help_str, opt_handler, &data)
 		     "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_FORMAT, 0,
+			test_dsc(&data, TEST_DSC_FORMAT, DEFAULT_BPC,
 				 format_list[k], DSC_FORMAT_RGB);
 	}
 
@@ -339,7 +340,8 @@ igt_main_args("l", NULL, help_str, opt_handler, &data)
 		     "that support it");
 	igt_subtest_with_dynamic("dsc-with-output-formats") {
 		for (int k = 0; k < ARRAY_SIZE(output_format_list); k++)
-			test_dsc(&data, TEST_DSC_OUTPUT_FORMAT, 0, DRM_FORMAT_XRGB8888,
+			test_dsc(&data, TEST_DSC_OUTPUT_FORMAT, DEFAULT_BPC,
+				 DRM_FORMAT_XRGB8888,
 				 output_format_list[k]);
 	}
 
-- 
2.25.1

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

* [igt-dev] [v4 04/10] tests/i915/kms_dsc: update if condition
  2023-07-28  7:49 [igt-dev] [v4 00/10] DSC Fractional BPP Val Support Swati Sharma
                   ` (2 preceding siblings ...)
  2023-07-28  7:49 ` [igt-dev] [v4 03/10] tests/i915/kms_dsc: use #define for default bpc Swati Sharma
@ 2023-07-28  7:49 ` Swati Sharma
  2023-07-28  8:45   ` Nautiyal, Ankit K
  2023-07-28  7:49 ` [igt-dev] [v4 05/10] tests/i915/kms_dsc: use igt_get_pipe_current_bpc() Swati Sharma
                   ` (5 subsequent siblings)
  9 siblings, 1 reply; 12+ messages in thread
From: Swati Sharma @ 2023-07-28  7:49 UTC (permalink / raw)
  To: igt-dev

Check is_dsc_output_format_supported() iff test flag is set to
OUTPUT_FORMAT.

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

diff --git a/tests/i915/kms_dsc.c b/tests/i915/kms_dsc.c
index 7b9bae91a..266918f74 100644
--- a/tests/i915/kms_dsc.c
+++ b/tests/i915/kms_dsc.c
@@ -238,8 +238,9 @@ static void test_dsc(data_t *data, uint32_t test_type, int bpc,
 		if (!is_dsc_supported_by_sink(data->drm_fd, data->output))
 			continue;
 
-		if (!is_dsc_output_format_supported(data->drm_fd, data->disp_ver,
-						    data->output, data->output_format))
+		if ((test_type & TEST_DSC_OUTPUT_FORMAT) &&
+		    (!is_dsc_output_format_supported(data->drm_fd, data->disp_ver,
+						     data->output, data->output_format)))
 			continue;
 
 		if (!check_gen11_dp_constraint(data->drm_fd, data->output, data->pipe))
-- 
2.25.1

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

* [igt-dev] [v4 05/10] tests/i915/kms_dsc: use igt_get_pipe_current_bpc()
  2023-07-28  7:49 [igt-dev] [v4 00/10] DSC Fractional BPP Val Support Swati Sharma
                   ` (3 preceding siblings ...)
  2023-07-28  7:49 ` [igt-dev] [v4 04/10] tests/i915/kms_dsc: update if condition Swati Sharma
@ 2023-07-28  7:49 ` Swati Sharma
  2023-07-28  7:49 ` [igt-dev] [v4 06/10] tests/i915/kms_dsc: add test validating output formats with input bpc Swati Sharma
                   ` (4 subsequent siblings)
  9 siblings, 0 replies; 12+ messages in thread
From: Swati Sharma @ 2023-07-28  7:49 UTC (permalink / raw)
  To: igt-dev

Use igt_get_pipe_current_bpc() to get current bpc when
TEST_DSC_BPC test flag is used. If input bpc is not equal to
current bpc, skip test.

v2: -use helper directly (Ankit)

Signed-off-by: Swati Sharma <swati2.sharma@intel.com>
Reviewed-by: Ankit Nautiyal <ankit.k.nautiyal@intel.com>
---
 tests/i915/kms_dsc.c | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/tests/i915/kms_dsc.c b/tests/i915/kms_dsc.c
index 266918f74..00e2ed1a8 100644
--- a/tests/i915/kms_dsc.c
+++ b/tests/i915/kms_dsc.c
@@ -117,6 +117,7 @@ static void update_display(data_t *data, uint32_t test_type)
 	int ret;
 	bool enabled;
 	int index = 0;
+	int current_bpc = 0;
 	igt_plane_t *primary;
 	drmModeModeInfo *mode;
 	igt_output_t *output = data->output;
@@ -202,11 +203,17 @@ static void update_display(data_t *data, uint32_t test_type)
 
 	restore_force_dsc_en();
 
+	if (test_type & TEST_DSC_BPC) {
+		current_bpc = igt_get_pipe_current_bpc(data->drm_fd, data->pipe);
+		igt_skip_on_f(data->input_bpc != current_bpc,
+			      "Input bpc = %d is not equal to current bpc = %d\n",
+			      data->input_bpc, current_bpc);
+	}
+
 	igt_assert_f(enabled,
 		     "Default DSC enable failed on connector: %s pipe: %s\n",
 		     output->name,
 		     kmstest_pipe_name(data->pipe));
-
 reset:
 	test_reset(data);
 
-- 
2.25.1

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

* [igt-dev] [v4 06/10] tests/i915/kms_dsc: add test validating output formats with input bpc
  2023-07-28  7:49 [igt-dev] [v4 00/10] DSC Fractional BPP Val Support Swati Sharma
                   ` (4 preceding siblings ...)
  2023-07-28  7:49 ` [igt-dev] [v4 05/10] tests/i915/kms_dsc: use igt_get_pipe_current_bpc() Swati Sharma
@ 2023-07-28  7:49 ` Swati Sharma
  2023-07-28  7:49 ` [igt-dev] [v4 07/10] lib/dsc: add helpers for vdsc fractional bpp debugfs entry Swati Sharma
                   ` (3 subsequent siblings)
  9 siblings, 0 replies; 12+ messages in thread
From: Swati Sharma @ 2023-07-28  7:49 UTC (permalink / raw)
  To: igt-dev

New subtest is added validating output format with different
input bpc.

v2: -update subject (Ankit)

Signed-off-by: Swati Sharma <swati2.sharma@intel.com>
Reviewed-by: Ankit Nautiyal <ankit.k.nautiyal@intel.com>
---
 tests/i915/kms_dsc.c | 13 +++++++++++++
 1 file changed, 13 insertions(+)

diff --git a/tests/i915/kms_dsc.c b/tests/i915/kms_dsc.c
index 00e2ed1a8..cf99e6faa 100644
--- a/tests/i915/kms_dsc.c
+++ b/tests/i915/kms_dsc.c
@@ -353,6 +353,19 @@ igt_main_args("l", NULL, help_str, opt_handler, &data)
 				 output_format_list[k]);
 	}
 
+	igt_describe("Tests basic display stream compression functionality if supported "
+		     "by a connector by forcing DSC and output format on all connectors "
+		     "that support it with certain input BPC for the connector");
+	igt_subtest_with_dynamic("dsc-with-output-formats-with-bpc") {
+		for (int k = 0; k < ARRAY_SIZE(output_format_list); k++) {
+			for (int j = 0; j < ARRAY_SIZE(bpc_list); j++) {
+				test_dsc(&data, TEST_DSC_OUTPUT_FORMAT | TEST_DSC_BPC,
+					 bpc_list[j], DRM_FORMAT_XRGB8888,
+					 output_format_list[k]);
+			}
+		}
+	}
+
 	igt_fixture {
 		igt_display_fini(&data.display);
 		drm_close_driver(data.drm_fd);
-- 
2.25.1

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

* [igt-dev] [v4 07/10] lib/dsc: add helpers for vdsc fractional bpp debugfs entry
  2023-07-28  7:49 [igt-dev] [v4 00/10] DSC Fractional BPP Val Support Swati Sharma
                   ` (5 preceding siblings ...)
  2023-07-28  7:49 ` [igt-dev] [v4 06/10] tests/i915/kms_dsc: add test validating output formats with input bpc Swati Sharma
@ 2023-07-28  7:49 ` Swati Sharma
  2023-07-28  7:49 ` [igt-dev] [v4 08/10] tests/i915/kms_dsc: enable validation for vdsc fractional bpp Swati Sharma
                   ` (2 subsequent siblings)
  9 siblings, 0 replies; 12+ messages in thread
From: Swati Sharma @ 2023-07-28  7:49 UTC (permalink / raw)
  To: igt-dev

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

v2: -improved func description (Ankit)
    -increased buff size (Ankit)
    -asserted bpp_prec (Ankit)
v3: -return 0 on success instead of 1 (Jouni)
v4: -rebase
v5: -alignment fixes (Ankit)

Signed-off-by: Swati Sharma <swati2.sharma@intel.com>
Reviewed-by: Ankit Nautiyal <ankit.k.nautiyal@intel.com>
---
 lib/igt_dsc.c | 84 +++++++++++++++++++++++++++++++++++++++++++++++++++
 lib/igt_dsc.h |  5 +++
 2 files changed, 89 insertions(+)

diff --git a/lib/igt_dsc.c b/lib/igt_dsc.c
index 76a420c10..6c3b70421 100644
--- a/lib/igt_dsc.c
+++ b/lib/igt_dsc.c
@@ -205,3 +205,87 @@ int igt_force_dsc_output_format(int drmfd, char *connector_name,
 
 	return write_dsc_debugfs(drmfd, connector_name, "i915_dsc_output_format", buf);
 }
+
+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);
+}
+
+/*
+ * igt_get_dsc_fractional_bpp_supported:
+ * @drmfd: A drm file descriptor
+ * @connector_name: Name of the libdrm connector we're going to use
+ *
+ * Returns: DSC BPP precision supported by the sink.
+ * 	    Precision value of
+ * 		16 => 1/16
+ * 		8  => 1/8
+ * 		1  => fractional bpp not supported
+ */
+int igt_get_dsc_fractional_bpp_supported(int drmfd, char *connector_name)
+{
+	char file_name[128] = {0};
+	char buf[512];
+	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);
+	igt_assert(bpp_prec > 0);
+
+	return bpp_prec;
+}
+
+/*
+ * 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_fractional_bpp_enable:
+ * @drmfd: A drm file descriptor
+ * @connector_name: Name of the libdrm connector we're going to use
+ *
+ * Returns: 0 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_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);
+}
diff --git a/lib/igt_dsc.h b/lib/igt_dsc.h
index b58743b5f..5d918ea7a 100644
--- a/lib/igt_dsc.h
+++ b/lib/igt_dsc.h
@@ -8,6 +8,7 @@
 
 #include "igt_fb.h"
 #include "igt_kms.h"
+#include "igt_core.h"
 
 bool igt_is_dsc_supported_by_source(int drmfd);
 bool igt_is_dsc_supported_by_sink(int drmfd, char *connector_name);
@@ -21,5 +22,9 @@ bool igt_is_dsc_output_format_supported_by_sink(int drmfd, char *connector_name,
 						enum dsc_output_format output_format);
 int igt_force_dsc_output_format(int drmfd, char *connector_name,
 				enum dsc_output_format output_format);
+int igt_get_dsc_fractional_bpp_supported(int drmfd, char *connector_name);
+bool igt_is_force_dsc_fractional_bpp_enabled(int drmfd, char *connector_name);
+int igt_force_dsc_fractional_bpp_enable(int drmfd, char *connector_name);
+int igt_get_dsc_fractional_bpp_debugfs_fd(int drmfd, char *connector_name);
 
 #endif
-- 
2.25.1

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

* [igt-dev] [v4 08/10] tests/i915/kms_dsc: enable validation for vdsc fractional bpp
  2023-07-28  7:49 [igt-dev] [v4 00/10] DSC Fractional BPP Val Support Swati Sharma
                   ` (6 preceding siblings ...)
  2023-07-28  7:49 ` [igt-dev] [v4 07/10] lib/dsc: add helpers for vdsc fractional bpp debugfs entry Swati Sharma
@ 2023-07-28  7:49 ` Swati Sharma
  2023-07-28  7:49 ` [igt-dev] [v4 09/10] tests/i915/kms_dsc: add test to validate fractional bpp with input bpc Swati Sharma
  2023-07-28  7:49 ` [igt-dev] [v4 10/10] tests/i915/kms_dsc: add test summary Swati Sharma
  9 siblings, 0 replies; 12+ messages in thread
From: Swati Sharma @ 2023-07-28  7:49 UTC (permalink / raw)
  To: igt-dev

Intel hardware supports fractional bpp from display_ver >= 14.
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.

v2: -change in igt_describe (Ankit)
v3: -rebase
v4: -add wrapper for source support of fractional bpp (Ankit)

Signed-off-by: Swati Sharma <swati2.sharma@intel.com>
Reviewed-by: Ankit Nautiyal <ankit.k.nautiyal@intel.com>
---
 tests/i915/kms_dsc.c        | 23 ++++++++++++
 tests/i915/kms_dsc_helper.c | 71 +++++++++++++++++++++++++++++++++++++
 tests/i915/kms_dsc_helper.h |  4 +++
 3 files changed, 98 insertions(+)

diff --git a/tests/i915/kms_dsc.c b/tests/i915/kms_dsc.c
index cf99e6faa..8733f13d1 100644
--- a/tests/i915/kms_dsc.c
+++ b/tests/i915/kms_dsc.c
@@ -41,6 +41,7 @@ IGT_TEST_DESCRIPTION("Test to validate display stream compression");
 #define TEST_DSC_BPC		(1<<0)
 #define TEST_DSC_FORMAT		(1<<1)
 #define TEST_DSC_OUTPUT_FORMAT	(1<<2)
+#define TEST_DSC_FRACTIONAL_BPP (1<<3)
 
 typedef struct {
 	int drm_fd;
@@ -143,6 +144,12 @@ static void update_display(data_t *data, uint32_t test_type)
 		force_dsc_output_format(data->drm_fd, data->output, data->output_format);
 	}
 
+	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->drm_fd, data->output);
+		force_dsc_fractional_bpp_enable(data->drm_fd, data->output);
+	}
+
 	igt_output_set_pipe(output, data->pipe);
 	primary = igt_output_get_plane_type(output, DRM_PLANE_TYPE_PRIMARY);
 
@@ -202,6 +209,7 @@ static void update_display(data_t *data, uint32_t test_type)
 				enabled ? "ON" : "OFF");
 
 	restore_force_dsc_en();
+	restore_force_dsc_fractional_bpp_en();
 
 	if (test_type & TEST_DSC_BPC) {
 		current_bpc = igt_get_pipe_current_bpc(data->drm_fd, data->pipe);
@@ -250,6 +258,11 @@ static void test_dsc(data_t *data, uint32_t test_type, int bpc,
 						     data->output, data->output_format)))
 			continue;
 
+		if ((test_type & TEST_DSC_FRACTIONAL_BPP) &&
+		    (!is_dsc_fractional_bpp_supported(data->disp_ver,
+						      data->drm_fd, data->output)))
+			continue;
+
 		if (!check_gen11_dp_constraint(data->drm_fd, data->output, data->pipe))
 			continue;
 
@@ -366,6 +379,16 @@ igt_main_args("l", NULL, help_str, opt_handler, &data)
 		}
 	}
 
+	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. 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.");
+	igt_subtest_with_dynamic("dsc-fractional-bpp")
+			test_dsc(&data, TEST_DSC_FRACTIONAL_BPP,
+				 DEFAULT_BPC, DRM_FORMAT_XRGB8888,
+				 DSC_FORMAT_RGB);
+
 	igt_fixture {
 		igt_display_fini(&data.display);
 		drm_close_driver(data.drm_fd);
diff --git a/tests/i915/kms_dsc_helper.c b/tests/i915/kms_dsc_helper.c
index 61f76ddee..34f4e5ad4 100644
--- a/tests/i915/kms_dsc_helper.c
+++ b/tests/i915/kms_dsc_helper.c
@@ -6,7 +6,9 @@
 #include "kms_dsc_helper.h"
 
 static bool force_dsc_en_orig;
+static bool force_dsc_fractional_bpp_en_orig;
 static int force_dsc_restore_fd = -1;
+static int force_dsc_fractional_bpp_restore_fd = -1;
 
 void force_dsc_enable(int drmfd, igt_output_t *output)
 {
@@ -51,6 +53,7 @@ void restore_force_dsc_en(void)
 void kms_dsc_exit_handler(int sig)
 {
 	restore_force_dsc_en();
+	restore_force_dsc_fractional_bpp_en();
 }
 
 bool is_dsc_supported_by_source(int drmfd)
@@ -143,3 +146,71 @@ bool is_dsc_output_format_supported(int drmfd, int disp_ver, igt_output_t *outpu
 
 	return true;
 }
+
+void force_dsc_fractional_bpp_enable(int drmfd, igt_output_t *output)
+{
+	int ret;
+
+	igt_debug("Forcing DSC Fractional BPP on %s\n", output->name);
+	ret = igt_force_dsc_fractional_bpp_enable(drmfd, output->name);
+	igt_assert_f(ret == 0, "forcing dsc fractional bpp debugfs_write failed\n");
+}
+
+void save_force_dsc_fractional_bpp_en(int drmfd, igt_output_t *output)
+{
+	force_dsc_fractional_bpp_en_orig =
+		igt_is_force_dsc_fractional_bpp_enabled(drmfd, output->name);
+	force_dsc_fractional_bpp_restore_fd =
+		igt_get_dsc_fractional_bpp_debugfs_fd(drmfd, output->name);
+	igt_assert(force_dsc_fractional_bpp_restore_fd >= 0);
+}
+
+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
+bool is_dsc_fractional_bpp_supported_by_sink(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 is_dsc_fractional_bpp_supported_by_source(int disp_ver)
+{
+	if (disp_ver < 14) {
+		igt_debug("DSC fractional bpp not supported on D13 and older platforms\n");
+		return false;
+	}
+
+	return true;
+}
+
+bool is_dsc_fractional_bpp_supported(int disp_ver, int drmfd, igt_output_t *output)
+{
+	if (is_dsc_fractional_bpp_supported_by_source(disp_ver)) {
+		if (!is_dsc_fractional_bpp_supported_by_sink(drmfd, output->name)) {
+			igt_debug("DSC fractional bpp not supported on connector %s\n",
+				   output->name);
+			return false;
+		} else
+			return true;
+	}
+
+	return false;
+}
diff --git a/tests/i915/kms_dsc_helper.h b/tests/i915/kms_dsc_helper.h
index 2109bd767..9af609e12 100644
--- a/tests/i915/kms_dsc_helper.h
+++ b/tests/i915/kms_dsc_helper.h
@@ -34,5 +34,9 @@ void force_dsc_output_format(int drmfd, igt_output_t *output,
 			     enum dsc_output_format output_format);
 bool is_dsc_output_format_supported(int disp_ver, int drmfd, igt_output_t *output,
 				    enum dsc_output_format output_format);
+void force_dsc_fractional_bpp_enable(int drmfd, igt_output_t *output);
+void save_force_dsc_fractional_bpp_en(int drmfd, igt_output_t *output);
+void restore_force_dsc_fractional_bpp_en(void);
+bool is_dsc_fractional_bpp_supported(int disp_ver, int drmfd, igt_output_t *output);
 
 #endif
-- 
2.25.1

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

* [igt-dev] [v4 09/10] tests/i915/kms_dsc: add test to validate fractional bpp with input bpc
  2023-07-28  7:49 [igt-dev] [v4 00/10] DSC Fractional BPP Val Support Swati Sharma
                   ` (7 preceding siblings ...)
  2023-07-28  7:49 ` [igt-dev] [v4 08/10] tests/i915/kms_dsc: enable validation for vdsc fractional bpp Swati Sharma
@ 2023-07-28  7:49 ` Swati Sharma
  2023-07-28  7:49 ` [igt-dev] [v4 10/10] tests/i915/kms_dsc: add test summary Swati Sharma
  9 siblings, 0 replies; 12+ messages in thread
From: Swati Sharma @ 2023-07-28  7:49 UTC (permalink / raw)
  To: igt-dev

New subtest is added to validate fractional bpp with different
input bpc.

Signed-off-by: Swati Sharma <swati2.sharma@intel.com>
Reviewed-by: Ankit Nautiyal <ankit.k.nautiyal@intel.com>
---
 tests/i915/kms_dsc.c | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/tests/i915/kms_dsc.c b/tests/i915/kms_dsc.c
index 8733f13d1..bb6ea2133 100644
--- a/tests/i915/kms_dsc.c
+++ b/tests/i915/kms_dsc.c
@@ -389,6 +389,16 @@ igt_main_args("l", NULL, help_str, opt_handler, &data)
 				 DEFAULT_BPC, DRM_FORMAT_XRGB8888,
 				 DSC_FORMAT_RGB);
 
+	igt_describe("Tests fractional compressed bpp functionality if supported "
+		     "by a connector by forcing fractional_bpp on all connectors that support it "
+		     "with certain input BPC for the connector.");
+	igt_subtest_with_dynamic("dsc-fractional-bpp-with-bpc") {
+		for (int j = 0; j < ARRAY_SIZE(bpc_list); j++)
+			test_dsc(&data, TEST_DSC_FRACTIONAL_BPP | TEST_DSC_BPC,
+				 bpc_list[j], DRM_FORMAT_XRGB8888,
+				 DSC_FORMAT_RGB);
+	}
+
 	igt_fixture {
 		igt_display_fini(&data.display);
 		drm_close_driver(data.drm_fd);
-- 
2.25.1

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

* [igt-dev] [v4 10/10] tests/i915/kms_dsc: add test summary
  2023-07-28  7:49 [igt-dev] [v4 00/10] DSC Fractional BPP Val Support Swati Sharma
                   ` (8 preceding siblings ...)
  2023-07-28  7:49 ` [igt-dev] [v4 09/10] tests/i915/kms_dsc: add test to validate fractional bpp with input bpc Swati Sharma
@ 2023-07-28  7:49 ` Swati Sharma
  9 siblings, 0 replies; 12+ messages in thread
From: Swati Sharma @ 2023-07-28  7:49 UTC (permalink / raw)
  To: igt-dev

Add test summary giving overall summary of subtests.

v2: -drop DSC1.2 reference (Ankit)

Signed-off-by: Swati Sharma <swati2.sharma@intel.com>
Reviewed-by: Ankit Nautiyal <ankit.k.nautiyal@intel.com>
---
 tests/i915/kms_dsc.c | 20 ++++++++++++++++++++
 1 file changed, 20 insertions(+)

diff --git a/tests/i915/kms_dsc.c b/tests/i915/kms_dsc.c
index bb6ea2133..089420cc5 100644
--- a/tests/i915/kms_dsc.c
+++ b/tests/i915/kms_dsc.c
@@ -43,6 +43,26 @@ IGT_TEST_DESCRIPTION("Test to validate display stream compression");
 #define TEST_DSC_OUTPUT_FORMAT	(1<<2)
 #define TEST_DSC_FRACTIONAL_BPP (1<<3)
 
+/*
+ * Starting from gen11, intel driver supports DSC1.1. For validating
+ * DSC, the first step is to verify if the sink supports DSC.
+ * If the sink does support DSC, we will validate the following
+ * scenarios. In all the scenarios, we are forcing dsc.
+ * (i) basic modeset (ii) input bpc (iii) pixel formats
+ * (iv) output formats (v) fractional bpp
+ * In the basic subtest, we perform modeset with default parameters.
+ * Input bpc and pixel formats subtests, we perform modeset
+ * with different input bpc (12/10/8) and pixel formats (YUV/RGB),
+ * respectively. From MTL+, we can verify fractional bpp and
+ * DSC YCBCR420 output format. The tests are executed with the
+ * RGB444 output format by default. However, in the output-format
+ * subtest, we verify output formats (RGB/YCBCR444/YCBCR420).
+ * Fractional bpp is tested with default parameter. In this,
+ * driver will ignore integer compressed bpp value and will do
+ * modeset with fractional bpp only. Also, tests are added to
+ * validate output format and fractional bpp with different input bpc.
+ */
+
 typedef struct {
 	int drm_fd;
 	uint32_t devid;
-- 
2.25.1

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

* Re: [igt-dev] [v4 04/10] tests/i915/kms_dsc: update if condition
  2023-07-28  7:49 ` [igt-dev] [v4 04/10] tests/i915/kms_dsc: update if condition Swati Sharma
@ 2023-07-28  8:45   ` Nautiyal, Ankit K
  0 siblings, 0 replies; 12+ messages in thread
From: Nautiyal, Ankit K @ 2023-07-28  8:45 UTC (permalink / raw)
  To: Swati Sharma, igt-dev


On 7/28/2023 1:19 PM, Swati Sharma wrote:
> Check is_dsc_output_format_supported() iff test flag is set to
> OUTPUT_FORMAT.
>
> Signed-off-by: Swati Sharma <swati2.sharma@intel.com>
> ---
>   tests/i915/kms_dsc.c | 5 +++--
>   1 file changed, 3 insertions(+), 2 deletions(-)
>
> diff --git a/tests/i915/kms_dsc.c b/tests/i915/kms_dsc.c
> index 7b9bae91a..266918f74 100644
> --- a/tests/i915/kms_dsc.c
> +++ b/tests/i915/kms_dsc.c
> @@ -238,8 +238,9 @@ static void test_dsc(data_t *data, uint32_t test_type, int bpc,
>   		if (!is_dsc_supported_by_sink(data->drm_fd, data->output))
>   			continue;
>   
> -		if (!is_dsc_output_format_supported(data->drm_fd, data->disp_ver,
> -						    data->output, data->output_format))
> +		if ((test_type & TEST_DSC_OUTPUT_FORMAT) &&
> +		    (!is_dsc_output_format_supported(data->drm_fd, data->disp_ver,
> +						     data->output, data->output_format)))
>   			continue;

The change look good.

Makes sense to check for output format constraint, only when we are 
forcing the output format.

>   
>   		if (!check_gen11_dp_constraint(data->drm_fd, data->output, data->pipe))

Perhaps this check and the first check: is_dsc_output_format_supported 
can be together.

Also realized that check_gen11_bpc_constraint which come later should 
not be in the loop, as it does not depend on either pipe or output.

So lets move that outside the loop.


Regards,

Ankit

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

end of thread, other threads:[~2023-07-28  8:45 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-07-28  7:49 [igt-dev] [v4 00/10] DSC Fractional BPP Val Support Swati Sharma
2023-07-28  7:49 ` [igt-dev] [v4 01/10] tests/i915/kms_dsc: add new test flag Swati Sharma
2023-07-28  7:49 ` [igt-dev] [v4 02/10] tests/i915/kms_dsc: use uint32_t " Swati Sharma
2023-07-28  7:49 ` [igt-dev] [v4 03/10] tests/i915/kms_dsc: use #define for default bpc Swati Sharma
2023-07-28  7:49 ` [igt-dev] [v4 04/10] tests/i915/kms_dsc: update if condition Swati Sharma
2023-07-28  8:45   ` Nautiyal, Ankit K
2023-07-28  7:49 ` [igt-dev] [v4 05/10] tests/i915/kms_dsc: use igt_get_pipe_current_bpc() Swati Sharma
2023-07-28  7:49 ` [igt-dev] [v4 06/10] tests/i915/kms_dsc: add test validating output formats with input bpc Swati Sharma
2023-07-28  7:49 ` [igt-dev] [v4 07/10] lib/dsc: add helpers for vdsc fractional bpp debugfs entry Swati Sharma
2023-07-28  7:49 ` [igt-dev] [v4 08/10] tests/i915/kms_dsc: enable validation for vdsc fractional bpp Swati Sharma
2023-07-28  7:49 ` [igt-dev] [v4 09/10] tests/i915/kms_dsc: add test to validate fractional bpp with input bpc Swati Sharma
2023-07-28  7:49 ` [igt-dev] [v4 10/10] tests/i915/kms_dsc: add test summary Swati Sharma

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox