mirror of
https://gitlab.freedesktop.org/monado/monado.git
synced 2025-01-17 04:15:44 +00:00
comp: Add XRT_COMPOSITOR_DESIRED_MODE env var to choose mode for direct mode.
The variable should be set to the index in the enumeration of a modes according to VK_KHR_display. Monado can print a list of available modes with their indices with the env var XRT_COMPOSITOR_PRINT_MODES=1.
This commit is contained in:
parent
c2250e5af0
commit
1cf742a3dc
|
@ -21,6 +21,7 @@ DEBUG_GET_ONCE_BOOL_OPTION(force_wayland, "XRT_COMPOSITOR_FORCE_WAYLAND", false)
|
|||
DEBUG_GET_ONCE_BOOL_OPTION(validate_vulkan, "XRT_COMPOSITOR_VULKAN_VALIDATION", false)
|
||||
DEBUG_GET_ONCE_BOOL_OPTION(wireframe, "XRT_COMPOSITOR_WIREFRAME", false)
|
||||
DEBUG_GET_ONCE_NUM_OPTION(force_gpu_index, "XRT_COMPOSITOR_FORCE_GPU_INDEX", -1)
|
||||
DEBUG_GET_ONCE_NUM_OPTION(desired_mode, "XRT_COMPOSITOR_DESIRED_MODE", -1)
|
||||
// clang-format on
|
||||
|
||||
void
|
||||
|
@ -49,6 +50,7 @@ comp_settings_init(struct comp_settings *s, struct xrt_device *xdev)
|
|||
s->validate_vulkan = debug_get_bool_option_validate_vulkan();
|
||||
s->gpu_index = debug_get_num_option_force_gpu_index();
|
||||
s->debug.wireframe = debug_get_bool_option_wireframe();
|
||||
s->desired_mode = debug_get_num_option_desired_mode();
|
||||
|
||||
if (debug_get_bool_option_force_nvidia()) {
|
||||
s->window_type = WINDOW_DIRECT_NVIDIA;
|
||||
|
|
|
@ -96,6 +96,9 @@ struct comp_settings
|
|||
|
||||
//! Run the compositor on this Vulkan physical device
|
||||
int gpu_index;
|
||||
|
||||
//! Try to choose the mode with this index for direct mode
|
||||
int desired_mode;
|
||||
};
|
||||
|
||||
/*!
|
||||
|
|
|
@ -479,8 +479,26 @@ comp_window_direct_get_primary_display_mode(struct comp_window_direct *w,
|
|||
|
||||
print_modes(w, mode_properties, mode_count);
|
||||
|
||||
int chosen_mode =
|
||||
choose_best_vk_mode_auto(w, mode_properties, mode_count);
|
||||
|
||||
int chosen_mode = 0;
|
||||
|
||||
int desired_mode = w->base.c->settings.desired_mode;
|
||||
if (desired_mode + 1 > (int)mode_count) {
|
||||
COMP_ERROR(w->base.c,
|
||||
"Requested mode index %d, but max is %d. Falling "
|
||||
"back to automatic mode selection",
|
||||
desired_mode, mode_count);
|
||||
chosen_mode =
|
||||
choose_best_vk_mode_auto(w, mode_properties, mode_count);
|
||||
} else if (desired_mode < 0) {
|
||||
chosen_mode =
|
||||
choose_best_vk_mode_auto(w, mode_properties, mode_count);
|
||||
} else {
|
||||
COMP_DEBUG(w->base.c, "Using manually chosen mode %d",
|
||||
desired_mode);
|
||||
chosen_mode = desired_mode;
|
||||
}
|
||||
|
||||
VkDisplayModePropertiesKHR props = mode_properties[chosen_mode];
|
||||
|
||||
COMP_DEBUG(w->base.c, "found display mode %dx%d@%.2f",
|
||||
|
|
Loading…
Reference in a new issue