Commit f2fcb487 authored by Olivier Fourdan's avatar Olivier Fourdan Committed by Adam Jackson
Browse files

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: default avatarOlivier Fourdan <ofourdan@redhat.com>
Reviewed-by: Emil Velikov's avatarEmil Velikov <emil.velikov@collabora.com>
parent b74b0f18
......@@ -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;
......
......@@ -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)
{
......@@ -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;
......
......@@ -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,
......
......@@ -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);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment