mirror of
https://gitlab.freedesktop.org/monado/monado.git
synced 2025-01-19 13:18:32 +00:00
aux/util: Add function to free device and stuff hanging off it
This commit is contained in:
parent
9b6625961a
commit
b67d65b4a5
|
@ -273,3 +273,17 @@ u_device_allocate(enum u_device_alloc_flags flags,
|
||||||
|
|
||||||
return xdev;
|
return xdev;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
u_device_free(struct xrt_device *xdev)
|
||||||
|
{
|
||||||
|
if (xdev->hmd != NULL) {
|
||||||
|
free(xdev->hmd->distortion.mesh.vertices);
|
||||||
|
xdev->hmd->distortion.mesh.vertices = NULL;
|
||||||
|
|
||||||
|
free(xdev->hmd->distortion.mesh.indices);
|
||||||
|
xdev->hmd->distortion.mesh.indices = NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
free(xdev);
|
||||||
|
}
|
||||||
|
|
|
@ -80,6 +80,8 @@ u_device_dump_config(struct xrt_device *xdev,
|
||||||
* placed after the device in memory.
|
* placed after the device in memory.
|
||||||
*
|
*
|
||||||
* Will setup any pointers and num values.
|
* Will setup any pointers and num values.
|
||||||
|
*
|
||||||
|
* @ingroup aux_util
|
||||||
*/
|
*/
|
||||||
void *
|
void *
|
||||||
u_device_allocate(enum u_device_alloc_flags flags,
|
u_device_allocate(enum u_device_alloc_flags flags,
|
||||||
|
@ -87,6 +89,14 @@ u_device_allocate(enum u_device_alloc_flags flags,
|
||||||
size_t num_inputs,
|
size_t num_inputs,
|
||||||
size_t num_outputs);
|
size_t num_outputs);
|
||||||
|
|
||||||
|
/*!
|
||||||
|
* Helper function to free a device and any data hanging of it.
|
||||||
|
*
|
||||||
|
* @ingroup aux_util
|
||||||
|
*/
|
||||||
|
void
|
||||||
|
u_device_free(struct xrt_device *xdev);
|
||||||
|
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue