OSDN Git Service

svga: rebind stream output targets
authorCharmaine Lee <charmainel@vmware.com>
Wed, 20 Jan 2016 18:35:56 +0000 (10:35 -0800)
committerBrian Paul <brianp@vmware.com>
Mon, 21 Mar 2016 19:37:40 +0000 (13:37 -0600)
To ensure stream output target surfaces are available for the draw commands,
we need to rebind the current stream output targets at the first draw in the
command buffer.

Reviewed-by: Brian Paul <brianp@vmware.com>
Reviewed-by: Jose Fonseca <jfonseca@vmware.com>
src/gallium/drivers/svga/svga_draw.c
src/gallium/drivers/svga/svga_pipe_streamout.c
src/gallium/drivers/svga/svga_streamout.h

index 3eda09a..96f8238 100644 (file)
@@ -459,6 +459,11 @@ draw_vgpu10(struct svga_hwtnl *hwtnl,
       if (ret != PIPE_OK)
          return ret;
 
+      /* Rebind stream output targets */
+      ret = svga_rebind_stream_output_targets(svga);
+      if (ret != PIPE_OK)
+         return ret;
+
       /* Rebind index buffer */
       if (svga->state.hw_draw.ib) {
          struct svga_winsys_context *swc = svga->swc;
index 3f443c4..1318b55 100644 (file)
@@ -311,6 +311,25 @@ svga_set_stream_output_targets(struct pipe_context *pipe,
    svga->num_so_targets = num_targets;
 }
 
+/**
+ * Rebind stream output target surfaces
+ */
+enum pipe_error
+svga_rebind_stream_output_targets(struct svga_context *svga)
+{
+   struct svga_winsys_context *swc = svga->swc;
+   enum pipe_error ret;
+   unsigned i;
+
+   for (i = 0; i < svga->num_so_targets; i++) {
+      ret = swc->resource_rebind(swc, svga->so_surfaces[i], NULL, SVGA_RELOC_WRITE);
+      if (ret != PIPE_OK)
+         return ret;
+   }
+
+   return PIPE_OK;
+}
+
 void
 svga_init_stream_output_functions(struct svga_context *svga)
 {
index da0c445..1daa1ad 100644 (file)
@@ -47,4 +47,7 @@ void
 svga_delete_stream_output(struct svga_context *svga,
                           struct svga_stream_output *streamout);
 
+enum pipe_error
+svga_rebind_stream_output_targets(struct svga_context *svga);
+
 #endif /* SVGA_STREAMOUT_H */