summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorOlivier Fourdan <ofourdan@redhat.com>2018-06-05 19:38:41 +0200
committerAdam Jackson <ajax@redhat.com>2018-06-21 10:54:10 -0400
commitf2fcb4877e976d078b0eb4755177170467341484 (patch)
tree3ef1fd0e80ae57116bdbce320b46ed49e0d82c62
parentb74b0f18b8d3032317e38453ee63ae9efd33a098 (diff)
xwayland: Add Wayland interfaces check
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@redhat.com> Reviewed-by: Emil Velikov <emil.velikov@collabora.com>
-rw-r--r--hw/xwayland/xwayland-glamor-eglstream.c28
-rw-r--r--hw/xwayland/xwayland-glamor-gbm.c14
-rw-r--r--hw/xwayland/xwayland-glamor.c11
-rw-r--r--hw/xwayland/xwayland.h7
4 files changed, 52 insertions, 8 deletions
diff --git a/hw/xwayland/xwayland-glamor-eglstream.c b/hw/xwayland/xwayland-glamor-eglstream.c
index f3fd97e6e..bf74ae329 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)
{
@@ -819,14 +838,6 @@ xwl_glamor_eglstream_init_screen(struct xwl_screen *xwl_screen)
xwl_eglstream_get(xwl_screen);
ScreenPtr screen = xwl_screen->screen;
- if (!xwl_eglstream->controller) {
- ErrorF("No eglstream controller was exposed in the wayland registry. "
- "This means your version of nvidia's EGL wayland libraries "
- "are too old, as we require support for this.\n");
- xwl_eglstream_cleanup(xwl_screen);
- return FALSE;
- }
-
/* We can just let glamor handle CreatePixmap */
screen->DestroyPixmap = xwl_glamor_eglstream_destroy_pixmap;
@@ -898,6 +909,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 4ac7d50f6..8a56801e6 100644
--- a/hw/xwayland/xwayland-glamor-gbm.c
+++ b/hw/xwayland/xwayland-glamor-gbm.c
@@ -747,6 +747,19 @@ xwl_glamor_gbm_init_wl_registry(struct xwl_screen *xwl_screen,
}
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)
{
struct xwl_gbm_private *xwl_gbm = xwl_gbm_get(xwl_screen);
@@ -887,6 +900,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 14706f6e8..72995de00 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,
id, interface, 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 6bbe72e46..191f1b297 100644
--- a/hw/xwayland/xwayland.h
+++ b/hw/xwayland/xwayland.h
@@ -69,6 +69,11 @@ struct xwl_egl_backend {
uint32_t id, const char *name,
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);