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@vmware.com>
This commit is contained in:
Charmaine Lee 2017-03-22 12:45:11 -07:00 committed by Brian Paul
parent 02c9bf2d54
commit a08e3b88ab
4 changed files with 19 additions and 8 deletions

View file

@ -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);
}
}
}

View file

@ -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);
}

View file

@ -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);
}
}

View file

@ -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);