diff options
author | Chris Wilson <chris@chris-wilson.co.uk> | 2011-10-31 10:04:35 +0000 |
---|---|---|
committer | Chris Wilson <chris@chris-wilson.co.uk> | 2011-10-31 10:05:43 +0000 |
commit | 088728ad26c7efc2d65b97ff22d526c65a0fa442 (patch) | |
tree | 721f869cf309d2228295d0c9203d540f285bf698 | |
parent | 9c399c74adc5e5bc7d425382a74d84315d2cef02 (diff) |
sna/blt: Don't idiotically override alu for pixel==0 and track alu
Another classic and utterly stupid mistake. At least I was consistent in
my error.
Reported-by: Clemens Eisserer <linuxhippy@gmail.com>
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=42414
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
-rw-r--r-- | src/sna/sna.h | 1 | ||||
-rw-r--r-- | src/sna/sna_accel.c | 11 | ||||
-rw-r--r-- | src/sna/sna_blt.c | 16 |
3 files changed, 17 insertions, 11 deletions
diff --git a/src/sna/sna.h b/src/sna/sna.h index 4ed3fb88..f045fa50 100644 --- a/src/sna/sna.h +++ b/src/sna/sna.h @@ -252,6 +252,7 @@ struct sna { struct { uint32_t fill_bo; uint32_t fill_pixel; + uint32_t fill_alu; } blt_state; union { struct gen2_render_state gen2; diff --git a/src/sna/sna_accel.c b/src/sna/sna_accel.c index f6095b5e..4cbd1942 100644 --- a/src/sna/sna_accel.c +++ b/src/sna/sna_accel.c @@ -3439,7 +3439,8 @@ sna_poly_segment_blt(DrawablePtr drawable, struct sna_fill_op fill; int16_t dx, dy; - DBG(("%s: alu=%d, fg=%08lx\n", __FUNCTION__, gc->alu, gc->fgPixel)); + DBG(("%s: n=%d, alu=%d, fg=%08lx, clipped=%d\n", + __FUNCTION__, n, gc->alu, gc->fgPixel, clipped)); if (!sna_fill_init_blt(&fill, sna, pixmap, bo, gc->alu, gc->fgPixel)) return FALSE; @@ -3456,7 +3457,7 @@ sna_poly_segment_blt(DrawablePtr drawable, nbox = ARRAY_SIZE(boxes); n -= nbox; do { - if (seg->x1 < seg->x2) { + if (seg->x1 <= seg->x2) { b->x1 = seg->x1; b->x2 = seg->x2; } else { @@ -3465,7 +3466,7 @@ sna_poly_segment_blt(DrawablePtr drawable, } b->x2++; - if (seg->y1 < seg->y2) { + if (seg->y1 <= seg->y2) { b->y1 = seg->y1; b->y2 = seg->y2; } else { @@ -3502,7 +3503,7 @@ sna_poly_segment_blt(DrawablePtr drawable, nbox = ARRAY_SIZE(boxes); n -= nbox; do { - if (seg->x1 < seg->x2) { + if (seg->x1 <= seg->x2) { b->x1 = seg->x1; b->x2 = seg->x2; } else { @@ -3511,7 +3512,7 @@ sna_poly_segment_blt(DrawablePtr drawable, } b->x2++; - if (seg->y1 < seg->y2) { + if (seg->y1 <= seg->y2) { b->y1 = seg->y1; b->y2 = seg->y2; } else { diff --git a/src/sna/sna_blt.c b/src/sna/sna_blt.c index 1630b35f..2ae4ac06 100644 --- a/src/sna/sna_blt.c +++ b/src/sna/sna_blt.c @@ -140,8 +140,8 @@ static bool sna_blt_fill_init(struct sna *sna, if (pitch > MAXSHORT) return FALSE; - if (pixel == 0) - alu = GXclear; + if (alu == GXclear) + pixel = 0; blt->br13 = 1<<31 | (fill_ROP[alu] << 16) | pitch; switch (bpp) { @@ -162,7 +162,8 @@ static bool sna_blt_fill_init(struct sna *sna, } if (sna->blt_state.fill_bo != bo->handle || - sna->blt_state.fill_pixel != pixel) + sna->blt_state.fill_pixel != pixel || + sna->blt_state.fill_alu != alu) { uint32_t *b; @@ -191,6 +192,7 @@ static bool sna_blt_fill_init(struct sna *sna, sna->blt_state.fill_bo = bo->handle; sna->blt_state.fill_pixel = pixel; + sna->blt_state.fill_alu = alu; } return TRUE; @@ -1608,8 +1610,8 @@ Bool sna_blt_fill_boxes(struct sna *sna, uint8_t alu, if (br13 > MAXSHORT) return FALSE; - if (pixel == 0) - alu = GXclear; + if (alu == GXclear) + pixel = 0; br13 |= 1<<31 | fill_ROP[alu] << 16; switch (bpp) { @@ -1627,7 +1629,8 @@ Bool sna_blt_fill_boxes(struct sna *sna, uint8_t alu, } if (sna->blt_state.fill_bo != bo->handle || - sna->blt_state.fill_pixel != pixel) + sna->blt_state.fill_pixel != pixel || + sna->blt_state.fill_alu != alu) { uint32_t *b; @@ -1656,6 +1659,7 @@ Bool sna_blt_fill_boxes(struct sna *sna, uint8_t alu, sna->blt_state.fill_bo = bo->handle; sna->blt_state.fill_pixel = pixel; + sna->blt_state.fill_alu = alu; } do { |