summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChris Wilson <chris@chris-wilson.co.uk>2014-02-22 10:05:41 +0000
committerChris Wilson <chris@chris-wilson.co.uk>2014-02-22 10:05:41 +0000
commit75cff26ebad33aca7ade7aa5a650235a7d42e47c (patch)
treec09684a7ef50fdc57457cbbc5cc489a06fb137d6
parent59d471de7fc7581b112f37a68714d0e1f8728dfd (diff)
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>
-rw-r--r--src/sna/sna_blt.c75
1 files changed, 63 insertions, 12 deletions
diff --git a/src/sna/sna_blt.c b/src/sna/sna_blt.c
index c02f8c7d..4bbcdbcc 100644
--- a/src/sna/sna_blt.c
+++ b/src/sna/sna_blt.c
@@ -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;
}