From 0809a90e38a32f4ddb03d7501daae8cb4aa76ad2 Mon Sep 17 00:00:00 2001 From: Chris Wilson Date: Thu, 10 Jan 2013 01:06:59 +0000 Subject: [PATCH] drm/i915: Read back semaphore mboxes after updating them The hope is that this causes the write to be flushed and land on the target. --- drivers/gpu/drm/i915/i915_reg.h | 2 ++ drivers/gpu/drm/i915/intel_ringbuffer.c | 20 ++++++++++++++++++++ 2 files changed, 22 insertions(+) diff --git a/drivers/gpu/drm/i915/i915_reg.h b/drivers/gpu/drm/i915/i915_reg.h index 2597cf9..a43bf2b 100644 --- a/drivers/gpu/drm/i915/i915_reg.h +++ b/drivers/gpu/drm/i915/i915_reg.h @@ -226,6 +226,8 @@ #define MI_MEM_VIRTUAL (1 << 22) /* 965+ only */ #define MI_STORE_DWORD_INDEX MI_INSTR(0x21, 1) #define MI_STORE_DWORD_INDEX_SHIFT 2 +#define MI_STORE_REG_MEM MI_INSTR(0x24, 1) +#define MI_STORE_GTT (1<<22) /* Official intel docs are somewhat sloppy concerning MI_LOAD_REGISTER_IMM: * - Always issue a MI_NOOP _before_ the MI_LOAD_REGISTER_IMM - otherwise hw * simply ignores the register load under certain conditions. diff --git a/drivers/gpu/drm/i915/intel_ringbuffer.c b/drivers/gpu/drm/i915/intel_ringbuffer.c index b2b2018..de06e35 100644 --- a/drivers/gpu/drm/i915/intel_ringbuffer.c +++ b/drivers/gpu/drm/i915/intel_ringbuffer.c @@ -565,6 +565,16 @@ update_mboxes(struct intel_ring_buffer *ring, intel_ring_emit(ring, ring->outstanding_lazy_request); } +static void +read_mboxes(struct intel_ring_buffer *ring, + u32 mmio_offset, + u32 address) +{ + intel_ring_emit(ring, MI_STORE_REG_MEM | MI_STORE_GTT); + intel_ring_emit(ring, mmio_offset); + intel_ring_emit(ring, ring->status_page.gfx_addr + address); +} + /** * gen6_add_request - Update the semaphore mailbox registers * @@ -596,6 +606,16 @@ gen6_add_request(struct intel_ring_buffer *ring) intel_ring_emit(ring, MI_USER_INTERRUPT); intel_ring_advance(ring); + if (IS_GEN6(ring->dev)) { + ret = intel_ring_begin(ring, 6); + if (ret) + return ret; + + read_mboxes(ring, mbox1_reg, 1024); + read_mboxes(ring, mbox2_reg, 1028); + intel_ring_advance(ring); + } + return 0; } -- 1.7.10.4