17465391 SPARC/autoconfig: Redundant probing in Xorg needs to be resolved
authorTianjun Ye<tianjun.ye@oracle.com>
Fri, 06 Dec 2013 18:48:20 -0800
changeset 1376 df86b96964b5
parent 1375 14708239aad2
child 1377 fbbb6fba6990
17465391 SPARC/autoconfig: Redundant probing in Xorg needs to be resolved
open-src/xserver/xorg/17465391.patch
open-src/xserver/xorg/autodetect-kernel-dev-fb.patch
open-src/xserver/xorg/patch-list
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/open-src/xserver/xorg/17465391.patch	Fri Dec 06 18:48:20 2013 -0800
@@ -0,0 +1,115 @@
+# Copyright (c) 2006, 2013, Oracle and/or its affiliates. All rights reserved.
+#
+# Permission is hereby granted, free of charge, to any person obtaining a
+# copy of this software and associated documentation files (the "Software"),
+# to deal in the Software without restriction, including without limitation
+# the rights to use, copy, modify, merge, publish, distribute, sublicense,
+# and/or sell copies of the Software, and to permit persons to whom the
+# Software is furnished to do so, subject to the following conditions:
+#
+# The above copyright notice and this permission notice (including the next
+# paragraph) shall be included in all copies or substantial portions of the
+# Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
+# THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+# DEALINGS IN THE SOFTWARE.
+17465391: SPARC/autoconfig: kernel driver based probing is redundancy, need to remove
+
+diff --git a/xf86pciBus.c b/xf86pciBus.c
+index 258988a..bfe8151 100644
+--- a/hw/xfree86/common/xf86pciBus.c
++++ b/hw/xfree86/common/xf86pciBus.c
+@@ -1132,7 +1132,11 @@ xf86VideoPtrToDriverList(struct pci_device *dev,
+         driverList[0] = "ast";
+         break;
+     case 0x1002:
++    #if ((defined(__sparc__) || defined(__sparc)) && defined (sun))
++        driverList[0] = "efb";
++    #else
+         driverList[0] = "ati";
++    #endif
+         break;
+     case 0x102c:
+         driverList[0] = "chips";
+@@ -1219,7 +1223,11 @@ xf86VideoPtrToDriverList(struct pci_device *dev,
+ #ifdef __linux__
+         driverList[idx++] = "nouveau";
+ #endif
++#ifdef sun
++        driverList[idx++] = "nvidia";
++#else
+         driverList[idx++] = "nv";
++#endif
+         break;
+     }
+     case 0x1106:
+
+
+diff --git a/xf86AutoConfig.c b/xf86AutoConfig.c
+index e85a72f..e3367f4 100644
+--- a/hw/xfree86/common/xf86AutoConfig.c
++++ b/hw/xfree86/common/xf86AutoConfig.c
+@@ -229,58 +229,7 @@ listPossibleVideoDrivers(char *matches[], int nmatches)
+ #ifdef XSERVER_PLATFORM_BUS
+     i = xf86PlatformMatchDriver(matches, nmatches);
+ #endif
+-#ifdef sun
+-    /* Check for driver type based on /dev/fb type and if valid, use
+-       it instead of PCI bus probe results */
+-    if (xf86Info.consoleFd >= 0 && (i < (nmatches - 1))) {
+-        struct vis_identifier visid;
+-        const char *cp;
+-        extern char xf86SolarisFbDev[PATH_MAX];
+-        int iret;
+-
+-        SYSCALL(iret = ioctl(xf86Info.consoleFd, VIS_GETIDENTIFIER, &visid));
+-        if (iret < 0) {
+-            int fbfd;
+-
+-            fbfd = open(xf86SolarisFbDev, O_RDONLY);
+-            if (fbfd >= 0) {
+-                SYSCALL(iret = ioctl(fbfd, VIS_GETIDENTIFIER, &visid));
+-                close(fbfd);
+-            }
+-        }
+-
+-        if (iret < 0) {
+-            xf86Msg(X_WARNING,
+-                    "could not get frame buffer identifier from %s\n",
+-                    xf86SolarisFbDev);
+-        }
+-        else {
+-            xf86Msg(X_PROBED, "console driver: %s\n", visid.name);
+-
+-            /* Special case from before the general case was set */
+-            if (strcmp(visid.name, "NVDAnvda") == 0) {
+-                matches[i++] = xnfstrdup("nvidia");
+-            }
+
+-            /* General case - split into vendor name (initial all-caps
+-               prefix) & driver name (rest of the string). */
+-            if (strcmp(visid.name, "SUNWtext") != 0) {
+-                for (cp = visid.name; (*cp != '\0') && isupper(*cp); cp++) {
+-                    /* find end of all uppercase vendor section */
+-                }
+-                if ((cp != visid.name) && (*cp != '\0')) {
+-                    char *driverName = xnfstrdup(cp);
+-                    char *vendorName = xnfstrdup(visid.name);
+-
+-                    vendorName[cp - visid.name] = '\0';
+-
+-                    matches[i++] = vendorName;
+-                    matches[i++] = driverName;
+-                }
+-            }
+-        }
+-    }
+-#endif
+ #ifdef __sparc__
+     if (i < (nmatches - 1))
+     {
--- a/open-src/xserver/xorg/autodetect-kernel-dev-fb.patch	Tue Nov 26 16:05:27 2013 -0800
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,124 +0,0 @@
-# Copyright (c) 2010, 2013, Oracle and/or its affiliates. All rights reserved.
-#
-# Permission is hereby granted, free of charge, to any person obtaining a
-# copy of this software and associated documentation files (the "Software"),
-# to deal in the Software without restriction, including without limitation
-# the rights to use, copy, modify, merge, publish, distribute, sublicense,
-# and/or sell copies of the Software, and to permit persons to whom the
-# Software is furnished to do so, subject to the following conditions:
-#
-# The above copyright notice and this permission notice (including the next
-# paragraph) shall be included in all copies or substantial portions of the
-# Software.
-#
-# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
-# THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
-# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
-# DEALINGS IN THE SOFTWARE.
-
---- a/hw/xfree86/common/xf86AutoConfig.c	Wed Sep 12 11:16:47 2012
-+++ b/hw/xfree86/common/xf86AutoConfig.c	Wed Sep 12 11:35:21 2012
-@@ -220,6 +220,12 @@
- listPossibleVideoDrivers(char *matches[], int nmatches)
- {
-     int i;
-+#ifdef sun
-+    int got_vis_id = 0;
-+    struct vis_identifier visid;
-+    int iret;
-+    extern char xf86SolarisFbDev[PATH_MAX];
-+#endif
- 
-     for (i = 0; i < nmatches; i++) {
-         matches[i] = NULL;
-@@ -233,52 +239,50 @@
-     /* Check for driver type based on /dev/fb type and if valid, use
-        it instead of PCI bus probe results */
-     if (xf86Info.consoleFd >= 0 && (i < (nmatches - 1))) {
--        struct vis_identifier visid;
--        const char *cp;
--        extern char xf86SolarisFbDev[PATH_MAX];
--        int iret;
--
-         SYSCALL(iret = ioctl(xf86Info.consoleFd, VIS_GETIDENTIFIER, &visid));
--        if (iret < 0) {
--            int fbfd;
-+        if (iret >= 0)
-+            got_vis_id = 1;
-+    }
-+    if (!got_vis_id) {
-+        int fbfd;
- 
--            fbfd = open(xf86SolarisFbDev, O_RDONLY);
--            if (fbfd >= 0) {
--                SYSCALL(iret = ioctl(fbfd, VIS_GETIDENTIFIER, &visid));
--                close(fbfd);
--            }
-+        fbfd = open(xf86SolarisFbDev, O_RDONLY);
-+        if (fbfd >= 0) {
-+            SYSCALL(iret = ioctl(fbfd, VIS_GETIDENTIFIER, &visid));
-+            if (iret >= 0)
-+                got_vis_id = 1;
-+            close(fbfd);
-         }
-+    }
-+    if (got_vis_id) {
-+        const char *cp;
- 
--        if (iret < 0) {
--            xf86Msg(X_WARNING,
--                    "could not get frame buffer identifier from %s\n",
--                    xf86SolarisFbDev);
-+        xf86Msg(X_PROBED, "console driver: %s\n", visid.name);
-+     
-+        /* Special case from before the general case was set */
-+        if (strcmp(visid.name, "NVDAnvda") == 0) {
-+            matches[i++] = xnfstrdup("nvidia");
-         }
--        else {
--            xf86Msg(X_PROBED, "console driver: %s\n", visid.name);
- 
--            /* Special case from before the general case was set */
--            if (strcmp(visid.name, "NVDAnvda") == 0) {
--                matches[i++] = xnfstrdup("nvidia");
-+        /* General case - split into vendor name (initial all-caps
-+           prefix) & driver name (rest of the string). */
-+        if (strcmp(visid.name, "SUNWtext") != 0) {
-+            for (cp = visid.name; (*cp != '\0') && isupper(*cp); cp++) {
-+                    /* find end of all uppercase vendor section */
-             }
-+            if ((cp != visid.name) && (*cp != '\0')) {
-+                 char *driverName = xnfstrdup(cp);
-+                 char *vendorName = xnfstrdup(visid.name);
-+                 vendorName[cp - visid.name] = '\0';
- 
--            /* General case - split into vendor name (initial all-caps
--               prefix) & driver name (rest of the string). */
--            if (strcmp(visid.name, "SUNWtext") != 0) {
--                for (cp = visid.name; (*cp != '\0') && isupper(*cp); cp++) {
--                    /* find end of all uppercase vendor section */
--                }
--                if ((cp != visid.name) && (*cp != '\0')) {
--                    char *driverName = xnfstrdup(cp);
--                    char *vendorName = xnfstrdup(visid.name);
--
--                    vendorName[cp - visid.name] = '\0';
--
--                    matches[i++] = vendorName;
--                    matches[i++] = driverName;
--                }
-+                 matches[i++] = vendorName;
-+                 matches[i++] = driverName;
-             }
--        }
-+         }
-+      } else {
-+         xf86Msg(X_WARNING,
-+                "could not get frame buffer identifier from %s\n",
-+                xf86SolarisFbDev);
-     }
- #endif
- #ifdef __sparc__
--- a/open-src/xserver/xorg/patch-list	Tue Nov 26 16:05:27 2013 -0800
+++ b/open-src/xserver/xorg/patch-list	Fri Dec 06 18:48:20 2013 -0800
@@ -22,7 +22,6 @@
 6906694.patch,-p1
 6912996.patch,-p1
 record-regset.patch,-p1
-autodetect-kernel-dev-fb.patch,-p1
 workaround-7154410.patch,-p1
 113-port.patch,-p1
 cli-nolock.patch,-p1
@@ -30,3 +29,4 @@
 sparc-config-improv.patch,-p1
 16794101.patch,-p1
 17404398.patch,-p1
+17465391.patch,-p1