diff options
author | Michel Dänzer <michel.daenzer@amd.com> | 2016-07-12 12:25:13 +0900 |
---|---|---|
committer | Michel Dänzer <michel@daenzer.net> | 2016-08-22 10:15:32 +0900 |
commit | cba28d572ac799391beacd89d57e69d0d7ed70e7 (patch) | |
tree | c8feb08402d8028b8ae60c0a31ead6f5ea373d13 /glamor | |
parent | 6e5bec261c3f7af069b57618d6c82b070dc4579d (diff) |
glamor: Handle bitplane in glamor_copy_fbo_cpu
This can significantly speed up at least some CopyPlane cases, e.g.
indirectly for stippled fills.
v2:
* Make temporary pixmap the same size as the destination pixmap
(instead of the destination drawable size), and fix coordinate
parameters passed to fbCopyXtoX and glamor_upload_boxes. Fixes
incorrect rendering with x11perf -copyplane* and crashes with the
xscreensaver phosphor hack.
v3:
* Make the change a bit more compact and hopefully more readable by
re-using the existing src_* locals in the bitplane case as well.
Reported-by: Keith Raghubar <keith.raghubar@amd.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Acked-by: Eric Anholt <eric@anholt.net>
Diffstat (limited to 'glamor')
-rw-r--r-- | glamor/glamor_copy.c | 40 |
1 files changed, 33 insertions, 7 deletions
diff --git a/glamor/glamor_copy.c b/glamor/glamor_copy.c index 3501a0d24..5b5f0e6b9 100644 --- a/glamor/glamor_copy.c +++ b/glamor/glamor_copy.c @@ -220,11 +220,37 @@ glamor_copy_cpu_fbo(DrawablePtr src, glamor_get_drawable_deltas(dst, dst_pixmap, &dst_xoff, &dst_yoff); - fbGetDrawable(src, src_bits, src_stride, src_bpp, src_xoff, src_yoff); + if (bitplane) { + PixmapPtr src_pix = fbCreatePixmap(screen, dst_pixmap->drawable.width, + dst_pixmap->drawable.height, + dst->depth, 0); + + if (!src_pix) { + glamor_finish_access(src); + goto bail; + } - glamor_upload_boxes(dst_pixmap, box, nbox, src_xoff + dx, src_yoff + dy, - dst_xoff, dst_yoff, - (uint8_t *) src_bits, src_stride * sizeof (FbBits)); + fbGetDrawable(&src_pix->drawable, src_bits, src_stride, src_bpp, src_xoff, + src_yoff); + + if (src->bitsPerPixel > 1) + fbCopyNto1(src, &src_pix->drawable, gc, box, nbox, + dst_xoff + dx, dst_yoff + dy, reverse, upsidedown, + bitplane, closure); + else + fbCopy1toN(src, &src_pix->drawable, gc, box, nbox, + dst_xoff + dx, dst_yoff + dy, reverse, upsidedown, + bitplane, closure); + + glamor_upload_boxes(dst_pixmap, box, nbox, 0, 0, 0, 0, + (uint8_t *) src_bits, src_stride * sizeof(FbBits)); + fbDestroyPixmap(src_pix); + } else { + fbGetDrawable(src, src_bits, src_stride, src_bpp, src_xoff, src_yoff); + glamor_upload_boxes(dst_pixmap, box, nbox, src_xoff + dx, src_yoff + dy, + dst_xoff, dst_yoff, + (uint8_t *) src_bits, src_stride * sizeof (FbBits)); + } glamor_finish_access(src); return TRUE; @@ -616,9 +642,9 @@ glamor_copy_gl(DrawablePtr src, return glamor_copy_fbo_fbo_draw(src, dst, gc, box, nbox, dx, dy, reverse, upsidedown, bitplane, closure); } - if (bitplane == 0) - return glamor_copy_cpu_fbo(src, dst, gc, box, nbox, dx, dy, - reverse, upsidedown, bitplane, closure); + + return glamor_copy_cpu_fbo(src, dst, gc, box, nbox, dx, dy, + reverse, upsidedown, bitplane, closure); } else if (GLAMOR_PIXMAP_PRIV_HAS_FBO(src_priv) && dst_priv->type != GLAMOR_DRM_ONLY && bitplane == 0) { |