[PATCH i-g-t,v3] tests/intel/kms_dsc: Store valid DSC outputs
Swati Sharma
swati2.sharma at intel.com
Mon May 12 09:09:42 UTC 2025
Instead of repeatedly checking debugfs to determine if a panel
supports DSC, perform the check once and store valid outputs (those
that support DSC and meet the required constraints) in an array.
v2: -store pipe as well in array
v3: -store only valid output
-no need to store pipe
-modify constraints accordingly
Signed-off-by: Swati Sharma <swati2.sharma at intel.com>
---
tests/intel/kms_dsc.c | 71 ++++++++++++++++++++++++-------------------
1 file changed, 39 insertions(+), 32 deletions(-)
diff --git a/tests/intel/kms_dsc.c b/tests/intel/kms_dsc.c
index 7f0745370..9b1b3e8dc 100644
--- a/tests/intel/kms_dsc.c
+++ b/tests/intel/kms_dsc.c
@@ -71,12 +71,14 @@ IGT_TEST_DESCRIPTION("Test to validate display stream compression");
typedef struct {
int drm_fd;
+ int count;
uint32_t devid;
igt_display_t display;
struct igt_fb fb_test_pattern;
enum dsc_output_format output_format;
unsigned int plane_format;
igt_output_t *output;
+ igt_output_t *valid_output[IGT_MAX_PIPES];
int input_bpc;
int disp_ver;
enum pipe pipe;
@@ -249,7 +251,6 @@ static void test_dsc(data_t *data, uint32_t test_type, int bpc,
enum dsc_output_format output_format)
{
igt_display_t *display = &data->display;
- igt_output_t *output;
enum pipe pipe;
char name[3][LEN] = {
{0},
@@ -257,47 +258,44 @@ static void test_dsc(data_t *data, uint32_t test_type, int bpc,
{0},
};
+ igt_require_f(data->count > 0, "No valid output found, either sink doesn't support dsc or min 8bpc\n");
igt_require(check_gen11_bpc_constraint(data->drm_fd, data->input_bpc));
- for_each_pipe_with_valid_output(display, pipe, output) {
- data->output_format = output_format;
- data->plane_format = plane_format;
- data->input_bpc = bpc;
- data->output = output;
- data->pipe = pipe;
-
- if (!is_dsc_supported_by_sink(data->drm_fd, data->output) ||
- !check_gen11_dp_constraint(data->drm_fd, data->output, data->pipe))
- continue;
+ for_each_pipe(display, pipe) {
+ for (int i = 0; i < data->count; i++) {
+ data->output_format = output_format;
+ data->plane_format = plane_format;
+ data->input_bpc = bpc;
+ data->output = data->valid_output[i];
+ data->pipe = pipe;
- if (igt_get_output_max_bpc(data->drm_fd, output->name) < MIN_DSC_BPC) {
- igt_info("Output %s doesn't support min %d-bpc\n", igt_output_name(data->output), MIN_DSC_BPC);
- continue;
- }
+ if (!check_gen11_dp_constraint(data->drm_fd, data->output, data->pipe))
+ continue;
- if ((test_type & TEST_DSC_OUTPUT_FORMAT) &&
- (!is_dsc_output_format_supported(data->drm_fd, data->disp_ver,
+ if ((test_type & TEST_DSC_OUTPUT_FORMAT) &&
+ (!is_dsc_output_format_supported(data->drm_fd, data->disp_ver,
data->output, data->output_format)))
- continue;
+ continue;
- if ((test_type & TEST_DSC_FRACTIONAL_BPP) &&
- (!is_dsc_fractional_bpp_supported(data->disp_ver,
+ if ((test_type & TEST_DSC_FRACTIONAL_BPP) &&
+ (!is_dsc_fractional_bpp_supported(data->disp_ver,
data->drm_fd, data->output)))
- continue;
+ continue;
- 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);
+ 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%s%s", kmstest_pipe_name(data->pipe), data->output->name,
- &name[0][0], &name[1][0], &name[2][0])
- update_display(data, test_type);
+ 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)
- break;
+ if (data->limited)
+ break;
+ }
}
}
@@ -323,15 +321,24 @@ data_t data = {};
igt_main_args("l", NULL, help_str, opt_handler, &data)
{
+ igt_output_t *output;
+
igt_fixture {
data.drm_fd = drm_open_driver_master(DRIVER_INTEL | DRIVER_XE);
data.devid = intel_get_drm_devid(data.drm_fd);
data.disp_ver = intel_display_ver(data.devid);
+ data.count = 0;
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(is_dsc_supported_by_source(data.drm_fd));
+
+ for_each_connected_output(&data.display, output) {
+ if (is_dsc_supported_by_sink(data.drm_fd, output) &&
+ igt_get_output_max_bpc(data.drm_fd, output->name) > MIN_DSC_BPC)
+ data.valid_output[data.count++] = output;
+ }
}
igt_describe("Tests basic display stream compression functionality if supported "
--
2.25.1
More information about the igt-dev
mailing list