sna: Remember to apply drawable offsets for composite memcpy

Yet another missing chunk from
commit 6921abd810
Author: Chris Wilson <chris@chris-wilson.co.uk>
Date:   Thu Jul 18 16:21:27 2013 +0100

    sna: Add a fast path for the most common fallback for CPU-CPU blits

I had the composite offsets, but not the normal window offsets!

Reported-by: F.Brown <francisbrwn9@gmail.com>
Reported-by: Jiri Slaby <jirislaby@gmail.com>
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=67124
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=67064
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
This commit is contained in:
Chris Wilson 2013-07-20 21:55:16 +01:00
parent e9823ec2a9
commit 2c78403cb5
1 changed files with 43 additions and 33 deletions

View File

@ -526,49 +526,59 @@ sna_composite_fb(CARD8 op,
src->filter != PictFilterConvolution &&
(op == PictOpSrc || (op == PictOpOver && !PICT_FORMAT_A(src->format))) &&
(dst->format == src->format || dst->format == alphaless(src->format)) &&
sna_transform_is_integer_translation(src->transform, &tx, &ty) &&
region->extents.x1 + src_x + tx >= 0 &&
region->extents.y1 + src_y + ty >= 0 &&
region->extents.x2 + src_x + tx <= src->pDrawable->width &&
region->extents.y2 + src_y + ty <= src->pDrawable->height) {
sna_transform_is_integer_translation(src->transform, &tx, &ty)) {
PixmapPtr dst_pixmap = get_drawable_pixmap(dst->pDrawable);
PixmapPtr src_pixmap = get_drawable_pixmap(src->pDrawable);
int nbox = RegionNumRects(region);
BoxPtr box = RegionRects(region);
int16_t sx = src_x + tx, sy = src_y + ty;
if (region->extents.x1 + sx >= 0 &&
region->extents.y1 + sy >= 0 &&
region->extents.x2 + sx <= src->pDrawable->width &&
region->extents.y2 + sy <= src->pDrawable->height) {
BoxPtr box = RegionRects(region);
int nbox = RegionNumRects(region);
src_x += tx; src_y += ty;
sx += src->pDrawable->x;
sy += src->pDrawable->y;
if (get_drawable_deltas(src->pDrawable, src_pixmap, &tx, &ty))
sx += tx, sy += ty;
if (get_drawable_deltas(src->pDrawable, src_pixmap, &tx, &ty))
src_x += tx, src_y += ty;
assert(region->extents.x1 + sx >= 0);
assert(region->extents.x2 + sx <= src_pixmap->drawable.width);
assert(region->extents.y1 + sy >= 0);
assert(region->extents.y2 + sy <= src_pixmap->drawable.height);
if (get_drawable_deltas(dst->pDrawable, dst_pixmap, &tx, &ty))
dst_x += tx, dst_y += ty;
dst_x += dst->pDrawable->x;
dst_y += dst->pDrawable->y;
if (get_drawable_deltas(dst->pDrawable, dst_pixmap, &tx, &ty))
dst_x += tx, dst_y += ty;
do {
assert(box->x1 + src_x >= 0);
assert(box->x2 + src_x <= src_pixmap->drawable.width);
assert(box->y1 + src_y >= 0);
assert(box->y2 + src_y <= src_pixmap->drawable.height);
assert(nbox);
do {
assert(box->x1 + sx >= 0);
assert(box->x2 + sx <= src_pixmap->drawable.width);
assert(box->y1 + sy >= 0);
assert(box->y2 + sy <= src_pixmap->drawable.height);
assert(box->x1 + dst_x >= 0);
assert(box->x2 + dst_x <= dst_pixmap->drawable.width);
assert(box->y1 + dst_y >= 0);
assert(box->y2 + dst_y <= dst_pixmap->drawable.height);
assert(box->x1 + dst_x >= 0);
assert(box->x2 + dst_x <= dst_pixmap->drawable.width);
assert(box->y1 + dst_y >= 0);
assert(box->y2 + dst_y <= dst_pixmap->drawable.height);
assert(box->x2 > box->x1 && box->y2 > box->y1);
assert(box->x2 > box->x1 && box->y2 > box->y1);
memcpy_blt(src_pixmap->devPrivate.ptr,
dst_pixmap->devPrivate.ptr,
dst_pixmap->drawable.bitsPerPixel,
src_pixmap->devKind,
dst_pixmap->devKind,
box->x1 + src_x, box->y1 + src_y,
box->x1 + dst_x, box->y1 + dst_y,
box->x2 - box->x1, box->y2 - box->y1);
box++;
} while (--nbox);
memcpy_blt(src_pixmap->devPrivate.ptr,
dst_pixmap->devPrivate.ptr,
dst_pixmap->drawable.bitsPerPixel,
src_pixmap->devKind,
dst_pixmap->devKind,
box->x1 + sx, box->y1 + sy,
box->x1 + dst_x, box->y1 + dst_y,
box->x2 - box->x1, box->y2 - box->y1);
box++;
} while (--nbox);
return;
return;
}
}
src_image = image_from_pict(src, FALSE, &src_xoff, &src_yoff);