[PATCH 36/51] drm/i915: Update switch_mm() to take a request structure

John.C.Harrison
2015-02-13T11:49:40Z

From: John Harrison <John.C.Harrison@Intel.com>

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

For: VIZ-5115
Signed-off-by: John Harrison <John.C.Harrison@Intel.com>
---
drivers/gpu/drm/i915/i915_gem_context.c | 2 +-
drivers/gpu/drm/i915/i915_gem_gtt.c | 20 ++++++++++++--------
drivers/gpu/drm/i915/i915_gem_gtt.h | 2 +-
3 files changed, 14 insertions(+), 10 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 e7c9137..89bbc2c 100644
--- a/drivers/gpu/drm/i915/i915_gem_gtt.c
+++ b/drivers/gpu/drm/i915/i915_gem_gtt.c
@@ -276,9 +276,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);
@@ -299,7 +300,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;

@@ -308,7 +309,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;
}
@@ -773,8 +774,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 */
@@ -798,8 +800,9 @@ static int hsw_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 */
@@ -830,8 +833,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;

@@ -1215,7 +1219,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 0804bbc..96a58d4 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);
};

--
1.7.9.5