mesa/st: create new surfaces before destroying old ones when updating attachments

try to avoid patterns that would destroy surfaces for drivers that cache them for
deduplication purposes

Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/12651>
This commit is contained in:
Mike Blumenkrantz 2021-08-31 14:37:31 -04:00 committed by Marge Bot
parent 7155676618
commit 45f35900c3

View file

@ -466,9 +466,11 @@ st_regen_renderbuffer_surface(struct st_context *st,
surf_tmpl.u.tex.first_layer = surf->u.tex.first_layer;
surf_tmpl.u.tex.last_layer = surf->u.tex.last_layer;
/* create -> destroy to avoid blowing up cached surfaces */
surf = pipe->create_surface(pipe, resource, &surf_tmpl);
pipe_surface_release(pipe, psurf);
*psurf = surf;
*psurf = pipe->create_surface(pipe, resource, &surf_tmpl);
strb->surface = *psurf;
}
@ -569,9 +571,10 @@ st_update_renderbuffer_surface(struct st_context *st,
surf_tmpl.u.tex.first_layer = first_layer;
surf_tmpl.u.tex.last_layer = last_layer;
/* create -> destroy to avoid blowing up cached surfaces */
struct pipe_surface *surf = pipe->create_surface(pipe, resource, &surf_tmpl);
pipe_surface_release(pipe, psurf);
*psurf = pipe->create_surface(pipe, resource, &surf_tmpl);
*psurf = surf;
}
strb->surface = *psurf;
}