diff options
author | Emil Velikov <[email protected]> | 2016-08-25 13:15:43 +0100 |
---|---|---|
committer | Emil Velikov <[email protected]> | 2016-10-14 12:53:39 +0100 |
commit | 98f5d0106a8ee45e58a6bf162720da3f6f614a95 (patch) | |
tree | 0179539bacaae92ba76661c02509bed009a3875f /src/egl/drivers/dri2/egl_dri2.h | |
parent | 637d001a97a82142bc20d410655098a0b7b39694 (diff) |
egl/dri2: set WL_bind_wayland_display in a consistent way
Introduce a helper and use it throughout the platform code. This allows
us to reduce the amount of ifdef(s) and (potentially) use
kms_swrast_dri.so for !drm platforms (namely wayland and x11).
Note: in the future as other platforms (android, surfaceless) support
the extension they can reuse the helper.
v2: Rebase, check for device_name.
Signed-off-by: Emil Velikov <[email protected]>
Reviewed-by: Daniel Stone <[email protected]>
Reviewed-by: Eric Engestrom <[email protected]>
Diffstat (limited to 'src/egl/drivers/dri2/egl_dri2.h')
-rw-r--r-- | src/egl/drivers/dri2/egl_dri2.h | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/src/egl/drivers/dri2/egl_dri2.h b/src/egl/drivers/dri2/egl_dri2.h index 244baf4e854..85d4b85eae2 100644 --- a/src/egl/drivers/dri2/egl_dri2.h +++ b/src/egl/drivers/dri2/egl_dri2.h @@ -397,4 +397,28 @@ const __DRIconfig * dri2_get_dri_config(struct dri2_egl_config *conf, EGLint surface_type, EGLenum colorspace); +static inline void +dri2_set_WL_bind_wayland_display(_EGLDriver *drv, _EGLDisplay *disp) +{ +#ifdef HAVE_WAYLAND_PLATFORM + struct dri2_egl_display *dri2_dpy = dri2_egl_display(disp); + + (void) drv; + + if (dri2_dpy->device_name && dri2_dpy->image) { + if (dri2_dpy->image->base.version >= 10 && + dri2_dpy->image->getCapabilities != NULL) { + int capabilities; + + capabilities = + dri2_dpy->image->getCapabilities(dri2_dpy->dri_screen); + disp->Extensions.WL_bind_wayland_display = + (capabilities & __DRI_IMAGE_CAP_GLOBAL_NAMES) != 0; + } else { + disp->Extensions.WL_bind_wayland_display = EGL_TRUE; + } + } +#endif +} + #endif /* EGL_DRI2_INCLUDED */ |