sna: Apply the dst offset for pixman fills

Along one of the sw blt paths we failed to apply the offset for
Composite redirection.

Reported-by: Jiri Slaby <jirislaby@gmail.com>
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=73811
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
This commit is contained in:
Chris Wilson 2014-02-22 10:05:41 +00:00
parent 59d471de7f
commit 75cff26eba
1 changed files with 63 additions and 12 deletions

View File

@ -940,9 +940,9 @@ static void blt_composite_fill__cpu(struct sna *sna,
}
fastcall static void
blt_composite_fill_box__cpu(struct sna *sna,
const struct sna_composite_op *op,
const BoxRec *box)
blt_composite_fill_box_no_offset__cpu(struct sna *sna,
const struct sna_composite_op *op,
const BoxRec *box)
{
assert(box->x1 >= 0);
assert(box->y1 >= 0);
@ -957,9 +957,9 @@ blt_composite_fill_box__cpu(struct sna *sna,
}
static void
blt_composite_fill_boxes__cpu(struct sna *sna,
const struct sna_composite_op *op,
const BoxRec *box, int n)
blt_composite_fill_boxes_no_offset__cpu(struct sna *sna,
const struct sna_composite_op *op,
const BoxRec *box, int n)
{
do {
assert(box->x1 >= 0);
@ -976,6 +976,45 @@ blt_composite_fill_boxes__cpu(struct sna *sna,
} while (--n);
}
fastcall static void
blt_composite_fill_box__cpu(struct sna *sna,
const struct sna_composite_op *op,
const BoxRec *box)
{
assert(box->x1 + op->dst.x >= 0);
assert(box->y1 + op->dst.y >= 0);
assert(box->x2 + op->dst.x <= op->dst.pixmap->drawable.width);
assert(box->y2 + op->dst.y <= op->dst.pixmap->drawable.height);
pixman_fill(op->dst.pixmap->devPrivate.ptr,
op->dst.pixmap->devKind / sizeof(uint32_t),
op->dst.pixmap->drawable.bitsPerPixel,
box->x1 + op->dst.x, box->y1 + op->dst.y,
box->x2 - box->x1, box->y2 - box->y1,
op->u.blt.pixel);
}
static void
blt_composite_fill_boxes__cpu(struct sna *sna,
const struct sna_composite_op *op,
const BoxRec *box, int n)
{
do {
assert(box->x1 + op->dst.x >= 0);
assert(box->y1 + op->dst.y >= 0);
assert(box->x2 + op->dst.x <= op->dst.pixmap->drawable.width);
assert(box->y2 + op->dst.y <= op->dst.pixmap->drawable.height);
pixman_fill(op->dst.pixmap->devPrivate.ptr,
op->dst.pixmap->devKind / sizeof(uint32_t),
op->dst.pixmap->drawable.bitsPerPixel,
box->x1 + op->dst.x, box->y1 + op->dst.y,
box->x2 - box->x1, box->y2 - box->y1,
op->u.blt.pixel);
box++;
} while (--n);
}
inline static void _sna_blt_fill_box(struct sna *sna,
const struct sna_blt_state *blt,
const BoxRec *box)
@ -1316,9 +1355,15 @@ prepare_blt_clear(struct sna *sna,
if (op->dst.bo == NULL) {
op->blt = blt_composite_fill__cpu;
op->box = blt_composite_fill_box__cpu;
op->boxes = blt_composite_fill_boxes__cpu;
op->thread_boxes = blt_composite_fill_boxes__cpu;
if (op->dst.x|op->dst.y) {
op->box = blt_composite_fill_box__cpu;
op->boxes = blt_composite_fill_boxes__cpu;
op->thread_boxes = blt_composite_fill_boxes__cpu;
} else {
op->box = blt_composite_fill_box_no_offset__cpu;
op->boxes = blt_composite_fill_boxes_no_offset__cpu;
op->thread_boxes = blt_composite_fill_boxes_no_offset__cpu;
}
op->done = nop_done;
op->u.blt.pixel = 0;
return true;
@ -1355,9 +1400,15 @@ prepare_blt_fill(struct sna *sna,
if (op->dst.bo == NULL) {
op->u.blt.pixel = pixel;
op->blt = blt_composite_fill__cpu;
op->box = blt_composite_fill_box__cpu;
op->boxes = blt_composite_fill_boxes__cpu;
op->thread_boxes = blt_composite_fill_boxes__cpu;
if (op->dst.x|op->dst.y) {
op->box = blt_composite_fill_box__cpu;
op->boxes = blt_composite_fill_boxes__cpu;
op->thread_boxes = blt_composite_fill_boxes__cpu;
} else {
op->box = blt_composite_fill_box_no_offset__cpu;
op->boxes = blt_composite_fill_boxes_no_offset__cpu;
op->thread_boxes = blt_composite_fill_boxes_no_offset__cpu;
}
op->done = nop_done;
return true;
}