From: Jani Nikula <jani.nikula@linux.intel.com>
To: Vinod Govindapillai <vinod.govindapillai@intel.com>,
intel-xe@lists.freedesktop.org, intel-gfx@lists.freedesktop.org
Cc: vinod.govindapillai@intel.com, ville.syrjala@intel.com,
uma.shankar@intel.com
Subject: Re: [PATCH 3/6] drm/i915/fbdev: Extract intel_fbdev_fb_prefer_stolen()
Date: Tue, 10 Feb 2026 11:30:48 +0200 [thread overview]
Message-ID: <2e0d12e298bec2b29397a63b6ec0c7546913c21f@intel.com> (raw)
In-Reply-To: <20260205140235.338410-4-vinod.govindapillai@intel.com>
On Thu, 05 Feb 2026, Vinod Govindapillai <vinod.govindapillai@intel.com> wrote:
> From: Ville Syrjälä <ville.syrjala@linux.intel.com>
>
> Consolidate the "should we allocate fbdev fb in stolen?"
> check into a helper function. Makes it easier to change the
> heuristics without having to change so many places.
>
> v2: rebase related changes and consolidate all the prefer
> stolen conditions into a single function (Vinod)
>
> Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
> Signed-off-by: Vinod Govindapillai <vinod.govindapillai@intel.com>
> ---
> drivers/gpu/drm/i915/display/intel_fbdev_fb.c | 27 +++++++++++++------
> drivers/gpu/drm/i915/display/intel_fbdev_fb.h | 2 ++
> drivers/gpu/drm/i915/i915_initial_plane.c | 3 ++-
All of these files are built on i915 only...
> 3 files changed, 23 insertions(+), 9 deletions(-)
>
> diff --git a/drivers/gpu/drm/i915/display/intel_fbdev_fb.c b/drivers/gpu/drm/i915/display/intel_fbdev_fb.c
> index e5251ed15948..4f057dbd1279 100644
> --- a/drivers/gpu/drm/i915/display/intel_fbdev_fb.c
> +++ b/drivers/gpu/drm/i915/display/intel_fbdev_fb.c
> @@ -10,6 +10,7 @@
> #include "gem/i915_gem_lmem.h"
>
> #include "i915_drv.h"
> +#include "intel_display_core.h"
...and should not include intel_display_core.h.
This is non-obvious, and an easy mistake to make. Eventually
intel_fbdev_fb.c needs to move to i915 core, with some refactoring.
> #include "intel_fbdev_fb.h"
>
> u32 intel_fbdev_fb_pitch_align(u32 stride)
> @@ -17,6 +18,23 @@ u32 intel_fbdev_fb_pitch_align(u32 stride)
> return ALIGN(stride, 64);
> }
>
> +bool intel_fbdev_fb_prefer_stolen(struct intel_display *display,
Just pass struct drm_i915_private around here.
> + unsigned int size)
> +{
> + struct drm_i915_private *i915 = to_i915(display->drm);
> +
> + /* Skip stolen on MTL as Wa_22018444074 mitigation. */
> + if (IS_METEORLAKE(i915))
> + 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 i915->dsm.usable_size >= size * 2;
> +}
> +
> struct drm_gem_object *intel_fbdev_fb_bo_create(struct drm_device *drm, int size)
> {
> struct drm_i915_private *i915 = to_i915(drm);
> @@ -28,14 +46,7 @@ struct drm_gem_object *intel_fbdev_fb_bo_create(struct drm_device *drm, int size
> I915_BO_ALLOC_CONTIGUOUS |
> I915_BO_ALLOC_USER);
> } else {
> - /*
> - * 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.
> - *
> - * Also skip stolen on MTL as Wa_22018444074 mitigation.
> - */
> - if (!IS_METEORLAKE(i915) && size * 2 < i915->dsm.usable_size)
> + if (intel_fbdev_fb_prefer_stolen(i915->display, size))
> obj = i915_gem_object_create_stolen(i915, size);
> if (IS_ERR(obj))
> obj = i915_gem_object_create_shmem(i915, size);
> diff --git a/drivers/gpu/drm/i915/display/intel_fbdev_fb.h b/drivers/gpu/drm/i915/display/intel_fbdev_fb.h
> index fd0b3775dc1f..82da57601dc7 100644
> --- a/drivers/gpu/drm/i915/display/intel_fbdev_fb.h
> +++ b/drivers/gpu/drm/i915/display/intel_fbdev_fb.h
> @@ -13,11 +13,13 @@ struct drm_gem_object;
> struct drm_mode_fb_cmd2;
> struct fb_info;
> struct i915_vma;
> +struct intel_display;
>
> u32 intel_fbdev_fb_pitch_align(u32 stride);
> struct drm_gem_object *intel_fbdev_fb_bo_create(struct drm_device *drm, int size);
> void intel_fbdev_fb_bo_destroy(struct drm_gem_object *obj);
> int intel_fbdev_fb_fill_info(struct drm_device *drm, struct fb_info *info,
> struct drm_gem_object *obj, struct i915_vma *vma);
> +bool intel_fbdev_fb_prefer_stolen(struct intel_display *display, unsigned int size);
>
> #endif
> diff --git a/drivers/gpu/drm/i915/i915_initial_plane.c b/drivers/gpu/drm/i915/i915_initial_plane.c
> index 7fb52d81f7b6..1263d7db2c44 100644
> --- a/drivers/gpu/drm/i915/i915_initial_plane.c
> +++ b/drivers/gpu/drm/i915/i915_initial_plane.c
> @@ -9,6 +9,7 @@
> #include "display/intel_crtc.h"
> #include "display/intel_display_types.h"
> #include "display/intel_fb.h"
> +#include "display/intel_fbdev_fb.h"
> #include "gem/i915_gem_lmem.h"
> #include "gem/i915_gem_region.h"
>
> @@ -116,7 +117,7 @@ initial_plane_vma(struct drm_i915_private *i915,
> */
> if (IS_ENABLED(CONFIG_FRAMEBUFFER_CONSOLE) &&
> mem == i915->mm.stolen_region &&
> - size * 2 > i915->dsm.usable_size) {
> + !intel_fbdev_fb_prefer_stolen(i915->display, size)) {
> drm_dbg_kms(&i915->drm, "Initial FB size exceeds half of stolen, discarding\n");
> return NULL;
> }
--
Jani Nikula, Intel
next prev parent reply other threads:[~2026-02-10 9:31 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-02-05 14:02 [PATCH 0/6] update the stolen memory allocation preference Vinod Govindapillai
2026-02-05 14:02 ` [PATCH 1/6] drm/xe/fbdev: Fix BIOS FB vs.s stolen size check Vinod Govindapillai
2026-02-06 12:41 ` Ville Syrjälä
2026-02-05 14:02 ` [PATCH 2/6] drm/i915/display: remove the usage of dev_priv Vinod Govindapillai
2026-02-05 14:02 ` [PATCH 3/6] drm/i915/fbdev: Extract intel_fbdev_fb_prefer_stolen() Vinod Govindapillai
2026-02-10 9:30 ` Jani Nikula [this message]
2026-02-24 18:34 ` Shankar, Uma
2026-02-05 14:02 ` [PATCH 4/6] drm/xe/fbdev: " Vinod Govindapillai
2026-02-05 14:02 ` [PATCH 5/6] drm/xe/fbdev: print info about stolen memory preference for fbdev Vinod Govindapillai
2026-02-05 14:02 ` [PATCH 6/6] drm/i915/fbdev: " Vinod Govindapillai
2026-02-05 14:41 ` ✓ CI.KUnit: success for update the stolen memory allocation preference Patchwork
2026-02-05 15:00 ` ✗ CI.checksparse: warning " Patchwork
2026-02-05 15:42 ` ✗ Xe.CI.BAT: failure " Patchwork
2026-02-06 13:33 ` ✗ Xe.CI.FULL: " Patchwork
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=2e0d12e298bec2b29397a63b6ec0c7546913c21f@intel.com \
--to=jani.nikula@linux.intel.com \
--cc=intel-gfx@lists.freedesktop.org \
--cc=intel-xe@lists.freedesktop.org \
--cc=uma.shankar@intel.com \
--cc=ville.syrjala@intel.com \
--cc=vinod.govindapillai@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