open-src/xserver/xorg/autodetect-kernel-dev-fb.patch
changeset 1419 66a69b108f21
parent 1418 536e3ec8f101
child 1420 a66feea9d14c
equal deleted inserted replaced
1418:536e3ec8f101 1419:66a69b108f21
     1 # Copyright (c) 2010, 2012, Oracle and/or its affiliates. All rights reserved.
       
     2 #
       
     3 # Permission is hereby granted, free of charge, to any person obtaining a
       
     4 # copy of this software and associated documentation files (the "Software"),
       
     5 # to deal in the Software without restriction, including without limitation
       
     6 # the rights to use, copy, modify, merge, publish, distribute, sublicense,
       
     7 # and/or sell copies of the Software, and to permit persons to whom the
       
     8 # Software is furnished to do so, subject to the following conditions:
       
     9 #
       
    10 # The above copyright notice and this permission notice (including the next
       
    11 # paragraph) shall be included in all copies or substantial portions of the
       
    12 # Software.
       
    13 #
       
    14 # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
       
    15 # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
       
    16 # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
       
    17 # THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
       
    18 # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
       
    19 # FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
       
    20 # DEALINGS IN THE SOFTWARE.
       
    21 
       
    22 --- a/hw/xfree86/common/xf86AutoConfig.c	Wed Sep 12 11:16:47 2012
       
    23 +++ b/hw/xfree86/common/xf86AutoConfig.c	Wed Sep 12 11:35:21 2012
       
    24 @@ -220,6 +220,12 @@
       
    25  listPossibleVideoDrivers(char *matches[], int nmatches)
       
    26  {
       
    27      int i;
       
    28 +#ifdef sun
       
    29 +    int got_vis_id = 0;
       
    30 +    struct vis_identifier visid;
       
    31 +    int iret;
       
    32 +    extern char xf86SolarisFbDev[PATH_MAX];
       
    33 +#endif
       
    34  
       
    35      for (i = 0; i < nmatches; i++) {
       
    36          matches[i] = NULL;
       
    37 @@ -233,52 +239,50 @@
       
    38      /* Check for driver type based on /dev/fb type and if valid, use
       
    39         it instead of PCI bus probe results */
       
    40      if (xf86Info.consoleFd >= 0 && (i < (nmatches - 1))) {
       
    41 -        struct vis_identifier visid;
       
    42 -        const char *cp;
       
    43 -        extern char xf86SolarisFbDev[PATH_MAX];
       
    44 -        int iret;
       
    45 -
       
    46          SYSCALL(iret = ioctl(xf86Info.consoleFd, VIS_GETIDENTIFIER, &visid));
       
    47 -        if (iret < 0) {
       
    48 -            int fbfd;
       
    49 +        if (iret >= 0)
       
    50 +            got_vis_id = 1;
       
    51 +    }
       
    52 +    if (!got_vis_id) {
       
    53 +        int fbfd;
       
    54  
       
    55 -            fbfd = open(xf86SolarisFbDev, O_RDONLY);
       
    56 -            if (fbfd >= 0) {
       
    57 -                SYSCALL(iret = ioctl(fbfd, VIS_GETIDENTIFIER, &visid));
       
    58 -                close(fbfd);
       
    59 -            }
       
    60 +        fbfd = open(xf86SolarisFbDev, O_RDONLY);
       
    61 +        if (fbfd >= 0) {
       
    62 +            SYSCALL(iret = ioctl(fbfd, VIS_GETIDENTIFIER, &visid));
       
    63 +            if (iret >= 0)
       
    64 +                got_vis_id = 1;
       
    65 +            close(fbfd);
       
    66          }
       
    67 +    }
       
    68 +    if (got_vis_id) {
       
    69 +        const char *cp;
       
    70  
       
    71 -        if (iret < 0) {
       
    72 -            xf86Msg(X_WARNING,
       
    73 -                    "could not get frame buffer identifier from %s\n",
       
    74 -                    xf86SolarisFbDev);
       
    75 +        xf86Msg(X_PROBED, "console driver: %s\n", visid.name);
       
    76 +     
       
    77 +        /* Special case from before the general case was set */
       
    78 +        if (strcmp(visid.name, "NVDAnvda") == 0) {
       
    79 +            matches[i++] = xnfstrdup("nvidia");
       
    80          }
       
    81 -        else {
       
    82 -            xf86Msg(X_PROBED, "console driver: %s\n", visid.name);
       
    83  
       
    84 -            /* Special case from before the general case was set */
       
    85 -            if (strcmp(visid.name, "NVDAnvda") == 0) {
       
    86 -                matches[i++] = xnfstrdup("nvidia");
       
    87 +        /* General case - split into vendor name (initial all-caps
       
    88 +           prefix) & driver name (rest of the string). */
       
    89 +        if (strcmp(visid.name, "SUNWtext") != 0) {
       
    90 +            for (cp = visid.name; (*cp != '\0') && isupper(*cp); cp++) {
       
    91 +                    /* find end of all uppercase vendor section */
       
    92              }
       
    93 +            if ((cp != visid.name) && (*cp != '\0')) {
       
    94 +                 char *driverName = xnfstrdup(cp);
       
    95 +                 char *vendorName = xnfstrdup(visid.name);
       
    96 +                 vendorName[cp - visid.name] = '\0';
       
    97  
       
    98 -            /* General case - split into vendor name (initial all-caps
       
    99 -               prefix) & driver name (rest of the string). */
       
   100 -            if (strcmp(visid.name, "SUNWtext") != 0) {
       
   101 -                for (cp = visid.name; (*cp != '\0') && isupper(*cp); cp++) {
       
   102 -                    /* find end of all uppercase vendor section */
       
   103 -                }
       
   104 -                if ((cp != visid.name) && (*cp != '\0')) {
       
   105 -                    char *driverName = xnfstrdup(cp);
       
   106 -                    char *vendorName = xnfstrdup(visid.name);
       
   107 -
       
   108 -                    vendorName[cp - visid.name] = '\0';
       
   109 -
       
   110 -                    matches[i++] = vendorName;
       
   111 -                    matches[i++] = driverName;
       
   112 -                }
       
   113 +                 matches[i++] = vendorName;
       
   114 +                 matches[i++] = driverName;
       
   115              }
       
   116 -        }
       
   117 +         }
       
   118 +      } else {
       
   119 +         xf86Msg(X_WARNING,
       
   120 +                "could not get frame buffer identifier from %s\n",
       
   121 +                xf86SolarisFbDev);
       
   122      }
       
   123  #endif
       
   124  #ifdef __sparc__