1848b8605Smrg/**************************************************************************
2848b8605Smrg *
3848b8605Smrg * Copyright 2007 VMware, Inc.
4848b8605Smrg * All Rights Reserved.
5848b8605Smrg *
6848b8605Smrg * Permission is hereby granted, free of charge, to any person obtaining a
7848b8605Smrg * copy of this software and associated documentation files (the
8848b8605Smrg * "Software"), to deal in the Software without restriction, including
9848b8605Smrg * without limitation the rights to use, copy, modify, merge, publish,
10848b8605Smrg * distribute, sub license, and/or sell copies of the Software, and to
11848b8605Smrg * permit persons to whom the Software is furnished to do so, subject to
12848b8605Smrg * the following conditions:
13848b8605Smrg *
14848b8605Smrg * The above copyright notice and this permission notice (including the
15848b8605Smrg * next paragraph) shall be included in all copies or substantial portions
16848b8605Smrg * of the Software.
17848b8605Smrg *
18848b8605Smrg * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
19848b8605Smrg * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
20848b8605Smrg * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
21848b8605Smrg * IN NO EVENT SHALL VMWARE AND/OR ITS SUPPLIERS BE LIABLE FOR
22848b8605Smrg * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
23848b8605Smrg * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
24848b8605Smrg * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
25848b8605Smrg *
26848b8605Smrg **************************************************************************/
27848b8605Smrg
28848b8605Smrg/**
29848b8605Smrg * @file
30848b8605Smrg *
31848b8605Smrg * Screen, Adapter or GPU
32848b8605Smrg *
33848b8605Smrg * These are driver functions/facilities that are context independent.
34848b8605Smrg */
35848b8605Smrg
36848b8605Smrg
37848b8605Smrg#ifndef P_SCREEN_H
38848b8605Smrg#define P_SCREEN_H
39848b8605Smrg
40848b8605Smrg
41848b8605Smrg#include "pipe/p_compiler.h"
42848b8605Smrg#include "pipe/p_format.h"
43848b8605Smrg#include "pipe/p_defines.h"
44848b8605Smrg#include "pipe/p_video_enums.h"
45848b8605Smrg
46848b8605Smrg
47848b8605Smrg
48848b8605Smrg#ifdef __cplusplus
49848b8605Smrgextern "C" {
50848b8605Smrg#endif
51848b8605Smrg
52848b8605Smrg
53848b8605Smrg/** Opaque types */
54848b8605Smrgstruct winsys_handle;
55848b8605Smrgstruct pipe_fence_handle;
56848b8605Smrgstruct pipe_resource;
57848b8605Smrgstruct pipe_surface;
58848b8605Smrgstruct pipe_transfer;
59848b8605Smrgstruct pipe_box;
60b8e80941Smrgstruct pipe_memory_info;
61b8e80941Smrgstruct disk_cache;
62b8e80941Smrgstruct driOptionCache;
63b8e80941Smrgstruct u_transfer_helper;
64848b8605Smrg
65848b8605Smrg/**
66848b8605Smrg * Gallium screen/adapter context.  Basically everything
67848b8605Smrg * hardware-specific that doesn't actually require a rendering
68848b8605Smrg * context.
69848b8605Smrg */
70848b8605Smrgstruct pipe_screen {
71b8e80941Smrg
72b8e80941Smrg   /**
73b8e80941Smrg    * For drivers using u_transfer_helper:
74b8e80941Smrg    */
75b8e80941Smrg   struct u_transfer_helper *transfer_helper;
76b8e80941Smrg
77848b8605Smrg   void (*destroy)( struct pipe_screen * );
78848b8605Smrg
79848b8605Smrg   const char *(*get_name)( struct pipe_screen * );
80848b8605Smrg
81848b8605Smrg   const char *(*get_vendor)( struct pipe_screen * );
82848b8605Smrg
83b8e80941Smrg   /**
84b8e80941Smrg    * Returns the device vendor.
85b8e80941Smrg    *
86b8e80941Smrg    * The returned value should return the actual device vendor/manufacturer,
87b8e80941Smrg    * rather than a potentially generic driver string.
88b8e80941Smrg    */
89b8e80941Smrg   const char *(*get_device_vendor)( struct pipe_screen * );
90b8e80941Smrg
91848b8605Smrg   /**
92848b8605Smrg    * Query an integer-valued capability/parameter/limit
93848b8605Smrg    * \param param  one of PIPE_CAP_x
94848b8605Smrg    */
95848b8605Smrg   int (*get_param)( struct pipe_screen *, enum pipe_cap param );
96848b8605Smrg
97848b8605Smrg   /**
98848b8605Smrg    * Query a float-valued capability/parameter/limit
99848b8605Smrg    * \param param  one of PIPE_CAP_x
100848b8605Smrg    */
101848b8605Smrg   float (*get_paramf)( struct pipe_screen *, enum pipe_capf param );
102848b8605Smrg
103848b8605Smrg   /**
104848b8605Smrg    * Query a per-shader-stage integer-valued capability/parameter/limit
105848b8605Smrg    * \param param  one of PIPE_CAP_x
106848b8605Smrg    */
107b8e80941Smrg   int (*get_shader_param)( struct pipe_screen *, enum pipe_shader_type shader,
108b8e80941Smrg                            enum pipe_shader_cap param );
109848b8605Smrg
110848b8605Smrg   /**
111848b8605Smrg    * Query an integer-valued capability/parameter/limit for a codec/profile
112848b8605Smrg    * \param param  one of PIPE_VIDEO_CAP_x
113848b8605Smrg    */
114848b8605Smrg   int (*get_video_param)( struct pipe_screen *,
115848b8605Smrg			   enum pipe_video_profile profile,
116848b8605Smrg			   enum pipe_video_entrypoint entrypoint,
117848b8605Smrg			   enum pipe_video_cap param );
118848b8605Smrg
119848b8605Smrg   /**
120848b8605Smrg    * Query a compute-specific capability/parameter/limit.
121b8e80941Smrg    * \param ir_type shader IR type for which the param applies, or don't care
122b8e80941Smrg    *                if the param is not shader related
123b8e80941Smrg    * \param param   one of PIPE_COMPUTE_CAP_x
124b8e80941Smrg    * \param ret     pointer to a preallocated buffer that will be
125b8e80941Smrg    *                initialized to the parameter value, or NULL.
126b8e80941Smrg    * \return        size in bytes of the parameter value that would be
127b8e80941Smrg    *                returned.
128848b8605Smrg    */
129848b8605Smrg   int (*get_compute_param)(struct pipe_screen *,
130b8e80941Smrg			    enum pipe_shader_ir ir_type,
131848b8605Smrg			    enum pipe_compute_cap param,
132848b8605Smrg			    void *ret);
133848b8605Smrg
134b8e80941Smrg   /**
135b8e80941Smrg    * Get the sample pixel grid's size. This function requires
136b8e80941Smrg    * PIPE_CAP_PROGRAMMABLE_SAMPLE_LOCATIONS to be callable.
137b8e80941Smrg    *
138b8e80941Smrg    * \param sample_count - total number of samples
139b8e80941Smrg    * \param out_width - the width of the pixel grid
140b8e80941Smrg    * \param out_height - the height of the pixel grid
141b8e80941Smrg    */
142b8e80941Smrg   void (*get_sample_pixel_grid)(struct pipe_screen *, unsigned sample_count,
143b8e80941Smrg                                 unsigned *out_width, unsigned *out_height);
144b8e80941Smrg
145848b8605Smrg   /**
146848b8605Smrg    * Query a timestamp in nanoseconds. The returned value should match
147848b8605Smrg    * PIPE_QUERY_TIMESTAMP. This function returns immediately and doesn't
148848b8605Smrg    * wait for rendering to complete (which cannot be achieved with queries).
149848b8605Smrg    */
150848b8605Smrg   uint64_t (*get_timestamp)(struct pipe_screen *);
151848b8605Smrg
152b8e80941Smrg   /**
153b8e80941Smrg    * Create a context.
154b8e80941Smrg    *
155b8e80941Smrg    * \param screen      pipe screen
156b8e80941Smrg    * \param priv        a pointer to set in pipe_context::priv
157b8e80941Smrg    * \param flags       a mask of PIPE_CONTEXT_* flags
158b8e80941Smrg    */
159b8e80941Smrg   struct pipe_context * (*context_create)(struct pipe_screen *screen,
160b8e80941Smrg					   void *priv, unsigned flags);
161848b8605Smrg
162848b8605Smrg   /**
163848b8605Smrg    * Check if the given pipe_format is supported as a texture or
164848b8605Smrg    * drawing surface.
165848b8605Smrg    * \param bindings  bitmask of PIPE_BIND_*
166848b8605Smrg    */
167848b8605Smrg   boolean (*is_format_supported)( struct pipe_screen *,
168848b8605Smrg                                   enum pipe_format format,
169848b8605Smrg                                   enum pipe_texture_target target,
170848b8605Smrg                                   unsigned sample_count,
171b8e80941Smrg                                   unsigned storage_sample_count,
172848b8605Smrg                                   unsigned bindings );
173848b8605Smrg
174848b8605Smrg   /**
175848b8605Smrg    * Check if the given pipe_format is supported as output for this codec/profile.
176848b8605Smrg    * \param profile  profile to check, may also be PIPE_VIDEO_PROFILE_UNKNOWN
177848b8605Smrg    */
178848b8605Smrg   boolean (*is_video_format_supported)( struct pipe_screen *,
179848b8605Smrg                                         enum pipe_format format,
180848b8605Smrg                                         enum pipe_video_profile profile,
181848b8605Smrg                                         enum pipe_video_entrypoint entrypoint );
182848b8605Smrg
183848b8605Smrg   /**
184848b8605Smrg    * Check if we can actually create the given resource (test the dimension,
185848b8605Smrg    * overall size, etc).  Used to implement proxy textures.
186848b8605Smrg    * \return TRUE if size is OK, FALSE if too large.
187848b8605Smrg    */
188848b8605Smrg   boolean (*can_create_resource)(struct pipe_screen *screen,
189848b8605Smrg                                  const struct pipe_resource *templat);
190b8e80941Smrg
191848b8605Smrg   /**
192848b8605Smrg    * Create a new texture object, using the given template info.
193848b8605Smrg    */
194848b8605Smrg   struct pipe_resource * (*resource_create)(struct pipe_screen *,
195848b8605Smrg					     const struct pipe_resource *templat);
196848b8605Smrg
197b8e80941Smrg   struct pipe_resource * (*resource_create_front)(struct pipe_screen *,
198b8e80941Smrg                                                   const struct pipe_resource *templat,
199b8e80941Smrg                                                   const void *map_front_private);
200b8e80941Smrg
201848b8605Smrg   /**
202848b8605Smrg    * Create a texture from a winsys_handle. The handle is often created in
203848b8605Smrg    * another process by first creating a pipe texture and then calling
204848b8605Smrg    * resource_get_handle.
205b8e80941Smrg    *
206b8e80941Smrg    * NOTE: in the case of WINSYS_HANDLE_TYPE_FD handles, the caller
207b8e80941Smrg    * retains ownership of the FD.  (This is consistent with
208b8e80941Smrg    * EGL_EXT_image_dma_buf_import)
209b8e80941Smrg    *
210b8e80941Smrg    * \param usage  A combination of PIPE_HANDLE_USAGE_* flags.
211848b8605Smrg    */
212848b8605Smrg   struct pipe_resource * (*resource_from_handle)(struct pipe_screen *,
213848b8605Smrg						  const struct pipe_resource *templat,
214b8e80941Smrg						  struct winsys_handle *handle,
215b8e80941Smrg						  unsigned usage);
216b8e80941Smrg
217b8e80941Smrg   /**
218b8e80941Smrg    * Create a resource from user memory. This maps the user memory into
219b8e80941Smrg    * the device address space.
220b8e80941Smrg    */
221b8e80941Smrg   struct pipe_resource * (*resource_from_user_memory)(struct pipe_screen *,
222b8e80941Smrg                                                       const struct pipe_resource *t,
223b8e80941Smrg                                                       void *user_memory);
224b8e80941Smrg
225b8e80941Smrg   /**
226b8e80941Smrg    * Unlike pipe_resource::bind, which describes what state trackers want,
227b8e80941Smrg    * resources can have much greater capabilities in practice, often implied
228b8e80941Smrg    * by the tiling layout or memory placement. This function allows querying
229b8e80941Smrg    * whether a capability is supported beyond what was requested by state
230b8e80941Smrg    * trackers. It's also useful for querying capabilities of imported
231b8e80941Smrg    * resources where the capabilities are unknown at first.
232b8e80941Smrg    *
233b8e80941Smrg    * Only these flags are allowed:
234b8e80941Smrg    * - PIPE_BIND_SCANOUT
235b8e80941Smrg    * - PIPE_BIND_CURSOR
236b8e80941Smrg    * - PIPE_BIND_LINEAR
237b8e80941Smrg    */
238b8e80941Smrg   bool (*check_resource_capability)(struct pipe_screen *screen,
239b8e80941Smrg                                     struct pipe_resource *resource,
240b8e80941Smrg                                     unsigned bind);
241848b8605Smrg
242848b8605Smrg   /**
243848b8605Smrg    * Get a winsys_handle from a texture. Some platforms/winsys requires
244848b8605Smrg    * that the texture is created with a special usage flag like
245848b8605Smrg    * DISPLAYTARGET or PRIMARY.
246b8e80941Smrg    *
247b8e80941Smrg    * The context parameter can optionally be used to flush the resource and
248b8e80941Smrg    * the context to make sure the resource is coherent with whatever user
249b8e80941Smrg    * will use it. Some drivers may also use the context to convert
250b8e80941Smrg    * the resource into a format compatible for sharing. The use case is
251b8e80941Smrg    * OpenGL-OpenCL interop. The context parameter is allowed to be NULL.
252b8e80941Smrg    *
253b8e80941Smrg    * NOTE: in the case of WINSYS_HANDLE_TYPE_FD handles, the caller
254b8e80941Smrg    * takes ownership of the FD.  (This is consistent with
255b8e80941Smrg    * EGL_MESA_image_dma_buf_export)
256b8e80941Smrg    *
257b8e80941Smrg    * \param usage  A combination of PIPE_HANDLE_USAGE_* flags.
258848b8605Smrg    */
259848b8605Smrg   boolean (*resource_get_handle)(struct pipe_screen *,
260b8e80941Smrg                                  struct pipe_context *context,
261848b8605Smrg				  struct pipe_resource *tex,
262b8e80941Smrg				  struct winsys_handle *handle,
263b8e80941Smrg				  unsigned usage);
264848b8605Smrg
265b8e80941Smrg   /**
266b8e80941Smrg    * Get stride and offset for the given pipe resource without the need to get
267b8e80941Smrg    * a winsys_handle.
268b8e80941Smrg    */
269b8e80941Smrg   void (*resource_get_info)(struct pipe_screen *screen,
270b8e80941Smrg                             struct pipe_resource *resource,
271b8e80941Smrg                             unsigned *stride,
272b8e80941Smrg                             unsigned *offset);
273b8e80941Smrg
274b8e80941Smrg   /**
275b8e80941Smrg    * Mark the resource as changed so derived internal resources will be
276b8e80941Smrg    * recreated on next use.
277b8e80941Smrg    *
278b8e80941Smrg    * This is necessary when reimporting external images that can't be directly
279b8e80941Smrg    * used as texture sampler source, to avoid sampling from old copies.
280b8e80941Smrg    */
281b8e80941Smrg   void (*resource_changed)(struct pipe_screen *, struct pipe_resource *pt);
282848b8605Smrg
283848b8605Smrg   void (*resource_destroy)(struct pipe_screen *,
284848b8605Smrg			    struct pipe_resource *pt);
285848b8605Smrg
286848b8605Smrg
287848b8605Smrg   /**
288848b8605Smrg    * Do any special operations to ensure frontbuffer contents are
289848b8605Smrg    * displayed, eg copy fake frontbuffer.
290848b8605Smrg    * \param winsys_drawable_handle  an opaque handle that the calling context
291848b8605Smrg    *                                gets out-of-band
292848b8605Smrg    * \param subbox an optional sub region to flush
293848b8605Smrg    */
294848b8605Smrg   void (*flush_frontbuffer)( struct pipe_screen *screen,
295848b8605Smrg                              struct pipe_resource *resource,
296848b8605Smrg                              unsigned level, unsigned layer,
297848b8605Smrg                              void *winsys_drawable_handle,
298848b8605Smrg                              struct pipe_box *subbox );
299848b8605Smrg
300848b8605Smrg   /** Set ptr = fence, with reference counting */
301848b8605Smrg   void (*fence_reference)( struct pipe_screen *screen,
302848b8605Smrg                            struct pipe_fence_handle **ptr,
303848b8605Smrg                            struct pipe_fence_handle *fence );
304848b8605Smrg
305848b8605Smrg   /**
306b8e80941Smrg    * Wait for the fence to finish.
307b8e80941Smrg    *
308b8e80941Smrg    * If the fence was created with PIPE_FLUSH_DEFERRED, and the context is
309b8e80941Smrg    * still unflushed, and the ctx parameter of fence_finish is equal to
310b8e80941Smrg    * the context where the fence was created, fence_finish will flush
311b8e80941Smrg    * the context prior to waiting for the fence.
312b8e80941Smrg    *
313b8e80941Smrg    * In all other cases, the ctx parameter has no effect.
314b8e80941Smrg    *
315b8e80941Smrg    * \param timeout  in nanoseconds (may be PIPE_TIMEOUT_INFINITE).
316848b8605Smrg    */
317b8e80941Smrg   boolean (*fence_finish)(struct pipe_screen *screen,
318b8e80941Smrg                           struct pipe_context *ctx,
319b8e80941Smrg                           struct pipe_fence_handle *fence,
320b8e80941Smrg                           uint64_t timeout);
321848b8605Smrg
322848b8605Smrg   /**
323b8e80941Smrg    * For fences created with PIPE_FLUSH_FENCE_FD (exported fd) or
324b8e80941Smrg    * by create_fence_fd() (imported fd), return the native fence fd
325b8e80941Smrg    * associated with the fence.  This may return -1 for fences
326b8e80941Smrg    * created with PIPE_FLUSH_DEFERRED if the fence command has not
327b8e80941Smrg    * been flushed yet.
328848b8605Smrg    */
329b8e80941Smrg   int (*fence_get_fd)(struct pipe_screen *screen,
330b8e80941Smrg                       struct pipe_fence_handle *fence);
331848b8605Smrg
332848b8605Smrg   /**
333848b8605Smrg    * Returns a driver-specific query.
334848b8605Smrg    *
335848b8605Smrg    * If \p info is NULL, the number of available queries is returned.
336848b8605Smrg    * Otherwise, the driver query at the specified \p index is returned
337848b8605Smrg    * in \p info. The function returns non-zero on success.
338848b8605Smrg    */
339848b8605Smrg   int (*get_driver_query_info)(struct pipe_screen *screen,
340848b8605Smrg                                unsigned index,
341848b8605Smrg                                struct pipe_driver_query_info *info);
342848b8605Smrg
343b8e80941Smrg   /**
344b8e80941Smrg    * Returns a driver-specific query group.
345b8e80941Smrg    *
346b8e80941Smrg    * If \p info is NULL, the number of available groups is returned.
347b8e80941Smrg    * Otherwise, the driver query group at the specified \p index is returned
348b8e80941Smrg    * in \p info. The function returns non-zero on success.
349b8e80941Smrg    */
350b8e80941Smrg   int (*get_driver_query_group_info)(struct pipe_screen *screen,
351b8e80941Smrg                                      unsigned index,
352b8e80941Smrg                                      struct pipe_driver_query_group_info *info);
353b8e80941Smrg
354b8e80941Smrg   /**
355b8e80941Smrg    * Query information about memory usage.
356b8e80941Smrg    */
357b8e80941Smrg   void (*query_memory_info)(struct pipe_screen *screen,
358b8e80941Smrg                             struct pipe_memory_info *info);
359b8e80941Smrg
360b8e80941Smrg   /**
361b8e80941Smrg    * Get IR specific compiler options struct.  For PIPE_SHADER_IR_NIR this
362b8e80941Smrg    * returns a 'struct nir_shader_compiler_options'.  Drivers reporting
363b8e80941Smrg    * NIR as the preferred IR must implement this.
364b8e80941Smrg    */
365b8e80941Smrg   const void *(*get_compiler_options)(struct pipe_screen *screen,
366b8e80941Smrg                                      enum pipe_shader_ir ir,
367b8e80941Smrg                                      enum pipe_shader_type shader);
368b8e80941Smrg
369b8e80941Smrg   /**
370b8e80941Smrg    * Returns a pointer to a driver-specific on-disk shader cache. If the
371b8e80941Smrg    * driver failed to create the cache or does not support an on-disk shader
372b8e80941Smrg    * cache NULL is returned. The callback itself may also be NULL if the
373b8e80941Smrg    * driver doesn't support an on-disk shader cache.
374b8e80941Smrg    */
375b8e80941Smrg   struct disk_cache *(*get_disk_shader_cache)(struct pipe_screen *screen);
376b8e80941Smrg
377b8e80941Smrg   /**
378b8e80941Smrg    * Create a new texture object from the given template info, taking
379b8e80941Smrg    * format modifiers into account. \p modifiers specifies a list of format
380b8e80941Smrg    * modifier tokens, as defined in drm_fourcc.h. The driver then picks the
381b8e80941Smrg    * best modifier among these and creates the resource. \p count must
382b8e80941Smrg    * contain the size of \p modifiers array.
383b8e80941Smrg    *
384b8e80941Smrg    * Returns NULL if an entry in \p modifiers is unsupported by the driver,
385b8e80941Smrg    * or if only DRM_FORMAT_MOD_INVALID is provided.
386b8e80941Smrg    */
387b8e80941Smrg   struct pipe_resource * (*resource_create_with_modifiers)(
388b8e80941Smrg                           struct pipe_screen *,
389b8e80941Smrg                           const struct pipe_resource *templat,
390b8e80941Smrg                           const uint64_t *modifiers, int count);
391b8e80941Smrg
392b8e80941Smrg   /**
393b8e80941Smrg    * Get supported modifiers for a format.
394b8e80941Smrg    * If \p max is 0, the total number of supported modifiers for the supplied
395b8e80941Smrg    * format is returned in \p count, with no modification to \p modifiers.
396b8e80941Smrg    * Otherwise, \p modifiers is filled with upto \p max supported modifier
397b8e80941Smrg    * codes, and \p count with the number of modifiers copied.
398b8e80941Smrg    * The \p external_only array is used to return whether the format and
399b8e80941Smrg    * modifier combination can only be used with an external texture target.
400b8e80941Smrg    */
401b8e80941Smrg   void (*query_dmabuf_modifiers)(struct pipe_screen *screen,
402b8e80941Smrg                                  enum pipe_format format, int max,
403b8e80941Smrg                                  uint64_t *modifiers,
404b8e80941Smrg                                  unsigned int *external_only, int *count);
405b8e80941Smrg
406b8e80941Smrg   /**
407b8e80941Smrg    * Create a memory object from a winsys handle
408b8e80941Smrg    *
409b8e80941Smrg    * The underlying memory is most often allocated in by a foregin API.
410b8e80941Smrg    * Then the underlying memory object is then exported through interfaces
411b8e80941Smrg    * compatible with EXT_external_resources.
412b8e80941Smrg    *
413b8e80941Smrg    * Note: For WINSYS_HANDLE_TYPE_FD handles, the caller retains ownership
414b8e80941Smrg    * of the fd.
415b8e80941Smrg    *
416b8e80941Smrg    * \param handle  A handle representing the memory object to import
417b8e80941Smrg    */
418b8e80941Smrg   struct pipe_memory_object *(*memobj_create_from_handle)(struct pipe_screen *screen,
419b8e80941Smrg                                                           struct winsys_handle *handle,
420b8e80941Smrg                                                           bool dedicated);
421b8e80941Smrg
422b8e80941Smrg   /**
423b8e80941Smrg    * Destroy a memory object
424b8e80941Smrg    *
425b8e80941Smrg    * \param memobj  The memory object to destroy
426b8e80941Smrg    */
427b8e80941Smrg   void (*memobj_destroy)(struct pipe_screen *screen,
428b8e80941Smrg                          struct pipe_memory_object *memobj);
429b8e80941Smrg
430b8e80941Smrg   /**
431b8e80941Smrg    * Create a texture from a memory object
432b8e80941Smrg    *
433b8e80941Smrg    * \param t       texture template
434b8e80941Smrg    * \param memobj  The memory object used to back the texture
435b8e80941Smrg    */
436b8e80941Smrg   struct pipe_resource * (*resource_from_memobj)(struct pipe_screen *screen,
437b8e80941Smrg                                                  const struct pipe_resource *t,
438b8e80941Smrg                                                  struct pipe_memory_object *memobj,
439b8e80941Smrg                                                  uint64_t offset);
440b8e80941Smrg
441b8e80941Smrg   /**
442b8e80941Smrg    * Fill @uuid with a unique driver identifier
443b8e80941Smrg    *
444b8e80941Smrg    * \param uuid    pointer to a memory region of PIPE_UUID_SIZE bytes
445b8e80941Smrg    */
446b8e80941Smrg   void (*get_driver_uuid)(struct pipe_screen *screen, char *uuid);
447b8e80941Smrg
448b8e80941Smrg   /**
449b8e80941Smrg    * Fill @uuid with a unique device identifier
450b8e80941Smrg    *
451b8e80941Smrg    * \param uuid    pointer to a memory region of PIPE_UUID_SIZE bytes
452b8e80941Smrg    */
453b8e80941Smrg   void (*get_device_uuid)(struct pipe_screen *screen, char *uuid);
454b8e80941Smrg
455b8e80941Smrg   /**
456b8e80941Smrg    * Set the maximum number of parallel shader compiler threads.
457b8e80941Smrg    */
458b8e80941Smrg   void (*set_max_shader_compiler_threads)(struct pipe_screen *screen,
459b8e80941Smrg                                           unsigned max_threads);
460b8e80941Smrg
461b8e80941Smrg   /**
462b8e80941Smrg    * Return whether parallel shader compilation has finished.
463b8e80941Smrg    */
464b8e80941Smrg   bool (*is_parallel_shader_compilation_finished)(struct pipe_screen *screen,
465b8e80941Smrg                                                   void *shader,
466b8e80941Smrg                                                   unsigned shader_type);
467b8e80941Smrg};
468b8e80941Smrg
469b8e80941Smrg
470b8e80941Smrg/**
471b8e80941Smrg * Global configuration options for screen creation.
472b8e80941Smrg */
473b8e80941Smrgstruct pipe_screen_config {
474b8e80941Smrg   const struct driOptionCache *options;
475848b8605Smrg};
476848b8605Smrg
477848b8605Smrg
478848b8605Smrg#ifdef __cplusplus
479848b8605Smrg}
480848b8605Smrg#endif
481848b8605Smrg
482848b8605Smrg#endif /* P_SCREEN_H */
483