From: Charmaine Lee Date: Wed, 22 Mar 2017 19:45:11 +0000 (-0700) Subject: svga: add a reset flag to svga_propagate_surface() X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=a08e3b88ab71b147145f60e56ce02392437c6866;p=mesa.git 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 --- diff --git a/src/gallium/drivers/svga/svga_pipe_misc.c b/src/gallium/drivers/svga/svga_pipe_misc.c index a8c04bd5adb..725cf33f8c0 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 e76b1da6aa5..451266b63e8 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 d9c1e2502fb..846acccacec 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 4315b1a1886..7cbb7671de4 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);