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>
This commit is contained in:
Chris Wilson 2011-10-31 10:04:35 +00:00
parent 9c399c74ad
commit 088728ad26
3 changed files with 17 additions and 11 deletions

View File

@ -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;

View File

@ -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 {

View File

@ -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 {