[PATCH xserver 1/3] xwayland: Add hook to check wl interface for glamor
Olivier Fourdan
ofourdan at redhat.com
Wed May 30 09:30:35 UTC 2018
Add an optional egl_backend callback to check that the required Wayland
interfaces are available.
Signed-off-by: Olivier Fourdan <ofourdan at redhat.com>
---
hw/xwayland/xwayland-glamor.c | 9 +++++++++
hw/xwayland/xwayland.c | 4 ++++
hw/xwayland/xwayland.h | 7 +++++++
3 files changed, 20 insertions(+)
diff --git a/hw/xwayland/xwayland-glamor.c b/hw/xwayland/xwayland-glamor.c
index 6ae274c08..aeb0b27b9 100644
--- a/hw/xwayland/xwayland-glamor.c
+++ b/hw/xwayland/xwayland-glamor.c
@@ -162,6 +162,15 @@ xwl_glamor_init_wl_registry(struct xwl_screen *xwl_screen,
interface, id, version);
}
+Bool
+xwl_glamor_has_wl_interface(struct xwl_screen *xwl_screen)
+{
+ if (xwl_screen->egl_backend.has_wl_interface)
+ return xwl_screen->egl_backend.has_wl_interface(xwl_screen);
+
+ return TRUE;
+}
+
struct wl_buffer *
xwl_glamor_pixmap_get_wl_buffer(PixmapPtr pixmap,
unsigned short width,
diff --git a/hw/xwayland/xwayland.c b/hw/xwayland/xwayland.c
index 4dd8f3810..d831291ca 100644
--- a/hw/xwayland/xwayland.c
+++ b/hw/xwayland/xwayland.c
@@ -1091,6 +1091,10 @@ xwl_screen_init(ScreenPtr pScreen, int argc, char **argv)
return FALSE;
#ifdef XWL_HAS_GLAMOR
+ if (xwl_screen->glamor && !xwl_glamor_has_wl_interface(xwl_screen)) {
+ ErrorF("Missing Wayland interfaces required for glamor, falling back to sw\n");
+ xwl_screen->glamor = 0;
+ }
if (xwl_screen->glamor && !xwl_glamor_init(xwl_screen)) {
ErrorF("Failed to initialize glamor, falling back to sw\n");
xwl_screen->glamor = 0;
diff --git a/hw/xwayland/xwayland.h b/hw/xwayland/xwayland.h
index ff746114c..62cb40f08 100644
--- a/hw/xwayland/xwayland.h
+++ b/hw/xwayland/xwayland.h
@@ -120,6 +120,12 @@ struct xwl_screen {
const char *name, uint32_t id,
uint32_t version);
+ /* Check that the required Wayland interfaces are available.
+ * This callback is optional.
+ */
+ Bool (*has_wl_interface)(struct xwl_screen *xwl_screen);
+
+
/* Called before glamor has been initialized. Backends should setup a
* valid, glamor compatible EGL context in this hook.
*/
@@ -429,6 +435,7 @@ 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_interface(struct xwl_screen *xwl_screen);
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