1bf215546Sopenharmony_ci/************************************************************************** 2bf215546Sopenharmony_ci * 3bf215546Sopenharmony_ci * Copyright 2012 VMware, Inc. 4bf215546Sopenharmony_ci * All Rights Reserved. 5bf215546Sopenharmony_ci * 6bf215546Sopenharmony_ci * Permission is hereby granted, free of charge, to any person obtaining a 7bf215546Sopenharmony_ci * copy of this software and associated documentation files (the 8bf215546Sopenharmony_ci * "Software"), to deal in the Software without restriction, including 9bf215546Sopenharmony_ci * without limitation the rights to use, copy, modify, merge, publish, 10bf215546Sopenharmony_ci * distribute, sub license, and/or sell copies of the Software, and to 11bf215546Sopenharmony_ci * permit persons to whom the Software is furnished to do so, subject to 12bf215546Sopenharmony_ci * the following conditions: 13bf215546Sopenharmony_ci * 14bf215546Sopenharmony_ci * The above copyright notice and this permission notice (including the 15bf215546Sopenharmony_ci * next paragraph) shall be included in all copies or substantial portions 16bf215546Sopenharmony_ci * of the Software. 17bf215546Sopenharmony_ci * 18bf215546Sopenharmony_ci * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS 19bf215546Sopenharmony_ci * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 20bf215546Sopenharmony_ci * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. 21bf215546Sopenharmony_ci * IN NO EVENT SHALL VMWARE AND/OR ITS SUPPLIERS BE LIABLE FOR 22bf215546Sopenharmony_ci * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, 23bf215546Sopenharmony_ci * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE 24bf215546Sopenharmony_ci * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 25bf215546Sopenharmony_ci * 26bf215546Sopenharmony_ci **************************************************************************/ 27bf215546Sopenharmony_ci 28bf215546Sopenharmony_ci/** 29bf215546Sopenharmony_ci * @file 30bf215546Sopenharmony_ci * u_debug_flush.h - Header for debugging flush- and map- related issues. 31bf215546Sopenharmony_ci * - Flush while synchronously mapped. 32bf215546Sopenharmony_ci * - Command stream reference while synchronously mapped. 33bf215546Sopenharmony_ci * - Synchronous map while referenced on command stream. 34bf215546Sopenharmony_ci * - Recursive maps. 35bf215546Sopenharmony_ci * - Unmap while not mapped. 36bf215546Sopenharmony_ci * 37bf215546Sopenharmony_ci * @author Thomas Hellstrom <thellstrom@vmware.com> 38bf215546Sopenharmony_ci */ 39bf215546Sopenharmony_ci#ifdef DEBUG 40bf215546Sopenharmony_ci 41bf215546Sopenharmony_ci#ifndef U_DEBUG_FLUSH_H_ 42bf215546Sopenharmony_ci#define U_DEBUG_FLUSH_H_ 43bf215546Sopenharmony_ci 44bf215546Sopenharmony_cistruct debug_flush_buf; 45bf215546Sopenharmony_cistruct debug_flush_ctx; 46bf215546Sopenharmony_ci 47bf215546Sopenharmony_ci/** 48bf215546Sopenharmony_ci * Create a buffer (AKA allocation) representation. 49bf215546Sopenharmony_ci * 50bf215546Sopenharmony_ci * @param supports_persistent Whether persistent maps are truly supported. 51bf215546Sopenharmony_ci * @param bt_depth Depth of backtrace to be captured for this buffer 52bf215546Sopenharmony_ci * representation. 53bf215546Sopenharmony_ci */ 54bf215546Sopenharmony_cistruct debug_flush_buf * 55bf215546Sopenharmony_cidebug_flush_buf_create(boolean supports_persistent, unsigned bt_depth); 56bf215546Sopenharmony_ci 57bf215546Sopenharmony_ci/** 58bf215546Sopenharmony_ci * Reference a buffer representation. 59bf215546Sopenharmony_ci * 60bf215546Sopenharmony_ci * @param dst Pointer copy destination 61bf215546Sopenharmony_ci * @param src Pointer copy source (may be NULL). 62bf215546Sopenharmony_ci * 63bf215546Sopenharmony_ci * Replace a pointer to a buffer representation with proper refcounting. 64bf215546Sopenharmony_ci */ 65bf215546Sopenharmony_civoid 66bf215546Sopenharmony_cidebug_flush_buf_reference(struct debug_flush_buf **dst, 67bf215546Sopenharmony_ci struct debug_flush_buf *src); 68bf215546Sopenharmony_ci 69bf215546Sopenharmony_ci/** 70bf215546Sopenharmony_ci * Create a context representation. 71bf215546Sopenharmony_ci * 72bf215546Sopenharmony_ci * @param catch_map_of_referenced Whether to catch synchronous maps of buffers 73bf215546Sopenharmony_ci * already present on the command stream. 74bf215546Sopenharmony_ci * @param bt_depth Depth of backtrace to be captured for this context 75bf215546Sopenharmony_ci * representation. 76bf215546Sopenharmony_ci */ 77bf215546Sopenharmony_cistruct debug_flush_ctx * 78bf215546Sopenharmony_cidebug_flush_ctx_create(boolean catch_map_of_referenced, unsigned bt_depth); 79bf215546Sopenharmony_ci 80bf215546Sopenharmony_ci/** 81bf215546Sopenharmony_ci * Destroy a context representation. 82bf215546Sopenharmony_ci * 83bf215546Sopenharmony_ci * @param fctx The context representation to destroy. 84bf215546Sopenharmony_ci */ 85bf215546Sopenharmony_civoid 86bf215546Sopenharmony_cidebug_flush_ctx_destroy(struct debug_flush_ctx *fctx); 87bf215546Sopenharmony_ci 88bf215546Sopenharmony_ci/** 89bf215546Sopenharmony_ci * Map annotation 90bf215546Sopenharmony_ci * 91bf215546Sopenharmony_ci * @param fbuf The buffer representation to map. 92bf215546Sopenharmony_ci * @param flags Pipebuffer flags for the map. 93bf215546Sopenharmony_ci * 94bf215546Sopenharmony_ci * Used to annotate a map of the buffer described by the buffer representation. 95bf215546Sopenharmony_ci */ 96bf215546Sopenharmony_civoid debug_flush_map(struct debug_flush_buf *fbuf, unsigned flags); 97bf215546Sopenharmony_ci 98bf215546Sopenharmony_ci/** 99bf215546Sopenharmony_ci * Unmap annotation 100bf215546Sopenharmony_ci * 101bf215546Sopenharmony_ci * @param fbuf The buffer representation to map. 102bf215546Sopenharmony_ci * 103bf215546Sopenharmony_ci * Used to annotate an unmap of the buffer described by the 104bf215546Sopenharmony_ci * buffer representation. 105bf215546Sopenharmony_ci */ 106bf215546Sopenharmony_civoid debug_flush_unmap(struct debug_flush_buf *fbuf); 107bf215546Sopenharmony_ci 108bf215546Sopenharmony_ci/** 109bf215546Sopenharmony_ci * Might flush annotation 110bf215546Sopenharmony_ci * 111bf215546Sopenharmony_ci * @param fctx The context representation that might be flushed. 112bf215546Sopenharmony_ci * 113bf215546Sopenharmony_ci * Used to annotate a conditional (possible) flush of the given context. 114bf215546Sopenharmony_ci */ 115bf215546Sopenharmony_civoid debug_flush_might_flush(struct debug_flush_ctx *fctx); 116bf215546Sopenharmony_ci 117bf215546Sopenharmony_ci/** 118bf215546Sopenharmony_ci * Flush annotation 119bf215546Sopenharmony_ci * 120bf215546Sopenharmony_ci * @param fctx The context representation that is flushed. 121bf215546Sopenharmony_ci * 122bf215546Sopenharmony_ci * Used to annotate a real flush of the given context. 123bf215546Sopenharmony_ci */ 124bf215546Sopenharmony_civoid debug_flush_flush(struct debug_flush_ctx *fctx); 125bf215546Sopenharmony_ci 126bf215546Sopenharmony_ci 127bf215546Sopenharmony_ci/** 128bf215546Sopenharmony_ci * Flush annotation 129bf215546Sopenharmony_ci * 130bf215546Sopenharmony_ci * @param fctx The context representation that is flushed. 131bf215546Sopenharmony_ci * 132bf215546Sopenharmony_ci * Used to annotate a real flush of the given context. 133bf215546Sopenharmony_ci */ 134bf215546Sopenharmony_civoid debug_flush_cb_reference(struct debug_flush_ctx *fctx, 135bf215546Sopenharmony_ci struct debug_flush_buf *fbuf); 136bf215546Sopenharmony_ci 137bf215546Sopenharmony_ci#endif 138bf215546Sopenharmony_ci#endif 139