[igt-dev] [PATCH i-g-t] tests/i915/kms_dsc: add has_dsc()

Nautiyal, Ankit K ankit.k.nautiyal at intel.com
Tue May 30 05:40:06 UTC 2023


On 5/18/2023 10:57 AM, Swati Sharma wrote:
> Instead of assuming dsc is supported gen11+, lets use has_dsc
> flag in i915_capability to check h/w support.
>
> Signed-off-by: Swati Sharma <swati2.sharma at intel.com>
> ---
>   tests/i915/kms_dsc.c | 20 +++++++++++++++++++-
>   1 file changed, 19 insertions(+), 1 deletion(-)
>
> diff --git a/tests/i915/kms_dsc.c b/tests/i915/kms_dsc.c
> index 3ce28f84..ad698f27 100644
> --- a/tests/i915/kms_dsc.c
> +++ b/tests/i915/kms_dsc.c
> @@ -253,6 +253,24 @@ static void test_dsc(data_t *data, enum dsc_test_type test_type, int bpc,
>   	}
>   }
>   
> +static bool has_dsc(data_t *data)
> +{
> +	char buf[4096];
> +	int dir, res;
> +
> +	dir = igt_debugfs_dir(data->drm_fd);
> +	igt_assert(dir >= 0);
> +
> +	igt_require_intel(data->drm_fd);
> +
> +	res = igt_debugfs_simple_read(dir, "i915_capabilities",
> +				      buf, sizeof(buf));
> +	igt_require(res > 0);
> +	close(dir);
> +
> +	return strstr(buf, "has_dsc: yes");
> +}

Looks good to me.

I suggest we can have it in lib igt_kms,  and re-use this in 
kms_invalid_mode.c . There too we are checking for display version to 
get DSC support from source.

Regards,

Ankit


> +
>   igt_main
>   {
>   	data_t data = {};
> @@ -265,7 +283,7 @@ igt_main
>   		igt_install_exit_handler(kms_dsc_exit_handler);
>   		igt_display_require(&data.display, data.drm_fd);
>   		igt_display_require_output(&data.display);
> -		igt_require(data.disp_ver >= 11);
> +		igt_require(has_dsc(&data));
>   	}
>   
>   	igt_describe("Tests basic display stream compression functionality if supported "


More information about the igt-dev mailing list