1 /**************************************************************************
3 * Copyright 2007 Tungsten Graphics, Inc., Cedar Park, Texas.
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 TUNGSTEN GRAPHICS 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 **************************************************************************/
32 * "Fenced buffers" is actually a misnomer. They should be referred as
33 * "fenceable buffers", i.e, buffers that can be fenced, but I couldn't find
34 * the word "fenceable" in the dictionary.
36 * A "fenced buffer" is a decorator around a normal buffer, which adds two
38 * - the ability for the destruction to be delayed by a fence;
39 * - reference counting.
41 * Usually DMA buffers have a life-time that will extend the life-time of its
42 * handle. The end-of-life is dictated by the fence signalling.
44 * Between the handle's destruction, and the fence signalling, the buffer is
45 * stored in a fenced buffer list.
47 * \author Jose Fonseca <jrfonseca@tungstengraphics.com>
50 #ifndef PB_BUFFER_FENCED_H_
51 #define PB_BUFFER_FENCED_H_
54 #include "util/u_debug.h"
63 struct pipe_fence_handle
;
67 * List of buffers which are awaiting fence signalling.
69 struct fenced_buffer_list
;
74 void (*destroy
)( struct pb_fence_ops
*ops
);
76 /** Set ptr = fence, with reference counting */
77 void (*fence_reference
)( struct pb_fence_ops
*ops
,
78 struct pipe_fence_handle
**ptr
,
79 struct pipe_fence_handle
*fence
);
82 * Checks whether the fence has been signalled.
83 * \param flags driver-specific meaning
84 * \return zero on success.
86 int (*fence_signalled
)( struct pb_fence_ops
*ops
,
87 struct pipe_fence_handle
*fence
,
91 * Wait for the fence to finish.
92 * \param flags driver-specific meaning
93 * \return zero on success.
95 int (*fence_finish
)( struct pb_fence_ops
*ops
,
96 struct pipe_fence_handle
*fence
,
105 #endif /*PB_BUFFER_FENCED_H_*/