diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/gallium/drivers/iris/iris_batch.c | 2 | ||||
-rw-r--r-- | src/gallium/drivers/iris/iris_context.c | 1 | ||||
-rw-r--r-- | src/gallium/drivers/iris/iris_program_cache.c | 5 | ||||
-rw-r--r-- | src/gallium/drivers/iris/iris_resource.c | 1 | ||||
-rw-r--r-- | src/gallium/drivers/iris/iris_state.c | 19 |
5 files changed, 26 insertions, 2 deletions
diff --git a/src/gallium/drivers/iris/iris_batch.c b/src/gallium/drivers/iris/iris_batch.c index 038a952442e..d552579782f 100644 --- a/src/gallium/drivers/iris/iris_batch.c +++ b/src/gallium/drivers/iris/iris_batch.c @@ -252,6 +252,8 @@ iris_batch_free(struct iris_batch *batch) _mesa_hash_table_destroy(batch->cache.render, NULL); _mesa_set_destroy(batch->cache.depth, NULL); + iris_destroy_binder(&batch->binder); + if (batch->state_sizes) { _mesa_hash_table_destroy(batch->state_sizes, NULL); gen_batch_decode_ctx_finish(&batch->decoder); diff --git a/src/gallium/drivers/iris/iris_context.c b/src/gallium/drivers/iris/iris_context.c index 09eb288bbbc..4812d7c3af8 100644 --- a/src/gallium/drivers/iris/iris_context.c +++ b/src/gallium/drivers/iris/iris_context.c @@ -79,6 +79,7 @@ iris_destroy_context(struct pipe_context *ctx) if (ctx->stream_uploader) u_upload_destroy(ctx->stream_uploader); + ice->vtbl.destroy_state(ice); iris_destroy_program_cache(ice); u_upload_destroy(ice->state.surface_uploader); u_upload_destroy(ice->state.dynamic_uploader); diff --git a/src/gallium/drivers/iris/iris_program_cache.c b/src/gallium/drivers/iris/iris_program_cache.c index 5a09c7f5529..d80de6e6c4b 100644 --- a/src/gallium/drivers/iris/iris_program_cache.c +++ b/src/gallium/drivers/iris/iris_program_cache.c @@ -341,6 +341,11 @@ iris_destroy_program_cache(struct iris_context *ice) ice->shaders.prog[i] = NULL; } + hash_table_foreach(ice->shaders.cache, entry) { + struct iris_compiled_shader *shader = entry->data; + pipe_resource_reference(&shader->buffer, NULL); + } + u_upload_destroy(ice->shaders.uploader); ralloc_free(ice->shaders.cache); diff --git a/src/gallium/drivers/iris/iris_resource.c b/src/gallium/drivers/iris/iris_resource.c index aeed6ce5943..5eccd66de59 100644 --- a/src/gallium/drivers/iris/iris_resource.c +++ b/src/gallium/drivers/iris/iris_resource.c @@ -159,6 +159,7 @@ iris_resource_destroy(struct pipe_screen *screen, struct iris_resource *res = (struct iris_resource *)resource; iris_bo_unreference(res->bo); + free(res); } static struct iris_resource * diff --git a/src/gallium/drivers/iris/iris_state.c b/src/gallium/drivers/iris/iris_state.c index add3428abd4..f24e59d5a60 100644 --- a/src/gallium/drivers/iris/iris_state.c +++ b/src/gallium/drivers/iris/iris_state.c @@ -1260,6 +1260,7 @@ iris_set_viewport_states(struct pipe_context *ctx, vp_map += GENX(SF_CLIP_VIEWPORT_length); } + free(ice->state.cso_vp); ice->state.cso_vp = cso; ice->state.num_viewports = num_viewports; ice->state.dirty |= IRIS_DIRTY_SF_CL_VIEWPORT; @@ -1456,8 +1457,6 @@ iris_set_vertex_buffers(struct pipe_context *ctx, const struct pipe_vertex_buffer *buffers) { struct iris_context *ice = (struct iris_context *) ctx; - struct iris_vertex_buffer_state *cso = - malloc(sizeof(struct iris_vertex_buffer_state)); /* If there are no buffers, do nothing. We can leave the stale * 3DSTATE_VERTEX_BUFFERS in place - as long as there are no vertex @@ -1466,6 +1465,9 @@ iris_set_vertex_buffers(struct pipe_context *ctx, if (!buffers) return; + struct iris_vertex_buffer_state *cso = + malloc(sizeof(struct iris_vertex_buffer_state)); + iris_free_vertex_buffers(ice->state.cso_vertex_buffers); cso->num_buffers = count; @@ -2746,14 +2748,27 @@ iris_upload_render_state(struct iris_context *ice, } } +/** + * State module teardown. + */ static void iris_destroy_state(struct iris_context *ice) { + iris_free_vertex_buffers(ice->state.cso_vertex_buffers); + // XXX: unreference resources/surfaces. for (unsigned i = 0; i < ice->state.framebuffer.nr_cbufs; i++) { pipe_surface_reference(&ice->state.framebuffer.cbufs[i], NULL); } pipe_surface_reference(&ice->state.framebuffer.zsbuf, NULL); + + free(ice->state.cso_depthbuffer); + + pipe_resource_reference(&ice->state.last_res.cc_vp, NULL); + pipe_resource_reference(&ice->state.last_res.sf_cl_vp, NULL); + pipe_resource_reference(&ice->state.last_res.color_calc, NULL); + pipe_resource_reference(&ice->state.last_res.scissor, NULL); + pipe_resource_reference(&ice->state.last_res.blend, NULL); } static unsigned |