svga: add SVGA3d_vgpu10_TransferFromBuffer()
authorCharmaine Lee <charmainel@vmware.com>
Thu, 1 Sep 2016 20:40:34 +0000 (13:40 -0700)
committerBrian Paul <brianp@vmware.com>
Sat, 17 Sep 2016 16:24:12 +0000 (10:24 -0600)
Also add the corresponding dump function to dump the TransferFromBuffer command.

Reviewed-by: Brian Paul <brianp@vmware.com>
src/gallium/drivers/svga/svga_cmd.h
src/gallium/drivers/svga/svga_cmd_vgpu10.c
src/gallium/drivers/svga/svgadump/svga_dump.c

index 47a33ec3932660afdddad987a5d83d38db7cc3b9..db0f8908e5d136a67094ca8464346020a8e2acf8 100644 (file)
@@ -668,4 +668,14 @@ SVGA3D_vgpu10_BufferCopy(struct svga_winsys_context *swc,
                          struct svga_winsys_surface *src,
                          struct svga_winsys_surface *dst,
                          unsigned srcx, unsigned dstx, unsigned width);
+
+enum pipe_error
+SVGA3D_vgpu10_TransferFromBuffer(struct svga_winsys_context *swc,
+                                 struct svga_winsys_surface *src,
+                                 unsigned srcOffset, unsigned srcPitch,
+                                 unsigned srcSlicePitch,
+                                 struct svga_winsys_surface *dst,
+                                 unsigned dstSubResource,
+                                 SVGA3dBox *dstBox);
+
 #endif /* __SVGA3D_H__ */
index 1f13193d2333a609d11916f90284c823d23e3858..55465f530302ec3714fc96295bd66c85030024b3 100644 (file)
@@ -1338,3 +1338,32 @@ SVGA3D_vgpu10_BufferCopy(struct svga_winsys_context *swc,
    swc->commit(swc);
    return PIPE_OK;
 }
+
+enum pipe_error
+SVGA3D_vgpu10_TransferFromBuffer(struct svga_winsys_context *swc,
+                                 struct svga_winsys_surface *src,
+                                 unsigned srcOffset, unsigned srcPitch,
+                                 unsigned srcSlicePitch,
+                                 struct svga_winsys_surface *dst,
+                                 unsigned dstSubResource,
+                                 SVGA3dBox *dstBox)
+{
+   SVGA3dCmdDXTransferFromBuffer *cmd;
+   cmd = SVGA3D_FIFOReserve(swc, SVGA_3D_CMD_DX_TRANSFER_FROM_BUFFER,
+                            sizeof(SVGA3dCmdDXTransferFromBuffer), 2);
+
+   if (!cmd)
+      return PIPE_ERROR_OUT_OF_MEMORY;
+
+   swc->surface_relocation(swc, &cmd->srcSid, NULL, src, SVGA_RELOC_READ);
+   swc->surface_relocation(swc, &cmd->destSid, NULL, dst, SVGA_RELOC_WRITE);
+   cmd->srcOffset = srcOffset;
+   cmd->srcPitch = srcPitch;
+   cmd->srcSlicePitch = srcSlicePitch;
+   cmd->destSubResource = dstSubResource;
+   cmd->destBox = *dstBox;
+   swc->commit(swc);
+   return PIPE_OK;
+}
index 5dc731a82e4cf8b6ae64bb0b5491b4cdf0c0d138..c8e6856f1706ade06d89c3c1795299e204c39174 100644 (file)
@@ -2030,6 +2030,17 @@ SVGA3D_DUMP_HEADER(GenMips)
    SVGA3D_DUMP_PARAMETER(shaderResourceViewId, u);
 }
 
+SVGA3D_DUMP_HEADER(TransferFromBuffer)
+{
+   SVGA3D_DUMP_PARAMETER(srcSid, u);
+   SVGA3D_DUMP_PARAMETER(srcOffset, u);
+   SVGA3D_DUMP_PARAMETER(srcPitch, u);
+   SVGA3D_DUMP_PARAMETER(srcSlicePitch, u);
+   SVGA3D_DUMP_PARAMETER(destSid, u);
+   SVGA3D_DUMP_PARAMETER(destSubResource, u);
+   dump_SVGA3dBox(&cmd->destBox);
+}
+
 static void
 dump_SVGA3dCmdInvalidateGBSurface(const SVGA3dCmdInvalidateGBSurface *cmd)
 {
@@ -2130,6 +2141,7 @@ svga_dump_command(uint32_t cmd_id, const void *data, uint32_t size)
    SVGA3D_DUMP_CASE_BASIC(BufferCopy, BUFFER_COPY);
    SVGA3D_DUMP_CASE_BASIC(BufferUpdate, BUFFER_UPDATE);
    SVGA3D_DUMP_CASE_BASIC(GenMips, GENMIPS);
+   SVGA3D_DUMP_CASE_BASIC(TransferFromBuffer, TRANSFER_FROM_BUFFER);
 
    case SVGA_3D_CMD_DX_SET_RENDERTARGETS:
       _debug_printf("\tSVGA_3D_CMD_DX_SET_RENDERTARGETS\n");