Reviewed-by: Marek Olšák <mar...@gmail.com> Marek
On Mon, Jun 24, 2013 at 6:44 PM, Brian Paul <bri...@vmware.com> wrote: > That confuses Gallium's memory debugging code where CALLOC/MALLOC > must be matched with FREE, not free(). > --- > src/gallium/auxiliary/hud/hud_cpu.c | 12 +++++++++++- > src/gallium/auxiliary/hud/hud_fps.c | 12 +++++++++++- > src/gallium/auxiliary/hud/hud_private.h | 2 +- > 3 files changed, 23 insertions(+), 3 deletions(-) > > diff --git a/src/gallium/auxiliary/hud/hud_cpu.c > b/src/gallium/auxiliary/hud/hud_cpu.c > index ce98115..cd20dee 100644 > --- a/src/gallium/auxiliary/hud/hud_cpu.c > +++ b/src/gallium/auxiliary/hud/hud_cpu.c > @@ -116,6 +116,12 @@ query_cpu_load(struct hud_graph *gr) > } > } > > +static void > +free_query_data(void *p) > +{ > + FREE(p); > +} > + > void > hud_cpu_graph_install(struct hud_pane *pane, unsigned cpu_index) > { > @@ -144,7 +150,11 @@ hud_cpu_graph_install(struct hud_pane *pane, unsigned > cpu_index) > } > > gr->query_new_value = query_cpu_load; > - gr->free_query_data = free; > + > + /* Don't use free() as our callback as that messes up Gallium's > + * memory debugger. Use simple free_query_data() wrapper. > + */ > + gr->free_query_data = free_query_data; > > info = gr->query_data; > info->cpu_index = cpu_index; > diff --git a/src/gallium/auxiliary/hud/hud_fps.c > b/src/gallium/auxiliary/hud/hud_fps.c > index 80381f5..6e9be71 100644 > --- a/src/gallium/auxiliary/hud/hud_fps.c > +++ b/src/gallium/auxiliary/hud/hud_fps.c > @@ -60,6 +60,12 @@ query_fps(struct hud_graph *gr) > } > } > > +static void > +free_query_data(void *p) > +{ > + FREE(p); > +} > + > void > hud_fps_graph_install(struct hud_pane *pane) > { > @@ -76,7 +82,11 @@ hud_fps_graph_install(struct hud_pane *pane) > } > > gr->query_new_value = query_fps; > - gr->free_query_data = free; > + > + /* Don't use free() as our callback as that messes up Gallium's > + * memory debugger. Use simple free_query_data() wrapper. > + */ > + gr->free_query_data = free_query_data; > > hud_pane_add_graph(pane, gr); > } > diff --git a/src/gallium/auxiliary/hud/hud_private.h > b/src/gallium/auxiliary/hud/hud_private.h > index 2b7d56b..1606ada 100644 > --- a/src/gallium/auxiliary/hud/hud_private.h > +++ b/src/gallium/auxiliary/hud/hud_private.h > @@ -42,7 +42,7 @@ struct hud_graph { > char name[128]; > void *query_data; > void (*query_new_value)(struct hud_graph *gr); > - void (*free_query_data)(void *ptr); > + void (*free_query_data)(void *ptr); /**< do not use ordinary free() */ > > /* mutable variables */ > unsigned num_vertices; > -- > 1.7.10.4 > > _______________________________________________ > mesa-dev mailing list > mesa-dev@lists.freedesktop.org > http://lists.freedesktop.org/mailman/listinfo/mesa-dev _______________________________________________ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev