24
24
**********************************************************/
26
#include "svga_screen_texture.h"
26
#include "svga_resource_texture.h"
27
27
#include "svga_context.h"
28
28
#include "svga_debug.h"
29
29
#include "svga_cmd.h"
30
#include "svga_surface.h"
31
32
#define FILE_DEBUG_FLAG DEBUG_BLIT
35
/* XXX I got my doubts about this, should maybe use svga_texture_copy_handle directly? */
34
36
static void svga_surface_copy(struct pipe_context *pipe,
35
struct pipe_surface *dest,
36
unsigned destx, unsigned desty,
37
struct pipe_surface *src,
38
unsigned srcx, unsigned srcy,
37
struct pipe_resource* dst_tex,
38
struct pipe_subresource subdst,
39
unsigned dstx, unsigned dsty, unsigned dstz,
40
struct pipe_resource* src_tex,
41
struct pipe_subresource subsrc,
42
unsigned srcx, unsigned srcy, unsigned srcz,
39
43
unsigned width, unsigned height)
41
45
struct svga_context *svga = svga_context(pipe);
46
struct pipe_screen *screen = pipe->screen;
42
47
SVGA3dCopyBox *box;
43
48
enum pipe_error ret;
49
struct pipe_surface *srcsurf, *dstsurf;
45
51
svga_hwtnl_flush_retry( svga );
53
srcsurf = screen->get_tex_surface(screen, src_tex,
54
subsrc.face, subsrc.level, srcz,
55
PIPE_BIND_SAMPLER_VIEW);
57
dstsurf = screen->get_tex_surface(screen, dst_tex,
58
subdst.face, subdst.level, dstz,
59
PIPE_BIND_RENDER_TARGET);
47
61
SVGA_DBG(DEBUG_DMA, "blit to sid %p (%d,%d), from sid %p (%d,%d) sz %dx%d\n",
48
svga_surface(dest)->handle,
50
svga_surface(src)->handle,
62
svga_surface(dstsurf)->handle,
64
svga_surface(srcsurf)->handle,
54
68
ret = SVGA3D_BeginSurfaceCopy(svga->swc,
59
73
if(ret != PIPE_OK) {
81
95
SVGA_FIFOCommitAll(svga->swc);
83
svga_surface(dest)->dirty = TRUE;
84
svga_propagate_surface(pipe, dest);
97
svga_surface(dstsurf)->dirty = TRUE;
98
svga_propagate_surface(pipe, dstsurf);
100
pipe_surface_reference(&srcsurf, NULL);
101
pipe_surface_reference(&dstsurf, NULL);
89
107
svga_init_blit_functions(struct svga_context *svga)
91
svga->pipe.surface_copy = svga_surface_copy;
109
svga->pipe.resource_copy_region = svga_surface_copy;