Message ID | 1426768264-16996-39-git-send-email-John.C.Harrison@Intel.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
On 19/03/2015 12:30, John.C.Harrison@Intel.com wrote: > From: John Harrison <John.C.Harrison@Intel.com> > > 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: John Harrison <John.C.Harrison@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 f615fca..35116d3 100644 > --- a/drivers/gpu/drm/i915/i915_gem_context.c > +++ b/drivers/gpu/drm/i915/i915_gem_context.c > @@ -595,7 +595,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, 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 ac63572..96fd8e0 100644 > --- a/drivers/gpu/drm/i915/i915_gem_gtt.c > +++ b/drivers/gpu/drm/i915/i915_gem_gtt.c > @@ -374,9 +374,10 @@ static struct i915_page_directory_entry *alloc_pd_single(void) > } > > /* 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); > @@ -397,7 +398,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; > > @@ -406,7 +407,7 @@ static int gen8_mm_switch(struct i915_hw_ppgtt *ppgtt, > > for (i = used_pd - 1; i >= 0; i--) { > dma_addr_t addr = ppgtt->pdp.page_directory[i]->daddr; > - ret = gen8_write_pdp(ring, i, addr); > + ret = gen8_write_pdp(req, i, addr); > if (ret) > return ret; > } > @@ -878,8 +879,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 */ > @@ -903,8 +905,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); > @@ -913,8 +916,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 */ > @@ -945,8 +949,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; > > @@ -1312,7 +1317,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 d4c7184..8490ff5 100644 > --- a/drivers/gpu/drm/i915/i915_gem_gtt.h > +++ b/drivers/gpu/drm/i915/i915_gem_gtt.h > @@ -300,7 +300,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); > }; > > Reviewed-by: Tomas Elf <tomas.elf@intel.com> Thanks, Tomas
diff --git a/drivers/gpu/drm/i915/i915_gem_context.c b/drivers/gpu/drm/i915/i915_gem_context.c index f615fca..35116d3 100644 --- a/drivers/gpu/drm/i915/i915_gem_context.c +++ b/drivers/gpu/drm/i915/i915_gem_context.c @@ -595,7 +595,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, 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 ac63572..96fd8e0 100644 --- a/drivers/gpu/drm/i915/i915_gem_gtt.c +++ b/drivers/gpu/drm/i915/i915_gem_gtt.c @@ -374,9 +374,10 @@ static struct i915_page_directory_entry *alloc_pd_single(void) } /* 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); @@ -397,7 +398,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; @@ -406,7 +407,7 @@ static int gen8_mm_switch(struct i915_hw_ppgtt *ppgtt, for (i = used_pd - 1; i >= 0; i--) { dma_addr_t addr = ppgtt->pdp.page_directory[i]->daddr; - ret = gen8_write_pdp(ring, i, addr); + ret = gen8_write_pdp(req, i, addr); if (ret) return ret; } @@ -878,8 +879,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 */ @@ -903,8 +905,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); @@ -913,8 +916,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 */ @@ -945,8 +949,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; @@ -1312,7 +1317,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 d4c7184..8490ff5 100644 --- a/drivers/gpu/drm/i915/i915_gem_gtt.h +++ b/drivers/gpu/drm/i915/i915_gem_gtt.h @@ -300,7 +300,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); };