[PATCH xserver 2/5] modesetting: Check that glamor-xv is usable

Olivier Fourdan ofourdan at redhat.com
Thu Apr 20 15:35:41 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://bugs.freedesktop.org/show_bug.cgi?id=100710
---
 hw/xfree86/drivers/modesetting/driver.c | 26 +++++++++++++-------------
 hw/xfree86/glamor_egl/glamor_xf86_xv.c  |  3 ++-
 2 files changed, 15 insertions(+), 14 deletions(-)

diff --git a/hw/xfree86/drivers/modesetting/driver.c b/hw/xfree86/drivers/modesetting/driver.c
index d7030e5..5d21415 100644
--- a/hw/xfree86/drivers/modesetting/driver.c
+++ b/hw/xfree86/drivers/modesetting/driver.c
@@ -1377,6 +1377,19 @@ CreateScreenResources(ScreenPtr pScreen)
 
     pScrPriv->rrStartFlippingPixmapTracking = msStartFlippingPixmapTracking;
 
+#ifdef GLAMOR
+    if (ms->drmmode.glamor) {
+        XF86VideoAdaptorPtr     glamor_adaptor;
+
+        glamor_adaptor = glamor_xv_init(pScreen, 16);
+        if (glamor_adaptor != NULL)
+            xf86XVScreenInit(pScreen, &glamor_adaptor, 1);
+        else
+            xf86DrvMsg(pScrn->scrnIndex, X_ERROR,
+                       "Failed to initialize XV support.\n");
+    }
+#endif
+
     return ret;
 }
 
@@ -1666,19 +1679,6 @@ ScreenInit(ScreenPtr pScreen, int argc, char **argv)
 
     xf86DPMSInit(pScreen, xf86DPMSSet, 0);
 
-#ifdef GLAMOR
-    if (ms->drmmode.glamor) {
-        XF86VideoAdaptorPtr     glamor_adaptor;
-
-        glamor_adaptor = glamor_xv_init(pScreen, 16);
-        if (glamor_adaptor != NULL)
-            xf86XVScreenInit(pScreen, &glamor_adaptor, 1);
-        else
-            xf86DrvMsg(pScrn->scrnIndex, X_ERROR,
-                       "Failed to initialize XV support.\n");
-    }
-#endif
-
     if (serverGeneration == 1)
         xf86ShowUnusedOptions(pScrn->scrnIndex, pScrn->options);
 
diff --git a/hw/xfree86/glamor_egl/glamor_xf86_xv.c b/hw/xfree86/glamor_egl/glamor_xf86_xv.c
index 8535fa0..4f5c76e 100644
--- a/hw/xfree86/glamor_egl/glamor_xf86_xv.c
+++ b/hw/xfree86/glamor_egl/glamor_xf86_xv.c
@@ -130,7 +130,8 @@ glamor_xv_init(ScreenPtr screen, int num_texture_ports)
     XF86VideoAdaptorPtr adapt;
     int i;
 
-    glamor_xv_core_init(screen);
+    if (!glamor_xv_core_init(screen))
+        return NULL;
 
     adapt = calloc(1, sizeof(XF86VideoAdaptorRec) + num_texture_ports *
                    (sizeof(glamor_port_private) + sizeof(DevUnion)));
-- 
2.9.3



More information about the xorg-devel mailing list