Merge branch 'master' into gallium-texture-transfer
authorKeith Whitwell <keithw@vmware.com>
Mon, 16 Feb 2009 19:50:48 +0000 (19:50 +0000)
committerKeith Whitwell <keithw@vmware.com>
Mon, 16 Feb 2009 19:50:48 +0000 (19:50 +0000)
Conflicts:

src/mesa/state_tracker/st_cb_accum.c
src/mesa/state_tracker/st_cb_drawpixels.c

1  2 
src/gallium/auxiliary/draw/draw_pipe_pstipple.c
src/gallium/drivers/softpipe/sp_draw_arrays.c
src/gallium/drivers/softpipe/sp_texture.c
src/gallium/include/pipe/p_screen.h
src/gallium/include/pipe/p_state.h
src/gallium/state_trackers/g3dvl/vl_r16snorm_mc_buf.c
src/mesa/state_tracker/st_cb_accum.c
src/mesa/state_tracker/st_cb_bitmap.c
src/mesa/state_tracker/st_cb_drawpixels.c
src/mesa/state_tracker/st_cb_fbo.c
src/mesa/state_tracker/st_cb_texture.c

@@@ -50,8 -51,10 +51,11 @@@ extern "C" 
  
  /** Opaque type */
  struct pipe_fence_handle;
