intel-xe.lists.freedesktop.org archive mirror
 help / color / mirror / Atom feed
From: "Ville Syrjälä" <ville.syrjala@linux.intel.com>
To: Rodrigo Vivi <rodrigo.vivi@intel.com>
Cc: intel-gfx@lists.freedesktop.org, intel-xe@lists.freedesktop.org
Subject: Re: [PATCH 02/20] drm/i915/fbc: Convert to intel_display, mostly
Date: Sat, 13 Jul 2024 00:38:49 +0300	[thread overview]
Message-ID: <ZpGiabxR0UkAKJv2@intel.com> (raw)
In-Reply-To: <Zo2USSCXVDDOqCvH@intel.com>

On Tue, Jul 09, 2024 at 03:49:29PM -0400, Rodrigo Vivi wrote:
> On Fri, Jul 05, 2024 at 05:52:36PM +0300, Ville Syrjala wrote:
> > From: Ville Syrjälä <ville.syrjala@linux.intel.com>
> > 
> > Switch the FBC code over to intel_display from i915, as
> > much as possible. This is the future direction so that
> > the display code can be shared between i915 and xe more
> > cleanly.
> > 
> > Some of the platform checks and the stolen mem facing stiff
> > still need i915 around though.
> > 
> > Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
> > ---
> >  .../drm/i915/display/intel_display_debugfs.c  |   4 +-
> >  .../drm/i915/display/intel_display_driver.c   |   4 +-
> >  drivers/gpu/drm/i915/display/intel_fbc.c      | 422 ++++++++++--------
> >  drivers/gpu/drm/i915/display/intel_fbc.h      |  13 +-
> >  .../drm/i915/display/intel_fifo_underrun.c    |   2 +-
> >  .../drm/i915/display/intel_modeset_setup.c    |   2 +-
> >  6 files changed, 239 insertions(+), 208 deletions(-)
> > 
> > diff --git a/drivers/gpu/drm/i915/display/intel_display_debugfs.c b/drivers/gpu/drm/i915/display/intel_display_debugfs.c
> > index 91757fed9c6d..5cf9b4af9adf 100644
> > --- a/drivers/gpu/drm/i915/display/intel_display_debugfs.c
> > +++ b/drivers/gpu/drm/i915/display/intel_display_debugfs.c
> > @@ -1008,7 +1008,7 @@ i915_fifo_underrun_reset_write(struct file *filp,
> >  			return ret;
> >  	}
> >  
> > -	intel_fbc_reset_underrun(dev_priv);
> > +	intel_fbc_reset_underrun(&dev_priv->display);
> >  
> >  	return cnt;
> >  }
> > @@ -1063,7 +1063,7 @@ void intel_display_debugfs_register(struct drm_i915_private *i915)
> >  	intel_bios_debugfs_register(i915);
> >  	intel_cdclk_debugfs_register(i915);
> >  	intel_dmc_debugfs_register(i915);
> > -	intel_fbc_debugfs_register(i915);
> > +	intel_fbc_debugfs_register(&i915->display);
> >  	intel_hpd_debugfs_register(i915);
> >  	intel_opregion_debugfs_register(i915);
> >  	intel_psr_debugfs_register(i915);
> > diff --git a/drivers/gpu/drm/i915/display/intel_display_driver.c b/drivers/gpu/drm/i915/display/intel_display_driver.c
> > index 794b4af38055..13e206ec450f 100644
> > --- a/drivers/gpu/drm/i915/display/intel_display_driver.c
> > +++ b/drivers/gpu/drm/i915/display/intel_display_driver.c
> > @@ -265,7 +265,7 @@ int intel_display_driver_probe_noirq(struct drm_i915_private *i915)
> >  
> >  	intel_init_quirks(display);
> >  
> > -	intel_fbc_init(i915);
> > +	intel_fbc_init(display);
> >  
> >  	return 0;
> >  
> > @@ -607,7 +607,7 @@ void intel_display_driver_remove_noirq(struct drm_i915_private *i915)
> >  	destroy_workqueue(i915->display.wq.flip);
> >  	destroy_workqueue(i915->display.wq.modeset);
> >  
> > -	intel_fbc_cleanup(i915);
> > +	intel_fbc_cleanup(&i915->display);
> >  }
> >  
> >  /* part #3: call after gem init */
> > diff --git a/drivers/gpu/drm/i915/display/intel_fbc.c b/drivers/gpu/drm/i915/display/intel_fbc.c
> > index ba9820d4b78f..de8caa69a0dd 100644
> > --- a/drivers/gpu/drm/i915/display/intel_fbc.c
> > +++ b/drivers/gpu/drm/i915/display/intel_fbc.c
> > @@ -61,13 +61,13 @@
> >  #include "intel_fbc_regs.h"
> >  #include "intel_frontbuffer.h"
> >  
> > -#define for_each_fbc_id(__dev_priv, __fbc_id) \
> > +#define for_each_fbc_id(__display, __fbc_id) \
> >  	for ((__fbc_id) = INTEL_FBC_A; (__fbc_id) < I915_MAX_FBCS; (__fbc_id)++) \
> > -		for_each_if(DISPLAY_RUNTIME_INFO(__dev_priv)->fbc_mask & BIT(__fbc_id))
> > +		for_each_if(DISPLAY_RUNTIME_INFO(__display)->fbc_mask & BIT(__fbc_id))
> >  
> > -#define for_each_intel_fbc(__dev_priv, __fbc, __fbc_id) \
> > -	for_each_fbc_id((__dev_priv), (__fbc_id)) \
> > -		for_each_if((__fbc) = (__dev_priv)->display.fbc[(__fbc_id)])
> > +#define for_each_intel_fbc(__display, __fbc, __fbc_id) \
> > +	for_each_fbc_id((__display), (__fbc_id)) \
> > +		for_each_if((__fbc) = (__display)->fbc[(__fbc_id)])
> >  
> >  struct intel_fbc_funcs {
> >  	void (*activate)(struct intel_fbc *fbc);
> > @@ -90,7 +90,7 @@ struct intel_fbc_state {
> >  };
> >  
> >  struct intel_fbc {
> > -	struct drm_i915_private *i915;
> > +	struct intel_display *display;
> >  	const struct intel_fbc_funcs *funcs;
> >  
> >  	/*
> > @@ -151,7 +151,7 @@ static unsigned int _intel_fbc_cfb_stride(const struct intel_plane_state *plane_
> >  /* minimum acceptable cfb stride in bytes, assuming 1:1 compression limit */
> >  static unsigned int skl_fbc_min_cfb_stride(const struct intel_plane_state *plane_state)
> >  {
> > -	struct drm_i915_private *i915 = to_i915(plane_state->uapi.plane->dev);
> > +	struct intel_display *display = to_intel_display(plane_state->uapi.plane->dev);
> >  	unsigned int limit = 4; /* 1:4 compression limit is the worst case */
> >  	unsigned int cpp = 4; /* FBC always 4 bytes per pixel */
> >  	unsigned int width = drm_rect_width(&plane_state->uapi.src) >> 16;
> > @@ -165,7 +165,7 @@ static unsigned int skl_fbc_min_cfb_stride(const struct intel_plane_state *plane
> >  	 * Wa_16011863758: icl+
> >  	 * Avoid some hardware segment address miscalculation.
> >  	 */
> > -	if (DISPLAY_VER(i915) >= 11)
> > +	if (DISPLAY_VER(display) >= 11)
> >  		stride += 64;
> >  
> >  	/*
> > @@ -181,7 +181,7 @@ static unsigned int skl_fbc_min_cfb_stride(const struct intel_plane_state *plane
> >  /* properly aligned cfb stride in bytes, assuming 1:1 compression limit */
> >  static unsigned int intel_fbc_cfb_stride(const struct intel_plane_state *plane_state)
> >  {
> > -	struct drm_i915_private *i915 = to_i915(plane_state->uapi.plane->dev);
> > +	struct intel_display *display = to_intel_display(plane_state->uapi.plane->dev);
> >  	unsigned int stride = _intel_fbc_cfb_stride(plane_state);
> >  
> >  	/*
> > @@ -189,7 +189,7 @@ static unsigned int intel_fbc_cfb_stride(const struct intel_plane_state *plane_s
> >  	 * be 512 byte aligned. Aligning each line to 512 bytes guarantees
> >  	 * that regardless of the compression limit we choose later.
> >  	 */
> > -	if (DISPLAY_VER(i915) >= 9)
> > +	if (DISPLAY_VER(display) >= 9)
> >  		return max(ALIGN(stride, 512), skl_fbc_min_cfb_stride(plane_state));
> >  	else
> >  		return stride;
> > @@ -197,12 +197,12 @@ static unsigned int intel_fbc_cfb_stride(const struct intel_plane_state *plane_s
> >  
> >  static unsigned int intel_fbc_cfb_size(const struct intel_plane_state *plane_state)
> >  {
> > -	struct drm_i915_private *i915 = to_i915(plane_state->uapi.plane->dev);
> > +	struct intel_display *display = to_intel_display(plane_state->uapi.plane->dev);
> >  	int lines = drm_rect_height(&plane_state->uapi.src) >> 16;
> >  
> > -	if (DISPLAY_VER(i915) == 7)
> > +	if (DISPLAY_VER(display) == 7)
> >  		lines = min(lines, 2048);
> > -	else if (DISPLAY_VER(i915) >= 8)
> > +	else if (DISPLAY_VER(display) >= 8)
> >  		lines = min(lines, 2560);
> >  
> >  	return lines * intel_fbc_cfb_stride(plane_state);
> > @@ -210,7 +210,7 @@ static unsigned int intel_fbc_cfb_size(const struct intel_plane_state *plane_sta
> >  
> >  static u16 intel_fbc_override_cfb_stride(const struct intel_plane_state *plane_state)
> >  {
> > -	struct drm_i915_private *i915 = to_i915(plane_state->uapi.plane->dev);
> > +	struct intel_display *display = to_intel_display(plane_state->uapi.plane->dev);
> >  	unsigned int stride_aligned = intel_fbc_cfb_stride(plane_state);
> >  	unsigned int stride = _intel_fbc_cfb_stride(plane_state);
> >  	const struct drm_framebuffer *fb = plane_state->hw.fb;
> > @@ -223,28 +223,31 @@ static u16 intel_fbc_override_cfb_stride(const struct intel_plane_state *plane_s
> >  	 * we always need to use the override there.
> >  	 */
> >  	if (stride != stride_aligned ||
> > -	    (DISPLAY_VER(i915) == 9 && fb->modifier == DRM_FORMAT_MOD_LINEAR))
> > +	    (DISPLAY_VER(display) == 9 && fb->modifier == DRM_FORMAT_MOD_LINEAR))
> >  		return stride_aligned * 4 / 64;
> >  
> >  	return 0;
> >  }
> >  
> > -static bool intel_fbc_has_fences(struct drm_i915_private *i915)
> > +static bool intel_fbc_has_fences(struct intel_display *display)
> >  {
> > +	struct drm_i915_private __maybe_unused *i915 = to_i915(display->drm);
> 
> I was going to ask why __maybe_unused,
> but then I remember about the xe compat-headers where below function is
> defined to 0...

Yaeh this one is needed.


 >  
> > -static u64 intel_fbc_stolen_end(struct drm_i915_private *i915)
> > +static u64 intel_fbc_stolen_end(struct intel_display *display)
> >  {
> > +	struct drm_i915_private __maybe_unused *i915 = to_i915(display->drm);

This one was only needed because I accidentally used to_i915() below
instead of using the local i915 variable. I adjusted this while pushing.

-- 
Ville Syrjälä
Intel

  reply	other threads:[~2024-07-12 21:38 UTC|newest]

Thread overview: 55+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-07-05 14:52 [PATCH 00/20] drm/{i915, xe}: FBC cleanups + tweak fbdev stolen usage Ville Syrjala
2024-07-05 14:52 ` [PATCH 01/20] drm/i915/fbc: Extract intel_fbc_has_fences() Ville Syrjala
2024-07-09 19:46   ` Rodrigo Vivi
2024-07-05 14:52 ` [PATCH 02/20] drm/i915/fbc: Convert to intel_display, mostly Ville Syrjala
2024-07-09 19:49   ` Rodrigo Vivi
2024-07-12 21:38     ` Ville Syrjälä [this message]
2024-07-05 14:52 ` [PATCH 03/20] drm/i915/fbc: s/_intel_fbc_cfb_stride()/intel_fbc_plane_cfb_stride()/ Ville Syrjala
2024-07-09 19:50   ` Rodrigo Vivi
2024-07-05 14:52 ` [PATCH 04/20] drm/i915/fbc: Extract intel_fbc_max_plane_size() Ville Syrjala
2024-07-09 19:51   ` Rodrigo Vivi
2024-07-05 14:52 ` [PATCH 05/20] drm/i915/fbc: Extract intel_fbc_max_surface_size() Ville Syrjala
2024-07-09 19:51   ` Rodrigo Vivi
2024-07-05 14:52 ` [PATCH 06/20] drm/i915/fbc: s/intel_fbc_hw_tracking_covers_screen()/intel_fbc_surface_size_ok()/ Ville Syrjala
2024-07-09 19:52   ` Rodrigo Vivi
2024-07-05 14:52 ` [PATCH 07/20] drm/i915/fbc: Adjust g4x+ platform checks Ville Syrjala
2024-07-09 19:54   ` Rodrigo Vivi
2024-07-05 14:52 ` [PATCH 08/20] drm/i915/fbc: Extract _intel_fbc_cfb_stride() Ville Syrjala
2024-07-10  8:01   ` Shankar, Uma
2024-07-05 14:52 ` [PATCH 09/20] drm/i915/fbc: s/lines/height/ Ville Syrjala
2024-07-09 20:00   ` Rodrigo Vivi
2024-07-05 14:52 ` [PATCH 10/20] drm/i915/fbc: Reoder CFB max height platform checks Ville Syrjala
2024-07-09 20:00   ` Rodrigo Vivi
2024-07-05 14:52 ` [PATCH 11/20] drm/i915/fbc: Extract intel_fbc_max_cfb_height() Ville Syrjala
2024-07-10  8:26   ` Shankar, Uma
2024-07-12 21:34     ` Ville Syrjälä
2024-07-05 14:52 ` [PATCH 12/20] drm/i915/fbc: Extract _intel_fbc_cfb_size() Ville Syrjala
2024-07-10  8:28   ` Shankar, Uma
2024-07-05 14:52 ` [PATCH 13/20] drm/i915/fbc: Extract intel_fbc_cfb_cpp() Ville Syrjala
2024-07-10  8:30   ` Shankar, Uma
2024-07-05 14:52 ` [PATCH 14/20] drm/i915/fbc: Introduce intel_fbc_preferred_cfb_size() Ville Syrjala
2024-07-10  8:36   ` Shankar, Uma
2024-07-05 14:52 ` [PATCH 15/20] drm/xe/fbdev: Fix BIOS FB vs.s stolen size checke Ville Syrjala
2024-07-10  8:42   ` Shankar, Uma
2024-07-05 14:52 ` [PATCH 16/20] drm/i915/fbdev: Extract intel_fbdev_fb_prefer_stolen() Ville Syrjala
2024-07-06 12:06   ` kernel test robot
2024-07-09 20:28   ` Lucas De Marchi
2024-07-10 11:47     ` Ville Syrjälä
2024-07-10  8:51   ` Shankar, Uma
2024-07-05 14:52 ` [PATCH 17/20] drm/xe/fbdev: " Ville Syrjala
2024-07-10  8:58   ` Shankar, Uma
2024-07-05 14:52 ` [PATCH 18/20] drm/xe/fbdev: Use the same logic for fbdev stolen takever and fresh allocation Ville Syrjala
2024-07-10  9:08   ` Shankar, Uma
2024-07-05 14:52 ` [PATCH 19/20] drm/i915/fbdev: Adjust fbdev stolen mem usage heuristic Ville Syrjala
2024-07-10  9:11   ` Shankar, Uma
2024-07-05 14:52 ` [PATCH 20/20] drm/xe/fbdev: " Ville Syrjala
2024-07-10  9:12   ` Shankar, Uma
2024-07-05 14:58 ` ✓ CI.Patch_applied: success for drm/{i915, xe}: FBC cleanups + tweak fbdev stolen usage Patchwork
2024-07-05 14:58 ` ✗ CI.checkpatch: warning " Patchwork
2024-07-05 15:00 ` ✓ CI.KUnit: success " Patchwork
2024-07-05 15:12 ` ✓ CI.Build: " Patchwork
2024-07-05 15:14 ` ✓ CI.Hooks: " Patchwork
2024-07-05 15:15 ` ✗ CI.checksparse: warning " Patchwork
2024-07-05 15:38 ` ✓ CI.BAT: success " Patchwork
2024-07-05 17:43 ` ✗ CI.FULL: failure " Patchwork
2024-07-12 21:39 ` [PATCH 00/20] drm/{i915,xe}: " 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=ZpGiabxR0UkAKJv2@intel.com \
    --to=ville.syrjala@linux.intel.com \
    --cc=intel-gfx@lists.freedesktop.org \
    --cc=intel-xe@lists.freedesktop.org \
    --cc=rodrigo.vivi@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).