nv30: avoid leaking render state and draw shaders
authorIlia Mirkin <imirkin@alum.mit.edu>
Sun, 24 May 2015 06:23:16 +0000 (02:23 -0400)
committerIlia Mirkin <imirkin@alum.mit.edu>
Sun, 24 May 2015 06:26:29 +0000 (02:26 -0400)
Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
Cc: "10.5 10.6" <mesa-stable@lists.freedesktop.org>
src/gallium/drivers/nouveau/nv30/nv30_draw.c
src/gallium/drivers/nouveau/nv30/nv30_fragprog.c
src/gallium/drivers/nouveau/nv30/nv30_vertprog.c

index 3575c3d29fa8e0457abe767a5694b59f508155cc..13aad7a4e09ebafb1275b8c14507e9ad7535aafe 100644 (file)
@@ -103,6 +103,7 @@ nv30_render_unmap_vertices(struct vbuf_render *render,
 {
    struct nv30_render *r = nv30_render(render);
    pipe_buffer_unmap(&r->nv30->base.pipe, r->transfer);
+   r->transfer = NULL;
 }
 
 static void
@@ -444,6 +445,12 @@ nv30_render_vbo(struct pipe_context *pipe, const struct pipe_draw_info *info)
 static void
 nv30_render_destroy(struct vbuf_render *render)
 {
+   struct nv30_render *r = nv30_render(render);
+
+   if (r->transfer)
+      pipe_buffer_unmap(&r->nv30->base.pipe, r->transfer);
+   pipe_resource_reference(&r->buffer, NULL);
+   nouveau_heap_free(&r->vertprog);
    FREE(render);
 }
 
index ee669b1c1fce54c6a4398600bf5d72237dd52dcf..7f227868f737ef2c9c68c2e5c1697905a2a4cae0 100644 (file)
@@ -23,6 +23,7 @@
  *
  */
 
+#include "draw/draw_context.h"
 #include "tgsi/tgsi_parse.h"
 
 #include "nv_object.xml.h"
@@ -147,6 +148,9 @@ nv30_fp_state_delete(struct pipe_context *pipe, void *hwcso)
 
    pipe_resource_reference(&fp->buffer, NULL);
 
+   if (fp->draw)
+      draw_delete_fragment_shader(nv30_context(pipe)->draw, fp->draw);
+
    FREE((void *)fp->pipe.tokens);
    FREE(fp->insn);
    FREE(fp->consts);
index 3c1b7e714ea24e70ca847447a7a64f715bfa1767..4d4145d10b5dc73fd5b201aeb27c561cdf57c5a9 100644 (file)
@@ -23,6 +23,7 @@
  *
  */
 
+#include "draw/draw_context.h"
 #include "util/u_dynarray.h"
 #include "tgsi/tgsi_parse.h"
 
@@ -237,6 +238,10 @@ nv30_vp_state_delete(struct pipe_context *pipe, void *hwcso)
 
    if (vp->translated)
       nv30_vertprog_destroy(vp);
+
+   if (vp->draw)
+      draw_delete_vertex_shader(nv30_context(pipe)->draw, vp->draw);
+
    FREE((void *)vp->pipe.tokens);
    FREE(vp);
 }