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
43 struct pipe_fence_handle
;
49 * Gallium3D drivers are (meant to be!) independent of both GL and the
50 * window system. The window system provides a buffer manager and a
51 * set of additional hooks for things like command buffer submission,
54 * There clearly has to be some agreement between the window system
55 * driver and the hardware driver about the format of command buffers,
60 /** Returns name of this winsys interface */
61 const char *(*get_name
)( struct pipe_winsys
*sws
);
64 * Do any special operations to ensure frontbuffer contents are
65 * displayed, eg copy fake frontbuffer.
67 void (*flush_frontbuffer
)( struct pipe_winsys
*sws
,
68 struct pipe_surface
*surf
,
69 void *context_private
);
72 void (*printf
)( struct pipe_winsys
*sws
,
76 /** allocate a new surface (no context dependency) */
77 struct pipe_surface
*(*surface_alloc
)(struct pipe_winsys
*ws
);
80 * Allocate storage for a pipe_surface.
81 * Returns 0 if succeeds.
83 int (*surface_alloc_storage
)(struct pipe_winsys
*ws
,
84 struct pipe_surface
*surf
,
85 unsigned width
, unsigned height
,
86 enum pipe_format format
,
89 void (*surface_release
)(struct pipe_winsys
*ws
, struct pipe_surface
**s
);
93 * Buffer management. Buffer attributes are mostly fixed over its lifetime.
95 * Remember that gallium gets to choose the interface it needs, and the
96 * window systems must then implement that interface (rather than the
97 * other way around...).
99 * usage is a bitmask of PIPE_BUFFER_USAGE_PIXEL/VERTEX/INDEX/CONSTANT. This
100 * usage argument is only an optimization hint, not a guarantee, therefore
101 * proper behavior must be observed in all circumstances.
103 struct pipe_buffer
*(*buffer_create
)( struct pipe_winsys
*sws
,
108 /** Create a buffer that wraps user-space data */
109 struct pipe_buffer
*(*user_buffer_create
)(struct pipe_winsys
*sws
,
114 * Map the entire data store of a buffer object into the client's address.
115 * flags is bitmask of PIPE_BUFFER_FLAG_READ/WRITE.
117 void *(*buffer_map
)( struct pipe_winsys
*sws
,
118 struct pipe_buffer
*buf
,
121 void (*buffer_unmap
)( struct pipe_winsys
*sws
,
122 struct pipe_buffer
*buf
);
124 void (*buffer_destroy
)( struct pipe_winsys
*sws
,
125 struct pipe_buffer
*buf
);
128 /** Set ptr = fence, with reference counting */
129 void (*fence_reference
)( struct pipe_winsys
*sws
,
130 struct pipe_fence_handle
**ptr
,
131 struct pipe_fence_handle
*fence
);
134 * Checks whether the fence has been signalled.
136 * The meaning of flag is pipe-driver specific.
138 * Returns zero if it has.
140 int (*fence_signalled
)( struct pipe_winsys
*sws
,
141 struct pipe_fence_handle
*fence
,
145 * Wait for the fence to finish.
147 * The meaning of flag is pipe-driver specific.
149 * Returns zero on success.
151 int (*fence_finish
)( struct pipe_winsys
*sws
,
152 struct pipe_fence_handle
*fence
,
160 #endif /* P_WINSYS_H */