intel-gfx.lists.freedesktop.org archive mirror
 help / color / mirror / Atom feed
From: Rodrigo Vivi <rodrigo.vivi@intel.com>
To: Ville Syrjala <ville.syrjala@linux.intel.com>
Cc: <dri-devel@lists.freedesktop.org>,
	<intel-gfx@lists.freedesktop.org>,
	<intel-xe@lists.freedesktop.org>,
	Thomas Zimmermann <tzimmermann@suse.de>
Subject: Re: [PATCH v2 13/19] drm/i915: Pass along the format info from .fb_create() to drm_helper_mode_fill_fb_struct()
Date: Tue, 15 Jul 2025 15:32:35 -0400	[thread overview]
Message-ID: <aHas01eFBQzs4eGE@intel.com> (raw)
In-Reply-To: <20250701090722.13645-14-ville.syrjala@linux.intel.com>

On Tue, Jul 01, 2025 at 12:07:16PM +0300, Ville Syrjala wrote:
> From: Ville Syrjälä <ville.syrjala@linux.intel.com>
> 
> Plumb the format info from .fb_create() all the way to
> drm_helper_mode_fill_fb_struct() to avoid the redundant
> lookup.
> 
> For the fbdev case a manual drm_get_format_info() lookup
> is needed.
> 
> Reviewed-by: Thomas Zimmermann <tzimmermann@suse.de>
> Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>

Acked-by: Rodrigo Vivi <rodrigo.vivi@intel.com>

to get this through drm-misc

