From c6c7e481ca05e97b24d3e5a6036835fdc562f5a1 Mon Sep 17 00:00:00 2001 From: Chris Wilson Date: Sat, 20 Jul 2013 22:33:00 +0100 Subject: [PATCH] read-after-write --- drivers/gpu/drm/i915/i915_reg.h | 1 + drivers/gpu/drm/i915/intel_ringbuffer.c | 14 +++++++++----- 2 files changed, 10 insertions(+), 5 deletions(-) diff --git a/drivers/gpu/drm/i915/i915_reg.h b/drivers/gpu/drm/i915/i915_reg.h index b9594850..561a907 100644 --- a/drivers/gpu/drm/i915/i915_reg.h +++ b/drivers/gpu/drm/i915/i915_reg.h @@ -239,6 +239,7 @@ * address/value pairs. Don't overdue it, though, x <= 2^4 must hold! */ #define MI_LOAD_REGISTER_IMM(x) MI_INSTR(0x22, 2*x-1) +#define MI_STORE_REGISTER_MEM(x) MI_INSTR(0x24, 2*x-1) #define MI_FLUSH_DW MI_INSTR(0x26, 1) /* for GEN6 */ #define MI_FLUSH_DW_STORE_INDEX (1<<21) #define MI_INVALIDATE_TLB (1<<18) diff --git a/drivers/gpu/drm/i915/intel_ringbuffer.c b/drivers/gpu/drm/i915/intel_ringbuffer.c index 8527ea0..b4b5e5f 100644 --- a/drivers/gpu/drm/i915/intel_ringbuffer.c +++ b/drivers/gpu/drm/i915/intel_ringbuffer.c @@ -623,16 +623,21 @@ static void update_mboxes(struct intel_ring_buffer *ring, u32 mmio_offset) { + struct drm_i915_private *dev_priv = ring->dev->dev_private; + struct pipe_control *pc = dev_priv->ring[RCS].private; + /* NB: In order to be able to do semaphore MBOX updates for varying number * of rings, it's easiest if we round up each individual update to a * multiple of 2 (since ring updates must always be a multiple of 2) * even though the actual update only requires 3 dwords. */ -#define MBOX_UPDATE_DWORDS 4 +#define MBOX_UPDATE_DWORDS 6 intel_ring_emit(ring, MI_LOAD_REGISTER_IMM(1)); intel_ring_emit(ring, mmio_offset); intel_ring_emit(ring, ring->outstanding_lazy_request); - intel_ring_emit(ring, MI_NOOP); + intel_ring_emit(ring, MI_STORE_REGISTER_MEM(1)); + intel_ring_emit(ring, mmio_offset); + intel_ring_emit(ring, pc->gtt_offset + 128); } /** @@ -652,9 +657,8 @@ gen6_add_request(struct intel_ring_buffer *ring) struct intel_ring_buffer *useless; int i, ret; - ret = intel_ring_begin(ring, ((I915_NUM_RINGS-1) * - MBOX_UPDATE_DWORDS) + - 4); + ret = intel_ring_begin(ring, + (I915_NUM_RINGS-1) * MBOX_UPDATE_DWORDS + 4); if (ret) return ret; #undef MBOX_UPDATE_DWORDS -- 1.8.3.2