summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBrian Paul <brianp@vmware.com>2016-06-28 17:15:57 -0600
committerBrian Paul <brianp@vmware.com>2016-06-30 14:32:11 -0600
commitc84444ea85b2cf749eaf78dd97430231d92fa618 (patch)
tree0d96d71f27789ace4dd2ddcbe456c268ead8d558
parent29a38f37ee5f090a6964caff42825259b8f39bbc (diff)
svga: use SVGA3D_vgpu10_BufferCopy() for buffer copies
So that we do copies host-side rather than in the guest with map/memcpy. Tested with piglit arb_copy_buffer-subdata-sync test and new arb_copy_buffer-intra-buffer-copy test. Reviewed-by: Charmaine Lee <charmainel@vmware.com> Acked-by: Roland Scheidegger <sroland@vmware.com>
-rw-r--r--src/gallium/drivers/svga/svga_pipe_blit.c32
1 files changed, 28 insertions, 4 deletions
diff --git a/src/gallium/drivers/svga/svga_pipe_blit.c b/src/gallium/drivers/svga/svga_pipe_blit.c
index bbb6156cdc0e..e38f36dc63d8 100644
--- a/src/gallium/drivers/svga/svga_pipe_blit.c
+++ b/src/gallium/drivers/svga/svga_pipe_blit.c
@@ -23,10 +23,11 @@
*
**********************************************************/
-#include "svga_resource_texture.h"
#include "svga_context.h"
#include "svga_debug.h"
#include "svga_cmd.h"
+#include "svga_resource_buffer.h"
+#include "svga_resource_texture.h"
#include "svga_surface.h"
//#include "util/u_blit_sw.h"
@@ -117,10 +118,33 @@ svga_resource_copy_region(struct pipe_context *pipe,
*/
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);
+ /* can't copy within the same buffer, unfortunately */
+ if (svga_have_vgpu10(svga) && src_tex != dst_tex) {
+ enum pipe_error ret;
+ struct svga_winsys_surface *src_surf;
+ struct svga_winsys_surface *dst_surf;
+ struct svga_buffer *dbuffer = svga_buffer(dst_tex);
+
+ src_surf = svga_buffer_handle(svga, src_tex);
+ dst_surf = svga_buffer_handle(svga, dst_tex);
+
+ ret = SVGA3D_vgpu10_BufferCopy(svga->swc, src_surf, dst_surf,
+ src_box->x, dstx, src_box->width);
+ if (ret != PIPE_OK) {
+ svga_context_flush(svga, NULL);
+ ret = SVGA3D_vgpu10_BufferCopy(svga->swc, src_surf, dst_surf,
+ src_box->x, dstx, src_box->width);
+ assert(ret == PIPE_OK);
+ }
+
+ dbuffer->dirty = TRUE;
+ }
+ else {
+ /* use map/memcpy fallback */
+ util_resource_copy_region(pipe, dst_tex, dst_level, dstx,
+ dsty, dstz, src_tex, src_level, src_box);
+ }
return;
}