Mesa (master): svga: add a reset flag to svga_propagate_surface()

Brian Paul brianp at kemper.freedesktop.org
Fri Apr 7 19:51:09 UTC 2017


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

Author: Charmaine Lee <charmainel at vmware.com>
Date:   Wed Mar 22 12:45:11 2017 -0700

svga: add a reset flag to svga_propagate_surface()

The reset flag specifies if the dirty bit needs to be reset
after the surface is propagated to the texture. This is used
to make sure that the dirty bit is not reset and stay unset
before the surface is unbound.

Reviewed-by: Brian Paul <brianp at vmware.com>

---

 src/gallium/drivers/svga/svga_pipe_misc.c         |  2 +-
 src/gallium/drivers/svga/svga_state_framebuffer.c |  6 ++++--
 src/gallium/drivers/svga/svga_surface.c           | 16 ++++++++++++----
 src/gallium/drivers/svga/svga_surface.h           |  3 ++-
 4 files changed, 19 insertions(+), 8 deletions(-)

diff --git a/src/gallium/drivers/svga/svga_pipe_misc.c b/src/gallium/drivers/svga/svga_pipe_misc.c
index a8c04bd5ad..725cf33f8c 100644
--- a/src/gallium/drivers/svga/svga_pipe_misc.c
+++ b/src/gallium/drivers/svga/svga_pipe_misc.c
@@ -128,7 +128,7 @@ svga_set_framebuffer_state(struct pipe_context *pipe,
       struct pipe_surface *s = i < fb->nr_cbufs ? fb->cbufs[i] : NULL;
       if (dst->cbufs[i] && dst->cbufs[i] != s) {
          if (svga_surface_needs_propagation(dst->cbufs[i])) {
-            svga_propagate_surface(svga, dst->cbufs[i]);
+            svga_propagate_surface(svga, dst->cbufs[i], FALSE);
          }
       }
    }
diff --git a/src/gallium/drivers/svga/svga_state_framebuffer.c b/src/gallium/drivers/svga/svga_state_framebuffer.c
index e76b1da6aa..451266b63e 100644
--- a/src/gallium/drivers/svga/svga_state_framebuffer.c
+++ b/src/gallium/drivers/svga/svga_state_framebuffer.c
@@ -233,7 +233,8 @@ emit_fb_vgpu10(struct svga_context *svga)
             /* propagate the backed view surface before unbinding it */
             if (hw->cbufs[i] && svga_surface(hw->cbufs[i])->backed) {
                svga_propagate_surface(svga,
-                                      &svga_surface(hw->cbufs[i])->backed->base);
+                                      &svga_surface(hw->cbufs[i])->backed->base,
+                                      TRUE);
             }
             pipe_surface_reference(&hw->cbufs[i], curr->cbufs[i]);
          }
@@ -243,7 +244,8 @@ emit_fb_vgpu10(struct svga_context *svga)
       if (hw->zsbuf != curr->zsbuf) {
          /* propagate the backed view surface before unbinding it */
          if (hw->zsbuf && svga_surface(hw->zsbuf)->backed) {
-            svga_propagate_surface(svga, &svga_surface(hw->zsbuf)->backed->base);
+            svga_propagate_surface(svga, &svga_surface(hw->zsbuf)->backed->base,
+                                   TRUE);
          }
          pipe_surface_reference(&hw->zsbuf, curr->zsbuf);
       }
diff --git a/src/gallium/drivers/svga/svga_surface.c b/src/gallium/drivers/svga/svga_surface.c
index d9c1e2502f..846acccace 100644
--- a/src/gallium/drivers/svga/svga_surface.c
+++ b/src/gallium/drivers/svga/svga_surface.c
@@ -618,7 +618,8 @@ svga_mark_surfaces_dirty(struct svga_context *svga)
  * pipe is optional context to inline the blit command in.
  */
 void
-svga_propagate_surface(struct svga_context *svga, struct pipe_surface *surf)
+svga_propagate_surface(struct svga_context *svga, struct pipe_surface *surf,
+                       boolean reset)
 {
    struct svga_surface *s = svga_surface(surf);
    struct svga_texture *tex = svga_texture(surf->texture);
@@ -629,7 +630,14 @@ svga_propagate_surface(struct svga_context *svga, struct pipe_surface *surf)
 
    SVGA_STATS_TIME_PUSH(ss->sws, SVGA_STATS_TIME_PROPAGATESURFACE);
 
-   s->dirty = FALSE;
+   /* Reset the dirty flag if specified. This is to ensure that
+    * the dirty flag will not be reset and stay unset when the backing
+    * surface is still being bound and rendered to.
+    * The reset flag will be set to TRUE when the surface is propagated
+    * and will be unbound.
+    */
+   s->dirty = !reset;
+
    ss->texture_timestamp++;
    svga_age_texture_view(tex, surf->u.tex.level);
 
@@ -693,12 +701,12 @@ svga_propagate_rendertargets(struct svga_context *svga)
    for (i = 0; i < svga->state.hw_draw.num_rendertargets; i++) {
       struct pipe_surface *s = svga->state.hw_draw.rtv[i];
       if (s) {
-         svga_propagate_surface(svga, s);
+         svga_propagate_surface(svga, s, FALSE);
       }
    }
 
    if (svga->state.hw_draw.dsv) {
-      svga_propagate_surface(svga, svga->state.hw_draw.dsv);
+      svga_propagate_surface(svga, svga->state.hw_draw.dsv, FALSE);
    }
 }
 
diff --git a/src/gallium/drivers/svga/svga_surface.h b/src/gallium/drivers/svga/svga_surface.h
index 4315b1a188..7cbb7671de 100644
--- a/src/gallium/drivers/svga/svga_surface.h
+++ b/src/gallium/drivers/svga/svga_surface.h
@@ -79,7 +79,8 @@ void
 svga_mark_surfaces_dirty(struct svga_context *svga);
 
 extern void
-svga_propagate_surface(struct svga_context *svga, struct pipe_surface *surf);
+svga_propagate_surface(struct svga_context *svga, struct pipe_surface *surf,
+                       boolean reset);
 
 void
 svga_propagate_rendertargets(struct svga_context *svga);




More information about the mesa-commit mailing list