mirror of
https://gitlab.freedesktop.org/monado/monado.git
synced 2024-12-29 11:06:18 +00:00
st/oxr: Fix system xdev init
This commit is contained in:
parent
94d4822afb
commit
b84413cc35
|
@ -23,6 +23,11 @@
|
||||||
DEBUG_GET_ONCE_NUM_OPTION(scale_percentage, "OXR_VIEWPORT_SCALE_PERCENTAGE", 140)
|
DEBUG_GET_ONCE_NUM_OPTION(scale_percentage, "OXR_VIEWPORT_SCALE_PERCENTAGE", 140)
|
||||||
// clang-format on
|
// clang-format on
|
||||||
|
|
||||||
|
static inline size_t
|
||||||
|
min_size_t(size_t a, size_t b)
|
||||||
|
{
|
||||||
|
return a < b ? a : b;
|
||||||
|
}
|
||||||
|
|
||||||
static bool
|
static bool
|
||||||
oxr_system_matches(struct oxr_logger *log,
|
oxr_system_matches(struct oxr_logger *log,
|
||||||
|
@ -96,11 +101,12 @@ oxr_system_fill_in(struct oxr_logger *log,
|
||||||
struct xrt_device **xdevs,
|
struct xrt_device **xdevs,
|
||||||
size_t num_xdevs)
|
size_t num_xdevs)
|
||||||
{
|
{
|
||||||
|
size_t num_copy = min_size_t(ARRAY_SIZE(sys->xdevs), num_xdevs);
|
||||||
|
|
||||||
for (uint32_t i = 4; i < ARRAY_SIZE(sys->xdevs); i++) {
|
for (uint32_t i = 0; i < num_copy; i++) {
|
||||||
sys->xdevs[i] = xdevs[i];
|
sys->xdevs[i] = xdevs[i];
|
||||||
}
|
}
|
||||||
for (size_t i = ARRAY_SIZE(sys->xdevs); i < num_xdevs; i++) {
|
for (size_t i = num_copy; i < num_xdevs; i++) {
|
||||||
oxr_xdev_destroy(&xdevs[i]);
|
oxr_xdev_destroy(&xdevs[i]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue