[PATCH i-g-t 1/2] lib/dsc: Add helper igt_get_dsc_sink_max_slice_count()

Reddy Guddati, Santhosh santhosh.reddy.guddati at intel.com
Wed Dec 11 02:50:39 UTC 2024



On 10-12-2024 19:23, Swati Sharma wrote:
> Helper is added to return maximum dsc sink slice count from the
> connector debugfs.
> 
> Signed-off-by: Swati Sharma <swati2.sharma at intel.com>
> ---
>   lib/igt_dsc.c | 24 ++++++++++++++++++++++++
>   lib/igt_dsc.h |  1 +
>   2 files changed, 25 insertions(+)
> 
> diff --git a/lib/igt_dsc.c b/lib/igt_dsc.c
> index 229cd3298..8d259b734 100644
> --- a/lib/igt_dsc.c
> +++ b/lib/igt_dsc.c
> @@ -308,3 +308,27 @@ int igt_get_dsc_fractional_bpp_debugfs_fd(int drmfd, char *connector_name)
>   
>   	return openat(igt_debugfs_dir(drmfd), file_name, O_WRONLY);
>   }
> +
> +/**
> + * igt_get_dsc_sink_max_slice_count:
> + * @drmfd: A drm file descriptor
> + * @connector_name: Name of the libdrm connector we're going to use
> + *
> + * Returns: The maximum dsc sink slice count from the connector debugfs.
> + */
> +int igt_get_dsc_sink_max_slice_count(int drmfd, char *connector_name)
> +{
> +	char file_name[128] = {0};
> +	char buf[512];
> +	char *start_loc;
> +	int max_slice_count;
> +
> +	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_Max_Slice_Count: "));
> +	igt_assert_eq(sscanf(start_loc, "DSC_Sink_Max_Slice_Count: %d", &max_slice_count), 1);
> +	igt_assert(max_slice_count > 0);
> +
> +	return max_slice_count;
> +}

LGTM,
Reviewed-by: Santhosh Reddy Guddati <santhosh.reddy.guddati at intel.com>
> diff --git a/lib/igt_dsc.h b/lib/igt_dsc.h
> index 7ab0917ec..3cf2d4e76 100644
> --- a/lib/igt_dsc.h
> +++ b/lib/igt_dsc.h
> @@ -27,5 +27,6 @@ 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);
> +int igt_get_dsc_sink_max_slice_count(int drmfd, char *connector_name);
>   
>   #endif



More information about the igt-dev mailing list