@@ -11,6 +11,24 @@
#include "xe_gt.h"
#include "xe_ttm_stolen_mgr.h"
+bool intel_fbdev_fb_prefer_stolen(struct intel_display *display,
+ unsigned int size)
+{
+ struct xe_device *xe = to_xe_device(display->drm);
+ struct ttm_resource_manager *stolen;
+
+ stolen = ttm_manager_type(&xe->ttm, XE_PL_STOLEN);
+ 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;
+}
+
struct intel_framebuffer *intel_fbdev_fb_alloc(struct drm_fb_helper *helper,
struct drm_fb_helper_surface_size *sizes)
{
@@ -15,6 +15,7 @@
#include "intel_display_types.h"
#include "intel_fb.h"
#include "intel_fb_pin.h"
+#include "intel_fbdev_fb.h"
#include "intel_frontbuffer.h"
#include "intel_plane_initial.h"
#include "xe_bo.h"
@@ -104,13 +105,8 @@ initial_plane_bo(struct xe_device *xe,
phys_base = base;
flags |= XE_BO_FLAG_STOLEN;
- /*
- * 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->display, plane_config->size))
return NULL;
}