Mesa (mesa_7_7_branch): st/xorg: use surface_copy for blits if available

Keith Whitwell keithw at kemper.freedesktop.org
Tue Nov 24 21:17:24 UTC 2009


Module: Mesa
Branch: mesa_7_7_branch
Commit: 4509f3cbad2972b6fe4a722ed07904666122a759
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=4509f3cbad2972b6fe4a722ed07904666122a759

Author: Keith Whitwell <keithw at vmware.com>
Date:   Tue Nov 24 20:48:12 2009 +0000

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(-)

diff --git a/src/gallium/state_trackers/xorg/xorg_exa.c b/src/gallium/state_trackers/xorg/xorg_exa.c
index 3d83b57..3e2f4e8 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 15cc29d..a67dda6 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;
 };
 




More information about the mesa-commit mailing list