[PATCH v2] drm/i915/display: Fix initial fb to use resource_size_t

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



We lookup up the physical address of the inherited framebuffer, and
presume that is an offset into the stolen memory region. As we are
dealing with physical resources and their addresses, we need to use
resource_size_t and not assume everything fits within a plain u32 [based
on prior assumptions that we were simply handling offsets into the
GGTT not generic addresses/offsets].

We made the switch to using resource_size_t for stolen in commit
b7128ef125b4 ("drm/i915: prefer resource_size_t for everything stolen")

v2: Expand the intel_initial_plane_config struct as well to accommodate
any possible location.

Reported-by: Tvrtko Ursulin <tvrtko.ursulin@xxxxxxxxx>
References: b7128ef125b4 ("drm/i915: prefer resource_size_t for everything stolen")
Signed-off-by: Chris Wilson <chris@xxxxxxxxxxxxxxxxxx>
Cc: Ville Syrjälä <ville.syrjala@xxxxxxxxxxxxxxx>
Cc: Tvrtko Ursulin <tvrtko.ursulin@xxxxxxxxx>
Cc: Matthew Auld <matthew.auld@xxxxxxxxx>
---
 drivers/gpu/drm/i915/display/intel_display.c      | 15 ++++++++-------
 .../gpu/drm/i915/display/intel_display_types.h    |  4 ++--
 2 files changed, 10 insertions(+), 9 deletions(-)

diff --git a/drivers/gpu/drm/i915/display/intel_display.c b/drivers/gpu/drm/i915/display/intel_display.c
index dff7c17f3d2b..9fd18b3dbb37 100644
--- a/drivers/gpu/drm/i915/display/intel_display.c
+++ b/drivers/gpu/drm/i915/display/intel_display.c
@@ -3409,7 +3409,8 @@ initial_plane_vma(struct drm_i915_private *i915,
 {
 	struct drm_i915_gem_object *obj;
 	struct i915_vma *vma;
-	u32 base, size;
+	resource_size_t base;
+	resource_size_t size;
 
 	if (plane_config->size == 0)
 		return NULL;
@@ -9319,13 +9320,13 @@ i9xx_get_initial_plane_config(struct intel_crtc *crtc,
 
 	aligned_height = intel_fb_align_height(fb, 0, fb->height);
 
-	plane_config->size = fb->pitches[0] * aligned_height;
+	plane_config->size = mul_u32_u32(fb->pitches[0], aligned_height);
 
 	drm_dbg_kms(&dev_priv->drm,
-		    "%s/%s with fb: size=%dx%d@%d, offset=%x, pitch %d, size 0x%x\n",
+		    "%s/%s with fb: size=%dx%d@%d, offset=%x, pitch %d, size 0x%pa\n",
 		    crtc->base.name, plane->base.name, fb->width, fb->height,
 		    fb->format->cpp[0] * 8, base, fb->pitches[0],
-		    plane_config->size);
+		    &plane_config->size);
 
 	plane_config->fb = intel_fb;
 }
@@ -10595,13 +10596,13 @@ skl_get_initial_plane_config(struct intel_crtc *crtc,
 
 	aligned_height = intel_fb_align_height(fb, 0, fb->height);
 
-	plane_config->size = fb->pitches[0] * aligned_height;
+	plane_config->size = mul_u32_u32(fb->pitches[0], aligned_height);
 
 	drm_dbg_kms(&dev_priv->drm,
-		    "%s/%s with fb: size=%dx%d@%d, offset=%x, pitch %d, size 0x%x\n",
+		    "%s/%s with fb: size=%dx%d@%d, offset=%x, pitch %d, size 0x%pa\n",
 		    crtc->base.name, plane->base.name, fb->width, fb->height,
 		    fb->format->cpp[0] * 8, base, fb->pitches[0],
-		    plane_config->size);
+		    &plane_config->size);
 
 	plane_config->fb = intel_fb;
 	return;
diff --git a/drivers/gpu/drm/i915/display/intel_display_types.h b/drivers/gpu/drm/i915/display/intel_display_types.h
index e8f809161c75..75cbf00f5c9b 100644
--- a/drivers/gpu/drm/i915/display/intel_display_types.h
+++ b/drivers/gpu/drm/i915/display/intel_display_types.h
@@ -591,9 +591,9 @@ struct intel_plane_state {
 struct intel_initial_plane_config {
 	struct intel_framebuffer *fb;
 	struct i915_vma *vma;
+	resource_size_t base;
+	resource_size_t size;
 	unsigned int tiling;
-	int size;
-	u32 base;
 	u8 rotation;
 };
 
-- 
2.20.1

_______________________________________________
Intel-gfx mailing list
Intel-gfx@xxxxxxxxxxxxxxxxxxxxx
https://lists.freedesktop.org/mailman/listinfo/intel-gfx




[Index of Archives]     [AMD Graphics]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux