diff mbox series

[20/20] drm/xe/fbdev: Adjust fbdev stolen mem usage heuristic

Message ID 20240705145254.3355-21-ville.syrjala@linux.intel.com (mailing list archive)
State New, archived
Headers show
Series drm/{i915, xe}: FBC cleanups + tweak fbdev stolen usage | expand

Commit Message

Ville Syrjälä July 5, 2024, 2:52 p.m. UTC
From: Ville Syrjälä <ville.syrjala@linux.intel.com>

Replace the "1/2 of stolen size" fbdev fb size heuristic with
something a bit more clever, that is ask the FBC code how much
stolen mem it would like to have avaialable for its CFB use.

TODO:
- This doesn't account for the fact that FBC's idea
  usable stolen size might differ from other users of stolen
- Would be nice to share the code with i915, but need to
  figure out how to abstract the stolen size and
  dgpu/lmem stuff

Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
---
 drivers/gpu/drm/xe/display/intel_fbdev_fb.c | 11 +++++------
 1 file changed, 5 insertions(+), 6 deletions(-)

Comments

Shankar, Uma July 10, 2024, 9:12 a.m. UTC | #1
> -----Original Message-----
> From: Intel-xe <intel-xe-bounces@lists.freedesktop.org> On Behalf Of Ville Syrjala
> Sent: Friday, July 5, 2024 8:23 PM
> To: intel-gfx@lists.freedesktop.org
> Cc: intel-xe@lists.freedesktop.org
> Subject: [PATCH 20/20] drm/xe/fbdev: Adjust fbdev stolen mem usage heuristic
> 
> From: Ville Syrjälä <ville.syrjala@linux.intel.com>
> 
> Replace the "1/2 of stolen size" fbdev fb size heuristic with something a bit more
> clever, that is ask the FBC code how much stolen mem it would like to have
> avaialable for its CFB use.

Looks Good to me.
Reviewed-by: Uma Shankar <uma.shankar@intel.com>

> TODO:
> - This doesn't account for the fact that FBC's idea
>   usable stolen size might differ from other users of stolen
> - Would be nice to share the code with i915, but need to
>   figure out how to abstract the stolen size and
>   dgpu/lmem stuff
> 
> Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
> ---
>  drivers/gpu/drm/xe/display/intel_fbdev_fb.c | 11 +++++------
>  1 file changed, 5 insertions(+), 6 deletions(-)
> 
> diff --git a/drivers/gpu/drm/xe/display/intel_fbdev_fb.c
> b/drivers/gpu/drm/xe/display/intel_fbdev_fb.c
> index f67bc0fd803b..62e1d176b07f 100644
> --- a/drivers/gpu/drm/xe/display/intel_fbdev_fb.c
> +++ b/drivers/gpu/drm/xe/display/intel_fbdev_fb.c
> @@ -24,12 +24,11 @@ bool intel_fbdev_fb_prefer_stolen(struct intel_display
> *display,
>  	if (!stolen)
>  		return false;
> 
> -	/*
> -	 * If the FB is too big, just don't use it since fbdev is not very
> -	 * important and we should probably use that space with FBC or other
> -	 * features.
> -	 */
> -	return stolen->size >= size * 2;
> +	if (size > stolen->size)
> +		return false;
> +
> +	/* try to ensure FBC has enough stolen to do its job well */
> +	return stolen->size - size >=
> +intel_fbc_preferred_cfb_size(&xe->display);
>  }
> 
>  struct intel_framebuffer *intel_fbdev_fb_alloc(struct drm_fb_helper *helper,
> --
> 2.44.2
diff mbox series

Patch

diff --git a/drivers/gpu/drm/xe/display/intel_fbdev_fb.c b/drivers/gpu/drm/xe/display/intel_fbdev_fb.c
index f67bc0fd803b..62e1d176b07f 100644
--- a/drivers/gpu/drm/xe/display/intel_fbdev_fb.c
+++ b/drivers/gpu/drm/xe/display/intel_fbdev_fb.c
@@ -24,12 +24,11 @@  bool intel_fbdev_fb_prefer_stolen(struct intel_display *display,
 	if (!stolen)
 		return false;
 
-	/*
-	 * If the FB is too big, just don't use it since fbdev is not very
-	 * important and we should probably use that space with FBC or other
-	 * features.
-	 */
-	return stolen->size >= size * 2;
+	if (size > stolen->size)
+		return false;
+
+	/* try to ensure FBC has enough stolen to do its job well */
+	return stolen->size - size >= intel_fbc_preferred_cfb_size(&xe->display);
 }
 
 struct intel_framebuffer *intel_fbdev_fb_alloc(struct drm_fb_helper *helper,