vc4: Fix leaks of the CL contents.
authorEric Anholt <eric@anholt.net>
Mon, 15 Dec 2014 04:41:25 +0000 (20:41 -0800)
committerEric Anholt <eric@anholt.net>
Mon, 15 Dec 2014 07:12:11 +0000 (23:12 -0800)
src/gallium/drivers/vc4/vc4_cl.c
src/gallium/drivers/vc4/vc4_context.c

index 29b956e6e9a8bd0af294e1a4fd5673f59d3c1e8d..36dd28c48c02236e5b2c20d4768a5abc453689c2 100644 (file)
  */
 
 #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;
 }
index fd65f432bac34cbf287fbec354d26988eabd1c79..e49d6549929dcdfe8d027790bfe864e806d3bd10 100644 (file)
@@ -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;