1 /**************************************************************************
3 * Copyright 2012 VMware, Inc.
6 * Permission is hereby granted, free of charge, to any person obtaining a
7 * copy of this software and associated documentation files (the
8 * "Software"), to deal in the Software without restriction, including
9 * without limitation the rights to use, copy, modify, merge, publish,
10 * distribute, sub license, and/or sell copies of the Software, and to
11 * permit persons to whom the Software is furnished to do so, subject to
12 * the following conditions:
14 * The above copyright notice and this permission notice (including the
15 * next paragraph) shall be included in all copies or substantial portions
18 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
19 * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
20 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
21 * IN NO EVENT SHALL VMWARE AND/OR ITS SUPPLIERS BE LIABLE FOR
22 * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
23 * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
24 * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
26 **************************************************************************/
30 * u_debug_flush.h - Header for debugging flush- and map- related issues.
31 * - Flush while synchronously mapped.
32 * - Command stream reference while synchronously mapped.
33 * - Synchronous map while referenced on command stream.
35 * - Unmap while not mapped.
37 * @author Thomas Hellstrom <thellstrom@vmware.com>
41 #ifndef U_DEBUG_FLUSH_H_
42 #define U_DEBUG_FLUSH_H_
44 struct debug_flush_buf
;
45 struct debug_flush_ctx
;
48 * Create a buffer (AKA allocation) representation.
50 * @param supports_persistent Whether persistent maps are truly supported.
51 * @param bt_depth Depth of backtrace to be captured for this buffer
54 struct debug_flush_buf
*
55 debug_flush_buf_create(boolean supports_persistent
, unsigned bt_depth
);
58 * Reference a buffer representation.
60 * @param dst Pointer copy destination
61 * @param src Pointer copy source (may be NULL).
63 * Replace a pointer to a buffer representation with proper refcounting.
66 debug_flush_buf_reference(struct debug_flush_buf
**dst
,
67 struct debug_flush_buf
*src
);
70 * Create a context representation.
72 * @param catch_map_of_referenced Whether to catch synchronous maps of buffers
73 * already present on the command stream.
74 * @param bt_depth Depth of backtrace to be captured for this context
77 struct debug_flush_ctx
*
78 debug_flush_ctx_create(boolean catch_map_of_referenced
, unsigned bt_depth
);
81 * Destroy a context representation.
83 * @param fctx The context representation to destroy.
86 debug_flush_ctx_destroy(struct debug_flush_ctx
*fctx
);
91 * @param fbuf The buffer representation to map.
92 * @param flags Pipebuffer flags for the map.
94 * Used to annotate a map of the buffer described by the buffer representation.
96 void debug_flush_map(struct debug_flush_buf
*fbuf
, unsigned flags
);
101 * @param fbuf The buffer representation to map.
103 * Used to annotate an unmap of the buffer described by the
104 * buffer representation.
106 void debug_flush_unmap(struct debug_flush_buf
*fbuf
);
109 * Might flush annotation
111 * @param fctx The context representation that might be flushed.
113 * Used to annotate a conditional (possible) flush of the given context.
115 void debug_flush_might_flush(struct debug_flush_ctx
*fctx
);
120 * @param fctx The context representation that is flushed.
122 * Used to annotate a real flush of the given context.
124 void debug_flush_flush(struct debug_flush_ctx
*fctx
);
130 * @param fctx The context representation that is flushed.
132 * Used to annotate a real flush of the given context.
134 void debug_flush_cb_reference(struct debug_flush_ctx
*fctx
,
135 struct debug_flush_buf
*fbuf
);