mirror of
https://gitlab.freedesktop.org/monado/monado.git
synced 2025-01-01 12:46:12 +00:00
xrt: Add hz suffix, follow code style and add limit to refresh rate array
This commit is contained in:
parent
dbfc322e41
commit
f84bef916f
|
@ -1078,8 +1078,8 @@ comp_main_create_system_compositor(struct xrt_device *xdev,
|
|||
|
||||
|
||||
//! @todo: Query all supported refresh rates of the current mode
|
||||
sys_info->num_refresh_rates = 1;
|
||||
sys_info->refresh_rates[0] = (float)(1. / time_ns_to_s(c->settings.nominal_frame_interval_ns));
|
||||
sys_info->refresh_rate_count = 1;
|
||||
sys_info->refresh_rates_hz[0] = (float)(1. / time_ns_to_s(c->settings.nominal_frame_interval_ns));
|
||||
|
||||
// Needs to be delayed until after compositor's u_var has been setup.
|
||||
if (!c->deferred_surface) {
|
||||
|
|
|
@ -291,8 +291,8 @@ compositor_init_sys_info(struct null_compositor *c, struct xrt_device *xdev)
|
|||
sys_info->supported_blend_mode_count = (uint8_t)xdev->hmd->blend_mode_count;
|
||||
|
||||
// Refresh rates.
|
||||
sys_info->num_refresh_rates = 1;
|
||||
sys_info->refresh_rates[0] = (float)(1. / time_ns_to_s(c->settings.frame_interval_ns));
|
||||
sys_info->refresh_rate_count = 1;
|
||||
sys_info->refresh_rates_hz[0] = (float)(1. / time_ns_to_s(c->settings.frame_interval_ns));
|
||||
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -2086,8 +2086,8 @@ struct xrt_system_compositor_info
|
|||
//! Number of meaningful elements in xrt_system_compositor_info::supported_blend_modes
|
||||
uint8_t supported_blend_mode_count;
|
||||
|
||||
uint32_t num_refresh_rates;
|
||||
float refresh_rates[1];
|
||||
uint32_t refresh_rate_count;
|
||||
float refresh_rates_hz[XRT_MAX_SUPPORTED_REFRESH_RATES];
|
||||
|
||||
//! The vk device as used by the compositor, never changes.
|
||||
xrt_uuid_t compositor_vk_deviceUUID;
|
||||
|
|
|
@ -39,6 +39,11 @@
|
|||
*/
|
||||
#define XRT_MAX_SWAPCHAIN_CREATE_INFO_FORMAT_LIST_COUNT 8
|
||||
|
||||
/*!
|
||||
* Max number of supported display refresh rates, artificial limit.
|
||||
*/
|
||||
#define XRT_MAX_SUPPORTED_REFRESH_RATES 16
|
||||
|
||||
/*!
|
||||
* @}
|
||||
*/
|
||||
|
|
|
@ -577,7 +577,8 @@ oxr_xrEnumerateDisplayRefreshRatesFB(XrSession session,
|
|||
}
|
||||
|
||||
OXR_TWO_CALL_HELPER(&log, displayRefreshRateCapacityInput, displayRefreshRateCountOutput, displayRefreshRates,
|
||||
sess->sys->xsysc->info.num_refresh_rates, sess->sys->xsysc->info.refresh_rates, XR_SUCCESS);
|
||||
sess->sys->xsysc->info.refresh_rate_count, sess->sys->xsysc->info.refresh_rates_hz,
|
||||
XR_SUCCESS);
|
||||
}
|
||||
|
||||
XRAPI_ATTR XrResult XRAPI_CALL
|
||||
|
@ -594,11 +595,11 @@ oxr_xrGetDisplayRefreshRateFB(XrSession session, float *displayRefreshRate)
|
|||
return XR_SUCCESS;
|
||||
}
|
||||
|
||||
if (sess->sys->xsysc->info.num_refresh_rates < 1) {
|
||||
if (sess->sys->xsysc->info.refresh_rate_count < 1) {
|
||||
return XR_ERROR_RUNTIME_FAILURE;
|
||||
}
|
||||
|
||||
*displayRefreshRate = sess->sys->xsysc->info.refresh_rates[0];
|
||||
*displayRefreshRate = sess->sys->xsysc->info.refresh_rates_hz[0];
|
||||
return XR_SUCCESS;
|
||||
}
|
||||
|
||||
|
|
|
@ -299,8 +299,8 @@ compositor_init_sys_info(struct sdl_compositor *c, struct sdl_program *sp, struc
|
|||
sys_info->supported_blend_mode_count = (uint8_t)xdev->hmd->blend_mode_count;
|
||||
|
||||
// Refresh rates.
|
||||
sys_info->num_refresh_rates = 1;
|
||||
sys_info->refresh_rates[0] = (float)(1. / time_ns_to_s(c->settings.frame_interval_ns));
|
||||
sys_info->refresh_rate_count = 1;
|
||||
sys_info->refresh_rates_hz[0] = (float)(1. / time_ns_to_s(c->settings.frame_interval_ns));
|
||||
|
||||
return true;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue