intel-gfx.lists.freedesktop.org archive mirror
 help / color / mirror / Atom feed
From: "Hogander, Jouni" <jouni.hogander@intel.com>
To: "ville.syrjala@linux.intel.com" <ville.syrjala@linux.intel.com>,
	"dri-devel@lists.freedesktop.org"
	<dri-devel@lists.freedesktop.org>
Cc: "intel-xe@lists.freedesktop.org" <intel-xe@lists.freedesktop.org>,
	"intel-gfx@lists.freedesktop.org"
	<intel-gfx@lists.freedesktop.org>
Subject: Re: [PATCH 3/3] drm/i915: Eliminate one more frequent drm_format_info()
Date: Thu, 27 Nov 2025 07:27:57 +0000	[thread overview]
Message-ID: <9ad4b4b01128cfedb5db6fad0d7f54377b56f73b.camel@intel.com> (raw)
In-Reply-To: <20251112233030.24117-4-ville.syrjala@linux.intel.com>

On Thu, 2025-11-13 at 01:30 +0200, Ville Syrjala wrote:
> From: Ville Syrjälä <ville.syrjala@linux.intel.com>
> 
> Another (somewhat expensive) drm_format_info() call has
> appeared in intel_plane_can_async_flip(). That one may get
> called several times per commit so we need to get rid of
> it.
> 
> Fortunately most callers already have the framebuffer at
> hand, so we can just grab the format info from there.
> The one exception is intel_plane_format_mod_supported_async()
> where we have to do the lookup. But that only gets called
> (a bunch of times) during driver init to build the
> IN_FORMATS_ASYNC blob, and afterwards there is no runtime
> cost.
> 
> Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>

Reviewed-by: Jouni Högander <jouni.hogander@intel.com>

