On 19/02/2015 17:17, john.c.harri...@intel.com wrote:
From: John Harrison <john.c.harri...@intel.com>

Updated the switch_mm() code paths to take a request instead of a ring.


This commit message could be slightly clearer by saying specifically what you changed rather than using the blanket expression "paths". You could e.g. say that you changed the mm_switch virtual function implementations and the gen8_write_pdp helper function to take requests rather than rings.

v2: Rebased to newer tree.

For: VIZ-5115
Signed-off-by: John Harrison <john.c.harri...@intel.com>
---
  drivers/gpu/drm/i915/i915_gem_context.c |    2 +-
  drivers/gpu/drm/i915/i915_gem_gtt.c     |   23 ++++++++++++++---------
  drivers/gpu/drm/i915/i915_gem_gtt.h     |    2 +-
  3 files changed, 16 insertions(+), 11 deletions(-)

diff --git a/drivers/gpu/drm/i915/i915_gem_context.c 
b/drivers/gpu/drm/i915/i915_gem_context.c
index 9e66fac..816a442 100644
--- a/drivers/gpu/drm/i915/i915_gem_context.c
+++ b/drivers/gpu/drm/i915/i915_gem_context.c
@@ -591,7 +591,7 @@ static int do_switch(struct drm_i915_gem_request *req)

        if (to->ppgtt) {
                trace_switch_mm(ring, to);
-               ret = to->ppgtt->switch_mm(to->ppgtt, req->ring);
+               ret = to->ppgtt->switch_mm(to->ppgtt, req);
                if (ret)
                        goto unpin_out;
        }
diff --git a/drivers/gpu/drm/i915/i915_gem_gtt.c 
b/drivers/gpu/drm/i915/i915_gem_gtt.c
index cd00080..c3408f2 100644
--- a/drivers/gpu/drm/i915/i915_gem_gtt.c
+++ b/drivers/gpu/drm/i915/i915_gem_gtt.c
@@ -280,9 +280,10 @@ static gen6_gtt_pte_t iris_pte_encode(dma_addr_t addr,
  }

  /* Broadwell Page Directory Pointer Descriptors */
-static int gen8_write_pdp(struct intel_engine_cs *ring, unsigned entry,
-                          uint64_t val)
+static int gen8_write_pdp(struct drm_i915_gem_request *req, unsigned entry,
+                         uint64_t val)
  {
+       struct intel_engine_cs *ring = req->ring;
        int ret;

        BUG_ON(entry >= 4);
@@ -303,7 +304,7 @@ static int gen8_write_pdp(struct intel_engine_cs *ring, 
unsigned entry,
  }

  static int gen8_mm_switch(struct i915_hw_ppgtt *ppgtt,
-                         struct intel_engine_cs *ring)
+                         struct drm_i915_gem_request *req)
  {
        int i, ret;

@@ -312,7 +313,7 @@ static int gen8_mm_switch(struct i915_hw_ppgtt *ppgtt,

        for (i = used_pd - 1; i >= 0; i--) {
                dma_addr_t addr = ppgtt->pd_dma_addr[i];
-               ret = gen8_write_pdp(ring, i, addr);
+               ret = gen8_write_pdp(req, i, addr);
                if (ret)
                        return ret;
        }
@@ -777,8 +778,9 @@ static uint32_t get_pd_offset(struct i915_hw_ppgtt *ppgtt)
  }

  static int hsw_mm_switch(struct i915_hw_ppgtt *ppgtt,
-                        struct intel_engine_cs *ring)
+                        struct drm_i915_gem_request *req)
  {
+       struct intel_engine_cs *ring = req->ring;
        int ret;

        /* NB: TLBs must be flushed and invalidated before a switch */
@@ -802,8 +804,9 @@ static int hsw_mm_switch(struct i915_hw_ppgtt *ppgtt,
  }

  static int vgpu_mm_switch(struct i915_hw_ppgtt *ppgtt,
-                         struct intel_engine_cs *ring)
+                         struct drm_i915_gem_request *req)
  {
+       struct intel_engine_cs *ring = req->ring;
        struct drm_i915_private *dev_priv = to_i915(ppgtt->base.dev);

        I915_WRITE(RING_PP_DIR_DCLV(ring), PP_DIR_DCLV_2G);
@@ -812,8 +815,9 @@ static int vgpu_mm_switch(struct i915_hw_ppgtt *ppgtt,
  }

  static int gen7_mm_switch(struct i915_hw_ppgtt *ppgtt,
-                         struct intel_engine_cs *ring)
+                         struct drm_i915_gem_request *req)
  {
+       struct intel_engine_cs *ring = req->ring;
        int ret;

        /* NB: TLBs must be flushed and invalidated before a switch */
@@ -844,8 +848,9 @@ static int gen7_mm_switch(struct i915_hw_ppgtt *ppgtt,
  }

  static int gen6_mm_switch(struct i915_hw_ppgtt *ppgtt,
-                         struct intel_engine_cs *ring)
+                         struct drm_i915_gem_request *req)
  {
+       struct intel_engine_cs *ring = req->ring;
        struct drm_device *dev = ppgtt->base.dev;
        struct drm_i915_private *dev_priv = dev->dev_private;

@@ -1235,7 +1240,7 @@ int i915_ppgtt_init_ring(struct drm_i915_gem_request *req)
        if (!ppgtt)
                return 0;

-       return ppgtt->switch_mm(ppgtt, req->ring);
+       return ppgtt->switch_mm(ppgtt, req);
  }

  struct i915_hw_ppgtt *
diff --git a/drivers/gpu/drm/i915/i915_gem_gtt.h 
b/drivers/gpu/drm/i915/i915_gem_gtt.h
index e7e202f..073be7f 100644
--- a/drivers/gpu/drm/i915/i915_gem_gtt.h
+++ b/drivers/gpu/drm/i915/i915_gem_gtt.h
@@ -289,7 +289,7 @@ struct i915_hw_ppgtt {

        int (*enable)(struct i915_hw_ppgtt *ppgtt);
        int (*switch_mm)(struct i915_hw_ppgtt *ppgtt,
-                        struct intel_engine_cs *ring);
+                        struct drm_i915_gem_request *req);
        void (*debug_dump)(struct i915_hw_ppgtt *ppgtt, struct seq_file *m);
  };



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

Reply via email to