From b1bacbf0386fde80e6e1a194fecca7c071863e57 Mon Sep 17 00:00:00 2001 From: Kenneth Graunke Date: Thu, 24 Jan 2019 09:01:53 -0800 Subject: [PATCH] iris: Unreference some more things on state module teardown --- src/gallium/drivers/iris/iris_state.c | 23 +++++++++++++++++++++-- 1 file changed, 21 insertions(+), 2 deletions(-) diff --git a/src/gallium/drivers/iris/iris_state.c b/src/gallium/drivers/iris/iris_state.c index 050738f7df1..28c510010e1 100644 --- a/src/gallium/drivers/iris/iris_state.c +++ b/src/gallium/drivers/iris/iris_state.c @@ -4956,8 +4956,8 @@ iris_destroy_state(struct iris_context *ice) const int i = u_bit_scan64(&bound_vbs); pipe_resource_reference(&genx->vertex_buffers[i].resource, NULL); } + free(ice->state.genx); - // XXX: unreference resources/surfaces. for (unsigned i = 0; i < ice->state.framebuffer.nr_cbufs; i++) { pipe_surface_reference(&ice->state.framebuffer.cbufs[i], NULL); } @@ -4966,9 +4966,28 @@ iris_destroy_state(struct iris_context *ice) for (int stage = 0; stage < MESA_SHADER_STAGES; stage++) { struct iris_shader_state *shs = &ice->state.shaders[stage]; pipe_resource_reference(&shs->sampler_table.res, NULL); + for (int i = 0; i < PIPE_MAX_CONSTANT_BUFFERS; i++) { + pipe_resource_reference(&shs->constbuf[i].data.res, NULL); + pipe_resource_reference(&shs->constbuf[i].surface_state.res, NULL); + } + for (int i = 0; i < PIPE_MAX_SHADER_IMAGES; i++) { + pipe_resource_reference(&shs->image[i].res, NULL); + pipe_resource_reference(&shs->image[i].surface_state.res, NULL); + } + for (int i = 0; i < PIPE_MAX_SHADER_BUFFERS; i++) { + pipe_resource_reference(&shs->ssbo[i], NULL); + pipe_resource_reference(&shs->ssbo_surface_state[i].res, NULL); + } + for (int i = 0; i < IRIS_MAX_TEXTURE_SAMPLERS; i++) { + pipe_sampler_view_reference((struct pipe_sampler_view **) + &shs->textures[i], NULL); + } } - free(ice->state.genx); + pipe_resource_reference(&ice->state.grid_size.res, NULL); + pipe_resource_reference(&ice->state.grid_surf_state.res, NULL); + + pipe_resource_reference(&ice->state.null_fb.res, NULL); pipe_resource_reference(&ice->state.unbound_tex.res, NULL); pipe_resource_reference(&ice->state.last_res.cc_vp, NULL); -- 2.30.2