From 3925414ac81d15c96e74a39774790111e6084aa5 Mon Sep 17 00:00:00 2001 From: Chris Wilson Date: Wed, 1 Feb 2012 21:21:06 +0000 Subject: [PATCH 1/2] drm/i915/ringbuffer: Pass seqno to ring->add_request and return acthd Signed-off-by: Chris Wilson --- drivers/gpu/drm/i915/i915_gem.c | 4 +- drivers/gpu/drm/i915/intel_ringbuffer.c | 34 ++++++++++++++---------------- drivers/gpu/drm/i915/intel_ringbuffer.h | 2 +- 3 files changed, 19 insertions(+), 21 deletions(-) diff --git a/drivers/gpu/drm/i915/i915_gem.c b/drivers/gpu/drm/i915/i915_gem.c index 51390b0..ff998ce 100644 --- a/drivers/gpu/drm/i915/i915_gem.c +++ b/drivers/gpu/drm/i915/i915_gem.c @@ -1790,8 +1790,8 @@ i915_add_request(struct intel_ring_buffer *ring, BUG_ON(request == NULL); seqno = i915_gem_next_request_seqno(ring); - ret = ring->add_request(ring, &seqno); - if (ret) + ret = ring->add_request(ring, seqno); + if (ret < 0) return ret; trace_i915_gem_request_add(ring, seqno); diff --git a/drivers/gpu/drm/i915/intel_ringbuffer.c b/drivers/gpu/drm/i915/intel_ringbuffer.c index 620b2ed..e53dd2d 100644 --- a/drivers/gpu/drm/i915/intel_ringbuffer.c +++ b/drivers/gpu/drm/i915/intel_ringbuffer.c @@ -438,16 +438,16 @@ update_semaphore(struct intel_ring_buffer *ring, int i, u32 seqno) static int gen6_add_request(struct intel_ring_buffer *ring, - u32 *result) + u32 seqno) { - u32 seqno; int ret; ret = intel_ring_begin(ring, 10); if (ret) return ret; - seqno = i915_gem_next_request_seqno(ring); + ret = ring->tail; + update_semaphore(ring, 0, seqno); update_semaphore(ring, 1, seqno); @@ -457,8 +457,7 @@ gen6_add_request(struct intel_ring_buffer *ring, intel_ring_emit(ring, MI_USER_INTERRUPT); intel_ring_advance(ring); - *result = seqno; - return 0; + return ret; } int @@ -497,9 +496,8 @@ do { \ static int pc_render_add_request(struct intel_ring_buffer *ring, - u32 *result) + u32 seqno) { - u32 seqno = i915_gem_next_request_seqno(ring); struct pipe_control *pc = ring->private; u32 scratch_addr = pc->gtt_offset + 128; int ret; @@ -533,6 +531,9 @@ pc_render_add_request(struct intel_ring_buffer *ring, PIPE_CONTROL_FLUSH(ring, scratch_addr); scratch_addr += 128; PIPE_CONTROL_FLUSH(ring, scratch_addr); + + ret = ring->tail; + intel_ring_emit(ring, GFX_OP_PIPE_CONTROL(4) | PIPE_CONTROL_QW_WRITE | PIPE_CONTROL_WRITE_FLUSH | PIPE_CONTROL_TEXTURE_CACHE_INVALIDATE | @@ -542,29 +543,28 @@ pc_render_add_request(struct intel_ring_buffer *ring, intel_ring_emit(ring, 0); intel_ring_advance(ring); - *result = seqno; - return 0; + return ret; } static int render_ring_add_request(struct intel_ring_buffer *ring, - u32 *result) + u32 seqno) { - u32 seqno = i915_gem_next_request_seqno(ring); int ret; ret = intel_ring_begin(ring, 4); if (ret) return ret; + ret = ring->tail; + intel_ring_emit(ring, MI_STORE_DWORD_INDEX); intel_ring_emit(ring, I915_GEM_HWS_INDEX << MI_STORE_DWORD_INDEX_SHIFT); intel_ring_emit(ring, seqno); intel_ring_emit(ring, MI_USER_INTERRUPT); intel_ring_advance(ring); - *result = seqno; - return 0; + return ret; } static u32 @@ -712,16 +712,15 @@ bsd_ring_flush(struct intel_ring_buffer *ring, static int ring_add_request(struct intel_ring_buffer *ring, - u32 *result) + u32 seqno) { - u32 seqno; int ret; ret = intel_ring_begin(ring, 4); if (ret) return ret; - seqno = i915_gem_next_request_seqno(ring); + ret = ring->tail; intel_ring_emit(ring, MI_STORE_DWORD_INDEX); intel_ring_emit(ring, I915_GEM_HWS_INDEX << MI_STORE_DWORD_INDEX_SHIFT); @@ -729,8 +728,7 @@ ring_add_request(struct intel_ring_buffer *ring, intel_ring_emit(ring, MI_USER_INTERRUPT); intel_ring_advance(ring); - *result = seqno; - return 0; + return ret; } static bool diff --git a/drivers/gpu/drm/i915/intel_ringbuffer.h b/drivers/gpu/drm/i915/intel_ringbuffer.h index 4c5338c..e1ded68 100644 --- a/drivers/gpu/drm/i915/intel_ringbuffer.h +++ b/drivers/gpu/drm/i915/intel_ringbuffer.h @@ -64,7 +64,7 @@ struct intel_ring_buffer { u32 invalidate_domains, u32 flush_domains); int (*add_request)(struct intel_ring_buffer *ring, - u32 *seqno); + u32 seqno); u32 (*get_seqno)(struct intel_ring_buffer *ring); int (*dispatch_execbuffer)(struct intel_ring_buffer *ring, u32 offset, u32 length); -- 1.7.8.3