From: Mike Blumenkrantz Date: Tue, 31 Aug 2021 18:37:31 +0000 (-0400) Subject: mesa/st: create new surfaces before destroying old ones when updating attachments X-Git-Tag: upstream/22.3.5~18453 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=45f35900c33bf864a8677afa8222df5dd0ca6b20;p=platform%2Fupstream%2Fmesa.git 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 Part-of: --- diff --git a/src/mesa/state_tracker/st_cb_fbo.c b/src/mesa/state_tracker/st_cb_fbo.c index 43f1c3f..5ffc234 100644 --- a/src/mesa/state_tracker/st_cb_fbo.c +++ b/src/mesa/state_tracker/st_cb_fbo.c @@ -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; }