Igt-dev Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Swati Sharma <swati2.sharma@intel.com>
To: igt-dev@lists.freedesktop.org
Cc: Swati Sharma <swati2.sharma@intel.com>
Subject: [PATCH i-g-t 4/4] tests/intel/kms_dsc: Add dsc-compressed-bpp subtest
Date: Fri, 31 Jul 2026 17:51:45 +0530	[thread overview]
Message-ID: <20260731122145.4099468-5-swati2.sharma@intel.com> (raw)
In-Reply-To: <20260731122145.4099468-1-swati2.sharma@intel.com>

Add a subtest that forces DSC with specific compressed BPP
values on all connectors that support it. For display version
>= 13, query the sink's max compressed BPP and iterate through
valid values. For older platforms, use a fixed set of BPP
values.

v2: Rebase

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

diff --git a/tests/intel/kms_dsc.c b/tests/intel/kms_dsc.c
index 1e30f6fee..fff51fb9a 100644
--- a/tests/intel/kms_dsc.c
+++ b/tests/intel/kms_dsc.c
@@ -59,6 +59,9 @@
  * @with-output-formats-with-bpc: DSC with output formats with certain input BPC for the connector
  * @fractional-bpp:               DSC with fractional bpp with default parameters
  * @fractional-bpp-with-bpc:      DSC with fractional bpp with certain input BPC for the connector
+ * @compressed-bpp:               DSC with compressed bpp
+ * @compressed-bpp-bigjoiner:               DSC with big joiner and compressed bpp
+ * @compressed-bpp-ultrajoiner:             DSC with ultra joiner and compressed bpp
  * @basic-bigjoiner:                        DSC with big joiner and default parameters
  * @with-formats-bigjoiner:                 DSC with big joiner and diff formats
  * @with-bpc-bigjoiner:                     DSC with big joiner and certain input BPC
@@ -82,12 +85,14 @@ IGT_TEST_DESCRIPTION("Test to validate display stream compression");
 #define LEN		20
 #define DEFAULT_BPC	0
 #define MIN_DSC_BPC	8
+#define STEP_SIZE	2
 
 #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)
 #define TEST_DSC_FRACTIONAL_BPP (1<<3)
+#define TEST_DSC_COMPRESSED_BPP (1<<4)
 
 typedef struct {
 	int drm_fd;
@@ -100,6 +105,7 @@ typedef struct {
 	igt_output_t *output;
 	igt_output_t *valid_output[IGT_MAX_PIPES];
 	int input_bpc;
+	float compressed_bpp;
 	int disp_ver;
 	igt_crtc_t *crtc;
 	enum joined_pipes force_joined_pipes;
@@ -151,6 +157,9 @@ static void test_reset(data_t *data)
 	igt_debug("Reset DSC output format\n");
 	data->output_format = DSC_FORMAT_RGB;
 	force_dsc_output_format(data->drm_fd, data->output, data->output_format);
+
+	igt_debug("Reset compressed BPP\n");
+	force_dsc_enable_compressed_bpp(data->drm_fd, data->output, 0);
 }
 
 static void test_cleanup(data_t *data)
@@ -169,6 +178,58 @@ static void test_cleanup(data_t *data)
 				       JOINED_PIPES_DEFAULT);
 }
 
