[PATCH v3 3/5] drm/plane: Function to check async supported modifier/format

Borah, Chaitanya Kumar chaitanya.kumar.borah at intel.com
Sun Jan 12 08:01:06 UTC 2025



> -----Original Message-----
> From: Intel-gfx <intel-gfx-bounces at lists.freedesktop.org> On Behalf Of Arun
> R Murthy
> Sent: Wednesday, January 8, 2025 11:09 AM
> To: dri-devel at lists.freedesktop.org; intel-gfx at lists.freedesktop.org; intel-
> xe at lists.freedesktop.org
> Cc: Murthy, Arun R <arun.r.murthy at intel.com>
> Subject: [PATCH v3 3/5] drm/plane: Function to check async supported
> modifier/format
> 
> Seperate function for async flips is to be called in order to check the provided
> format/modifier support.
> At present the flag for async flip is stored in crtc_state as async flip is
> supported on only one plane for a given crtc. The same is being used over
> here to decide the async function pointer.
> 
> Signed-off-by: Arun R Murthy <arun.r.murthy at intel.com>
> ---
>  drivers/gpu/drm/drm_plane.c | 30 ++++++++++++++++++++++--------
>  1 file changed, 22 insertions(+), 8 deletions(-)
> 
> diff --git a/drivers/gpu/drm/drm_plane.c b/drivers/gpu/drm/drm_plane.c
> index
> 4f35eec2b7770fcc90c3e07a9068b31c0563a4c0..9e08ba4318cf0c07fa0701023
> 659986855e0e98a 100644
> --- a/drivers/gpu/drm/drm_plane.c
> +++ b/drivers/gpu/drm/drm_plane.c
> @@ -238,12 +238,21 @@ int drm_plane_create_format_blob(struct
> drm_device *dev,
>  	mod = modifiers_ptr(blob_data);
>  	for (i = 0; i < modifier_count; i++) {
>  		for (j = 0; j < format_count; j++) {
> -			if (is_async ||
> -			    !plane->funcs->format_mod_supported ||
> -			    plane->funcs->format_mod_supported(plane,
> -							       formats[j],
> -							       modifiers[i])) {
> -				mod->formats |= 1ULL << j;
> +			if (is_async) {
> +				if (!plane->funcs-
> >format_mod_supported_async ||
> +				    plane->funcs-
> >format_mod_supported_async(plane,
> +
> formats[j],
> +
> modifiers[i])) {
> +					mod->formats |= 1ULL << j;
> +				}
> +
> +			} else {
> +				if (!plane->funcs->format_mod_supported ||
> +				    plane->funcs-
> >format_mod_supported(plane,
> +								       formats[j],
> +
> modifiers[i])) {
> +					mod->formats |= 1ULL << j;
> +				}
>  			}
>  		}
> 
> @@ -910,6 +919,7 @@ bool drm_plane_has_format(struct drm_plane
> *plane,
>  			  u32 format, u64 modifier)
>  {
>  	unsigned int i;
> +	bool is_async = plane->crtc->state->async_flip;
> 
>  	for (i = 0; i < plane->format_count; i++) {
>  		if (format == plane->format_types[i]) @@ -918,8 +928,12 @@
> bool drm_plane_has_format(struct drm_plane *plane,
>  	if (i == plane->format_count)
>  		return false;
> 
> -	if (plane->funcs->format_mod_supported) {
> -		if (!plane->funcs->format_mod_supported(plane, format,
> modifier))
> +	if (is_async ? plane->funcs->format_mod_supported_async :
> +			plane->funcs->format_mod_supported) {
> +		if (!(is_async ? plane->funcs->format_mod_supported_async(
> +						plane, format, modifier) :
> +					plane->funcs-
> >format_mod_supported(
> +						plane, format, modifier)))

Since we are bringing this check here. Should the check be removed from the i915 code?
We also need to account for the fact that some drivers will not have the format_mod_supported_async() implemented.

Regards

Chaitanya

>  			return false;
>  	} else {
>  		if (!plane->modifier_count)
> 
> --
> 2.25.1



More information about the dri-devel mailing list