> ---
>  drivers/gpu/drm/i915/display/i9xx_plane.c     |  4 ++--
>  drivers/gpu/drm/i915/display/intel_display.c  |  2 +-
>  drivers/gpu/drm/i915/display/intel_plane.c    | 22 +++++++++++------
> --
>  drivers/gpu/drm/i915/display/intel_plane.h    |  4 +++-
>  .../drm/i915/display/skl_universal_plane.c    |  2 +-
>  5 files changed, 20 insertions(+), 14 deletions(-)
> 
> diff --git a/drivers/gpu/drm/i915/display/i9xx_plane.c
> b/drivers/gpu/drm/i915/display/i9xx_plane.c
> index 51ccc6bd5f21..b93c86197b4a 100644
> --- a/drivers/gpu/drm/i915/display/i9xx_plane.c
> +++ b/drivers/gpu/drm/i915/display/i9xx_plane.c
> @@ -819,7 +819,7 @@ unsigned int vlv_plane_min_alignment(struct
> intel_plane *plane,
>  {
>  	struct intel_display *display = to_intel_display(plane);
>  
> -	if (intel_plane_can_async_flip(plane, fb->format->format,
> fb->modifier))
> +	if (intel_plane_can_async_flip(plane, fb->format, fb-
> >modifier))
>  		return 256 * 1024;
>  
>  	/* FIXME undocumented so not sure what's actually needed */
> @@ -843,7 +843,7 @@ static unsigned int
> g4x_primary_min_alignment(struct intel_plane *plane,
>  {
>  	struct intel_display *display = to_intel_display(plane);
>  
> -	if (intel_plane_can_async_flip(plane, fb->format->format,
> fb->modifier))
> +	if (intel_plane_can_async_flip(plane, fb->format, fb-
> >modifier))
>  		return 256 * 1024;
>  
>  	if (intel_scanout_needs_vtd_wa(display))
> diff --git a/drivers/gpu/drm/i915/display/intel_display.c
> b/drivers/gpu/drm/i915/display/intel_display.c
> index 069967114bd9..71bd8484885b 100644
> --- a/drivers/gpu/drm/i915/display/intel_display.c
> +++ b/drivers/gpu/drm/i915/display/intel_display.c
> @@ -6122,7 +6122,7 @@ static int intel_async_flip_check_hw(struct
> intel_atomic_state *state, struct in
>  		if (!plane->async_flip)
>  			continue;
>  
> -		if (!intel_plane_can_async_flip(plane,
> new_plane_state->hw.fb->format->format,
> +		if (!intel_plane_can_async_flip(plane,
> new_plane_state->hw.fb->format,
>  						new_plane_state-
> >hw.fb->modifier)) {
>  			drm_dbg_kms(display->drm,
>  				    "[PLANE:%d:%s] pixel format
> %p4cc / modifier 0x%llx does not support async flip\n",
> diff --git a/drivers/gpu/drm/i915/display/intel_plane.c
> b/drivers/gpu/drm/i915/display/intel_plane.c
> index 5105e3278bc4..ee9cda94a7c9 100644
> --- a/drivers/gpu/drm/i915/display/intel_plane.c
> +++ b/drivers/gpu/drm/i915/display/intel_plane.c
> @@ -178,25 +178,29 @@ bool intel_plane_needs_physical(struct
> intel_plane *plane)
>  		DISPLAY_INFO(display)->cursor_needs_physical;
>  }
>  
> -bool intel_plane_can_async_flip(struct intel_plane *plane, u32
> format,
> +bool intel_plane_can_async_flip(struct intel_plane *plane,
> +				const struct drm_format_info *info,
>  				u64 modifier)
>  {
> -	if
> (intel_format_info_is_yuv_semiplanar(drm_format_info(format),
> modifier) ||
> -	    format == DRM_FORMAT_C8)
> +	if (intel_format_info_is_yuv_semiplanar(info, modifier) ||
> +	    info->format == DRM_FORMAT_C8)
>  		return false;
>  
>  	return plane->can_async_flip && plane-
> >can_async_flip(modifier);
>  }
>  
> -bool intel_plane_format_mod_supported_async(struct drm_plane *plane,
> -					    u32 format,
> -					    u64 modifier)
> +bool intel_plane_format_mod_supported_async(struct drm_plane
> *_plane,
> +					    u32 format, u64
> modifier)
>  {
> -	if (!plane->funcs->format_mod_supported(plane, format,
> modifier))
> +	struct intel_plane *plane = to_intel_plane(_plane);
> +	const struct drm_format_info *info;
> +
> +	if (!plane->base.funcs->format_mod_supported(&plane->base,
> format, modifier))
>  		return false;
>  
> -	return intel_plane_can_async_flip(to_intel_plane(plane),
> -					format, modifier);
> +	info = drm_get_format_info(plane->base.dev, format,
> modifier);
> +
> +	return intel_plane_can_async_flip(plane, info, modifier);
>  }
>  
>  unsigned int intel_adjusted_rate(const struct drm_rect *src,
> diff --git a/drivers/gpu/drm/i915/display/intel_plane.h
> b/drivers/gpu/drm/i915/display/intel_plane.h
> index 4e99df9de3e8..5a8f2f3baab5 100644
> --- a/drivers/gpu/drm/i915/display/intel_plane.h
> +++ b/drivers/gpu/drm/i915/display/intel_plane.h
> @@ -8,6 +8,7 @@
>  
>  #include <linux/types.h>
>  
> +struct drm_format_info;
>  struct drm_plane;
>  struct drm_property;
>  struct drm_rect;
> @@ -21,7 +22,8 @@ enum plane_id;
>  
>  struct intel_plane *
>  intel_crtc_get_plane(struct intel_crtc *crtc, enum plane_id
> plane_id);
> -bool intel_plane_can_async_flip(struct intel_plane *plane, u32
> format,
> +bool intel_plane_can_async_flip(struct intel_plane *plane,
> +				const struct drm_format_info *info,
>  				u64 modifier);
>  unsigned int intel_adjusted_rate(const struct drm_rect *src,
>  				 const struct drm_rect *dst,
> diff --git a/drivers/gpu/drm/i915/display/skl_universal_plane.c
> b/drivers/gpu/drm/i915/display/skl_universal_plane.c
> index 89c8003ccfe7..921b2f73d27a 100644
> --- a/drivers/gpu/drm/i915/display/skl_universal_plane.c
> +++ b/drivers/gpu/drm/i915/display/skl_universal_plane.c
> @@ -595,7 +595,7 @@ static u32 tgl_plane_min_alignment(struct
> intel_plane *plane,
>  	 * Figure out what's going on here...
>  	 */
>  	if (display->platform.alderlake_p &&
> -	    intel_plane_can_async_flip(plane, fb->format->format,
> fb->modifier))
> +	    intel_plane_can_async_flip(plane, fb->format, fb-
> >modifier))
>  		return mult * 16 * 1024;
>  
>  	switch (fb->modifier) {


  reply	other threads:[~2025-11-27  7:28 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-11-12 23:30 [PATCH 0/3] drm/i915: Async flip stuff Ville Syrjala
2025-11-12 23:30 ` [PATCH 1/3] drm/plane: Fix create_in_format_blob() return value Ville Syrjala
2025-11-13  3:43   ` Murthy, Arun R
2025-11-12 23:30 ` [PATCH 2/3] drm/i915: Expose the IN_FORMATS_ASYNC blob for all planes Ville Syrjala
2025-11-27  7:26   ` Hogander, Jouni
2025-11-12 23:30 ` [PATCH 3/3] drm/i915: Eliminate one more frequent drm_format_info() Ville Syrjala
2025-11-27  7:27   ` Hogander, Jouni [this message]
2025-11-13  0:37 ` ✓ i915.CI.BAT: success for drm/i915: Async flip stuff Patchwork
2025-11-13  4:39 ` ✗ i915.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=9ad4b4b01128cfedb5db6fad0d7f54377b56f73b.camel@intel.com \
    --to=jouni.hogander@intel.com \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=intel-gfx@lists.freedesktop.org \
    --cc=intel-xe@lists.freedesktop.org \
    --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).