[PATCH xserver 4/5] Xwayland: Check that glamor-xv is usable

Olivier Fourdan ofourdan at redhat.com
Thu Apr 20 15:35:43 UTC 2017


Use glamor_xv_core_init() returned value to disable Xv support early if
glamor-xv is not usable.

Signed-off-by: Olivier Fourdan <ofourdan at redhat.com>
Fixes: https://bugzilla.redhat.com/1412814
---
 hw/xwayland/xwayland-glamor-xv.c |  3 ++-
 hw/xwayland/xwayland-glamor.c    | 11 ++++++-----
 2 files changed, 8 insertions(+), 6 deletions(-)

diff --git a/hw/xwayland/xwayland-glamor-xv.c b/hw/xwayland/xwayland-glamor-xv.c
index 65f93c6..48c93de 100644
--- a/hw/xwayland/xwayland-glamor-xv.c
+++ b/hw/xwayland/xwayland-glamor-xv.c
@@ -406,7 +406,8 @@ xwl_glamor_xv_init(ScreenPtr pScreen)
     xwlXvScreen->CloseScreen = pScreen->CloseScreen;
     pScreen->CloseScreen = xwl_glamor_xv_close_screen;
 
-    glamor_xv_core_init(pScreen);
+    if (!glamor_xv_core_init(pScreen))
+        return FALSE;
 
     return xwl_glamor_xv_add_adaptors(pScreen);
 }
diff --git a/hw/xwayland/xwayland-glamor.c b/hw/xwayland/xwayland-glamor.c
index 63f2303..b085efb 100644
--- a/hw/xwayland/xwayland-glamor.c
+++ b/hw/xwayland/xwayland-glamor.c
@@ -249,6 +249,12 @@ xwl_glamor_create_screen_resources(ScreenPtr screen)
 
     SetRootClip(screen, xwl_screen->root_clip_mode);
 
+    /* xwl_glamor_xv_init() needs screen resources */
+#ifdef XV
+    if (!xwl_glamor_xv_init(screen))
+        ErrorF("Failed to initialize glamor Xv extension\n");
+#endif
+
     return screen->devPrivate != NULL;
 }
 
@@ -614,10 +620,5 @@ xwl_glamor_init(struct xwl_screen *xwl_screen)
     screen->CreatePixmap = xwl_glamor_create_pixmap;
     screen->DestroyPixmap = xwl_glamor_destroy_pixmap;
 
-#ifdef XV
-    if (!xwl_glamor_xv_init(screen))
-        ErrorF("Failed to initialize glamor Xv extension\n");
-#endif
-
     return TRUE;
 }
-- 
2.9.3



More information about the xorg-devel mailing list