+ struct pipe_winsys;
+ struct pipe_buffer;
  
 +
  /**
   * Gallium screen/adapter context.  Basically everything
   * hardware-specific that doesn't actually require a rendering
Simple merge
@@@ -202,35 -199,29 +202,42 @@@ accum_accum(struct pipe_context *pipe, 
     GLfloat *colorBuf, *accBuf;
     GLint i;
  
 -   acc_surf = screen->get_tex_surface(screen, acc_strb->texture, 0, 0, 0,
 -                                      (PIPE_BUFFER_USAGE_CPU_WRITE |
 -                                       PIPE_BUFFER_USAGE_CPU_READ));
 +   acc_trans = screen->get_tex_transfer(screen, acc_strb->texture, 0, 0, 0,
 +                                        PIPE_TRANSFER_READ, xpos, ypos,
 +                                        width, height);
  
 -   color_surf = screen->get_tex_surface(screen, color_strb->texture, 0, 0, 0,
 -                                        PIPE_BUFFER_USAGE_CPU_READ);
 +   color_trans = screen->get_tex_transfer(screen, color_strb->texture, 0, 0, 0,
 +                                          PIPE_TRANSFER_READ, xpos, ypos,
 +                                          width, height);
  
-    colorBuf = (GLfloat *) malloc(width * height * 4 * sizeof(GLfloat));
-    accBuf = (GLfloat *) malloc(width * height * 4 * sizeof(GLfloat));
+    colorBuf = (GLfloat *) _mesa_malloc(width * height * 4 * sizeof(GLfloat));
+    accBuf = (GLfloat *) _mesa_malloc(width * height * 4 * sizeof(GLfloat));
  
 -   pipe_get_tile_rgba(color_surf, xpos, ypos, width, height, colorBuf);
 -   acc_get_tile_rgba(pipe, acc_surf, xpos, ypos, width, height, accBuf);
 +   pipe_get_tile_rgba(color_trans, 0, 0, width, height, colorBuf);
 +   acc_get_tile_rgba(pipe, acc_trans, 0, 0, width, height, accBuf);
  
     for (i = 0; i < 4 * width * height; i++) {
        accBuf[i] = accBuf[i] + colorBuf[i] * value;
     }
  
 -   acc_put_tile_rgba(pipe, acc_surf, xpos, ypos, width, height, accBuf);
 +   screen->tex_transfer_release(screen, &acc_trans);
 +   acc_trans = screen->get_tex_transfer(screen, acc_strb->texture, 0, 0, 0,
 +                                        PIPE_TRANSFER_WRITE, xpos, ypos,
 +                                        width, height);
  
 +   acc_put_tile_rgba(pipe, acc_trans, 0, 0, width, height, accBuf);
 +
++<<<<<<< HEAD:src/mesa/state_tracker/st_cb_accum.c
 +   free(colorBuf);
 +   free(accBuf);
 +   screen->tex_transfer_release(screen, &acc_trans);
 +   screen->tex_transfer_release(screen, &color_trans);
++=======
+    _mesa_free(colorBuf);
+    _mesa_free(accBuf);
+    pipe_surface_reference(&acc_surf, NULL);
+    pipe_surface_reference(&color_surf, NULL);
++>>>>>>> master:src/mesa/state_tracker/st_cb_accum.c
  }
  
  
@@@ -245,27 -236,25 +252,33 @@@ accum_load(struct pipe_context *pipe, G
     GLfloat *buf;
     GLint i;
  
 -   acc_surf = screen->get_tex_surface(screen, acc_strb->texture, 0, 0, 0,
 -                                      PIPE_BUFFER_USAGE_CPU_WRITE);
 +   acc_trans = screen->get_tex_transfer(screen, acc_strb->texture, 0, 0, 0,
 +                                        PIPE_TRANSFER_WRITE, xpos, ypos,
 +                                        width, height);
  
 -   color_surf = screen->get_tex_surface(screen, color_strb->texture, 0, 0, 0,
 -                                        PIPE_BUFFER_USAGE_CPU_READ);
 +   color_trans = screen->get_tex_transfer(screen, color_strb->texture, 0, 0, 0,
 +                                        PIPE_TRANSFER_READ, xpos, ypos,
 +                                        width, height);
  
-    buf = (GLfloat *) malloc(width * height * 4 * sizeof(GLfloat));
+    buf = (GLfloat *) _mesa_malloc(width * height * 4 * sizeof(GLfloat));
  
 -   pipe_get_tile_rgba(color_surf, xpos, ypos, width, height, buf);
 +   pipe_get_tile_rgba(color_trans, 0, 0, width, height, buf);
  
     for (i = 0; i < 4 * width * height; i++) {
        buf[i] = buf[i] * value;
     }
  
 -   acc_put_tile_rgba(pipe, acc_surf, xpos, ypos, width, height, buf);
 +   acc_put_tile_rgba(pipe, acc_trans, 0, 0, width, height, buf);
  
++<<<<<<< HEAD:src/mesa/state_tracker/st_cb_accum.c
 +   free(buf);
 +   screen->tex_transfer_release(screen, &acc_trans);
 +   screen->tex_transfer_release(screen, &color_trans);
++=======
+    _mesa_free(buf);
+    pipe_surface_reference(&acc_surf, NULL);
+    pipe_surface_reference(&color_surf, NULL);
++>>>>>>> master:src/mesa/state_tracker/st_cb_accum.c
  }
  
  
@@@ -282,21 -271,20 +295,26 @@@ accum_return(GLcontext *ctx, GLfloat va
     GLfloat *abuf, *cbuf = NULL;
     GLint i, ch;
  
-    abuf = (GLfloat *) malloc(width * height * 4 * sizeof(GLfloat));
+    abuf = (GLfloat *) _mesa_malloc(width * height * 4 * sizeof(GLfloat));
  
 -   acc_surf = screen->get_tex_surface(screen, acc_strb->texture, 0, 0, 0,
 -                                      PIPE_BUFFER_USAGE_CPU_READ);
 +   acc_trans = screen->get_tex_transfer(screen, acc_strb->texture, 0, 0, 0,
 +                                        PIPE_TRANSFER_READ, xpos, ypos,
 +                                        width, height);
  
 -   color_surf = screen->get_tex_surface(screen, color_strb->texture, 0, 0, 0,
 -                                        (PIPE_BUFFER_USAGE_CPU_READ |
 -                                         PIPE_BUFFER_USAGE_CPU_WRITE));
 +   color_trans = screen->get_tex_transfer(screen, color_strb->texture, 0, 0, 0,
 +                                          PIPE_TRANSFER_READ_WRITE, xpos, ypos,
 +                                          width, height);
  
 -   acc_get_tile_rgba(pipe, acc_surf, xpos, ypos, width, height, abuf);
 +   acc_get_tile_rgba(pipe, acc_trans, 0, 0, width, height, abuf);
  
     if (!colormask[0] || !colormask[1] || !colormask[2] || !colormask[3]) {
++<<<<<<< HEAD:src/mesa/state_tracker/st_cb_accum.c
 +      cbuf = (GLfloat *) malloc(width * height * 4 * sizeof(GLfloat));
 +      pipe_get_tile_rgba(color_trans, 0, 0, width, height, cbuf);
++=======
+       cbuf = (GLfloat *) _mesa_malloc(width * height * 4 * sizeof(GLfloat));
+       pipe_get_tile_rgba(color_surf, xpos, ypos, width, height, cbuf);
++>>>>>>> master:src/mesa/state_tracker/st_cb_accum.c
     }
  
     for (i = 0; i < width * height; i++) {
        }
     }
  
 -   pipe_put_tile_rgba(color_surf, xpos, ypos, width, height, abuf);
 +   pipe_put_tile_rgba(color_trans, 0, 0, width, height, abuf);
  
-    free(abuf);
+    _mesa_free(abuf);
     if (cbuf)
++<<<<<<< HEAD:src/mesa/state_tracker/st_cb_accum.c
 +      free(cbuf);
 +   screen->tex_transfer_release(screen, &acc_trans);
 +   screen->tex_transfer_release(screen, &color_trans);
++=======
+       _mesa_free(cbuf);
+    pipe_surface_reference(&acc_surf, NULL);
+    pipe_surface_reference(&color_surf, NULL);
++>>>>>>> master:src/mesa/state_tracker/st_cb_accum.c
  }
  
  
Simple merge
@@@ -950,11 -950,11 +950,11 @@@ copy_stencil_pixels(GLcontext *ctx, GLi
        }
     }
  
-    free(buffer);
+    _mesa_free(buffer);
  
     /* unmap the stencil buffer */
 -   screen->surface_unmap(screen, psDraw);
 -   pipe_surface_reference(&psDraw, NULL);
 +   screen->transfer_unmap(screen, ptDraw);
 +   screen->tex_transfer_release(screen, &ptDraw);
  }
  
  
