gallium: remove the geom_flags param from is_format_supported
[mesa.git] / src / gallium / include / pipe / p_screen.h
1 /**************************************************************************
2 *
3 * Copyright 2007 Tungsten Graphics, Inc., Cedar Park, Texas.
4 * All Rights Reserved.
5 *
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:
13 *
14 * The above copyright notice and this permission notice (including the
15 * next paragraph) shall be included in all copies or substantial portions
16 * of the Software.
17 *
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.
25 *
26 **************************************************************************/
27
28 /**
29 * @file
30 *
31 * Screen, Adapter or GPU
32 *
33 * These are driver functions/facilities that are context independent.
34 */
35
36
37 #ifndef P_SCREEN_H
38 #define P_SCREEN_H
39
40
41 #include "pipe/p_compiler.h"
42 #include "pipe/p_format.h"
43 #include "pipe/p_defines.h"
44
45
46
47 #ifdef __cplusplus
48 extern "C" {
49 #endif
50
51
52 /** Opaque type */
53 struct winsys_handle;
54 /** Opaque type */
55 struct pipe_fence_handle;
56 struct pipe_winsys;
57 struct pipe_resource;
58 struct pipe_surface;
59 struct pipe_transfer;
60
61
62 /**
63 * Gallium screen/adapter context. Basically everything
64 * hardware-specific that doesn't actually require a rendering
65 * context.
66 */
67 struct pipe_screen {
68 struct pipe_winsys *winsys;
69
70 void (*destroy)( struct pipe_screen * );
71
72
73 const char *(*get_name)( struct pipe_screen * );
74
75 const char *(*get_vendor)( struct pipe_screen * );
76
77 /**
78 * Query an integer-valued capability/parameter/limit
79 * \param param one of PIPE_CAP_x
80 */
81 int (*get_param)( struct pipe_screen *, enum pipe_cap param );
82
83 /**
84 * Query a float-valued capability/parameter/limit
85 * \param param one of PIPE_CAP_x
86 */
87 float (*get_paramf)( struct pipe_screen *, enum pipe_cap param );
88
89 /**
90 * Query a per-shader-stage integer-valued capability/parameter/limit
91 * \param param one of PIPE_CAP_x
92 */
93 int (*get_shader_param)( struct pipe_screen *, unsigned shader, enum pipe_shader_cap param );
94
95 struct pipe_context * (*context_create)( struct pipe_screen *,
96 void *priv );
97
98 /**
99 * Check if the given pipe_format is supported as a texture or
100 * drawing surface.
101 * \param bindings bitmask of PIPE_BIND_*
102 */
103 boolean (*is_format_supported)( struct pipe_screen *,
104 enum pipe_format format,
105 enum pipe_texture_target target,
106 unsigned sample_count,
107 unsigned bindings );
108
109 /**
110 * Create a new texture object, using the given template info.
111 */
112 struct pipe_resource * (*resource_create)(struct pipe_screen *,
113 const struct pipe_resource *templat);
114
115 /**
116 * Create a texture from a winsys_handle. The handle is often created in
117 * another process by first creating a pipe texture and then calling
118 * resource_get_handle.
119 */
120 struct pipe_resource * (*resource_from_handle)(struct pipe_screen *,
121 const struct pipe_resource *templat,
122 struct winsys_handle *handle);
123
124 /**
125 * Get a winsys_handle from a texture. Some platforms/winsys requires
126 * that the texture is created with a special usage flag like
127 * DISPLAYTARGET or PRIMARY.
128 */
129 boolean (*resource_get_handle)(struct pipe_screen *,
130 struct pipe_resource *tex,
131 struct winsys_handle *handle);
132
133
134 void (*resource_destroy)(struct pipe_screen *,
135 struct pipe_resource *pt);
136
137
138 /**
139 * Create a buffer that wraps user-space data.
140 *
141 * Effectively this schedules a delayed call to buffer_create
142 * followed by an upload of the data at *some point in the future*,
143 * or perhaps never. Basically the allocate/upload is delayed
144 * until the buffer is actually passed to hardware.
145 *
146 * The intention is to provide a quick way to turn regular data
147 * into a buffer, and secondly to avoid a copy operation if that
148 * data subsequently turns out to be only accessed by the CPU.
149 *
150 * Common example is OpenGL vertex buffers that are subsequently
151 * processed either by software TNL in the driver or by passing to
152 * hardware.
153 *
154 * XXX: What happens if the delayed call to buffer_create() fails?
155 *
156 * Note that ptr may be accessed at any time upto the time when the
157 * buffer is destroyed, so the data must not be freed before then.
158 */
159 struct pipe_resource *(*user_buffer_create)(struct pipe_screen *screen,
160 void *ptr,
161 unsigned bytes,
162 unsigned bind_flags);
163
164 /**
165 * Do any special operations to ensure frontbuffer contents are
166 * displayed, eg copy fake frontbuffer.
167 * \param winsys_drawable_handle an opaque handle that the calling context
168 * gets out-of-band
169 */
170 void (*flush_frontbuffer)( struct pipe_screen *screen,
171 struct pipe_resource *resource,
172 unsigned level, unsigned layer,
173 void *winsys_drawable_handle );
174
175
176
177 /** Set ptr = fence, with reference counting */
178 void (*fence_reference)( struct pipe_screen *screen,
179 struct pipe_fence_handle **ptr,
180 struct pipe_fence_handle *fence );
181
182 /**
183 * Checks whether the fence has been signalled.
184 */
185 boolean (*fence_signalled)( struct pipe_screen *screen,
186 struct pipe_fence_handle *fence );
187
188 /**
189 * Wait for the fence to finish.
190 * \param timeout in nanoseconds
191 */
192 boolean (*fence_finish)( struct pipe_screen *screen,
193 struct pipe_fence_handle *fence,
194 uint64_t timeout );
195
196 };
197
198
199 #ifdef __cplusplus
200 }
201 #endif
202
203 #endif /* P_SCREEN_H */