[PATCH xserver 3/5] xwayland: Add Wayland interfaces check
Olivier Fourdan
ofourdan at redhat.com
Fri Jun 1 14:31:40 UTC 2018
Introduces a new egl_backend function to let the EGL backend check for
the presence of the required Wayland interfaces.
Signed-off-by: Olivier Fourdan <ofourdan at redhat.com>
---
hw/xwayland/xwayland-glamor-eglstream.c | 20 ++++++++++++++++++++
hw/xwayland/xwayland-glamor-gbm.c | 14 ++++++++++++++
hw/xwayland/xwayland-glamor.c | 11 +++++++++++
hw/xwayland/xwayland.h | 7 +++++++
4 files changed, 52 insertions(+)
diff --git a/hw/xwayland/xwayland-glamor-eglstream.c b/hw/xwayland/xwayland-glamor-eglstream.c
index 89c531f4a..85b562c31 100644
--- a/hw/xwayland/xwayland-glamor-eglstream.c
+++ b/hw/xwayland/xwayland-glamor-eglstream.c
@@ -660,6 +660,25 @@ xwl_glamor_eglstream_init_wl_registry(struct xwl_screen *xwl_screen,
}
}
+static Bool
+xwl_glamor_eglstream_has_wl_interfaces(struct xwl_screen *xwl_screen)
+{
+ struct xwl_eglstream_private *xwl_eglstream =
+ xwl_eglstream_get(xwl_screen);
+
+ if (xwl_eglstream->display == NULL) {
+ ErrorF("glamor: 'wl_eglstream_display' not supported\n");
+ return FALSE;
+ }
+
+ if (xwl_eglstream->controller == NULL) {
+ ErrorF("glamor: 'wl_eglstream_controller' not supported\n");
+ return FALSE;
+ }
+
+ return TRUE;
+}
+
static inline void
xwl_eglstream_init_shaders(struct xwl_screen *xwl_screen)
{
@@ -898,6 +917,7 @@ xwl_glamor_init_eglstream(struct xwl_screen *xwl_screen)
xwl_screen->egl_backend.init_egl = xwl_glamor_eglstream_init_egl;
xwl_screen->egl_backend.init_wl_registry = xwl_glamor_eglstream_init_wl_registry;
+ xwl_screen->egl_backend.has_wl_interfaces = xwl_glamor_eglstream_has_wl_interfaces;
xwl_screen->egl_backend.init_screen = xwl_glamor_eglstream_init_screen;
xwl_screen->egl_backend.get_wl_buffer_for_pixmap = xwl_glamor_eglstream_get_wl_buffer_for_pixmap;
xwl_screen->egl_backend.post_damage = xwl_glamor_eglstream_post_damage;
diff --git a/hw/xwayland/xwayland-glamor-gbm.c b/hw/xwayland/xwayland-glamor-gbm.c
index 29325adac..f34c45b9a 100644
--- a/hw/xwayland/xwayland-glamor-gbm.c
+++ b/hw/xwayland/xwayland-glamor-gbm.c
@@ -746,6 +746,19 @@ xwl_glamor_gbm_init_wl_registry(struct xwl_screen *xwl_screen,
xwl_screen_set_dmabuf_interface(xwl_screen, id, version);
}
+static Bool
+xwl_glamor_gbm_has_wl_interfaces(struct xwl_screen *xwl_screen)
+{
+ struct xwl_gbm_private *xwl_gbm = xwl_gbm_get(xwl_screen);
+
+ if (xwl_gbm->drm == NULL) {
+ ErrorF("glamor: 'wl_drm' not supported\n");
+ return FALSE;
+ }
+
+ return TRUE;
+}
+
static Bool
xwl_glamor_gbm_init_egl(struct xwl_screen *xwl_screen)
{
@@ -879,6 +892,7 @@ xwl_glamor_init_gbm(struct xwl_screen *xwl_screen)
xwl_gbm);
xwl_screen->egl_backend.init_wl_registry = xwl_glamor_gbm_init_wl_registry;
+ xwl_screen->egl_backend.has_wl_interfaces = xwl_glamor_gbm_has_wl_interfaces;
xwl_screen->egl_backend.init_egl = xwl_glamor_gbm_init_egl;
xwl_screen->egl_backend.init_screen = xwl_glamor_gbm_init_screen;
xwl_screen->egl_backend.get_wl_buffer_for_pixmap = xwl_glamor_gbm_get_wl_buffer_for_pixmap;
diff --git a/hw/xwayland/xwayland-glamor.c b/hw/xwayland/xwayland-glamor.c
index c7ae51336..8e858394a 100644
--- a/hw/xwayland/xwayland-glamor.c
+++ b/hw/xwayland/xwayland-glamor.c
@@ -76,6 +76,17 @@ xwl_glamor_init_wl_registry(struct xwl_screen *xwl_screen,
interface, id, version);
}
+Bool
+xwl_glamor_has_wl_interfaces(struct xwl_screen *xwl_screen,
+ struct xwl_egl_backend *xwl_egl_backend)
+{
+ if (xwl_egl_backend->has_wl_interfaces)
+ return xwl_egl_backend->has_wl_interfaces(xwl_screen);
+
+ /* If the backend has no requirement wrt WL interfaces, we're fine */
+ return TRUE;
+}
+
struct wl_buffer *
xwl_glamor_pixmap_get_wl_buffer(PixmapPtr pixmap,
unsigned short width,
diff --git a/hw/xwayland/xwayland.h b/hw/xwayland/xwayland.h
index 0d6a4c246..674be3d49 100644
--- a/hw/xwayland/xwayland.h
+++ b/hw/xwayland/xwayland.h
@@ -69,6 +69,11 @@ struct xwl_egl_backend {
const char *name, uint32_t id,
uint32_t version);
+ /* Check that the required Wayland interfaces are available. This
+ * callback is optional.
+ */
+ Bool (*has_wl_interfaces)(struct xwl_screen *xwl_screen);
+
/* Called before glamor has been initialized. Backends should setup a
* valid, glamor compatible EGL context in this hook.
*/
@@ -432,6 +437,8 @@ void xwl_glamor_init_wl_registry(struct xwl_screen *xwl_screen,
struct wl_registry *registry,
uint32_t id, const char *interface,
uint32_t version);
+Bool xwl_glamor_has_wl_interfaces(struct xwl_screen *xwl_screen,
+ struct xwl_egl_backend *xwl_egl_backend);
void xwl_glamor_post_damage(struct xwl_window *xwl_window,
PixmapPtr pixmap, RegionPtr region);
Bool xwl_glamor_allow_commits(struct xwl_window *xwl_window);
--
2.17.0
More information about the xorg-devel
mailing list