mirror of
https://gitlab.freedesktop.org/monado/monado.git
synced 2025-01-19 13:18:32 +00:00
xrt: make get_visibility_mask return xrt_return_t
This commit is contained in:
parent
9d2fd53e24
commit
818e519f50
|
@ -405,10 +405,10 @@ struct xrt_device
|
||||||
* @param[in] view_index The index of the view to get the mask for.
|
* @param[in] view_index The index of the view to get the mask for.
|
||||||
* @param[out] out_mask Output mask, caller must free.
|
* @param[out] out_mask Output mask, caller must free.
|
||||||
*/
|
*/
|
||||||
void (*get_visibility_mask)(struct xrt_device *xdev,
|
xrt_result_t (*get_visibility_mask)(struct xrt_device *xdev,
|
||||||
enum xrt_visibility_mask_type type,
|
enum xrt_visibility_mask_type type,
|
||||||
uint32_t view_index,
|
uint32_t view_index,
|
||||||
struct xrt_visibility_mask **out_mask);
|
struct xrt_visibility_mask **out_mask);
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* Destroy device.
|
* Destroy device.
|
||||||
|
@ -527,13 +527,13 @@ xrt_device_compute_distortion(
|
||||||
*
|
*
|
||||||
* @public @memberof xrt_device
|
* @public @memberof xrt_device
|
||||||
*/
|
*/
|
||||||
static inline void
|
static inline xrt_result_t
|
||||||
xrt_device_get_visibility_mask(struct xrt_device *xdev,
|
xrt_device_get_visibility_mask(struct xrt_device *xdev,
|
||||||
enum xrt_visibility_mask_type type,
|
enum xrt_visibility_mask_type type,
|
||||||
uint32_t view_index,
|
uint32_t view_index,
|
||||||
struct xrt_visibility_mask **out_mask)
|
struct xrt_visibility_mask **out_mask)
|
||||||
{
|
{
|
||||||
xdev->get_visibility_mask(xdev, type, view_index, out_mask);
|
return xdev->get_visibility_mask(xdev, type, view_index, out_mask);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
|
|
|
@ -139,13 +139,14 @@ ipc_client_device_set_output(struct xrt_device *xdev, enum xrt_output_name name,
|
||||||
IPC_CHK_ONLY_PRINT(icd->ipc_c, xret, "ipc_call_device_set_output");
|
IPC_CHK_ONLY_PRINT(icd->ipc_c, xret, "ipc_call_device_set_output");
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static xrt_result_t
|
||||||
ipc_client_device_get_visibility_mask(struct xrt_device *xdev,
|
ipc_client_device_get_visibility_mask(struct xrt_device *xdev,
|
||||||
enum xrt_visibility_mask_type type,
|
enum xrt_visibility_mask_type type,
|
||||||
uint32_t view_index,
|
uint32_t view_index,
|
||||||
struct xrt_visibility_mask **out_mask)
|
struct xrt_visibility_mask **out_mask)
|
||||||
{
|
{
|
||||||
assert(false);
|
assert(false);
|
||||||
|
return XRT_ERROR_IPC_FAILURE;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
|
|
|
@ -252,7 +252,7 @@ ipc_client_hmd_is_form_factor_available(struct xrt_device *xdev, enum xrt_form_f
|
||||||
return available;
|
return available;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static xrt_result_t
|
||||||
ipc_client_hmd_get_visibility_mask(struct xrt_device *xdev,
|
ipc_client_hmd_get_visibility_mask(struct xrt_device *xdev,
|
||||||
enum xrt_visibility_mask_type type,
|
enum xrt_visibility_mask_type type,
|
||||||
uint32_t view_index,
|
uint32_t view_index,
|
||||||
|
@ -284,12 +284,13 @@ ipc_client_hmd_get_visibility_mask(struct xrt_device *xdev,
|
||||||
*out_mask = mask;
|
*out_mask = mask;
|
||||||
ipc_client_connection_unlock(ipc_c);
|
ipc_client_connection_unlock(ipc_c);
|
||||||
|
|
||||||
return;
|
return XRT_SUCCESS;
|
||||||
|
|
||||||
err_mask_free:
|
err_mask_free:
|
||||||
free(mask);
|
free(mask);
|
||||||
err_mask_unlock:
|
err_mask_unlock:
|
||||||
ipc_client_connection_unlock(ipc_c);
|
ipc_client_connection_unlock(ipc_c);
|
||||||
|
return XRT_ERROR_IPC_FAILURE;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
|
|
|
@ -1574,7 +1574,11 @@ ipc_handle_device_get_visibility_mask(volatile struct ipc_client_state *ics,
|
||||||
struct xrt_device *xdev = get_xdev(ics, device_id);
|
struct xrt_device *xdev = get_xdev(ics, device_id);
|
||||||
struct xrt_visibility_mask *mask = NULL;
|
struct xrt_visibility_mask *mask = NULL;
|
||||||
if (xdev->get_visibility_mask) {
|
if (xdev->get_visibility_mask) {
|
||||||
xrt_device_get_visibility_mask(xdev, type, view_index, &mask);
|
xret = xrt_device_get_visibility_mask(xdev, type, view_index, &mask);
|
||||||
|
if (xret != XRT_SUCCESS) {
|
||||||
|
IPC_ERROR(s, "Failed to get visibility mask");
|
||||||
|
return xret;
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
struct xrt_fov fov = xdev->hmd->distortion.fov[view_index];
|
struct xrt_fov fov = xdev->hmd->distortion.fov[view_index];
|
||||||
u_visibility_mask_get_default(type, &fov, &mask);
|
u_visibility_mask_get_default(type, &fov, &mask);
|
||||||
|
|
|
@ -1183,6 +1183,7 @@ oxr_session_get_visibility_mask(struct oxr_logger *log,
|
||||||
struct oxr_system *sys = sess->sys;
|
struct oxr_system *sys = sess->sys;
|
||||||
struct xrt_device *xdev = GET_XDEV_BY_ROLE(sess->sys, head);
|
struct xrt_device *xdev = GET_XDEV_BY_ROLE(sess->sys, head);
|
||||||
enum xrt_visibility_mask_type type = convert_mask_type(visibilityMaskType);
|
enum xrt_visibility_mask_type type = convert_mask_type(visibilityMaskType);
|
||||||
|
xrt_result_t xret;
|
||||||
|
|
||||||
assert(viewIndex < ARRAY_SIZE(sys->visibility_mask));
|
assert(viewIndex < ARRAY_SIZE(sys->visibility_mask));
|
||||||
|
|
||||||
|
@ -1197,7 +1198,8 @@ oxr_session_get_visibility_mask(struct oxr_logger *log,
|
||||||
|
|
||||||
// If we didn't have any cached mask get it.
|
// If we didn't have any cached mask get it.
|
||||||
if (mask == NULL) {
|
if (mask == NULL) {
|
||||||
xrt_device_get_visibility_mask(xdev, type, viewIndex, &mask);
|
xret = xrt_device_get_visibility_mask(xdev, type, viewIndex, &mask);
|
||||||
|
OXR_CHECK_XRET(log, sess, xret, get_visibility_mask);
|
||||||
sys->visibility_mask[viewIndex] = mask;
|
sys->visibility_mask[viewIndex] = mask;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue