All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Ville Syrjälä" <ville.syrjala@linux.intel.com>
To: Lucas De Marchi <lucas.demarchi@intel.com>
Cc: intel-gfx@lists.freedesktop.org, intel-xe@lists.freedesktop.org
Subject: Re: [PATCH 16/20] drm/i915/fbdev: Extract intel_fbdev_fb_prefer_stolen()
Date: Wed, 10 Jul 2024 14:47:56 +0300	[thread overview]
Message-ID: <Zo507NB2VMELZAxH@intel.com> (raw)
In-Reply-To: <4mw2rthck4nmipknligxj6hu2siwzg236ge2vwor3w4ae7pydu@i2hwfhwouxon>

On Tue, Jul 09, 2024 at 03:28:15PM -0500, Lucas De Marchi wrote:
> On Fri, Jul 05, 2024 at 05:52:50PM GMT, Ville Syrjälä 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.
> >
> >Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
> >---
> > drivers/gpu/drm/i915/display/intel_fbdev_fb.c | 24 ++++++++++++-------
> > drivers/gpu/drm/i915/display/intel_fbdev_fb.h |  5 +++-
> > .../drm/i915/display/intel_plane_initial.c    | 10 +++-----
> > 3 files changed, 23 insertions(+), 16 deletions(-)
> >
> >diff --git a/drivers/gpu/drm/i915/display/intel_fbdev_fb.c b/drivers/gpu/drm/i915/display/intel_fbdev_fb.c
> >index 497525ef9668..0a6445acb100 100644
> >--- a/drivers/gpu/drm/i915/display/intel_fbdev_fb.c
> >+++ b/drivers/gpu/drm/i915/display/intel_fbdev_fb.c
> >@@ -11,6 +11,19 @@
> > #include "intel_display_types.h"
> > #include "intel_fbdev_fb.h"
> >
> >+bool intel_fbdev_fb_prefer_stolen(struct intel_display *display,
> >+				  unsigned int size)
> >+{
> >+	struct drm_i915_private *i915 = to_i915(display->drm);
> >+
> >+	/*
> >+	 * 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 intel_framebuffer *intel_fbdev_fb_alloc(struct drm_fb_helper *helper,
> > 					       struct drm_fb_helper_surface_size *sizes)
> > {
> >@@ -42,14 +55,9 @@ struct intel_framebuffer *intel_fbdev_fb_alloc(struct drm_fb_helper *helper,
> > 						  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(dev_priv)) && size * 2 < dev_priv->dsm.usable_size)
> >+		/* skip stolen on MTL as Wa_22018444074 mitigation */
> >+		if (!IS_METEORLAKE(dev_priv) &&
> 
> shouldn't this be inside intel_fbdev_fb_prefer_stolen()?

That would also apply it to the BIOS fb takeover, so change the
behaviour. The correct answer is likely just removing the MTL check
entirely, but I left that out for now to avoid too many functional
changes.

> 
> And also pull the same logic on the xe side a few patches after this.
> 
> Lucas De Marchi
> 
> >+		    intel_fbdev_fb_prefer_stolen(&dev_priv->display, size))
> > 			obj = i915_gem_object_create_stolen(dev_priv, size);
> > 		if (IS_ERR(obj))
> > 			obj = i915_gem_object_create_shmem(dev_priv, size);
> >diff --git a/drivers/gpu/drm/i915/display/intel_fbdev_fb.h b/drivers/gpu/drm/i915/display/intel_fbdev_fb.h
> >index 4832fe688fbf..3b9033bd2160 100644
> >--- a/drivers/gpu/drm/i915/display/intel_fbdev_fb.h
> >+++ b/drivers/gpu/drm/i915/display/intel_fbdev_fb.h
> >@@ -6,16 +6,19 @@
> > #ifndef __INTEL_FBDEV_FB_H__
> > #define __INTEL_FBDEV_FB_H__
> >
> >+#include <linux/types.h>
> >+
> > struct drm_fb_helper;
> > struct drm_fb_helper_surface_size;
> > struct drm_i915_gem_object;
> > struct drm_i915_private;
> > struct fb_info;
> > struct i915_vma;
> >+struct intel_display;
> >
> > struct intel_framebuffer *intel_fbdev_fb_alloc(struct drm_fb_helper *helper,
> > 					       struct drm_fb_helper_surface_size *sizes);
> > int intel_fbdev_fb_fill_info(struct drm_i915_private *i915, struct fb_info *info,
> > 			     struct drm_i915_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/display/intel_plane_initial.c b/drivers/gpu/drm/i915/display/intel_plane_initial.c
> >index ada1792df5b3..4622bb5f3426 100644
> >--- a/drivers/gpu/drm/i915/display/intel_plane_initial.c
> >+++ b/drivers/gpu/drm/i915/display/intel_plane_initial.c
> >@@ -11,6 +11,7 @@
> > #include "intel_display.h"
> > #include "intel_display_types.h"
> > #include "intel_fb.h"
> >+#include "intel_fbdev_fb.h"
> > #include "intel_frontbuffer.h"
> > #include "intel_plane_initial.h"
> >
> >@@ -160,15 +161,10 @@ initial_plane_vma(struct drm_i915_private *i915,
> > 			mem->min_page_size);
> > 	size -= base;
> >
> >-	/*
> >-	 * 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) &&
> > 	    mem == i915->mm.stolen_region &&
> >-	    size * 2 > i915->dsm.usable_size) {
> >-		drm_dbg_kms(&i915->drm, "Initial FB size exceeds half of stolen, discarding\n");
> >+	    !intel_fbdev_fb_prefer_stolen(&i915->display, size)) {
> >+		drm_dbg_kms(&i915->drm, "Initial FB size uses too much stolen, discarding\n");
> > 		return NULL;
> > 	}
> >
> >-- 
> >2.44.2
> >

-- 
Ville Syrjälä
Intel

  reply	other threads:[~2024-07-10 11:48 UTC|newest]

Thread overview: 59+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-07-05 14:52 [PATCH 00/20] drm/{i915, xe}: FBC cleanups + tweak fbdev stolen usage Ville Syrjala
2024-07-05 14:52 ` [PATCH 01/20] drm/i915/fbc: Extract intel_fbc_has_fences() Ville Syrjala
2024-07-09 19:46   ` Rodrigo Vivi
2024-07-05 14:52 ` [PATCH 02/20] drm/i915/fbc: Convert to intel_display, mostly Ville Syrjala
2024-07-09 19:49   ` Rodrigo Vivi
2024-07-12 21:38     ` Ville Syrjälä
2024-07-05 14:52 ` [PATCH 03/20] drm/i915/fbc: s/_intel_fbc_cfb_stride()/intel_fbc_plane_cfb_stride()/ Ville Syrjala
2024-07-09 19:50   ` Rodrigo Vivi
2024-07-05 14:52 ` [PATCH 04/20] drm/i915/fbc: Extract intel_fbc_max_plane_size() Ville Syrjala
2024-07-09 19:51   ` Rodrigo Vivi
2024-07-05 14:52 ` [PATCH 05/20] drm/i915/fbc: Extract intel_fbc_max_surface_size() Ville Syrjala
2024-07-09 19:51   ` Rodrigo Vivi
2024-07-05 14:52 ` [PATCH 06/20] drm/i915/fbc: s/intel_fbc_hw_tracking_covers_screen()/intel_fbc_surface_size_ok()/ Ville Syrjala
2024-07-09 19:52   ` Rodrigo Vivi
2024-07-05 14:52 ` [PATCH 07/20] drm/i915/fbc: Adjust g4x+ platform checks Ville Syrjala
2024-07-09 19:54   ` Rodrigo Vivi
2024-07-05 14:52 ` [PATCH 08/20] drm/i915/fbc: Extract _intel_fbc_cfb_stride() Ville Syrjala
2024-07-10  8:01   ` Shankar, Uma
2024-07-05 14:52 ` [PATCH 09/20] drm/i915/fbc: s/lines/height/ Ville Syrjala
2024-07-09 20:00   ` Rodrigo Vivi
2024-07-05 14:52 ` [PATCH 10/20] drm/i915/fbc: Reoder CFB max height platform checks Ville Syrjala
2024-07-09 20:00   ` Rodrigo Vivi
2024-07-05 14:52 ` [PATCH 11/20] drm/i915/fbc: Extract intel_fbc_max_cfb_height() Ville Syrjala
2024-07-10  8:26   ` Shankar, Uma
2024-07-12 21:34     ` Ville Syrjälä
2024-07-05 14:52 ` [PATCH 12/20] drm/i915/fbc: Extract _intel_fbc_cfb_size() Ville Syrjala
2024-07-10  8:28   ` Shankar, Uma
2024-07-05 14:52 ` [PATCH 13/20] drm/i915/fbc: Extract intel_fbc_cfb_cpp() Ville Syrjala
2024-07-10  8:30   ` Shankar, Uma
2024-07-05 14:52 ` [PATCH 14/20] drm/i915/fbc: Introduce intel_fbc_preferred_cfb_size() Ville Syrjala
2024-07-10  8:36   ` Shankar, Uma
2024-07-05 14:52 ` [PATCH 15/20] drm/xe/fbdev: Fix BIOS FB vs.s stolen size checke Ville Syrjala
2024-07-10  8:42   ` Shankar, Uma
2024-07-05 14:52 ` [PATCH 16/20] drm/i915/fbdev: Extract intel_fbdev_fb_prefer_stolen() Ville Syrjala
2024-07-06 12:06   ` kernel test robot
2024-07-09 20:28   ` Lucas De Marchi
2024-07-10 11:47     ` Ville Syrjälä [this message]
2024-07-10  8:51   ` Shankar, Uma
2024-07-05 14:52 ` [PATCH 17/20] drm/xe/fbdev: " Ville Syrjala
2024-07-10  8:58   ` Shankar, Uma
2024-07-05 14:52 ` [PATCH 18/20] drm/xe/fbdev: Use the same logic for fbdev stolen takever and fresh allocation Ville Syrjala
2024-07-10  9:08   ` Shankar, Uma
2024-07-05 14:52 ` [PATCH 19/20] drm/i915/fbdev: Adjust fbdev stolen mem usage heuristic Ville Syrjala
2024-07-10  9:11   ` Shankar, Uma
2024-07-05 14:52 ` [PATCH 20/20] drm/xe/fbdev: " Ville Syrjala
2024-07-10  9:12   ` Shankar, Uma
2024-07-05 14:58 ` ✓ CI.Patch_applied: success for drm/{i915, xe}: FBC cleanups + tweak fbdev stolen usage Patchwork
2024-07-05 14:58 ` ✗ CI.checkpatch: warning " Patchwork
2024-07-05 15:00 ` ✓ CI.KUnit: success " Patchwork
2024-07-05 15:12 ` ✓ CI.Build: " Patchwork
2024-07-05 15:14 ` ✓ CI.Hooks: " Patchwork
2024-07-05 15:15 ` ✗ CI.checksparse: warning " Patchwork
2024-07-05 15:31 ` ✗ Fi.CI.CHECKPATCH: " Patchwork
2024-07-05 15:31 ` ✗ Fi.CI.SPARSE: " Patchwork
2024-07-05 15:38 ` ✓ CI.BAT: success " Patchwork
2024-07-05 15:39 ` ✓ Fi.CI.BAT: " Patchwork
2024-07-05 17:43 ` ✗ CI.FULL: failure " Patchwork
2024-07-06 18:52 ` ✗ Fi.CI.IGT: " Patchwork
2024-07-12 21:39 ` [PATCH 00/20] drm/{i915,xe}: " Ville Syrjälä

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=Zo507NB2VMELZAxH@intel.com \
    --to=ville.syrjala@linux.intel.com \
    --cc=intel-gfx@lists.freedesktop.org \
    --cc=intel-xe@lists.freedesktop.org \
    --cc=lucas.demarchi@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.