2 * Copyright 2017 Advanced Micro Devices, Inc.
5 * Permission is hereby granted, free of charge, to any person obtaining a
6 * copy of this software and associated documentation files (the "Software"),
7 * to deal in the Software without restriction, including without limitation
8 * on the rights to use, copy, modify, merge, publish, distribute, sub
9 * license, and/or sell copies of the Software, and to permit persons to whom
10 * the Software is furnished to do so, subject to the following conditions:
12 * The above copyright notice and this permission notice (including the next
13 * paragraph) shall be included in all copies or substantial portions of the
16 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18 * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL
19 * THE AUTHOR(S) AND/OR THEIR SUPPLIERS BE LIABLE FOR ANY CLAIM,
20 * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
21 * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
22 * USE OR OTHER DEALINGS IN THE SOFTWARE.
27 * \file u_async_debug.h
28 * Provides a helper implementation of pipe_debug_callback which allows debug
29 * messages from non-application threads to be passed back to the application
33 #ifndef UTIL_ASYNC_DEBUG_H
34 #define UTIL_ASYNC_DEBUG_H
36 #include "pipe/p_state.h"
38 #include "util/simple_mtx.h"
40 struct util_debug_message
{
42 enum pipe_debug_type type
;
46 struct util_async_debug_callback
{
47 struct pipe_debug_callback base
;
52 struct util_debug_message
*messages
;
56 u_async_debug_init(struct util_async_debug_callback
*adbg
);
58 u_async_debug_cleanup(struct util_async_debug_callback
*adbg
);
61 _u_async_debug_drain(struct util_async_debug_callback
*adbg
,
62 struct pipe_debug_callback
*dst
);
65 u_async_debug_drain(struct util_async_debug_callback
*adbg
,
66 struct pipe_debug_callback
*dst
)
68 /* Read the count without taking the lock to avoid atomics in the fast path.
69 * We'll re-read the count after taking the lock. */
71 _u_async_debug_drain(adbg
, dst
);
74 #endif /* UTIL_ASYNC_DEBUG_H */