+/* Force a full off→on modeset with DSC so the driver populates compressed BPP. */
+static void
+force_dsc_with_modeset(int drm_fd, igt_display_t *display,
+		       igt_output_t *output, igt_crtc_t *crtc)
+{
+	drmModeModeInfo *mode;
+
+	igt_display_reset(display);
+	igt_display_commit(display);
+
+	igt_output_set_crtc(output, crtc);
+
+	mode = igt_output_get_highres_mode(output);
+	igt_output_override_mode(output, mode);
+	igt_display_commit2(display, COMMIT_ATOMIC);
+
+	force_dsc_enable(drm_fd, output);
+
+	igt_output_set_crtc(output, NULL);
+	igt_display_commit2(display, COMMIT_ATOMIC);
+
+	igt_output_set_crtc(output, crtc);
+	igt_display_commit2(display, COMMIT_ATOMIC);
+}
+
+static int
+get_compressed_bpp_list(int drm_fd, int disp_ver, igt_display_t *display,
+			igt_output_t *output, igt_crtc_t *crtc, float *bpp_list,
+			int max_entries)
+{
+	int count = 0;
+	float max_bpp = 0.0f;
+
+	if (disp_ver < 13) {
+		const int fixed_bpp[] = {6, 8, 10, 12, 15};
+		for (int i = 0; i < ARRAY_SIZE(fixed_bpp) && count < max_entries; i++)
+			bpp_list[count++] = fixed_bpp[i];
+	} else {
+		force_dsc_with_modeset(drm_fd, display, output, crtc);
+		max_bpp = igt_get_dsc_sink_compressed_bpp(drm_fd, crtc->pipe);
+
+		/* FIXME: MIN compressed BPP value is 8 for RGB and
+		 * 6 for YCBCR420 output formats. For simplicity lets
+		 * consider 8 for time being.
+		 */
+		for (int bpp = 8; bpp <= max_bpp && count < max_entries; bpp += STEP_SIZE)
+			bpp_list[count++] = bpp;
+	}
+
+	return count;
+}
+
 /* re-probe connectors and do a modeset with DSC */
 static void update_display(data_t *data, uint32_t test_type)
 {
@@ -260,6 +321,11 @@ static void update_display(data_t *data, uint32_t test_type)
 
 		igt_output_override_mode(output, mode);
 
+		if (test_type & TEST_DSC_COMPRESSED_BPP) {
+			igt_debug("Trying to set compressed BPP to %.2f\n", data->compressed_bpp);
+			force_dsc_enable_compressed_bpp(data->drm_fd, data->output, data->compressed_bpp);
+		}
+
 		if (!intel_pipe_output_combo_valid(display)) {
 			if (data->output_format == DSC_FORMAT_RGB) {
 				igt_info("No valid pipe/output/mode found.\n");
@@ -331,6 +397,8 @@ static void test_dsc(data_t *data, uint32_t test_type, int bpc,
 	igt_display_t *display = &data->display;
 	igt_crtc_t *crtc;
 	int n_pipes = igt_display_n_crtcs(display);
+	int bpp_count = 1;
+	float bpp_list[32] = {0};
 	char name[3][LEN] = {
 				{0},
 				{0},
@@ -380,9 +448,17 @@ static void test_dsc(data_t *data, uint32_t test_type, int bpc,
 			if (test_type & TEST_DSC_BPC)
 				snprintf(&name[2][0], LEN, "-%dbpc", data->input_bpc);
 
+			if (test_type & TEST_DSC_COMPRESSED_BPP)
+				bpp_count = get_compressed_bpp_list(data->drm_fd, data->disp_ver, display,
+								     data->output, data->crtc, bpp_list, ARRAY_SIZE(bpp_list));
+
 			igt_dynamic_f("pipe-%s-%s%s%s%s", igt_crtc_name(data->crtc), data->output->name,
-				      &name[0][0], &name[1][0], &name[2][0])
-				update_display(data, test_type);
+				      &name[0][0], &name[1][0], &name[2][0]) {
+				for (int j = 0; j < bpp_count; j++) {
+					data->compressed_bpp = bpp_list[j];
+					update_display(data, test_type);
+				}
+			}
 
 			if (data->limited)
 				break;
@@ -546,6 +622,16 @@ int igt_main_args("l", NULL, help_str, opt_handler, &data)
 					 bpc_list[j], DRM_FORMAT_XRGB8888,
 					 DSC_FORMAT_RGB, joiner_tests[i]);
 		}
+
+		igt_describe_f("Tests basic display stream compression functionality "
+			       "if supported by a connector by forcing DSC%s and "
+			       "compressed bpp on all connectors that support it.",
+			       joiner_tests[i] ? " and joiner" : "");
+		igt_subtest_with_dynamic_f("dsc-compressed-bpp%s",
+					   joiner_subtest_suffix(joiner_tests[i]))
+			test_dsc(&data, TEST_DSC_COMPRESSED_BPP,
+				 DEFAULT_BPC, DRM_FORMAT_XRGB8888,
+				 DSC_FORMAT_RGB, joiner_tests[i]);
 	}
 
 	igt_fixture() {
-- 
2.25.1


  parent reply	other threads:[~2026-07-31 12:15 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-07-31 12:21 [PATCH i-g-t 0/4] Add DSC compressed BPP subtest Swati Sharma
2026-07-31 12:21 ` [PATCH i-g-t 1/4] lib/dsc: Add igt_force_dsc_enable_compressed_bpp() Swati Sharma
2026-07-31 12:21 ` [PATCH i-g-t 2/4] tests/intel/kms_dsc_helper: Add helper to force compressed BPP Swati Sharma
2026-07-31 12:21 ` [PATCH i-g-t 3/4] lib/dsc: Add igt_get_dsc_sink_compressed_bpp() Swati Sharma
2026-07-31 12:21 ` Swati Sharma [this message]
2026-07-31 13:00 ` ✓ Xe.CI.BAT: success for Add DSC compressed BPP subtest (rev2) Patchwork
2026-07-31 13:28 ` ✗ i915.CI.BAT: failure " Patchwork
2026-07-31 14:00 ` ✗ Xe.CI.FULL: " Patchwork

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20260731122145.4099468-5-swati2.sharma@intel.com \
    --to=swati2.sharma@intel.com \
    --cc=igt-dev@lists.freedesktop.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox