st/xorg: unite finalization and stub out pipelined copies
authorZack Rusin <zackr@vmware.com>
Wed, 9 Sep 2009 20:08:00 +0000 (16:08 -0400)
committerZack Rusin <zackr@vmware.com>
Thu, 10 Sep 2009 21:21:06 +0000 (17:21 -0400)
src/gallium/state_trackers/xorg/xorg_composite.c
src/gallium/state_trackers/xorg/xorg_composite.h
src/gallium/state_trackers/xorg/xorg_exa.c
src/gallium/state_trackers/xorg/xorg_exa.h

index dff51f220d12ee509c5a1a551d75541158ec4265..b2da064b590381e478303833f9797f9871f54dbd 100644 (file)
@@ -699,3 +699,11 @@ void xorg_solid(struct exa_context *exa,
    }
 }
 
+void xorg_copy_pixmap(struct exa_context *ctx,
+                      struct exa_pixmap_priv *dst, int dx, int dy,
+                      struct exa_pixmap_priv *src, int sx, int sy,
+                      int width, int height)
+{
+    
+}
+
index 236addf1ce485602f452e79a717bb819e1353130..e73f1c704a8bd61867e386b4bb7ed674b00d1110 100644 (file)
@@ -29,4 +29,9 @@ void xorg_solid(struct exa_context *exa,
                 struct exa_pixmap_priv *pixmap,
                 int x0, int y0, int x1, int y1);
 
+void xorg_copy_pixmap(struct exa_context *ctx,
+                      struct exa_pixmap_priv *dst, int dx, int dy,
+                      struct exa_pixmap_priv *src, int sx, int sy,
+                      int width, int height);
+
 #endif
index 8d9555136399d23501e9f8fd0c78b40809a7d76e..d3e7607cc382b759d75aec5bc27c97bb1b670135 100644 (file)
@@ -82,6 +82,15 @@ exa_get_pipe_format(int depth, enum pipe_format *format, int *bbp)
     }
 }
 
+static void
+xorg_exa_common_done(struct exa_context *exa)
+{
+   exa->copy.src = NULL;
+   exa->copy.dst = NULL;
+   exa->has_solid_color = FALSE;
+   exa->num_bound_samplers = 0;
+}
+
 /*
  * Static exported EXA functions
  */
@@ -236,16 +245,17 @@ ExaDone(PixmapPtr pPixmap)
 #else
     xorg_finish(exa);
 #endif
-
-    if (priv->src_surf)
-       exa->scrn->tex_surface_destroy(priv->src_surf);
-    priv->src_surf = NULL;
+    xorg_exa_common_done(exa);
 }
 
 static void
 ExaDoneComposite(PixmapPtr pPixmap)
 {
+   ScrnInfoPtr pScrn = xf86Screens[pPixmap->drawable.pScreen->myNum];
+   modesettingPtr ms = modesettingPTR(pScrn);
+   struct exa_context *exa = ms->exa;
 
+   xorg_exa_common_done(exa);
 }
 
 static Bool
@@ -324,10 +334,11 @@ ExaPrepareCopy(PixmapPtr pSrcPixmap, PixmapPtr pDstPixmap, int xdir,
     if (!priv->tex || !src_priv->tex)
        return FALSE;
 
-    if (!exa->ctx || !exa->ctx->surface_copy)
+    if (!exa->ctx)
        return FALSE;
 
-    priv->src_surf = exa_gpu_surface(exa, src_priv);
+    exa->copy.src = src_priv;
+    exa->copy.dst = priv;
 
     return TRUE;
 }
@@ -336,17 +347,19 @@ static void
 ExaCopy(PixmapPtr pDstPixmap, int srcX, int srcY, int dstX, int dstY,
        int width, int height)
 {
-    ScrnInfoPtr pScrn = xf86Screens[pDstPixmap->drawable.pScreen->myNum];
-    modesettingPtr ms = modesettingPTR(pScrn);
-    struct exa_context *exa = ms->exa;
-    struct exa_pixmap_priv *priv = exaGetPixmapDriverPrivate(pDstPixmap);
-    struct pipe_surface *surf = exa_gpu_surface(exa, priv);
+   ScrnInfoPtr pScrn = xf86Screens[pDstPixmap->drawable.pScreen->myNum];
+   modesettingPtr ms = modesettingPTR(pScrn);
+   struct exa_context *exa = ms->exa;
+   struct exa_pixmap_priv *priv = exaGetPixmapDriverPrivate(pDstPixmap);
+
+   debug_printf("\tExaCopy(srcx=%d, srcy=%d, dstX=%d, dstY=%d, w=%d, h=%d)\n",
+                srcX, srcY, dstX, dstY, width, height);
 
-    debug_printf("\tExaCopy\n");
+   debug_assert(priv == exa->copy.dst);
 
-    exa->ctx->surface_copy(exa->ctx, surf, dstX, dstY, priv->src_surf,
-                          srcX, srcY, width, height);
-    exa->scrn->tex_surface_destroy(surf);
+   xorg_copy_pixmap(exa, exa->copy.dst, dstX, dstY,
+                    exa->copy.src, srcX, srcY,
+                    width, height);
 }
 
 static Bool
@@ -557,16 +570,16 @@ ExaModifyPixmapHeader(PixmapPtr pPixmap, int width, int height,
 
            if (priv->tex) {
                struct pipe_surface *dst_surf;
+                struct pipe_surface *src_surf;
 
                dst_surf = exa->scrn->get_tex_surface(exa->scrn, texture, 0, 0, 0,
                                                      PIPE_BUFFER_USAGE_GPU_WRITE);
-               priv->src_surf = exa_gpu_surface(exa, priv);
-               exa->ctx->surface_copy(exa->ctx, dst_surf, 0, 0, priv->src_surf,
+               src_surf = exa_gpu_surface(exa, priv);
+               exa->ctx->surface_copy(exa->ctx, dst_surf, 0, 0, src_surf,
                                       0, 0, min(width, texture->width[0]),
                                       min(height, texture->height[0]));
                exa->scrn->tex_surface_destroy(dst_surf);
-               exa->scrn->tex_surface_destroy(priv->src_surf);
-               priv->src_surf = NULL;
+               exa->scrn->tex_surface_destroy(src_surf);
            } else if (pPixmap->devPrivate.ptr) {
                struct pipe_transfer *transfer;
 
index 8157c7117283c7c5dffb089a65f26947d2900fc4..7229e87101da2091d3d901e0326514c734c4f3bb 100644 (file)
@@ -27,6 +27,11 @@ struct exa_context
 
    float solid_color[4];
    boolean has_solid_color;
+
+   struct {
+      struct exa_pixmap_priv *src;
+      struct exa_pixmap_priv *dst;
+   } copy;
 };
 
 
@@ -37,7 +42,6 @@ struct exa_pixmap_priv
 
    struct pipe_texture *tex;
    struct pipe_texture *depth_stencil_tex;
-   struct pipe_surface *src_surf; /* for copies */
 
    struct pipe_transfer *map_transfer;
    unsigned map_count;