All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/7] drm/i915: Track file_priv, not ctx in the ppgtt structure
@ 2014-07-30 19:41 Daniel Vetter
  2014-07-30 19:41 ` [PATCH 2/7] drm/i915: Only refcount ppgtt if it actually is one Daniel Vetter
                   ` (6 more replies)
  0 siblings, 7 replies; 31+ messages in thread
From: Daniel Vetter @ 2014-07-30 19:41 UTC (permalink / raw)
  To: Intel Graphics Development; +Cc: Daniel Vetter

Hardware contexts reference a ppgtt, not the other way round. And the
only user of this (in debugfs) actually only cares about which file
the ppgtt is associated with. So give it what it wants.

While at it give the ppgtt create function a proper name&place.

Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
---
 drivers/gpu/drm/i915/i915_debugfs.c     |  2 +-
 drivers/gpu/drm/i915/i915_gem_context.c | 22 +---------------------
 drivers/gpu/drm/i915/i915_gem_gtt.c     | 21 +++++++++++++++++++++
 drivers/gpu/drm/i915/i915_gem_gtt.h     |  6 +++++-
 4 files changed, 28 insertions(+), 23 deletions(-)

diff --git a/drivers/gpu/drm/i915/i915_debugfs.c b/drivers/gpu/drm/i915/i915_debugfs.c
index 9e737b771c40..3bf1d20c598b 100644
--- a/drivers/gpu/drm/i915/i915_debugfs.c
+++ b/drivers/gpu/drm/i915/i915_debugfs.c
@@ -333,7 +333,7 @@ static int per_file_stats(int id, void *ptr, void *data)
 			}
 
 			ppgtt = container_of(vma->vm, struct i915_hw_ppgtt, base);
-			if (ppgtt->ctx && ppgtt->ctx->file_priv != stats->file_priv)
+			if (ppgtt->file_priv != stats->file_priv)
 				continue;
 
 			if (obj->ring) /* XXX per-vma statistic */
diff --git a/drivers/gpu/drm/i915/i915_gem_context.c b/drivers/gpu/drm/i915/i915_gem_context.c
index 899c6a7a5920..3b8367aa8404 100644
--- a/drivers/gpu/drm/i915/i915_gem_context.c
+++ b/drivers/gpu/drm/i915/i915_gem_context.c
@@ -181,26 +181,6 @@ i915_gem_alloc_context_obj(struct drm_device *dev, size_t size)
 	return obj;
 }
 
-static struct i915_hw_ppgtt *
-create_vm_for_ctx(struct drm_device *dev, struct intel_context *ctx)
-{
-	struct i915_hw_ppgtt *ppgtt;
-	int ret;
-
-	ppgtt = kzalloc(sizeof(*ppgtt), GFP_KERNEL);
-	if (!ppgtt)
-		return ERR_PTR(-ENOMEM);
-
-	ret = i915_ppgtt_init(dev, ppgtt);
-	if (ret) {
-		kfree(ppgtt);
-		return ERR_PTR(ret);
-	}
-
-	ppgtt->ctx = ctx;
-	return ppgtt;
-}
-
 static struct intel_context *
 __create_hw_context(struct drm_device *dev,
 		    struct drm_i915_file_private *file_priv)
