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 **************************************************************************/
34 * This is the interface that Gallium3D requires any window system
35 * hosting it to implement. This is the only include file in Gallium3D
40 /** Opaque type for a buffer */
41 struct pipe_buffer_handle
;
44 * Gallium3D drivers are (meant to be!) independent of both GL and the
45 * window system. The window system provides a buffer manager and a
46 * set of additional hooks for things like command buffer submission,
49 * There clearly has to be some agreement between the window system
50 * driver and the hardware driver about the format of command buffers,
59 struct pipe_buffer_handle
;
63 /** Returns name of this winsys interface */
64 const char *(*get_name
)( struct pipe_winsys
*sws
);
66 /** Wait for any buffered rendering to finish */
67 void (*wait_idle
)( struct pipe_winsys
*sws
, void *context_private
);
70 * Do any special operations to ensure frontbuffer contents are
71 * displayed, eg copy fake frontbuffer.
73 void (*flush_frontbuffer
)( struct pipe_winsys
*sws
,
74 struct pipe_surface
*surf
,
75 void *context_private
);
78 void (*printf
)( struct pipe_winsys
*sws
,
83 * flags is bitmask of PIPE_SURFACE_FLAG_RENDER, PIPE_SURFACE_FLAG_TEXTURE
85 struct pipe_region
*(*region_alloc
)(struct pipe_winsys
*ws
,
86 unsigned cpp
, unsigned width
,
87 unsigned height
, unsigned flags
);
89 void (*region_release
)(struct pipe_winsys
*ws
, struct pipe_region
**r
);
92 /** allocate a new surface (no context dependency) */
93 struct pipe_surface
*(*surface_alloc
)(struct pipe_winsys
*ws
,
96 void (*surface_release
)(struct pipe_winsys
*ws
, struct pipe_surface
**s
);
99 * The buffer manager is modeled after the dri_bufmgr interface, which
100 * in turn is modeled after the ARB_vertex_buffer_object extension,
101 * but this is the subset that gallium cares about. Remember that
102 * gallium gets to choose the interface it needs, and the window
103 * systems must then implement that interface (rather than the
104 * other way around...).
106 struct pipe_buffer_handle
*(*buffer_create
)(struct pipe_winsys
*sws
,
107 unsigned alignment
);
109 /** Create a buffer that wraps user-space data */
110 struct pipe_buffer_handle
*(*user_buffer_create
)(struct pipe_winsys
*sws
,
116 * Map the entire data store of a buffer object into the client's address.
117 * flags is bitmask of PIPE_BUFFER_FLAG_READ/WRITE.
119 void *(*buffer_map
)( struct pipe_winsys
*sws
,
120 struct pipe_buffer_handle
*buf
,
123 void (*buffer_unmap
)( struct pipe_winsys
*sws
,
124 struct pipe_buffer_handle
*buf
);
126 /** Set ptr = buf, with reference counting */
127 void (*buffer_reference
)( struct pipe_winsys
*sws
,
128 struct pipe_buffer_handle
**ptr
,
129 struct pipe_buffer_handle
*buf
);
132 * Create the data store of a buffer and optionally initialize it.
134 * usage is a bitmask of PIPE_BUFFER_USAGE_PIXEL/VERTEX/INDEX/CONSTANT. This
135 * usage argument is only an optimization hint, not a guarantee, therefore
136 * proper behavior must be observed in all circumstances.
138 void (*buffer_data
)(struct pipe_winsys
*sws
,
139 struct pipe_buffer_handle
*buf
,
140 unsigned size
, const void *data
,
143 /** Modify some or all of the data contained in a buffer's data store */
144 void (*buffer_subdata
)(struct pipe_winsys
*sws
,
145 struct pipe_buffer_handle
*buf
,
146 unsigned long offset
,
150 /** Query some or all of the data contained in a buffer's data store */
151 void (*buffer_get_subdata
)(struct pipe_winsys
*sws
,
152 struct pipe_buffer_handle
*buf
,
153 unsigned long offset
,
161 #endif /* P_WINSYS_H */