diff --git a/src/xrt/compositor/main/comp_compositor.c b/src/xrt/compositor/main/comp_compositor.c index 7133839cf..3747c7182 100644 --- a/src/xrt/compositor/main/comp_compositor.c +++ b/src/xrt/compositor/main/comp_compositor.c @@ -722,7 +722,7 @@ compositor_init_vulkan(struct comp_compositor *c) VkResult ret; - c->vk.print = c->settings.print_debug; + c->vk.print = c->settings.log_level <= U_LOGGING_DEBUG; ret = find_get_instance_proc_addr(c); if (ret != VK_SUCCESS) { diff --git a/src/xrt/compositor/main/comp_compositor.h b/src/xrt/compositor/main/comp_compositor.h index f6139626a..3d4dfb17b 100644 --- a/src/xrt/compositor/main/comp_compositor.h +++ b/src/xrt/compositor/main/comp_compositor.h @@ -303,20 +303,14 @@ comp_swapchain_really_destroy(struct comp_swapchain *sc); * * @relates comp_compositor */ -#define COMP_SPEW(c, ...) \ - if (c->settings.print_spew) { \ - U_LOG_T(__VA_ARGS__); \ - } +#define COMP_SPEW(c, ...) U_LOG_IFL_T(c->settings.log_level, __VA_ARGS__); /*! * Debug level logging. * * @relates comp_compositor */ -#define COMP_DEBUG(c, ...) \ - if (c->settings.print_debug) { \ - U_LOG_D(__VA_ARGS__); \ - } +#define COMP_DEBUG(c, ...) U_LOG_IFL_D(c->settings.log_level, __VA_ARGS__); /*! * Mode printing. diff --git a/src/xrt/compositor/main/comp_settings.c b/src/xrt/compositor/main/comp_settings.c index 1449ab95a..834eeebbe 100644 --- a/src/xrt/compositor/main/comp_settings.c +++ b/src/xrt/compositor/main/comp_settings.c @@ -11,8 +11,7 @@ #include "comp_settings.h" // clang-format off -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_LOG_OPTION(log, "XRT_COMPOSITOR_LOG", U_LOGGING_WARN) 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_nvidia, "XRT_COMPOSITOR_FORCE_NVIDIA", false) @@ -45,8 +44,7 @@ comp_settings_init(struct comp_settings *s, struct xrt_device *xdev) s->width = xdev->hmd->screens[0].w_pixels; s->height = xdev->hmd->screens[0].h_pixels; s->nominal_frame_interval_ns = interval_ns; - s->print_spew = debug_get_bool_option_print_spew(); - s->print_debug = debug_get_bool_option_print_debug(); + s->log_level = debug_get_log_option_log(); s->print_modes = debug_get_bool_option_print_modes(); s->selected_gpu_index = debug_get_num_option_force_gpu_index(); s->client_gpu_index = debug_get_num_option_force_client_gpu_index(); diff --git a/src/xrt/compositor/main/comp_settings.h b/src/xrt/compositor/main/comp_settings.h index 7b18d8c38..b733e5d50 100644 --- a/src/xrt/compositor/main/comp_settings.h +++ b/src/xrt/compositor/main/comp_settings.h @@ -14,6 +14,9 @@ #include "xrt/xrt_compositor.h" #include "xrt/xrt_vulkan_includes.h" +#include "util/u_logging.h" + + #ifdef __cplusplus extern "C" { #endif @@ -85,11 +88,8 @@ struct comp_settings //! Not used with direct mode. bool fullscreen; - //! Should we debug print a lot! - bool print_spew; - - //! Should we debug print. - bool print_debug; + //! Logging level. + enum u_logging_level log_level; //! Print information about available modes for direct mode. bool print_modes;