The open source OpenXR runtime

u/logging: add U_LOG_XDEV_UNSUPPORTED_INPUT macro

Part-of: <https://gitlab.freedesktop.org/monado/monado/-/merge_requests/2271>

+25 -1
+25 -1
src/xrt/auxiliary/util/u_logging.h
··· 1 - // Copyright 2020, Collabora, Ltd. 1 + // Copyright 2020-2024, Collabora, Ltd. 2 2 // SPDX-License-Identifier: BSL-1.0 3 3 /*! 4 4 * @file 5 5 * @brief Basic logging functionality. 6 6 * @author Jakob Bornecrantz <jakob@collabora.com> 7 + * @author Simon Zeni <simon.zeni@collabora.com> 7 8 * @ingroup aux_log 8 9 */ 9 10 ··· 11 12 #pragma once 12 13 13 14 #include "xrt/xrt_compiler.h" 15 + 16 + #include "util/u_pretty_print.h" 14 17 15 18 #include <stdarg.h> 16 19 ··· 367 370 //! Conditionally log a device-related memory hexdump message at U_LOGGING_DEBUG level. 368 371 #define U_LOG_XDEV_IFL_D_HEX(xdev, cond_level, data, data_size) \ 369 372 U_LOG_XDEV_IFL_HEX(U_LOGGING_DEBUG, cond_level, xdev, data, data_size) 373 + /*! 374 + * @} 375 + */ 376 + 377 + /*! 378 + * @name Device-related error logging macros 379 + * 380 + * These are printed from a driver at error level. 381 + * 382 + * @param xdev The @ref xrt_device pointer associated with this message 383 + * 384 + * @{ 385 + */ 386 + #define U_LOG_XDEV_UNSUPPORTED_INPUT(xdev, cond_level, name) \ 387 + do { \ 388 + struct u_pp_sink_stack_only sink; \ 389 + u_pp_delegate_t dg = u_pp_sink_stack_only_init(&sink); \ 390 + u_pp_xrt_input_name(dg, name); \ 391 + U_LOG_XDEV_IFL_E(xdev, cond_level, "Unsupported input: %s", sink.buffer); \ 392 + } while (false); 393 + 370 394 /*! 371 395 * @} 372 396 */