2 * Copyright © 2011 Intel Corporation
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:
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
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.
25 * Kristian Høgsberg <krh@bitplanet.net>
34 #include <sys/types.h>
40 #include "egl_dri2_fallbacks.h"
43 static struct gbm_bo
*
44 lock_front_buffer(struct gbm_surface
*_surf
)
46 struct gbm_dri_surface
*surf
= (struct gbm_dri_surface
*) _surf
;
47 struct dri2_egl_surface
*dri2_surf
= surf
->dri_private
;
48 struct gbm_dri_device
*device
= (struct gbm_dri_device
*) _surf
->gbm
;
51 if (dri2_surf
->current
== NULL
) {
52 _eglError(EGL_BAD_SURFACE
, "no front buffer");
56 bo
= dri2_surf
->current
->bo
;
59 dri2_surf
->current
->locked
= 1;
60 dri2_surf
->current
= NULL
;
67 release_buffer(struct gbm_surface
*_surf
, struct gbm_bo
*bo
)
69 struct gbm_dri_surface
*surf
= (struct gbm_dri_surface
*) _surf
;
70 struct dri2_egl_surface
*dri2_surf
= surf
->dri_private
;
73 for (i
= 0; i
< ARRAY_SIZE(dri2_surf
->color_buffers
); i
++) {
74 if (dri2_surf
->color_buffers
[i
].bo
== bo
) {
75 dri2_surf
->color_buffers
[i
].locked
= 0;
81 has_free_buffers(struct gbm_surface
*_surf
)
83 struct gbm_dri_surface
*surf
= (struct gbm_dri_surface
*) _surf
;
84 struct dri2_egl_surface
*dri2_surf
= surf
->dri_private
;
87 for (i
= 0; i
< ARRAY_SIZE(dri2_surf
->color_buffers
); i
++)
88 if (!dri2_surf
->color_buffers
[i
].locked
)
95 dri2_drm_create_surface(_EGLDriver
*drv
, _EGLDisplay
*disp
, EGLint type
,
96 _EGLConfig
*conf
, void *native_window
,
97 const EGLint
*attrib_list
)
99 struct dri2_egl_display
*dri2_dpy
= dri2_egl_display(disp
);
100 struct dri2_egl_config
*dri2_conf
= dri2_egl_config(conf
);
101 struct dri2_egl_surface
*dri2_surf
;
102 struct gbm_surface
*window
= native_window
;
103 struct gbm_dri_surface
*surf
;
107 dri2_surf
= calloc(1, sizeof *dri2_surf
);
109 _eglError(EGL_BAD_ALLOC
, "dri2_create_surface");
113 if (!_eglInitSurface(&dri2_surf
->base
, disp
, type
, conf
, attrib_list
))
119 _eglError(EGL_BAD_NATIVE_WINDOW
, "dri2_create_surface");
123 surf
= gbm_dri_surface(window
);
124 dri2_surf
->gbm_surf
= surf
;
125 dri2_surf
->base
.Width
= surf
->base
.width
;
126 dri2_surf
->base
.Height
= surf
->base
.height
;
127 surf
->dri_private
= dri2_surf
;
133 if (dri2_dpy
->dri2
) {
134 dri2_surf
->dri_drawable
=
135 (*dri2_dpy
->dri2
->createNewDrawable
) (dri2_dpy
->dri_screen
,
136 dri2_conf
->dri_double_config
,
137 dri2_surf
->gbm_surf
);
140 assert(dri2_dpy
->swrast
!= NULL
);
141 dri2_surf
->dri_drawable
=
142 (*dri2_dpy
->swrast
->createNewDrawable
) (dri2_dpy
->dri_screen
,
143 dri2_conf
->dri_double_config
,
144 dri2_surf
->gbm_surf
);
147 if (dri2_surf
->dri_drawable
== NULL
) {
148 _eglError(EGL_BAD_ALLOC
, "createNewDrawable()");
152 return &dri2_surf
->base
;
161 dri2_drm_create_window_surface(_EGLDriver
*drv
, _EGLDisplay
*disp
,
162 _EGLConfig
*conf
, void *native_window
,
163 const EGLint
*attrib_list
)
165 return dri2_drm_create_surface(drv
, disp
, EGL_WINDOW_BIT
, conf
,
166 native_window
, attrib_list
);
170 dri2_drm_create_pixmap_surface(_EGLDriver
*drv
, _EGLDisplay
*disp
,
171 _EGLConfig
*conf
, void *native_window
,
172 const EGLint
*attrib_list
)
174 /* From the EGL_MESA_platform_gbm spec, version 5:
176 * It is not valid to call eglCreatePlatformPixmapSurfaceEXT with a <dpy>
177 * that belongs to the GBM platform. Any such call fails and generates
180 _eglError(EGL_BAD_PARAMETER
, "cannot create EGL pixmap surfaces on GBM");
185 dri2_drm_destroy_surface(_EGLDriver
*drv
, _EGLDisplay
*disp
, _EGLSurface
*surf
)
187 struct dri2_egl_display
*dri2_dpy
= dri2_egl_display(disp
);
188 struct dri2_egl_surface
*dri2_surf
= dri2_egl_surface(surf
);
191 if (!_eglPutSurface(surf
))
194 (*dri2_dpy
->core
->destroyDrawable
)(dri2_surf
->dri_drawable
);
196 for (i
= 0; i
< ARRAY_SIZE(dri2_surf
->color_buffers
); i
++) {
197 if (dri2_surf
->color_buffers
[i
].bo
)
198 gbm_bo_destroy(dri2_surf
->color_buffers
[i
].bo
);
201 for (i
= 0; i
< __DRI_BUFFER_COUNT
; i
++) {
202 if (dri2_surf
->dri_buffers
[i
])
203 dri2_dpy
->dri2
->releaseBuffer(dri2_dpy
->dri_screen
,
204 dri2_surf
->dri_buffers
[i
]);
213 get_back_bo(struct dri2_egl_surface
*dri2_surf
)
215 struct dri2_egl_display
*dri2_dpy
=
216 dri2_egl_display(dri2_surf
->base
.Resource
.Display
);
217 struct gbm_dri_surface
*surf
= dri2_surf
->gbm_surf
;
220 if (dri2_surf
->back
== NULL
) {
221 for (i
= 0; i
< ARRAY_SIZE(dri2_surf
->color_buffers
); i
++) {
222 if (!dri2_surf
->color_buffers
[i
].locked
) {
223 dri2_surf
->back
= &dri2_surf
->color_buffers
[i
];
229 if (dri2_surf
->back
== NULL
)
231 if (dri2_surf
->back
->bo
== NULL
)
232 dri2_surf
->back
->bo
= gbm_bo_create(&dri2_dpy
->gbm_dri
->base
.base
,
233 surf
->base
.width
, surf
->base
.height
,
234 surf
->base
.format
, surf
->base
.flags
);
235 if (dri2_surf
->back
->bo
== NULL
)
242 get_swrast_front_bo(struct dri2_egl_surface
*dri2_surf
)
244 struct dri2_egl_display
*dri2_dpy
=
245 dri2_egl_display(dri2_surf
->base
.Resource
.Display
);
246 struct gbm_dri_surface
*surf
= dri2_surf
->gbm_surf
;
248 if (dri2_surf
->current
== NULL
) {
249 assert(!dri2_surf
->color_buffers
[0].locked
);
250 dri2_surf
->current
= &dri2_surf
->color_buffers
[0];
253 if (dri2_surf
->current
->bo
== NULL
)
254 dri2_surf
->current
->bo
= gbm_bo_create(&dri2_dpy
->gbm_dri
->base
.base
,
255 surf
->base
.width
, surf
->base
.height
,
256 surf
->base
.format
, surf
->base
.flags
);
257 if (dri2_surf
->current
->bo
== NULL
)
264 back_bo_to_dri_buffer(struct dri2_egl_surface
*dri2_surf
, __DRIbuffer
*buffer
)
266 struct dri2_egl_display
*dri2_dpy
=
267 dri2_egl_display(dri2_surf
->base
.Resource
.Display
);
268 struct gbm_dri_bo
*bo
;
271 bo
= (struct gbm_dri_bo
*) dri2_surf
->back
->bo
;
273 dri2_dpy
->image
->queryImage(bo
->image
, __DRI_IMAGE_ATTRIB_NAME
, &name
);
274 dri2_dpy
->image
->queryImage(bo
->image
, __DRI_IMAGE_ATTRIB_STRIDE
, &pitch
);
276 buffer
->attachment
= __DRI_BUFFER_BACK_LEFT
;
278 buffer
->pitch
= pitch
;
284 get_aux_bo(struct dri2_egl_surface
*dri2_surf
,
285 unsigned int attachment
, unsigned int format
, __DRIbuffer
*buffer
)
287 struct dri2_egl_display
*dri2_dpy
=
288 dri2_egl_display(dri2_surf
->base
.Resource
.Display
);
289 __DRIbuffer
*b
= dri2_surf
->dri_buffers
[attachment
];
292 b
= dri2_dpy
->dri2
->allocateBuffer(dri2_dpy
->dri_screen
,
294 dri2_surf
->base
.Width
,
295 dri2_surf
->base
.Height
);
296 dri2_surf
->dri_buffers
[attachment
] = b
;
301 memcpy(buffer
, b
, sizeof *buffer
);
307 dri2_drm_get_buffers_with_format(__DRIdrawable
*driDrawable
,
308 int *width
, int *height
,
309 unsigned int *attachments
, int count
,
310 int *out_count
, void *loaderPrivate
)
312 struct dri2_egl_surface
*dri2_surf
= loaderPrivate
;
315 dri2_surf
->buffer_count
= 0;
316 for (i
= 0, j
= 0; i
< 2 * count
; i
+= 2, j
++) {
317 assert(attachments
[i
] < __DRI_BUFFER_COUNT
);
318 assert(dri2_surf
->buffer_count
< 5);
320 switch (attachments
[i
]) {
321 case __DRI_BUFFER_BACK_LEFT
:
322 if (get_back_bo(dri2_surf
) < 0) {
323 _eglError(EGL_BAD_ALLOC
, "failed to allocate color buffer");
326 back_bo_to_dri_buffer(dri2_surf
, &dri2_surf
->buffers
[j
]);
329 if (get_aux_bo(dri2_surf
, attachments
[i
], attachments
[i
+ 1],
330 &dri2_surf
->buffers
[j
]) < 0) {
331 _eglError(EGL_BAD_ALLOC
, "failed to allocate aux buffer");
342 *width
= dri2_surf
->base
.Width
;
343 *height
= dri2_surf
->base
.Height
;
345 return dri2_surf
->buffers
;
349 dri2_drm_get_buffers(__DRIdrawable
* driDrawable
,
350 int *width
, int *height
,
351 unsigned int *attachments
, int count
,
352 int *out_count
, void *loaderPrivate
)
354 unsigned int *attachments_with_format
;
356 const unsigned int format
= 32;
359 attachments_with_format
= calloc(count
, 2 * sizeof(unsigned int));
360 if (!attachments_with_format
) {
365 for (i
= 0; i
< count
; ++i
) {
366 attachments_with_format
[2*i
] = attachments
[i
];
367 attachments_with_format
[2*i
+ 1] = format
;
371 dri2_drm_get_buffers_with_format(driDrawable
,
373 attachments_with_format
, count
,
374 out_count
, loaderPrivate
);
376 free(attachments_with_format
);
382 dri2_drm_image_get_buffers(__DRIdrawable
*driDrawable
,
386 uint32_t buffer_mask
,
387 struct __DRIimageList
*buffers
)
389 struct dri2_egl_surface
*dri2_surf
= loaderPrivate
;
390 struct gbm_dri_bo
*bo
;
392 if (get_back_bo(dri2_surf
) < 0)
395 bo
= (struct gbm_dri_bo
*) dri2_surf
->back
->bo
;
396 buffers
->image_mask
= __DRI_IMAGE_BUFFER_BACK
;
397 buffers
->back
= bo
->image
;
403 dri2_drm_flush_front_buffer(__DRIdrawable
* driDrawable
, void *loaderPrivate
)
406 (void) loaderPrivate
;
410 dri2_drm_swap_buffers(_EGLDriver
*drv
, _EGLDisplay
*disp
, _EGLSurface
*draw
)
412 struct dri2_egl_display
*dri2_dpy
= dri2_egl_display(disp
);
413 struct dri2_egl_surface
*dri2_surf
= dri2_egl_surface(draw
);
416 if (dri2_dpy
->swrast
) {
417 (*dri2_dpy
->core
->swapBuffers
)(dri2_surf
->dri_drawable
);
419 if (dri2_surf
->base
.Type
== EGL_WINDOW_BIT
) {
420 if (dri2_surf
->current
)
421 _eglError(EGL_BAD_SURFACE
, "dri2_swap_buffers");
422 for (i
= 0; i
< ARRAY_SIZE(dri2_surf
->color_buffers
); i
++)
423 if (dri2_surf
->color_buffers
[i
].age
> 0)
424 dri2_surf
->color_buffers
[i
].age
++;
426 /* Make sure we have a back buffer in case we're swapping without
428 if (get_back_bo(dri2_surf
) < 0) {
429 _eglError(EGL_BAD_ALLOC
, "dri2_swap_buffers");
433 dri2_surf
->current
= dri2_surf
->back
;
434 dri2_surf
->current
->age
= 1;
435 dri2_surf
->back
= NULL
;
438 dri2_flush_drawable_for_swapbuffers(disp
, draw
);
439 (*dri2_dpy
->flush
->invalidate
)(dri2_surf
->dri_drawable
);
446 dri2_drm_query_buffer_age(_EGLDriver
*drv
,
447 _EGLDisplay
*disp
, _EGLSurface
*surface
)
449 struct dri2_egl_surface
*dri2_surf
= dri2_egl_surface(surface
);
451 if (get_back_bo(dri2_surf
) < 0) {
452 _eglError(EGL_BAD_ALLOC
, "dri2_query_buffer_age");
456 return dri2_surf
->back
->age
;
460 dri2_drm_create_image_khr_pixmap(_EGLDisplay
*disp
, _EGLContext
*ctx
,
461 EGLClientBuffer buffer
, const EGLint
*attr_list
)
463 struct dri2_egl_display
*dri2_dpy
= dri2_egl_display(disp
);
464 struct gbm_dri_bo
*dri_bo
= gbm_dri_bo((struct gbm_bo
*) buffer
);
465 struct dri2_egl_image
*dri2_img
;
467 dri2_img
= malloc(sizeof *dri2_img
);
469 _eglError(EGL_BAD_ALLOC
, "dri2_create_image_khr_pixmap");
473 if (!_eglInitImage(&dri2_img
->base
, disp
)) {
478 dri2_img
->dri_image
= dri2_dpy
->image
->dupImage(dri_bo
->image
, dri2_img
);
479 if (dri2_img
->dri_image
== NULL
) {
481 _eglError(EGL_BAD_ALLOC
, "dri2_create_image_khr_pixmap");
485 return &dri2_img
->base
;
489 dri2_drm_create_image_khr(_EGLDriver
*drv
, _EGLDisplay
*disp
,
490 _EGLContext
*ctx
, EGLenum target
,
491 EGLClientBuffer buffer
, const EGLint
*attr_list
)
496 case EGL_NATIVE_PIXMAP_KHR
:
497 return dri2_drm_create_image_khr_pixmap(disp
, ctx
, buffer
, attr_list
);
499 return dri2_create_image_khr(drv
, disp
, ctx
, target
, buffer
, attr_list
);
504 dri2_drm_authenticate(_EGLDisplay
*disp
, uint32_t id
)
506 struct dri2_egl_display
*dri2_dpy
= dri2_egl_display(disp
);
508 return drmAuthMagic(dri2_dpy
->fd
, id
);
512 swrast_put_image2(__DRIdrawable
*driDrawable
,
522 struct dri2_egl_surface
*dri2_surf
= loaderPrivate
;
523 int internal_stride
, i
;
524 struct gbm_dri_bo
*bo
;
526 if (op
!= __DRI_SWRAST_IMAGE_OP_DRAW
&&
527 op
!= __DRI_SWRAST_IMAGE_OP_SWAP
)
530 if (get_swrast_front_bo(dri2_surf
) < 0)
533 bo
= gbm_dri_bo(dri2_surf
->current
->bo
);
534 if (gbm_dri_bo_map(bo
) == NULL
)
537 internal_stride
= bo
->base
.base
.stride
;
539 for (i
= 0; i
< height
; i
++) {
540 memcpy(bo
->map
+ (x
+ i
) * internal_stride
+ y
,
541 data
+ i
* stride
, stride
);
544 gbm_dri_bo_unmap(bo
);
548 swrast_get_image(__DRIdrawable
*driDrawable
,
556 struct dri2_egl_surface
*dri2_surf
= loaderPrivate
;
557 int internal_stride
, stride
, i
;
558 struct gbm_dri_bo
*bo
;
560 if (get_swrast_front_bo(dri2_surf
) < 0)
563 bo
= gbm_dri_bo(dri2_surf
->current
->bo
);
564 if (gbm_dri_bo_map(bo
) == NULL
)
567 internal_stride
= bo
->base
.base
.stride
;
570 for (i
= 0; i
< height
; i
++) {
571 memcpy(data
+ i
* stride
,
572 bo
->map
+ (x
+ i
) * internal_stride
+ y
, stride
);
575 gbm_dri_bo_unmap(bo
);
578 static struct dri2_egl_display_vtbl dri2_drm_display_vtbl
= {
579 .authenticate
= dri2_drm_authenticate
,
580 .create_window_surface
= dri2_drm_create_window_surface
,
581 .create_pixmap_surface
= dri2_drm_create_pixmap_surface
,
582 .create_pbuffer_surface
= dri2_fallback_create_pbuffer_surface
,
583 .destroy_surface
= dri2_drm_destroy_surface
,
584 .create_image
= dri2_drm_create_image_khr
,
585 .swap_interval
= dri2_fallback_swap_interval
,
586 .swap_buffers
= dri2_drm_swap_buffers
,
587 .swap_buffers_with_damage
= dri2_fallback_swap_buffers_with_damage
,
588 .swap_buffers_region
= dri2_fallback_swap_buffers_region
,
589 .post_sub_buffer
= dri2_fallback_post_sub_buffer
,
590 .copy_buffers
= dri2_fallback_copy_buffers
,
591 .query_buffer_age
= dri2_drm_query_buffer_age
,
592 .create_wayland_buffer_from_image
= dri2_fallback_create_wayland_buffer_from_image
,
593 .get_sync_values
= dri2_fallback_get_sync_values
,
597 dri2_initialize_drm(_EGLDriver
*drv
, _EGLDisplay
*disp
)
599 struct dri2_egl_display
*dri2_dpy
;
600 struct gbm_device
*gbm
;
604 loader_set_logger(_eglLog
);
606 dri2_dpy
= calloc(1, sizeof *dri2_dpy
);
608 return _eglError(EGL_BAD_ALLOC
, "eglInitialize");
610 disp
->DriverData
= (void *) dri2_dpy
;
612 gbm
= disp
->PlatformDisplay
;
615 int n
= snprintf(buf
, sizeof(buf
), DRM_DEV_NAME
, DRM_DIR_NAME
, 0);
616 if (n
!= -1 && n
< sizeof(buf
))
617 fd
= loader_open_device(buf
);
619 fd
= loader_open_device("/dev/dri/card0");
620 dri2_dpy
->own_device
= 1;
621 gbm
= gbm_create_device(fd
);
626 if (strcmp(gbm_device_get_backend_name(gbm
), "drm") != 0) {
631 dri2_dpy
->gbm_dri
= gbm_dri_device(gbm
);
632 if (dri2_dpy
->gbm_dri
->base
.type
!= GBM_DRM_DRIVER_TYPE_DRI
) {
638 fd
= fcntl(gbm_device_get_fd(gbm
), F_DUPFD_CLOEXEC
, 3);
646 dri2_dpy
->device_name
= loader_get_device_name_for_fd(dri2_dpy
->fd
);
647 dri2_dpy
->driver_name
= strdup(dri2_dpy
->gbm_dri
->base
.driver_name
);
649 dri2_dpy
->dri_screen
= dri2_dpy
->gbm_dri
->screen
;
650 dri2_dpy
->core
= dri2_dpy
->gbm_dri
->core
;
651 dri2_dpy
->dri2
= dri2_dpy
->gbm_dri
->dri2
;
652 dri2_dpy
->image
= dri2_dpy
->gbm_dri
->image
;
653 dri2_dpy
->flush
= dri2_dpy
->gbm_dri
->flush
;
654 dri2_dpy
->swrast
= dri2_dpy
->gbm_dri
->swrast
;
655 dri2_dpy
->driver_configs
= dri2_dpy
->gbm_dri
->driver_configs
;
657 dri2_dpy
->gbm_dri
->lookup_image
= dri2_lookup_egl_image
;
658 dri2_dpy
->gbm_dri
->lookup_user_data
= disp
;
660 dri2_dpy
->gbm_dri
->get_buffers
= dri2_drm_get_buffers
;
661 dri2_dpy
->gbm_dri
->flush_front_buffer
= dri2_drm_flush_front_buffer
;
662 dri2_dpy
->gbm_dri
->get_buffers_with_format
= dri2_drm_get_buffers_with_format
;
663 dri2_dpy
->gbm_dri
->image_get_buffers
= dri2_drm_image_get_buffers
;
664 dri2_dpy
->gbm_dri
->swrast_put_image2
= swrast_put_image2
;
665 dri2_dpy
->gbm_dri
->swrast_get_image
= swrast_get_image
;
667 dri2_dpy
->gbm_dri
->base
.base
.surface_lock_front_buffer
= lock_front_buffer
;
668 dri2_dpy
->gbm_dri
->base
.base
.surface_release_buffer
= release_buffer
;
669 dri2_dpy
->gbm_dri
->base
.base
.surface_has_free_buffers
= has_free_buffers
;
671 dri2_setup_screen(disp
);
673 for (i
= 0; dri2_dpy
->driver_configs
[i
]; i
++) {
674 EGLint format
, attr_list
[3];
675 unsigned int red
, alpha
;
677 dri2_dpy
->core
->getConfigAttrib(dri2_dpy
->driver_configs
[i
],
678 __DRI_ATTRIB_RED_MASK
, &red
);
679 dri2_dpy
->core
->getConfigAttrib(dri2_dpy
->driver_configs
[i
],
680 __DRI_ATTRIB_ALPHA_MASK
, &alpha
);
681 if (red
== 0x3ff00000 && alpha
== 0x00000000)
682 format
= GBM_FORMAT_XRGB2101010
;
683 else if (red
== 0x3ff00000 && alpha
== 0xc0000000)
684 format
= GBM_FORMAT_ARGB2101010
;
685 else if (red
== 0x00ff0000 && alpha
== 0x00000000)
686 format
= GBM_FORMAT_XRGB8888
;
687 else if (red
== 0x00ff0000 && alpha
== 0xff000000)
688 format
= GBM_FORMAT_ARGB8888
;
689 else if (red
== 0xf800)
690 format
= GBM_FORMAT_RGB565
;
694 attr_list
[0] = EGL_NATIVE_VISUAL_ID
;
695 attr_list
[1] = format
;
696 attr_list
[2] = EGL_NONE
;
698 dri2_add_config(disp
, dri2_dpy
->driver_configs
[i
],
699 i
+ 1, EGL_WINDOW_BIT
, attr_list
, NULL
);
702 disp
->Extensions
.KHR_image_pixmap
= EGL_TRUE
;
704 disp
->Extensions
.EXT_buffer_age
= EGL_TRUE
;
706 #ifdef HAVE_WAYLAND_PLATFORM
707 if (dri2_dpy
->image
) {
708 if (dri2_dpy
->image
->base
.version
>= 10 &&
709 dri2_dpy
->image
->getCapabilities
!= NULL
) {
713 dri2_dpy
->image
->getCapabilities(dri2_dpy
->dri_screen
);
714 disp
->Extensions
.WL_bind_wayland_display
=
715 (capabilities
& __DRI_IMAGE_CAP_GLOBAL_NAMES
) != 0;
717 disp
->Extensions
.WL_bind_wayland_display
= EGL_TRUE
;
721 /* Fill vtbl last to prevent accidentally calling virtual function during
724 dri2_dpy
->vtbl
= &dri2_drm_display_vtbl
;