c/main: Use log levels

This commit is contained in:
Jakob Bornecrantz 2020-10-06 20:37:01 +01:00
parent bbeab1da3f
commit b5e5322f49
4 changed files with 10 additions and 18 deletions

View file

@ -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) {

View file

@ -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.

View file

@ -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();

View file

@ -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;