summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChris Wilson <chris@chris-wilson.co.uk>2012-03-14 11:51:39 +0000
committerChris Wilson <chris@chris-wilson.co.uk>2012-03-14 11:55:45 +0000
commit6a4ac18e37521d54dc36b215cbd27c56d20b2922 (patch)
treeb71e67df82ac048d818481089680053fbf064602
parent8580677ee6725144acf63f5cc2f8097376352d6e (diff)
sna/traps: Use a more direct fallback path for the CPU
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
-rw-r--r--src/sna/sna_trapezoids.c81
1 files changed, 50 insertions, 31 deletions
diff --git a/src/sna/sna_trapezoids.c b/src/sna/sna_trapezoids.c
index f05324fc..f0f48e8e 100644
--- a/src/sna/sna_trapezoids.c
+++ b/src/sna/sna_trapezoids.c
@@ -2423,44 +2423,63 @@ trapezoids_fallback(CARD8 op, PicturePtr src, PicturePtr dst,
DBG(("%s: mask (%dx%d) depth=%d, format=%08x\n",
__FUNCTION__, width, height, depth, format));
- scratch = sna_pixmap_create_upload(screen,
- width, height, 8,
- KGEM_BUFFER_WRITE);
- if (!scratch)
- return;
+ if (is_gpu(dst->pDrawable) || picture_is_gpu(src)) {
+ scratch = sna_pixmap_create_upload(screen,
+ width, height, 8,
+ KGEM_BUFFER_WRITE);
+ if (!scratch)
+ return;
- if (depth < 8) {
- image = pixman_image_create_bits(format, width, height,
- NULL, 0);
+ if (depth < 8) {
+ image = pixman_image_create_bits(format, width, height,
+ NULL, 0);
+ } else {
+ memset(scratch->devPrivate.ptr, 0, scratch->devKind*height);
+ image = pixman_image_create_bits(format, width, height,
+ scratch->devPrivate.ptr,
+ scratch->devKind);
+ }
+ if (image) {
+ for (; ntrap; ntrap--, traps++)
+ pixman_rasterize_trapezoid(image,
+ (pixman_trapezoid_t *)traps,
+ -bounds.x1, -bounds.y1);
+ if (depth < 8) {
+ pixman_image_t *a8;
+
+ a8 = pixman_image_create_bits(PIXMAN_a8, width, height,
+ scratch->devPrivate.ptr,
+ scratch->devKind);
+ if (a8) {
+ pixman_image_composite(PIXMAN_OP_SRC,
+ image, NULL, a8,
+ 0, 0,
+ 0, 0,
+ 0, 0,
+ width, height);
+ pixman_image_unref (a8);
+ }
+ }
+
+ pixman_image_unref(image);
+ }
} else {
+ scratch = screen->CreatePixmap(screen,
+ width, height, depth,
+ CREATE_PIXMAP_USAGE_SCRATCH);
+ if (!scratch)
+ return;
+
memset(scratch->devPrivate.ptr, 0, scratch->devKind*height);
image = pixman_image_create_bits(format, width, height,
scratch->devPrivate.ptr,
scratch->devKind);
- }
- if (image) {
- for (; ntrap; ntrap--, traps++)
- pixman_rasterize_trapezoid(image,
- (pixman_trapezoid_t *)traps,
- -bounds.x1, -bounds.y1);
- if (depth < 8) {
- pixman_image_t *a8;
-
- a8 = pixman_image_create_bits(PIXMAN_a8, width, height,
- scratch->devPrivate.ptr,
- scratch->devKind);
- if (a8) {
- pixman_image_composite(PIXMAN_OP_SRC,
- image, NULL, a8,
- 0, 0,
- 0, 0,
- 0, 0,
- width, height);
- pixman_image_unref (a8);
- }
+ if (image) {
+ for (; ntrap; ntrap--, traps++)
+ pixman_rasterize_trapezoid(image,
+ (pixman_trapezoid_t *)traps,
+ -bounds.x1, -bounds.y1);
}
-
- pixman_image_unref(image);
}
mask = CreatePicture(0, &scratch->drawable,