From 38ef572d68380db407039fe12d62426939030010 Mon Sep 17 00:00:00 2001 From: Chris Wilson Date: Thu, 21 Nov 2013 21:52:46 +0000 Subject: [PATCH] sna: XY_SETUP_* expects the dst tiling to be set on gen4+ A few paths failed to set the tiling flag when setting up the BLT engine, leaving the engine in a potentially inconsistent state. Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=71260 Signed-off-by: Chris Wilson --- src/sna/sna_accel.c | 32 ++++++++++++++++---------------- src/sna/sna_blt.c | 16 ++++++++++++++++ 2 files changed, 32 insertions(+), 16 deletions(-) diff --git a/src/sna/sna_accel.c b/src/sna/sna_accel.c index 75a6b27..7238cbe 100644 --- a/src/sna/sna_accel.c +++ b/src/sna/sna_accel.c @@ -11427,7 +11427,7 @@ sna_poly_fill_rect_tiled_8x8_blt(DrawablePtr drawable, assert(sna->kgem.mode == KGEM_BLT); b = sna->kgem.batch + sna->kgem.nbatch; if (sna->kgem.gen >= 0100) { - b[0] = XY_SETUP_BLT | 3 << 20 | 8; + b[0] = XY_SETUP_BLT | 3 << 20 | (br00 & BLT_DST_TILED) | 8; b[1] = br13; b[2] = 0; b[3] = 0; @@ -11446,7 +11446,7 @@ sna_poly_fill_rect_tiled_8x8_blt(DrawablePtr drawable, 0); sna->kgem.nbatch += 10; } else { - b[0] = XY_SETUP_BLT | 3 << 20 | 6; + b[0] = XY_SETUP_BLT | 3 << 20 | (br00 & BLT_DST_TILED) | 6; b[1] = br13; b[2] = 0; b[3] = 0; @@ -11512,7 +11512,7 @@ sna_poly_fill_rect_tiled_8x8_blt(DrawablePtr drawable, assert(sna->kgem.mode == KGEM_BLT); b = sna->kgem.batch + sna->kgem.nbatch; if (sna->kgem.gen >= 0100) { - b[0] = XY_SETUP_BLT | 3 << 20 | 8; + b[0] = XY_SETUP_BLT | 3 << 20 | (br00 & BLT_DST_TILED) | 8; b[1] = br13; b[2] = 0; b[3] = 0; @@ -11531,7 +11531,7 @@ sna_poly_fill_rect_tiled_8x8_blt(DrawablePtr drawable, 0); sna->kgem.nbatch += 10; } else { - b[0] = XY_SETUP_BLT | 3 << 20 | 6; + b[0] = XY_SETUP_BLT | 3 << 20 | (br00 & BLT_DST_TILED) | 6; b[1] = br13; b[2] = 0; b[3] = 0; @@ -11571,7 +11571,7 @@ sna_poly_fill_rect_tiled_8x8_blt(DrawablePtr drawable, assert(sna->kgem.mode == KGEM_BLT); b = sna->kgem.batch + sna->kgem.nbatch; if (sna->kgem.gen >= 0100) { - b[0] = XY_SETUP_BLT | 3 << 20 | 8; + b[0] = XY_SETUP_BLT | 3 << 20 | (br00 & BLT_DST_TILED) | 8; b[1] = br13; b[2] = 0; b[3] = 0; @@ -11590,7 +11590,7 @@ sna_poly_fill_rect_tiled_8x8_blt(DrawablePtr drawable, 0); sna->kgem.nbatch += 10; } else { - b[0] = XY_SETUP_BLT | 3 << 20 | 6; + b[0] = XY_SETUP_BLT | 3 << 20 | (br00 & BLT_DST_TILED) | 6; b[1] = br13; b[2] = 0; b[3] = 0; @@ -11665,7 +11665,7 @@ sna_poly_fill_rect_tiled_8x8_blt(DrawablePtr drawable, assert(sna->kgem.mode == KGEM_BLT); b = sna->kgem.batch + sna->kgem.nbatch; if (sna->kgem.gen >= 0100) { - b[0] = XY_SETUP_BLT | 3 << 20 | 8; + b[0] = XY_SETUP_BLT | 3 << 20 | (br00 & BLT_DST_TILED) | 8; b[1] = br13; b[2] = 0; b[3] = 0; @@ -11684,7 +11684,7 @@ sna_poly_fill_rect_tiled_8x8_blt(DrawablePtr drawable, 0); sna->kgem.nbatch += 10; } else { - b[0] = XY_SETUP_BLT | 3 << 20 | 6; + b[0] = XY_SETUP_BLT | 3 << 20 | (br00 & BLT_DST_TILED) | 6; b[1] = br13; b[2] = 0; b[3] = 0; @@ -12173,7 +12173,7 @@ sna_poly_fill_rect_stippled_8x8_blt(DrawablePtr drawable, assert(sna->kgem.mode == KGEM_BLT); b = sna->kgem.batch + sna->kgem.nbatch; if (sna->kgem.gen >= 0100) { - b[0] = XY_SETUP_MONO_PATTERN_SL_BLT | 3 << 20 | 8; + b[0] = XY_SETUP_MONO_PATTERN_SL_BLT | 3 << 20 | (br00 & BLT_DST_TILED) | 8; b[1] = br13; b[2] = 0; b[3] = 0; @@ -12189,7 +12189,7 @@ sna_poly_fill_rect_stippled_8x8_blt(DrawablePtr drawable, b[9] = pat[1]; sna->kgem.nbatch += 10; } else { - b[0] = XY_SETUP_MONO_PATTERN_SL_BLT | 3 << 20 | 7; + b[0] = XY_SETUP_MONO_PATTERN_SL_BLT | 3 << 20 | (br00 & BLT_DST_TILED) | 7; b[1] = br13; b[2] = 0; b[3] = 0; @@ -12245,7 +12245,7 @@ sna_poly_fill_rect_stippled_8x8_blt(DrawablePtr drawable, assert(sna->kgem.mode == KGEM_BLT); b = sna->kgem.batch + sna->kgem.nbatch; if (sna->kgem.gen >= 0100) { - b[0] = XY_SETUP_MONO_PATTERN_SL_BLT | 3 << 20 | 8; + b[0] = XY_SETUP_MONO_PATTERN_SL_BLT | 3 << 20 | (br00 & BLT_DST_TILED) | 8; b[1] = br13; b[2] = 0; b[3] = 0; @@ -12261,7 +12261,7 @@ sna_poly_fill_rect_stippled_8x8_blt(DrawablePtr drawable, b[9] = pat[1]; sna->kgem.nbatch += 10; } else { - b[0] = XY_SETUP_MONO_PATTERN_SL_BLT | 3 << 20 | 7; + b[0] = XY_SETUP_MONO_PATTERN_SL_BLT | 3 << 20 | (br00 & BLT_DST_TILED) | 7; b[1] = br13; b[2] = 0; b[3] = 0; @@ -12295,7 +12295,7 @@ sna_poly_fill_rect_stippled_8x8_blt(DrawablePtr drawable, assert(sna->kgem.mode == KGEM_BLT); b = sna->kgem.batch + sna->kgem.nbatch; if (sna->kgem.gen >= 0100) { - b[0] = XY_SETUP_MONO_PATTERN_SL_BLT | 3 << 20 | 8; + b[0] = XY_SETUP_MONO_PATTERN_SL_BLT | 3 << 20 | (br00 & BLT_DST_TILED) | 8; b[1] = br13; b[2] = 0; b[3] = 0; @@ -12311,7 +12311,7 @@ sna_poly_fill_rect_stippled_8x8_blt(DrawablePtr drawable, b[9] = pat[1]; sna->kgem.nbatch += 10; } else { - b[0] = XY_SETUP_MONO_PATTERN_SL_BLT | 3 << 20 | 7; + b[0] = XY_SETUP_MONO_PATTERN_SL_BLT | 3 << 20 | (br00 & BLT_DST_TILED) | 7; b[1] = br13; b[2] = 0; b[3] = 0; @@ -12367,7 +12367,7 @@ sna_poly_fill_rect_stippled_8x8_blt(DrawablePtr drawable, assert(sna->kgem.mode == KGEM_BLT); b = sna->kgem.batch + sna->kgem.nbatch; if (sna->kgem.gen >= 0100) { - b[0] = XY_SETUP_MONO_PATTERN_SL_BLT | 3 << 20 | 8; + b[0] = XY_SETUP_MONO_PATTERN_SL_BLT | 3 << 20 | (br00 & BLT_DST_TILED) | 8; b[1] = br13; b[2] = 0; b[3] = 0; @@ -12383,7 +12383,7 @@ sna_poly_fill_rect_stippled_8x8_blt(DrawablePtr drawable, b[9] = pat[1]; sna->kgem.nbatch += 10; } else { - b[0] = XY_SETUP_MONO_PATTERN_SL_BLT | 3 << 20 | 7; + b[0] = XY_SETUP_MONO_PATTERN_SL_BLT | 3 << 20 | (br00 & BLT_DST_TILED) | 7; b[1] = br13; b[2] = 0; b[3] = 0; diff --git a/src/sna/sna_blt.c b/src/sna/sna_blt.c index 17a785c..8f7b8a3 100644 --- a/src/sna/sna_blt.c +++ b/src/sna/sna_blt.c @@ -186,6 +186,8 @@ static bool sna_blt_fill_init(struct sna *sna, b[0] = XY_SETUP_MONO_PATTERN_SL_BLT | 8; if (bpp == 32) b[0] |= BLT_WRITE_ALPHA | BLT_WRITE_RGB; + if (bo->tiling) + b[0] |= BLT_DST_TILED; b[1] = blt->br13; b[2] = 0; b[3] = 0; @@ -204,6 +206,8 @@ static bool sna_blt_fill_init(struct sna *sna, b[0] = XY_SETUP_MONO_PATTERN_SL_BLT | 7; if (bpp == 32) b[0] |= BLT_WRITE_ALPHA | BLT_WRITE_RGB; + if (bo->tiling) + b[0] |= BLT_DST_TILED; b[1] = blt->br13; b[2] = 0; b[3] = 0; @@ -246,6 +250,8 @@ noinline static void sna_blt_fill_begin(struct sna *sna, b[0] = XY_SETUP_MONO_PATTERN_SL_BLT | 8; if (blt->bpp == 32) b[0] |= BLT_WRITE_ALPHA | BLT_WRITE_RGB; + if (blt->bo[0]->tiling) + b[0] |= BLT_DST_TILED; b[1] = blt->br13; b[2] = 0; b[3] = 0; @@ -264,6 +270,8 @@ noinline static void sna_blt_fill_begin(struct sna *sna, b[0] = XY_SETUP_MONO_PATTERN_SL_BLT | 7; if (blt->bpp == 32) b[0] |= BLT_WRITE_ALPHA | BLT_WRITE_RGB; + if (blt->bo[0]->tiling) + b[0] |= BLT_DST_TILED; b[1] = blt->br13; b[2] = 0; b[3] = 0; @@ -3081,6 +3089,8 @@ bool sna_blt_fill_boxes(struct sna *sna, uint8_t alu, b[0] = XY_SETUP_MONO_PATTERN_SL_BLT | 8; if (bpp == 32) b[0] |= BLT_WRITE_ALPHA | BLT_WRITE_RGB; + if (bo->tiling) + b[0] |= BLT_DST_TILED; b[1] = br13; b[2] = 0; b[3] = 0; @@ -3099,6 +3109,8 @@ bool sna_blt_fill_boxes(struct sna *sna, uint8_t alu, b[0] = XY_SETUP_MONO_PATTERN_SL_BLT | 7; if (bpp == 32) b[0] |= BLT_WRITE_ALPHA | BLT_WRITE_RGB; + if (bo->tiling) + b[0] |= BLT_DST_TILED; b[1] = br13; b[2] = 0; b[3] = 0; @@ -3163,6 +3175,8 @@ bool sna_blt_fill_boxes(struct sna *sna, uint8_t alu, b[0] = XY_SETUP_MONO_PATTERN_SL_BLT | 8; if (bpp == 32) b[0] |= BLT_WRITE_ALPHA | BLT_WRITE_RGB; + if (bo->tiling) + b[0] |= BLT_DST_TILED; b[1] = br13; b[2] = 0; b[3] = 0; @@ -3181,6 +3195,8 @@ bool sna_blt_fill_boxes(struct sna *sna, uint8_t alu, b[0] = XY_SETUP_MONO_PATTERN_SL_BLT | 7; if (bpp == 32) b[0] |= BLT_WRITE_ALPHA | BLT_WRITE_RGB; + if (bo->tiling) + b[0] |= BLT_DST_TILED; b[1] = br13; b[2] = 0; b[3] = 0; -- 2.7.4