From 99132ce71ef174d28c0beb4aa875fe68be95f0b4 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 | 29 ++++++++++++++++++++--------- 1 file changed, 20 insertions(+), 9 deletions(-) diff --git a/src/sna/sna_display.c b/src/sna/sna_display.c index e036e94..7976cf9 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,29 @@ 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[1] = 0x44050; /* DERRMR */ b[2] = ~event; - 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[3] = MI_STORE_REGISTER_MEM | 1 << 22 | 1; + b[4] = 0x44050; /* DERRMR */ + b[5] = kgem_add_reloc(&sna->kgem, sna->kgem.nbatch + 5, + 0, I915_GEM_DOMAIN_RENDER, 0); + b[6] = MI_NOOP; + b[7] = MI_NOOP; + b[8] = MI_LOAD_REGISTER_IMM | 1; + b[9] = 0x4f100; /* magic */ + b[10] = (1 << 31) | (1 << 30) | pipe << 29 | (y1 << 16) | y2; + b[11] = MI_WAIT_FOR_EVENT | event; + b[12] = MI_LOAD_REGISTER_IMM | 1; + b[13] = 0x44050; /* DERRMR */ + b[14] = ~0; + b[15] = MI_STORE_REGISTER_MEM | 1 << 22 | 1; + b[16] = 0x44050; /* DERRMR */ + b[17] = kgem_add_reloc(&sna->kgem, sna->kgem.nbatch + 17, + 0, I915_GEM_DOMAIN_RENDER, 0); + + sna->kgem.nbatch += 18; sna->kgem.batch_flags |= I915_EXEC_SECURE; return true; } -- 1.8.3.2