• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright © 2011 Intel Corporation
3  *
4  * Permission is hereby granted, free of charge, to any person obtaining a
5  * copy of this software and associated documentation files (the "Software"),
6  * to deal in the Software without restriction, including without limitation
7  * the rights to use, copy, modify, merge, publish, distribute, sublicense,
8  * and/or sell copies of the Software, and to permit persons to whom the
9  * Software is furnished to do so, subject to the following conditions:
10  *
11  * The above copyright notice and this permission notice (including the next
12  * paragraph) shall be included in all copies or substantial portions of the
13  * Software.
14  *
15  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
16  * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
17  * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
18  * NONINFRINGEMENT.  IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
19  * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
20  * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21  * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
22  * DEALINGS IN THE SOFTWARE.
23  *
24  * Authors:
25  *    Kristian Høgsberg <krh@bitplanet.net>
26  */
27 
28 #ifndef EGL_DRI2_INCLUDED
29 #define EGL_DRI2_INCLUDED
30 
31 #include <stdbool.h>
32 #include <stdint.h>
33 
34 #ifdef HAVE_X11_PLATFORM
35 #include <X11/Xlib-xcb.h>
36 #ifdef HAVE_X11_DRI2
37 #include <xcb/dri2.h>
38 #endif
39 #include <xcb/randr.h>
40 #include <xcb/xcb.h>
41 #include <xcb/xfixes.h>
42 
43 #include "loader_dri_helper.h"
44 #ifdef HAVE_LIBDRM
45 #include "loader_dri3_helper.h"
46 #endif
47 #endif
48 
49 #ifdef HAVE_WAYLAND_PLATFORM
50 /* forward declarations to avoid pulling wayland headers everywhere */
51 struct wl_egl_window;
52 struct wl_event_queue;
53 struct wl_callback;
54 struct wl_display;
55 struct wl_drm;
56 struct wl_registry;
57 struct wl_shm;
58 struct wl_surface;
59 struct zwp_linux_dmabuf_v1;
60 struct zwp_linux_dmabuf_feedback_v1;
61 #endif
62 
63 #include <GL/gl.h>
64 #include "mesa_interface.h"
65 #include "kopper_interface.h"
66 
67 #ifdef HAVE_DRM_PLATFORM
68 #include <gbm_driint.h>
69 #endif
70 
71 #ifdef HAVE_ANDROID_PLATFORM
72 #define LOG_TAG "EGL-DRI2"
73 
74 #include <hardware/gralloc.h>
75 
76 #include "util/u_gralloc/u_gralloc.h"
77 
78 #if ANDROID_API_LEVEL >= 26
79 #include <vndk/window.h>
80 #else
81 #include <system/window.h>
82 #endif
83 
84 #endif /* HAVE_ANDROID_PLATFORM */
85 
86 #include "eglconfig.h"
87 #include "eglcontext.h"
88 #include "eglcurrent.h"
89 #include "egldevice.h"
90 #include "egldisplay.h"
91 #include "egldriver.h"
92 #include "eglimage.h"
93 #include "egllog.h"
94 #include "eglsurface.h"
95 #include "eglsync.h"
96 
97 #include "util/bitset.h"
98 #include "util/u_dynarray.h"
99 #include "util/u_vector.h"
100 #include "util/format/u_format.h"
101 
102 struct wl_buffer;
103 
104 struct dri2_egl_display_vtbl {
105    /* mandatory on Wayland, unused otherwise */
106    int (*authenticate)(_EGLDisplay *disp, uint32_t id);
107 
108    /* mandatory */
109    _EGLSurface *(*create_window_surface)(_EGLDisplay *disp, _EGLConfig *config,
110                                          void *native_window,
111                                          const EGLint *attrib_list);
112 
113    /* optional */
114    _EGLSurface *(*create_pixmap_surface)(_EGLDisplay *disp, _EGLConfig *config,
115                                          void *native_pixmap,
116                                          const EGLint *attrib_list);
117 
118    /* optional */
119    _EGLSurface *(*create_pbuffer_surface)(_EGLDisplay *disp, _EGLConfig *config,
120                                           const EGLint *attrib_list);
121 
122    /* mandatory */
123    EGLBoolean (*destroy_surface)(_EGLDisplay *disp, _EGLSurface *surface);
124 
125    /* optional */
126    EGLBoolean (*swap_interval)(_EGLDisplay *disp, _EGLSurface *surf,
127                                EGLint interval);
128 
129    /* mandatory */
130    _EGLImage *(*create_image)(_EGLDisplay *disp, _EGLContext *ctx,
131                               EGLenum target, EGLClientBuffer buffer,
132                               const EGLint *attr_list);
133 
134    /* mandatory */
135    EGLBoolean (*swap_buffers)(_EGLDisplay *disp, _EGLSurface *surf);
136 
137    /* optional - falls back to .swap_buffers */
138    EGLBoolean (*swap_buffers_with_damage)(_EGLDisplay *disp,
139                                           _EGLSurface *surface,
140                                           const EGLint *rects, EGLint n_rects);
141 
142    /* optional */
143    EGLBoolean (*swap_buffers_region)(_EGLDisplay *disp, _EGLSurface *surf,
144                                      EGLint numRects, const EGLint *rects);
145 
146    /* optional */
147    EGLBoolean (*post_sub_buffer)(_EGLDisplay *disp, _EGLSurface *surf, EGLint x,
148                                  EGLint y, EGLint width, EGLint height);
149 
150    /* optional */
151    EGLBoolean (*copy_buffers)(_EGLDisplay *disp, _EGLSurface *surf,
152                               void *native_pixmap_target);
153 
154    /* optional */
155    EGLint (*query_buffer_age)(_EGLDisplay *disp, _EGLSurface *surf);
156 
157    /* optional */
158    EGLBoolean (*query_surface)(_EGLDisplay *disp, _EGLSurface *surf,
159                                EGLint attribute, EGLint *value);
160 
161    /* optional */
162    struct wl_buffer *(*create_wayland_buffer_from_image)(_EGLDisplay *disp,
163                                                          _EGLImage *img);
164 
165    /* optional */
166    EGLBoolean (*get_sync_values)(_EGLDisplay *display, _EGLSurface *surface,
167                                  EGLuint64KHR *ust, EGLuint64KHR *msc,
168                                  EGLuint64KHR *sbc);
169 
170    /* optional */
171    EGLBoolean (*get_msc_rate)(_EGLDisplay *display, _EGLSurface *surface,
172                               EGLint *numerator, EGLint *denominator);
173 
174    /* mandatory */
175    struct dri_drawable *(*get_dri_drawable)(_EGLSurface *surf);
176 
177    /* optional */
178    void (*close_screen_notify)(_EGLDisplay *disp);
179 
180    /* Used in EGL_KHR_mutable_render_buffer to update the native window's
181     * shared buffer mode.
182     * optional
183     */
184    bool (*set_shared_buffer_mode)(_EGLDisplay *disp, _EGLSurface *surf,
185                                   bool mode);
186 };
187 
188 #ifdef HAVE_WAYLAND_PLATFORM
189 struct dri2_wl_formats {
190    unsigned int num_formats;
191 
192    /* Bitmap referencing dri2_wl_visuals */
193    unsigned int *formats_bitmap;
194 
195    /* Array of vectors. Contains one modifier vector per format */
196    struct u_vector *modifiers;
197 };
198 
199 struct dmabuf_feedback_format_table {
200    unsigned int size;
201    struct {
202       uint32_t format;
203       uint32_t padding; /* unused */
204       uint64_t modifier;
205    } *data;
206 };
207 
208 struct dmabuf_feedback_tranche {
209    dev_t target_device;
210    uint32_t flags;
211    struct dri2_wl_formats formats;
212 };
213 
214 struct dmabuf_feedback {
215    dev_t main_device;
216    struct dmabuf_feedback_format_table format_table;
217    struct util_dynarray tranches;
218    struct dmabuf_feedback_tranche pending_tranche;
219 };
220 #endif
221 
222 struct dri2_egl_display {
223    const struct dri2_egl_display_vtbl *vtbl;
224 
225    mtx_t lock;
226 
227    int dri2_major;
228    int dri2_minor;
229    struct dri_screen *dri_screen_render_gpu;
230    /* dri_screen_display_gpu holds display GPU in case of prime gpu offloading
231     * else dri_screen_render_gpu and dri_screen_display_gpu is same. In case of
232     * prime gpu offloading, if display and render driver names are different
233     * (potentially not compatible), dri_screen_display_gpu will be NULL but
234     * fd_display_gpu will still hold fd for display driver.
235     */
236    struct dri_screen *dri_screen_display_gpu;
237    bool own_dri_screen;
238    const struct dri_config **driver_configs;
239    /* fd of the GPU used for rendering. */
240    int fd_render_gpu;
241    /* fd of the GPU used for display. If the same GPU is used for display
242     * and rendering, then fd_render_gpu == fd_display_gpu (no need to use
243     * os_same_file_description).
244     */
245    int fd_display_gpu;
246 
247    /* dri2_initialize/dri2_terminate increment/decrement this count, so does
248     * dri2_make_current (tracks if there are active contexts/surfaces). */
249    int ref_count;
250 
251    bool has_compression_modifiers;
252    bool own_device;
253    bool kopper;
254    bool kopper_without_modifiers;
255    bool swrast;
256    bool swrast_not_kms;
257    int min_swap_interval;
258    int max_swap_interval;
259    int default_swap_interval;
260 #ifdef HAVE_DRM_PLATFORM
261    struct gbm_dri_device *gbm_dri;
262 #endif
263 
264    char *driver_name;
265 
266    const __DRIextension **loader_extensions;
267 
268    bool has_dmabuf_import;
269    bool has_dmabuf_export;
270    bool explicit_modifiers;
271    bool multibuffers_available;
272 #ifdef HAVE_X11_PLATFORM
273    xcb_connection_t *conn;
274    xcb_screen_t *screen;
275    bool swap_available;
276 #ifdef HAVE_LIBDRM
277    struct loader_screen_resources screen_resources;
278 #endif
279 #endif
280 
281 #ifdef HAVE_WAYLAND_PLATFORM
282    struct wl_display *wl_dpy;
283    struct wl_display *wl_dpy_wrapper;
284    struct wl_registry *wl_registry;
285    struct wl_drm *wl_server_drm;
286    struct wl_drm *wl_drm;
287    uint32_t wl_drm_version, wl_drm_name;
288    struct wl_shm *wl_shm;
289    struct wl_event_queue *wl_queue;
290    struct zwp_linux_dmabuf_v1 *wl_dmabuf;
291    struct dri2_wl_formats formats;
292    struct zwp_linux_dmabuf_feedback_v1 *wl_dmabuf_feedback;
293    struct dmabuf_feedback_format_table format_table;
294    bool authenticated;
295    uint32_t capabilities;
296    char *device_name;
297    bool is_render_node;
298 #endif
299 
300 #ifdef HAVE_ANDROID_PLATFORM
301    struct u_gralloc *gralloc;
302    /* gralloc vendor usage bit for front rendering */
303    uint32_t front_rendering_usage;
304    bool has_native_fence_fd;
305    bool pure_swrast;
306 #endif
307 };
308 
309 struct dri2_egl_context {
310    _EGLContext base;
311    struct dri_context *dri_context;
312 };
313 
314 struct dri2_egl_surface {
315    _EGLSurface base;
316    struct dri_drawable *dri_drawable;
317    __DRIbuffer buffers[5];
318    bool have_fake_front;
319 
320 #ifdef HAVE_X11_PLATFORM
321    xcb_drawable_t drawable;
322    xcb_xfixes_region_t region;
323    int depth;
324    int bytes_per_pixel;
325    xcb_gcontext_t gc;
326    xcb_gcontext_t swapgc;
327 #endif
328 
329 #ifdef HAVE_WAYLAND_PLATFORM
330    struct wl_egl_window *wl_win;
331    int dx;
332    int dy;
333    struct wl_event_queue *wl_queue;
334    struct wl_surface *wl_surface_wrapper;
335    struct wl_display *wl_dpy_wrapper;
336    struct wl_drm *wl_drm_wrapper;
337    struct wl_callback *throttle_callback;
338    struct zwp_linux_dmabuf_feedback_v1 *wl_dmabuf_feedback;
339    struct dmabuf_feedback dmabuf_feedback, pending_dmabuf_feedback;
340    bool compositor_using_another_device;
341    int format;
342    bool resized;
343    bool received_dmabuf_feedback;
344 #endif
345 
346 #ifdef HAVE_DRM_PLATFORM
347    struct gbm_dri_surface *gbm_surf;
348 #endif
349 
350 #if defined(HAVE_WAYLAND_PLATFORM) || defined(HAVE_DRM_PLATFORM)
351    struct {
352 #ifdef HAVE_WAYLAND_PLATFORM
353       struct wl_buffer *wl_buffer;
354       bool wl_release;
355       struct dri_image *dri_image;
356       /* for is_different_gpu case. NULL else */
357       struct dri_image *linear_copy;
358       /* for swrast */
359       void *data;
360       int data_size;
361 #endif
362 #ifdef HAVE_DRM_PLATFORM
363       struct gbm_bo *bo;
364 #endif
365       bool locked;
366       int age;
367    } color_buffers[4], *back, *current;
368 #endif
369 
370 #ifdef HAVE_ANDROID_PLATFORM
371    struct ANativeWindow *window;
372    struct ANativeWindowBuffer *buffer;
373 
374    /* in-fence associated with buffer, -1 once passed down to dri layer: */
375    int in_fence_fd;
376 
377    struct dri_image *dri_image_back;
378    struct dri_image *dri_image_front;
379 
380    /* Used to record all the buffers created by ANativeWindow and their ages.
381     * Allocate number of color_buffers based on query to android bufferqueue
382     * and save color_buffers_count.
383     */
384    int color_buffers_count;
385    struct {
386       struct ANativeWindowBuffer *buffer;
387       int age;
388    } *color_buffers, *back;
389    uint32_t gralloc_usage;
390 #endif
391 
392 #ifdef HAVE_OHOS_PLATFORM
393    struct NativeWindow *window;
394 #endif
395 
396    /* surfaceless and device */
397    struct dri_image *front;
398    enum pipe_format visual;
399 
400    int out_fence_fd;
401    EGLBoolean enable_out_fence;
402 
403    /* swrast device */
404    char *swrast_device_buffer;
405 };
406 
407 struct dri2_egl_config {
408    _EGLConfig base;
409    const struct dri_config *dri_config[2][2];
410 };
411 
412 struct dri2_egl_image {
413    _EGLImage base;
414    struct dri_image *dri_image;
415 };
416 
417 struct dri2_egl_sync {
418    _EGLSync base;
419    mtx_t mutex;
420    cnd_t cond;
421    int refcount;
422    void *fence;
423 };
424 
425 /* standard typecasts */
426 _EGL_DRIVER_STANDARD_TYPECASTS(dri2_egl)
_EGL_DRIVER_TYPECAST(dri2_egl_image,_EGLImage,obj)427 _EGL_DRIVER_TYPECAST(dri2_egl_image, _EGLImage, obj)
428 _EGL_DRIVER_TYPECAST(dri2_egl_sync, _EGLSync, obj)
429 
430 static inline struct dri2_egl_display *
431 dri2_egl_display_lock(_EGLDisplay *disp)
432 {
433    struct dri2_egl_display *dri2_dpy = dri2_egl_display(disp);
434 
435    if (dri2_dpy)
436       mtx_lock(&dri2_dpy->lock);
437 
438    return dri2_dpy;
439 }
440 
441 static inline EGLBoolean
dri2_egl_error_unlock(struct dri2_egl_display * dri2_dpy,EGLint err,const char * msg)442 dri2_egl_error_unlock(struct dri2_egl_display *dri2_dpy, EGLint err,
443                       const char *msg)
444 {
445    mtx_unlock(&dri2_dpy->lock);
446    return _eglError(err, msg);
447 }
448 
449 extern const __DRIimageLookupExtension image_lookup_extension;
450 extern const __DRIuseInvalidateExtension use_invalidate;
451 extern const __DRIbackgroundCallableExtension background_callable_extension;
452 extern const __DRIswrastLoaderExtension swrast_pbuffer_loader_extension;
453 
454 EGLBoolean
455 dri2_load_driver(_EGLDisplay *disp);
456 
457 /* Helper for platforms not using dri2_create_screen */
458 void
459 dri2_setup_screen(_EGLDisplay *disp);
460 
461 void
462 dri2_setup_swap_interval(_EGLDisplay *disp, int max_swap_interval);
463 
464 EGLBoolean
465 dri2_create_screen(_EGLDisplay *disp);
466 
467 EGLBoolean
468 dri2_setup_device(_EGLDisplay *disp, EGLBoolean software);
469 
470 struct dri_drawable *
471 dri2_surface_get_dri_drawable(_EGLSurface *surf);
472 
473 GLboolean
474 dri2_validate_egl_image(void *image, void *data);
475 
476 struct dri_image *
477 dri2_lookup_egl_image_validated(void *image, void *data);
478 
479 void
480 dri2_get_shifts_and_sizes(const struct dri_config *config, int *shifts,
481                           unsigned int *sizes);
482 
483 enum pipe_format
484 dri2_image_format_for_pbuffer_config(struct dri2_egl_display *dri2_dpy,
485                                      const struct dri_config *config);
486 
487 struct dri2_egl_config *
488 dri2_add_config(_EGLDisplay *disp, const struct dri_config *dri_config,
489                 EGLint surface_type, const EGLint *attr_list);
490 
491 void
492 dri2_add_pbuffer_configs_for_visuals(_EGLDisplay *disp);
493 
494 EGLint
495 dri2_from_dri_compression_rate(enum __DRIFixedRateCompression rate);
496 
497 enum __DRIFixedRateCompression
498 dri2_to_dri_compression_rate(EGLint rate);
499 
500 _EGLImage *
501 dri2_create_image_khr(_EGLDisplay *disp, _EGLContext *ctx, EGLenum target,
502                       EGLClientBuffer buffer, const EGLint *attr_list);
503 
504 _EGLImage *
505 dri2_create_image_dma_buf(_EGLDisplay *disp, _EGLContext *ctx,
506                           EGLClientBuffer buffer, const EGLint *attr_list);
507 
508 _EGLImage *
509 dri2_create_image_from_dri(_EGLDisplay *disp, struct dri_image *dri_image);
510 
511 #ifdef HAVE_X11_PLATFORM
512 EGLBoolean
513 dri2_initialize_x11_dri2(_EGLDisplay *disp);
514 EGLBoolean
515 dri2_initialize_x11(_EGLDisplay *disp, bool *allow_dri2);
516 void
517 dri2_teardown_x11(struct dri2_egl_display *dri2_dpy);
518 unsigned int
519 dri2_x11_get_red_mask_for_depth(struct dri2_egl_display *dri2_dpy, int depth);
520 #else
521 static inline EGLBoolean
dri2_initialize_x11_dri2(_EGLDisplay * disp)522 dri2_initialize_x11_dri2(_EGLDisplay *disp)
523 {
524    return _eglError(EGL_NOT_INITIALIZED, "X11 platform not built");
525 }
526 static inline EGLBoolean
dri2_initialize_x11(_EGLDisplay * disp,bool * allow_dri2)527 dri2_initialize_x11(_EGLDisplay *disp, bool *allow_dri2)
528 {
529    return _eglError(EGL_NOT_INITIALIZED, "X11 platform not built");
530 }
531 static inline void
dri2_teardown_x11(struct dri2_egl_display * dri2_dpy)532 dri2_teardown_x11(struct dri2_egl_display *dri2_dpy)
533 {
534 }
535 static inline unsigned int
dri2_x11_get_red_mask_for_depth(struct dri2_egl_display * dri2_dpy,int depth)536 dri2_x11_get_red_mask_for_depth(struct dri2_egl_display *dri2_dpy, int depth)
537 {
538    return 0;
539 }
540 #endif
541 
542 #ifdef HAVE_DRM_PLATFORM
543 EGLBoolean
544 dri2_initialize_drm(_EGLDisplay *disp);
545 void
546 dri2_teardown_drm(struct dri2_egl_display *dri2_dpy);
547 #else
548 static inline EGLBoolean
dri2_initialize_drm(_EGLDisplay * disp)549 dri2_initialize_drm(_EGLDisplay *disp)
550 {
551    return _eglError(EGL_NOT_INITIALIZED, "GBM/DRM platform not built");
552 }
553 static inline void
dri2_teardown_drm(struct dri2_egl_display * dri2_dpy)554 dri2_teardown_drm(struct dri2_egl_display *dri2_dpy)
555 {
556 }
557 #endif
558 
559 #ifdef HAVE_WAYLAND_PLATFORM
560 EGLBoolean
561 dri2_initialize_wayland(_EGLDisplay *disp);
562 void
563 dri2_teardown_wayland(struct dri2_egl_display *dri2_dpy);
564 bool
565 dri2_wl_is_format_supported(void *user_data, uint32_t format);
566 #else
567 static inline EGLBoolean
dri2_initialize_wayland(_EGLDisplay * disp)568 dri2_initialize_wayland(_EGLDisplay *disp)
569 {
570    return _eglError(EGL_NOT_INITIALIZED, "Wayland platform not built");
571 }
572 static inline void
dri2_teardown_wayland(struct dri2_egl_display * dri2_dpy)573 dri2_teardown_wayland(struct dri2_egl_display *dri2_dpy)
574 {
575 }
576 #endif
577 
578 #ifdef HAVE_ANDROID_PLATFORM
579 EGLBoolean
580 dri2_initialize_android(_EGLDisplay *disp);
581 #else
582 static inline EGLBoolean
dri2_initialize_android(_EGLDisplay * disp)583 dri2_initialize_android(_EGLDisplay *disp)
584 {
585    return _eglError(EGL_NOT_INITIALIZED, "Android platform not built");
586 }
587 #endif
588 
589 #ifdef HAVE_OHOS_PLATFORM
590 EGLBoolean
591 dri2_initialize_ohos(_EGLDisplay *disp);
592 #else
593 static inline EGLBoolean
dri2_initialize_ohos(_EGLDisplay * disp)594 dri2_initialize_ohos(_EGLDisplay *disp)
595 {
596    return _eglError(EGL_NOT_INITIALIZED, "OHOS platform not built");
597 }
598 #endif
599 
600 EGLBoolean
601 dri2_initialize_surfaceless(_EGLDisplay *disp);
602 
603 EGLBoolean
604 dri2_initialize_device(_EGLDisplay *disp);
605 static inline void
dri2_teardown_device(struct dri2_egl_display * dri2_dpy)606 dri2_teardown_device(struct dri2_egl_display *dri2_dpy)
607 { /* noop */
608 }
609 
610 void
611 dri2_flush_drawable_for_swapbuffers_flags(
612    _EGLDisplay *disp, _EGLSurface *draw,
613    enum __DRI2throttleReason throttle_reason);
614 void
615 dri2_flush_drawable_for_swapbuffers(_EGLDisplay *disp, _EGLSurface *draw);
616 
617 const struct dri_config *
618 dri2_get_dri_config(struct dri2_egl_config *conf, EGLint surface_type,
619                     EGLenum colorspace);
620 #include "dri_util.h"
621 static inline void
dri2_set_WL_bind_wayland_display(_EGLDisplay * disp)622 dri2_set_WL_bind_wayland_display(_EGLDisplay *disp)
623 {
624 #ifdef HAVE_WAYLAND_PLATFORM
625    struct dri2_egl_display *dri2_dpy = dri2_egl_display(disp);
626 
627    int capabilities;
628 
629    capabilities =
630       dri2_get_capabilities(dri2_dpy->dri_screen_render_gpu);
631    disp->Extensions.WL_bind_wayland_display =
632       (capabilities & __DRI_IMAGE_CAP_GLOBAL_NAMES) != 0;
633 #endif
634 }
635 
636 void
637 dri2_display_destroy(_EGLDisplay *disp);
638 
639 struct dri2_egl_display *
640 dri2_display_create(_EGLDisplay *disp);
641 
642 EGLBoolean
643 dri2_init_surface(_EGLSurface *surf, _EGLDisplay *disp, EGLint type,
644                   _EGLConfig *conf, const EGLint *attrib_list,
645                   EGLBoolean enable_out_fence, void *native_surface);
646 
647 void
648 dri2_fini_surface(_EGLSurface *surf);
649 
650 EGLBoolean
651 dri2_create_drawable(struct dri2_egl_display *dri2_dpy,
652                      const struct dri_config *config,
653                      struct dri2_egl_surface *dri2_surf, void *loaderPrivate);
654 
655 static inline uint64_t
combine_u32_into_u64(uint32_t hi,uint32_t lo)656 combine_u32_into_u64(uint32_t hi, uint32_t lo)
657 {
658    return (((uint64_t)hi) << 32) | (((uint64_t)lo) & 0xffffffff);
659 }
660 
661 #endif /* EGL_DRI2_INCLUDED */
662