diff options
author | Chris Wilson <chris@chris-wilson.co.uk> | 2012-03-30 21:27:29 +0100 |
---|---|---|
committer | Chris Wilson <chris@chris-wilson.co.uk> | 2012-03-30 22:02:08 +0100 |
commit | 305734ebdf3d51c084cfbee8804b6c60b1f03a98 (patch) | |
tree | 9b6aca9fc282d3cee0286eb5d0ed3394681d8875 | |
parent | 6f2814db6f7b89e94e54b8d73c7e176ab7d1c469 (diff) |
sna: Separate out scanline waiting for gen4
So that we do not set a gen4 bit on gen2 and apply the old workaround of
trimming y2 instead.
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
-rw-r--r-- | src/sna/sna_display.c | 54 |
1 files changed, 37 insertions, 17 deletions
diff --git a/src/sna/sna_display.c b/src/sna/sna_display.c index ecfe6702..f413ac1e 100644 --- a/src/sna/sna_display.c +++ b/src/sna/sna_display.c @@ -2105,44 +2105,62 @@ static void sna_emit_wait_for_scanline_gen6(struct sna *sna, kgem_advance_batch(&sna->kgem, 4); } -static void sna_emit_wait_for_scanline_gen2(struct sna *sna, +static void sna_emit_wait_for_scanline_gen4(struct sna *sna, int pipe, int y1, int y2, bool full_height) { uint32_t event; uint32_t *b; - /* - * Pre-965 doesn't have SVBLANK, so we need a bit - * of extra time for the blitter to start up and - * do its job for a full height blit - */ if (pipe == 0) { - pipe = MI_LOAD_SCAN_LINES_DISPLAY_PIPEA; - event = MI_WAIT_FOR_PIPEA_SCAN_LINE_WINDOW; if (full_height) event = MI_WAIT_FOR_PIPEA_SVBLANK; + else + event = MI_WAIT_FOR_PIPEA_SCAN_LINE_WINDOW; } else { - pipe = MI_LOAD_SCAN_LINES_DISPLAY_PIPEB; - event = MI_WAIT_FOR_PIPEB_SCAN_LINE_WINDOW; if (full_height) event = MI_WAIT_FOR_PIPEB_SVBLANK; + else + event = MI_WAIT_FOR_PIPEB_SCAN_LINE_WINDOW; } - if (sna->kgem.mode == KGEM_NONE) - kgem_set_mode(&sna->kgem, KGEM_BLT); - + kgem_set_mode(&sna->kgem, KGEM_BLT); b = kgem_get_batch(&sna->kgem, 5); /* The documentation says that the LOAD_SCAN_LINES command * always comes in pairs. Don't ask me why. */ - b[0] = MI_LOAD_SCAN_LINES_INCL | pipe; - b[1] = (y1 << 16) | (y2-1); - b[2] = MI_LOAD_SCAN_LINES_INCL | pipe; - b[3] = (y1 << 16) | (y2-1); + b[2] = b[0] = MI_LOAD_SCAN_LINES_INCL | pipe << 20; + b[3] = b[1] = (y1 << 16) | (y2-1); b[4] = MI_WAIT_FOR_EVENT | event; kgem_advance_batch(&sna->kgem, 5); } +static void sna_emit_wait_for_scanline_gen2(struct sna *sna, + int pipe, int y1, int y2, + bool full_height) +{ + uint32_t *b; + + /* + * Pre-965 doesn't have SVBLANK, so we need a bit + * of extra time for the blitter to start up and + * do its job for a full height blit + */ + if (full_height) + y2 -= 2; + + kgem_set_mode(&sna->kgem, KGEM_BLT); + b = kgem_get_batch(&sna->kgem, 5); + /* The documentation says that the LOAD_SCAN_LINES command + * always comes in pairs. Don't ask me why. */ + b[2] = b[0] = MI_LOAD_SCAN_LINES_INCL | pipe << 20; + b[3] = b[1] = (y1 << 16) | (y2-1); + if (pipe == 0) + b[4] = MI_WAIT_FOR_EVENT | MI_WAIT_FOR_PIPEA_SCAN_LINE_WINDOW; + else + b[4] = MI_WAIT_FOR_EVENT | MI_WAIT_FOR_PIPEB_SCAN_LINE_WINDOW; + kgem_advance_batch(&sna->kgem, 5); +} + bool sna_wait_for_scanline(struct sna *sna, PixmapPtr pixmap, @@ -2202,6 +2220,8 @@ sna_wait_for_scanline(struct sna *sna, if (sna->kgem.gen >= 60) sna_emit_wait_for_scanline_gen6(sna, pipe, y1, y2, full_height); + else if (sna->kgem.gen >= 40) + sna_emit_wait_for_scanline_gen4(sna, pipe, y1, y2, full_height); else sna_emit_wait_for_scanline_gen2(sna, pipe, y1, y2, full_height); |