summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChris Wilson <chris@chris-wilson.co.uk>2010-04-14 11:18:25 +0100
committerChris Wilson <chris@chris-wilson.co.uk>2010-04-14 17:10:05 +0100
commit1cc2c2c44ac72460cf1c4e6bdc13c612235809c9 (patch)
treec44a37392925b81dd878064b574ad53cd4add514
parent324a2810da3fbae35637ba9080f31f9383db0868 (diff)
i830: Use pixman_blt directly for performing the in-memory copy
In order to avoid an infinite recursion after enabling CopyArea to use the put_image acceleration to either stream a blit or to copy in-place, we cannot call CopyArea from put_image for the fallback path. Instead, we can simply call pixman_blt directly, which coincidentally is a tiny bit faster. Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
-rw-r--r--src/i830_uxa.c53
1 files changed, 28 insertions, 25 deletions
diff --git a/src/i830_uxa.c b/src/i830_uxa.c
index 09c2ef31..58ed4917 100644
--- a/src/i830_uxa.c
+++ b/src/i830_uxa.c
@@ -767,7 +767,6 @@ static Bool i830_uxa_put_image(PixmapPtr pixmap,
ScrnInfoPtr scrn = xf86Screens[screen->myNum];
PixmapPtr scratch;
struct intel_pixmap *priv;
- Bool scratch_pixmap;
GCPtr gc;
Bool ret;
@@ -804,39 +803,43 @@ static Bool i830_uxa_put_image(PixmapPtr pixmap,
ret = i830_bo_put_image(scratch, bo, src, src_pitch, w, h);
drm_intel_gem_bo_unmap_gtt(bo);
- scratch_pixmap = FALSE;
- if (!ret) {
- (*screen->DestroyPixmap) (scratch);
- return FALSE;
+ if (ret) {
+ gc = GetScratchGC(pixmap->drawable.depth, screen);
+ if (gc) {
+ ValidateGC(&pixmap->drawable, gc);
+
+ (*gc->ops->CopyArea)(&scratch->drawable,
+ &pixmap->drawable,
+ gc, 0, 0, w, h, x, y);
+
+ FreeScratchGC(gc);
+ } else
+ ret = FALSE;
}
+
+ (*screen->DestroyPixmap)(scratch);
} else {
/* bo is not busy so can be mapped without a stall, upload in-place. */
- scratch = GetScratchPixmapHeader(screen, w, h,
- pixmap->drawable.depth,
- pixmap->drawable.bitsPerPixel,
- src_pitch, src);
- scratch_pixmap = TRUE;
- }
-
- ret = FALSE;
- gc = GetScratchGC(pixmap->drawable.depth, screen);
- if (gc) {
- ValidateGC(&pixmap->drawable, gc);
+ if (drm_intel_gem_bo_map_gtt(priv->bo)) {
+ xf86DrvMsg(scrn->scrnIndex, X_WARNING,
+ "%s: bo map failed\n", __FUNCTION__);
+ return FALSE;
+ }
- (*gc->ops->CopyArea)(&scratch->drawable,
- &pixmap->drawable,
- gc, 0, 0, w, h, x, y);
+ pixman_blt((uint32_t *)src, priv->bo->virtual,
+ src_pitch / sizeof(uint32_t),
+ pixmap->devKind / sizeof(uint32_t),
+ pixmap->drawable.bitsPerPixel,
+ pixmap->drawable.bitsPerPixel,
+ 0, 0,
+ x, y,
+ w, h);
- FreeScratchGC(gc);
+ drm_intel_gem_bo_unmap_gtt(priv->bo);
ret = TRUE;
}
- if (scratch_pixmap)
- FreeScratchPixmapHeader(scratch);
- else
- (*screen->DestroyPixmap)(scratch);
-
return ret;
}