Intel-XE Archive on 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: intel-xe@lists.freedesktop.org, intel-gfx@lists.freedesktop.org,
	dri-devel@lists.freedesktop.org
Subject: Re: [PATCHv2 2/3] drm/plane: Expose function to create format/modifier blob
Date: Fri, 22 Nov 2024 22:06:13 +0200	[thread overview]
Message-ID: <Z0DkNcS-qLgoArml@intel.com> (raw)
In-Reply-To: <20241118075315.466009-3-arun.r.murthy@intel.com>

On Mon, Nov 18, 2024 at 01:23:14PM +0530, Arun R Murthy wrote:
> Expose drm plane function to create formats/modifiers blob. This
> function can be used to expose list of supported formats/modifiers for
> sync/async flips.
> 
> Signed-off-by: Arun R Murthy <arun.r.murthy@intel.com>
> ---
>  drivers/gpu/drm/drm_plane.c | 44 ++++++++++++++++++++++++-------------
>  include/drm/drm_plane.h     |  4 ++++
>  2 files changed, 33 insertions(+), 15 deletions(-)
> 
> diff --git a/drivers/gpu/drm/drm_plane.c b/drivers/gpu/drm/drm_plane.c
> index 416818e54ccf..4f35eec2b777 100644
> --- a/drivers/gpu/drm/drm_plane.c
> +++ b/drivers/gpu/drm/drm_plane.c
> @@ -191,7 +191,10 @@ 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)
> +int drm_plane_create_format_blob(struct drm_device *dev,
> +				 struct drm_plane *plane, u64 *modifiers,
> +				 unsigned int modifier_count, u32 *formats,
> +				 unsigned int format_count, bool is_async)
>  {
>  	const struct drm_mode_config *config = &dev->mode_config;
>  	struct drm_property_blob *blob;
> @@ -200,14 +203,14 @@ static int create_in_format_blob(struct drm_device *dev, struct drm_plane *plane
>  	struct drm_format_modifier_blob *blob_data;
>  	unsigned int i, j;
>  
> -	formats_size = sizeof(__u32) * plane->format_count;
> +	formats_size = sizeof(__u32) * format_count;
>  	if (WARN_ON(!formats_size)) {
>  		/* 0 formats are never expected */
>  		return 0;
>  	}
>  
>  	modifiers_size =
> -		sizeof(struct drm_format_modifier) * plane->modifier_count;
> +		sizeof(struct drm_format_modifier) * modifier_count;
>  
>  	blob_size = sizeof(struct drm_format_modifier_blob);
>  	/* Modifiers offset is a pointer to a struct with a 64 bit field so it
> @@ -223,37 +226,45 @@ static int create_in_format_blob(struct drm_device *dev, struct drm_plane *plane
>  
>  	blob_data = blob->data;
>  	blob_data->version = FORMAT_BLOB_CURRENT;
> -	blob_data->count_formats = plane->format_count;
> +	blob_data->count_formats = format_count;
>  	blob_data->formats_offset = sizeof(struct drm_format_modifier_blob);
> -	blob_data->count_modifiers = plane->modifier_count;
> +	blob_data->count_modifiers = modifier_count;
>  
>  	blob_data->modifiers_offset =
>  		ALIGN(blob_data->formats_offset + formats_size, 8);
>  
> -	memcpy(formats_ptr(blob_data), plane->format_types, formats_size);
> +	memcpy(formats_ptr(blob_data), formats, formats_size);
>  
>  	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 ||
> +	for (i = 0; i < modifier_count; i++) {
> +		for (j = 0; j < format_count; j++) {
> +			if (is_async ||

I asked for a format_mod_supported_async(). This is not that.

> +			    !plane->funcs->format_mod_supported ||
>  			    plane->funcs->format_mod_supported(plane,
> -							       plane->format_types[j],
> -							       plane->modifiers[i])) {
> +							       formats[j],
> +							       modifiers[i])) {
>  				mod->formats |= 1ULL << j;
>  			}
>  		}
>  
> -		mod->modifier = plane->modifiers[i];
> +		mod->modifier = modifiers[i];
>  		mod->offset = 0;
>  		mod->pad = 0;
>  		mod++;
>  	}
>  
> -	drm_object_attach_property(&plane->base, config->modifiers_property,
> -				   blob->base.id);
> +	if (is_async)
> +		drm_object_attach_property(&plane->base,
> +					   config->async_modifiers_property,
> +					   blob->base.id);
> +	else
> +		drm_object_attach_property(&plane->base,
> +					   config->modifiers_property,
> +					   blob->base.id);
>  
>  	return 0;
>  }
> +EXPORT_SYMBOL(drm_plane_create_format_blob);
>  
>  /**
>   * DOC: hotspot properties
> @@ -476,7 +487,10 @@ static int __drm_universal_plane_init(struct drm_device *dev,
>  	}
>  
>  	if (format_modifier_count)
> -		create_in_format_blob(dev, plane);
> +		drm_plane_create_format_blob(dev, plane, plane->modifiers,
> +					     format_modifier_count,
> +					     plane->format_types, format_count,
> +					     false);
>  
>  	return 0;
>  }
> diff --git a/include/drm/drm_plane.h b/include/drm/drm_plane.h
> index dd718c62ac31..3c5c2c614af8 100644
> --- a/include/drm/drm_plane.h
> +++ b/include/drm/drm_plane.h
> @@ -988,5 +988,9 @@ int drm_plane_create_scaling_filter_property(struct drm_plane *plane,
>  int drm_plane_add_size_hints_property(struct drm_plane *plane,
>  				      const struct drm_plane_size_hint *hints,
>  				      int num_hints);
> +int drm_plane_create_format_blob(struct drm_device *dev,
> +				 struct drm_plane *plane, u64 *modifiers,
> +				 unsigned int modifier_count, u32 *formats,
> +				 unsigned int format_count, bool is_async);
>  
>  #endif
> -- 
> 2.25.1

-- 
Ville Syrjälä
Intel

  reply	other threads:[~2024-11-22 20:06 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-11-18  7:53 [PATCHv2/3] Expose modifiers/formats supported by async flips Arun R Murthy
2024-11-18  7:53 ` [PATCHv2 1/3] drm/plane: Add new plane property IN_FORMATS_ASYNC Arun R Murthy
2024-11-18  7:53 ` [PATCHv2 2/3] drm/plane: Expose function to create format/modifier blob Arun R Murthy
2024-11-22 20:06   ` Ville Syrjälä [this message]
2024-11-25  8:45     ` Murthy, Arun R
2024-12-13  9:02       ` Murthy, Arun R
2024-11-18  7:53 ` [PATCHv2 3/3] drm/i915/display: Populate list of async supported formats/modifiers Arun R Murthy
2024-11-22  4:02   ` kernel test robot
2024-11-25 13:05   ` kernel test robot
2024-11-28 23:21   ` kernel test robot
2024-11-18 11:51 ` ✓ CI.Patch_applied: success for series starting with [PATCHv2,1/3] drm/plane: Add new plane property IN_FORMATS_ASYNC Patchwork
2024-11-18 11:52 ` ✓ CI.checkpatch: " Patchwork
2024-11-18 11:53 ` ✓ CI.KUnit: " Patchwork
2024-11-18 12:11 ` ✓ CI.Build: " Patchwork
2024-11-18 12:11 ` ✗ CI.Hooks: failure " Patchwork
2024-11-18 12:13 ` ✗ CI.checksparse: warning " Patchwork
2024-11-18 12:31 ` ✓ CI.BAT: success " Patchwork
2024-11-18 15:15 ` ✗ CI.FULL: failure " Patchwork
2024-12-13 10:55 ` ✗ CI.Patch_applied: failure for series starting with [PATCHv2,1/3] drm/plane: Add new plane property IN_FORMATS_ASYNC (rev2) Patchwork
  -- strict thread matches above, loose matches on Subject: below --
2024-11-05 10:26 [PATCH 0/4] Expose modifiers/formats supported by async flips Arun R Murthy
2024-11-18  7:48 ` [PATCHv2/3] " Arun R Murthy
2024-11-18  7:48   ` [PATCHv2 2/3] drm/plane: Expose function to create format/modifier blob Arun R Murthy

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=Z0DkNcS-qLgoArml@intel.com \
    --to=ville.syrjala@linux.intel.com \
    --cc=arun.r.murthy@intel.com \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=intel-gfx@lists.freedesktop.org \
    --cc=intel-xe@lists.freedesktop.org \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox