All of lore.kernel.org
 help / color / mirror / Atom feed
From: Chris Wilson <chris@chris-wilson.co.uk>
To: intel-gfx@lists.freedesktop.org
Cc: Matthew Auld <matthew.auld@intel.com>,
	Chris Wilson <chris@chris-wilson.co.uk>
Subject: [Intel-gfx] [PATCH v2] drm/i915/display: Fix initial fb to use resource_size_t
Date: Tue,  7 Jul 2020 19:09:09 +0100	[thread overview]
Message-ID: <20200707180909.7556-1-chris@chris-wilson.co.uk> (raw)
In-Reply-To: <20200707171517.28183-1-chris@chris-wilson.co.uk>

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@intel.com>
References: b7128ef125b4 ("drm/i915: prefer resource_size_t for everything stolen")
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Cc: Ville Syrjälä <ville.syrjala@linux.intel.com>
Cc: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
Cc: Matthew Auld <matthew.auld@intel.com>
---
 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@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

  parent reply	other threads:[~2020-07-07 18:09 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-07-07 17:15 [Intel-gfx] [PATCH] drm/i915/display: Fix initial fb to use resource_size_t Chris Wilson
2020-07-07 17:34 ` [Intel-gfx] ✗ Fi.CI.CHECKPATCH: warning for " Patchwork
2020-07-07 17:48 ` [Intel-gfx] [PATCH] " Tvrtko Ursulin
2020-07-07 18:00   ` Chris Wilson
2020-07-07 17:55 ` [Intel-gfx] ✓ Fi.CI.BAT: success for " Patchwork
2020-07-07 18:09 ` Chris Wilson [this message]
2020-07-07 18:27 ` [Intel-gfx] ✗ Fi.CI.CHECKPATCH: warning for drm/i915/display: Fix initial fb to use resource_size_t (rev2) Patchwork
2020-07-07 18:48 ` [Intel-gfx] ✓ Fi.CI.BAT: success " Patchwork
2020-07-07 22:10 ` [Intel-gfx] ✓ Fi.CI.IGT: success for drm/i915/display: Fix initial fb to use resource_size_t Patchwork
2020-07-07 22:17 ` [Intel-gfx] ✓ Fi.CI.IGT: success for drm/i915/display: Fix initial fb to use resource_size_t (rev2) 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=20200707180909.7556-1-chris@chris-wilson.co.uk \
    --to=chris@chris-wilson.co.uk \
    --cc=intel-gfx@lists.freedesktop.org \
    --cc=matthew.auld@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.