mirror of
https://github.com/torvalds/linux.git
synced 2026-07-28 18:21:24 +02:00
drm/i915/fbdev: Extract intel_fbdev_fb_prefer_stolen()
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)
v3: avoid including intel_display_core.h (Jani)
Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Signed-off-by: Vinod Govindapillai <vinod.govindapillai@intel.com>
Reviewed-by: Uma Shankar <uma.shankar@intel.com>
Acked-by: Mika Kahola <mika.kahola@intel.com>
Link: https://patch.msgid.link/20260220170908.201422-4-vinod.govindapillai@intel.com
This commit is contained in:
parent
26a3e4bffc
commit
94c7d28612
|
|
@ -17,6 +17,22 @@ u32 intel_fbdev_fb_pitch_align(u32 stride)
|
||||||
return ALIGN(stride, 64);
|
return ALIGN(stride, 64);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool intel_fbdev_fb_prefer_stolen(struct drm_device *drm, unsigned int size)
|
||||||
|
{
|
||||||
|
struct drm_i915_private *i915 = to_i915(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_gem_object *intel_fbdev_fb_bo_create(struct drm_device *drm, int size)
|
||||||
{
|
{
|
||||||
struct drm_i915_private *i915 = to_i915(drm);
|
struct drm_i915_private *i915 = to_i915(drm);
|
||||||
|
|
@ -28,14 +44,7 @@ struct drm_gem_object *intel_fbdev_fb_bo_create(struct drm_device *drm, int size
|
||||||
I915_BO_ALLOC_CONTIGUOUS |
|
I915_BO_ALLOC_CONTIGUOUS |
|
||||||
I915_BO_ALLOC_USER);
|
I915_BO_ALLOC_USER);
|
||||||
} else {
|
} else {
|
||||||
/*
|
if (intel_fbdev_fb_prefer_stolen(drm, size))
|
||||||
* 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)
|
|
||||||
obj = i915_gem_object_create_stolen(i915, size);
|
obj = i915_gem_object_create_stolen(i915, size);
|
||||||
if (IS_ERR(obj))
|
if (IS_ERR(obj))
|
||||||
obj = i915_gem_object_create_shmem(i915, size);
|
obj = i915_gem_object_create_shmem(i915, size);
|
||||||
|
|
|
||||||
|
|
@ -19,5 +19,6 @@ 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);
|
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,
|
int intel_fbdev_fb_fill_info(struct drm_device *drm, struct fb_info *info,
|
||||||
struct drm_gem_object *obj, struct i915_vma *vma);
|
struct drm_gem_object *obj, struct i915_vma *vma);
|
||||||
|
bool intel_fbdev_fb_prefer_stolen(struct drm_device *drm, unsigned int size);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
||||||
|
|
@ -9,6 +9,7 @@
|
||||||
#include "display/intel_crtc.h"
|
#include "display/intel_crtc.h"
|
||||||
#include "display/intel_display_types.h"
|
#include "display/intel_display_types.h"
|
||||||
#include "display/intel_fb.h"
|
#include "display/intel_fb.h"
|
||||||
|
#include "display/intel_fbdev_fb.h"
|
||||||
#include "gem/i915_gem_lmem.h"
|
#include "gem/i915_gem_lmem.h"
|
||||||
#include "gem/i915_gem_region.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) &&
|
if (IS_ENABLED(CONFIG_FRAMEBUFFER_CONSOLE) &&
|
||||||
mem == i915->mm.stolen_region &&
|
mem == i915->mm.stolen_region &&
|
||||||
size * 2 > i915->dsm.usable_size) {
|
!intel_fbdev_fb_prefer_stolen(&i915->drm, size)) {
|
||||||
drm_dbg_kms(&i915->drm, "Initial FB size exceeds half of stolen, discarding\n");
|
drm_dbg_kms(&i915->drm, "Initial FB size exceeds half of stolen, discarding\n");
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user