diff options
author | Chris Wilson <chris@chris-wilson.co.uk> | 2010-04-14 11:18:25 +0100 |
---|---|---|
committer | Owain G. Ainsworth <oga@openbsd.org> | 2010-04-16 18:24:24 +0100 |
commit | 4a15cdfd933c0dab9a1af35307cddd6effef1508 (patch) | |
tree | eecb5266dce6b9864cc03c818762f4a1fab930c5 /src/i830_uxa.c | |
parent | d9da730aea63ade57dd64f88e32982d3c03a838a (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>
(cherry picked from commit 1cc2c2c44ac72460cf1c4e6bdc13c612235809c9)
Signed-off-by: Owain G. Ainsworth <oga@openbsd.org>
Diffstat (limited to 'src/i830_uxa.c')
-rw-r--r-- | src/i830_uxa.c | 53 |
1 files changed, 28 insertions, 25 deletions
diff --git a/src/i830_uxa.c b/src/i830_uxa.c index 346c8b84..f46a9c8d 100644 --- a/src/i830_uxa.c +++ b/src/i830_uxa.c @@ -756,7 +756,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; @@ -793,39 +792,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; } |