All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Ville Syrjälä" <ville.syrjala@linux.intel.com>
To: Arun R Murthy <arun.r.murthy@intel.com>
Cc: dri-devel@lists.freedesktop.org, intel-gfx@lists.freedesktop.org,
	intel-xe@lists.freedesktop.org, chaitanya.kumar.borah@intel.com,
	Naveen Kumar <naveen1.kumar@intel.com>
Subject: Re: [PATCH v6 2/3] drm/plane: modify create_in_formats to accommodate async
Date: Wed, 19 Feb 2025 20:53:41 +0200	[thread overview]
Message-ID: <Z7YotTllfzjddNcL@intel.com> (raw)
In-Reply-To: <20250219-asyn-v6-2-b959e6becb3c@intel.com>

On Wed, Feb 19, 2025 at 02:47:24PM +0530, Arun R Murthy wrote:
> create_in_formats creates the list of supported format/modifiers for
> synchronous flips, modify the same function so as to take the
> format_mod_supported as argument and create list of format/modifier for
> async as well.
> 
> v5: create_in_formats can return -ve value in failure case, correct the
> if condition to check the creation of blob <Chaitanya>
> Dont add the modifier for which none of the formats is not supported.
> v6: Remove the code for masking the unsupported modifiers as UMD can
> leave with it. (Naveen/Chaitanya)
> 
> Signed-off-by: Arun R Murthy <arun.r.murthy@intel.com>
> Tested-by: Naveen Kumar <naveen1.kumar@intel.com>
> ---
>  drivers/gpu/drm/drm_plane.c | 45 +++++++++++++++++++++++++++++++++------------
>  1 file changed, 33 insertions(+), 12 deletions(-)
> 
> diff --git a/drivers/gpu/drm/drm_plane.c b/drivers/gpu/drm/drm_plane.c
> index fe181c1002171acc68d3054c2d178f9b9f501fe2..fc26ef8a6cab346c9491495b57f88f1eb205d22c 100644
> --- a/drivers/gpu/drm/drm_plane.c
> +++ b/drivers/gpu/drm/drm_plane.c
> @@ -193,9 +193,12 @@ modifiers_ptr(struct drm_format_modifier_blob *blob)
>  	return (struct drm_format_modifier *)(((char *)blob) + blob->modifiers_offset);
>  }
>  
> -static int create_in_format_blob(struct drm_device *dev, struct drm_plane *plane)
> +static int create_in_format_blob(struct drm_device *dev, struct drm_plane *plane,
> +				 bool (*format_mod_supported)
> +						(struct drm_plane *plane,
> +						 uint32_t format,
> +						 uint64_t modifier))
>  {
> -	const struct drm_mode_config *config = &dev->mode_config;
>  	struct drm_property_blob *blob;
>  	struct drm_format_modifier *mod;
>  	size_t blob_size, formats_size, modifiers_size;
> @@ -237,13 +240,17 @@ static int create_in_format_blob(struct drm_device *dev, struct drm_plane *plane
>  	mod = modifiers_ptr(blob_data);
>  	for (i = 0; i < plane->modifier_count; i++) {
>  		for (j = 0; j < plane->format_count; j++) {
> -			if (!plane->funcs->format_mod_supported ||
> -			    plane->funcs->format_mod_supported(plane,
> -							       plane->format_types[j],
> -							       plane->modifiers[i])) {
> +			if (!format_mod_supported || format_mod_supported
> +							(plane,
> +							 plane->format_types[j],
> +							 plane->modifiers[i])) {

Weird line breaks.

>  				mod->formats |= 1ULL << j;
>  			}
>  		}
> +		if (!mod->formats) {
> +			blob_data->count_modifiers--;
> +			continue;
> +		}

I hope no userspace rejects the blob if there
is extra data at the end...

Since this can actually change the behaviour 
I think this one needs to be a separate patch
in case we need a revert later.

>  
>  		mod->modifier = plane->modifiers[i];
>  		mod->offset = 0;
> @@ -251,10 +258,7 @@ static int create_in_format_blob(struct drm_device *dev, struct drm_plane *plane
>  		mod++;
>  	}
>  
> -	drm_object_attach_property(&plane->base, config->modifiers_property,
> -				   blob->base.id);
> -
> -	return 0;
> +	return blob->base.id;

The return type is wrong for this.

I think it'd probably be better to return
struct drm_property_blob* instead so we can
return errors properly as well.

>  }
>  
>  /**
> @@ -371,6 +375,7 @@ static int __drm_universal_plane_init(struct drm_device *dev,
>  	};
>  	unsigned int format_modifier_count = 0;
>  	int ret;
> +	int blob_id;
>  
>  	/* plane index is used with 32bit bitmasks */
>  	if (WARN_ON(config->num_total_plane >= 32))
> @@ -477,8 +482,24 @@ static int __drm_universal_plane_init(struct drm_device *dev,
>  		drm_plane_create_hotspot_properties(plane);
>  	}
>  
> -	if (format_modifier_count)
> -		create_in_format_blob(dev, plane);
> +	if (format_modifier_count) {
> +		blob_id = create_in_format_blob(dev, plane,
> +						plane->funcs->format_mod_supported);
> +		if (blob_id > 0)
> +			drm_object_attach_property(&plane->base,
> +						   config->modifiers_property,
> +						   blob_id);
> +	}
> +
> +	if (plane->funcs->format_mod_supported_async) {
> +		blob_id = create_in_format_blob(dev, plane,
> +						plane->funcs->format_mod_supported_async);
> +		if (blob_id > 0)
> +			drm_object_attach_property(&plane->base,
> +						   config->async_modifiers_property,
> +						   blob_id);
> +	}
> +
>  
>  	return 0;
>  }
> 
> -- 
> 2.25.1

-- 
Ville Syrjälä
Intel

  reply	other threads:[~2025-02-19 19:40 UTC|newest]

Thread overview: 29+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-02-19  9:17 [PATCH v6 0/3] Expose modifiers/formats supported by async flips Arun R Murthy
2025-02-19  9:17 ` [PATCH v6 1/3] drm/plane: Add new plane property IN_FORMATS_ASYNC Arun R Murthy
2025-02-19 18:54   ` Ville Syrjälä
2025-02-19  9:17 ` [PATCH v6 2/3] drm/plane: modify create_in_formats to accommodate async Arun R Murthy
2025-02-19 18:53   ` Ville Syrjälä [this message]
2025-03-12  5:48   ` Borah, Chaitanya Kumar
2025-03-12  5:51     ` Borah, Chaitanya Kumar
2025-02-19  9:17 ` [PATCH v6 3/3] drm/i915/display: Add i915 hook for format_mod_supported_async Arun R Murthy
2025-02-19 19:08   ` Ville Syrjälä
2025-02-19  9:39 ` ✓ CI.Patch_applied: success for Expose modifiers/formats supported by async flips (rev7) Patchwork
2025-02-19  9:40 ` ✗ CI.checkpatch: warning " Patchwork
2025-02-19  9:41 ` ✓ CI.KUnit: success " Patchwork
2025-02-19  9:57 ` ✓ CI.Build: " Patchwork
2025-02-19 10:00 ` ✓ CI.Hooks: " Patchwork
2025-02-19 10:01 ` ✗ Fi.CI.CHECKPATCH: warning for Expose modifiers/formats supported by async flips (rev6) Patchwork
2025-02-19 10:01 ` ✗ Fi.CI.SPARSE: " Patchwork
2025-02-19 10:01 ` ✗ CI.checksparse: warning for Expose modifiers/formats supported by async flips (rev7) Patchwork
2025-02-19 10:15 ` ✗ i915.CI.BAT: failure for Expose modifiers/formats supported by async flips (rev6) Patchwork
2025-02-19 13:53 ` [PATCH v6 0/3] Expose modifiers/formats supported by async flips Simona Vetter
2025-02-19 22:33 ` Ville Syrjälä
2025-02-20  6:20 ` ✓ CI.Patch_applied: success for Expose modifiers/formats supported by async flips (rev8) Patchwork
2025-02-20  6:20 ` ✗ CI.checkpatch: warning " Patchwork
2025-02-20  6:21 ` ✓ CI.KUnit: success " Patchwork
2025-02-20  6:38 ` ✓ CI.Build: " Patchwork
2025-02-20  6:40 ` ✓ CI.Hooks: " Patchwork
2025-02-20  6:50 ` ✗ CI.checksparse: warning " Patchwork
2025-02-20  7:15 ` ✗ Xe.CI.Full: failure for Expose modifiers/formats supported by async flips (rev7) Patchwork
2025-02-20  7:15 ` ✓ Xe.CI.BAT: success for Expose modifiers/formats supported by async flips (rev8) Patchwork
2025-02-21  0:55 ` ✗ Xe.CI.Full: failure " Patchwork

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=Z7YotTllfzjddNcL@intel.com \
    --to=ville.syrjala@linux.intel.com \
    --cc=arun.r.murthy@intel.com \
    --cc=chaitanya.kumar.borah@intel.com \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=intel-gfx@lists.freedesktop.org \
    --cc=intel-xe@lists.freedesktop.org \
    --cc=naveen1.kumar@intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.