src/video/Xext/Xxf86dga/XF86DGA.c
branchSDL-1.3
changeset 1668 4da1ee79c9af
parent 1662 782fd950bd46
     1.1 --- a/src/video/Xext/Xxf86dga/XF86DGA.c	Mon May 29 03:53:21 2006 +0000
     1.2 +++ b/src/video/Xext/Xxf86dga/XF86DGA.c	Mon May 29 04:04:35 2006 +0000
     1.3 @@ -65,8 +65,8 @@
     1.4  #include "../extensions/Xext.h"
     1.5  #include "../extensions/extutil.h"
     1.6  
     1.7 -extern XExtDisplayInfo *SDL_NAME (xdga_find_display) (Display *);
     1.8 -extern char *SDL_NAME (xdga_extension_name);
     1.9 +extern XExtDisplayInfo *SDL_NAME(xdga_find_display) (Display *);
    1.10 +extern char *SDL_NAME(xdga_extension_name);
    1.11  
    1.12  #define XF86DGACheckExtension(dpy,i,val) \
    1.13    XextCheckExtension (dpy, i, SDL_NAME(xdga_extension_name), val)
    1.14 @@ -77,37 +77,37 @@
    1.15   *                                                                           *
    1.16   *****************************************************************************/
    1.17  
    1.18 -Bool SDL_NAME (XF86DGAQueryExtension) (Display * dpy,
    1.19 -                                       int *event_basep, int *error_basep)
    1.20 +Bool SDL_NAME(XF86DGAQueryExtension) (Display * dpy,
    1.21 +                                      int *event_basep, int *error_basep)
    1.22  {
    1.23 -    return SDL_NAME (XDGAQueryExtension) (dpy, event_basep, error_basep);
    1.24 +    return SDL_NAME(XDGAQueryExtension) (dpy, event_basep, error_basep);
    1.25  }
    1.26  
    1.27 -Bool SDL_NAME (XF86DGAQueryVersion) (Display * dpy,
    1.28 -                                     int *majorVersion, int *minorVersion)
    1.29 +Bool SDL_NAME(XF86DGAQueryVersion) (Display * dpy,
    1.30 +                                    int *majorVersion, int *minorVersion)
    1.31  {
    1.32 -    return SDL_NAME (XDGAQueryVersion) (dpy, majorVersion, minorVersion);
    1.33 +    return SDL_NAME(XDGAQueryVersion) (dpy, majorVersion, minorVersion);
    1.34  }
    1.35  
    1.36 -Bool SDL_NAME (XF86DGAGetVideoLL) (Display * dpy,
    1.37 -                                   int screen,
    1.38 -                                   int *offset,
    1.39 -                                   int *width, int *bank_size, int *ram_size)
    1.40 +Bool SDL_NAME(XF86DGAGetVideoLL) (Display * dpy,
    1.41 +                                  int screen,
    1.42 +                                  int *offset,
    1.43 +                                  int *width, int *bank_size, int *ram_size)
    1.44  {
    1.45 -    XExtDisplayInfo *info = SDL_NAME (xdga_find_display) (dpy);
    1.46 +    XExtDisplayInfo *info = SDL_NAME(xdga_find_display) (dpy);
    1.47      xXF86DGAGetVideoLLReply rep;
    1.48      xXF86DGAGetVideoLLReq *req;
    1.49  
    1.50 -    XF86DGACheckExtension (dpy, info, False);
    1.51 +    XF86DGACheckExtension(dpy, info, False);
    1.52  
    1.53 -    LockDisplay (dpy);
    1.54 -    GetReq (XF86DGAGetVideoLL, req);
    1.55 +    LockDisplay(dpy);
    1.56 +    GetReq(XF86DGAGetVideoLL, req);
    1.57      req->reqType = info->codes->major_opcode;
    1.58      req->dgaReqType = X_XF86DGAGetVideoLL;
    1.59      req->screen = screen;
    1.60 -    if (!_XReply (dpy, (xReply *) & rep, 0, xFalse)) {
    1.61 -        UnlockDisplay (dpy);
    1.62 -        SyncHandle ();
    1.63 +    if (!_XReply(dpy, (xReply *) & rep, 0, xFalse)) {
    1.64 +        UnlockDisplay(dpy);
    1.65 +        SyncHandle();
    1.66          return False;
    1.67      }
    1.68  
    1.69 @@ -116,192 +116,191 @@
    1.70      *bank_size = rep.bank_size;
    1.71      *ram_size = rep.ram_size;
    1.72  
    1.73 -    UnlockDisplay (dpy);
    1.74 -    SyncHandle ();
    1.75 +    UnlockDisplay(dpy);
    1.76 +    SyncHandle();
    1.77      return True;
    1.78  }
    1.79  
    1.80  
    1.81 -Bool SDL_NAME (XF86DGADirectVideoLL) (Display * dpy, int screen, int enable)
    1.82 +Bool SDL_NAME(XF86DGADirectVideoLL) (Display * dpy, int screen, int enable)
    1.83  {
    1.84 -    XExtDisplayInfo *info = SDL_NAME (xdga_find_display) (dpy);
    1.85 +    XExtDisplayInfo *info = SDL_NAME(xdga_find_display) (dpy);
    1.86      xXF86DGADirectVideoReq *req;
    1.87  
    1.88 -    XF86DGACheckExtension (dpy, info, False);
    1.89 +    XF86DGACheckExtension(dpy, info, False);
    1.90  
    1.91 -    LockDisplay (dpy);
    1.92 -    GetReq (XF86DGADirectVideo, req);
    1.93 +    LockDisplay(dpy);
    1.94 +    GetReq(XF86DGADirectVideo, req);
    1.95      req->reqType = info->codes->major_opcode;
    1.96      req->dgaReqType = X_XF86DGADirectVideo;
    1.97      req->screen = screen;
    1.98      req->enable = enable;
    1.99 -    UnlockDisplay (dpy);
   1.100 -    SyncHandle ();
   1.101 -    XSync (dpy, False);
   1.102 +    UnlockDisplay(dpy);
   1.103 +    SyncHandle();
   1.104 +    XSync(dpy, False);
   1.105      return True;
   1.106  }
   1.107  
   1.108 -Bool SDL_NAME (XF86DGAGetViewPortSize) (Display * dpy,
   1.109 -                                        int screen, int *width, int *height)
   1.110 +Bool SDL_NAME(XF86DGAGetViewPortSize) (Display * dpy,
   1.111 +                                       int screen, int *width, int *height)
   1.112  {
   1.113 -    XExtDisplayInfo *info = SDL_NAME (xdga_find_display) (dpy);
   1.114 +    XExtDisplayInfo *info = SDL_NAME(xdga_find_display) (dpy);
   1.115      xXF86DGAGetViewPortSizeReply rep;
   1.116      xXF86DGAGetViewPortSizeReq *req;
   1.117  
   1.118 -    XF86DGACheckExtension (dpy, info, False);
   1.119 +    XF86DGACheckExtension(dpy, info, False);
   1.120  
   1.121 -    LockDisplay (dpy);
   1.122 -    GetReq (XF86DGAGetViewPortSize, req);
   1.123 +    LockDisplay(dpy);
   1.124 +    GetReq(XF86DGAGetViewPortSize, req);
   1.125      req->reqType = info->codes->major_opcode;
   1.126      req->dgaReqType = X_XF86DGAGetViewPortSize;
   1.127      req->screen = screen;
   1.128 -    if (!_XReply (dpy, (xReply *) & rep, 0, xFalse)) {
   1.129 -        UnlockDisplay (dpy);
   1.130 -        SyncHandle ();
   1.131 +    if (!_XReply(dpy, (xReply *) & rep, 0, xFalse)) {
   1.132 +        UnlockDisplay(dpy);
   1.133 +        SyncHandle();
   1.134          return False;
   1.135      }
   1.136  
   1.137      *width = rep.width;
   1.138      *height = rep.height;
   1.139  
   1.140 -    UnlockDisplay (dpy);
   1.141 -    SyncHandle ();
   1.142 +    UnlockDisplay(dpy);
   1.143 +    SyncHandle();
   1.144      return True;
   1.145  }
   1.146  
   1.147  
   1.148 -Bool SDL_NAME (XF86DGASetViewPort) (Display * dpy, int screen, int x, int y)
   1.149 +Bool SDL_NAME(XF86DGASetViewPort) (Display * dpy, int screen, int x, int y)
   1.150  {
   1.151 -    XExtDisplayInfo *info = SDL_NAME (xdga_find_display) (dpy);
   1.152 +    XExtDisplayInfo *info = SDL_NAME(xdga_find_display) (dpy);
   1.153      xXF86DGASetViewPortReq *req;
   1.154  
   1.155 -    XF86DGACheckExtension (dpy, info, False);
   1.156 +    XF86DGACheckExtension(dpy, info, False);
   1.157  
   1.158 -    LockDisplay (dpy);
   1.159 -    GetReq (XF86DGASetViewPort, req);
   1.160 +    LockDisplay(dpy);
   1.161 +    GetReq(XF86DGASetViewPort, req);
   1.162      req->reqType = info->codes->major_opcode;
   1.163      req->dgaReqType = X_XF86DGASetViewPort;
   1.164      req->screen = screen;
   1.165      req->x = x;
   1.166      req->y = y;
   1.167 -    UnlockDisplay (dpy);
   1.168 -    SyncHandle ();
   1.169 -    XSync (dpy, False);
   1.170 +    UnlockDisplay(dpy);
   1.171 +    SyncHandle();
   1.172 +    XSync(dpy, False);
   1.173      return True;
   1.174  }
   1.175  
   1.176  
   1.177 -Bool SDL_NAME (XF86DGAGetVidPage) (Display * dpy, int screen, int *vpage)
   1.178 +Bool SDL_NAME(XF86DGAGetVidPage) (Display * dpy, int screen, int *vpage)
   1.179  {
   1.180 -    XExtDisplayInfo *info = SDL_NAME (xdga_find_display) (dpy);
   1.181 +    XExtDisplayInfo *info = SDL_NAME(xdga_find_display) (dpy);
   1.182      xXF86DGAGetVidPageReply rep;
   1.183      xXF86DGAGetVidPageReq *req;
   1.184  
   1.185 -    XF86DGACheckExtension (dpy, info, False);
   1.186 +    XF86DGACheckExtension(dpy, info, False);
   1.187  
   1.188 -    LockDisplay (dpy);
   1.189 -    GetReq (XF86DGAGetVidPage, req);
   1.190 +    LockDisplay(dpy);
   1.191 +    GetReq(XF86DGAGetVidPage, req);
   1.192      req->reqType = info->codes->major_opcode;
   1.193      req->dgaReqType = X_XF86DGAGetVidPage;
   1.194      req->screen = screen;
   1.195 -    if (!_XReply (dpy, (xReply *) & rep, 0, xFalse)) {
   1.196 -        UnlockDisplay (dpy);
   1.197 -        SyncHandle ();
   1.198 +    if (!_XReply(dpy, (xReply *) & rep, 0, xFalse)) {
   1.199 +        UnlockDisplay(dpy);
   1.200 +        SyncHandle();
   1.201          return False;
   1.202      }
   1.203  
   1.204      *vpage = rep.vpage;
   1.205 -    UnlockDisplay (dpy);
   1.206 -    SyncHandle ();
   1.207 +    UnlockDisplay(dpy);
   1.208 +    SyncHandle();
   1.209      return True;
   1.210  }
   1.211  
   1.212  
   1.213 -Bool SDL_NAME (XF86DGASetVidPage) (Display * dpy, int screen, int vpage)
   1.214 +Bool SDL_NAME(XF86DGASetVidPage) (Display * dpy, int screen, int vpage)
   1.215  {
   1.216 -    XExtDisplayInfo *info = SDL_NAME (xdga_find_display) (dpy);
   1.217 +    XExtDisplayInfo *info = SDL_NAME(xdga_find_display) (dpy);
   1.218      xXF86DGASetVidPageReq *req;
   1.219  
   1.220 -    XF86DGACheckExtension (dpy, info, False);
   1.221 +    XF86DGACheckExtension(dpy, info, False);
   1.222  
   1.223 -    LockDisplay (dpy);
   1.224 -    GetReq (XF86DGASetVidPage, req);
   1.225 +    LockDisplay(dpy);
   1.226 +    GetReq(XF86DGASetVidPage, req);
   1.227      req->reqType = info->codes->major_opcode;
   1.228      req->dgaReqType = X_XF86DGASetVidPage;
   1.229      req->screen = screen;
   1.230      req->vpage = vpage;
   1.231 -    UnlockDisplay (dpy);
   1.232 -    SyncHandle ();
   1.233 -    XSync (dpy, False);
   1.234 +    UnlockDisplay(dpy);
   1.235 +    SyncHandle();
   1.236 +    XSync(dpy, False);
   1.237      return True;
   1.238  }
   1.239  
   1.240 -Bool SDL_NAME (XF86DGAInstallColormap) (Display * dpy,
   1.241 -                                        int screen, Colormap cmap)
   1.242 +Bool SDL_NAME(XF86DGAInstallColormap) (Display * dpy,
   1.243 +                                       int screen, Colormap cmap)
   1.244  {
   1.245 -    XExtDisplayInfo *info = SDL_NAME (xdga_find_display) (dpy);
   1.246 +    XExtDisplayInfo *info = SDL_NAME(xdga_find_display) (dpy);
   1.247      xXF86DGAInstallColormapReq *req;
   1.248  
   1.249 -    XF86DGACheckExtension (dpy, info, False);
   1.250 +    XF86DGACheckExtension(dpy, info, False);
   1.251  
   1.252 -    LockDisplay (dpy);
   1.253 -    GetReq (XF86DGAInstallColormap, req);
   1.254 +    LockDisplay(dpy);
   1.255 +    GetReq(XF86DGAInstallColormap, req);
   1.256      req->reqType = info->codes->major_opcode;
   1.257      req->dgaReqType = X_XF86DGAInstallColormap;
   1.258      req->screen = screen;
   1.259      req->id = cmap;
   1.260 -    UnlockDisplay (dpy);
   1.261 -    SyncHandle ();
   1.262 -    XSync (dpy, False);
   1.263 +    UnlockDisplay(dpy);
   1.264 +    SyncHandle();
   1.265 +    XSync(dpy, False);
   1.266      return True;
   1.267  }
   1.268  
   1.269 -Bool SDL_NAME (XF86DGAQueryDirectVideo) (Display * dpy,
   1.270 -                                         int screen, int *flags)
   1.271 +Bool SDL_NAME(XF86DGAQueryDirectVideo) (Display * dpy, int screen, int *flags)
   1.272  {
   1.273 -    XExtDisplayInfo *info = SDL_NAME (xdga_find_display) (dpy);
   1.274 +    XExtDisplayInfo *info = SDL_NAME(xdga_find_display) (dpy);
   1.275      xXF86DGAQueryDirectVideoReply rep;
   1.276      xXF86DGAQueryDirectVideoReq *req;
   1.277  
   1.278 -    XF86DGACheckExtension (dpy, info, False);
   1.279 +    XF86DGACheckExtension(dpy, info, False);
   1.280  
   1.281 -    LockDisplay (dpy);
   1.282 -    GetReq (XF86DGAQueryDirectVideo, req);
   1.283 +    LockDisplay(dpy);
   1.284 +    GetReq(XF86DGAQueryDirectVideo, req);
   1.285      req->reqType = info->codes->major_opcode;
   1.286      req->dgaReqType = X_XF86DGAQueryDirectVideo;
   1.287      req->screen = screen;
   1.288 -    if (!_XReply (dpy, (xReply *) & rep, 0, xFalse)) {
   1.289 -        UnlockDisplay (dpy);
   1.290 -        SyncHandle ();
   1.291 +    if (!_XReply(dpy, (xReply *) & rep, 0, xFalse)) {
   1.292 +        UnlockDisplay(dpy);
   1.293 +        SyncHandle();
   1.294          return False;
   1.295      }
   1.296      *flags = rep.flags;
   1.297 -    UnlockDisplay (dpy);
   1.298 -    SyncHandle ();
   1.299 +    UnlockDisplay(dpy);
   1.300 +    SyncHandle();
   1.301      return True;
   1.302  }
   1.303  
   1.304 -Bool SDL_NAME (XF86DGAViewPortChanged) (Display * dpy, int screen, int n)
   1.305 +Bool SDL_NAME(XF86DGAViewPortChanged) (Display * dpy, int screen, int n)
   1.306  {
   1.307 -    XExtDisplayInfo *info = SDL_NAME (xdga_find_display) (dpy);
   1.308 +    XExtDisplayInfo *info = SDL_NAME(xdga_find_display) (dpy);
   1.309      xXF86DGAViewPortChangedReply rep;
   1.310      xXF86DGAViewPortChangedReq *req;
   1.311  
   1.312 -    XF86DGACheckExtension (dpy, info, False);
   1.313 +    XF86DGACheckExtension(dpy, info, False);
   1.314  
   1.315 -    LockDisplay (dpy);
   1.316 -    GetReq (XF86DGAViewPortChanged, req);
   1.317 +    LockDisplay(dpy);
   1.318 +    GetReq(XF86DGAViewPortChanged, req);
   1.319      req->reqType = info->codes->major_opcode;
   1.320      req->dgaReqType = X_XF86DGAViewPortChanged;
   1.321      req->screen = screen;
   1.322      req->n = n;
   1.323 -    if (!_XReply (dpy, (xReply *) & rep, 0, xFalse)) {
   1.324 -        UnlockDisplay (dpy);
   1.325 -        SyncHandle ();
   1.326 +    if (!_XReply(dpy, (xReply *) & rep, 0, xFalse)) {
   1.327 +        UnlockDisplay(dpy);
   1.328 +        SyncHandle();
   1.329          return False;
   1.330      }
   1.331 -    UnlockDisplay (dpy);
   1.332 -    SyncHandle ();
   1.333 +    UnlockDisplay(dpy);
   1.334 +    SyncHandle();
   1.335      return rep.result;
   1.336  }
   1.337  
   1.338 @@ -373,41 +372,41 @@
   1.339  static ScrPtr *scrList = NULL;
   1.340  
   1.341  static MapPtr
   1.342 -AddMap (void)
   1.343 +AddMap(void)
   1.344  {
   1.345      MapPtr *old;
   1.346  
   1.347      old = mapList;
   1.348 -    mapList = realloc (mapList, sizeof (MapPtr) * (numMaps + 1));
   1.349 +    mapList = realloc(mapList, sizeof(MapPtr) * (numMaps + 1));
   1.350      if (!mapList) {
   1.351          mapList = old;
   1.352          return NULL;
   1.353      }
   1.354 -    mapList[numMaps] = malloc (sizeof (MapRec));
   1.355 +    mapList[numMaps] = malloc(sizeof(MapRec));
   1.356      if (!mapList[numMaps])
   1.357          return NULL;
   1.358      return mapList[numMaps++];
   1.359  }
   1.360  
   1.361  static ScrPtr
   1.362 -AddScr (void)
   1.363 +AddScr(void)
   1.364  {
   1.365      ScrPtr *old;
   1.366  
   1.367      old = scrList;
   1.368 -    scrList = realloc (scrList, sizeof (ScrPtr) * (numScrs + 1));
   1.369 +    scrList = realloc(scrList, sizeof(ScrPtr) * (numScrs + 1));
   1.370      if (!scrList) {
   1.371          scrList = old;
   1.372          return NULL;
   1.373      }
   1.374 -    scrList[numScrs] = malloc (sizeof (ScrRec));
   1.375 +    scrList[numScrs] = malloc(sizeof(ScrRec));
   1.376      if (!scrList[numScrs])
   1.377          return NULL;
   1.378      return scrList[numScrs++];
   1.379  }
   1.380  
   1.381  static MapPtr
   1.382 -FindMap (unsigned long address, unsigned long size)
   1.383 +FindMap(unsigned long address, unsigned long size)
   1.384  {
   1.385      int i;
   1.386  
   1.387 @@ -419,7 +418,7 @@
   1.388  }
   1.389  
   1.390  static ScrPtr
   1.391 -FindScr (Display * display, int screen)
   1.392 +FindScr(Display * display, int screen)
   1.393  {
   1.394      int i;
   1.395  
   1.396 @@ -431,7 +430,7 @@
   1.397  }
   1.398  
   1.399  static void *
   1.400 -MapPhysAddress (unsigned long address, unsigned long size)
   1.401 +MapPhysAddress(unsigned long address, unsigned long size)
   1.402  {
   1.403      unsigned long offset, delta;
   1.404      int pagesize = -1;
   1.405 @@ -445,20 +444,20 @@
   1.406      HFILE hfd;
   1.407  #endif
   1.408  
   1.409 -    if ((mp = FindMap (address, size))) {
   1.410 +    if ((mp = FindMap(address, size))) {
   1.411          mp->refcount++;
   1.412          return (void *) ((unsigned long) mp->vaddr + mp->delta);
   1.413      }
   1.414  #if defined(_SC_PAGESIZE) && defined(HAS_SC_PAGESIZE)
   1.415 -    pagesize = sysconf (_SC_PAGESIZE);
   1.416 +    pagesize = sysconf(_SC_PAGESIZE);
   1.417  #endif
   1.418  #ifdef _SC_PAGE_SIZE
   1.419      if (pagesize == -1)
   1.420 -        pagesize = sysconf (_SC_PAGE_SIZE);
   1.421 +        pagesize = sysconf(_SC_PAGE_SIZE);
   1.422  #endif
   1.423  #ifdef HAS_GETPAGESIZE
   1.424      if (pagesize == -1)
   1.425 -        pagesize = getpagesize ();
   1.426 +        pagesize = getpagesize();
   1.427  #endif
   1.428  #ifdef PAGE_SIZE
   1.429      if (pagesize == -1)
   1.430 @@ -472,7 +471,7 @@
   1.431  
   1.432  #if defined(ISC) && defined(HAS_SVR3_MMAP)
   1.433      if (mapFd < 0) {
   1.434 -        if ((mapFd = open ("/dev/mmap", O_RDWR)) < 0)
   1.435 +        if ((mapFd = open("/dev/mmap", O_RDWR)) < 0)
   1.436              return NULL;
   1.437      }
   1.438      mloc.vaddr = (char *) 0;
   1.439 @@ -480,7 +479,7 @@
   1.440      mloc.length = size + delta;
   1.441      mloc.ioflg = 1;
   1.442  
   1.443 -    if ((vaddr = (void *) ioctl (mapFd, MAP, &mloc)) == (void *) -1)
   1.444 +    if ((vaddr = (void *) ioctl(mapFd, MAP, &mloc)) == (void *) -1)
   1.445          return NULL;
   1.446  #elif defined (__EMX__)
   1.447      /*
   1.448 @@ -489,8 +488,8 @@
   1.449       * of memory handles. Some umap/close mechanism should be provided
   1.450       */
   1.451  
   1.452 -    rc = DosOpen ("/dev/pmap$", &hfd, &action, 0, FILE_NORMAL, FILE_OPEN,
   1.453 -                  OPEN_ACCESS_READWRITE | OPEN_SHARE_DENYNONE, (PEAOP2) NULL);
   1.454 +    rc = DosOpen("/dev/pmap$", &hfd, &action, 0, FILE_NORMAL, FILE_OPEN,
   1.455 +                 OPEN_ACCESS_READWRITE | OPEN_SHARE_DENYNONE, (PEAOP2) NULL);
   1.456      if (rc != 0)
   1.457          return NULL;
   1.458      {
   1.459 @@ -509,9 +508,9 @@
   1.460  
   1.461          pmap.a.phys = offset;
   1.462          pmap.size = size + delta;
   1.463 -        rc = DosDevIOCtl (hfd, XFREE86_PMAP, PMAP_MAP,
   1.464 -                          (PULONG) & pmap, sizeof (pmap), &plen,
   1.465 -                          (PULONG) & dmap, sizeof (dmap), &dlen);
   1.466 +        rc = DosDevIOCtl(hfd, XFREE86_PMAP, PMAP_MAP,
   1.467 +                         (PULONG) & pmap, sizeof(pmap), &plen,
   1.468 +                         (PULONG) & dmap, sizeof(dmap), &dlen);
   1.469          if (rc == 0) {
   1.470              vaddr = dmap.a.user;
   1.471          }
   1.472 @@ -519,24 +518,24 @@
   1.473      if (rc != 0)
   1.474          return NULL;
   1.475  #elif defined (Lynx)
   1.476 -    vaddr = (void *) smem_create ("XF86DGA", (char *) offset,
   1.477 -                                  size + delta, SM_READ | SM_WRITE);
   1.478 +    vaddr = (void *) smem_create("XF86DGA", (char *) offset,
   1.479 +                                 size + delta, SM_READ | SM_WRITE);
   1.480  #else
   1.481  #ifndef MAP_FILE
   1.482  #define MAP_FILE 0
   1.483  #endif
   1.484      if (mapFd < 0) {
   1.485 -        if ((mapFd = open (DEV_MEM, O_RDWR)) < 0)
   1.486 +        if ((mapFd = open(DEV_MEM, O_RDWR)) < 0)
   1.487              return NULL;
   1.488      }
   1.489 -    vaddr = (void *) mmap (NULL, size + delta, PROT_READ | PROT_WRITE,
   1.490 -                           MAP_FILE | MAP_SHARED, mapFd, (off_t) offset);
   1.491 +    vaddr = (void *) mmap(NULL, size + delta, PROT_READ | PROT_WRITE,
   1.492 +                          MAP_FILE | MAP_SHARED, mapFd, (off_t) offset);
   1.493      if (vaddr == (void *) -1)
   1.494          return NULL;
   1.495  #endif
   1.496  
   1.497      if (!vaddr) {
   1.498 -        if (!(mp = AddMap ()))
   1.499 +        if (!(mp = AddMap()))
   1.500              return NULL;
   1.501          mp->physaddr = address;
   1.502          mp->size = size;
   1.503 @@ -554,125 +553,124 @@
   1.504   * should restore text mode.
   1.505   */
   1.506  
   1.507 -int SDL_NAME (XF86DGAForkApp) (int screen)
   1.508 +int SDL_NAME(XF86DGAForkApp) (int screen)
   1.509  {
   1.510      pid_t pid;
   1.511      int status;
   1.512      int i;
   1.513  
   1.514      /* fork the app, parent hangs around to clean up */
   1.515 -    if ((pid = fork ()) > 0) {
   1.516 +    if ((pid = fork()) > 0) {
   1.517          ScrPtr sp;
   1.518  
   1.519 -        waitpid (pid, &status, 0);
   1.520 +        waitpid(pid, &status, 0);
   1.521          for (i = 0; i < numScrs; i++) {
   1.522              sp = scrList[i];
   1.523 -            SDL_NAME (XF86DGADirectVideoLL) (sp->display, sp->screen, 0);
   1.524 -            XSync (sp->display, False);
   1.525 +            SDL_NAME(XF86DGADirectVideoLL) (sp->display, sp->screen, 0);
   1.526 +            XSync(sp->display, False);
   1.527          }
   1.528 -        if (WIFEXITED (status))
   1.529 -            _exit (0);
   1.530 +        if (WIFEXITED(status))
   1.531 +            _exit(0);
   1.532          else
   1.533 -            _exit (-1);
   1.534 +            _exit(-1);
   1.535      }
   1.536      return pid;
   1.537  }
   1.538  
   1.539  
   1.540 -Bool SDL_NAME (XF86DGADirectVideo) (Display * dis, int screen, int enable)
   1.541 +Bool SDL_NAME(XF86DGADirectVideo) (Display * dis, int screen, int enable)
   1.542  {
   1.543      ScrPtr sp;
   1.544      MapPtr mp = NULL;
   1.545  
   1.546 -    if ((sp = FindScr (dis, screen)))
   1.547 +    if ((sp = FindScr(dis, screen)))
   1.548          mp = sp->map;
   1.549  
   1.550      if (enable & XF86DGADirectGraphics) {
   1.551  #if !defined(ISC) && !defined(HAS_SVR3_MMAP) && !defined(Lynx) \
   1.552  	&& !defined(__EMX__)
   1.553          if (mp && mp->vaddr)
   1.554 -            mprotect (mp->vaddr, mp->size + mp->delta,
   1.555 -                      PROT_READ | PROT_WRITE);
   1.556 +            mprotect(mp->vaddr, mp->size + mp->delta, PROT_READ | PROT_WRITE);
   1.557  #endif
   1.558      } else {
   1.559  #if !defined(ISC) && !defined(HAS_SVR3_MMAP) && !defined(Lynx) \
   1.560  	&& !defined(__EMX__)
   1.561          if (mp && mp->vaddr)
   1.562 -            mprotect (mp->vaddr, mp->size + mp->delta, PROT_READ);
   1.563 +            mprotect(mp->vaddr, mp->size + mp->delta, PROT_READ);
   1.564  #elif defined(Lynx)
   1.565          /* XXX this doesn't allow enable after disable */
   1.566 -        smem_create (NULL, mp->vaddr, mp->size + mp->delta, SM_DETACH);
   1.567 -        smem_remove ("XF86DGA");
   1.568 +        smem_create(NULL, mp->vaddr, mp->size + mp->delta, SM_DETACH);
   1.569 +        smem_remove("XF86DGA");
   1.570  #endif
   1.571      }
   1.572  
   1.573 -    SDL_NAME (XF86DGADirectVideoLL) (dis, screen, enable);
   1.574 +    SDL_NAME(XF86DGADirectVideoLL) (dis, screen, enable);
   1.575      return 1;
   1.576  }
   1.577  
   1.578  
   1.579  static void
   1.580 -XF86cleanup (int sig)
   1.581 +XF86cleanup(int sig)
   1.582  {
   1.583      ScrPtr sp;
   1.584      int i;
   1.585      static char beenhere = 0;
   1.586  
   1.587      if (beenhere)
   1.588 -        _exit (3);
   1.589 +        _exit(3);
   1.590      beenhere = 1;
   1.591  
   1.592      for (i = 0; i < numScrs; i++) {
   1.593          sp = scrList[i];
   1.594 -        SDL_NAME (XF86DGADirectVideo) (sp->display, sp->screen, 0);
   1.595 -        XSync (sp->display, False);
   1.596 +        SDL_NAME(XF86DGADirectVideo) (sp->display, sp->screen, 0);
   1.597 +        XSync(sp->display, False);
   1.598      }
   1.599 -    _exit (3);
   1.600 +    _exit(3);
   1.601  }
   1.602  
   1.603  Bool
   1.604 -SDL_NAME (XF86DGAGetVideo) (Display * dis,
   1.605 -                            int screen,
   1.606 -                            char **addr, int *width, int *bank, int *ram)
   1.607 +SDL_NAME(XF86DGAGetVideo) (Display * dis,
   1.608 +                           int screen,
   1.609 +                           char **addr, int *width, int *bank, int *ram)
   1.610  {
   1.611      /*unsigned long */ int offset;
   1.612      static int beenHere = 0;
   1.613      ScrPtr sp;
   1.614      MapPtr mp;
   1.615  
   1.616 -    if (!(sp = FindScr (dis, screen))) {
   1.617 -        if (!(sp = AddScr ())) {
   1.618 -            fprintf (stderr, "XF86DGAGetVideo: malloc failure\n");
   1.619 -            exit (-2);
   1.620 +    if (!(sp = FindScr(dis, screen))) {
   1.621 +        if (!(sp = AddScr())) {
   1.622 +            fprintf(stderr, "XF86DGAGetVideo: malloc failure\n");
   1.623 +            exit(-2);
   1.624          }
   1.625          sp->display = dis;
   1.626          sp->screen = screen;
   1.627          sp->map = NULL;
   1.628      }
   1.629  
   1.630 -    SDL_NAME (XF86DGAGetVideoLL) (dis, screen, &offset, width, bank, ram);
   1.631 +    SDL_NAME(XF86DGAGetVideoLL) (dis, screen, &offset, width, bank, ram);
   1.632  
   1.633 -    *addr = MapPhysAddress (offset, *bank);
   1.634 +    *addr = MapPhysAddress(offset, *bank);
   1.635      if (*addr == NULL) {
   1.636 -        fprintf (stderr,
   1.637 -                 "XF86DGAGetVideo: failed to map video memory (%s)\n",
   1.638 -                 strerror (errno));
   1.639 -        exit (-2);
   1.640 +        fprintf(stderr,
   1.641 +                "XF86DGAGetVideo: failed to map video memory (%s)\n",
   1.642 +                strerror(errno));
   1.643 +        exit(-2);
   1.644      }
   1.645  
   1.646 -    if ((mp = FindMap (offset, *bank)))
   1.647 +    if ((mp = FindMap(offset, *bank)))
   1.648          sp->map = mp;
   1.649  
   1.650      if (!beenHere) {
   1.651          beenHere = 1;
   1.652 -        atexit ((void (*)(void)) XF86cleanup);
   1.653 +        atexit((void (*)(void)) XF86cleanup);
   1.654          /* one shot XF86cleanup attempts */
   1.655 -        signal (SIGSEGV, XF86cleanup);
   1.656 +        signal(SIGSEGV, XF86cleanup);
   1.657  #ifdef SIGBUS
   1.658 -        signal (SIGBUS, XF86cleanup);
   1.659 +        signal(SIGBUS, XF86cleanup);
   1.660  #endif
   1.661 -        signal (SIGHUP, XF86cleanup);
   1.662 -        signal (SIGFPE, XF86cleanup);
   1.663 +        signal(SIGHUP, XF86cleanup);
   1.664 +        signal(SIGFPE, XF86cleanup);
   1.665      }
   1.666  
   1.667      return 1;