![]() |
|
|||
0001 /************************************************************************** 0002 * 0003 * Copyright (c) 2006-2009 VMware, Inc., Palo Alto, CA., USA 0004 * All Rights Reserved. 0005 * 0006 * Permission is hereby granted, free of charge, to any person obtaining a 0007 * copy of this software and associated documentation files (the 0008 * "Software"), to deal in the Software without restriction, including 0009 * without limitation the rights to use, copy, modify, merge, publish, 0010 * distribute, sub license, and/or sell copies of the Software, and to 0011 * permit persons to whom the Software is furnished to do so, subject to 0012 * the following conditions: 0013 * 0014 * The above copyright notice and this permission notice (including the 0015 * next paragraph) shall be included in all copies or substantial portions 0016 * of the Software. 0017 * 0018 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 0019 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 0020 * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL 0021 * THE COPYRIGHT HOLDERS, AUTHORS AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, 0022 * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR 0023 * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE 0024 * USE OR OTHER DEALINGS IN THE SOFTWARE. 0025 * 0026 **************************************************************************/ 0027 /* 0028 * Authors: Thomas Hellstrom <thellstrom-at-vmware-dot-com> 0029 */ 0030 0031 #ifndef _TTM_EXECBUF_UTIL_H_ 0032 #define _TTM_EXECBUF_UTIL_H_ 0033 0034 #include <linux/list.h> 0035 0036 #include "ttm_bo_api.h" 0037 0038 /** 0039 * struct ttm_validate_buffer 0040 * 0041 * @head: list head for thread-private list. 0042 * @bo: refcounted buffer object pointer. 0043 * @num_shared: How many shared fences we want to add. 0044 */ 0045 0046 struct ttm_validate_buffer { 0047 struct list_head head; 0048 struct ttm_buffer_object *bo; 0049 unsigned int num_shared; 0050 }; 0051 0052 /** 0053 * function ttm_eu_backoff_reservation 0054 * 0055 * @ticket: ww_acquire_ctx from reserve call 0056 * @list: thread private list of ttm_validate_buffer structs. 0057 * 0058 * Undoes all buffer validation reservations for bos pointed to by 0059 * the list entries. 0060 */ 0061 void ttm_eu_backoff_reservation(struct ww_acquire_ctx *ticket, 0062 struct list_head *list); 0063 0064 /** 0065 * function ttm_eu_reserve_buffers 0066 * 0067 * @ticket: [out] ww_acquire_ctx filled in by call, or NULL if only 0068 * non-blocking reserves should be tried. 0069 * @list: thread private list of ttm_validate_buffer structs. 0070 * @intr: should the wait be interruptible 0071 * @dups: [out] optional list of duplicates. 0072 * @del_lru: true if BOs should be removed from the LRU. 0073 * 0074 * Tries to reserve bos pointed to by the list entries for validation. 0075 * If the function returns 0, all buffers are marked as "unfenced", 0076 * taken off the lru lists and are not synced for write CPU usage. 0077 * 0078 * If the function detects a deadlock due to multiple threads trying to 0079 * reserve the same buffers in reverse order, all threads except one will 0080 * back off and retry. This function may sleep while waiting for 0081 * CPU write reservations to be cleared, and for other threads to 0082 * unreserve their buffers. 0083 * 0084 * If intr is set to true, this function may return -ERESTARTSYS if the 0085 * calling process receives a signal while waiting. In that case, no 0086 * buffers on the list will be reserved upon return. 0087 * 0088 * If dups is non NULL all buffers already reserved by the current thread 0089 * (e.g. duplicates) are added to this list, otherwise -EALREADY is returned 0090 * on the first already reserved buffer and all buffers from the list are 0091 * unreserved again. 0092 * 0093 * Buffers reserved by this function should be unreserved by 0094 * a call to either ttm_eu_backoff_reservation() or 0095 * ttm_eu_fence_buffer_objects() when command submission is complete or 0096 * has failed. 0097 */ 0098 int ttm_eu_reserve_buffers(struct ww_acquire_ctx *ticket, 0099 struct list_head *list, bool intr, 0100 struct list_head *dups); 0101 0102 /** 0103 * function ttm_eu_fence_buffer_objects. 0104 * 0105 * @ticket: ww_acquire_ctx from reserve call 0106 * @list: thread private list of ttm_validate_buffer structs. 0107 * @fence: The new exclusive fence for the buffers. 0108 * 0109 * This function should be called when command submission is complete, and 0110 * it will add a new sync object to bos pointed to by entries on @list. 0111 * It also unreserves all buffers, putting them on lru lists. 0112 * 0113 */ 0114 void ttm_eu_fence_buffer_objects(struct ww_acquire_ctx *ticket, 0115 struct list_head *list, 0116 struct dma_fence *fence); 0117 0118 #endif
[ Source navigation ] | [ Diff markup ] | [ Identifier search ] | [ general search ] |
This page was automatically generated by the 2.1.0 LXR engine. The LXR team |
![]() ![]() |