open-src/xserver/xorg/autodetect-kernel-dev-fb.patch
author Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
Mon, 14 Mar 2011 15:37:30 -0700
changeset 1088 1c99106ccbe0
child 1124 7bc7e624f965
permissions -rw-r--r--
6983602 Xorg 1.9 integration [PSARC/2011/008]

# Copyright (c) 2010, 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.
diff -Nurp -x '*~' -x '*.orig' hw/xfree86/common/xf86AutoConfig.c hw/xfree86/common/xf86AutoConfig.c
--- hw/xfree86/common/xf86AutoConfig.c	2010-12-16 15:40:50.420727168 -0500
+++ hw/xfree86/common/xf86AutoConfig.c	2010-12-03 15:50:42.721496105 -0500
@@ -219,6 +219,12 @@ static void
 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;
@@ -229,50 +235,50 @@ listPossibleVideoDrivers(char *matches[]
     /* Check for driver type based on /dev/fb type and if valid, use
        it instead of PCI bus probe results */
     if (xf86Info.consoleFd >= 0) {
-	struct vis_identifier   visid;
+	SYSCALL(iret = ioctl(xf86Info.consoleFd, VIS_GETIDENTIFIER, &visid));
+	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));
+	    if (iret >= 0)
+		got_vis_id = 1;
+	    close(fbfd);
+	}
+    }
+    if (got_vis_id) {
 	const char *cp;
-	extern char xf86SolarisFbDev[PATH_MAX];
-	int iret;
 
-	SYSCALL(iret = ioctl(xf86Info.consoleFd, VIS_GETIDENTIFIER, &visid));
-	if (iret < 0) {
-	    int fbfd;
+	xf86Msg(X_PROBED, "console driver: %s\n", visid.name);
 
-	    fbfd = open(xf86SolarisFbDev, O_RDONLY);
-	    if (fbfd >= 0) {
-		SYSCALL(iret = ioctl(fbfd, VIS_GETIDENTIFIER, &visid));
-		close(fbfd);
-	    }
+	/* Special case from before the general case was set */
+	if (strcmp(visid.name, "NVDAnvda") == 0) {
+	    matches[i++] = xnfstrdup("nvidia");
 	}
 
-	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';
 
-	    /* 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__