From 4509f3cbad2972b6fe4a722ed07904666122a759 Mon Sep 17 00:00:00 2001 From: Keith Whitwell Date: Tue, 24 Nov 2009 20:48:12 +0000 Subject: st/xorg: use surface_copy for blits if available Even if its not available, we really want to be coalescing blit operations better. --- src/gallium/state_trackers/xorg/xorg_exa.c | 36 +++++++++++++++++++++++++++--- src/gallium/state_trackers/xorg/xorg_exa.h | 3 +++ 2 files changed, 36 insertions(+), 3 deletions(-) (limited to 'src/gallium/state_trackers/xorg') diff --git a/src/gallium/state_trackers/xorg/xorg_exa.c b/src/gallium/state_trackers/xorg/xorg_exa.c index 3d83b5700d..3e2f4e8834 100644 --- a/src/gallium/state_trackers/xorg/xorg_exa.c +++ b/src/gallium/state_trackers/xorg/xorg_exa.c @@ -156,6 +156,8 @@ xorg_exa_common_done(struct exa_context *exa) exa->copy.src = NULL; exa->copy.dst = NULL; + pipe_surface_reference(&exa->copy.src_surface, NULL); + pipe_surface_reference(&exa->copy.dst_surface, NULL); exa->transform.has_src = FALSE; exa->transform.has_mask = FALSE; exa->has_solid_color = FALSE; @@ -438,6 +440,21 @@ ExaPrepareCopy(PixmapPtr pSrcPixmap, PixmapPtr pDstPixmap, int xdir, exa->copy.src = src_priv; exa->copy.dst = priv; + + if (exa->pipe->surface_copy) { + exa->copy.src_surface = + exa->scrn->get_tex_surface( exa->scrn, + exa->copy.src->tex, + 0, 0, 0, + PIPE_BUFFER_USAGE_GPU_READ); + + exa->copy.dst_surface = + exa->scrn->get_tex_surface( exa->scrn, + exa->copy.dst->tex, + 0, 0, 0, + PIPE_BUFFER_USAGE_GPU_WRITE ); + } + return exa->accel; } @@ -458,11 +475,24 @@ ExaCopy(PixmapPtr pDstPixmap, int srcX, int srcY, int dstX, int dstY, debug_assert(priv == exa->copy.dst); - renderer_copy_pixmap(exa->renderer, exa->copy.dst, dstX, dstY, - exa->copy.src, srcX, srcY, - width, height); + if (exa->copy.src_surface && exa->copy.dst_surface) { + /* XXX: consider exposing >1 box in surface_copy interface. + */ + exa->pipe->surface_copy( exa->pipe, + exa->copy.dst_surface, + dstX, dstY, + exa->copy.src_surface, + srcX, srcY, + width, height ); + } + else { + renderer_copy_pixmap(exa->renderer, exa->copy.dst, dstX, dstY, + exa->copy.src, srcX, srcY, + width, height); + } } + static Bool picture_check_formats(struct exa_pixmap_priv *pSrc, PicturePtr pSrcPicture) { diff --git a/src/gallium/state_trackers/xorg/xorg_exa.h b/src/gallium/state_trackers/xorg/xorg_exa.h index 15cc29d662..a67dda65a5 100644 --- a/src/gallium/state_trackers/xorg/xorg_exa.h +++ b/src/gallium/state_trackers/xorg/xorg_exa.h @@ -37,6 +37,9 @@ struct exa_context struct { struct exa_pixmap_priv *src; struct exa_pixmap_priv *dst; + + struct pipe_surface *src_surface; + struct pipe_surface *dst_surface; } copy; }; -- cgit v1.2.3