@@@ -1058,24 -1056,24 +1058,24 @@@ st_CopyPixels(GLcontext *ctx, GLint src
  
        if (type == GL_COLOR) {
           /* alternate path using get/put_tile() */
-          GLfloat *buf = (GLfloat *) malloc(width * height * 4 * sizeof(GLfloat));
+          GLfloat *buf = (GLfloat *) _mesa_malloc(width * height * 4 * sizeof(GLfloat));
  
 -         pipe_get_tile_rgba(psRead, srcx, srcy, width, height, buf);
 -         pipe_put_tile_rgba(psTex, 0, 0, width, height, buf);
 +         pipe_get_tile_rgba(ptRead, 0, 0, width, height, buf);
 +         pipe_put_tile_rgba(ptTex, 0, 0, width, height, buf);
  
-          free(buf);
+          _mesa_free(buf);
        }
        else {
           /* GL_DEPTH */
-          GLuint *buf = (GLuint *) malloc(width * height * sizeof(GLuint));
+          GLuint *buf = (GLuint *) _mesa_malloc(width * height * sizeof(GLuint));
 -         pipe_get_tile_z(psRead, srcx, srcy, width, height, buf);
 -         pipe_put_tile_z(psTex, 0, 0, width, height, buf);
 +         pipe_get_tile_z(ptRead, 0, 0, width, height, buf);
 +         pipe_put_tile_z(ptTex, 0, 0, width, height, buf);
-          free(buf);
+          _mesa_free(buf);
        }
 -      pipe_surface_reference(&psRead, NULL);
 -   }
  
 -   pipe_surface_reference(&psTex, NULL);
 +      screen->tex_transfer_release(screen, &ptRead);
 +      screen->tex_transfer_release(screen, &ptTex);
 +   }
  
     /* draw textured quad */
     draw_textured_quad(ctx, dstx, dsty, ctx->Current.RasterPos[2],
Simple merge