vtest: properly clean up resources

Call virgl_renderer_resource_unref from resource_destroy_func.  Do
not rely on virgl_renderer_cleanup to clean up for us.  This is
needed for proper multiple client support, where we need to clean up
client resources when a client dies.

Signed-off-by: Chia-I Wu <olvaffe@gmail.com>
Reviewed-by: Alexandros Frantzis <alexandros.frantzis@collabora.com>
macos/master
Chia-I Wu 5 years ago
parent eca6ebc2ef
commit ad1b7b15dd
  1. 11
      vtest/vtest_renderer.c

@ -135,6 +135,12 @@ static void
resource_destroy_func(void *value)
{
struct vtest_resource *res = value;
/* virgl_renderer_ctx_detach_resource and virgl_renderer_resource_detach_iov
* are implied
*/
virgl_renderer_resource_unref(res->res_id);
if (res->iov.iov_base)
munmap(res->iov.iov_base, res->iov.iov_len);
free(res);
@ -705,13 +711,8 @@ int vtest_resource_unref(UNUSED uint32_t length_dw)
}
handle = res_unref_buf[VCMD_RES_UNREF_RES_HANDLE];
/* XXX check that handle is owned by ctx */
virgl_renderer_ctx_attach_resource(ctx->ctx_id, handle);
virgl_renderer_resource_detach_iov(handle, NULL, NULL);
util_hash_table_remove(renderer.resource_table, intptr_to_pointer(handle));
virgl_renderer_resource_unref(handle);
return 0;
}

Loading…
Cancel
Save