Mesa (master): vc4: Fix leaks of the CL contents.

Eric Anholt anholt at kemper.freedesktop.org
Mon Dec 15 07:12:47 UTC 2014


Module: Mesa
Branch: master
Commit: 667719fcb2296d73e1897d4071da6dd30b2cc6ac
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=667719fcb2296d73e1897d4071da6dd30b2cc6ac

Author: Eric Anholt <eric at anholt.net>
Date:   Sun Dec 14 20:41:25 2014 -0800

vc4: Fix leaks of the CL contents.

---

 src/gallium/drivers/vc4/vc4_cl.c      |    5 ++++-
 src/gallium/drivers/vc4/vc4_context.c |    2 ++
 2 files changed, 6 insertions(+), 1 deletion(-)

diff --git a/src/gallium/drivers/vc4/vc4_cl.c b/src/gallium/drivers/vc4/vc4_cl.c
index 29b956e..36dd28c 100644
--- a/src/gallium/drivers/vc4/vc4_cl.c
+++ b/src/gallium/drivers/vc4/vc4_cl.c
@@ -22,11 +22,14 @@
  */
 
 #include "util/u_math.h"
+#include "util/ralloc.h"
 #include "vc4_context.h"
 
 void
 vc4_init_cl(struct vc4_context *vc4, struct vc4_cl *cl)
 {
+        cl->base = ralloc_size(vc4, 1);
+        cl->end = cl->next = cl->base;
 }
 
 void
@@ -35,7 +38,7 @@ vc4_grow_cl(struct vc4_cl *cl)
         uint32_t size = MAX2((cl->end - cl->base) * 2, 4096);
         uint32_t offset = cl->next -cl->base;
 
-        cl->base = realloc(cl->base, size);
+        cl->base = reralloc(ralloc_parent(cl->base), cl->base, uint8_t, size);
         cl->end = cl->base + size;
         cl->next = cl->base + offset;
 }
diff --git a/src/gallium/drivers/vc4/vc4_context.c b/src/gallium/drivers/vc4/vc4_context.c
index fd65f43..e49d654 100644
--- a/src/gallium/drivers/vc4/vc4_context.c
+++ b/src/gallium/drivers/vc4/vc4_context.c
@@ -472,7 +472,9 @@ vc4_context_create(struct pipe_screen *pscreen, void *priv)
         vc4_init_cl(vc4, &vc4->bcl);
         vc4_init_cl(vc4, &vc4->rcl);
         vc4_init_cl(vc4, &vc4->shader_rec);
+        vc4_init_cl(vc4, &vc4->uniforms);
         vc4_init_cl(vc4, &vc4->bo_handles);
+        vc4_init_cl(vc4, &vc4->bo_pointers);
 
         vc4->dirty = ~0;
         vc4->fd = screen->fd;




More information about the mesa-commit mailing list