glamor: Fix pixmap offset for bitplane in glamor_copy_fbo_cpu

Commit cba28d5 - "glamor: Handle bitplane in glamor_copy_fbo_cpu"
introduced a regression as the computed pixmap offset would not match
the actual coordinates and write data elsewhere in memory causing a
segfault in fbBltOne().

Translate the pixmap coordinates so that the data is read and written at
the correct location.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=97974
Signed-off-by: Olivier Fourdan <ofourdan@redhat.com>
Reviewed-and-Tested-by: Michel Dänzer <michel.daenzer@amd.com>
This commit is contained in:
Olivier Fourdan 2016-10-05 08:36:21 +02:00 committed by Adam Jackson
parent a6e85e6330
commit 1c2fcb9548

View File

@ -230,20 +230,22 @@ glamor_copy_cpu_fbo(DrawablePtr src,
goto bail; goto bail;
} }
src_pix->drawable.x = -dst->x;
src_pix->drawable.y = -dst->y;
fbGetDrawable(&src_pix->drawable, src_bits, src_stride, src_bpp, src_xoff, fbGetDrawable(&src_pix->drawable, src_bits, src_stride, src_bpp, src_xoff,
src_yoff); src_yoff);
if (src->bitsPerPixel > 1) if (src->bitsPerPixel > 1)
fbCopyNto1(src, &src_pix->drawable, gc, box, nbox, fbCopyNto1(src, &src_pix->drawable, gc, box, nbox, dx, dy,
dst_xoff + dx, dst_yoff + dy, reverse, upsidedown, reverse, upsidedown, bitplane, closure);
bitplane, closure);
else else
fbCopy1toN(src, &src_pix->drawable, gc, box, nbox, fbCopy1toN(src, &src_pix->drawable, gc, box, nbox, dx, dy,
dst_xoff + dx, dst_yoff + dy, reverse, upsidedown, reverse, upsidedown, bitplane, closure);
bitplane, closure);
glamor_upload_boxes(dst_pixmap, box, nbox, 0, 0, 0, 0, glamor_upload_boxes(dst_pixmap, box, nbox, src_xoff, src_yoff,
(uint8_t *) src_bits, src_stride * sizeof(FbBits)); dst_xoff, dst_yoff, (uint8_t *) src_bits,
src_stride * sizeof(FbBits));
fbDestroyPixmap(src_pix); fbDestroyPixmap(src_pix);
} else { } else {
fbGetDrawable(src, src_bits, src_stride, src_bpp, src_xoff, src_yoff); fbGetDrawable(src, src_bits, src_stride, src_bpp, src_xoff, src_yoff);