[Intel-gfx] [PATCH v2 12/16] drm/i915: add batch object and context to i915_add_request()
Mika Kuoppala
mika.kuoppala at linux.intel.com
Thu Mar 14 16:52:13 CET 2013
In order to track down a batch buffer and context which
caused the ring to hang, store reference to bo and context
into the request struct. Request can also cause gpu to hang
after the batch in the flush section in the ring. To detect this
add start of the flush portion offset into the request.
Signed-off-by: Mika Kuoppala <mika.kuoppala at intel.com>
---
drivers/gpu/drm/i915/i915_drv.h | 13 ++++++++++---
drivers/gpu/drm/i915/i915_gem.c | 8 ++++++--
drivers/gpu/drm/i915/i915_gem_execbuffer.c | 7 ++++---
3 files changed, 20 insertions(+), 8 deletions(-)
diff --git a/drivers/gpu/drm/i915/i915_drv.h b/drivers/gpu/drm/i915/i915_drv.h
index 393f6a2..1a4cba0 100644
--- a/drivers/gpu/drm/i915/i915_drv.h
+++ b/drivers/gpu/drm/i915/i915_drv.h
@@ -1249,9 +1249,15 @@ struct drm_i915_gem_request {
/** GEM sequence number associated with this request. */
uint32_t seqno;
- /** Postion in the ringbuffer of the end of the request */
+ /** Position in the ringbuffer of the start of the request */
+ u32 head;
+
+ /** Position in the ringbuffer of the end of the request */
u32 tail;
+ /** Batch buffer related to this request if any */
+ struct drm_i915_gem_object *batch_obj;
+
/** Context related to this request */
struct i915_hw_context *ctx;
@@ -1647,9 +1653,10 @@ int __must_check i915_gem_idle(struct drm_device *dev);
int i915_do_add_request(struct intel_ring_buffer *ring,
u32 *seqno,
struct drm_file *file,
- struct i915_hw_context *ctx);
+ struct i915_hw_context *ctx,
+ struct drm_i915_gem_object *batch_obj);
#define i915_add_request(ring, seqno) \
- i915_do_add_request(ring, seqno, NULL, NULL)
+ i915_do_add_request(ring, seqno, NULL, NULL, NULL)
int __must_check i915_wait_seqno(struct intel_ring_buffer *ring,
uint32_t seqno);
int i915_gem_fault(struct vm_area_struct *vma, struct vm_fault *vmf);
diff --git a/drivers/gpu/drm/i915/i915_gem.c b/drivers/gpu/drm/i915/i915_gem.c
index e905086..fa7f446 100644
--- a/drivers/gpu/drm/i915/i915_gem.c
+++ b/drivers/gpu/drm/i915/i915_gem.c
@@ -1998,14 +1998,16 @@ int
i915_do_add_request(struct intel_ring_buffer *ring,
u32 *out_seqno,
struct drm_file *file,
- struct i915_hw_context *ctx)
+ struct i915_hw_context *ctx,
+ struct drm_i915_gem_object *obj)
{
drm_i915_private_t *dev_priv = ring->dev->dev_private;
struct drm_i915_gem_request *request;
- u32 request_ring_position;
+ u32 request_ring_position, request_start;
int was_empty;
int ret;
+ request_start = intel_ring_get_tail(ring);
/*
* Emit any outstanding flushes - execbuf can fail to emit the flush
* after having emitted the batchbuffer command. Hence we need to fix
@@ -2037,7 +2039,9 @@ i915_do_add_request(struct intel_ring_buffer *ring,
request->seqno = intel_ring_get_seqno(ring);
request->ring = ring;
+ request->head = request_start;
request->tail = request_ring_position;
+ request->batch_obj = obj;
request->ctx = ctx;
if (request->ctx)
diff --git a/drivers/gpu/drm/i915/i915_gem_execbuffer.c b/drivers/gpu/drm/i915/i915_gem_execbuffer.c
index 1b524e7..2f23013 100644
--- a/drivers/gpu/drm/i915/i915_gem_execbuffer.c
+++ b/drivers/gpu/drm/i915/i915_gem_execbuffer.c
@@ -794,13 +794,14 @@ static void
i915_gem_execbuffer_retire_commands(struct drm_device *dev,
struct drm_file *file,
struct intel_ring_buffer *ring,
- struct i915_hw_context *ctx)
+ struct i915_hw_context *ctx,
+ struct drm_i915_gem_object *obj)
{
/* Unconditionally force add_request to emit a full flush. */
ring->gpu_caches_dirty = true;
/* Add a breadcrumb for the completion of the batch buffer */
- (void)i915_do_add_request(ring, NULL, file, ctx);
+ (void)i915_do_add_request(ring, NULL, file, ctx, obj);
}
static int
@@ -1075,7 +1076,7 @@ i915_gem_do_execbuffer(struct drm_device *dev, void *data,
trace_i915_gem_ring_dispatch(ring, intel_ring_get_seqno(ring), flags);
i915_gem_execbuffer_move_to_active(&eb->objects, ring);
- i915_gem_execbuffer_retire_commands(dev, file, ring, ctx);
+ i915_gem_execbuffer_retire_commands(dev, file, ring, ctx, batch_obj);
err:
eb_destroy(eb);
--
1.7.9.5
More information about the Intel-gfx
mailing list