[PATCH 19/20] drm/i915/fbdev: Adjust fbdev stolen mem usage heuristic
Ville Syrjala
ville.syrjala at linux.intel.com
Fri Jul 5 14:52:53 UTC 2024
From: Ville Syrjälä <ville.syrjala at 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 xe, but need to
figure out how to abstract the stolen size and
dgpu/lmem stuff
Signed-off-by: Ville Syrjälä <ville.syrjala at linux.intel.com>
---
drivers/gpu/drm/i915/display/intel_fbdev_fb.c | 11 +++++------
1 file changed, 5 insertions(+), 6 deletions(-)
diff --git a/drivers/gpu/drm/i915/display/intel_fbdev_fb.c b/drivers/gpu/drm/i915/display/intel_fbdev_fb.c
index 0a6445acb100..29f3241c9270 100644
--- a/drivers/gpu/drm/i915/display/intel_fbdev_fb.c
+++ b/drivers/gpu/drm/i915/display/intel_fbdev_fb.c
@@ -16,12 +16,11 @@ bool intel_fbdev_fb_prefer_stolen(struct intel_display *display,
{
struct drm_i915_private *i915 = to_i915(display->drm);
- /*
- * 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 i915->dsm.usable_size >= size * 2;
+ if (size > i915->dsm.usable_size)
+ return false;
+
+ /* try to ensure FBC has enough stolen to do its job well */
+ return i915->dsm.usable_size - size >= intel_fbc_preferred_cfb_size(&i915->display);
}
struct intel_framebuffer *intel_fbdev_fb_alloc(struct drm_fb_helper *helper,
--
2.44.2
More information about the Intel-gfx
mailing list