gallium: Remove do_flip argument from surface_copy
authorJakob Bornecrantz <jakob@vmware.com>
Fri, 13 Mar 2009 10:38:41 +0000 (10:38 +0000)
committerJakob Bornecrantz <jakob@vmware.com>
Fri, 13 Mar 2009 00:38:20 +0000 (01:38 +0100)
I should have gotten most uses and implementation
correctly fixed, but things might break.

Feel free to blame me.

25 files changed:
src/gallium/auxiliary/util/u_blit.c
src/gallium/drivers/cell/ppu/cell_surface.c
src/gallium/drivers/i915simple/i915_surface.c
src/gallium/drivers/i965simple/brw_surface.c
src/gallium/drivers/nv04/nv04_surface.c
src/gallium/drivers/nv10/nv10_surface.c
src/gallium/drivers/nv20/nv20_surface.c
src/gallium/drivers/nv30/nv30_surface.c
src/gallium/drivers/nv40/nv40_surface.c
src/gallium/drivers/nv50/nv50_surface.c
src/gallium/drivers/r300/r300_surface.c
src/gallium/drivers/softpipe/sp_surface.c
src/gallium/drivers/trace/tr_context.c
src/gallium/include/pipe/p_context.h
src/gallium/state_trackers/egl/egl_surface.c
src/gallium/state_trackers/glx/xlib/xm_api.c
src/gallium/state_trackers/python/p_context.i
src/gallium/state_trackers/xorg/xorg_dri2.c
src/gallium/state_trackers/xorg/xorg_exa.c
src/gallium/winsys/drm/nouveau/dri/nouveau_swapbuffers.c
src/gallium/winsys/g3dvl/nouveau/nouveau_swapbuffers.c
src/mesa/state_tracker/st_atom_framebuffer.c
src/mesa/state_tracker/st_cb_drawpixels.c
src/mesa/state_tracker/st_cb_texture.c
src/mesa/state_tracker/st_texture.c

