Blame SOURCES/0015-XFree86-Load-wlshm-driver-as-fallback-for-Wayland.patch

d64d53
From 4e8eb23a03e14ce149e302e4dfc6e6af6fa61424 Mon Sep 17 00:00:00 2001
70130e
From: Daniel Stone <daniel@fooishbar.org>
70130e
Date: Fri, 16 Aug 2013 13:21:21 +0100
d64d53
Subject: [PATCH 15/38] XFree86: Load wlshm driver as fallback for Wayland
70130e
70130e
Since fbdev or vesa are unlikely to be too useful there ...
70130e
70130e
Signed-off-by: Daniel Stone <daniel@fooishbar.org>
70130e
---
70130e
 hw/xfree86/common/xf86AutoConfig.c |  9 +++++++--
70130e
 hw/xfree86/common/xf86Config.c     | 16 +++++++++++++---
70130e
 2 files changed, 20 insertions(+), 5 deletions(-)
70130e
70130e
diff --git a/hw/xfree86/common/xf86AutoConfig.c b/hw/xfree86/common/xf86AutoConfig.c
d64d53
index af2b7f8..a3e1fa7 100644
70130e
--- a/hw/xfree86/common/xf86AutoConfig.c
70130e
+++ b/hw/xfree86/common/xf86AutoConfig.c
d64d53
@@ -275,10 +275,15 @@ listPossibleVideoDrivers(char *matches[], int nmatches)
70130e
 #if !defined(sun)
70130e
     /* Fallback to platform default frame buffer driver */
70130e
     if (i < (nmatches - 1)) {
70130e
+#ifdef XORG_WAYLAND
70130e
+        if (xorgWayland)
70130e
+            matches[i++] = xnfstrdup("wlshm");
70130e
+        else
70130e
+#endif
70130e
 #if !defined(__linux__) && defined(__sparc__)
70130e
-        matches[i++] = xnfstrdup("wsfb");
70130e
+            matches[i++] = xnfstrdup("wsfb");
70130e
 #else
70130e
-        matches[i++] = xnfstrdup("fbdev");
70130e
+            matches[i++] = xnfstrdup("fbdev");
70130e
 #endif
70130e
     }
70130e
 #endif                          /* !sun */
70130e
diff --git a/hw/xfree86/common/xf86Config.c b/hw/xfree86/common/xf86Config.c
d64d53
index 3b0bb89..aebfc1b 100644
70130e
--- a/hw/xfree86/common/xf86Config.c
70130e
+++ b/hw/xfree86/common/xf86Config.c
70130e
@@ -519,7 +519,11 @@ xf86InputDriverlistFromConfig(void)
70130e
 static void
70130e
 fixup_video_driver_list(char **drivers)
70130e
 {
d64d53
-    static const char *fallback[4] = { "fbdev", "vesa", "wsfb", NULL };
d64d53
+    static const char *fallback_hw[4] = { "fbdev", "vesa", "wsfb", NULL };
70130e
+#ifdef XORG_WAYLAND
70130e
+    static const char *fallback_wayland[2] = { "wlshm", NULL };
70130e
+#endif
70130e
+    const char **fallbacks;
70130e
     char **end, **drv;
70130e
     char *x;
70130e
     int i;
70130e
@@ -532,9 +536,15 @@ fixup_video_driver_list(char **drivers)
70130e
      * for each of the fallback drivers, if we find it in the list,
70130e
      * swap it with the last available non-fallback driver.
70130e
      */
70130e
-    for (i = 0; fallback[i]; i++) {
70130e
+#ifdef XORG_WAYLAND
70130e
+    if (xorgWayland)
70130e
+        fallbacks = fallback_wl;
70130e
+    else
70130e
+#endif
70130e
+        fallbacks = fallback_hw;
70130e
+    for (i = 0; fallbacks[i]; i++) {
70130e
         for (drv = drivers; drv != end; drv++) {
70130e
-            if (strstr(*drv, fallback[i])) {
70130e
+            if (strstr(*drv, fallbacks[i])) {
70130e
                 x = *drv;
70130e
                 *drv = *end;
70130e
                 *end = x;
70130e
-- 
d64d53
1.8.4.2
70130e