[Intel-gfx] [PATCH 45/49] drm/i915: Record the position of the start of the request
Chris Wilson
chris at chris-wilson.co.uk
Fri Mar 27 04:02:17 PDT 2015
Not only does it make for good documentation and debugging aide, but it
is also vital for when we want to unwind requests - such as when
throwing away an incomplete request.
Signed-off-by: Chris Wilson <chris at chris-wilson.co.uk>
---
drivers/gpu/drm/i915/i915_gem.c | 12 +++++++----
drivers/gpu/drm/i915/i915_gem_context.c | 9 +--------
drivers/gpu/drm/i915/intel_lrc.c | 36 +--------------------------------
drivers/gpu/drm/i915/intel_lrc.h | 2 --
drivers/gpu/drm/i915/intel_ringbuffer.c | 1 +
5 files changed, 11 insertions(+), 49 deletions(-)
diff --git a/drivers/gpu/drm/i915/i915_gem.c b/drivers/gpu/drm/i915/i915_gem.c
index 5fef69b2ce9f..706ec143ff1b 100644
--- a/drivers/gpu/drm/i915/i915_gem.c
+++ b/drivers/gpu/drm/i915/i915_gem.c
@@ -2406,7 +2406,6 @@ int __i915_add_request(struct intel_engine_cs *ring,
struct drm_i915_private *dev_priv = ring->dev->dev_private;
struct drm_i915_gem_request *request;
struct intel_ringbuffer *ringbuf;
- u32 request_start;
int ret;
request = ring->outstanding_lazy_request;
@@ -2421,7 +2420,6 @@ int __i915_add_request(struct intel_engine_cs *ring,
} else
ringbuf = ring->buffer;
- request_start = intel_ring_get_tail(ringbuf);
/*
* Emit any outstanding flushes - execbuf can fail to emit the flush
* after having emitted the batchbuffer command. Hence we need to fix
@@ -2449,7 +2447,6 @@ int __i915_add_request(struct intel_engine_cs *ring,
return ret;
}
- request->head = request_start;
request->tail = intel_ring_get_tail(ringbuf);
/* Whilst this request exists, batch_obj will be on the
@@ -2658,7 +2655,14 @@ static void i915_gem_reset_ring_cleanup(struct drm_i915_private *dev_priv,
}
/* This may not have been flushed before the reset, so clean it now */
- i915_gem_request_assign(&ring->outstanding_lazy_request, NULL);
+ if (ring->outstanding_lazy_request) {
+ struct drm_i915_gem_request *request;
+
+ request = ring->outstanding_lazy_request;
+ request->ringbuf->tail = request->head;
+
+ i915_gem_request_assign(&ring->outstanding_lazy_request, NULL);
+ }
}
void i915_gem_restore_fences(struct drm_device *dev)
diff --git a/drivers/gpu/drm/i915/i915_gem_context.c b/drivers/gpu/drm/i915/i915_gem_context.c
index b9c6b0ad1d0f..43e58249235b 100644
--- a/drivers/gpu/drm/i915/i915_gem_context.c
+++ b/drivers/gpu/drm/i915/i915_gem_context.c
@@ -298,15 +298,8 @@ void i915_gem_context_reset(struct drm_device *dev)
struct drm_i915_private *dev_priv = dev->dev_private;
int i;
- if (i915.enable_execlists) {
- struct intel_context *ctx;
-
- list_for_each_entry(ctx, &dev_priv->context_list, link) {
- intel_lr_context_reset(dev, ctx);
- }
-
+ if (i915.enable_execlists)
return;
- }
for (i = 0; i < I915_NUM_RINGS; i++) {
struct intel_engine_cs *ring = &dev_priv->ring[i];
diff --git a/drivers/gpu/drm/i915/intel_lrc.c b/drivers/gpu/drm/i915/intel_lrc.c
index 8fa44c3e8c3c..f4535832cf53 100644
--- a/drivers/gpu/drm/i915/intel_lrc.c
+++ b/drivers/gpu/drm/i915/intel_lrc.c
@@ -768,6 +768,7 @@ static int logical_ring_alloc_request(struct intel_engine_cs *ring,
request->ctx = ctx;
i915_gem_context_reference(request->ctx);
request->ringbuf = ctx->engine[ring->id].ringbuf;
+ request->head = intel_ring_get_tail(request->ringbuf);
ring->outstanding_lazy_request = request;
return 0;
@@ -1813,38 +1814,3 @@ error_unpin_ctx:
drm_gem_object_unreference(&ctx_obj->base);
return ret;
}
-
-void intel_lr_context_reset(struct drm_device *dev,
- struct intel_context *ctx)
-{
- struct drm_i915_private *dev_priv = dev->dev_private;
- struct intel_engine_cs *ring;
- int i;
-
- for_each_ring(ring, dev_priv, i) {
- struct drm_i915_gem_object *ctx_obj =
- ctx->engine[ring->id].state;
- struct intel_ringbuffer *ringbuf =
- ctx->engine[ring->id].ringbuf;
- uint32_t *reg_state;
- struct page *page;
-
- if (!ctx_obj)
- continue;
-
- if (i915_gem_object_get_pages(ctx_obj)) {
- WARN(1, "Failed get_pages for context obj\n");
- continue;
- }
- page = i915_gem_object_get_page(ctx_obj, 1);
- reg_state = kmap_atomic(page);
-
- reg_state[CTX_RING_HEAD+1] = 0;
- reg_state[CTX_RING_TAIL+1] = 0;
-
- kunmap_atomic(reg_state);
-
- ringbuf->head = 0;
- ringbuf->tail = 0;
- }
-}
diff --git a/drivers/gpu/drm/i915/intel_lrc.h b/drivers/gpu/drm/i915/intel_lrc.h
index 03e69c8636b0..b276e00773d9 100644
--- a/drivers/gpu/drm/i915/intel_lrc.h
+++ b/drivers/gpu/drm/i915/intel_lrc.h
@@ -71,8 +71,6 @@ int intel_logical_ring_begin(struct intel_ringbuffer *ringbuf,
void intel_lr_context_free(struct intel_context *ctx);
int intel_lr_context_deferred_create(struct intel_context *ctx,
struct intel_engine_cs *ring);
-void intel_lr_context_reset(struct drm_device *dev,
- struct intel_context *ctx);
/* Execlists */
int intel_sanitize_enable_execlists(struct drm_device *dev, int enable_execlists);
diff --git a/drivers/gpu/drm/i915/intel_ringbuffer.c b/drivers/gpu/drm/i915/intel_ringbuffer.c
index f44e7be17104..984bfefb8373 100644
--- a/drivers/gpu/drm/i915/intel_ringbuffer.c
+++ b/drivers/gpu/drm/i915/intel_ringbuffer.c
@@ -2185,6 +2185,7 @@ intel_ring_alloc_request(struct intel_engine_cs *ring)
request->ring = ring;
request->ringbuf = ring->buffer;
+ request->head = intel_ring_get_tail(ring->buffer);
ret = i915_gem_get_seqno(ring->dev, &request->seqno);
if (ret) {
--
2.1.4
More information about the Intel-gfx
mailing list