index 813e41f1b11c6e7e36027239abd13c3accdb7f0f..3b3777b8730eef9166e6ccc656eea2797ecdc4ce 100644 (file)
@@ -328,7 +328,7 @@ util_blit_pixels(struct blit_state *ctx,
 
    if(dst->format == src->format && (dstX1 - dstX0) == srcW && (dstY1 - dstY0) == srcH) {
       /* FIXME: this will most surely fail for overlapping rectangles */
-      pipe->surface_copy(pipe, FALSE,
+      pipe->surface_copy(pipe,
                         dst, dstX0, dstY0,   /* dest */
                         src, srcX0, srcY0, /* src */
                         srcW, srcH);     /* size */
@@ -362,7 +362,7 @@ util_blit_pixels(struct blit_state *ctx,
                                      PIPE_BUFFER_USAGE_GPU_WRITE);
 
    /* load temp texture */
-   pipe->surface_copy(pipe, FALSE,
+   pipe->surface_copy(pipe,
                       texSurf, 0, 0,   /* dest */
                       src, srcLeft, srcTop, /* src */
                       srcW, srcH);     /* size */
index c9203fee08785ee8245b625a1d717def82b8327d..ffb8595d828ed327ce12de8d001bee2e704dd863 100644 (file)
 #include "cell_surface.h"
 
 
+static void
+cell_surface_copy(struct pipe_context *pipe,
+                  struct pipe_surface *dest, unsigned destx, unsigned desty,
+                  struct pipe_surface *src, unsigned srcx, unsigned srcy,
+                  unsigned width, unsigned height)
+{
+   util_surface_copy(pipe, FALSE,
+                     dest, destx, desty,
+                     src, srcx, srcy,
+                     width, height);
+}
+
 void
 cell_init_surface_functions(struct cell_context *cell)
 {
-   cell->pipe.surface_copy = util_surface_copy;
+   cell->pipe.surface_copy = cell_surface_copy;
    cell->pipe.surface_fill = util_surface_fill;
 }
index 7eec649906c07693bae13afd535af2a175a47e2f..09b2c499b8f3cefa7c90d199178743f87870b899 100644 (file)
@@ -41,7 +41,6 @@
  */
 static void
 i915_surface_copy(struct pipe_context *pipe,
-                  boolean do_flip,
                  struct pipe_surface *dst,
                  unsigned dstx, unsigned dsty,
                  struct pipe_surface *src,
@@ -58,7 +57,7 @@ i915_surface_copy(struct pipe_context *pipe,
    assert( dst_tex->base.block.height == 1 );
 
    i915_copy_blit( i915_context(pipe),
-                   do_flip,
+                   FALSE,
                    dst_tex->base.block.size,
                    (unsigned short) src_tex->stride, src_tex->buffer, src->offset,
                    (unsigned short) dst_tex->stride, dst_tex->buffer, dst->offset,
index 0a95dce1940c264a553b87bd6ec3ae2ad0780ed5..511779dbfa04a9c00aa9080087958ace904064dd 100644 (file)
@@ -41,7 +41,6 @@
  */
 static void
 brw_surface_copy(struct pipe_context *pipe,
-                 boolean do_flip,
                  struct pipe_surface *dst,
                  unsigned dstx, unsigned dsty,
                  struct pipe_surface *src,
@@ -64,11 +63,11 @@ brw_surface_copy(struct pipe_context *pipe,
       pipe_copy_rect(dst_map,
                      &dst->block,
                      dst->stride,
-                     dstx, dsty, 
-                     width, height, 
-                     src_map, 
-                     do_flip ? -(int) src->stride : src->stride, 
-                     srcx, do_flip ? height - 1 - srcy : srcy);
+                     dstx, dsty,
+                     width, height,
+                     src_map,
+                     src->stride,
+                     srcx, srcy);
 
       pipe->screen->surface_unmap(pipe->screen, src);
       pipe->screen->surface_unmap(pipe->screen, dst);
@@ -79,7 +78,7 @@ brw_surface_copy(struct pipe_context *pipe,
       assert(dst->block.width == 1);
       assert(dst->block.height == 1);
       brw_copy_blit(brw_context(pipe),
-                    do_flip,
+                    FALSE,
                     dst->block.size,
                     (short) src->stride/src->block.size, src_tex->buffer, src->offset, FALSE,
                     (short) dst->stride/dst->block.size, dst_tex->buffer, dst->offset, FALSE,
index 14abf166798b08aad4f6509465f7d890ef9cb49a..0387ff4e78b4db5232bc2079678563d100d11c04 100644 (file)
@@ -33,7 +33,7 @@
 #include "util/u_tile.h"
 
 static void
-nv04_surface_copy(struct pipe_context *pipe, boolean do_flip,
+nv04_surface_copy(struct pipe_context *pipe,
                  struct pipe_surface *dest, unsigned destx, unsigned desty,
                  struct pipe_surface *src, unsigned srcx, unsigned srcy,
                  unsigned width, unsigned height)
@@ -41,15 +41,6 @@ nv04_surface_copy(struct pipe_context *pipe, boolean do_flip,
        struct nv04_context *nv04 = nv04_context(pipe);
        struct nv04_surface_2d *eng2d = nv04->screen->eng2d;
 
-       if (do_flip) {
-               desty += height;
-               while (height--) {
-                       eng2d->copy(eng2d, dest, destx, desty--, src,
-                                   srcx, srcy++, width, 1);
-               }
-               return;
-       }
-
        eng2d->copy(eng2d, dest, destx, desty, src, srcx, srcy, width, height);
 }
 
index 253815106383871cd48221dc78c05956e7b7b564..5b52246a9caa4bd41df50fef03e09555c1ecb230 100644 (file)
@@ -33,7 +33,7 @@
 #include "util/u_tile.h"
 
 static void
-nv10_surface_copy(struct pipe_context *pipe, boolean do_flip,
+nv10_surface_copy(struct pipe_context *pipe,
                  struct pipe_surface *dest, unsigned destx, unsigned desty,
                  struct pipe_surface *src, unsigned srcx, unsigned srcy,
                  unsigned width, unsigned height)
@@ -41,15 +41,6 @@ nv10_surface_copy(struct pipe_context *pipe, boolean do_flip,
        struct nv10_context *nv10 = nv10_context(pipe);
        struct nv04_surface_2d *eng2d = nv10->screen->eng2d;
 
-       if (do_flip) {
-               desty += height;
-               while (height--) {
-                       eng2d->copy(eng2d, dest, destx, desty--, src,
-                                   srcx, srcy++, width, 1);
-               }
-               return;
-       }
-
        eng2d->copy(eng2d, dest, destx, desty, src, srcx, srcy, width, height);
 }
 
index 6cd607583cf73b40da957913ea7ed0ddd71a84f5..4224bdd6afae374b6f4d7398341fdbfb72240d64 100644 (file)
@@ -33,7 +33,7 @@
 #include "util/u_tile.h"
 
 static void
-nv20_surface_copy(struct pipe_context *pipe, boolean do_flip,
+nv20_surface_copy(struct pipe_context *pipe,
                  struct pipe_surface *dest, unsigned destx, unsigned desty,
                  struct pipe_surface *src, unsigned srcx, unsigned srcy,
                  unsigned width, unsigned height)
@@ -41,15 +41,6 @@ nv20_surface_copy(struct pipe_context *pipe, boolean do_flip,
        struct nv20_context *nv20 = nv20_context(pipe);
        struct nv04_surface_2d *eng2d = nv20->screen->eng2d;
 
-       if (do_flip) {
-               desty += height;
-               while (height--) {
-                       eng2d->copy(eng2d, dest, destx, desty--, src,
-                                   srcx, srcy++, width, 1);
-               }
-               return;
-       }
-
        eng2d->copy(eng2d, dest, destx, desty, src, srcx, srcy, width, height);
 }
 
index 0f8dc12045a93eb8462567b263bdda63892ea630..5e237e13eb54d8423d6025bdbad79bf0dd5546f5 100644 (file)
@@ -33,7 +33,7 @@
 #include "util/u_tile.h"
 
 static void
-nv30_surface_copy(struct pipe_context *pipe, boolean do_flip,
+nv30_surface_copy(struct pipe_context *pipe,
                  struct pipe_surface *dest, unsigned destx, unsigned desty,
                  struct pipe_surface *src, unsigned srcx, unsigned srcy,
                  unsigned width, unsigned height)
@@ -41,15 +41,6 @@ nv30_surface_copy(struct pipe_context *pipe, boolean do_flip,
        struct nv30_context *nv30 = nv30_context(pipe);
        struct nv04_surface_2d *eng2d = nv30->screen->eng2d;
 
-       if (do_flip) {
-               desty += height;
-               while (height--) {
-                       eng2d->copy(eng2d, dest, destx, desty--, src,
-                                   srcx, srcy++, width, 1);
-               }
-               return;
-       }
-
        eng2d->copy(eng2d, dest, destx, desty, src, srcx, srcy, width, height);
 }
 
index c4a5fb20d97c4eb5cae4bfcac7510d82ad7f029a..1a849da32d71aadd3737c5b46edc35ca0a799bcb 100644 (file)
@@ -33,7 +33,7 @@
 #include "util/u_tile.h"
 
 static void
-nv40_surface_copy(struct pipe_context *pipe, boolean do_flip,
+nv40_surface_copy(struct pipe_context *pipe,
                  struct pipe_surface *dest, unsigned destx, unsigned desty,
                  struct pipe_surface *src, unsigned srcx, unsigned srcy,
                  unsigned width, unsigned height)
@@ -41,15 +41,6 @@ nv40_surface_copy(struct pipe_context *pipe, boolean do_flip,
        struct nv40_context *nv40 = nv40_context(pipe);
        struct nv04_surface_2d *eng2d = nv40->screen->eng2d;
 
-       if (do_flip) {
-               desty += height;
-               while (height--) {
-                       eng2d->copy(eng2d, dest, destx, desty--, src,
-                                   srcx, srcy++, width, 1);
-               }
-               return;
-       }
-
        eng2d->copy(eng2d, dest, destx, desty, src, srcx, srcy, width, height);
 }
 
index b0936518b038ad85e9e91825fc8ea4c17bbe9344..0cc5168144d644923ed6e3da7978e5e7135206ab 100644 (file)
@@ -144,7 +144,7 @@ nv50_surface_do_copy(struct nv50_screen *screen, struct pipe_surface *dst,
 }
 
 static void
-nv50_surface_copy(struct pipe_context *pipe, boolean flip,
+nv50_surface_copy(struct pipe_context *pipe,
                  struct pipe_surface *dest, unsigned destx, unsigned desty,
                  struct pipe_surface *src, unsigned srcx, unsigned srcy,
                  unsigned width, unsigned height)
@@ -154,16 +154,8 @@ nv50_surface_copy(struct pipe_context *pipe, boolean flip,
 
        assert(src->format == dest->format);
 
-       if (flip) {
-               desty += height;
-               while (height--) {
-                       nv50_surface_do_copy(screen, dest, destx, desty--, src,
-                                            srcx, srcy++, width, 1);
-               }
-       } else {
-               nv50_surface_do_copy(screen, dest, destx, desty, src, srcx,
+       nv50_surface_do_copy(screen, dest, destx, desty, src, srcx,
                                     srcy, width, height);
-       }
 }
 
 static void
index 938a521b87770154aaf7c27cb458eccee36bdc42..a49bec9910114d6633cc1daf271540dd6ac887d2 100644 (file)
@@ -253,7 +253,6 @@ static void r300_surface_fill(struct pipe_context* pipe,
 }
 
 static void r300_surface_copy(struct pipe_context* pipe,
-                              boolean do_flip,
                               struct pipe_surface* dest,
                               unsigned destx, unsigned desty,
                               struct pipe_surface* src,
@@ -272,7 +271,7 @@ static void r300_surface_copy(struct pipe_context* pipe,
 
     if (TRUE) {
         debug_printf("r300: Falling back on surface_copy\n");
-        return util_surface_copy(pipe, do_flip, dest, destx, desty, src,
+        return util_surface_copy(pipe, FALSE, dest, destx, desty, src,
                 srcx, srcy, w, h);
     }
 #if 0
index 6ade7326982f3be59e09ea33bbdfcc819e64a86f..ef04843f1721352c21c55088689d443ab2ee7ed3 100644 (file)
 #include "sp_context.h"
 
 
+static void
+sp_surface_copy(struct pipe_context *pipe,
+                struct pipe_surface *dest, unsigned destx, unsigned desty,
+                struct pipe_surface *src, unsigned srcx, unsigned srcy,
+                unsigned width, unsigned height)
+{
+   util_surface_copy(pipe, FALSE,
+                     dest, destx, desty,
+                     src, srcx, srcy,
+                     width, height);
+}
 
 void
 sp_init_surface_functions(struct softpipe_context *sp)
 {
-   sp->pipe.surface_copy = util_surface_copy;
+   sp->pipe.surface_copy = sp_surface_copy;
    sp->pipe.surface_fill = util_surface_fill;
 }
index 9dcd13f114d0527854ba51995f7a01e7e8991262..c5bae0eed20fe30404c0336dc36e86973efed297 100644 (file)
@@ -911,7 +911,6 @@ trace_context_set_vertex_elements(struct pipe_context *_pipe,
 
 static INLINE void
 trace_context_surface_copy(struct pipe_context *_pipe,
-                           boolean do_flip,
                            struct pipe_surface *dest,
                            unsigned destx, unsigned desty,
                            struct pipe_surface *src,
@@ -927,7 +926,6 @@ trace_context_surface_copy(struct pipe_context *_pipe,
    trace_dump_call_begin("pipe_context", "surface_copy");
 
    trace_dump_arg(ptr, pipe);
-   trace_dump_arg(bool, do_flip);
    trace_dump_arg(ptr, dest);
    trace_dump_arg(uint, destx);
    trace_dump_arg(uint, desty);
@@ -937,7 +935,7 @@ trace_context_surface_copy(struct pipe_context *_pipe,
    trace_dump_arg(uint, width);
    trace_dump_arg(uint, height);
 
-   pipe->surface_copy(pipe, do_flip,
+   pipe->surface_copy(pipe,
                       dest, destx, desty,
                       src, srcx, srcy, width, height);
 
index 9454cc87db3890a948f30641e430777988974002..2452bf3522b2d4e64830a6e40713ebab9fe12064 100644 (file)
@@ -193,7 +193,6 @@ struct pipe_context {
     */
    /*@{*/
    void (*surface_copy)(struct pipe_context *pipe,
-                        boolean do_flip,/**< flip surface contents vertically */
                        struct pipe_surface *dest,
                        unsigned destx, unsigned desty,
                        struct pipe_surface *src, /* don't make this const - 
index b8d5f4217f9feadd3bebb98209ccf57220b5bfea..e6e80b985aa2cf5133ea319d83431ae9ca326a56 100644 (file)
@@ -391,7 +391,6 @@ drm_swap_buffers(_EGLDriver *drv, EGLDisplay dpy, EGLSurface draw)
                if (surf->screen) {
                        surf->user->pipe->flush(surf->user->pipe, PIPE_FLUSH_RENDER_CACHE | PIPE_FLUSH_TEXTURE_CACHE, NULL);
                        surf->user->pipe->surface_copy(surf->user->pipe,
-                               0,
                                surf->screen->surface,
                                0, 0,
                                back_surf,
index c590d5b296d842d0c83109803b514e5155b9a435..7f32b460aaed4f60b5a797b1fd3971442b91d5d6 100644 (file)
@@ -1143,7 +1143,6 @@ void XMesaCopySubBuffer( XMesaBuffer b, int x, int y, int width, int height )
       return;
 
    pipe->surface_copy(pipe,
-                      FALSE,
                       surf_front, x, y,  /* dest */
                       surf_back, x, y,   /* src */
                       width, height);
index 7b8b64b5923ed9a2dc675ebd8c9ec903c7b93389..d1729a46871cb809d2339ffa9c35df9354e48913 100644 (file)
@@ -266,13 +266,12 @@ error1:
     * Surface functions
     */
    
-   void surface_copy(int do_flip,
-                     struct pipe_surface *dest,
+   void surface_copy(struct pipe_surface *dest,
                      unsigned destx, unsigned desty,
                      struct pipe_surface *src,
                      unsigned srcx, unsigned srcy,
                      unsigned width, unsigned height) {
-      $self->pipe->surface_copy($self->pipe, do_flip, dest, destx, desty, src, srcx, srcy, width, height);
+      $self->pipe->surface_copy($self->pipe, dest, destx, desty, src, srcx, srcy, width, height);
    }
 
    void surface_fill(struct pipe_surface *dst,
index b9993b1ea1b70c1a75e36968f4e5e1bdb74a6215..d04204e1bfd5975c5616b215cea624fa96238bbd 100644 (file)
@@ -173,7 +173,7 @@ driCopyRegion(DrawablePtr pDraw, RegionPtr pRegion,
        ms->screen->get_tex_surface(ms->screen, src_priv->tex, 0, 0, 0,
                                    PIPE_BUFFER_USAGE_GPU_READ);
 
-    ms->ctx->surface_copy(ms->ctx, 0, dst_surf, 0, 0, src_surf,
+    ms->ctx->surface_copy(ms->ctx, dst_surf, 0, 0, src_surf,
                          0, 0, pDraw->width, pDraw->height);
 
     pipe_surface_reference(&dst_surf, NULL);
index c5f1293951287993c8ad4f5821b95ed35dde4fa0..56c8fdccb285582d14696e404d0beaa1680be68e 100644 (file)
@@ -283,7 +283,7 @@ ExaCopy(PixmapPtr pDstPixmap, int srcX, int srcY, int dstX, int dstY,
                                   PIPE_BUFFER_USAGE_GPU_READ |
                                   PIPE_BUFFER_USAGE_GPU_WRITE);
 
-    exa->ctx->surface_copy(exa->ctx, 0, surf, dstX, dstY, priv->src_surf,
+    exa->ctx->surface_copy(exa->ctx, surf, dstX, dstY, priv->src_surf,
                           srcX, srcY, width, height);
     exa->scrn->tex_surface_destroy(surf);
 }
index 58cb6f7265c54cc77c6f81b87ba13fec0ae51b9c..3cac722b4a82a94b9293c034c289eac568dad463 100644 (file)
@@ -39,7 +39,7 @@ nouveau_copy_buffer(__DRIdrawablePrivate *dPriv, struct pipe_surface *surf,
                w  = pbox->x2 - pbox->x1;
                h  = pbox->y2 - pbox->y1;
 
-               pipe->surface_copy(pipe, FALSE, nv->base.frontbuffer,
+               pipe->surface_copy(pipe, nv->base.frontbuffer,
                                   dx, dy, surf, sx, sy, w, h);
        }
 
index 864be37871fbd67221fd79fc2edcbac699f159d0..77e46a2054bedf369a5016954e9f2fb9361b0ed3 100644 (file)
@@ -31,7 +31,7 @@ nouveau_copy_buffer(dri_drawable_t *dri_drawable, struct pipe_surface *surf,
                w  = pbox->x2 - pbox->x1;
                h  = pbox->y2 - pbox->y1;
 
-               pipe->surface_copy(pipe, FALSE, nv->base.frontbuffer,
+               pipe->surface_copy(pipe, nv->base.frontbuffer,
                                   dx, dy, surf, sx, sy, w, h);
        }
 
index 625efdd66b5d94552dd142d2cad262863a48b40a..b32009c19bbe6e551d65462be68e9015a20b369c 100644 (file)
@@ -154,7 +154,6 @@ update_framebuffer_state( struct st_context *st )
          (void) st_get_framebuffer_surface(stfb, ST_SURFACE_BACK_LEFT, &surf_back);
 
          st->pipe->surface_copy(st->pipe,
-                                FALSE,
                                 surf_front, 0, 0,  /* dest */
                                 surf_back, 0, 0,   /* src */
                                 fb->Width, fb->Height);
index f666eb4ae8e43a8d91e79055f8a9657aa604cd58..821ea67ce463ad0a21886d660830eda2b8b2c1fa 100644 (file)
@@ -916,7 +916,6 @@ st_CopyPixels(GLcontext *ctx, GLint srcx, GLint srcy,
       struct pipe_surface *psTex = screen->get_tex_surface(screen, pt, 0, 0, 0, 
                                       PIPE_BUFFER_USAGE_GPU_WRITE );
       pipe->surface_copy(pipe,
-                         FALSE,
                         psTex, /* dest */
                         0, 0, /* destx/y */
                         psRead,
index c805e399de25c538101977e63ea2eaa60cedd125..71640d78f72810e8f9a5a2c64ea78a37343de4f3 100644 (file)
@@ -1089,21 +1089,19 @@ st_copy_texsubimage(GLcontext *ctx,
    if (matching_base_formats && ctx->_ImageTransferState == 0x0) {
       /* try potential hardware path */
       struct pipe_surface *dest_surface = NULL;
+      boolean do_flip = (st_fb_orientation(ctx->ReadBuffer) == Y_0_TOP);
 
-      if (src_format == dest_format) {
+      if (src_format == dest_format && !do_flip) {
          /* use surface_copy() / blit */
-         boolean do_flip = (st_fb_orientation(ctx->ReadBuffer) == Y_0_TOP);
+
 
          dest_surface = screen->get_tex_surface(screen, stImage->pt,
                                                 stImage->face, stImage->level,
                                                 destZ,
                                                 PIPE_BUFFER_USAGE_GPU_WRITE);
-         if (do_flip)
-            srcY = strb->surface->height - srcY - height;
 
          /* for surface_copy(), y=0=top, always */
          pipe->surface_copy(pipe,
-                            do_flip,
                             /* dest */
                             dest_surface,
                             destX, destY,
@@ -1123,7 +1121,6 @@ st_copy_texsubimage(GLcontext *ctx,
                                            PIPE_TEXTURE_USAGE_RENDER_TARGET,
                                            0)) {
          /* draw textured quad to do the copy */
-         boolean do_flip = (st_fb_orientation(ctx->ReadBuffer) == Y_0_TOP);
          int srcY0, srcY1;
 
          dest_surface = screen->get_tex_surface(screen, stImage->pt,
index 20c34cd80afd09387024d9596dee22736ab7904a..30b95bebab3ab8a836d1de38ccafbd4948f50f2e 100644 (file)
@@ -342,7 +342,6 @@ st_texture_image_copy(struct pipe_context *pipe,
                                             PIPE_BUFFER_USAGE_GPU_READ);
 
       pipe->surface_copy(pipe,
-                         FALSE,
                         dst_surface,
                         0, 0, /* destX, Y */
                         src_surface,