mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2025-12-27 23:30:10 +01:00
i965: Fix slow leak of brw->wm.compile_data->store
We were successfully freeing our compile data at context destroy, but until then we were allocating a new store every compile without freeing it. Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=56019 Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
This commit is contained in:
parent
177c82555b
commit
2fcaf4eae8
3 changed files with 6 additions and 20 deletions
|
|
@ -977,7 +977,6 @@ struct brw_context
|
|||
|
||||
struct {
|
||||
struct brw_wm_prog_data *prog_data;
|
||||
struct brw_wm_compile *compile_data;
|
||||
|
||||
/** Input sizes, calculated from active vertex program.
|
||||
* One bit per fragment program input attribute.
|
||||
|
|
|
|||
|
|
@ -72,8 +72,6 @@ static void brw_destroy_context( struct intel_context *intel )
|
|||
brw_destroy_state(brw);
|
||||
brw_draw_destroy( brw );
|
||||
|
||||
ralloc_free(brw->wm.compile_data);
|
||||
|
||||
dri_bo_release(&brw->curbe.curbe_bo);
|
||||
dri_bo_release(&brw->vs.const_bo);
|
||||
dri_bo_release(&brw->wm.const_bo);
|
||||
|
|
|
|||
|
|
@ -215,20 +215,7 @@ bool do_wm_prog(struct brw_context *brw,
|
|||
if (prog)
|
||||
fs = prog->_LinkedShaders[MESA_SHADER_FRAGMENT];
|
||||
|
||||
c = brw->wm.compile_data;
|
||||
if (c == NULL) {
|
||||
brw->wm.compile_data = rzalloc(NULL, struct brw_wm_compile);
|
||||
c = brw->wm.compile_data;
|
||||
if (c == NULL) {
|
||||
/* Ouch - big out of memory problem. Can't continue
|
||||
* without triggering a segfault, no way to signal,
|
||||
* so just return.
|
||||
*/
|
||||
return false;
|
||||
}
|
||||
} else {
|
||||
memset(c, 0, sizeof(*brw->wm.compile_data));
|
||||
}
|
||||
c = rzalloc(NULL, struct brw_wm_compile);
|
||||
|
||||
/* Allocate the references to the uniforms that will end up in the
|
||||
* prog_data associated with the compiled program, and which will be freed
|
||||
|
|
@ -239,14 +226,14 @@ bool do_wm_prog(struct brw_context *brw,
|
|||
/* The backend also sometimes adds params for texture size. */
|
||||
param_count += 2 * BRW_MAX_TEX_UNIT;
|
||||
|
||||
c->prog_data.param = rzalloc_array(c, const float *, param_count);
|
||||
c->prog_data.pull_param = rzalloc_array(c, const float *, param_count);
|
||||
c->prog_data.param = rzalloc_array(NULL, const float *, param_count);
|
||||
c->prog_data.pull_param = rzalloc_array(NULL, const float *, param_count);
|
||||
} else {
|
||||
/* brw_wm_pass0.c will also add references to 0.0 and 1.0 which are
|
||||
* uploaded as push parameters.
|
||||
*/
|
||||
int param_count = (fp->program.Base.Parameters->NumParameters + 2) * 4;
|
||||
c->prog_data.param = rzalloc_array(c, const float *, param_count);
|
||||
c->prog_data.param = rzalloc_array(NULL, const float *, param_count);
|
||||
/* The old backend never does pull constants. */
|
||||
c->prog_data.pull_param = NULL;
|
||||
}
|
||||
|
|
@ -288,6 +275,8 @@ bool do_wm_prog(struct brw_context *brw,
|
|||
&c->prog_data, sizeof(c->prog_data),
|
||||
&brw->wm.prog_offset, &brw->wm.prog_data);
|
||||
|
||||
ralloc_free(c);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue