All of lore.kernel.org
 help / color / mirror / Atom feed
From: Matthew Auld <matthew.auld@intel.com>
To: intel-gfx@lists.freedesktop.org
Cc: Paulo Zanoni <paulo.r.zanoni@intel.com>
Subject: [PATCH 8/9] drm/i915: give stolen_usable_size a more suitable home
Date: Thu,  7 Dec 2017 12:28:38 +0000	[thread overview]
Message-ID: <20171207122839.29925-9-matthew.auld@intel.com> (raw)
In-Reply-To: <20171207122839.29925-1-matthew.auld@intel.com>

Kick it out of i915_ggtt and keep it grouped with dsm and dsm_reserved,
where it makes the most sense.

Signed-off-by: Matthew Auld <matthew.auld@intel.com>
Cc: Joonas Lahtinen <joonas.lahtinen@linux.intel.com>
Cc: Chris Wilson <chris@chris-wilson.co.uk>
Cc: Paulo Zanoni <paulo.r.zanoni@intel.com>
Reviewed-by: Chris Wilson <chris@chris-wilson.co.uk>
---
 drivers/gpu/drm/i915/i915_drv.h        | 13 ++++++++++++-
 drivers/gpu/drm/i915/i915_gem_gtt.h    | 10 ----------
 drivers/gpu/drm/i915/i915_gem_stolen.c |  5 ++---
 drivers/gpu/drm/i915/intel_display.c   |  3 +--
 drivers/gpu/drm/i915/intel_fbdev.c     |  3 +--
 5 files changed, 16 insertions(+), 18 deletions(-)

