Mesa (master): svga: move surface propagation code into new function

Brian Paul brianp at kemper.freedesktop.org
Mon Aug 29 23:45:51 UTC 2016


Module: Mesa
Branch: master
Commit: 646afc6ff75fca5a961549ffe175877f903ef5c7
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=646afc6ff75fca5a961549ffe175877f903ef5c7

Author: Brian Paul <brianp at vmware.com>
Date:   Fri Aug 26 09:53:47 2016 -0600

svga: move surface propagation code into new function

Put new svga_propagate_rendertargets() function where all the other
surface propagation code lives.

Reviewed-by: Charmaine Lee <charmainel at vmware.com>

---

 src/gallium/drivers/svga/svga_context.c | 13 ++-----------
 src/gallium/drivers/svga/svga_surface.c | 22 ++++++++++++++++++++++
 src/gallium/drivers/svga/svga_surface.h |  3 +++
 3 files changed, 27 insertions(+), 11 deletions(-)

diff --git a/src/gallium/drivers/svga/svga_context.c b/src/gallium/drivers/svga/svga_context.c
index ffecef5..b3b2728 100644
--- a/src/gallium/drivers/svga/svga_context.c
+++ b/src/gallium/drivers/svga/svga_context.c
@@ -408,24 +408,15 @@ void svga_hwtnl_flush_buffer( struct svga_context *svga,
  */ 
 void svga_surfaces_flush(struct svga_context *svga)
 {
-   struct svga_screen *svgascreen = svga_screen(svga->pipe.screen);
-   unsigned i;
-
    SVGA_STATS_TIME_PUSH(svga_sws(svga), SVGA_STATS_TIME_SURFACEFLUSH);
 
    /* Emit buffered drawing commands.
     */
    svga_hwtnl_flush_retry( svga );
 
-   /* Emit back-copy from render target view to texture.
+   /* Emit back-copy from render target views to textures.
     */
-   for (i = 0; i < svgascreen->max_color_buffers; i++) {
-      if (svga->curr.framebuffer.cbufs[i])
-         svga_propagate_surface(svga, svga->curr.framebuffer.cbufs[i]);
-   }
-
-   if (svga->curr.framebuffer.zsbuf)
-      svga_propagate_surface(svga, svga->curr.framebuffer.zsbuf);
+   svga_propagate_rendertargets(svga);
 
    SVGA_STATS_TIME_POP(svga_sws(svga));
 }
diff --git a/src/gallium/drivers/svga/svga_surface.c b/src/gallium/drivers/svga/svga_surface.c
index a11ce4e..75e76fb 100644
--- a/src/gallium/drivers/svga/svga_surface.c
+++ b/src/gallium/drivers/svga/svga_surface.c
@@ -658,6 +658,28 @@ svga_propagate_surface(struct svga_context *svga, struct pipe_surface *surf)
 
 
 /**
+ * If any of the render targets are in backing texture views, propagate any
+ * changes to them back to the original texture.
+ */
+void
+svga_propagate_rendertargets(struct svga_context *svga)
+{
+   const unsigned num_cbufs = svga_screen(svga->pipe.screen)->max_color_buffers;
+   unsigned i;
+
+   for (i = 0; i < num_cbufs; i++) {
+      if (svga->curr.framebuffer.cbufs[i]) {
+         svga_propagate_surface(svga, svga->curr.framebuffer.cbufs[i]);
+      }
+   }
+
+   if (svga->curr.framebuffer.zsbuf) {
+      svga_propagate_surface(svga, svga->curr.framebuffer.zsbuf);
+   }
+}
+
+
+/**
  * Check if we should call svga_propagate_surface on the surface.
  */
 boolean
diff --git a/src/gallium/drivers/svga/svga_surface.h b/src/gallium/drivers/svga/svga_surface.h
index 2f003b2..ed9f37a 100644
--- a/src/gallium/drivers/svga/svga_surface.h
+++ b/src/gallium/drivers/svga/svga_surface.h
@@ -78,6 +78,9 @@ struct svga_surface
 extern void
 svga_propagate_surface(struct svga_context *svga, struct pipe_surface *surf);
 
+void
+svga_propagate_rendertargets(struct svga_context *svga);
+
 extern boolean
 svga_surface_needs_propagation(const struct pipe_surface *surf);
 




More information about the mesa-commit mailing list