From b310a0fd229b092e68ad254e4e0e724f30ba148a Mon Sep 17 00:00:00 2001 From: Chris Wilson Date: Sat, 20 Jul 2013 22:30:58 +0100 Subject: [PATCH] read-after-write --- src/sna/sna_display.c | 27 ++++++++++++++++++--------- 1 file changed, 18 insertions(+), 9 deletions(-) diff --git a/src/sna/sna_display.c b/src/sna/sna_display.c index e036e94..a7dd6f7 100644 --- a/src/sna/sna_display.c +++ b/src/sna/sna_display.c @@ -3316,6 +3316,7 @@ static bool sna_emit_wait_for_scanline_hsw(struct sna *sna, } #define MI_LOAD_REGISTER_IMM (0x22<<23) +#define MI_STORE_REGISTER_MEM (0x24<<23) static bool sna_emit_wait_for_scanline_ivb(struct sna *sna, xf86CrtcPtr crtc, @@ -3413,19 +3414,27 @@ static bool sna_emit_wait_for_scanline_gen6(struct sna *sna, event = 1 << (3*full_height + pipe*8); b = kgem_get_batch(&sna->kgem); - sna->kgem.nbatch += 10; - b[0] = MI_LOAD_REGISTER_IMM | 1; + b[0] = MI_STORE_REGISTER_MEM | 1 << 22 | 1; b[1] = 0x44050; /* DERRMR */ - b[2] = ~event; + b[2] = kgem_add_reloc(&sna->kgem, sna->kgem.nbatch + 2, + 0, I915_GEM_DOMAIN_RENDER, 8); b[3] = MI_LOAD_REGISTER_IMM | 1; - b[4] = 0x4f100; /* magic */ - b[5] = (1 << 31) | (1 << 30) | pipe << 29 | (y1 << 16) | y2; - b[6] = MI_WAIT_FOR_EVENT | event; - b[7] = MI_LOAD_REGISTER_IMM | 1; - b[8] = 0x44050; /* DERRMR */ - b[9] = ~0; + b[4] = 0x44050; /* DERRMR */ + b[5] = ~event; + b[6] = MI_STORE_REGISTER_MEM | 1 << 22 | 1; + b[7] = 0x44050; /* DERRMR */ + b[8] = kgem_add_reloc(&sna->kgem, sna->kgem.nbatch + 8, + 0, I915_GEM_DOMAIN_RENDER, 32); + b[9] = MI_LOAD_REGISTER_IMM | 1; + b[10] = 0x4f100; /* magic */ + b[11] = (1 << 31) | (1 << 30) | pipe << 29 | (y1 << 16) | y2; + b[12] = MI_WAIT_FOR_EVENT | event; + b[13] = MI_LOAD_REGISTER_IMM | 1; + b[14] = 0x44050; /* DERRMR */ + b[15] = ~0; + sna->kgem.nbatch += 16; sna->kgem.batch_flags |= I915_EXEC_SECURE; return true; } -- 1.8.3.2