[PATCH i-g-t v2 1/2] lib/igt_kms: Add support to retrieve async modifiers and formats

Borah, Chaitanya Kumar chaitanya.kumar.borah at intel.com
Mon Feb 24 15:48:46 UTC 2025



> -----Original Message-----
> From: Reddy Guddati, Santhosh <santhosh.reddy.guddati at intel.com>
> Sent: Friday, February 21, 2025 11:27 AM
> To: igt-dev at lists.freedesktop.org
> Cc: Murthy, Arun R <arun.r.murthy at intel.com>; B S, Karthik
> <karthik.b.s at intel.com>; Borah, Chaitanya Kumar
> <chaitanya.kumar.borah at intel.com>; Reddy Guddati, Santhosh
> <santhosh.reddy.guddati at intel.com>
> Subject: [PATCH i-g-t v2 1/2] lib/igt_kms: Add support to retrieve async
> modifiers and formats
> 
> This patch introduces async_blob_data to handle asynchronous format
> modifiers.Processes asynchronous format modifiers and update plane's
> format and modifiers.

Nit: This could be better phrased. Details like async_blob_data need not be part of the commit message.
Something as follows:

This patch helps parse through the plane property  "IN_FORMATS_ASYNC" to identify
format modifier pairs supported by the plane for async flips.

> 
> Handles 'IN_FORMATS_ASYNC' property.
> 
> V2: Add new fields async_formats and reset idx.
> 
> Signed-off-by: Santhosh Reddy Guddati <santhosh.reddy.guddati at intel.com>
> ---
>  lib/igt_kms.c | 46 +++++++++++++++++++++++++++++++++++++++++++++-
>  lib/igt_kms.h |  8 +++++++-
>  2 files changed, 52 insertions(+), 2 deletions(-)
> 
> diff --git a/lib/igt_kms.c b/lib/igt_kms.c index 0ba1afb08..8623235a9 100644
> --- a/lib/igt_kms.c
> +++ b/lib/igt_kms.c
> @@ -701,6 +701,7 @@ const char * const
> igt_plane_prop_names[IGT_NUM_PLANE_PROPS] = {
>  	[IGT_PLANE_FB_DAMAGE_CLIPS] = "FB_DAMAGE_CLIPS",
>  	[IGT_PLANE_SCALING_FILTER] = "SCALING_FILTER",
>  	[IGT_PLANE_SIZE_HINTS] = "SIZE_HINTS",
> +	[IGT_PLANE_IN_FORMATS_ASYNC] = "IN_FORMATS_ASYNC",
>  };
> 
>  const char * const igt_crtc_prop_names[IGT_NUM_CRTC_PROPS] = { @@ -
> 5724,11 +5725,14 @@ static int igt_count_plane_format_mod(const struct
> drm_format_modifier_blob *blo
> 
>  static void igt_fill_plane_format_mod(igt_display_t *display, igt_plane_t
> *plane)  {
> -	const struct drm_format_modifier_blob *blob_data;
> +	const struct drm_format_modifier_blob *blob_data,
> *async_blob_data;
> +	const struct drm_format_modifier *async_modifiers;
>  	drmModePropertyBlobPtr blob;
>  	uint64_t blob_id;
>  	int idx = 0;
>  	int count;
> +	int async_count;
> +	const uint32_t *async_formats;
> 
>  	if (!igt_plane_has_prop(plane, IGT_PLANE_IN_FORMATS)) {
>  		drmModePlanePtr p = plane->drm_plane; @@ -5788,6
> +5792,46 @@ static void igt_fill_plane_format_mod(igt_display_t *display,
> igt_plane_t *plane
>  	}
> 
>  	igt_assert_eq(idx, plane->format_mod_count);
> +
> +	if (!igt_plane_has_prop(plane, IGT_PLANE_IN_FORMATS_ASYNC))
> +		return;
> +
> +	blob_id = igt_plane_get_prop(plane,
> IGT_PLANE_IN_FORMATS_ASYNC);
> +	blob = drmModeGetPropertyBlob(display->drm_fd, blob_id);
> +
> +	if (!blob)
> +		return;
> +
> +	async_blob_data = (const struct drm_format_modifier_blob *)blob-
> >data;
> +	async_count = igt_count_plane_format_mod(async_blob_data);
> +
> +	if (!async_count)
> +		return;
> +
> +	plane->async_format_mod_count = async_count;
> +	plane->async_modifiers = calloc(async_count, sizeof(plane-
> >async_modifiers[0]));
> +	igt_assert(plane->async_modifiers);
> +
> +	plane->async_formats = calloc(async_count, sizeof(plane-
> >async_formats[0]));
> +	igt_assert(plane->async_formats);
> +
> +	idx = 0;
> +	for (int i = 0; i < async_blob_data->count_modifiers; i++) {
> +		for (int j = 0; j < 64; j++) {
> +			async_modifiers = modifiers_ptr(async_blob_data);
> +			async_formats = formats_ptr(async_blob_data);
> +
> +			if (!(async_modifiers[i].formats & (1ULL << j)))
> +				continue;
> +
> +			plane->async_formats[idx] =
> async_formats[async_modifiers[i].offset + j];
> +			plane->async_modifiers[idx] =
> async_modifiers[i].modifier;
> +			idx++;
> +			igt_assert_lte(idx, plane->async_format_mod_count);
> +		}
> +	}
> +
> +	igt_assert_eq(idx, plane->async_format_mod_count);
>  }
> 
>  /**
> diff --git a/lib/igt_kms.h b/lib/igt_kms.h index 7227f0b0e..7bc5fc06c 100644
> --- a/lib/igt_kms.h
> +++ b/lib/igt_kms.h
> @@ -365,7 +365,8 @@ enum igt_atomic_plane_properties {
>         IGT_PLANE_HOTSPOT_X,
>         IGT_PLANE_HOTSPOT_Y,
>         IGT_PLANE_SIZE_HINTS,
> -       IGT_NUM_PLANE_PROPS
> +       IGT_PLANE_IN_FORMATS_ASYNC,
> +       IGT_NUM_PLANE_PROPS,
>  };
> 
>  /**
> @@ -438,6 +439,10 @@ typedef struct igt_plane {
>  	uint64_t *modifiers;
>  	uint32_t *formats;
>  	int format_mod_count;
> +
> +	uint64_t *async_modifiers;
> +	uint32_t *async_formats;
> +	int async_format_mod_count;
>  } igt_plane_t;
> 
>  /*
> @@ -1273,5 +1278,6 @@ int igt_get_dp_pending_retrain(int drm_fd,
> igt_output_t *output);  void igt_reset_link_params(int drm_fd, igt_output_t
> *output);  int igt_backlight_read(int *result, const char *fname,
> igt_backlight_context_t *context);  int igt_backlight_write(int value, const char
> *fname, igt_backlight_context_t *context);
> +bool igt_get_supported_async_modifier(igt_plane_t *plane);

Where is the definition of this and where is this being used?

Regards

Chaitanya

> 
>  #endif /* __IGT_KMS_H__ */
> --
> 2.25.1



More information about the igt-dev mailing list