@@ -287,7 +267,7 @@ i915_gem_create_context(struct drm_device *dev,
 	}
 
 	if (create_vm) {
-		struct i915_hw_ppgtt *ppgtt = create_vm_for_ctx(dev, ctx);
+		struct i915_hw_ppgtt *ppgtt = i915_ppgtt_create(dev, file_priv);
 
 		if (IS_ERR_OR_NULL(ppgtt)) {
 			DRM_DEBUG_DRIVER("PPGTT setup failed (%ld)\n",
diff --git a/drivers/gpu/drm/i915/i915_gem_gtt.c b/drivers/gpu/drm/i915/i915_gem_gtt.c
index baa94199239b..83ee41e5c1c7 100644
--- a/drivers/gpu/drm/i915/i915_gem_gtt.c
+++ b/drivers/gpu/drm/i915/i915_gem_gtt.c
@@ -1222,6 +1222,27 @@ int i915_ppgtt_init(struct drm_device *dev, struct i915_hw_ppgtt *ppgtt)
 	return ret;
 }
 
+struct i915_hw_ppgtt *
+i915_ppgtt_create(struct drm_device *dev, struct drm_i915_file_private *fpriv)
+{
+	struct i915_hw_ppgtt *ppgtt;
+	int ret;
+
+	ppgtt = kzalloc(sizeof(*ppgtt), GFP_KERNEL);
+	if (!ppgtt)
+		return ERR_PTR(-ENOMEM);
+
+	ret = i915_ppgtt_init(dev, ppgtt);
+	if (ret) {
+		kfree(ppgtt);
+		return ERR_PTR(ret);
+	}
+
+	ppgtt->file_priv = fpriv;
+
+	return ppgtt;
+}
+
 void  i915_ppgtt_release(struct kref *kref)
 {
 	struct i915_hw_ppgtt *ppgtt =
diff --git a/drivers/gpu/drm/i915/i915_gem_gtt.h b/drivers/gpu/drm/i915/i915_gem_gtt.h
index 380e034c66f8..0b04ef6167f8 100644
--- a/drivers/gpu/drm/i915/i915_gem_gtt.h
+++ b/drivers/gpu/drm/i915/i915_gem_gtt.h
@@ -34,6 +34,8 @@
 #ifndef __I915_GEM_GTT_H__
 #define __I915_GEM_GTT_H__
 
+struct drm_i915_file_private;
+
 typedef uint32_t gen6_gtt_pte_t;
 typedef uint64_t gen8_gtt_pte_t;
 typedef gen8_gtt_pte_t gen8_ppgtt_pde_t;
@@ -258,7 +260,7 @@ struct i915_hw_ppgtt {
 		dma_addr_t *gen8_pt_dma_addr[4];
 	};
 
-	struct intel_context *ctx;
+	struct drm_i915_file_private *file_priv;
 
 	int (*enable)(struct i915_hw_ppgtt *ppgtt);
 	int (*switch_mm)(struct i915_hw_ppgtt *ppgtt,
@@ -276,6 +278,8 @@ bool intel_enable_ppgtt(struct drm_device *dev, bool full);
 
 int i915_ppgtt_init(struct drm_device *dev, struct i915_hw_ppgtt *ppgtt);
 void i915_ppgtt_release(struct kref *kref);
+struct i915_hw_ppgtt *i915_ppgtt_create(struct drm_device *dev,
+					struct drm_i915_file_private *fpriv);
 static inline void i915_ppgtt_get(struct i915_hw_ppgtt *ppgtt)
 {
 	if (ppgtt)
-- 
1.9.3

^ permalink raw reply related	[flat|nested] 31+ messages in thread

end of thread, other threads:[~2014-08-06  8:46 UTC | newest]

Thread overview: 31+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-07-30 19:41 [PATCH 1/7] drm/i915: Track file_priv, not ctx in the ppgtt structure Daniel Vetter
2014-07-30 19:41 ` [PATCH 2/7] drm/i915: Only refcount ppgtt if it actually is one Daniel Vetter
2014-07-31  6:52   ` Chris Wilson
2014-07-31  7:39     ` Daniel Vetter
2014-07-31  8:18       ` Daniel Vetter
2014-07-30 19:42 ` [PATCH 3/7] drm/i915: Add proper prefix to obj_to_ggtt Daniel Vetter
2014-07-31 11:43   ` Thierry, Michel
2014-07-30 19:42 ` [PATCH 4/7] drm/i915: Allow i915_gem_setup_global_gtt to fail Daniel Vetter
2014-07-31  6:49   ` Chris Wilson
2014-07-30 19:42 ` [PATCH 5/7] drm/i915: Initialize the aliasing ppgtt as part of global gtt Daniel Vetter
2014-07-31  3:46   ` Ben Widawsky
2014-07-31  3:47     ` Ben Widawsky
2014-07-31  3:48       ` Ben Widawsky
2014-07-31  9:10       ` Daniel Vetter
2014-07-31 15:47   ` Thierry, Michel
2014-07-31 16:15   ` Ville Syrjälä
2014-08-01  9:54     ` Thierry, Michel
2014-08-04 15:38       ` Daniel Vetter
2014-08-04  8:17     ` Daniel Vetter
2014-08-04 14:18   ` [PATCH] " Daniel Vetter
2014-08-06  8:18     ` Thierry, Michel
2014-08-06  8:30       ` Daniel Vetter
2014-08-06  8:44         ` Thierry, Michel
2014-08-06  8:46           ` Daniel Vetter
2014-07-30 19:42 ` [PATCH 6/7] drm/i915: Only track real ppgtt for a context Daniel Vetter
2014-07-30 21:11   ` Daniel Vetter
2014-08-04 14:20   ` [PATCH] " Daniel Vetter
2014-08-04 17:17     ` Thierry, Michel
2014-08-04 17:56     ` Daniel Vetter
2014-07-30 19:42 ` [PATCH 7/7] drm/i915: Drop create_vm argument to i915_gem_create_context Daniel Vetter
2014-07-31  9:33 ` [PATCH 1/7] drm/i915: Track file_priv, not ctx in the ppgtt structure Thierry, Michel

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.