drm/xe/fbdev: Extract intel_fbdev_fb_prefer_stolen()

Pull the "should we keep the bios fb in stolen?" logic into
into a helper function, same as was done for i915. Gives us
a single place where to tweak the heuristics.

v2: changes related to rebase and consolidated other conditions
    for the stolen preference into this single function (Vinod)

v3: avoid including intel_display_core.h (Jani Nikula)

Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Signed-off-by: Vinod Govindapillai <vinod.govindapillai@intel.com>
Reviewed-by: Uma Shankar <uma.shankar@intel.com>
Acked-by: Mika Kahola <mika.kahola@intel.com>
Link: https://patch.msgid.link/20260220170908.201422-5-vinod.govindapillai@intel.com
This commit is contained in:
Ville Syrjälä 2026-02-20 19:09:06 +02:00 committed by Vinod Govindapillai
parent 94c7d28612
commit 27c56f73c3
2 changed files with 26 additions and 10 deletions

View File

@ -23,6 +23,29 @@ u32 intel_fbdev_fb_pitch_align(u32 stride)
return ALIGN(stride, XE_PAGE_SIZE);
}
bool intel_fbdev_fb_prefer_stolen(struct drm_device *drm, unsigned int size)
{
struct xe_device *xe = to_xe_device(drm);
struct ttm_resource_manager *stolen;
stolen = ttm_manager_type(&xe->ttm, XE_PL_STOLEN);
if (!stolen)
return false;
if (IS_DGFX(xe))
return false;
if (XE_DEVICE_WA(xe, 22019338487_display))
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;
}
struct drm_gem_object *intel_fbdev_fb_bo_create(struct drm_device *drm, int size)
{
struct xe_device *xe = to_xe_device(drm);
@ -30,7 +53,7 @@ struct drm_gem_object *intel_fbdev_fb_bo_create(struct drm_device *drm, int size
obj = ERR_PTR(-ENODEV);
if (!IS_DGFX(xe) && !XE_DEVICE_WA(xe, 22019338487_display)) {
if (intel_fbdev_fb_prefer_stolen(drm, size)) {
obj = xe_bo_create_pin_map_novm(xe, xe_device_get_root_tile(xe),
size,
ttm_bo_type_kernel, XE_BO_FLAG_SCANOUT |

View File

@ -17,6 +17,7 @@
#include "intel_display_regs.h"
#include "intel_display_types.h"
#include "intel_fb.h"
#include "intel_fbdev_fb.h"
#include "intel_fb_pin.h"
#include "xe_bo.h"
#include "xe_vram_types.h"
@ -90,16 +91,8 @@ initial_plane_bo(struct xe_device *xe,
phys_base = base;
flags |= XE_BO_FLAG_STOLEN;
if (XE_DEVICE_WA(xe, 22019338487_display))
return NULL;
/*
* 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.
*/
if (IS_ENABLED(CONFIG_FRAMEBUFFER_CONSOLE) &&
plane_config->size * 2 > stolen->size)
!intel_fbdev_fb_prefer_stolen(&xe->drm, plane_config->size))
return NULL;
}