v3d: Fix leak of the default attributes BOs.
authorEric Anholt <eric@anholt.net>
Thu, 5 Jul 2018 20:34:14 +0000 (13:34 -0700)
committerEric Anholt <eric@anholt.net>
Thu, 5 Jul 2018 22:50:54 +0000 (15:50 -0700)
The GLES3 CTS makes a lot more progress on a run now.

src/gallium/drivers/v3d/v3dx_state.c

index ff1c4b52125e2b67ef91d50980f299babfdf39b7..f775c531e5f640564c68ebdc0e87107fd582f321 100644 (file)
@@ -416,6 +416,15 @@ v3d_vertex_state_create(struct pipe_context *pctx, unsigned num_elements,
         return so;
 }
 
+static void
+v3d_vertex_state_delete(struct pipe_context *pctx, void *hwcso)
+{
+        struct v3d_vertex_stateobj *so = hwcso;
+
+        v3d_bo_unreference(&so->default_attribute_values);
+        free(so);
+}
+
 static void
 v3d_vertex_state_bind(struct pipe_context *pctx, void *hwcso)
 {
@@ -959,7 +968,7 @@ v3dX(state_init)(struct pipe_context *pctx)
         pctx->delete_depth_stencil_alpha_state = v3d_generic_cso_state_delete;
 
         pctx->create_vertex_elements_state = v3d_vertex_state_create;
-        pctx->delete_vertex_elements_state = v3d_generic_cso_state_delete;
+        pctx->delete_vertex_elements_state = v3d_vertex_state_delete;
         pctx->bind_vertex_elements_state = v3d_vertex_state_bind;
 
         pctx->create_sampler_state = v3d_create_sampler_state;