summaryrefslogtreecommitdiff
path: root/drivers/gpu/drm/xe/display/intel_fbdev_fb.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/gpu/drm/xe/display/intel_fbdev_fb.c')
-rw-r--r--drivers/gpu/drm/xe/display/intel_fbdev_fb.c27
1 files changed, 26 insertions, 1 deletions
diff --git a/drivers/gpu/drm/xe/display/intel_fbdev_fb.c b/drivers/gpu/drm/xe/display/intel_fbdev_fb.c
index 7ad76022cb14..87af5646c938 100644
--- a/drivers/gpu/drm/xe/display/intel_fbdev_fb.c
+++ b/drivers/gpu/drm/xe/display/intel_fbdev_fb.c
@@ -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 |
@@ -40,6 +63,8 @@ struct drm_gem_object *intel_fbdev_fb_bo_create(struct drm_device *drm, int size
drm_info(&xe->drm, "Allocated fbdev into stolen\n");
else
drm_info(&xe->drm, "Allocated fbdev into stolen failed: %li\n", PTR_ERR(obj));
+ } else {
+ drm_info(&xe->drm, "Allocating fbdev: Stolen memory not preferred.\n");
}
if (IS_ERR(obj)) {