The open source OpenXR runtime
0
fork

Configure Feed

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

comp: print available modes with XRT_COMPOSITOR_PRINT_MODES=1

To not clutter the user's output with debug info, add a variable to print only the available modes.

authored by

Christoph Haag and committed by
Lubosz Sarnecki
c2250e5a 6b8103f3

+37
+12
src/xrt/compositor/main/comp_compositor.h
··· 222 222 } while (false) 223 223 224 224 /*! 225 + * Mode printing. 226 + * 227 + * @ingroup comp 228 + */ 229 + #define COMP_PRINT_MODE(c, ...) \ 230 + do { \ 231 + if (c->settings.print_modes) { \ 232 + comp_compositor_print(c, __func__, __VA_ARGS__); \ 233 + } \ 234 + } while (false) 235 + 236 + /*! 225 237 * Error level logging. 226 238 * 227 239 * @ingroup comp
+2
src/xrt/compositor/main/comp_settings.c
··· 13 13 // clang-format off 14 14 DEBUG_GET_ONCE_BOOL_OPTION(print_spew, "XRT_COMPOSITOR_PRINT_SPEW", false) 15 15 DEBUG_GET_ONCE_BOOL_OPTION(print_debug, "XRT_COMPOSITOR_PRINT_DEBUG", false) 16 + DEBUG_GET_ONCE_BOOL_OPTION(print_modes, "XRT_COMPOSITOR_PRINT_MODES", false) 16 17 DEBUG_GET_ONCE_BOOL_OPTION(force_randr, "XRT_COMPOSITOR_FORCE_RANDR", false) 17 18 DEBUG_GET_ONCE_BOOL_OPTION(force_nvidia, "XRT_COMPOSITOR_FORCE_NVIDIA", false) 18 19 DEBUG_GET_ONCE_BOOL_OPTION(force_xcb, "XRT_COMPOSITOR_FORCE_XCB", false) ··· 44 45 s->nominal_frame_interval_ns = interval_ns; 45 46 s->print_spew = debug_get_bool_option_print_spew(); 46 47 s->print_debug = debug_get_bool_option_print_debug(); 48 + s->print_modes = debug_get_bool_option_print_modes(); 47 49 s->validate_vulkan = debug_get_bool_option_validate_vulkan(); 48 50 s->gpu_index = debug_get_num_option_force_gpu_index(); 49 51 s->debug.wireframe = debug_get_bool_option_wireframe();
+3
src/xrt/compositor/main/comp_settings.h
··· 82 82 //! Should we debug print. 83 83 bool print_debug; 84 84 85 + //! Print information about available modes for direct mode. 86 + bool print_modes; 87 + 85 88 //! Should we flip y axis for compositor buffers (for GL) 86 89 bool flip_y; 87 90
+20
src/xrt/compositor/main/comp_window_direct_mode.cpp
··· 428 428 return best_mode.index; 429 429 } 430 430 431 + static void 432 + print_modes(struct comp_window_direct *w, 433 + VkDisplayModePropertiesKHR *mode_properties, 434 + int mode_count) 435 + { 436 + COMP_PRINT_MODE(w->base.c, "Available Vk modes for direct mode"); 437 + for (int i = 0; i < mode_count; i++) { 438 + VkDisplayModePropertiesKHR props = mode_properties[i]; 439 + uint16_t width = props.parameters.visibleRegion.width; 440 + uint16_t height = props.parameters.visibleRegion.height; 441 + float refresh = (float)props.parameters.refreshRate / 1000.; 442 + 443 + COMP_PRINT_MODE(w->base.c, "| %2d | %dx%d@%.2f", i, width, 444 + height, refresh); 445 + } 446 + COMP_PRINT_MODE(w->base.c, "Listed %d modes", mode_count); 447 + } 448 + 431 449 static VkDisplayModeKHR 432 450 comp_window_direct_get_primary_display_mode(struct comp_window_direct *w, 433 451 VkDisplayKHR display) ··· 458 476 delete[] mode_properties; 459 477 return nullptr; 460 478 } 479 + 480 + print_modes(w, mode_properties, mode_count); 461 481 462 482 int chosen_mode = 463 483 choose_best_vk_mode_auto(w, mode_properties, mode_count);