X-Git-Url: https://git.libre-soc.org/?a=blobdiff_plain;f=src%2Fgallium%2Fdrivers%2Fsvga%2Fsvga_pipe_blit.c;h=8e114d3e30eb745332bf4135848de31ccdbe325a;hb=daf4254d07328381ed013aac25e25d6021fbfd14;hp=4f575b06e62392857d36fd2ff6786e970131286d;hpb=b605f4ff11c894500f2d0273c5d4653ff413448d;p=mesa.git diff --git a/src/gallium/drivers/svga/svga_pipe_blit.c b/src/gallium/drivers/svga/svga_pipe_blit.c index 4f575b06e62..8e114d3e30e 100644 --- a/src/gallium/drivers/svga/svga_pipe_blit.c +++ b/src/gallium/drivers/svga/svga_pipe_blit.c @@ -23,37 +23,67 @@ * **********************************************************/ -#include "svga_screen_texture.h" +#include "svga_resource_texture.h" #include "svga_context.h" #include "svga_debug.h" #include "svga_cmd.h" +#include "svga_surface.h" + +#include "util/u_surface.h" #define FILE_DEBUG_FLAG DEBUG_BLIT +/* XXX still have doubts about this... */ static void svga_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) -{ + struct pipe_resource* dst_tex, + unsigned dst_level, + unsigned dstx, unsigned dsty, unsigned dstz, + struct pipe_resource* src_tex, + unsigned src_level, + const struct pipe_box *src_box) + { struct svga_context *svga = svga_context(pipe); + struct svga_texture *stex, *dtex; +/* struct pipe_screen *screen = pipe->screen; SVGA3dCopyBox *box; enum pipe_error ret; + struct pipe_surface *srcsurf, *dstsurf;*/ + unsigned dst_face, dst_z, src_face, src_z; + + /* Emit buffered drawing commands, and any back copies. + */ + svga_surfaces_flush( svga ); + + /* Fallback for buffers. */ + if (dst_tex->target == PIPE_BUFFER && src_tex->target == PIPE_BUFFER) { + util_resource_copy_region(pipe, dst_tex, dst_level, dstx, dsty, dstz, + src_tex, src_level, src_box); + return; + } + + stex = svga_texture(src_tex); + dtex = svga_texture(dst_tex); - svga_hwtnl_flush_retry( svga ); +#if 0 + srcsurf = screen->get_tex_surface(screen, src_tex, + src_level, src_box->z, src_box->z, + PIPE_BIND_SAMPLER_VIEW); + + dstsurf = screen->get_tex_surface(screen, dst_tex, + dst_level, dst_box->z, dst_box->z, + PIPE_BIND_RENDER_TARGET); SVGA_DBG(DEBUG_DMA, "blit to sid %p (%d,%d), from sid %p (%d,%d) sz %dx%d\n", - svga_surface(dest)->handle, - destx, desty, - svga_surface(src)->handle, - srcx, srcy, + svga_surface(dstsurf)->handle, + dstx, dsty, + svga_surface(srcsurf)->handle, + src_box->x, src_box->y, width, height); ret = SVGA3D_BeginSurfaceCopy(svga->swc, - src, - dest, + srcsurf, + dstsurf, &box, 1); if(ret != PIPE_OK) { @@ -61,32 +91,67 @@ static void svga_surface_copy(struct pipe_context *pipe, svga_context_flush(svga, NULL); ret = SVGA3D_BeginSurfaceCopy(svga->swc, - src, - dest, + srcsurf, + dstsurf, &box, 1); assert(ret == PIPE_OK); } - box->x = destx; - box->y = desty; + box->x = dstx; + box->y = dsty; box->z = 0; box->w = width; box->h = height; box->d = 1; - box->srcx = srcx; - box->srcy = srcy; + box->srcx = src_box->x; + box->srcy = src_box->y; box->srcz = 0; SVGA_FIFOCommitAll(svga->swc); - svga_surface(dest)->dirty = TRUE; - svga_propagate_surface(pipe, dest); + svga_surface(dstsurf)->dirty = TRUE; + svga_propagate_surface(pipe, dstsurf); + + pipe_surface_reference(&srcsurf, NULL); + pipe_surface_reference(&dstsurf, NULL); + +#else + if (src_tex->target == PIPE_TEXTURE_CUBE) { + src_face = src_box->z; + src_z = 0; + assert(src_box->depth == 1); + } + else { + src_face = 0; + src_z = src_box->z; + } + /* different src/dst type???*/ + if (dst_tex->target == PIPE_TEXTURE_CUBE) { + dst_face = dstz; + dst_z = 0; + assert(src_box->depth == 1); + } + else { + dst_face = 0; + dst_z = dstz; + } + svga_texture_copy_handle(svga, + stex->handle, + src_box->x, src_box->y, src_z, + src_level, src_face, + dtex->handle, + dstx, dsty, dst_z, + dst_level, dst_face, + src_box->width, src_box->height, src_box->depth); + +#endif + } void svga_init_blit_functions(struct svga_context *svga) { - svga->pipe.surface_copy = svga_surface_copy; + svga->pipe.resource_copy_region = svga_surface_copy; }