mirror of
https://gitlab.freedesktop.org/monado/monado.git
synced 2025-01-31 19:08:30 +00:00
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.
This commit is contained in:
parent
6b8103f31b
commit
c2250e5af0
|
@ -221,6 +221,18 @@ comp_compositor_print(struct comp_compositor *c,
|
||||||
} \
|
} \
|
||||||
} while (false)
|
} while (false)
|
||||||
|
|
||||||
|
/*!
|
||||||
|
* Mode printing.
|
||||||
|
*
|
||||||
|
* @ingroup comp
|
||||||
|
*/
|
||||||
|
#define COMP_PRINT_MODE(c, ...) \
|
||||||
|
do { \
|
||||||
|
if (c->settings.print_modes) { \
|
||||||
|
comp_compositor_print(c, __func__, __VA_ARGS__); \
|
||||||
|
} \
|
||||||
|
} while (false)
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* Error level logging.
|
* Error level logging.
|
||||||
*
|
*
|
||||||
|
|
|
@ -13,6 +13,7 @@
|
||||||
// clang-format off
|
// clang-format off
|
||||||
DEBUG_GET_ONCE_BOOL_OPTION(print_spew, "XRT_COMPOSITOR_PRINT_SPEW", false)
|
DEBUG_GET_ONCE_BOOL_OPTION(print_spew, "XRT_COMPOSITOR_PRINT_SPEW", false)
|
||||||
DEBUG_GET_ONCE_BOOL_OPTION(print_debug, "XRT_COMPOSITOR_PRINT_DEBUG", false)
|
DEBUG_GET_ONCE_BOOL_OPTION(print_debug, "XRT_COMPOSITOR_PRINT_DEBUG", false)
|
||||||
|
DEBUG_GET_ONCE_BOOL_OPTION(print_modes, "XRT_COMPOSITOR_PRINT_MODES", false)
|
||||||
DEBUG_GET_ONCE_BOOL_OPTION(force_randr, "XRT_COMPOSITOR_FORCE_RANDR", false)
|
DEBUG_GET_ONCE_BOOL_OPTION(force_randr, "XRT_COMPOSITOR_FORCE_RANDR", false)
|
||||||
DEBUG_GET_ONCE_BOOL_OPTION(force_nvidia, "XRT_COMPOSITOR_FORCE_NVIDIA", false)
|
DEBUG_GET_ONCE_BOOL_OPTION(force_nvidia, "XRT_COMPOSITOR_FORCE_NVIDIA", false)
|
||||||
DEBUG_GET_ONCE_BOOL_OPTION(force_xcb, "XRT_COMPOSITOR_FORCE_XCB", false)
|
DEBUG_GET_ONCE_BOOL_OPTION(force_xcb, "XRT_COMPOSITOR_FORCE_XCB", false)
|
||||||
|
@ -44,6 +45,7 @@ comp_settings_init(struct comp_settings *s, struct xrt_device *xdev)
|
||||||
s->nominal_frame_interval_ns = interval_ns;
|
s->nominal_frame_interval_ns = interval_ns;
|
||||||
s->print_spew = debug_get_bool_option_print_spew();
|
s->print_spew = debug_get_bool_option_print_spew();
|
||||||
s->print_debug = debug_get_bool_option_print_debug();
|
s->print_debug = debug_get_bool_option_print_debug();
|
||||||
|
s->print_modes = debug_get_bool_option_print_modes();
|
||||||
s->validate_vulkan = debug_get_bool_option_validate_vulkan();
|
s->validate_vulkan = debug_get_bool_option_validate_vulkan();
|
||||||
s->gpu_index = debug_get_num_option_force_gpu_index();
|
s->gpu_index = debug_get_num_option_force_gpu_index();
|
||||||
s->debug.wireframe = debug_get_bool_option_wireframe();
|
s->debug.wireframe = debug_get_bool_option_wireframe();
|
||||||
|
|
|
@ -82,6 +82,9 @@ struct comp_settings
|
||||||
//! Should we debug print.
|
//! Should we debug print.
|
||||||
bool print_debug;
|
bool print_debug;
|
||||||
|
|
||||||
|
//! Print information about available modes for direct mode.
|
||||||
|
bool print_modes;
|
||||||
|
|
||||||
//! Should we flip y axis for compositor buffers (for GL)
|
//! Should we flip y axis for compositor buffers (for GL)
|
||||||
bool flip_y;
|
bool flip_y;
|
||||||
|
|
||||||
|
|
|
@ -428,6 +428,24 @@ choose_best_vk_mode_auto(struct comp_window_direct *w,
|
||||||
return best_mode.index;
|
return best_mode.index;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
print_modes(struct comp_window_direct *w,
|
||||||
|
VkDisplayModePropertiesKHR *mode_properties,
|
||||||
|
int mode_count)
|
||||||
|
{
|
||||||
|
COMP_PRINT_MODE(w->base.c, "Available Vk modes for direct mode");
|
||||||
|
for (int i = 0; i < mode_count; i++) {
|
||||||
|
VkDisplayModePropertiesKHR props = mode_properties[i];
|
||||||
|
uint16_t width = props.parameters.visibleRegion.width;
|
||||||
|
uint16_t height = props.parameters.visibleRegion.height;
|
||||||
|
float refresh = (float)props.parameters.refreshRate / 1000.;
|
||||||
|
|
||||||
|
COMP_PRINT_MODE(w->base.c, "| %2d | %dx%d@%.2f", i, width,
|
||||||
|
height, refresh);
|
||||||
|
}
|
||||||
|
COMP_PRINT_MODE(w->base.c, "Listed %d modes", mode_count);
|
||||||
|
}
|
||||||
|
|
||||||
static VkDisplayModeKHR
|
static VkDisplayModeKHR
|
||||||
comp_window_direct_get_primary_display_mode(struct comp_window_direct *w,
|
comp_window_direct_get_primary_display_mode(struct comp_window_direct *w,
|
||||||
VkDisplayKHR display)
|
VkDisplayKHR display)
|
||||||
|
@ -459,6 +477,8 @@ comp_window_direct_get_primary_display_mode(struct comp_window_direct *w,
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
print_modes(w, mode_properties, mode_count);
|
||||||
|
|
||||||
int chosen_mode =
|
int chosen_mode =
|
||||||
choose_best_vk_mode_auto(w, mode_properties, mode_count);
|
choose_best_vk_mode_auto(w, mode_properties, mode_count);
|
||||||
VkDisplayModePropertiesKHR props = mode_properties[chosen_mode];
|
VkDisplayModePropertiesKHR props = mode_properties[chosen_mode];
|
||||||
|
|
Loading…
Reference in a new issue