> ---
>  drivers/gpu/drm/i915/display/intel_fb.c            | 8 +++++---
>  drivers/gpu/drm/i915/display/intel_fb.h            | 2 ++
>  drivers/gpu/drm/i915/display/intel_fbdev_fb.c      | 6 +++++-
>  drivers/gpu/drm/i915/display/intel_plane_initial.c | 3 ++-
>  drivers/gpu/drm/xe/display/intel_fbdev_fb.c        | 6 +++++-
>  drivers/gpu/drm/xe/display/xe_plane_initial.c      | 2 +-
>  6 files changed, 20 insertions(+), 7 deletions(-)
> 
> diff --git a/drivers/gpu/drm/i915/display/intel_fb.c b/drivers/gpu/drm/i915/display/intel_fb.c
> index 30fa287ed6b0..1792f138b062 100644
> --- a/drivers/gpu/drm/i915/display/intel_fb.c
> +++ b/drivers/gpu/drm/i915/display/intel_fb.c
> @@ -2207,6 +2207,7 @@ static const struct drm_framebuffer_funcs intel_fb_funcs = {
>  
>  int intel_framebuffer_init(struct intel_framebuffer *intel_fb,
>  			   struct drm_gem_object *obj,
> +			   const struct drm_format_info *info,
>  			   struct drm_mode_fb_cmd2 *mode_cmd)
>  {
>  	struct intel_display *display = to_intel_display(obj->dev);
> @@ -2254,7 +2255,7 @@ int intel_framebuffer_init(struct intel_framebuffer *intel_fb,
>  		goto err_frontbuffer_put;
>  	}
>  
> -	drm_helper_mode_fill_fb_struct(display->drm, fb, NULL, mode_cmd);
> +	drm_helper_mode_fill_fb_struct(display->drm, fb, info, mode_cmd);
>  
>  	for (i = 0; i < fb->format->num_planes; i++) {
>  		unsigned int stride_alignment;
> @@ -2335,7 +2336,7 @@ intel_user_framebuffer_create(struct drm_device *dev,
>  	if (IS_ERR(obj))
>  		return ERR_CAST(obj);
>  
> -	fb = intel_framebuffer_create(obj, &mode_cmd);
> +	fb = intel_framebuffer_create(obj, info, &mode_cmd);
>  	drm_gem_object_put(obj);
>  
>  	return fb;
> @@ -2343,6 +2344,7 @@ intel_user_framebuffer_create(struct drm_device *dev,
>  
>  struct drm_framebuffer *
>  intel_framebuffer_create(struct drm_gem_object *obj,
> +			 const struct drm_format_info *info,
>  			 struct drm_mode_fb_cmd2 *mode_cmd)
>  {
>  	struct intel_framebuffer *intel_fb;
> @@ -2352,7 +2354,7 @@ intel_framebuffer_create(struct drm_gem_object *obj,
>  	if (!intel_fb)
>  		return ERR_PTR(-ENOMEM);
>  
> -	ret = intel_framebuffer_init(intel_fb, obj, mode_cmd);
> +	ret = intel_framebuffer_init(intel_fb, obj, info, mode_cmd);
>  	if (ret)
>  		goto err;
>  
> diff --git a/drivers/gpu/drm/i915/display/intel_fb.h b/drivers/gpu/drm/i915/display/intel_fb.h
> index 00181c4a67dc..403b8b63721a 100644
> --- a/drivers/gpu/drm/i915/display/intel_fb.h
> +++ b/drivers/gpu/drm/i915/display/intel_fb.h
> @@ -102,9 +102,11 @@ void intel_add_fb_offsets(int *x, int *y,
>  
>  int intel_framebuffer_init(struct intel_framebuffer *ifb,
>  			   struct drm_gem_object *obj,
> +			   const struct drm_format_info *info,
>  			   struct drm_mode_fb_cmd2 *mode_cmd);
>  struct drm_framebuffer *
>  intel_framebuffer_create(struct drm_gem_object *obj,
> +			 const struct drm_format_info *info,
>  			 struct drm_mode_fb_cmd2 *mode_cmd);
>  struct drm_framebuffer *
>  intel_user_framebuffer_create(struct drm_device *dev,
> diff --git a/drivers/gpu/drm/i915/display/intel_fbdev_fb.c b/drivers/gpu/drm/i915/display/intel_fbdev_fb.c
> index 8db3af36b2f2..210aee9ae88b 100644
> --- a/drivers/gpu/drm/i915/display/intel_fbdev_fb.c
> +++ b/drivers/gpu/drm/i915/display/intel_fbdev_fb.c
> @@ -62,7 +62,11 @@ struct intel_framebuffer *intel_fbdev_fb_alloc(struct drm_fb_helper *helper,
>  		return ERR_PTR(-ENOMEM);
>  	}
>  
> -	fb = intel_framebuffer_create(intel_bo_to_drm_bo(obj), &mode_cmd);
> +	fb = intel_framebuffer_create(intel_bo_to_drm_bo(obj),
> +				      drm_get_format_info(display->drm,
> +							  mode_cmd.pixel_format,
> +							  mode_cmd.modifier[0]),
> +				      &mode_cmd);
>  	i915_gem_object_put(obj);
>  
>  	return to_intel_framebuffer(fb);
> diff --git a/drivers/gpu/drm/i915/display/intel_plane_initial.c b/drivers/gpu/drm/i915/display/intel_plane_initial.c
> index 2194d39a5c98..4246173ed311 100644
> --- a/drivers/gpu/drm/i915/display/intel_plane_initial.c
> +++ b/drivers/gpu/drm/i915/display/intel_plane_initial.c
> @@ -289,7 +289,8 @@ intel_alloc_initial_plane_obj(struct intel_crtc *crtc,
>  	mode_cmd.flags = DRM_MODE_FB_MODIFIERS;
>  
>  	if (intel_framebuffer_init(to_intel_framebuffer(fb),
> -				   intel_bo_to_drm_bo(vma->obj), &mode_cmd)) {
> +				   intel_bo_to_drm_bo(vma->obj),
> +				   fb->format, &mode_cmd)) {
>  		drm_dbg_kms(display->drm, "intel fb init failed\n");
>  		goto err_vma;
>  	}
> diff --git a/drivers/gpu/drm/xe/display/intel_fbdev_fb.c b/drivers/gpu/drm/xe/display/intel_fbdev_fb.c
> index b28a94df824f..fba9617a75a5 100644
> --- a/drivers/gpu/drm/xe/display/intel_fbdev_fb.c
> +++ b/drivers/gpu/drm/xe/display/intel_fbdev_fb.c
> @@ -66,7 +66,11 @@ struct intel_framebuffer *intel_fbdev_fb_alloc(struct drm_fb_helper *helper,
>  		goto err;
>  	}
>  
> -	fb = intel_framebuffer_create(&obj->ttm.base, &mode_cmd);
> +	fb = intel_framebuffer_create(&obj->ttm.base,
> +				      drm_get_format_info(dev,
> +							  mode_cmd.pixel_format,
> +							  mode_cmd.modifier[0]),
> +				      &mode_cmd);
>  	if (IS_ERR(fb)) {
>  		xe_bo_unpin_map_no_vm(obj);
>  		goto err;
> diff --git a/drivers/gpu/drm/xe/display/xe_plane_initial.c b/drivers/gpu/drm/xe/display/xe_plane_initial.c
> index b2ede3af9345..dcbc4b2d3fd9 100644
> --- a/drivers/gpu/drm/xe/display/xe_plane_initial.c
> +++ b/drivers/gpu/drm/xe/display/xe_plane_initial.c
> @@ -184,7 +184,7 @@ intel_alloc_initial_plane_obj(struct intel_crtc *crtc,
>  		return false;
>  
>  	if (intel_framebuffer_init(to_intel_framebuffer(fb),
> -				   &bo->ttm.base, &mode_cmd)) {
> +				   &bo->ttm.base, fb->format, &mode_cmd)) {
>  		drm_dbg_kms(&xe->drm, "intel fb init failed\n");
>  		goto err_bo;
>  	}
> -- 
> 2.49.0
> 

  reply	other threads:[~2025-07-15 19:33 UTC|newest]

Thread overview: 40+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-07-01  9:07 [PATCH v2 00/19] drm: Eliminate redundant drm_format_info lookups Ville Syrjala
2025-07-01  9:07 ` [PATCH v2 01/19] drm: Pass pixel_format+modifier to .get_format_info() Ville Syrjala
2025-07-01 18:49   ` Laurent Pinchart
2025-07-01  9:07 ` [PATCH v2 02/19] drm: Pass pixel_format+modifier directly to drm_get_format_info() Ville Syrjala
2025-07-01 16:31   ` Liviu Dudau
2025-07-01  9:07 ` [PATCH v2 03/19] drm: Look up the format info earlier Ville Syrjala
2025-07-01  9:07 ` [PATCH v2 04/19] drm: Pass the format info to .fb_create() Ville Syrjala
2025-07-01  9:07 ` [PATCH v2 05/19] drm: Allow the caller to pass in the format info to drm_helper_mode_fill_fb_struct() Ville Syrjala
2025-07-01 11:05   ` Dmitry Baryshkov
2025-07-01 16:41   ` Liviu Dudau
2025-07-01  9:07 ` [PATCH v2 06/19] drm/malidp: Pass along the format info from .fb_create() malidp_verify_afbc_framebuffer_size() Ville Syrjala
2025-07-01 16:45   ` Liviu Dudau
2025-07-01  9:07 ` [PATCH v2 07/19] drm/gem: Pass along the format info from .fb_create() to drm_helper_mode_fill_fb_struct() Ville Syrjala
2025-07-01 19:20   ` Laurent Pinchart
2025-07-01  9:07 ` [PATCH v2 08/19] drm/gem/afbc: Eliminate redundant drm_get_format_info() Ville Syrjala
2025-07-01  9:07 ` [PATCH v2 09/19] drm/amdgpu: Pass along the format info from .fb_create() to drm_helper_mode_fill_fb_struct() Ville Syrjala
2025-07-15 18:25   ` Deucher, Alexander
2025-07-01  9:07 ` [PATCH v2 10/19] drm/armada: " Ville Syrjala
2025-07-01  9:07 ` [PATCH v2 11/19] drm/exynos: " Ville Syrjala
2025-07-01  9:07 ` [PATCH v2 12/19] drm/gma500: " Ville Syrjala
2025-07-02  5:28   ` Patrik Jakobsson
2025-07-01  9:07 ` [PATCH v2 13/19] drm/i915: " Ville Syrjala
2025-07-15 19:32   ` Rodrigo Vivi [this message]
2025-07-01  9:07 ` [PATCH v2 14/19] drm/komeda: " Ville Syrjala
2025-07-01 16:46   ` Liviu Dudau
2025-07-01  9:07 ` [PATCH v2 15/19] drm/msm: " Ville Syrjala
2025-07-01  9:07 ` [PATCH v2 16/19] drm/tegra: " Ville Syrjala
2025-07-01  9:07 ` [PATCH v2 17/19] drm/virtio: " Ville Syrjala
2025-07-01  9:07 ` [PATCH v2 18/19] drm/vmwgfx: " Ville Syrjala
2025-07-01  9:07 ` [PATCH v2 19/19] drm: Make passing of format info to drm_helper_mode_fill_fb_struct() mandatory Ville Syrjala
2025-07-22 13:41   ` Mark Brown
2025-07-25 13:36     ` Mark Brown
2025-07-25 14:23       ` Imre Deak
2025-07-25 17:52         ` Mark Brown
2025-07-28 10:22           ` Imre Deak
2025-08-12 21:33             ` Timur Tabi
2025-08-13  8:05               ` Imre Deak
2025-08-13 19:25                 ` Timur Tabi
2025-07-01 11:41 ` ✗ i915.CI.BAT: failure for drm: Eliminate redundant drm_format_info lookups (rev7) Patchwork
2025-07-16 18:22 ` [PATCH v2 00/19] drm: Eliminate redundant drm_format_info lookups Ville Syrjälä

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=aHas01eFBQzs4eGE@intel.com \
    --to=rodrigo.vivi@intel.com \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=intel-gfx@lists.freedesktop.org \
    --cc=intel-xe@lists.freedesktop.org \
    --cc=tzimmermann@suse.de \
    --cc=ville.syrjala@linux.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).