提交 e85b26dc 编写于 作者: J John Harrison 提交者: Daniel Vetter

drm/i915: Update switch_mm() to take a request structure

Updated the switch_mm() code paths to take a request instead of a ring. This
includes the myriad *_mm_switch functions themselves and a bunch of PDP related
helper functions.

v2: Rebased to newer tree.

For: VIZ-5115
Signed-off-by: NJohn Harrison <John.C.Harrison@Intel.com>
Reviewed-by: NTomas Elf <tomas.elf@intel.com>
Signed-off-by: NDaniel Vetter <daniel.vetter@ffwll.ch>
上级 4866d729
...@@ -652,7 +652,7 @@ static int do_switch(struct drm_i915_gem_request *req) ...@@ -652,7 +652,7 @@ static int do_switch(struct drm_i915_gem_request *req)
* Register Immediate commands in Ring Buffer before submitting * Register Immediate commands in Ring Buffer before submitting
* a context."*/ * a context."*/
trace_switch_mm(ring, to); trace_switch_mm(ring, to);
ret = to->ppgtt->switch_mm(to->ppgtt, ring); ret = to->ppgtt->switch_mm(to->ppgtt, req);
if (ret) if (ret)
goto unpin_out; goto unpin_out;
...@@ -703,7 +703,7 @@ static int do_switch(struct drm_i915_gem_request *req) ...@@ -703,7 +703,7 @@ static int do_switch(struct drm_i915_gem_request *req)
*/ */
if (needs_pd_load_post(ring, to, hw_flags)) { if (needs_pd_load_post(ring, to, hw_flags)) {
trace_switch_mm(ring, to); trace_switch_mm(ring, to);
ret = to->ppgtt->switch_mm(to->ppgtt, ring); ret = to->ppgtt->switch_mm(to->ppgtt, req);
/* The hardware context switch is emitted, but we haven't /* The hardware context switch is emitted, but we haven't
* actually changed the state - so it's probably safe to bail * actually changed the state - so it's probably safe to bail
* here. Still, let the user know something dangerous has * here. Still, let the user know something dangerous has
......
...@@ -452,10 +452,11 @@ static struct i915_page_directory *alloc_pd(struct drm_device *dev) ...@@ -452,10 +452,11 @@ static struct i915_page_directory *alloc_pd(struct drm_device *dev)
} }
/* Broadwell Page Directory Pointer Descriptors */ /* Broadwell Page Directory Pointer Descriptors */
static int gen8_write_pdp(struct intel_engine_cs *ring, static int gen8_write_pdp(struct drm_i915_gem_request *req,
unsigned entry, unsigned entry,
dma_addr_t addr) dma_addr_t addr)
{ {
struct intel_engine_cs *ring = req->ring;
int ret; int ret;
BUG_ON(entry >= 4); BUG_ON(entry >= 4);
...@@ -476,7 +477,7 @@ static int gen8_write_pdp(struct intel_engine_cs *ring, ...@@ -476,7 +477,7 @@ static int gen8_write_pdp(struct intel_engine_cs *ring,
} }
static int gen8_mm_switch(struct i915_hw_ppgtt *ppgtt, static int gen8_mm_switch(struct i915_hw_ppgtt *ppgtt,
struct intel_engine_cs *ring) struct drm_i915_gem_request *req)
{ {
int i, ret; int i, ret;
...@@ -485,7 +486,7 @@ static int gen8_mm_switch(struct i915_hw_ppgtt *ppgtt, ...@@ -485,7 +486,7 @@ static int gen8_mm_switch(struct i915_hw_ppgtt *ppgtt,
dma_addr_t pd_daddr = pd ? pd->daddr : ppgtt->scratch_pd->daddr; dma_addr_t pd_daddr = pd ? pd->daddr : ppgtt->scratch_pd->daddr;
/* The page directory might be NULL, but we need to clear out /* The page directory might be NULL, but we need to clear out
* whatever the previous context might have used. */ * whatever the previous context might have used. */
ret = gen8_write_pdp(ring, i, pd_daddr); ret = gen8_write_pdp(req, i, pd_daddr);
if (ret) if (ret)
return ret; return ret;
} }
...@@ -1062,8 +1063,9 @@ static uint32_t get_pd_offset(struct i915_hw_ppgtt *ppgtt) ...@@ -1062,8 +1063,9 @@ static uint32_t get_pd_offset(struct i915_hw_ppgtt *ppgtt)
} }
static int hsw_mm_switch(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; int ret;
/* NB: TLBs must be flushed and invalidated before a switch */ /* NB: TLBs must be flushed and invalidated before a switch */
...@@ -1087,8 +1089,9 @@ static int hsw_mm_switch(struct i915_hw_ppgtt *ppgtt, ...@@ -1087,8 +1089,9 @@ static int hsw_mm_switch(struct i915_hw_ppgtt *ppgtt,
} }
static int vgpu_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); struct drm_i915_private *dev_priv = to_i915(ppgtt->base.dev);
I915_WRITE(RING_PP_DIR_DCLV(ring), PP_DIR_DCLV_2G); I915_WRITE(RING_PP_DIR_DCLV(ring), PP_DIR_DCLV_2G);
...@@ -1097,8 +1100,9 @@ static int vgpu_mm_switch(struct i915_hw_ppgtt *ppgtt, ...@@ -1097,8 +1100,9 @@ static int vgpu_mm_switch(struct i915_hw_ppgtt *ppgtt,
} }
static int gen7_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; int ret;
/* NB: TLBs must be flushed and invalidated before a switch */ /* NB: TLBs must be flushed and invalidated before a switch */
...@@ -1129,8 +1133,9 @@ static int gen7_mm_switch(struct i915_hw_ppgtt *ppgtt, ...@@ -1129,8 +1133,9 @@ static int gen7_mm_switch(struct i915_hw_ppgtt *ppgtt,
} }
static int gen6_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_device *dev = ppgtt->base.dev;
struct drm_i915_private *dev_priv = dev->dev_private; struct drm_i915_private *dev_priv = dev->dev_private;
...@@ -1582,7 +1587,7 @@ int i915_ppgtt_init_ring(struct drm_i915_gem_request *req) ...@@ -1582,7 +1587,7 @@ int i915_ppgtt_init_ring(struct drm_i915_gem_request *req)
if (!ppgtt) if (!ppgtt)
return 0; return 0;
return ppgtt->switch_mm(ppgtt, req->ring); return ppgtt->switch_mm(ppgtt, req);
} }
struct i915_hw_ppgtt * struct i915_hw_ppgtt *
......
...@@ -338,7 +338,7 @@ struct i915_hw_ppgtt { ...@@ -338,7 +338,7 @@ struct i915_hw_ppgtt {
int (*enable)(struct i915_hw_ppgtt *ppgtt); int (*enable)(struct i915_hw_ppgtt *ppgtt);
int (*switch_mm)(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); void (*debug_dump)(struct i915_hw_ppgtt *ppgtt, struct seq_file *m);
}; };
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册