From: Ville Syrjälä <ville.syrjala@xxxxxxxxxxxxxxx> 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@xxxxxxxxxxxxxxx> --- 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