diff --git a/drivers/gpu/drm/i915/i915_drv.h b/drivers/gpu/drm/i915/i915_drv.h
index 40171a7da9d9..57bda4a370f6 100644
--- a/drivers/gpu/drm/i915/i915_drv.h
+++ b/drivers/gpu/drm/i915/i915_drv.h
@@ -2253,7 +2253,7 @@ struct drm_i915_private {
 	/**
 	 * Data Stolen Memory - aka "i915 stolen memory" gives us the start and
 	 * end of stolen which we can optionally use to create GEM objects
-	 * backed by stolen memory. Note that ggtt->stolen_usable_size tells us
+	 * backed by stolen memory. Note that stolen_usable_size tells us
 	 * exactly how much of this we are actually allowed to use, given that
 	 * some portion of it is in fact reserved for use by hardware functions.
 	 */
@@ -2263,6 +2263,17 @@ struct drm_i915_private {
 	 */
 	struct resource dsm_reserved;
 
+	/*
+	 * Stolen memory is segmented in hardware with different portions
+	 * offlimits to certain functions.
+	 *
+	 * The drm_mm is initialised to the total accessible range, as found
+	 * from the PCI config. On Broadwell+, this is further restricted to
+	 * avoid the first page! The upper end of stolen memory is reserved for
+	 * hardware functions and similarly removed from the accessible range.
+	 */
+	u32 stolen_usable_size;	/* Total size minus reserved ranges */
+
 	void __iomem *regs;
 
 	struct intel_uncore uncore;
diff --git a/drivers/gpu/drm/i915/i915_gem_gtt.h b/drivers/gpu/drm/i915/i915_gem_gtt.h
index 4a17ce36281a..e5aa07ceb627 100644
--- a/drivers/gpu/drm/i915/i915_gem_gtt.h
+++ b/drivers/gpu/drm/i915/i915_gem_gtt.h
@@ -373,16 +373,6 @@ struct i915_ggtt {
 	struct resource gmadr;          /* GMADR resource */
 	u64 mappable_end;		/* End offset that we can CPU map */
 
-	/* Stolen memory is segmented in hardware with different portions
-	 * offlimits to certain functions.
-	 *
-	 * The drm_mm is initialised to the total accessible range, as found
-	 * from the PCI config. On Broadwell+, this is further restricted to
-	 * avoid the first page! The upper end of stolen memory is reserved for
-	 * hardware functions and similarly removed from the accessible range.
-	 */
-	u32 stolen_usable_size;	/* Total size minus reserved ranges */
-
 	/** "Graphics Stolen Memory" holds the global PTEs */
 	void __iomem *gsm;
 	void (*invalidate)(struct drm_i915_private *dev_priv);
diff --git a/drivers/gpu/drm/i915/i915_gem_stolen.c b/drivers/gpu/drm/i915/i915_gem_stolen.c
index 1c0d76f73363..346a1cc7d794 100644
--- a/drivers/gpu/drm/i915/i915_gem_stolen.c
+++ b/drivers/gpu/drm/i915/i915_gem_stolen.c
@@ -320,7 +320,6 @@ static void bdw_get_stolen_reserved(struct drm_i915_private *dev_priv,
 
 int i915_gem_init_stolen(struct drm_i915_private *dev_priv)
 {
-	struct i915_ggtt *ggtt = &dev_priv->ggtt;
 	dma_addr_t reserved_base, stolen_top;
 	u32 reserved_total, reserved_size;
 	u32 stolen_usable_start;
@@ -411,12 +410,12 @@ int i915_gem_init_stolen(struct drm_i915_private *dev_priv)
 	if (INTEL_GEN(dev_priv) >= 8)
 		stolen_usable_start = 4096;
 
-	ggtt->stolen_usable_size =
+	dev_priv->stolen_usable_size =
 		resource_size(&dev_priv->dsm) - reserved_total - stolen_usable_start;
 
 	/* Basic memrange allocator for stolen space. */
 	drm_mm_init(&dev_priv->mm.stolen, stolen_usable_start,
-		    ggtt->stolen_usable_size);
+		    dev_priv->stolen_usable_size);
 
 	return 0;
 }
diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/intel_display.c
index 0098738d3740..f1e0e838b2a7 100644
--- a/drivers/gpu/drm/i915/intel_display.c
+++ b/drivers/gpu/drm/i915/intel_display.c
@@ -2639,7 +2639,6 @@ intel_alloc_initial_plane_obj(struct intel_crtc *crtc,
 {
 	struct drm_device *dev = crtc->base.dev;
 	struct drm_i915_private *dev_priv = to_i915(dev);
-	struct i915_ggtt *ggtt = &dev_priv->ggtt;
 	struct drm_i915_gem_object *obj = NULL;
 	struct drm_mode_fb_cmd2 mode_cmd = { 0 };
 	struct drm_framebuffer *fb = &plane_config->fb->base;
@@ -2655,7 +2654,7 @@ intel_alloc_initial_plane_obj(struct intel_crtc *crtc,
 	/* 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 (size_aligned * 2 > ggtt->stolen_usable_size)
+	if (size_aligned * 2 > dev_priv->stolen_usable_size)
 		return false;
 
 	mutex_lock(&dev->struct_mutex);
diff --git a/drivers/gpu/drm/i915/intel_fbdev.c b/drivers/gpu/drm/i915/intel_fbdev.c
index ea96682568e8..da48af11eb6b 100644
--- a/drivers/gpu/drm/i915/intel_fbdev.c
+++ b/drivers/gpu/drm/i915/intel_fbdev.c
@@ -115,7 +115,6 @@ static int intelfb_alloc(struct drm_fb_helper *helper,
 	struct drm_framebuffer *fb;
 	struct drm_device *dev = helper->dev;
 	struct drm_i915_private *dev_priv = to_i915(dev);
-	struct i915_ggtt *ggtt = &dev_priv->ggtt;
 	struct drm_mode_fb_cmd2 mode_cmd = {};
 	struct drm_i915_gem_object *obj;
 	int size, ret;
@@ -139,7 +138,7 @@ static int intelfb_alloc(struct drm_fb_helper *helper,
 	 * important and we should probably use that space with FBC or other
 	 * features. */
 	obj = NULL;
-	if (size * 2 < ggtt->stolen_usable_size)
+	if (size * 2 < dev_priv->stolen_usable_size)
 		obj = i915_gem_object_create_stolen(dev_priv, size);
 	if (obj == NULL)
 		obj = i915_gem_object_create(dev_priv, size);
-- 
2.14.3

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

  parent reply	other threads:[~2017-12-07 12:28 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-12-07 12:28 [PATCH 0/9] make stolen resource centric Matthew Auld
2017-12-07 12:28 ` [PATCH 1/9] x86/early-quirks: Extend Intel graphics stolen memory placement to 64bit Matthew Auld
2017-12-07 12:28   ` Matthew Auld
2017-12-08 22:58   ` Thomas Gleixner
2017-12-08 22:58     ` Thomas Gleixner
2017-12-07 12:28 ` [PATCH 2/9] x86/early-quirks: replace the magical increment start values Matthew Auld
2017-12-07 12:28   ` Matthew Auld
2017-12-07 12:28 ` [PATCH 3/9] x86/early-quirks: reverse the if ladders Matthew Auld
2017-12-07 12:28   ` Matthew Auld
2017-12-08 23:05   ` Thomas Gleixner
2017-12-08 23:05     ` Thomas Gleixner
2017-12-07 12:28 ` [PATCH 4/9] drm/i915: nuke the duplicated stolen discovery Matthew Auld
2017-12-07 12:28 ` [PATCH 5/9] drm/i915: make dsm struct resource centric Matthew Auld
2017-12-07 12:28 ` [PATCH 6/9] drm/i915: make reserved " Matthew Auld
2017-12-07 12:28 ` [PATCH 7/9] drm/i915: make mappable " Matthew Auld
2017-12-07 12:28 ` Matthew Auld [this message]
2017-12-07 12:28 ` [PATCH 9/9] drm/i915: prefer resource_size_t for everything stolen Matthew Auld
2017-12-07 13:15 ` ✓ Fi.CI.BAT: success for make stolen resource centric (rev6) Patchwork
2017-12-07 18:43 ` ✗ Fi.CI.IGT: warning " 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=20171207122839.29925-9-matthew.auld@intel.com \
    --to=matthew.auld@intel.com \
    --cc=intel-gfx@lists.freedesktop.org \
    --cc=paulo.r.zanoni@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.