提交 0eb973d3 编写于 作者: T Tvrtko Ursulin

drm/i915: Cache ringbuffer GTT VMA

Purpose is to avoid calling i915_gem_obj_ggtt_offset from the
interrupt context without the big lock held.

v2: Renamed gtt_start to gtt_offset. (Daniel Vetter)
v3: Cache the VMA instead of address. (Chris Wilson)
Signed-off-by: NTvrtko Ursulin <tvrtko.ursulin@intel.com>
Reviewed-by: NChris Wilson <chris@chris-wilson.co.uk>
Cc: Daniel Vetter <daniel.vetter@ffwll.ch>
Cc: Chris Wilson <chris@chris-wilson.co.uk>
Link: http://patchwork.freedesktop.org/patch/msgid/1452870629-13830-2-git-send-email-tvrtko.ursulin@linux.intel.com
上级 ca82580c
...@@ -391,7 +391,6 @@ static int execlists_update_context(struct drm_i915_gem_request *rq) ...@@ -391,7 +391,6 @@ static int execlists_update_context(struct drm_i915_gem_request *rq)
struct intel_engine_cs *ring = rq->ring; struct intel_engine_cs *ring = rq->ring;
struct i915_hw_ppgtt *ppgtt = rq->ctx->ppgtt; struct i915_hw_ppgtt *ppgtt = rq->ctx->ppgtt;
struct drm_i915_gem_object *ctx_obj = rq->ctx->engine[ring->id].state; struct drm_i915_gem_object *ctx_obj = rq->ctx->engine[ring->id].state;
struct drm_i915_gem_object *rb_obj = rq->ringbuf->obj;
struct page *page; struct page *page;
uint32_t *reg_state; uint32_t *reg_state;
...@@ -401,7 +400,7 @@ static int execlists_update_context(struct drm_i915_gem_request *rq) ...@@ -401,7 +400,7 @@ static int execlists_update_context(struct drm_i915_gem_request *rq)
reg_state = kmap_atomic(page); reg_state = kmap_atomic(page);
reg_state[CTX_RING_TAIL+1] = rq->tail; reg_state[CTX_RING_TAIL+1] = rq->tail;
reg_state[CTX_RING_BUFFER_START+1] = i915_gem_obj_ggtt_offset(rb_obj); reg_state[CTX_RING_BUFFER_START+1] = rq->ringbuf->vma->node.start;
if (ppgtt && !USES_FULL_48BIT_PPGTT(ppgtt->base.dev)) { if (ppgtt && !USES_FULL_48BIT_PPGTT(ppgtt->base.dev)) {
/* True 32b PPGTT with dynamic page allocation: update PDP /* True 32b PPGTT with dynamic page allocation: update PDP
......
...@@ -1999,6 +1999,7 @@ void intel_unpin_ringbuffer_obj(struct intel_ringbuffer *ringbuf) ...@@ -1999,6 +1999,7 @@ void intel_unpin_ringbuffer_obj(struct intel_ringbuffer *ringbuf)
else else
iounmap(ringbuf->virtual_start); iounmap(ringbuf->virtual_start);
ringbuf->virtual_start = NULL; ringbuf->virtual_start = NULL;
ringbuf->vma = NULL;
i915_gem_object_ggtt_unpin(ringbuf->obj); i915_gem_object_ggtt_unpin(ringbuf->obj);
} }
...@@ -2065,6 +2066,8 @@ int intel_pin_and_map_ringbuffer_obj(struct drm_device *dev, ...@@ -2065,6 +2066,8 @@ int intel_pin_and_map_ringbuffer_obj(struct drm_device *dev,
} }
} }
ringbuf->vma = i915_gem_obj_to_ggtt(obj);
return 0; return 0;
} }
......
...@@ -99,6 +99,7 @@ struct intel_ring_hangcheck { ...@@ -99,6 +99,7 @@ struct intel_ring_hangcheck {
struct intel_ringbuffer { struct intel_ringbuffer {
struct drm_i915_gem_object *obj; struct drm_i915_gem_object *obj;
void __iomem *virtual_start; void __iomem *virtual_start;
struct i915_vma *vma;
struct intel_engine_cs *ring; struct intel_engine_cs *ring;
struct list_head link; struct list_head link;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册