Details | Last modification | View Log | RSS feed
Rev | Author | Line No. | Line |
---|---|---|---|
3770 | Serge | 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 | #include "pipe/p_video_enums.h" |
||
45 | |||
46 | |||
47 | |||
48 | #ifdef __cplusplus |
||
49 | extern "C" { |
||
50 | #endif |
||
51 | |||
52 | |||
53 | /** Opaque types */ |
||
54 | struct winsys_handle; |
||
55 | struct pipe_fence_handle; |
||
56 | struct pipe_resource; |
||
57 | struct pipe_surface; |
||
58 | struct pipe_transfer; |
||
59 | |||
60 | |||
61 | /** |
||
62 | * Gallium screen/adapter context. Basically everything |
||
63 | * hardware-specific that doesn't actually require a rendering |
||
64 | * context. |
||
65 | */ |
||
66 | struct pipe_screen { |
||
67 | void (*destroy)( struct pipe_screen * ); |
||
68 | |||
69 | const char *(*get_name)( struct pipe_screen * ); |
||
70 | |||
71 | const char *(*get_vendor)( struct pipe_screen * ); |
||
72 | |||
73 | /** |
||
74 | * Query an integer-valued capability/parameter/limit |
||
75 | * \param param one of PIPE_CAP_x |
||
76 | */ |
||
77 | int (*get_param)( struct pipe_screen *, enum pipe_cap param ); |
||
78 | |||
79 | /** |
||
80 | * Query a float-valued capability/parameter/limit |
||
81 | * \param param one of PIPE_CAP_x |
||
82 | */ |
||
83 | float (*get_paramf)( struct pipe_screen *, enum pipe_capf param ); |
||
84 | |||
85 | /** |
||
86 | * Query a per-shader-stage integer-valued capability/parameter/limit |
||
87 | * \param param one of PIPE_CAP_x |
||
88 | */ |
||
89 | int (*get_shader_param)( struct pipe_screen *, unsigned shader, enum pipe_shader_cap param ); |
||
90 | |||
91 | /** |
||
92 | * Query an integer-valued capability/parameter/limit for a codec/profile |
||
93 | * \param param one of PIPE_VIDEO_CAP_x |
||
94 | */ |
||
95 | int (*get_video_param)( struct pipe_screen *, |
||
96 | enum pipe_video_profile profile, |
||
97 | enum pipe_video_cap param ); |
||
98 | |||
99 | /** |
||
100 | * Query a compute-specific capability/parameter/limit. |
||
101 | * \param param one of PIPE_COMPUTE_CAP_x |
||
102 | * \param ret pointer to a preallocated buffer that will be |
||
103 | * initialized to the parameter value, or NULL. |
||
104 | * \return size in bytes of the parameter value that would be |
||
105 | * returned. |
||
106 | */ |
||
107 | int (*get_compute_param)(struct pipe_screen *, |
||
108 | enum pipe_compute_cap param, |
||
109 | void *ret); |
||
110 | |||
111 | /** |
||
112 | * Query a timestamp in nanoseconds. The returned value should match |
||
113 | * PIPE_QUERY_TIMESTAMP. This function returns immediately and doesn't |
||
114 | * wait for rendering to complete (which cannot be achieved with queries). |
||
115 | */ |
||
116 | uint64_t (*get_timestamp)(struct pipe_screen *); |
||
117 | |||
118 | struct pipe_context * (*context_create)( struct pipe_screen *, |
||
119 | void *priv ); |
||
120 | |||
121 | /** |
||
122 | * Check if the given pipe_format is supported as a texture or |
||
123 | * drawing surface. |
||
124 | * \param bindings bitmask of PIPE_BIND_* |
||
125 | */ |
||
126 | boolean (*is_format_supported)( struct pipe_screen *, |
||
127 | enum pipe_format format, |
||
128 | enum pipe_texture_target target, |
||
129 | unsigned sample_count, |
||
130 | unsigned bindings ); |
||
131 | |||
132 | /** |
||
133 | * Check if the given pipe_format is supported as output for this codec/profile. |
||
134 | * \param profile profile to check, may also be PIPE_VIDEO_PROFILE_UNKNOWN |
||
135 | */ |
||
136 | boolean (*is_video_format_supported)( struct pipe_screen *, |
||
137 | enum pipe_format format, |
||
138 | enum pipe_video_profile profile ); |
||
139 | |||
140 | /** |
||
141 | * Check if we can actually create the given resource (test the dimension, |
||
142 | * overall size, etc). Used to implement proxy textures. |
||
143 | * \return TRUE if size is OK, FALSE if too large. |
||
144 | */ |
||
145 | boolean (*can_create_resource)(struct pipe_screen *screen, |
||
146 | const struct pipe_resource *templat); |
||
147 | |||
148 | /** |
||
149 | * Create a new texture object, using the given template info. |
||
150 | */ |
||
151 | struct pipe_resource * (*resource_create)(struct pipe_screen *, |
||
152 | const struct pipe_resource *templat); |
||
153 | |||
154 | /** |
||
155 | * Create a texture from a winsys_handle. The handle is often created in |
||
156 | * another process by first creating a pipe texture and then calling |
||
157 | * resource_get_handle. |
||
158 | */ |
||
159 | struct pipe_resource * (*resource_from_handle)(struct pipe_screen *, |
||
160 | const struct pipe_resource *templat, |
||
161 | struct winsys_handle *handle); |
||
162 | |||
163 | /** |
||
164 | * Get a winsys_handle from a texture. Some platforms/winsys requires |
||
165 | * that the texture is created with a special usage flag like |
||
166 | * DISPLAYTARGET or PRIMARY. |
||
167 | */ |
||
168 | boolean (*resource_get_handle)(struct pipe_screen *, |
||
169 | struct pipe_resource *tex, |
||
170 | struct winsys_handle *handle); |
||
171 | |||
172 | |||
173 | void (*resource_destroy)(struct pipe_screen *, |
||
174 | struct pipe_resource *pt); |
||
175 | |||
176 | |||
177 | /** |
||
178 | * Do any special operations to ensure frontbuffer contents are |
||
179 | * displayed, eg copy fake frontbuffer. |
||
180 | * \param winsys_drawable_handle an opaque handle that the calling context |
||
181 | * gets out-of-band |
||
182 | */ |
||
183 | void (*flush_frontbuffer)( struct pipe_screen *screen, |
||
184 | struct pipe_resource *resource, |
||
185 | unsigned level, unsigned layer, |
||
186 | void *winsys_drawable_handle ); |
||
187 | |||
188 | |||
189 | |||
190 | /** Set ptr = fence, with reference counting */ |
||
191 | void (*fence_reference)( struct pipe_screen *screen, |
||
192 | struct pipe_fence_handle **ptr, |
||
193 | struct pipe_fence_handle *fence ); |
||
194 | |||
195 | /** |
||
196 | * Checks whether the fence has been signalled. |
||
197 | */ |
||
198 | boolean (*fence_signalled)( struct pipe_screen *screen, |
||
199 | struct pipe_fence_handle *fence ); |
||
200 | |||
201 | /** |
||
202 | * Wait for the fence to finish. |
||
203 | * \param timeout in nanoseconds (may be PIPE_TIMEOUT_INFINITE). |
||
204 | */ |
||
205 | boolean (*fence_finish)( struct pipe_screen *screen, |
||
206 | struct pipe_fence_handle *fence, |
||
207 | uint64_t timeout ); |
||
208 | |||
209 | /** |
||
210 | * Returns a driver-specific query. |
||
211 | * |
||
212 | * If \p info is NULL, the number of available queries is returned. |
||
213 | * Otherwise, the driver query at the specified \p index is returned |
||
214 | * in \p info. The function returns non-zero on success. |
||
215 | */ |
||
216 | int (*get_driver_query_info)(struct pipe_screen *screen, |
||
217 | unsigned index, |
||
218 | struct pipe_driver_query_info *info); |
||
219 | |||
220 | }; |
||
221 | |||
222 | |||
223 | #ifdef __cplusplus |
||
224 | } |
||
225 | #endif |
||
226 | |||
227 | #endif /* P_SCREEN_H */ |