Intel-XE Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Vinod Govindapillai <vinod.govindapillai@intel.com>
To: intel-xe@lists.freedesktop.org, intel-gfx@lists.freedesktop.org
Cc: vinod.govindapillai@intel.com, ville.syrjala@intel.com,
	uma.shankar@intel.com
Subject: [PATCH v2 4/6] drm/xe/fbdev: Extract intel_fbdev_fb_prefer_stolen()
Date: Fri, 20 Feb 2026 19:09:06 +0200	[thread overview]
Message-ID: <20260220170908.201422-5-vinod.govindapillai@intel.com> (raw)
In-Reply-To: <20260220170908.201422-1-vinod.govindapillai@intel.com>

From: Ville Syrjälä <ville.syrjala@linux.intel.com>

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>
Reviewed-by: Uma Shankar <uma.shankar@intel.com>
Signed-off-by: Vinod Govindapillai <vinod.govindapillai@intel.com>
---
 drivers/gpu/drm/xe/display/intel_fbdev_fb.c   | 25 ++++++++++++++++++-
 drivers/gpu/drm/xe/display/xe_initial_plane.c | 11 ++------
 2 files changed, 26 insertions(+), 10 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..4673614cd224 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 |
diff --git a/drivers/gpu/drm/xe/display/xe_initial_plane.c b/drivers/gpu/drm/xe/display/xe_initial_plane.c
index 38ecc201ac4e..13fdc51f8f50 100644
--- a/drivers/gpu/drm/xe/display/xe_initial_plane.c
+++ b/drivers/gpu/drm/xe/display/xe_initial_plane.c
@@ -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;
 	}
 
-- 
2.43.0


  parent reply	other threads:[~2026-02-20 17:09 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-02-20 17:09 [PATCH v2 0/6] update the stolen memory allocation preference Vinod Govindapillai
2026-02-20 17:09 ` [PATCH v2 1/6] drm/xe/fbdev: Fix BIOS FB vs.s stolen size check Vinod Govindapillai
2026-02-24 18:21   ` Shankar, Uma
2026-02-20 17:09 ` [PATCH v2 2/6] drm/i915/display: remove the usage of dev_priv Vinod Govindapillai
2026-02-24 13:17   ` Kahola, Mika
2026-02-20 17:09 ` [PATCH v2 3/6] drm/i915/fbdev: Extract intel_fbdev_fb_prefer_stolen() Vinod Govindapillai
2026-02-21 12:31   ` kernel test robot
2026-02-21 13:44   ` kernel test robot
2026-02-24 18:55   ` Shankar, Uma
2026-02-20 17:09 ` Vinod Govindapillai [this message]
2026-02-20 17:09 ` [PATCH v2 5/6] drm/xe/fbdev: print info about stolen memory preference for fbdev Vinod Govindapillai
2026-02-24 18:36   ` Shankar, Uma
2026-02-20 17:09 ` [PATCH v2 6/6] drm/i915/fbdev: " Vinod Govindapillai
2026-02-24 18:37   ` Shankar, Uma
2026-02-20 18:21 ` ✓ CI.KUnit: success for update the stolen memory allocation preference (rev2) Patchwork
2026-02-20 18:37 ` ✗ CI.checksparse: warning " Patchwork
2026-02-20 18:59 ` ✗ Xe.CI.BAT: failure " Patchwork
2026-02-21  9:24 ` ✗ Xe.CI.FULL: " Patchwork
2026-02-25 11:12 ` [PATCH v2 0/6] update the stolen memory allocation preference Kahola, Mika

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20260220170908.201422-5-vinod.govindapillai@intel.com \
    --to=vinod.govindapillai@intel.com \
    --cc=intel-gfx@lists.freedesktop.org \
    --cc=intel-xe@lists.freedesktop.org \
    --cc=uma.shankar@intel.com \
    --cc=ville.syrjala@intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox