[PATCH i-g-t] tests/intel/kms_dsc: Store valid DSC outputs

Nautiyal, Ankit K ankit.k.nautiyal at intel.com
Wed Mar 12 06:11:01 UTC 2025


On 2/18/2025 6:33 PM, Swati Sharma wrote:
> 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.

Makes sense.

Patch looks good to me.

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

>
> Signed-off-by: Swati Sharma <swati2.sharma at intel.com>
> ---
>   tests/intel/kms_dsc.c | 32 +++++++++++++++++---------------
>   1 file changed, 17 insertions(+), 15 deletions(-)
>
> diff --git a/tests/intel/kms_dsc.c b/tests/intel/kms_dsc.c
> index 5508e7a9e..3f1c93094 100644
> --- a/tests/intel/kms_dsc.c
> +++ b/tests/intel/kms_dsc.c
> @@ -73,12 +73,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;
> @@ -262,32 +264,21 @@ 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;
> -	enum pipe pipe;
>   	char name[3][LEN] = {
>   				{0},
>   				{0},
>   				{0},
>   			    };
>   
> +	igt_require_f(data->count > 0, "No dsc output found that meets all constraints\n");
>   	igt_require(check_gen11_bpc_constraint(data->drm_fd, data->input_bpc));
>   
> -	for_each_pipe_with_valid_output(display, pipe, output) {
> +	for (int i = 0; i < data->count; i++) {
>   		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;
> -
> -		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;
> -		}
> +		data->output = data->valid_output[i];
> +		data->pipe = i;
>   
>   		if ((test_type & TEST_DSC_OUTPUT_FORMAT) &&
>   		    (!is_dsc_output_format_supported(data->drm_fd, data->disp_ver,
> @@ -337,15 +328,26 @@ data_t data = {};
>   
>   igt_main_args("l", NULL, help_str, opt_handler, &data)
>   {
> +	igt_output_t *output;
> +	enum pipe pipe = PIPE_A;
> +
>   	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_valid_output_on_pipe(&data.display, pipe, output) {
> +			if (is_dsc_supported_by_sink(data.drm_fd, output) &&
> +			    check_gen11_dp_constraint(data.drm_fd, output, pipe) &&
> +		            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 "


More information about the igt-dev mailing list