iris: plug leaks
This commit is contained in:
@@ -252,6 +252,8 @@ iris_batch_free(struct iris_batch *batch)
|
|||||||
_mesa_hash_table_destroy(batch->cache.render, NULL);
|
_mesa_hash_table_destroy(batch->cache.render, NULL);
|
||||||
_mesa_set_destroy(batch->cache.depth, NULL);
|
_mesa_set_destroy(batch->cache.depth, NULL);
|
||||||
|
|
||||||
|
iris_destroy_binder(&batch->binder);
|
||||||
|
|
||||||
if (batch->state_sizes) {
|
if (batch->state_sizes) {
|
||||||
_mesa_hash_table_destroy(batch->state_sizes, NULL);
|
_mesa_hash_table_destroy(batch->state_sizes, NULL);
|
||||||
gen_batch_decode_ctx_finish(&batch->decoder);
|
gen_batch_decode_ctx_finish(&batch->decoder);
|
||||||
|
@@ -79,6 +79,7 @@ iris_destroy_context(struct pipe_context *ctx)
|
|||||||
if (ctx->stream_uploader)
|
if (ctx->stream_uploader)
|
||||||
u_upload_destroy(ctx->stream_uploader);
|
u_upload_destroy(ctx->stream_uploader);
|
||||||
|
|
||||||
|
ice->vtbl.destroy_state(ice);
|
||||||
iris_destroy_program_cache(ice);
|
iris_destroy_program_cache(ice);
|
||||||
u_upload_destroy(ice->state.surface_uploader);
|
u_upload_destroy(ice->state.surface_uploader);
|
||||||
u_upload_destroy(ice->state.dynamic_uploader);
|
u_upload_destroy(ice->state.dynamic_uploader);
|
||||||
|
@@ -341,6 +341,11 @@ iris_destroy_program_cache(struct iris_context *ice)
|
|||||||
ice->shaders.prog[i] = NULL;
|
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);
|
u_upload_destroy(ice->shaders.uploader);
|
||||||
|
|
||||||
ralloc_free(ice->shaders.cache);
|
ralloc_free(ice->shaders.cache);
|
||||||
|
@@ -159,6 +159,7 @@ iris_resource_destroy(struct pipe_screen *screen,
|
|||||||
struct iris_resource *res = (struct iris_resource *)resource;
|
struct iris_resource *res = (struct iris_resource *)resource;
|
||||||
|
|
||||||
iris_bo_unreference(res->bo);
|
iris_bo_unreference(res->bo);
|
||||||
|
free(res);
|
||||||
}
|
}
|
||||||
|
|
||||||
static struct iris_resource *
|
static struct iris_resource *
|
||||||
|
@@ -1260,6 +1260,7 @@ iris_set_viewport_states(struct pipe_context *ctx,
|
|||||||
vp_map += GENX(SF_CLIP_VIEWPORT_length);
|
vp_map += GENX(SF_CLIP_VIEWPORT_length);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
free(ice->state.cso_vp);
|
||||||
ice->state.cso_vp = cso;
|
ice->state.cso_vp = cso;
|
||||||
ice->state.num_viewports = num_viewports;
|
ice->state.num_viewports = num_viewports;
|
||||||
ice->state.dirty |= IRIS_DIRTY_SF_CL_VIEWPORT;
|
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)
|
const struct pipe_vertex_buffer *buffers)
|
||||||
{
|
{
|
||||||
struct iris_context *ice = (struct iris_context *) ctx;
|
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
|
/* If there are no buffers, do nothing. We can leave the stale
|
||||||
* 3DSTATE_VERTEX_BUFFERS in place - as long as there are no vertex
|
* 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)
|
if (!buffers)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
struct iris_vertex_buffer_state *cso =
|
||||||
|
malloc(sizeof(struct iris_vertex_buffer_state));
|
||||||
|
|
||||||
iris_free_vertex_buffers(ice->state.cso_vertex_buffers);
|
iris_free_vertex_buffers(ice->state.cso_vertex_buffers);
|
||||||
|
|
||||||
cso->num_buffers = count;
|
cso->num_buffers = count;
|
||||||
@@ -2746,14 +2748,27 @@ iris_upload_render_state(struct iris_context *ice,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* State module teardown.
|
||||||
|
*/
|
||||||
static void
|
static void
|
||||||
iris_destroy_state(struct iris_context *ice)
|
iris_destroy_state(struct iris_context *ice)
|
||||||
{
|
{
|
||||||
|
iris_free_vertex_buffers(ice->state.cso_vertex_buffers);
|
||||||
|
|
||||||
// XXX: unreference resources/surfaces.
|
// XXX: unreference resources/surfaces.
|
||||||
for (unsigned i = 0; i < ice->state.framebuffer.nr_cbufs; i++) {
|
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.cbufs[i], NULL);
|
||||||
}
|
}
|
||||||
pipe_surface_reference(&ice->state.framebuffer.zsbuf, 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
|
static unsigned
|
||||||
|
Reference in New Issue
Block a user