mirror of
https://github.com/lbgos/rift-s-linux.git
synced 2026-10-29 04:02:05 +01:00
u/system_helpers: Make system devices easier to embed
This commit is contained in:
1 parent
54ce551d75
commit
0b7deed16f
2 files changed
+24
-9
No files matched your search
@@ -26,15 +26,8 @@
|
||||
static void
|
||||
destroy(struct xrt_system_devices *xsysd)
|
||||
{
|
||||
struct u_system_devices *usysd = u_system_devices(xsysd);
|
||||
|
||||
for (uint32_t i = 0; i < ARRAY_SIZE(usysd->base.xdevs); i++) {
|
||||
xrt_device_destroy(&usysd->base.xdevs[i]);
|
||||
}
|
||||
|
||||
xrt_frame_context_destroy_nodes(&usysd->xfctx);
|
||||
|
||||
free(usysd);
|
||||
u_system_devices_close(xsysd);
|
||||
free(xsysd);
|
||||
}
|
||||
|
||||
|
||||
@@ -53,6 +46,18 @@ u_system_devices_allocate(void)
|
||||
return usysd;
|
||||
}
|
||||
|
||||
void
|
||||
u_system_devices_close(struct xrt_system_devices *xsysd)
|
||||
{
|
||||
struct u_system_devices *usysd = u_system_devices(xsysd);
|
||||
|
||||
for (uint32_t i = 0; i < ARRAY_SIZE(usysd->base.xdevs); i++) {
|
||||
xrt_device_destroy(&usysd->base.xdevs[i]);
|
||||
}
|
||||
|
||||
xrt_frame_context_destroy_nodes(&usysd->xfctx);
|
||||
}
|
||||
|
||||
xrt_result_t
|
||||
u_system_devices_create_from_prober(struct xrt_instance *xinst,
|
||||
struct xrt_system_devices **out_xsysd,
|
||||
|
||||
@@ -61,6 +61,16 @@ u_system_devices(struct xrt_system_devices *xsysd)
|
||||
struct u_system_devices *
|
||||
u_system_devices_allocate(void);
|
||||
|
||||
/*!
|
||||
* Destroys all devices and clears out the frame context, doesn't free the
|
||||
* struct itself, useful for code embedding the system devices struct into
|
||||
* other objects where it's not the first member or C++ classes.
|
||||
*
|
||||
* @ingroup aux_util
|
||||
*/
|
||||
void
|
||||
u_system_devices_close(struct xrt_system_devices *xsysd);
|
||||
|
||||
/*!
|
||||
* Takes a @ref xrt_instance, gets the prober from it and then uses the prober
|
||||
* to allocate a filled in @ref u_system_devices.
|
||||
|
||||
Reference in new issue
Block a user