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 **************************************************************************/
36 * This is the interface that Gallium3D requires any window system
37 * hosting it to implement. This is the only include file in Gallium3D
42 /** Opaque type for a buffer */
43 struct pipe_buffer_handle
;
46 struct pipe_fence_handle
;
52 * Gallium3D drivers are (meant to be!) independent of both GL and the
53 * window system. The window system provides a buffer manager and a
54 * set of additional hooks for things like command buffer submission,
57 * There clearly has to be some agreement between the window system
58 * driver and the hardware driver about the format of command buffers,
63 /** Returns name of this winsys interface */
64 const char *(*get_name
)( struct pipe_winsys
*sws
);
67 * Do any special operations to ensure frontbuffer contents are
68 * displayed, eg copy fake frontbuffer.
70 void (*flush_frontbuffer
)( struct pipe_winsys
*sws
,
71 struct pipe_surface
*surf
,
72 void *context_private
);
75 void (*printf
)( struct pipe_winsys
*sws
,
80 * flags is bitmask of PIPE_SURFACE_FLAG_RENDER, PIPE_SURFACE_FLAG_TEXTURE
82 unsigned (*surface_pitch
)(struct pipe_winsys
*ws
, unsigned cpp
,
83 unsigned with
, unsigned flags
);
85 /** allocate a new surface (no context dependency) */
86 struct pipe_surface
*(*surface_alloc
)(struct pipe_winsys
*ws
,
87 enum pipe_format format
);
89 void (*surface_release
)(struct pipe_winsys
*ws
, struct pipe_surface
**s
);
93 * The buffer manager is modeled after the dri_bufmgr interface, which
94 * in turn is modeled after the ARB_vertex_buffer_object extension,
95 * but this is the subset that gallium cares about. Remember that
96 * gallium gets to choose the interface it needs, and the window
97 * systems must then implement that interface (rather than the
98 * other way around...).
100 struct pipe_buffer_handle
*(*buffer_create
)( struct pipe_winsys
*sws
,
105 /** Create a buffer that wraps user-space data */
106 struct pipe_buffer_handle
*(*user_buffer_create
)(struct pipe_winsys
*sws
,
111 * Map the entire data store of a buffer object into the client's address.
112 * flags is bitmask of PIPE_BUFFER_FLAG_READ/WRITE.
114 void *(*buffer_map
)( struct pipe_winsys
*sws
,
115 struct pipe_buffer_handle
*buf
,
118 void (*buffer_unmap
)( struct pipe_winsys
*sws
,
119 struct pipe_buffer_handle
*buf
);
121 /** Set ptr = buf, with reference counting */
122 void (*buffer_reference
)( struct pipe_winsys
*sws
,
123 struct pipe_buffer_handle
**ptr
,
124 struct pipe_buffer_handle
*buf
);
127 * Create the data store of a buffer and optionally initialize it.
129 * usage is a bitmask of PIPE_BUFFER_USAGE_PIXEL/VERTEX/INDEX/CONSTANT. This
130 * usage argument is only an optimization hint, not a guarantee, therefore
131 * proper behavior must be observed in all circumstances.
133 * Returns zero on success.
135 int (*buffer_data
)(struct pipe_winsys
*sws
,
136 struct pipe_buffer_handle
*buf
,
137 unsigned size
, const void *data
,
141 * Modify some or all of the data contained in a buffer's data store.
143 * Returns zero on success.
145 int (*buffer_subdata
)(struct pipe_winsys
*sws
,
146 struct pipe_buffer_handle
*buf
,
147 unsigned long offset
,
152 * Query some or all of the data contained in a buffer's data store.
154 * Returns zero on success.
156 int (*buffer_get_subdata
)(struct pipe_winsys
*sws
,
157 struct pipe_buffer_handle
*buf
,
158 unsigned long offset
,
163 /** Set ptr = buf, with reference counting */
164 void (*fence_reference
)( struct pipe_winsys
*sws
,
165 struct pipe_fence_handle
**ptr
,
166 struct pipe_fence_handle
*fence
);
169 * Checks whether the fence has been signalled.
171 * The meaning of flag is pipe-driver specific.
173 * Returns zero if it has.
175 int (*fence_signalled
)( struct pipe_winsys
*sws
,
176 struct pipe_fence_handle
*fence
,
180 * Wait for the fence to finish.
182 * The meaning of flag is pipe-driver specific.
184 * Returns zero on success.
186 int (*fence_finish
)( struct pipe_winsys
*sws
,
187 struct pipe_fence_handle
*fence
,
195 #endif /* P_WINSYS_H */