From: Keith Whitwell Date: Mon, 16 Feb 2009 19:50:48 +0000 (+0000) Subject: Merge branch 'master' into gallium-texture-transfer X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=59d54334c96f44ed1d8bf660dc96221362a77d04;p=mesa.git Merge branch 'master' into gallium-texture-transfer Conflicts: src/mesa/state_tracker/st_cb_accum.c src/mesa/state_tracker/st_cb_drawpixels.c --- 59d54334c96f44ed1d8bf660dc96221362a77d04 diff --cc src/gallium/include/pipe/p_screen.h index 8714a2ed7d7,17d1548253b..341d1caea0f --- a/src/gallium/include/pipe/p_screen.h +++ b/src/gallium/include/pipe/p_screen.h @@@ -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 diff --cc src/mesa/state_tracker/st_cb_accum.c index 46ec03234fc,2fc37343bdf..33c648856a2 --- a/src/mesa/state_tracker/st_cb_accum.c +++ b/src/mesa/state_tracker/st_cb_accum.c @@@ -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++) { @@@ -311,13 -299,13 +329,19 @@@ } } - 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 } diff --cc src/mesa/state_tracker/st_cb_drawpixels.c index 9a84f04af15,cb4a01c22b6..13307fc2c12 --- a/src/mesa/state_tracker/st_cb_drawpixels.c +++ b/src/mesa/state_tracker/st_cb_drawpixels.c @@@ -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],