[PATCH xserver] glamor: Handle bitplane in glamor_copy_fbo_cpu
Michel Dänzer
michel at daenzer.net
Tue Jul 12 03:39:35 UTC 2016
From: Michel Dänzer <michel.daenzer at amd.com>
This can significantly speed up at least some CopyPlane cases, e.g.
indirectly for stippled fills.
Reported-by: Keith Raghubar <keith.raghubar at amd.com>
Signed-off-by: Michel Dänzer <michel.daenzer at amd.com>
---
The x/yoff deltas for fbCopyXtoX might be backwards, somebody please check.
glamor/glamor_copy.c | 38 ++++++++++++++++++++++++++++++++------
1 file changed, 32 insertions(+), 6 deletions(-)
diff --git a/glamor/glamor_copy.c b/glamor/glamor_copy.c
index 3501a0d..6bb7911 100644
--- a/glamor/glamor_copy.c
+++ b/glamor/glamor_copy.c
@@ -222,9 +222,35 @@ glamor_copy_cpu_fbo(DrawablePtr src,
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));
+ if (bitplane) {
+ FbBits *tmp_bits;
+ FbStride tmp_stride;
+ int tmp_bpp;
+ int tmp_xoff, tmp_yoff;
+ PixmapPtr tmp_pix = fbCreatePixmap(screen, dst->width, dst->height,
+ dst->depth, 0);
+
+ fbGetDrawable(&tmp_pix->drawable, tmp_bits, tmp_stride, tmp_bpp, tmp_xoff,
+ tmp_yoff);
+
+ if (src->bitsPerPixel > 1)
+ fbCopyNto1(src, &tmp_pix->drawable, gc, box, nbox,
+ src_xoff - tmp_xoff, src_yoff - tmp_yoff, reverse,
+ upsidedown, bitplane, closure);
+ else
+ fbCopy1toN(src, &tmp_pix->drawable, gc, box, nbox,
+ src_xoff - tmp_xoff, src_yoff - tmp_yoff, reverse,
+ upsidedown, bitplane, closure);
+
+ glamor_upload_boxes(dst_pixmap, box, nbox, src_xoff + dx, src_yoff + dy,
+ dst_xoff, dst_yoff,
+ (uint8_t *) tmp_bits, tmp_stride * sizeof(FbBits));
+
+ fbDestroyPixmap(tmp_pix);
+ } else
+ 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) {
--
2.8.1
More information about the xorg-devel
mailing list