The open source OpenXR runtime
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

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.

authored by

Christoph Haag and committed by
Lubosz Sarnecki
1cf742a3 c2250e5a

+25 -2
+2
src/xrt/compositor/main/comp_settings.c
··· 21 21 DEBUG_GET_ONCE_BOOL_OPTION(validate_vulkan, "XRT_COMPOSITOR_VULKAN_VALIDATION", false) 22 22 DEBUG_GET_ONCE_BOOL_OPTION(wireframe, "XRT_COMPOSITOR_WIREFRAME", false) 23 23 DEBUG_GET_ONCE_NUM_OPTION(force_gpu_index, "XRT_COMPOSITOR_FORCE_GPU_INDEX", -1) 24 + DEBUG_GET_ONCE_NUM_OPTION(desired_mode, "XRT_COMPOSITOR_DESIRED_MODE", -1) 24 25 // clang-format on 25 26 26 27 void ··· 49 50 s->validate_vulkan = debug_get_bool_option_validate_vulkan(); 50 51 s->gpu_index = debug_get_num_option_force_gpu_index(); 51 52 s->debug.wireframe = debug_get_bool_option_wireframe(); 53 + s->desired_mode = debug_get_num_option_desired_mode(); 52 54 53 55 if (debug_get_bool_option_force_nvidia()) { 54 56 s->window_type = WINDOW_DIRECT_NVIDIA;
+3
src/xrt/compositor/main/comp_settings.h
··· 96 96 97 97 //! Run the compositor on this Vulkan physical device 98 98 int gpu_index; 99 + 100 + //! Try to choose the mode with this index for direct mode 101 + int desired_mode; 99 102 }; 100 103 101 104 /*!
+20 -2
src/xrt/compositor/main/comp_window_direct_mode.cpp
··· 479 479 480 480 print_modes(w, mode_properties, mode_count); 481 481 482 - int chosen_mode = 483 - choose_best_vk_mode_auto(w, mode_properties, mode_count); 482 + 483 + int chosen_mode = 0; 484 + 485 + int desired_mode = w->base.c->settings.desired_mode; 486 + if (desired_mode + 1 > (int)mode_count) { 487 + COMP_ERROR(w->base.c, 488 + "Requested mode index %d, but max is %d. Falling " 489 + "back to automatic mode selection", 490 + desired_mode, mode_count); 491 + chosen_mode = 492 + choose_best_vk_mode_auto(w, mode_properties, mode_count); 493 + } else if (desired_mode < 0) { 494 + chosen_mode = 495 + choose_best_vk_mode_auto(w, mode_properties, mode_count); 496 + } else { 497 + COMP_DEBUG(w->base.c, "Using manually chosen mode %d", 498 + desired_mode); 499 + chosen_mode = desired_mode; 500 + } 501 + 484 502 VkDisplayModePropertiesKHR props = mode_properties[chosen_mode]; 485 503 486 504 COMP_DEBUG(w->base.c, "found display mode %dx%d@%.2f",