Ignore:
Timestamp:
Sep 5, 2001, 4:31:14 PM (24 years ago)
Author:
bird
Message:

Added $Id:$ keyword.

Location:
trunk/src/opengl/glide/sst1/init
Files:
18 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/opengl/glide/sst1/init/h3drvr.c

    r2885 r6653  
     1/* $Id: h3drvr.c,v 1.2 2001-09-05 14:31:00 bird Exp $ */
    12/*
    23** THIS SOFTWARE IS SUBJECT TO COPYRIGHT PROTECTION AND IS OFFERED ONLY
    34** PURSUANT TO THE 3DFX GLIDE GENERAL PUBLIC LICENSE. THERE IS NO RIGHT
    45** TO USE THE GLIDE TRADEMARK WITHOUT PRIOR WRITTEN PERMISSION OF 3DFX
    5 ** INTERACTIVE, INC. A COPY OF THIS LICENSE MAY BE OBTAINED FROM THE 
    6 ** DISTRIBUTOR OR BY CONTACTING 3DFX INTERACTIVE INC(info@3dfx.com). 
    7 ** THIS PROGRAM IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER 
     6** INTERACTIVE, INC. A COPY OF THIS LICENSE MAY BE OBTAINED FROM THE
     7** DISTRIBUTOR OR BY CONTACTING 3DFX INTERACTIVE INC(info@3dfx.com).
     8** THIS PROGRAM IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER
    89** EXPRESSED OR IMPLIED. SEE THE 3DFX GLIDE GENERAL PUBLIC LICENSE FOR A
    9 ** FULL TEXT OF THE NON-WARRANTY PROVISIONS. 
    10 ** 
     10** FULL TEXT OF THE NON-WARRANTY PROVISIONS.
     11**
    1112** USE, DUPLICATION OR DISCLOSURE BY THE GOVERNMENT IS SUBJECT TO
    1213** RESTRICTIONS AS SET FORTH IN SUBDIVISION (C)(1)(II) OF THE RIGHTS IN
     
    1415** AND/OR IN SIMILAR OR SUCCESSOR CLAUSES IN THE FAR, DOD OR NASA FAR
    1516** SUPPLEMENT. UNPUBLISHED RIGHTS RESERVED UNDER THE COPYRIGHT LAWS OF
    16 ** THE UNITED STATES. 
    17 ** 
     17** THE UNITED STATES.
     18**
    1819** COPYRIGHT 3DFX INTERACTIVE, INC. 1999, ALL RIGHTS RESERVED
    1920**
    2021**
    21 ** $Revision: 1.1 $
    22 ** $Date: 2000-02-25 00:31:26 $
     22** $Revision: 1.2 $
     23** $Date: 2001-09-05 14:31:00 $
    2324**
    2425*/
     
    5657static InitSwapType_t FX_CALL swapBuffers( FxU32 code ) {
    5758  return 0;
    58 } 
     59}
    5960
    6061static FxU32 FX_CALL status( void ) {
    6162  return 0;
    62 } 
     63}
    6364
    6465static FxBool FX_CALL busy(void) {
    6566  return 0;
    66 } 
     67}
    6768
    6869static void FX_CALL idle( void ) {
  • trunk/src/opengl/glide/sst1/init/init.c

    r2885 r6653  
     1/* $Id: init.c,v 1.2 2001-09-05 14:31:00 bird Exp $ */
    12/*
    23** THIS SOFTWARE IS SUBJECT TO COPYRIGHT PROTECTION AND IS OFFERED ONLY
    34** PURSUANT TO THE 3DFX GLIDE GENERAL PUBLIC LICENSE. THERE IS NO RIGHT
    45** TO USE THE GLIDE TRADEMARK WITHOUT PRIOR WRITTEN PERMISSION OF 3DFX
    5 ** INTERACTIVE, INC. A COPY OF THIS LICENSE MAY BE OBTAINED FROM THE 
    6 ** DISTRIBUTOR OR BY CONTACTING 3DFX INTERACTIVE INC(info@3dfx.com). 
    7 ** THIS PROGRAM IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER 
     6** INTERACTIVE, INC. A COPY OF THIS LICENSE MAY BE OBTAINED FROM THE
     7** DISTRIBUTOR OR BY CONTACTING 3DFX INTERACTIVE INC(info@3dfx.com).
     8** THIS PROGRAM IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER
    89** EXPRESSED OR IMPLIED. SEE THE 3DFX GLIDE GENERAL PUBLIC LICENSE FOR A
    9 ** FULL TEXT OF THE NON-WARRANTY PROVISIONS. 
    10 ** 
     10** FULL TEXT OF THE NON-WARRANTY PROVISIONS.
     11**
    1112** USE, DUPLICATION OR DISCLOSURE BY THE GOVERNMENT IS SUBJECT TO
    1213** RESTRICTIONS AS SET FORTH IN SUBDIVISION (C)(1)(II) OF THE RIGHTS IN
     
    1415** AND/OR IN SIMILAR OR SUCCESSOR CLAUSES IN THE FAR, DOD OR NASA FAR
    1516** SUPPLEMENT. UNPUBLISHED RIGHTS RESERVED UNDER THE COPYRIGHT LAWS OF
    16 ** THE UNITED STATES. 
    17 ** 
     17** THE UNITED STATES.
     18**
    1819** COPYRIGHT 3DFX INTERACTIVE, INC. 1999, ALL RIGHTS RESERVED
    1920**
    2021**
    21 ** $Revision: 1.1 $
    22 ** $Date: 2000-02-25 00:31:26 $
     22** $Revision: 1.2 $
     23** $Date: 2001-09-05 14:31:00 $
    2324**
    2425*/
     
    99100  if ( !libInitialized ) {
    100101
    101     /* When initializing the Library snoop out all 3Dfx devices 
     102    /* When initializing the Library snoop out all 3Dfx devices
    102103       and fill a static data structure with pertinant data.  */
    103104
     
    128129              hwInfo[numDevicesInSystem-1].hwDep.vgInfo.slaveBaseAddr =
    129130                (FxU32)sst1InitMapBoard( numSst1s );
    130               hwInfo[numDevicesInSystem-1].regs.hwDep.VGRegDesc.slavePtr = 
     131              hwInfo[numDevicesInSystem-1].regs.hwDep.VGRegDesc.slavePtr =
    131132                (FxU32*)hwInfo[numDevicesInSystem-1].hwDep.vgInfo.slaveBaseAddr;
    132133              numSst1s++;
     
    177178            _outp(0x3d4, 0x3f);
    178179            regVal = _inp(0x3d5);
    179            
     180
    180181            if (!(regVal & (1 << 2))) /* we're not there */
    181182              continue;
     
    196197#endif
    197198
    198           hwInfo[numDevicesInSystem].hwDep.vg96Info.vgaBaseAddr = 
     199          hwInfo[numDevicesInSystem].hwDep.vg96Info.vgaBaseAddr =
    199200            (FxU32)hwInfo[numDevicesInSystem].regs.hwDep.VG96RegDesc.partnerRegPtr;
    200           hwInfo[numDevicesInSystem].hwDep.vg96Info.vg96BaseAddr = 
     201          hwInfo[numDevicesInSystem].hwDep.vg96Info.vg96BaseAddr =
    201202            (FxU32)hwInfo[numDevicesInSystem].regs.hwDep.VG96RegDesc.baseAddress;
    202          
     203
    203204          numDevicesInSystem++;
    204         } 
     205        }
    205206#else
    206207#  error "Do hardware enumeration for this chip!"
     
    208209      }
    209210    }
    210    
     211
    211212
    212213    /* Sanity Check for SLI detection */
     
    228229    libInitialized = FXTRUE;
    229230  }
    230  
     231
    231232  if ( cb ) {
    232233    for( device = 0; device < numDevicesInSystem; device++ ) {
    233234      cb( &hwInfo[device] );
    234     } 
     235    }
    235236  }
    236237  return;
     
    242243   volatile FxU32* retVal = NULL;
    243244   FxBool okP = (boardNum < INIT_MAX_DEVICES);
    244    
     245
    245246   if (okP) {
    246247      InitDeviceInfo* infoP = (hwInfo + boardNum);
    247248      const FxU32 vId = infoP->vendorID;
    248249      const FxU32 dId = infoP->deviceID;
    249      
     250
    250251#if defined(SST1)
    251252      okP = ((vId == TDFXVID) &&
     
    294295        pciClose();
    295296        libInitialized = FXFALSE;
    296     } 
     297    }
    297298} /* initClose */
    298299
     
    334335  Implementor(s): jdt
    335336  Library: init
    336   Description: 
    337   Selects a 3Dfx device ( potentially from among many in the system ) and 
     337  Description:
     338  Selects a 3Dfx device ( potentially from among many in the system ) and
    338339  initializes the internal init driver functions with behavior appropriate
    339340  to the type of the selected device.
     
    346347
    347348FxBool
    348 initDeviceSelect( FxU32 devNumber ) 
     349initDeviceSelect( FxU32 devNumber )
    349350{
    350351  FxBool rv = FXFALSE;
    351  
     352
    352353  if ( devNumber < numDevicesInSystem ) {
    353354    context = &contexts[hwInfo[devNumber].hwClass];
    354355    context->info = hwInfo[devNumber];
    355356    rv =  FXTRUE;
    356   } 
    357  
     357  }
     358
    358359  return rv;
    359360
     
    390391        prior to rendering.
    391392  Arguments:
    392   hwnd - pointer to a window handle or null.  If NULL, then 
     393  hwnd - pointer to a window handle or null.  If NULL, then
    393394         the application window handle will be inferred though
    394395         the GetActiveWindow() api.
     
    431432    FxBool rv;
    432433    if ( context ) {
    433         rv = context->setVideo( hWnd, sRes, vRefresh, cFormat, 
     434        rv = context->setVideo( hWnd, sRes, vRefresh, cFormat,
    434435                                yOrigin, nColBuffers, nAuxBuffers,
    435436                                xres, yres, fbStride, vidTimings);
     
    454455  -------------------------------------------------------------------*/
    455456void initRestoreVideo( void ) {
    456     if ( context ) 
     457    if ( context )
    457458        context->restoreVideo();
    458459} /* initRestoreVideo */
     
    464465  Library: init
    465466  Description:
    466   Enable the command transport mechanism for the underlying 
     467  Enable the command transport mechanism for the underlying
    467468  hardware and return information about accessing the transport
    468469  to the caller
     
    496497  -------------------------------------------------------------------*/
    497498void initDisableTransport( void ) {
    498     if ( context ) 
     499    if ( context )
    499500        context->disableTransport();
    500501} /* initDisableTransport */
     
    506507  Library: init
    507508  Description:
    508   Initiate a buffer swap. 
    509   Arguments: 
     509  Initiate a buffer swap.
     510  Arguments:
    510511  code - code describing type of swap, wether to sync to vretrace, how
    511512         many vretraces to wait, etc.
     
    567568  Library: init
    568569  Description:
    569   Returns only when graphics pipeline is completely idle. 
     570  Returns only when graphics pipeline is completely idle.
    570571  May hang software if hardware is permanently busy.
    571572  Arguments:
     
    587588  Get the current pointer to a particular buffer
    588589  Arguments:
    589   buffer - which buffer to get pointer to 
     590  buffer - which buffer to get pointer to
    590591  Return:
    591592  integer pointer
     
    602603  Date: 2/25
    603604  Implementor(s): jdt
    604   Library: init 
     605  Library: init
    605606  Description:
    606607  Sets the current render buffer
     
    638639  Library: init
    639640  Description:
    640   CYA function so that emergency functionality may be added w/o 
     641  CYA function so that emergency functionality may be added w/o
    641642  corrupting dll interface
    642643  Arguments:
     
    658659  Description:
    659660        This will re-attach new buffers for the rendering context, used
    660         typically only in a windowing system where buffers need to move 
     661        typically only in a windowing system where buffers need to move
    661662        and resize. Also, implicitly detach old associated buffers.
    662663  Arguments:
  • trunk/src/opengl/glide/sst1/init/init96/dxdrvr.c

    r2885 r6653  
     1/* $Id: dxdrvr.c,v 1.2 2001-09-05 14:31:01 bird Exp $ */
    12/*
    23** THIS SOFTWARE IS SUBJECT TO COPYRIGHT PROTECTION AND IS OFFERED ONLY
    34** PURSUANT TO THE 3DFX GLIDE GENERAL PUBLIC LICENSE. THERE IS NO RIGHT
    45** TO USE THE GLIDE TRADEMARK WITHOUT PRIOR WRITTEN PERMISSION OF 3DFX
    5 ** INTERACTIVE, INC. A COPY OF THIS LICENSE MAY BE OBTAINED FROM THE 
    6 ** DISTRIBUTOR OR BY CONTACTING 3DFX INTERACTIVE INC(info@3dfx.com). 
    7 ** THIS PROGRAM IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER 
     6** INTERACTIVE, INC. A COPY OF THIS LICENSE MAY BE OBTAINED FROM THE
     7** DISTRIBUTOR OR BY CONTACTING 3DFX INTERACTIVE INC(info@3dfx.com).
     8** THIS PROGRAM IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER
    89** EXPRESSED OR IMPLIED. SEE THE 3DFX GLIDE GENERAL PUBLIC LICENSE FOR A
    9 ** FULL TEXT OF THE NON-WARRANTY PROVISIONS. 
    10 ** 
     10** FULL TEXT OF THE NON-WARRANTY PROVISIONS.
     11**
    1112** USE, DUPLICATION OR DISCLOSURE BY THE GOVERNMENT IS SUBJECT TO
    1213** RESTRICTIONS AS SET FORTH IN SUBDIVISION (C)(1)(II) OF THE RIGHTS IN
     
    1415** AND/OR IN SIMILAR OR SUCCESSOR CLAUSES IN THE FAR, DOD OR NASA FAR
    1516** SUPPLEMENT. UNPUBLISHED RIGHTS RESERVED UNDER THE COPYRIGHT LAWS OF
    16 ** THE UNITED STATES. 
    17 ** 
     17** THE UNITED STATES.
     18**
    1819** COPYRIGHT 3DFX INTERACTIVE, INC. 1999, ALL RIGHTS RESERVED
    1920**
    2021** $Log: dxdrvr.c,v $
    21 ** Revision 1.1  2000-02-25 00:31:28  sandervl
     22** Revision 1.2  2001-09-05 14:31:01  bird
     23** Added $Id:$ keyword.
     24**
     25** Revision 1.1  2000/02/25 00:31:28  sandervl
    2226** Created new Voodoo 1 Glide dir
    2327**
    24  * 
     28 *
    2529 * 34    1/12/98 10:22p Dow
    2630 * H3D Stereo Support
    27  * 
     31 *
    2832 * 33    11/06/97 9:51a Jdt
    2933 * Fixes window resize events to not crash/hang
    30  * 
     34 *
    3135 * 32    10/01/97 3:21p Atai
    3236 * fix 819, DOS tests flicker on glide
    33  * 
     37 *
    3438 * 31    9/08/97 12:05p Atai
    3539 * fixed resize problem in dxControl()
    36  * 
     40 *
    3741 * 30    8/28/97 10:24a Odo
    3842 * moved debugging varaible
    39  * 
     43 *
    4044 * 29    8/27/97 10:32a Dow
    4145 * added more debugging info
    42  * 
     46 *
    4347 * 28    8/21/97 4:24p Dow
    4448 * Fixed @#$%! C++ Comments, Added Debugging info
    4549**
    46 ** $Revision: 1.1 $
    47 ** $Date: 2000-02-25 00:31:28 $
     50** $Revision: 1.2 $
     51** $Date: 2001-09-05 14:31:01 $
    4852**
    4953*/
     
    8791
    8892#if defined( __WIN32__) && defined(INIT_ACCESS_DDRAW)
    89 #define WIN32_LEAN_AND_MEAN 
    90 #include <windows.h> 
    91 #include <ddraw.h> 
     93#define WIN32_LEAN_AND_MEAN
     94#include <windows.h>
     95#include <ddraw.h>
    9296
    9397#define NUM_BUFS 6
     
    9599static HWND                 hWndApp     = 0;
    96100static FxU32                FifoOffset  = 0;
    97 static FxU32                Width       = 0; 
     101static FxU32                Width       = 0;
    98102static FxU32                Height      = 0;
    99103static FxBool               IsFullScreen = 0;
     
    133137{
    134138  DDSURFACEDESC   ddsd;
    135  
     139
    136140  ddsd.dwSize = sizeof(ddsd);
    137   if (IDirectDrawSurface2_Lock(lpSurf, NULL, &ddsd, DDLOCK_WAIT, NULL) 
     141  if (IDirectDrawSurface2_Lock(lpSurf, NULL, &ddsd, DDLOCK_WAIT, NULL)
    138142      !=DD_OK) {
    139143    return ErrorMessage(hWndApp, "_dxSurfaceToBufDesc: DdrawSurface Lock failed\n");
    140144  }
    141  
     145
    142146  /* pDesc->bufType should be filled in by caller */
    143147  pDesc->bufOffset = (FxU32) (ddsd.lpSurface);        /* virtual address. */
    144148  pDesc->bufStride = (FxI32) (ddsd.lPitch);           /* in bytes         */
    145149  pDesc->bufBPP    = (FxI32) 16;
    146  
     150
    147151  IDirectDrawSurface2_Unlock(lpSurf, NULL);
    148152  return FXTRUE;
     
    163167  InitBufDesc_t   *dScreen = &pDesc[4];
    164168  InitBufDesc_t   *dTriple = &pDesc[5];
    165  
     169
    166170  GDBG_INFO((80, "_dxDDrawToGlide entry\n"));
    167  
     171
    168172  /* Initialize all descriptors. */
    169173  dScreen->bufMagic  = VG96_BUF_MAGIC;
     
    172176  dScreen->bufStride = 0;
    173177  dScreen->bufBPP    = 0;
    174  
     178
    175179  /* Get info about screen (primary display) */
    176180  dScreen->bufType  = INIT_BUFFER_SCREENBUFFER;
    177181  if (!_dxSurfaceToBufDesc( lpFront, dScreen))
    178182    return ErrorMessage(hWndApp, "Couldn't get Screen Info");
    179  
     183
    180184  *dFront = *dBack = *dAux = *dFifo =
    181185  *dTriple =
    182186  *dScreen;
    183  
     187
    184188  dFront->bufType   = INIT_BUFFER_FRONTBUFFER;
    185189
     
    188192  if (!_dxSurfaceToBufDesc( lpBack, dBack))
    189193    return ErrorMessage(hWndApp, "Couldn't get Backbuffer Info");
    190  
     194
    191195  /* Get info about aux buffer */
    192196  dAux->bufType = INIT_BUFFER_AUXBUFFER;
    193   if (!_dxSurfaceToBufDesc( lpAux, dAux)) 
     197  if (!_dxSurfaceToBufDesc( lpAux, dAux))
    194198    return ErrorMessage(hWndApp, "Couldn't get AuxBuffer Info");
    195  
     199
    196200  /* Get info about triple buffer */
    197201  if (tripleBuffering) {
     
    205209  dFifo->bufOffset = FifoOffset;
    206210  dFifo->bufStride = 65536 << 1; /* Fixme!!! what's this? */
    207  
     211
    208212  /* Now convert buf addresses for draw buffers into video memory offsets */
    209213  dFront->bufOffset -= dScreen->bufOffset;
     
    212216  if (tripleBuffering)
    213217    dTriple->bufOffset -= dScreen->bufOffset;
    214  
     218
    215219  GDBG_INFO((80, "_dxDDrawToGlideDesc: dFront->bufOffset = 0x%x\n", dFront->bufOffset));
    216220  GDBG_INFO((80, "_dxDDrawToGlideDesc: dBack->bufOffset = 0x%x\n", dBack->bufOffset));
     
    243247{
    244248  DDSURFACEDESC   ddsd;
    245  
     249
    246250#ifdef H3D
    247   GDBG_INFO((80, "_dxAS: hWnd = %x, fs=%d, xRes=%d, yRes=%d, vRefresh=%d, pageFlip=%d\n", 
     251  GDBG_INFO((80, "_dxAS: hWnd = %x, fs=%d, xRes=%d, yRes=%d, vRefresh=%d, pageFlip=%d\n",
    248252             hWndApp, IsFullScreen, xRes, yRes, vRefresh, pageFlip));
    249253#else
    250   GDBG_INFO((80, "_dxAS: hWnd = %x, fs=%d, xRes=%d, yRes=%d, vRefresh=%d\n", 
     254  GDBG_INFO((80, "_dxAS: hWnd = %x, fs=%d, xRes=%d, yRes=%d, vRefresh=%d\n",
    251255             hWndApp, IsFullScreen, xRes, yRes, vRefresh));
    252256#endif
    253  
     257
    254258  if (lpDD1 == NULL) {
    255259    if (DirectDrawCreate( NULL, &lpDD1, NULL ) != DD_OK) {
     
    262266  }
    263267
    264   if (IDirectDraw_QueryInterface( lpDD1, &IID_IDirectDraw2, 
     268  if (IDirectDraw_QueryInterface( lpDD1, &IID_IDirectDraw2,
    265269                                   (LPVOID*)&lpDD) !=DD_OK) {
    266270
     
    272276    GDBG_INFO((80, "_dxAS: DDraw2 Obj created!\n"));
    273277  }
    274  
     278
    275279  /*
    276280   * Make sure this is done after creating direct draw object!!!
     
    281285    FifoOffset = init96GetFBVram() - 65536*3; /* fixme!!! why 3? */
    282286  }
    283  
     287
    284288  /*
    285289   * If there are any previously allocated surfaces, free them now
     
    291295  if( lpTriple ) IDirectDrawSurface2_Release( lpTriple    );
    292296  if( lpFront  ) IDirectDrawSurface2_Release( lpFront  );
    293  
     297
    294298  lpClipper = NULL;
    295299  lpFront   = NULL;
     
    297301  lpTriple    = NULL;
    298302  lpAux     = NULL;
    299  
     303
    300304  if ( !IsFullScreen ) {        /* In a window */
    301305
     
    307311      return ErrorMessage(hWndApp,  "Couldn't get display mode!");
    308312
    309     if (ddsd.ddpfPixelFormat.dwRGBBitCount / 8 != 2) 
     313    if (ddsd.ddpfPixelFormat.dwRGBBitCount / 8 != 2)
    310314      return ErrorMessage(hWndApp,  "Display is not in 16bpp format!");
    311315
     
    317321    ddsd.dwFlags        = DDSD_CAPS;
    318322    ddsd.ddsCaps.dwCaps = DDSCAPS_PRIMARYSURFACE | DDSCAPS_3DDEVICE;
    319        
    320     if (IDirectDraw2_CreateSurface( lpDD, &ddsd, &lpFront, 0 ) != DD_OK) 
     323
     324    if (IDirectDraw2_CreateSurface( lpDD, &ddsd, &lpFront, 0 ) != DD_OK)
    321325      return ErrorMessage(hWndApp, "Couldn't allocate primary surface!");
    322326
     
    324328               xRes, yRes, ddsd.lPitch));
    325329    /* From jdt */
    326     if (IDirectDraw2_CreateClipper( lpDD, 0, &lpClipper, 0 ) != DD_OK) 
     330    if (IDirectDraw2_CreateClipper( lpDD, 0, &lpClipper, 0 ) != DD_OK)
    327331      return ErrorMessage(hWndApp, "Create Clipper failed!\n");
    328332
    329     if (IDirectDrawClipper_SetHWnd( lpClipper, 0, hWndApp ) != DD_OK) 
     333    if (IDirectDrawClipper_SetHWnd( lpClipper, 0, hWndApp ) != DD_OK)
    330334      return ErrorMessage(hWndApp, "Clipper SethWnd failed!\n");
    331335
    332     if (IDirectDrawSurface2_SetClipper( lpFront, lpClipper ) != DD_OK) 
     336    if (IDirectDrawSurface2_SetClipper( lpFront, lpClipper ) != DD_OK)
    333337      return ErrorMessage(hWndApp, "Set Clipper failed!\n");
    334338
     
    341345    ddsd.ddsCaps.dwCaps =
    342346      DDSCAPS_OFFSCREENPLAIN | DDSCAPS_VIDEOMEMORY | DDSCAPS_3DDEVICE;
    343        
    344     if (IDirectDraw2_CreateSurface( lpDD, &ddsd, &lpBack, 0 ) != DD_OK) 
     347
     348    if (IDirectDraw2_CreateSurface( lpDD, &ddsd, &lpBack, 0 ) != DD_OK)
    345349      return ErrorMessage(hWndApp,  "Couldn't allocate secondary surface!" );
    346350
    347351    GDBG_INFO((80, "_dxAS: Back buffer allocated!\n"));
    348352
    349     /* 
    350      * Always allocate Aux Buffer Surface 
     353    /*
     354     * Always allocate Aux Buffer Surface
    351355     * XXX - (use nAuxBuffers, and deal with 8bpp for alpha)
    352356     */
     
    357361    ddsd.ddsCaps.dwCaps = DDSCAPS_OFFSCREENPLAIN | DDSCAPS_VIDEOMEMORY
    358362        | DDSCAPS_3DDEVICE;
    359        
    360     if (IDirectDraw2_CreateSurface( lpDD, &ddsd, &lpAux, 0 ) != DD_OK) 
     363
     364    if (IDirectDraw2_CreateSurface( lpDD, &ddsd, &lpAux, 0 ) != DD_OK)
    361365      return ErrorMessage(hWndApp,  "Couldn't allocate aux surface" );
    362366
     
    364368
    365369  } else {
    366    
     370
    367371    /* Full screen - Set Exclusive Mode, change resolution,  */
    368372    GDBG_INFO((80, "_dxAS: Setting Full screen exclusive mode!\n"));
    369    
    370     if (IDirectDraw2_SetCooperativeLevel(lpDD, hWndApp, 
     373
     374    if (IDirectDraw2_SetCooperativeLevel(lpDD, hWndApp,
    371375                                         DDSCL_EXCLUSIVE | DDSCL_FULLSCREEN ) != DD_OK)
    372376      return ErrorMessage(hWndApp, "Couldn't set cooperative level!");
    373    
     377
    374378    if (IDirectDraw2_SetDisplayMode( lpDD, xRes, yRes, 16, 0,0) != DD_OK)
    375379      return ErrorMessage(hWndApp,  "Couldn't set display mode!");
    376    
     380
    377381    /* Allocate Front/Back Buffer Surfaces, skip triple buffer XXX */
    378382    ddsd.dwSize            = sizeof( ddsd );
    379383    ddsd.dwFlags           = DDSD_CAPS | DDSD_BACKBUFFERCOUNT;
    380384    ddsd.dwBackBufferCount = 1;
    381     ddsd.ddsCaps.dwCaps    = DDSCAPS_PRIMARYSURFACE | 
    382       DDSCAPS_FLIP | 
     385    ddsd.ddsCaps.dwCaps    = DDSCAPS_PRIMARYSURFACE |
     386      DDSCAPS_FLIP |
    383387        DDSCAPS_COMPLEX |
    384388          DDSCAPS_VIDEOMEMORY | DDSCAPS_3DDEVICE;
    385    
    386     if (IDirectDraw2_CreateSurface( lpDD, &ddsd, &lpFront, 0 ) != DD_OK) 
     389
     390    if (IDirectDraw2_CreateSurface( lpDD, &ddsd, &lpFront, 0 ) != DD_OK)
    387391      return ErrorMessage(hWndApp, "Couldn't allocate primary surface!");
    388    
     392
    389393    /* Get back buffer information */
    390394    ddsd.ddsCaps.dwCaps = DDSCAPS_BACKBUFFER;
    391     if (IDirectDrawSurface2_GetAttachedSurface( lpFront, &ddsd.ddsCaps, 
     395    if (IDirectDrawSurface2_GetAttachedSurface( lpFront, &ddsd.ddsCaps,
    392396                                               &lpBack) != DD_OK)
    393397      return ErrorMessage(hWndApp, "Couldn't get back buffer info!\n");
    394    
     398
    395399    GDBG_INFO((80, "_dxAS: Full Screen: front/back buffer allocated!\n"));
    396    
     400
    397401    /* Allocate Aux Buffer Surface - XXX */
    398402    ddsd.dwSize         = sizeof( ddsd );
     
    400404    ddsd.dwWidth        = xRes;
    401405    ddsd.dwHeight       = yRes;
    402     ddsd.ddsCaps.dwCaps = 
     406    ddsd.ddsCaps.dwCaps =
    403407      DDSCAPS_OFFSCREENPLAIN | DDSCAPS_VIDEOMEMORY | DDSCAPS_3DDEVICE;
    404    
    405     if (IDirectDraw2_CreateSurface( lpDD, &ddsd, &lpAux, 0 ) != DD_OK) 
     408
     409    if (IDirectDraw2_CreateSurface( lpDD, &ddsd, &lpAux, 0 ) != DD_OK)
    406410      return ErrorMessage(hWndApp,  "Couldn't allocate aux surface" );
    407411
    408412    GDBG_INFO((80, "_dxAS: Full Screen: aux buffer allocated!\n"));
    409    
     413
    410414/*
    411415 * Triple buffer hack: full-screen only for now.  Allocate as Aux DD surf,
     
    414418 */
    415419    if (tripleBuffering) {
    416       if (IDirectDraw2_CreateSurface( lpDD, &ddsd, &lpTriple, 0 ) != DD_OK) 
     420      if (IDirectDraw2_CreateSurface( lpDD, &ddsd, &lpTriple, 0 ) != DD_OK)
    417421        return ErrorMessage(hWndApp,  "Couldn't allocate triple buffer" );
    418422
     
    420424    }
    421425  }
    422  
     426
    423427  /* Convert direct draw surfaces to Glide's idea of buffer descriptors */
    424428  return _dxDDrawToGlideDesc(pDesc);
     
    432436  const char      *errorMessage = "no error";
    433437
    434   /* for now this is a goddamn baseball bat 
     438  /* for now this is a goddamn baseball bat
    435439     it can be trimmed down */
    436440  if ( !IsFullScreen ) { /* this *REALLY* should be called for fullscreen */
     
    440444    if( lpTriple ) IDirectDrawSurface2_Release( lpTriple    );
    441445    if( lpFront  ) IDirectDrawSurface2_Release( lpFront  );
    442    
     446
    443447    lpClipper = NULL;
    444448    lpFront   = NULL;
     
    446450    lpTriple  = NULL;
    447451    lpAux     = NULL;
    448  
     452
    449453    /* Verify screen pixel format is 16bpp, and set cooperative level */
    450454    ddsd.dwSize = sizeof( ddsd );
     
    454458    ddsd.dwFlags        = DDSD_CAPS;
    455459    ddsd.ddsCaps.dwCaps = DDSCAPS_PRIMARYSURFACE | DDSCAPS_3DDEVICE;
    456        
     460
    457461    if (IDirectDraw2_CreateSurface( lpDD, &ddsd, &lpFront, 0 ) != DD_OK) {
    458462      errorMessage =  "Couldn't allocate primary surface!";
     
    484488    ddsd.ddsCaps.dwCaps =
    485489      DDSCAPS_OFFSCREENPLAIN | DDSCAPS_VIDEOMEMORY | DDSCAPS_3DDEVICE;
    486        
     490
    487491    if (IDirectDraw2_CreateSurface( lpDD, &ddsd, &lpBack, 0 ) != DD_OK) {
    488492      errorMessage = "Couldn't allocate secondary surface!";
     
    490494    }
    491495
    492     /* 
    493      * Always allocate Aux Buffer Surface 
     496    /*
     497     * Always allocate Aux Buffer Surface
    494498     * XXX - (use nAuxBuffers, and deal with 8bpp for alpha)
    495499     */
     
    500504    ddsd.ddsCaps.dwCaps = DDSCAPS_OFFSCREENPLAIN | DDSCAPS_VIDEOMEMORY
    501505        | DDSCAPS_3DDEVICE;
    502        
     506
    503507    if (IDirectDraw2_CreateSurface( lpDD, &ddsd, &lpAux, 0 ) != DD_OK) {
    504508      errorMessage = "Couldn't allocate aux surface";
     
    531535{
    532536  if (lpDD == NULL) return TRUE;
    533  
     537
    534538  if (IDirectDrawSurface2_IsLost(lpFront) == DDERR_SURFACELOST) {
    535     if (IDirectDrawSurface2_Restore(lpFront) != DD_OK) 
     539    if (IDirectDrawSurface2_Restore(lpFront) != DD_OK)
    536540      return ErrorMessage(hWndApp, "Front Buffer restore failure\n");
    537541  }
    538  
     542
    539543  if (!IsFullScreen) {
    540544    if (IDirectDrawSurface2_IsLost(lpBack) == DDERR_SURFACELOST) {
    541       if (IDirectDrawSurface2_Restore(lpBack) != DD_OK) 
     545      if (IDirectDrawSurface2_Restore(lpBack) != DD_OK)
    542546        return ErrorMessage(hWndApp, "Back  Buffer restore failure\n");
    543547    }
    544548  }
    545  
     549
    546550  if (IDirectDrawSurface2_IsLost(lpAux) == DDERR_SURFACELOST) {
    547     if (IDirectDrawSurface2_Restore(lpAux) != DD_OK) 
     551    if (IDirectDrawSurface2_Restore(lpAux) != DD_OK)
    548552      return ErrorMessage(hWndApp, "Aux   Buffer restore failure\n");
    549553  }
    550  
     554
    551555  if (!IsFullScreen) {
    552556    if (IDirectDrawSurface2_IsLost(lpTriple) == DDERR_SURFACELOST) {
    553       if (IDirectDrawSurface2_Restore(lpTriple) != DD_OK) 
     557      if (IDirectDrawSurface2_Restore(lpTriple) != DD_OK)
    554558        return ErrorMessage(hWndApp, "Back  Buffer restore failure\n");
    555559    }
    556560  }
    557  
     561
    558562  GDBG_INFO((80, "_dxRS: restore surfaces OK\n"));
    559563  return _dxDDrawToGlideDesc(pDesc);
     
    587591
    588592  /*
    589    * Get ourselves a valid window handle 
     593   * Get ourselves a valid window handle
    590594   */
    591595  hWndApp = (hWindow == 0) ? GetActiveWindow() : (HWND) hWindow;
     
    615619    if ((sRes <  GR_RESOLUTION_MIN) ||
    616620        (sRes >  GR_RESOLUTION_MAX) &&
    617         (!GR_RESOLUTION_IS_AUTOFLIPPED(sRes)) ) 
     621        (!GR_RESOLUTION_IS_AUTOFLIPPED(sRes)) )
    618622#else
    619623    if ((sRes <  GR_RESOLUTION_320x200) ||
    620         (sRes >  GR_RESOLUTION_512x256)) 
     624        (sRes >  GR_RESOLUTION_512x256))
    621625#endif
    622626      return ErrorMessage(hWndApp, "Bad Fullscreen resolution");
     
    659663    GDBG_INFO((80, "\tbufType = 0x%x\n", pBufDesc[i].bufType));
    660664    GDBG_INFO((80, "\tbufOffset = 0x%x\n", pBufDesc[i].bufOffset));
    661     GDBG_INFO((80, "\tbufStride = 0x%x\n", pBufDesc[i].bufStride));   
     665    GDBG_INFO((80, "\tbufStride = 0x%x\n", pBufDesc[i].bufStride));
    662666    GDBG_INFO((80, "\tbufBPP = 0x%x\n", pBufDesc[i].bufBPP));
    663667  }
     
    668672
    669673  if ( curHALData->initSetVideo ) {
    670     curHALData->initSetVideo( sRes, vRefresh, 
     674    curHALData->initSetVideo( sRes, vRefresh,
    671675                             (FxU32*)width, (FxU32*)height );
    672676  }
     
    683687  RECT    rect;
    684688  int     i;
    685  
     689
    686690  GDBG_INFO((80, "dxControl: code = %d\n", code));
    687  
     691
    688692  /* dx is not initizized */
    689693  if ( lpDD== NULL ) {
    690694    return TRUE;
    691695  }
    692  
     696
    693697  /* Why was I called? */
    694698  switch(code) {
     
    698702      Width = rect.right;
    699703      Height = rect.bottom;
    700       GDBG_INFO((120, "W and H changed to %d %d\n", 
    701                  Width, Height)); 
     704      GDBG_INFO((120, "W and H changed to %d %d\n",
     705                 Width, Height));
    702706
    703707      if (!_dxReallocSurfaces(Width, Height, 0, BufDesc)) {
     
    731735  GDBG_INFO((80, "dxControl: code = %d, w = %d, h = %d\n", code,
    732736             Width, Height));
    733  
     737
    734738  return FXTRUE;
    735739} /* dxControl */
     
    759763    lpDD1     = NULL;
    760764  }
    761  
     765
    762766  lpClipper = NULL;
    763767  lpFront   = NULL;
     
    766770  lpAux     = NULL;
    767771  lpDD      = NULL;
    768  
     772
    769773#endif /* 0 */
    770774  GDBG_INFO((80, "dxClose:  Returning TRUE\n"));
     
    778782  static POINT   point;
    779783  static HRESULT hr;
    780  
     784
    781785  GDBG_INFO((80, "dxSwap:\n"));
    782786  if ( !IsFullScreen ) {
     
    787791    src.top    = 0;
    788792    src.bottom = Height-1;
    789        
     793
    790794    dest = src;
    791795    point.x = 0;
     
    797801    dest.bottom += point.y;
    798802
    799     hr = IDirectDrawSurface_Blt( lpFront, 
     803    hr = IDirectDrawSurface_Blt( lpFront,
    800804                                &dest,
    801805                                lpBack,
     
    803807                                DDBLT_WAIT,
    804808                                NULL );
    805        
     809
    806810    while( IDirectDrawSurface_GetBltStatus( lpFront, DDGBS_ISBLTDONE ) !=
    807811          DD_OK );
    808        
     812
    809813    if ( hr != DD_OK ) {
    810814      ErrorMessage(hWndApp, "Couldn't blit!\n");
     
    812816  }
    813817  return;
    814  
     818
    815819} /* dxSwap */
    816820#else /* it's either DOS or the Hoopti Lab Setup */
     
    880884    break;
    881885  }
    882  
     886
    883887
    884888#define WAITLOOP {\
     
    893897
    894898  if ( curHALData->initSetVideo ) {
    895     rv = curHALData->initSetVideo( sRes, vRefresh, 
     899    rv = curHALData->initSetVideo( sRes, vRefresh,
    896900                                  (FxU32*)width, (FxU32*)height );
    897901    if ( !rv ) goto BAIL;
    898902  }
    899  
     903
    900904  /* Initialize all descriptors. */
    901905  dFront->bufMagic  = VG96_BUF_MAGIC;
     
    952956#ifdef GDBG_INFO_ON
    953957  {
    954     int i; 
     958    int i;
    955959
    956960    for (i = 0; i < 5; i++) {
     
    959963      GDBG_INFO((80, "%s:  pBufDesc.bufType = %s\n",
    960964                 FN_NAME, bufTypeNames[pBufDesc[i].bufType]));
    961       GDBG_INFO((80, "%s:  pBufDesc.bufOffset = 0x%x\n", 
     965      GDBG_INFO((80, "%s:  pBufDesc.bufOffset = 0x%x\n",
    962966                 FN_NAME, pBufDesc[i].bufOffset ));
    963       GDBG_INFO((80, "%s:  pBufDesc.bufStride = 0x%x\n", 
     967      GDBG_INFO((80, "%s:  pBufDesc.bufStride = 0x%x\n",
    964968                 FN_NAME, pBufDesc[i].bufStride));
    965969      GDBG_INFO((80, "%s:  pBufDesc.bufBPP = 0x%x\n",
  • trunk/src/opengl/glide/sst1/init/init96/init96.c

    r2885 r6653  
     1/* $Id: init96.c,v 1.2 2001-09-05 14:31:01 bird Exp $ */
    12/*
    23 ** THIS SOFTWARE IS SUBJECT TO COPYRIGHT PROTECTION AND IS OFFERED ONLY
    34 ** PURSUANT TO THE 3DFX GLIDE GENERAL PUBLIC LICENSE. THERE IS NO RIGHT
    45 ** TO USE THE GLIDE TRADEMARK WITHOUT PRIOR WRITTEN PERMISSION OF 3DFX
    5  ** INTERACTIVE, INC. A COPY OF THIS LICENSE MAY BE OBTAINED FROM THE 
    6  ** DISTRIBUTOR OR BY CONTACTING 3DFX INTERACTIVE INC(info@3dfx.com). 
    7  ** THIS PROGRAM IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER 
     6 ** INTERACTIVE, INC. A COPY OF THIS LICENSE MAY BE OBTAINED FROM THE
     7 ** DISTRIBUTOR OR BY CONTACTING 3DFX INTERACTIVE INC(info@3dfx.com).
     8 ** THIS PROGRAM IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER
    89 ** EXPRESSED OR IMPLIED. SEE THE 3DFX GLIDE GENERAL PUBLIC LICENSE FOR A
    9  ** FULL TEXT OF THE NON-WARRANTY PROVISIONS. 
    10  ** 
     10 ** FULL TEXT OF THE NON-WARRANTY PROVISIONS.
     11 **
    1112 ** USE, DUPLICATION OR DISCLOSURE BY THE GOVERNMENT IS SUBJECT TO
    1213 ** RESTRICTIONS AS SET FORTH IN SUBDIVISION (C)(1)(II) OF THE RIGHTS IN
     
    1415 ** AND/OR IN SIMILAR OR SUCCESSOR CLAUSES IN THE FAR, DOD OR NASA FAR
    1516 ** SUPPLEMENT. UNPUBLISHED RIGHTS RESERVED UNDER THE COPYRIGHT LAWS OF
    16  ** THE UNITED STATES. 
    17  ** 
     17 ** THE UNITED STATES.
     18 **
    1819 ** COPYRIGHT 3DFX INTERACTIVE, INC. 1999, ALL RIGHTS RESERVED
    19  ** $Revision: 1.1 $
    20  ** $Date: 2000-02-25 00:31:28 $
     20 ** $Revision: 1.2 $
     21 ** $Date: 2001-09-05 14:31:01 $
    2122 **
    2223 */
    23 static char revString[] = "@#%$Workfile: INIT96.C $ $Revision: 1.1 $";
     24static char revString[] = "@#%$Workfile: INIT96.C $ $Revision: 1.2 $";
    2425
    2526/* ANSI Headers */
     
    113114
    114115
    115 #define RFB 0 
     116#define RFB 0
    116117#define DFB 1
    117118
    118  
     119
    119120extern FxBool tripleBuffering;
    120121
     
    173174oldVidMode;
    174175
    175 static FxU32 
    176 devNum, 
     176static FxU32
     177devNum,
    177178physAddr,
    178179fifoMTRRNum = 0xffffffff;
     
    181182#ifdef GDBG_INFO_ON
    182183/* NOTE:
    183    
     184
    184185   This array is HIGHLY important to debugging.  Delete it at your
    185186   extreme peril.
     
    449450#ifdef GDBG_INFO_ON
    450451FxU32
    451 get96(FxU32 *addr) 
     452get96(FxU32 *addr)
    452453{
    453454  FxU32
     
    495496
    496497static FxBool
    497 init96LoadBufRegs(int nBuffers, 
    498                   InitBufDesc_t *pBufDesc, 
    499                   int xRes, int yRes, 
     498init96LoadBufRegs(int nBuffers,
     499                  InitBufDesc_t *pBufDesc,
     500                  int xRes, int yRes,
    500501                  InitRegisterDesc *rd);
    501502
     
    512513  SET(sstPtr->vC.x, x);
    513514  SET(sstPtr->vC.y, y+XY_ONE*tSize/2);
    514  
     515
    515516  SET(sstPtr->s, 0);
    516517  SET(sstPtr->t, 0);
     
    561562
    562563  *(texAddr + (8 << 15)) = init;
    563   /* 
     564  /*
    564565     write to 2 consequtive locations in lod0 to alter the data
    565      on the memory signals 
     566     on the memory signals
    566567  */
    567568  WAITLOOP;
    568   *(texAddr + (0)) = 0xffffffff;       
     569  *(texAddr + (0)) = 0xffffffff;
    569570  WAITLOOP;
    570571  *(texAddr + (1)) = 0xffffffff;
    571  
     572
    572573  WAITLOOP;
    573574
     
    592593{
    593594  FxU32 data;
    594  
     595
    595596  if(myGetenv(("SST96_TMUMEM_SIZE"))) {
    596597    *TmuMemorySize = atoi(myGetenv(("SST96_TMUMEM_SIZE")));
     
    605606  /* set lod8 */
    606607  SET(sstPtr->tLOD, ((8 << 2) | (8 << 7)));
    607    
    608   /* 
     608
     609  /*
    609610     first see if we have 4 Mbytes by writing a texel at 2MB followed by
    610611     a texel at 1MB and 0MB and then rendering using the texel at 2MB
     
    617618    data = sense(sstbase,info,tmu,0x200000, SENSE1);
    618619    if (data) {
    619       *TmuMemorySize = 4; 
     620      *TmuMemorySize = 4;
    620621      return(FXTRUE);
    621622    }
     
    630631    }
    631632  }
    632  
     633
    633634  data = sense(sstbase,info,tmu,0x000000, SENSE0);
    634635  if (data) {
    635636    data = sense(sstbase,info,tmu,0x000000, SENSE1);
    636637    if (data) {
    637       *TmuMemorySize = 1; 
     638      *TmuMemorySize = 1;
    638639      return(FXTRUE);
    639640    }
     
    641642
    642643#undef WAITLOOP
    643  
     644
    644645  return(FXFALSE);
    645646}
     
    653654sst96InitGetTmuInfo(FxU32 *sstbase, VG96Info *info)
    654655{
    655   sstPtr = 
     656  sstPtr =
    656657    (volatile Sstregs *)(SST96_COMMAND_REGS(sstbase));
    657658
     
    684685
    685686  VG96Info *vg96Info = (VG96Info *) info;
    686  
     687
    687688  FxU32
    688689    vendorID = vID,
    689690    deviceID = dID;
    690  
     691
    691692  GDBG_INFO((80, "SST-96 Initialization code %s\n", revString));
    692  
     693
    693694  /* Watcom warning suppression */
    694695  revString[0] = revString[0];
     
    696697  /* !!! FIXME hack for vxd bug */
    697698  putenv( "SST_DUALHEAD=1" );
    698  
     699
    699700  switch (vID) {
    700701  case AT3DVID:
     
    710711
    711712  GDBG_INFO((80, "init96MapBoard:  Mapping card into linear memory\n"));
    712  
     713
    713714  regDesc->hwDep.VG96RegDesc.baseAddress =
    714715    pciMapCardMulti( vendorID, deviceID, curHALData->memSize, &devNum, 0 , 0);
     
    741742  sstHW  = regDesc->hwDep.VG96RegDesc.baseAddress;
    742743
    743   GDBG_INFO((80, "%s:  Mapped Voodoo Rush board at 0x%x\n", 
     744  GDBG_INFO((80, "%s:  Mapped Voodoo Rush board at 0x%x\n",
    744745             FN_NAME, regDesc->hwDep.VG96RegDesc.baseAddress));
    745746
     
    750751
    751752  GDBG_INFO((88, "init96MapBoard sstHW = %x\n", sstHW));
    752  
     753
    753754  /* CHD NOTE:  The routine init96SetupRendering MUST Be called from this
    754755     routine or all hell brakes loose.
     
    761762    GrScreenResolution_t    res = GR_RESOLUTION_640x480;
    762763    static void init96SetupRendering(InitRegisterDesc *regDesc,
    763                                      GrScreenResolution_t sRes);
     764                     GrScreenResolution_t sRes);
    764765
    765766    if (curHALData->initAperture)
     
    769770    if ( !rv )
    770771      return FXFALSE;
    771    
     772
    772773    init96SetupRendering(regDesc, res);
    773    
     774
    774775    sst96InitGetTmuInfo((FxU32 *)sstHW, vg96Info);
    775776    }
     
    779780    /* In dos mode, we do it the way it is supposed to be.
    780781       In windows mode, calling initEnableRegs() will change the clock
    781        rate and it makes the refresh looks bad. So we still use the 
     782       rate and it makes the refresh looks bad. So we still use the
    782783       init96SetVideo() to set up the rendering mode etc.
    783784       */
     
    791792      union REGS
    792793        inR, outR;
    793      
     794
    794795      inR.w.ax = 0x4f03;
    795796      int386(0x10, &inR, &outR);
    796      
     797
    797798      oldVidMode = outR.w.bx;
    798799      GDBG_INFO((80, "%s:  Saving Current video mode (0x%x).\n",
    799                  FN_NAME, oldVidMode)); 
     800                 FN_NAME, oldVidMode));
    800801    }
    801    
     802
    802803    if ( !rv )
    803804      return FXFALSE;
    804    
     805
    805806    if ( curHALData->initEnableRegs )
    806807      rv = curHALData->initEnableRegs( regDesc );
    807808    if ( !rv )
    808809      return FXFALSE;
    809    
     810
    810811    init96SetupRendering(regDesc, res);
    811    
     812
    812813    sst96InitGetTmuInfo((FxU32 *)sstHW, vg96Info);
    813814  }
     
    817818    GrScreenResolution_t    res = GR_RESOLUTION_NONE;
    818819    init96SetVideo(0, res,
    819                    0, 2, 1, 
     820                   0, 2, 1,
    820821                   2, 1, regDesc,
    821822                   &xres, &yres, &fbStride );
     
    827828
    828829  GDBG_INFO((80, "init96MapBoard:  returning FXTRUE\n"));
    829  
     830
    830831  return FXTRUE;
    831832
     
    852853  }\
    853854}
    854 #endif 
     855#endif
    855856
    856857#define SWAPPENDING(status) ((status & 0x70) >> 4)
     
    862863  Library: Init Code for 96
    863864  Description:
    864  
     865
    865866  Arguments:
    866  
     867
    867868  Return:
    868869  -------------------------------------------------------------------*/
     
    874875
    875876  sstHW  = regDesc->hwDep.VG96RegDesc.baseAddress;
    876   sstPtr = 
     877  sstPtr =
    877878    (volatile Sstregs *)(SST96_COMMAND_REGS(regDesc->hwDep.VG96RegDesc.baseAddress));
    878879
     
    882883  GDBG_INFO((80, "%s:  Software reset\n", FN_NAME));
    883884  SET(sstHW[0x90 + 0x100000], 0xf601); /* (0xf601) init0, sw reset. */
    884    
     885
    885886  WAITLOOP;
    886887
     
    889890  SET(sstHW[0x100000 + 0x94], 0);
    890891  SET(sstHW[0x100000 + 0x93], 0);
    891    
     892
    892893  GDBG_INFO((80, "%s:  Setting up Mem FIFO\n", FN_NAME));
    893894
     
    895896
    896897  SET(sstHW[0x92 + 0x100000], regVal);
    897    
    898   /* Off for Host Blt, On for LFB command traffic 
     898
     899  /* Off for Host Blt, On for LFB command traffic
    899900     Low Priority Request Aging - wait 64 cycles
    900901     before answering low priority requests from
     
    903904     [24]   - PUMA Texture Address Space Mode      - 0x1 - 2MB
    904905     [23]   - PUMA Texture Base Address Mode       - 0x1 - 6MB
    905      [12:7] - PUMA Low Priority Grant Limit Cnt    - 0x0 
    906      [6]    - PUMA Low Prorirty Grant Limit Enable - 0x0 
     906     [12:7] - PUMA Low Priority Grant Limit Cnt    - 0x0
     907     [6]    - PUMA Low Prorirty Grant Limit Enable - 0x0
    907908     [5:0]  - PUMA Low Priority Request Delay Cnt  - 0x1f - 32 ccls
    908909     Setting to 0x3f ( max ) seems to cripple windows/d3d
     
    910911     */
    911912  GDBG_INFO((80, "%s:  Setting low priority request aging.\n", FN_NAME));
    912   /* 
    913    * If we're running at a high resolution, don't starve AT3D's 
     913  /*
     914   * If we're running at a high resolution, don't starve AT3D's
    914915   * video refresh.   XXX FIXME for AT3d only
    915916   */
     
    926927    SET(sstHW[0x91 + 0x100000],regVal);
    927928  }
    928    
    929   /* Come out of Reset 
     929
     930  /* Come out of Reset
    930931     [17]    - Serial Status Xfer Mode     - 0x0 - rising edge
    931932     [16:12] - TREX-To-FBI High Water Mark - 0xf
    932933     [11:8]  - TREX-To-FBI Bus Clock Delay - 0x6
    933      */   
    934  
     934     */
     935
    935936  GDBG_INFO((80, "%s:  Coming out of FBI reset\n", FN_NAME));
    936937  GETREGVALFROMENV(regVal, "SST96_FBIJRINIT0", 0xf600);
    937938  SET(sstHW[0x90 + 0x100000], regVal); /* Bit 1 disables tmu */
    938    
     939
    939940  WAITLOOP;
    940941
     
    942943  {
    943944    FxU32 trexinit0, trexinit1;
    944        
     945
    945946    if(myGetenv(("SST_TREX0INIT0"))) {
    946947      sscanf(myGetenv(("SST_TREX0INIT0")), "%i", &trexinit0);
     
    948949      trexinit0 = 0x05441;      /* TREXINIT0 */
    949950    }
    950        
     951
    951952    if(myGetenv(("SST_TREX0INIT1"))) {
    952953      sscanf(myGetenv(("SST_TREX0INIT1")), "%i", &trexinit1);
     
    954955      trexinit1 = 0x3643c; /* TREXINIT1 */
    955956    }
    956        
     957
    957958    SET(sstHW[0xc7 + 0x100000], trexinit0); /* TREXINIT0 */
    958959    SET(sstHW[0xc8 + 0x100000], trexinit1); /* TREXINIT1 */
    959960  }
    960  
     961
    961962  WAITLOOP;
    962  
     963
    963964#undef FN_NAME
    964965} /* init96SetupRendering */
     
    970971  Library: init96
    971972  Description:
    972  
     973
    973974  1 - Set video mode
    974975  2 - Enable Direct Writes to Jr
    975976  3 - Put Jr registers in Reset
    976977  3 - Set up Color Buffer Registers
    977  
     978
    978979  Arguments
    979  
     980
    980981  Return:
    981   FXFALSE - fail 
     982  FXFALSE - fail
    982983  FXTRUE  - pass
    983984  -------------------------------------------------------------------*/
    984 INITVG96ENTRY(init96SetVideo, FxBool , 
     985INITVG96ENTRY(init96SetVideo, FxBool ,
    985986              (  FxU32                   hWnd,
    986987               GrScreenResolution_t    sRes,
     
    10111012  GDBG_INFO((80, "%s:  %d Color Buffers\n", FN_NAME, nColBuffers));
    10121013
    1013   GDBG_INFO((80, "(%s) hWnd=%x, sRes=%d, yOrg=%d, ncb=%d, nab=%d\n", 
     1014  GDBG_INFO((80, "(%s) hWnd=%x, sRes=%d, yOrg=%d, ncb=%d, nab=%d\n",
    10141015             FN_NAME, hWnd, sRes, yOrigin, nColBuffers, nAuxBuffers));
    10151016
     
    10201021  if (curHALData->initAperture)
    10211022    (*curHALData->initAperture)(regDesc);
    1022  
     1023
    10231024#if defined( __DOS32__ )
    10241025  {
     
    10311032    oldVidMode = outR.w.bx;
    10321033    GDBG_INFO((80, "%s:  Saving Current video mode (0x%x).\n",
    1033                FN_NAME, oldVidMode)); 
    1034   }
    1035 #endif
    1036  
     1034               FN_NAME, oldVidMode));
     1035  }
     1036#endif
     1037
    10371038  /*-------------------------------------
    10381039    Set Video Mode
     
    10421043     this does not have anything to do with directX */
    10431044#ifdef __linux__
    1044   if (!linOpen(hWnd, sRes, vRefresh, cFormat, yOrigin, 
    1045               nColBuffers, nAuxBuffers, bufDesc, 
     1045  if (!linOpen(hWnd, sRes, vRefresh, cFormat, yOrigin,
     1046              nColBuffers, nAuxBuffers, bufDesc,
    10461047              xres, yres, &swapType)) {
    10471048#else
    1048   if (!dxOpen(hWnd, sRes, vRefresh, cFormat, yOrigin, 
    1049               nColBuffers, nAuxBuffers, bufDesc, 
     1049  if (!dxOpen(hWnd, sRes, vRefresh, cFormat, yOrigin,
     1050              nColBuffers, nAuxBuffers, bufDesc,
    10501051              xres, yres, &swapType)) {
    10511052#endif
     
    10541055    goto BAIL;
    10551056  }
    1056    
    1057 #ifdef GDBG_INFO_ON 
     1057
     1058#ifdef GDBG_INFO_ON
    10581059  for (i = 0; i < nColBuffers; i++) {
    10591060    GDBG_INFO((80, "%s:  bufDesc[%d]:\n", FN_NAME, i));
    10601061    GDBG_INFO((80, "%s:  bufDesc.bufType = %s\n",
    10611062               FN_NAME, bufTypeNames[bufDesc[i].bufType]));
    1062     GDBG_INFO((80, "%s:  bufDesc.bufOffset = 0x%x\n", 
     1063    GDBG_INFO((80, "%s:  bufDesc.bufOffset = 0x%x\n",
    10631064               FN_NAME, bufDesc[i].bufOffset ));
    1064     GDBG_INFO((80, "%s:  bufDesc.bufStride = 0x%x\n", 
     1065    GDBG_INFO((80, "%s:  bufDesc.bufStride = 0x%x\n",
    10651066               FN_NAME, bufDesc[i].bufStride));
    10661067    GDBG_INFO((80, "%s:  bufDesc.bufBPP = 0x%x\n",
     
    10971098    FxU32
    10981099      pending = 7;              /* # Swaps pending */
    1099            
    1100     GDBG_INFO((80, 
    1101                "%s:  Sending %d swapbufferCMDs\n", 
    1102                FN_NAME, 
     1100
     1101    GDBG_INFO((80,
     1102               "%s:  Sending %d swapbufferCMDs\n",
     1103               FN_NAME,
    11031104               pending));
    11041105    while (pending) {
    11051106      FxU32
    11061107        tries = 0;
    1107                
     1108
    11081109      GDBG_INFO((80, "%s: %d swaps pending\n", FN_NAME, pending))  ;
    11091110
     
    11171118        WAITLOOP;
    11181119      }
    1119                
     1120
    11201121      do {
    11211122        ++tries;
    11221123        status =  sstHW[0x100000];
    1123                    
     1124
    11241125        GDBG_INFO((120, "%s:  Serial status = 0x%x\n", FN_NAME, status));
    11251126        pending = SWAPPENDING(status);
     
    11311132      } while (pending);
    11321133    }
    1133            
     1134
    11341135    /* Clear counters with a NOP */
    11351136    SET(sstHW[0x42 + 0x100000], 1); /* NOP cmd */
     
    11381139    do {
    11391140      if (nTries > MAXTRIES) {
    1140         GDBG_INFO((80, 
     1141        GDBG_INFO((80,
    11411142                   "%s: Bailing out and returning false after %d checks for idle.\n", FN_NAME, nTries-1));
    11421143        return FXFALSE;
     
    11441145      ++nTries;
    11451146      status = sstHW[0x100000];
    1146                
    1147       GDBG_INFO((80, 
    1148                  "%s: Serial status after soft reset: 0x%x\n", 
    1149                  FN_NAME, 
     1147
     1148      GDBG_INFO((80,
     1149                 "%s: Serial status after soft reset: 0x%x\n",
     1150                 FN_NAME,
    11501151                 status));
    11511152    } while (status & 0x1);
    11521153  } /* end of swap buffer block */
    11531154
    1154  
     1155
    11551156  if (tripleBuffering) {
    11561157    GETREGVALFROMENV(regVal, "SST96_FBIJRINIT0", 0xf600);
     
    11671168
    11681169  dfbFrontIdx =   0;
    1169   dfbBackIdx  =   1; 
     1170  dfbBackIdx  =   1;
    11701171  dfbRenderIdx =  dfbBackIdx;
    11711172
    11721173  rfbFrontIdx =   0;
    1173   rfbBackIdx  =   1; 
     1174  rfbBackIdx  =   1;
    11741175  rfbRenderIdx =  rfbBackIdx;
    11751176
     
    11791180    goto BAIL;
    11801181  }
    1181  
     1182
    11821183  /*-------------------------------------
    11831184    Set up Page Flipping
     
    11961197    if (curHALData->initUseTiles && (swapType == INIT_SWAP_FLIP)) {
    11971198#ifdef H3D
    1198       (*curHALData->initUseTiles)(regDesc, 
     1199      (*curHALData->initUseTiles)(regDesc,
    11991200                                buf,
    12001201                                maxBuffer,
    12011202                                bI[0].dfbStride,
    1202                                 *xres, 
     1203                                *xres,
    12031204                                *yres,
    12041205                                GR_RESOLUTION_IS_AUTOFLIPPED(sRes) );
    12051206#else
    1206       (*curHALData->initUseTiles)(regDesc, 
     1207      (*curHALData->initUseTiles)(regDesc,
    12071208                                buf,
    12081209                                maxBuffer,
    12091210                                bI[0].dfbStride,
    1210                                 *xres, 
     1211                                *xres,
    12111212                                *yres );
    12121213#endif
     
    12141215  }
    12151216#endif
    1216  
     1217
    12171218  *fbStride = (bI[1].dfbStride>>1);
    12181219  GDBG_INFO(( 200, "frame buffer stride: %d\n", *fbStride ));
    1219  
     1220
    12201221 BAIL:
    12211222  return rv;
     
    12301231  Library: init96
    12311232  Description:
    1232  
     1233
    12331234  Disable Direct Hardware Access
    12341235  Restore the video to it's initial state
    1235  
     1236
    12361237  Arguments:
    12371238  none
     
    12401241  -------------------------------------------------------------------*/
    12411242INITVG96ENTRY(init96RestoreVideo, void, ( InitRegisterDesc *regDesc )) {
    1242 #define FN_NAME "init96RestoreVideo" 
     1243#define FN_NAME "init96RestoreVideo"
    12431244  if ( curHALData->initDisableRegs )
    12441245    curHALData->initDisableRegs( regDesc );
    1245  
    1246 #if  defined( __WIN32__ ) && !defined( INIT_HOOPTI ) 
     1246
     1247#if  defined( __WIN32__ ) && !defined( INIT_HOOPTI )
    12471248  dxClose();
    1248 #elif defined( __DOS32__ ) 
     1249#elif defined( __DOS32__ )
    12491250  {
    12501251    static union REGS
     
    12701271  Library: init96
    12711272  Description:
    1272  
    1273   Enable the JR command transport and return pertinant fifo 
     1273
     1274  Enable the JR command transport and return pertinant fifo
    12741275  information to the caller
    1275  
     1276
    12761277  Arguments:
    12771278  info - structure to fill with info about the FIFO
     
    12801281  FXFALSE - fail
    12811282  -------------------------------------------------------------------*/
    1282 INITVG96ENTRY(init96EnableTransport, FxBool, ( InitFIFOData *info, InitRegisterDesc* regDesc)) 
     1283INITVG96ENTRY(init96EnableTransport, FxBool, ( InitFIFOData *info, InitRegisterDesc* regDesc))
    12831284{
    12841285#define FN_NAME "init96EnableTransport"
     
    12921293  PciMemType
    12931294    fifoMemType;
    1294  
     1295
    12951296  GDBG_INFO((80, "%s\n", FN_NAME));
    1296  
     1297
    12971298  /*------------------------------------------------------------
    12981299    Enable the Off Chip Fifo
    12991300    ------------------------------------------------------------*/
    1300  
     1301
    13011302  /* These are defined in sst.c for now */
    13021303  lo = (fifoStart >> 12);     /* physaddr of 1st 4k page */
     
    13041305  sz = (hi - lo + 1) << 12;   /* bytes */
    13051306  th = (hi - lo) - 3;         /* threshold, in 4k pages. */
    1306  
     1307
    13071308  /* Generate virtual addresses for the pointers. */
    13081309  fifovirt = (FxU32 *)&sstHW[lo << 10];
     
    13101311  fifomax  = sz;
    13111312  fifocur  = 0;
    1312  
     1313
    13131314  fifoptr  = fifovirt;
    13141315  fifosize = 4096;            /* initially, set to 4k */
    1315  
     1316
    13161317  fifolfb = 1;
    1317  
     1318
    13181319  /* First disable the off-chip fifo */
    13191320  GDBG_INFO((80, "%s:  Disabling off-chip FIFO\n", FN_NAME));
    13201321  SET(sstHW[0x100000 + 0x93], 0);
    1321  
     1322
    13221323  /* FbijrInit4 - 0x94 - entry count */
    13231324  SET(sstHW[0x100000 + 0x94], 0);
    1324  
     1325
    13251326  /* FbijrInit5 - 0x95 - read pointer */
    13261327  SET(sstHW[0x100000 + 0x95], lo << 9);
    13271328
    1328   /* Default size to page checking mode. 
     1329  /* Default size to page checking mode.
    13291330   *
    13301331   * NB: This will get overwritten later if we're using
     
    13401341  info->hwDep.vg96FIFOData.fifoLfb  = fifolfb;
    13411342
    1342   /* Set up alternate wrapping values. 
     1343  /* Set up alternate wrapping values.
    13431344   *
    13441345   * NB: This *MUST* come before the processor dependent
     
    13751376
    13761377  /*
    1377   **  NOTE TO ALL FOOLS WHO TREAD HERE     
    1378   ** 
     1378  **  NOTE TO ALL FOOLS WHO TREAD HERE
     1379  **
    13791380  **  It is VITALLY important to enable the FIFO AFTER the
    13801381  **  P6 Lag Of Love(tm), instead of before, otherwise the FIFO will
     
    13871388
    13881389  /* Set the fifo ptr now that we really know where its going to start
    1389    * for the client code. 
     1390   * for the client code.
    13901391   */
    13911392  info->hwDep.vg96FIFOData.fifoPtr  = (FxU32*)fifoptr;
     
    14261427    Return:
    14271428    -------------------------------------------------------------------*/
    1428 INITVG96ENTRY(init96DisableTransport, void, ( void )) 
     1429INITVG96ENTRY(init96DisableTransport, void, ( void ))
    14291430{
    14301431#define FN_NAME "init96DisableTransport"
    14311432  while (*(volatile FxU32 *)sstPtr & 1);
    1432  
     1433
    14331434  SET(sstHW[0x100000 + 0x90], 0xf601); /* (0xf601) init0, sw reset. */
    14341435  SET(sstHW[0x100000 + 0x95], 0);
     
    15031504
    15041505    sstPtr->swappendCMD = 0x1;
    1505    
     1506
    15061507
    15071508    if (gotEnv == FXFALSE) {
     
    15521553    CRTC_GET(AR_CRTC_SERIAL_OVERFLOW_INDEX, serialOverflow);
    15531554    serialOverflow &= 0xF0;
    1554    
     1555
    15551556    /* Make sure scanout within active display */
    15561557    do {
    15571558      INP(VGA_INPUT_STATUS_1C, tmp);
    15581559    } while (tmp & VIS1C_PIXEL_DISPLAY_INACTIVE);
    1559    
     1560
    15601561    /* Set serial address */
    15611562    /* For some reason unknown to me, this is set to the byte offset / 4,
    15621563       or perhaps the offset in dwords */
    1563    
     1564
    15641565    /* Top nibble */
    15651566    tmp = (FxU8) ((offset >> (2+16)) & 0x0F);
    15661567    CRTC_SET(AR_CRTC_SERIAL_OVERFLOW_INDEX, serialOverflow | tmp);
    1567    
     1568
    15681569    /* Middle byte */
    15691570    tmp = (FxU8) ((offset >> (2+8)) & 0xFF);
    15701571    CRTC_SET(VR_CRTC_SERIAL_START_ADDRESS_HI_INDEX, tmp);
    1571    
     1572
    15721573    /* Low byte */
    15731574    tmp = (FxU8) ((offset >> 2) & 0xFF);
    15741575    CRTC_SET(VR_CRTC_SERIAL_START_ADDRESS_LO_INDEX, tmp);
    1575    
     1576
    15761577    /* Save away */
    15771578    do {
     
    15841585#endif
    15851586#endif
    1586    
     1587
    15871588    /* dpc - 26 jan 1998
    15881589     * Some hw, macronix, requires that we diddle w/ even more bits
    1589      * when we do the swap. 
     1590     * when we do the swap.
    15901591     */
    15911592    if(curHALData->initSwapTiles != NULL) (*curHALData->initSwapTiles)(rd);
    1592    
     1593
    15931594    ADVANCE_BUFFERS(rfb);
    15941595
     
    15971598               bI[rfbRenderIdx].rfb));
    15981599    wcb( (FxU32*)&(sstPtr->colBufferSetup), bI[rfbRenderIdx].rfb );
    1599    
     1600
    16001601
    16011602  } else {
     
    16231624  Library: Init Code for VG96
    16241625  Description:
    1625  
     1626
    16261627  Arguments:
    1627  
     1628
    16281629  Return:
    16291630  -------------------------------------------------------------------*/
     
    16551656#define LFB_OFFSET( X ) ( X & 0x3fffff )
    16561657
    1657 INITVG96ENTRY(init96GetBufferPtr, void*, (InitBuffer_t buffer, int *strideBytes)) 
     1658INITVG96ENTRY(init96GetBufferPtr, void*, (InitBuffer_t buffer, int *strideBytes))
    16581659{
    16591660#define FN_NAME "init96GetBufferPtr"
     
    16981699  Date: 2/25
    16991700  Implementor(s): jdt
    1700   Library: init96 
     1701  Library: init96
    17011702  Description:
    17021703  Set the current render buffer
     
    17061707  none
    17071708  -------------------------------------------------------------------*/
    1708 INITVG96ENTRY(init96RenderBuffer, void, (InitBuffer_t buffer,Init96WriteMethod *wcb)) 
     1709INITVG96ENTRY(init96RenderBuffer, void, (InitBuffer_t buffer,Init96WriteMethod *wcb))
    17091710{
    17101711#define FN_NAME "init96RenderBuffer"
     
    17371738  none
    17381739  -------------------------------------------------------------------*/
    1739 INITVG96ENTRY(init96Origin, void, (InitOriginLocation_t origin,Init96WriteMethod *wcb)) 
     1740INITVG96ENTRY(init96Origin, void, (InitOriginLocation_t origin,Init96WriteMethod *wcb))
    17401741{
    17411742#define FN_NAME "init96Origin"
     
    17811782
    17821783  GDBG_INFO((80, "(%s)\n", FN_NAME));
    1783  
     1784
    17841785  if ( !sstHW ) return FXFALSE;
    17851786
     
    18131814                                      (*((volatile FxU32*)(((FxU32)(__regP)) + (0x95 << 12))) << 3))
    18141815
    1815 INITVG96ENTRY(init96WrapFIFO, 
    1816               FxBool, 
     1816INITVG96ENTRY(init96WrapFIFO,
     1817              FxBool,
    18171818              (InitRegisterDesc* rd, InitFIFOData* fifoP))
    18181819{
     
    18261827
    18271828  {
    1828     const FxI32 writes = (MIN(fifoP->hwDep.vg96FIFOData.roomToReadPtr, 
     1829    const FxI32 writes = (MIN(fifoP->hwDep.vg96FIFOData.roomToReadPtr,
    18291830                              fifoP->hwDep.vg96FIFOData.roomToEnd) -
    18301831                          fifoP->hwDep.vg96FIFOData.fifoSize);
    1831    
     1832
    18321833    fifoP->hwDep.vg96FIFOData.roomToReadPtr -= writes;
    18331834    fifoP->hwDep.vg96FIFOData.roomToEnd -= writes;
     
    18431844      const FxU32 curReadPtr = SST96_HW_FIFO(sstHW, sstPtr);
    18441845      const FxU32 curReadDist = curReadPtr - lastHwRead;
    1845      
     1846
    18461847      roomToReadPtr += curReadDist;
    18471848      if (lastHwRead > curReadPtr) roomToReadPtr += fifoP->hwDep.vg96FIFOData.fifoMax;
     
    18501851    }
    18511852
    1852     GDBG_INFO((80, FN_NAME"_Wait : (0x%X : 0x%X) : (0x%X : 0x%X)\n", 
     1853    GDBG_INFO((80, FN_NAME"_Wait : (0x%X : 0x%X) : (0x%X : 0x%X)\n",
    18531854               (FxU32)fifoP->hwDep.vg96FIFOData.fifoPtr, blockSize,
    18541855               fifoP->hwDep.vg96FIFOData.roomToReadPtr,
     
    18701871#else
    18711872#define JU_JU_STALL /* Do Nothing */
    1872 #endif     
     1873#endif
    18731874      {
    18741875         volatile FxU32* fifoPtr = fifoP->hwDep.vg96FIFOData.fifoPtr;
     
    18861887            volatile FxU32* serialStatus =
    18871888              fifoP->hwDep.vg96FIFOData.regDesc->hwDep.VG96RegDesc.serialStatus;
    1888            
     1889
    18891890            if ((*serialStatus & 0x80) != 0x00) {
    18901891               GDBG_INFO((85, FN_NAME": fifo close to full. Waiting(0x%X)...\n", numJuJuStalls));
     
    19001901#undef kFifoPadDelay
    19011902
    1902       GDBG_INFO((80, FN_NAME"_Wrap : (0x%X : 0x%X) : (0x%X : 0x%X)\n", 
     1903      GDBG_INFO((80, FN_NAME"_Wrap : (0x%X : 0x%X) : (0x%X : 0x%X)\n",
    19031904                 (FxU32)fifoP->hwDep.vg96FIFOData.fifoPtr, blockSize,
    19041905                 fifoP->hwDep.vg96FIFOData.roomToReadPtr,
    19051906                 fifoP->hwDep.vg96FIFOData.roomToEnd));
    1906      
     1907
    19071908      fifoP->hwDep.vg96FIFOData.roomToReadPtr -= fifoP->hwDep.vg96FIFOData.roomToEnd;
    19081909      fifoP->hwDep.vg96FIFOData.roomToEnd = fifoP->hwDep.vg96FIFOData.fifoMax;
    1909      
    1910       /* Reset fifo ptr to start */ 
     1910
     1911      /* Reset fifo ptr to start */
    19111912      fifoP->hwDep.vg96FIFOData.fifoPtr = fifoP->hwDep.vg96FIFOData.fifoVirt;
    19121913      goto again;
    19131914  }
    1914  
     1915
    19151916  /* compute room left */
    19161917  fifoP->hwDep.vg96FIFOData.roomToEnd -= blockSize;
     
    19181919  fifoP->hwDep.vg96FIFOData.fifoSize = MIN(fifoP->hwDep.vg96FIFOData.roomToReadPtr,
    19191920                                           fifoP->hwDep.vg96FIFOData.roomToEnd) + blockSize;
    1920  
     1921
    19211922  GDBG_INFO((80, FN_NAME": (0x%X : 0x%X) : (0x%X : 0x%X) : 0x%X\n",
    19221923             (FxU32)fifoP->hwDep.vg96FIFOData.fifoPtr, blockSize,
     
    19311932  return FXTRUE;
    19321933#undef FN_NAME
    1933 } 
     1934}
    19341935#else /* !SST96_ALT_FIFO_WRAP */
    19351936
     
    19511952#define FN_NAME "init96FIFOWait"
    19521953  volatile FxU32 *pstatus;
    1953  
     1954
    19541955
    19551956  /* Check for more room. */
    19561957  pstatus = (volatile FxU32 *) rd->hwDep.VG96RegDesc.serialStatus;
    1957  
     1958
    19581959  if (*pstatus & 0x80) {        /* 0x80 is the FIFO threshold */
    19591960    int  timeout;
     
    19651966    if (*pstatus & 0x80) {
    19661967      GDBG_INFO((80, "Lost patience in %s.  Status is 0x%x\n",
    1967                  FN_NAME, *pstatus)); 
     1968                 FN_NAME, *pstatus));
    19681969      goto again;
    19691970    }
    19701971  }
    1971 #undef FN_NAME 
     1972#undef FN_NAME
    19721973} /* init96FIFOWait */
    19731974
     
    19881989#define FN_NAME "init96WrapFIFO"
    19891990  FxBool rVal;
    1990  
     1991
    19911992  GDBG_INFO((80,"%s\n", FN_NAME));
    1992  
     1993
    19931994  while (fifoData->hwDep.vg96FIFOData.fifoSize > 0) {
    19941995    *fifoData->hwDep.vg96FIFOData.fifoPtr++ = 0L;
    19951996    fifoData->hwDep.vg96FIFOData.fifoSize -= 4;
    19961997  }
    1997  
    1998  
     1998
     1999
    19992000  fifoData->hwDep.vg96FIFOData.fifoCur += 4096;
    2000  
     2001
    20012002  /* Wrap back to beginning? */
    20022003  if (fifoData->hwDep.vg96FIFOData.fifoCur >= fifoData->hwDep.vg96FIFOData.fifoMax ) {
    20032004    static int fifowraps = 0;
    2004    
     2005
    20052006    fifoData->hwDep.vg96FIFOData.fifoCur = 0;
    20062007    if ((fifowraps = (fifowraps + 1) & 0xf) == 0) {
    2007       GDBG_INFO((80, "%s:  Wrapping %s FIFO\n", 
    2008                  FN_NAME, 
    2009                  (fifoData->hwDep.vg96FIFOData.fifoLfb 
    2010                   ? "LFB" 
     2008      GDBG_INFO((80, "%s:  Wrapping %s FIFO\n",
     2009                 FN_NAME,
     2010                 (fifoData->hwDep.vg96FIFOData.fifoLfb
     2011                  ? "LFB"
    20112012                  : "Video Aperture")));
    20122013    }
    20132014
    2014     if (fifoData->hwDep.vg96FIFOData.fifoLfb) 
     2015    if (fifoData->hwDep.vg96FIFOData.fifoLfb)
    20152016      fifoData->hwDep.vg96FIFOData.fifoPtr = fifoData->hwDep.vg96FIFOData.fifoVirt;
    20162017  }
    2017  
     2018
    20182019  /*  */
    20192020  {
    20202021    FxU32
    20212022      fbiJrInit5;
    2022    
     2023
    20232024    GDBG_INFO((125, "%s:  Write = 0x%x\n", FN_NAME,
    20242025               (FxU32) fifoData->hwDep.vg96FIFOData.fifoPtr -
    20252026               (FxU32) fifoData->hwDep.vg96FIFOData.fifoVirt));
    2026    
     2027
    20272028    fbiJrInit5 = *((volatile FxU32 *) (((FxU32) sstPtr) + (0x95 << 12)));
    20282029
     
    20452046
    20462047  GDBG_INFO((80, "%s:  Got more room.\n", FN_NAME));
    2047  
     2048
    20482049  /* At this point, we have atleast 1 more page of fifo. */
    20492050  fifoData->hwDep.vg96FIFOData.fifoSize = 4096;
    2050  
     2051
    20512052  rVal = FXTRUE;
    2052  
     2053
    20532054  GDBG_INFO((80, "%s:  returning %s\n", FN_NAME, rVal ? "FXTRUE" : "FXFALSE"));
    2054  
     2055
    20552056  return rVal;
    2056  
     2057
    20572058#undef FN_NAME
    20582059} /* init96WrapFIFO */
     
    20602061#endif /* !SST96_ALT_FIFO_WRAP */
    20612062
    2062 /* 
    2063  * This function is used only locally, so none of Chris's decorations 
     2063/*
     2064 * This function is used only locally, so none of Chris's decorations
    20642065 * Load colbufSetup and auxBufSetup registers, given a InitBufDesc_t
    20652066 */
    2066 static FxBool 
     2067static FxBool
    20672068init96LoadBufRegs(int nBuffers, InitBufDesc_t *pBufDesc, int xRes,
    2068                   int yRes, InitRegisterDesc *rd) 
     2069                  int yRes, InitRegisterDesc *rd)
    20692070{
    20702071#define FN_NAME "init96LoadBufRegs"
     
    20752076  InitBufDesc_t   *pFifo   = NULL;
    20762077  int i;
    2077    
     2078
    20782079  GDBG_INFO((80, "(%s) w = %d, h = %d, n = %d\n",
    20792080             FN_NAME, xRes, yRes, nBuffers));
    2080    
     2081
    20812082  if ( !sstHW ) return FXFALSE;
    2082    
     2083
    20832084  /* Take pBufDesc apart */
    20842085  while (nBuffers-- > 0) {
    20852086    switch (pBufDesc->bufType) {
    20862087    case INIT_BUFFER_FRONTBUFFER:
    2087       GDBG_INFO((80, "%s: %s: 0x%x\n", 
     2088      GDBG_INFO((80, "%s: %s: 0x%x\n",
    20882089                 FN_NAME, bufTypeNames[pBufDesc->bufType], pBufDesc));
    20892090      pFront = pBufDesc;
    20902091      break;
    20912092    case INIT_BUFFER_BACKBUFFER:
    2092       GDBG_INFO((80, "%s: %s: 0x%x\n", 
     2093      GDBG_INFO((80, "%s: %s: 0x%x\n",
    20932094                 FN_NAME, bufTypeNames[pBufDesc->bufType], pBufDesc));
    20942095      pBack  = pBufDesc;
    20952096      break;
    20962097    case INIT_BUFFER_AUXBUFFER:
    2097       GDBG_INFO((80, "%s: %s: 0x%x\n", 
     2098      GDBG_INFO((80, "%s: %s: 0x%x\n",
    20982099                 FN_NAME, bufTypeNames[pBufDesc->bufType], pBufDesc));
    2099       pAux   = pBufDesc; 
     2100      pAux   = pBufDesc;
    21002101      break;
    2101     case INIT_BUFFER_FIFOBUFFER:   
    2102       GDBG_INFO((80, "%s: %s: 0x%x\n", 
     2102    case INIT_BUFFER_FIFOBUFFER:
     2103      GDBG_INFO((80, "%s: %s: 0x%x\n",
    21032104                 FN_NAME, bufTypeNames[pBufDesc->bufType], pBufDesc));
    21042105      pFifo  = pBufDesc;
    21052106      break;
    21062107    case INIT_BUFFER_TRIPLEBUFFER:
    2107       GDBG_INFO((80, "%s: %s: 0x%x\n", 
     2108      GDBG_INFO((80, "%s: %s: 0x%x\n",
    21082109                 FN_NAME, bufTypeNames[pBufDesc->bufType], pBufDesc));
    21092110      pTriple = pBufDesc;
     
    21212122  GDBG_INFO((80,"pFront = %.08x, pBack = %.08x, pTriple = %.08x, pAux = %.08x, pFifo = %.08x\n",
    21222123             pFront, pBack, pTriple, pAux, pFifo));
    2123    
     2124
    21242125  if (myGetenv("SST96_FORCEALIGN")) {
    21252126    FxU32 F, B, T, A;
    2126    
     2127
    21272128    sscanf(myGetenv("SST96_FORCEALIGN"), "%x,%x,%x,%x", &F, &B, &T, &A);
    21282129    GDBG_INFO((80, "!!!!!GROSS HACK... forcing values!!!!!\n"));
     
    21432144  if (pFifo)
    21442145    GDBG_INFO((80,"C = %.08x, s= %6d\n", pFifo ->bufOffset, pFifo ->bufStride));
    2145    
     2146
    21462147  /* Fill the arrays here */
    2147   bI[0].dfbBase   = pFront->bufOffset; 
     2148  bI[0].dfbBase   = pFront->bufOffset;
    21482149  bI[0].dfbStride = pFront->bufStride;
    21492150  bI[0].dfbTop    = pFront->bufOffset + (yRes-1) * pFront->bufStride;
    2150    
     2151
    21512152  bI[1].dfbBase   = pBack->bufOffset;
    21522153  bI[1].dfbStride = pBack->bufStride;
     
    22042205    fifoEnd   = pFifo->bufOffset + pFifo->bufStride;
    22052206  }
    2206  
     2207
    22072208  GDBG_INFO((80, "%s:  Returning TRUE\n", FN_NAME));
    22082209  return FXTRUE;
     
    22192220  success. Zero is returned of the board is not mapped.
    22202221  XXX This should be refined in the future. XXX
    2221  
     2222
    22222223  Arguments: none
    2223  
     2224
    22242225  Return: n, where n == available VRAM in bytes on the board
    22252226  -------------------------------------------------------------------*/
  • trunk/src/opengl/glide/sst1/init/init96/initmcrx.c

    r2885 r6653  
     1/* $Id: initmcrx.c,v 1.2 2001-09-05 14:31:02 bird Exp $ */
    12/*
    23** THIS SOFTWARE IS SUBJECT TO COPYRIGHT PROTECTION AND IS OFFERED ONLY
    34** PURSUANT TO THE 3DFX GLIDE GENERAL PUBLIC LICENSE. THERE IS NO RIGHT
    45** TO USE THE GLIDE TRADEMARK WITHOUT PRIOR WRITTEN PERMISSION OF 3DFX
    5 ** INTERACTIVE, INC. A COPY OF THIS LICENSE MAY BE OBTAINED FROM THE 
    6 ** DISTRIBUTOR OR BY CONTACTING 3DFX INTERACTIVE INC(info@3dfx.com). 
    7 ** THIS PROGRAM IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER 
     6** INTERACTIVE, INC. A COPY OF THIS LICENSE MAY BE OBTAINED FROM THE
     7** DISTRIBUTOR OR BY CONTACTING 3DFX INTERACTIVE INC(info@3dfx.com).
     8** THIS PROGRAM IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER
    89** EXPRESSED OR IMPLIED. SEE THE 3DFX GLIDE GENERAL PUBLIC LICENSE FOR A
    9 ** FULL TEXT OF THE NON-WARRANTY PROVISIONS. 
    10 ** 
     10** FULL TEXT OF THE NON-WARRANTY PROVISIONS.
     11**
    1112** USE, DUPLICATION OR DISCLOSURE BY THE GOVERNMENT IS SUBJECT TO
    1213** RESTRICTIONS AS SET FORTH IN SUBDIVISION (C)(1)(II) OF THE RIGHTS IN
     
    1415** AND/OR IN SIMILAR OR SUCCESSOR CLAUSES IN THE FAR, DOD OR NASA FAR
    1516** SUPPLEMENT. UNPUBLISHED RIGHTS RESERVED UNDER THE COPYRIGHT LAWS OF
    16 ** THE UNITED STATES. 
    17 ** 
     17** THE UNITED STATES.
     18**
    1819** COPYRIGHT 3DFX INTERACTIVE, INC. 1999, ALL RIGHTS RESERVED
    1920**
    2021**
    21 ** $Revision: 1.1 $
    22 ** $Date: 2000-02-25 00:31:31 $
     22** $Revision: 1.2 $
     23** $Date: 2001-09-05 14:31:02 $
    2324**
    2425*/
    25 static char revString[] = "@#%$Workfile: initmcrx.c $ $Revision: 1.1 $";
     26static char revString[] = "@#%$Workfile: initmcrx.c $ $Revision: 1.2 $";
    2627
    2728#include <3dfx.h>
     
    8586  Library: Init Code for MCRX
    8687  Description:
    87  
     88
    8889  Arguments:
    89  
     90
    9091  Return:
    9192        address of mcrxHALData
     
    106107  Initialize rd pointers to access apertures
    107108  Arguments:
    108  
     109
    109110  Return:
    110111  -------------------------------------------------------------------*/
     
    121122     0x2000000 - 0x20000);
    122123
    123   GDBG_INFO((80, "%s:  Setting partnerRegPtr to 0x%x\n", 
     124  GDBG_INFO((80, "%s:  Setting partnerRegPtr to 0x%x\n",
    124125             FN_NAME, rd->hwDep.VG96RegDesc.partnerRegPtr));
    125  
     126
    126127#if 1
    127128  rd->hwDep.VG96RegDesc.serialStatus = (FxU32 *)
     
    137138  rd->hwDep.VG96RegDesc.fifoApertureBase =
    138139    (FxU32 *) (((FxU32)rd->hwDep.VG96RegDesc.baseAddress) + 0x400000);
    139  
     140
    140141  GDBG_INFO((80, "%s:  returning TRUE\n", FN_NAME));
    141  
     142
    142143  return rVal;
    143144
     
    146147
    147148/* FIXME !! jdt - need to add more resolutions to dos */
    148 INITMCRXENTRY(initMCRXSetVideo, FxBool, (GrScreenResolution_t res, GrScreenRefresh_t refresh, FxU32 *xr, FxU32 *yr )) 
     149INITMCRXENTRY(initMCRXSetVideo, FxBool, (GrScreenResolution_t res, GrScreenRefresh_t refresh, FxU32 *xr, FxU32 *yr ))
    149150{
    150151#define FN_NAME "initMCRXSetVideo"
    151152  FxBool rv = FXTRUE;
    152 #if defined(INIT_ACCESS_DIRECT) && defined( __DOS32__ ) 
     153#if defined(INIT_ACCESS_DIRECT) && defined( __DOS32__ )
    153154  union REGS r0, r1;
    154155#endif
    155  
     156
    156157  GDBG_INFO((80, "%s: \n", FN_NAME));
    157158
    158 #if defined(INIT_ACCESS_DIRECT) && defined( __DOS32__ ) 
     159#if defined(INIT_ACCESS_DIRECT) && defined( __DOS32__ )
    159160  switch( res ) {
    160161  case GR_RESOLUTION_320x200:
     
    215216
    216217#endif
    217   GDBG_INFO((80, "%s: returning %s\n", FN_NAME, rv?"TRUE":"FALSE")); 
     218  GDBG_INFO((80, "%s: returning %s\n", FN_NAME, rv?"TRUE":"FALSE"));
    218219  return rv;
    219 #undef FN_NAME 
     220#undef FN_NAME
    220221} /* initMCRXSetVideo */
    221222
     
    228229
    229230  Do all setup necessary to enable direct writes to JR Space
    230  
     231
    231232  Arguments:
    232233  rd - pointer to register description
    233  
     234
    234235  Return:
    235236  True if success, False if Failure
    236237  -------------------------------------------------------------------*/
    237 INITMCRXENTRY(initMCRXEnableRegs, FxBool, (InitRegisterDesc *rd)) 
     238INITMCRXENTRY(initMCRXEnableRegs, FxBool, (InitRegisterDesc *rd))
    238239{
    239240#define FN_NAME "initMCRXEnableRegs"
    240   FxU32 
     241  FxU32
    241242    tmp;
    242243  FxU8
     
    256257  GDBG_INFO((80, "%s:    Save Extended Registers Protection State\n",
    257258             FN_NAME));
    258  
     259
    259260  OUTP(0x3d4, 0x19);
    260261  INP(0x3d5, protState);
     
    273274  OUTP(0x3C4, 0x1B);
    274275  INP(0x3C5, rd->hwDep.VG96RegDesc.mclockLo);
    275   GDBG_INFO((80, "%s: mclock registers: (0x%X : 0x%X)\n", FN_NAME, 
     276  GDBG_INFO((80, "%s: mclock registers: (0x%X : 0x%X)\n", FN_NAME,
    276277             (FxU32)rd->hwDep.VG96RegDesc.mclockHi, (FxU32)rd->hwDep.VG96RegDesc.mclockHi));
    277  
     278
    278279  GDBG_INFO((80, "%s:  Enabling FBI Jr.\n", FN_NAME));
    279280  OUTPW(0x3C4, 0x001F);
     
    311312
    312313/* FIXME!!! jdt - puma/ram timing fixes need to go here */
    313 INITMCRXENTRY(initMCRXDisableRegs,FxBool,(InitRegisterDesc *rd)) 
     314INITMCRXENTRY(initMCRXDisableRegs,FxBool,(InitRegisterDesc *rd))
    314315{
    315316#define FN_NAME "initMCRXDisableRegs"
    316317  FxU8
    317318    seqSave, crtcSave;
    318  
     319
    319320  FxU16
    320321    protState;
     
    349350  CRTC_GET(0x28, tmp);
    350351  GDBG_INFO((80, "%s:  crtc 0x28: 0x%X\n", FN_NAME, tmp));
    351   tmp &= ~1; 
     352  tmp &= ~1;
    352353  CRTC_SET(0x28, tmp);
    353354
     
    358359  {
    359360    FxU16 tempMclock;
    360    
     361
    361362    GDBG_INFO((80, "%s:  Restoring mclock\n", FN_NAME));
    362363    tempMclock = (0x1A | (rd->hwDep.VG96RegDesc.mclockHi << 8));
    363364    OUTPW(0x3C4, tempMclock);
    364    
     365
    365366    tempMclock = (0x1B | (rd->hwDep.VG96RegDesc.mclockLo << 8));
    366367    OUTPW(0x3C4, tempMclock);
     
    370371    OUTPW(0x3C4, 0x001C);
    371372  }
    372  
     373
    373374  GDBG_INFO((80, "%s:  Restoring Protection\n", FN_NAME));
    374375  OUTPW(0x3df, protState);
     
    381382
    382383  return FXTRUE;
    383  
     384
    384385#undef FN_NAME
    385386} /* initMCRXDisableRegs */
     
    391392  Library: Init Code for MCRX
    392393  Description:
    393  
     394
    394395  Arguments:
    395  
     396
    396397  Return:
    397398  -------------------------------------------------------------------*/
     
    408409  { 0x0d, 0x0c, 0x21 },
    409410  { 0x71, 0x72, 0x73 },
    410   /* chd - Fixme! 
     411  /* chd - Fixme!
    411412   * Bogus numbers.  Does triple buffering work on Macronix?
    412    * 
    413    * dpc - 23 jan 1998 - 
     413   *
     414   * dpc - 23 jan 1998 -
    414415   * Donny just told me this so hopefully this will work.
    415416   */
     
    438439    const FxU8 maxBufferBits = (((crtcSwapControl & 0x08) == 0) ? 1 : 2);
    439440
    440     crtcSwapStatus = ((crtcSwapStatus & ~0x03) | 
     441    crtcSwapStatus = ((crtcSwapStatus & ~0x03) |
    441442                      ((bufferBits == maxBufferBits) ? 0x00 : bufferBits + 1));
    442443    CRTC_SET(0x7A, crtcSwapStatus);
    443444  }
    444  
     445
    445446  /* We have no way of knowing that this worked so of course we always
    446447   * return success.
     
    456457  Library: Init Code for MCRX
    457458  Description:
    458  
     459
    459460  Arguments:
    460461  atmm:                 Pointer to base of MCRX
     
    472473                                      FxU32 nBuffers,
    473474                                      FxU32 strideInBytes,
    474                                       FxU32 Width, FxU32 Height, FxU32 PageFlipping)) 
     475                                      FxU32 Width, FxU32 Height, FxU32 PageFlipping))
    475476#else
    476477INITMCRXENTRY(initMCRXUseTiles, int, (InitRegisterDesc *rd,
     
    478479                                      FxU32 nBuffers,
    479480                                      FxU32 strideInBytes,
    480                                       FxU32 Width, FxU32 Height)) 
     481                                      FxU32 Width, FxU32 Height))
    481482#endif
    482483{
     
    496497
    497498  const char *envVal;
    498  
     499
    499500  GDBG_INFO((80, "%s:\n", FN_NAME));
    500501
     
    538539   * If we are triple buffering we need to enable this on the actual
    539540   * macronix part as well. This is set by enabling bit 3 of the crtc
    540    * register. 
     541   * register.
    541542   */
    542543  if (nBuffers == 3) tmp |= 0x08;
    543544  mcrxHALData.initSwapTiles = initMCRXSwapTiles;
    544545
    545   if (envVal = myGetenv("MRCX_71")) 
     546  if (envVal = myGetenv("MRCX_71"))
    546547    sscanf(envVal, "%x", &tmp);
    547548  CRTC_SET(0x70, tmp);
     
    562563#undef FN_NAME
    563564} /* initMCRXUseTiles */
    564  
     565
    565566
    566567/*-------------------------------------------------------------------
     
    572573
    573574  get information about MCRX
    574  
     575
    575576  Arguments:
    576577  info - pointer to info struct
    577  
     578
    578579  Return:
    579580  True if success, False if Failure
    580581  -------------------------------------------------------------------*/
    581 INITMCRXENTRY(initMCRXGetInfo,FxBool,(VG96Info *info)) 
     582INITMCRXENTRY(initMCRXGetInfo,FxBool,(VG96Info *info))
    582583{
    583584#define FN_NAME "initMCRXGetInfo"
     
    594595  /* Watcom warning suppression */
    595596  revString[0] = revString[0];
    596  
     597
    597598  info->vgaChip = 0;
    598599  info->vg96Rev = 0;
     
    600601  info->tfxRev  = 1;
    601602  info->tfxRam  = 2;
    602  
     603
    603604  info->vg96Ram = (0x100000 << mBytesPow);
    604605
    605606  GDBG_INFO((80, "%s: frame buffer has 0x%x bytes\n", FN_NAME, info->vg96Ram));
    606  
     607
    607608  return FXTRUE;
    608  
     609
    609610#undef FN_NAME
    610611} /* initMCRXGetInfo */
  • trunk/src/opengl/glide/sst1/init/init96/lindrvr.c

    r2885 r6653  
     1/* $Id: lindrvr.c,v 1.2 2001-09-05 14:31:03 bird Exp $ */
    12/*
    23** THIS SOFTWARE IS SUBJECT TO COPYRIGHT PROTECTION AND IS OFFERED ONLY
    34** PURSUANT TO THE 3DFX GLIDE GENERAL PUBLIC LICENSE. THERE IS NO RIGHT
    45** TO USE THE GLIDE TRADEMARK WITHOUT PRIOR WRITTEN PERMISSION OF 3DFX
    5 ** INTERACTIVE, INC. A COPY OF THIS LICENSE MAY BE OBTAINED FROM THE 
    6 ** DISTRIBUTOR OR BY CONTACTING 3DFX INTERACTIVE INC(info@3dfx.com). 
    7 ** THIS PROGRAM IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER 
     6** INTERACTIVE, INC. A COPY OF THIS LICENSE MAY BE OBTAINED FROM THE
     7** DISTRIBUTOR OR BY CONTACTING 3DFX INTERACTIVE INC(info@3dfx.com).
     8** THIS PROGRAM IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER
    89** EXPRESSED OR IMPLIED. SEE THE 3DFX GLIDE GENERAL PUBLIC LICENSE FOR A
    9 ** FULL TEXT OF THE NON-WARRANTY PROVISIONS. 
    10 ** 
     10** FULL TEXT OF THE NON-WARRANTY PROVISIONS.
     11**
    1112** USE, DUPLICATION OR DISCLOSURE BY THE GOVERNMENT IS SUBJECT TO
    1213** RESTRICTIONS AS SET FORTH IN SUBDIVISION (C)(1)(II) OF THE RIGHTS IN
     
    1415** AND/OR IN SIMILAR OR SUCCESSOR CLAUSES IN THE FAR, DOD OR NASA FAR
    1516** SUPPLEMENT. UNPUBLISHED RIGHTS RESERVED UNDER THE COPYRIGHT LAWS OF
    16 ** THE UNITED STATES. 
    17 ** 
     17** THE UNITED STATES.
     18**
    1819** COPYRIGHT 3DFX INTERACTIVE, INC. 1999, ALL RIGHTS RESERVED
    1920**
     
    5859
    5960#ifndef DUMMY
    60 static Display              *dpy        = 0;
    61 static int                  screenNum   = 0;
    62 static int                  screenWidth = 0;
    63 static void*                screenPhys  = 0;
    64 static int                  screenMem   = 0;
    65 static GC                   xgc         = 0;
     61static Display          *dpy    = 0;
     62static int          screenNum   = 0;
     63static int          screenWidth = 0;
     64static void*            screenPhys  = 0;
     65static int          screenMem   = 0;
     66static GC           xgc     = 0;
    6667static Window               hWndApp     = 0;
    67 static FxU32                Width       = 0; 
     68static FxU32                Width       = 0;
    6869static FxU32                Height      = 0;
    6970static FxBool               IsFullScreen = 0;
     
    155156  screenNum=XDefaultScreen(dpy);
    156157  XF86DGAGetVideoLL(dpy, screenNum, (int*)&screenPhys, &screenWidth, &banksize,
    157                     &screenMem);
     158            &screenMem);
    158159  screenMem*=1024;
    159160  return FXTRUE;
     
    168169}
    169170
    170 static int 
     171static int
    171172cvtXToGlideDesc(InitBufDesc_t *pDesc) {
    172173  InitBufDesc_t   *dFront  = &pDesc[0];
     
    200201    return ErrorMessage(hWndApp, "Couldn't get Backbuffer Info");
    201202  dBack->bufOffset -= dScreen->bufOffset;
    202  
     203
    203204  /* Get info about aux buffer (pixmap) */
    204205  dAux->bufType = INIT_BUFFER_AUXBUFFER;
    205   if (!cvtAddrToBufDesc(addrAux, dAux)) 
     206  if (!cvtAddrToBufDesc(addrAux, dAux))
    206207    return ErrorMessage(hWndApp, "Couldn't get AuxBuffer Info");
    207208  dAux->bufOffset -= dScreen->bufOffset;
    208  
     209
    209210  /* Get info about triple buffer (pixmap if used) */
    210211  if (tripleBuffering) {
     
    219220  dFifo->bufOffset = (int)addrFifo-dScreen->bufOffset;
    220221  dFifo->bufStride = FIFOSIZE;
    221  
     222
    222223  GDBG_INFO((80, "cvtXToGlideDesc: dFront->bufOffset = 0x%x\n", dFront->bufOffset));
    223224  GDBG_INFO((80, "cvtXToGlideDesc: dBack->bufOffset = 0x%x\n", dBack->bufOffset));
     
    269270
    270271static int
    271 doAllocPixmaps(int xRes, int yRes, int vRefresh, 
    272                       InitBufDesc_t *pDesc) {
    273     GDBG_INFO((80, "doAllocPixmaps: hWnd = %x, fs=%d, xRes=%d, yRes=%d, vRefresh=%d\n", 
     272doAllocPixmaps(int xRes, int yRes, int vRefresh,
     273              InitBufDesc_t *pDesc) {
     274    GDBG_INFO((80, "doAllocPixmaps: hWnd = %x, fs=%d, xRes=%d, yRes=%d, vRefresh=%d\n",
    274275             hWndApp, IsFullScreen, xRes, yRes, vRefresh));
    275276
     
    277278
    278279  pixFifo=XCreatePixmap(dpy, hWndApp, screenWidth,
    279                         (FIFOSIZE/2+4096+screenWidth-1)/screenWidth, 16);
     280            (FIFOSIZE/2+4096+screenWidth-1)/screenWidth, 16);
    280281  if ((XF86RushLockPixmap(dpy, screenNum, pixFifo, &addrFifo)==FXFALSE)
    281282      || !addrFifo) {
     
    289290  pixBack=XCreatePixmap(dpy, hWndApp, xRes, yRes, 16);
    290291  if ((XF86RushLockPixmap(dpy, screenNum, pixBack,
    291                           &addrBack)==FXFALSE) || !addrBack) {
     292              &addrBack)==FXFALSE) || !addrBack) {
    292293    doReleasePixmaps();
    293294    return ErrorMessage(hWndApp, "Failed to lock back pixmap\n");
     
    295296  pixAux=XCreatePixmap(dpy, hWndApp, xRes, yRes, 16);
    296297  if ((XF86RushLockPixmap(dpy, screenNum, pixAux,
    297                           &addrAux)==FXFALSE) || !addrAux) {
     298              &addrAux)==FXFALSE) || !addrAux) {
    298299    doReleasePixmaps();
    299300    return ErrorMessage(hWndApp, "Failed to lock aux pixmap\n");
     
    302303    pixTriple=XCreatePixmap(dpy, hWndApp, xRes, yRes, 16);
    303304    if ((XF86RushLockPixmap(dpy, screenNum, pixTriple,
    304                             &addrTriple)==FXFALSE) || !addrTriple) {
     305                &addrTriple)==FXFALSE) || !addrTriple) {
    305306      doReleasePixmaps();
    306307      return ErrorMessage(hWndApp, "Failed to lock triple pixmap\n");
     
    311312}
    312313
    313 static FxBool 
     314static FxBool
    314315getWindowSize(int *width, int *height) {
    315316    XWindowAttributes attr;
     
    351352
    352353    /*
    353      * Get ourselves a valid window handle 
     354     * Get ourselves a valid window handle
    354355     */
    355356    hWndApp = (Window)hWindow;
     
    374375
    375376    if ((sRes <  GR_RESOLUTION_320x200) ||
    376         (sRes >  GR_RESOLUTION_512x256)) 
     377        (sRes >  GR_RESOLUTION_512x256))
    377378      return ErrorMessage(hWndApp, "Bad Fullscreen resolution");
    378379
     
    389390      return ErrorMessage(hWndApp, "Screen depth must be 16\n");
    390391    if (XF86DGAQueryDirectVideo(dpy, DefaultScreen(dpy), &flags)==False ||
    391         !flags) {
     392    !flags) {
    392393      GDBG_INFO((0, "Could query Direct Video"));
    393394      return ErrorMessage(hWndApp, "Direct video not supported\n");
    394395    }
    395396    if (XF86VidModeGetAllModeLines(dpy, DefaultScreen(dpy), &numModes,
    396                                    &vidModes)==False) {
     397                   &vidModes)==False) {
    397398      return ErrorMessage(hWndApp, "Couldn't query vidmode list\n");
    398399      return 1;
     
    400401    for (i=0; i<numModes; i++)
    401402      if ((vidModes[i]->hdisplay==Width) && (vidModes[i]->vdisplay==Height))
    402         break;
     403    break;
    403404    if (i==numModes) {
    404405      return ErrorMessage(hWndApp, "Server doesn't support requested resolution\n");
    405406      if (vidModes) {
    406         XFree(vidModes);
    407         vidModes=0;
     407    XFree(vidModes);
     408    vidModes=0;
    408409      }
    409410      return 1;
     
    429430    GDBG_INFO((80, "\tbufType = 0x%x\n", pBufDesc[i].bufType));
    430431    GDBG_INFO((80, "\tbufOffset = 0x%x\n", pBufDesc[i].bufOffset));
    431     GDBG_INFO((80, "\tbufStride = 0x%x\n", pBufDesc[i].bufStride));   
     432    GDBG_INFO((80, "\tbufStride = 0x%x\n", pBufDesc[i].bufStride));
    432433    GDBG_INFO((80, "\tbufBPP = 0x%x\n", pBufDesc[i].bufBPP));
    433434  }
     
    450451
    451452  if ( curHALData->initSetVideo ) {
    452     curHALData->initSetVideo( sRes, vRefresh, 
     453    curHALData->initSetVideo( sRes, vRefresh,
    453454                             (FxU32*)width, (FxU32*)height );
    454455  }
     
    463464{
    464465  int     i, w, h;
    465  
     466
    466467  GDBG_INFO((80, "linControl: code = %d\n", code));
    467468
     
    472473    getWindowSize(&w, &h);
    473474    if ((Width != w) || (Height != h)) {
    474       GDBG_INFO((120, "W and H changed to %d %d\n", 
    475                  Width, Height)); 
     475      GDBG_INFO((120, "W and H changed to %d %d\n",
     476                 Width, Height));
    476477
    477478      if (!doAllocPixmaps(w, h, 0, BufDesc)) {
    478         w=Width;
    479         h=Height;
    480         if (!doAllocPixmaps(w, h, 0, BufDesc)) {
    481           /* ErrorMessage(hWndApp, "linControl: Resize failed\n"); */
    482           return FXFALSE;
    483         }
     479    w=Width;
     480    h=Height;
     481    if (!doAllocPixmaps(w, h, 0, BufDesc)) {
     482      /* ErrorMessage(hWndApp, "linControl: Resize failed\n"); */
     483      return FXFALSE;
     484    }
    484485      }
    485486      Width = w;
     
    512513  GDBG_INFO((80, "linControl: code = %d, w = %d, h = %d\n", code,
    513514             Width, Height));
    514  
     515
    515516  return FXTRUE;
    516517} /* linControl */
  • trunk/src/opengl/glide/sst1/init/initvg/dac.c

    r2885 r6653  
     1/* $Id: dac.c,v 1.2 2001-09-05 14:31:03 bird Exp $ */
    12/*
    23** THIS SOFTWARE IS SUBJECT TO COPYRIGHT PROTECTION AND IS OFFERED ONLY
    34** PURSUANT TO THE 3DFX GLIDE GENERAL PUBLIC LICENSE. THERE IS NO RIGHT
    45** TO USE THE GLIDE TRADEMARK WITHOUT PRIOR WRITTEN PERMISSION OF 3DFX
    5 ** INTERACTIVE, INC. A COPY OF THIS LICENSE MAY BE OBTAINED FROM THE 
    6 ** DISTRIBUTOR OR BY CONTACTING 3DFX INTERACTIVE INC(info@3dfx.com). 
    7 ** THIS PROGRAM IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER 
     6** INTERACTIVE, INC. A COPY OF THIS LICENSE MAY BE OBTAINED FROM THE
     7** DISTRIBUTOR OR BY CONTACTING 3DFX INTERACTIVE INC(info@3dfx.com).
     8** THIS PROGRAM IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER
    89** EXPRESSED OR IMPLIED. SEE THE 3DFX GLIDE GENERAL PUBLIC LICENSE FOR A
    9 ** FULL TEXT OF THE NON-WARRANTY PROVISIONS. 
    10 ** 
     10** FULL TEXT OF THE NON-WARRANTY PROVISIONS.
     11**
    1112** USE, DUPLICATION OR DISCLOSURE BY THE GOVERNMENT IS SUBJECT TO
    1213** RESTRICTIONS AS SET FORTH IN SUBDIVISION (C)(1)(II) OF THE RIGHTS IN
     
    1415** AND/OR IN SIMILAR OR SUCCESSOR CLAUSES IN THE FAR, DOD OR NASA FAR
    1516** SUPPLEMENT. UNPUBLISHED RIGHTS RESERVED UNDER THE COPYRIGHT LAWS OF
    16 ** THE UNITED STATES. 
    17 ** 
     17** THE UNITED STATES.
     18**
    1819** COPYRIGHT 3DFX INTERACTIVE, INC. 1999, ALL RIGHTS RESERVED
    1920**
    2021**
    21 ** $Revision: 1.1 $
    22 ** $Date: 2000-02-25 00:31:32 $
     22** $Revision: 1.2 $
     23** $Date: 2001-09-05 14:31:03 $
    2324**
    2425** Initialization code for initializing supported SST-1 DACs
     
    3940**  Read external DAC registers
    4041**  NOTE: The video unit of FBI must be in reset before calling this routine.
    41 **        The rendering engines of FBI and TREX must be idle before calling 
     42**        The rendering engines of FBI and TREX must be idle before calling
    4243**        this routine.
    4344**        fbiInit23 register remapping (PCI config. initEnable[2]=1) must be
     
    7273**  Write to external DAC registers
    7374**  NOTE: The video unit of FBI must be in reset before calling this routine.
    74 **        The rendering engines of FBI and TREX must be idle before calling 
     75**        The rendering engines of FBI and TREX must be idle before calling
    7576**        this routine.
    7677**
     
    591592    {
    592593        float calc;
    593        
     594
    594595        calc = ((float) 14.318 * (float) (m + 2)) /
    595596            ((float) (n + 2) * vcoFreqDivide);
  • trunk/src/opengl/glide/sst1/init/initvg/gamma.c

    r2885 r6653  
     1/* $Id: gamma.c,v 1.2 2001-09-05 14:31:04 bird Exp $ */
    12/*
    23** THIS SOFTWARE IS SUBJECT TO COPYRIGHT PROTECTION AND IS OFFERED ONLY
    34** PURSUANT TO THE 3DFX GLIDE GENERAL PUBLIC LICENSE. THERE IS NO RIGHT
    45** TO USE THE GLIDE TRADEMARK WITHOUT PRIOR WRITTEN PERMISSION OF 3DFX
    5 ** INTERACTIVE, INC. A COPY OF THIS LICENSE MAY BE OBTAINED FROM THE 
    6 ** DISTRIBUTOR OR BY CONTACTING 3DFX INTERACTIVE INC(info@3dfx.com). 
    7 ** THIS PROGRAM IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER 
     6** INTERACTIVE, INC. A COPY OF THIS LICENSE MAY BE OBTAINED FROM THE
     7** DISTRIBUTOR OR BY CONTACTING 3DFX INTERACTIVE INC(info@3dfx.com).
     8** THIS PROGRAM IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER
    89** EXPRESSED OR IMPLIED. SEE THE 3DFX GLIDE GENERAL PUBLIC LICENSE FOR A
    9 ** FULL TEXT OF THE NON-WARRANTY PROVISIONS. 
    10 ** 
     10** FULL TEXT OF THE NON-WARRANTY PROVISIONS.
     11**
    1112** USE, DUPLICATION OR DISCLOSURE BY THE GOVERNMENT IS SUBJECT TO
    1213** RESTRICTIONS AS SET FORTH IN SUBDIVISION (C)(1)(II) OF THE RIGHTS IN
     
    1415** AND/OR IN SIMILAR OR SUCCESSOR CLAUSES IN THE FAR, DOD OR NASA FAR
    1516** SUPPLEMENT. UNPUBLISHED RIGHTS RESERVED UNDER THE COPYRIGHT LAWS OF
    16 ** THE UNITED STATES. 
    17 ** 
     17** THE UNITED STATES.
     18**
    1819** COPYRIGHT 3DFX INTERACTIVE, INC. 1999, ALL RIGHTS RESERVED
    1920**
    2021**
    21 ** $Revision: 1.1 $
    22 ** $Date: 2000-02-25 00:31:33 $
     22** $Revision: 1.2 $
     23** $Date: 2001-09-05 14:31:04 $
    2324**
    2425** Initialization code for loading SST-1 gamma tables
     
    132133        else
    133134            sstVideoIsReset = FXFALSE;
    134    
     135
    135136        ISET(sst->fbiInit1, IGET(sst->fbiInit1) & ~SST_VIDEO_RESET);
    136137        /* wait for video reset to be deasserted */
     
    147148        FxU32 gcG = gammaTableG[(x<<3)];
    148149        FxU32 gcB = gammaTableB[(x<<3)];
    149         ISET(sst->clutData, ((x<<SST_CLUTDATA_INDEX_SHIFT) | 
     150        ISET(sst->clutData, ((x<<SST_CLUTDATA_INDEX_SHIFT) |
    150151                         (gcR<<SST_CLUTDATA_RED_SHIFT) |
    151152                         (gcG<<SST_CLUTDATA_GREEN_SHIFT) |
     
    173174}
    174175
    175 FX_EXPORT FxBool FX_CSTYLE sst1InitGammaTable(FxU32 *sstbase, FxU32 nentries, 
     176FX_EXPORT FxBool FX_CSTYLE sst1InitGammaTable(FxU32 *sstbase, FxU32 nentries,
    176177FxU32 *r, FxU32 *g, FxU32 *b)
    177178{
     
    213214        else
    214215            sstVideoIsReset = FXFALSE;
    215    
     216
    216217        ISET(sst->fbiInit1, IGET(sst->fbiInit1) & ~SST_VIDEO_RESET);
    217218        /* wait for video reset to be deasserted */
     
    228229        FxU32 gcG = gammaTableG[(x<<3)];
    229230        FxU32 gcB = gammaTableB[(x<<3)];
    230         ISET(sst->clutData, ((x<<SST_CLUTDATA_INDEX_SHIFT) | 
     231        ISET(sst->clutData, ((x<<SST_CLUTDATA_INDEX_SHIFT) |
    231232                         (gcR<<SST_CLUTDATA_RED_SHIFT) |
    232233                         (gcG<<SST_CLUTDATA_GREEN_SHIFT) |
  • trunk/src/opengl/glide/sst1/init/initvg/gdebug.c

    r2885 r6653  
     1/* $Id: gdebug.c,v 1.2 2001-09-05 14:31:04 bird Exp $ */
    12/*
    23** THIS SOFTWARE IS SUBJECT TO COPYRIGHT PROTECTION AND IS OFFERED ONLY
    34** PURSUANT TO THE 3DFX GLIDE GENERAL PUBLIC LICENSE. THERE IS NO RIGHT
    45** TO USE THE GLIDE TRADEMARK WITHOUT PRIOR WRITTEN PERMISSION OF 3DFX
    5 ** INTERACTIVE, INC. A COPY OF THIS LICENSE MAY BE OBTAINED FROM THE 
    6 ** DISTRIBUTOR OR BY CONTACTING 3DFX INTERACTIVE INC(info@3dfx.com). 
    7 ** THIS PROGRAM IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER 
     6** INTERACTIVE, INC. A COPY OF THIS LICENSE MAY BE OBTAINED FROM THE
     7** DISTRIBUTOR OR BY CONTACTING 3DFX INTERACTIVE INC(info@3dfx.com).
     8** THIS PROGRAM IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER
    89** EXPRESSED OR IMPLIED. SEE THE 3DFX GLIDE GENERAL PUBLIC LICENSE FOR A
    9 ** FULL TEXT OF THE NON-WARRANTY PROVISIONS. 
    10 ** 
     10** FULL TEXT OF THE NON-WARRANTY PROVISIONS.
     11**
    1112** USE, DUPLICATION OR DISCLOSURE BY THE GOVERNMENT IS SUBJECT TO
    1213** RESTRICTIONS AS SET FORTH IN SUBDIVISION (C)(1)(II) OF THE RIGHTS IN
     
    1415** AND/OR IN SIMILAR OR SUCCESSOR CLAUSES IN THE FAR, DOD OR NASA FAR
    1516** SUPPLEMENT. UNPUBLISHED RIGHTS RESERVED UNDER THE COPYRIGHT LAWS OF
    16 ** THE UNITED STATES. 
    17 ** 
     17** THE UNITED STATES.
     18**
    1819** COPYRIGHT 3DFX INTERACTIVE, INC. 1999, ALL RIGHTS RESERVED
    1920**
    20 ** $Revision: 1.1 $
    21 ** $Date: 2000-02-25 00:31:33 $
     21** $Revision: 1.2 $
     22** $Date: 2001-09-05 14:31:04 $
    2223*/
    2324
     
    104105    /* I can't init gdbg_msgfile to stdout since it isn't constant so
    105106     * I do it now */
    106     gdbg_msgfile = stdout;   
     107    gdbg_msgfile = stdout;
    107108
    108109    done = 1;
     
    132133gdbg_vprintf (const char *format,va_list args)
    133134{
    134  
     135
    135136    if (gdbg_msgfile != NULL) {
    136137        if (!UseDebugString) {
     
    138139            vfprintf(gdbg_msgfile,format,args);
    139140
    140             fflush(gdbg_msgfile);   
    141         } 
     141            fflush(gdbg_msgfile);
     142        }
    142143#ifdef __WIN32__
    143144        else {
     
    262263        if (outf) gdbg_msgfile = outf;
    263264        return outf != NULL;
    264     } 
    265 }
     265    }
     266}
  • trunk/src/opengl/glide/sst1/init/initvg/info.c

    r2885 r6653  
     1/* $Id: info.c,v 1.2 2001-09-05 14:31:04 bird Exp $ */
    12/*
    23** THIS SOFTWARE IS SUBJECT TO COPYRIGHT PROTECTION AND IS OFFERED ONLY
    34** PURSUANT TO THE 3DFX GLIDE GENERAL PUBLIC LICENSE. THERE IS NO RIGHT
    45** TO USE THE GLIDE TRADEMARK WITHOUT PRIOR WRITTEN PERMISSION OF 3DFX
    5 ** INTERACTIVE, INC. A COPY OF THIS LICENSE MAY BE OBTAINED FROM THE 
    6 ** DISTRIBUTOR OR BY CONTACTING 3DFX INTERACTIVE INC(info@3dfx.com). 
    7 ** THIS PROGRAM IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER 
     6** INTERACTIVE, INC. A COPY OF THIS LICENSE MAY BE OBTAINED FROM THE
     7** DISTRIBUTOR OR BY CONTACTING 3DFX INTERACTIVE INC(info@3dfx.com).
     8** THIS PROGRAM IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER
    89** EXPRESSED OR IMPLIED. SEE THE 3DFX GLIDE GENERAL PUBLIC LICENSE FOR A
    9 ** FULL TEXT OF THE NON-WARRANTY PROVISIONS. 
    10 ** 
     10** FULL TEXT OF THE NON-WARRANTY PROVISIONS.
     11**
    1112** USE, DUPLICATION OR DISCLOSURE BY THE GOVERNMENT IS SUBJECT TO
    1213** RESTRICTIONS AS SET FORTH IN SUBDIVISION (C)(1)(II) OF THE RIGHTS IN
     
    1415** AND/OR IN SIMILAR OR SUCCESSOR CLAUSES IN THE FAR, DOD OR NASA FAR
    1516** SUPPLEMENT. UNPUBLISHED RIGHTS RESERVED UNDER THE COPYRIGHT LAWS OF
    16 ** THE UNITED STATES. 
    17 ** 
     17** THE UNITED STATES.
     18**
    1819** COPYRIGHT 3DFX INTERACTIVE, INC. 1999, ALL RIGHTS RESERVED
    1920**
    2021**
    21 ** $Revision: 1.1 $
    22 ** $Date: 2000-02-25 00:31:33 $
     22** $Revision: 1.2 $
     23** $Date: 2001-09-05 14:31:04 $
    2324**
    2425** Routines to detect memory size, strapping pin, and other initialization
     
    3738#define XY_ONE (1<<SST_XY_FRACBITS)
    3839
    39 static FxBool 
    40 readAndSum4x4(FxU32 *sstbase, FxU32 x, FxU32 y, 
    41                 FxU32 *r_sum, FxU32 *g_sum, FxU32 *b_sum)
     40static FxBool
     41readAndSum4x4(FxU32 *sstbase, FxU32 x, FxU32 y,
     42            FxU32 *r_sum, FxU32 *g_sum, FxU32 *b_sum)
    4243{
    4344    FxU32 rd_x, rd_y;
     
    5051    sst1InitIdle(sstbase);
    5152    if (x & 1) {
    52         INIT_PRINTF(("ERROR: readAndSum4x4 must have an even X (%d)\n", x));
    53         return(FXFALSE);
     53    INIT_PRINTF(("ERROR: readAndSum4x4 must have an even X (%d)\n", x));
     54    return(FXFALSE);
    5455    }
    5556
     
    5960    *b_sum = 0;
    6061
    61     for (rd_y = 0; rd_y < 4; rd_y++) {          /* read 4 scanlines */
    62         for (rd_x = 0; rd_x < 4; rd_x ++) {
    63             if ((rd_x & 1)==0) {                /* read 2 pixels at a time */
    64                 rd_col =
    65                   IGET(sstbase[(SST_LFB_ADDR + (y+rd_y)*2048 + (x+rd_x)*2) >> 2]);
    66             }
    67             else rd_col >>= 16;
    68             rd_r = ((rd_col >> 11) & 0x1f) << 3;
    69             rd_g = ((rd_col >>  5) & 0x3f) << 2;
    70             rd_b = ((rd_col >>  0) & 0x1f) << 3;
    71             *r_sum += rd_r;
    72             *g_sum += rd_g;
    73             *b_sum += rd_b;
    74             INIT_INFO((4,"%d,%d = rd_col: 0x%04x   rgb: %02x %02x %02x\n",
    75                     rd_x, rd_y, (rd_col & 0xffff), rd_r, rd_g, rd_b));
    76         }
     62    for (rd_y = 0; rd_y < 4; rd_y++) {      /* read 4 scanlines */
     63    for (rd_x = 0; rd_x < 4; rd_x ++) {
     64        if ((rd_x & 1)==0) {        /* read 2 pixels at a time */
     65        rd_col =
     66          IGET(sstbase[(SST_LFB_ADDR + (y+rd_y)*2048 + (x+rd_x)*2) >> 2]);
     67        }
     68        else rd_col >>= 16;
     69        rd_r = ((rd_col >> 11) & 0x1f) << 3;
     70        rd_g = ((rd_col >>  5) & 0x3f) << 2;
     71        rd_b = ((rd_col >>  0) & 0x1f) << 3;
     72        *r_sum += rd_r;
     73        *g_sum += rd_g;
     74        *b_sum += rd_b;
     75        INIT_INFO((4,"%d,%d = rd_col: 0x%04x   rgb: %02x %02x %02x\n",
     76            rd_x, rd_y, (rd_col & 0xffff), rd_r, rd_g, rd_b));
     77    }
    7778    }
    7879    INIT_INFO((3,"sums:  r_sum=0x%03x  g_sum=0x%03x  b_sum=0x%03x\n",
    79                     *r_sum, *g_sum, *b_sum));
    80         return(FXTRUE);
     80            *r_sum, *g_sum, *b_sum));
     81    return(FXTRUE);
    8182}
    8283
     
    117118    /* init sum array */
    118119    for (r_sum = 0; r_sum <= 0xfff; r_sum++) {
    119         rb_tbl[r_sum] = -1;
    120         g_tbl[r_sum] = -1;
     120    rb_tbl[r_sum] = -1;
     121    g_tbl[r_sum] = -1;
    121122    }
    122123
     
    126127    /* fill sum array */
    127128    for (tst_color = 0; tst_color <= 255; tst_color++) {
    128         INIT_INFO((2,"tst_color=0x%02x\n", tst_color));
    129         ISET(sst->c1, (tst_color << 16) | (tst_color << 8) | tst_color);
    130 
    131         drawTriangle(sst, x,y,36);
    132         if(readAndSum4x4(sstbase, x,y, &r_sum,&g_sum,&b_sum) == FXFALSE)
    133                 return(FXFALSE);
    134 
    135         /* check sums for uniqueness and then store away */
    136         if (r_sum != b_sum) {
    137             INIT_PRINTF(("ERROR:  b_sum=0x%03x  r_sum=0x%03x\n", r_sum, b_sum));
    138                 return(FXFALSE);
    139         }
    140         if (rb_tbl[r_sum] != -1) {
    141             INIT_PRINTF(("ERROR:  non-unique r/b_sum=0x%03x\n", r_sum));
    142                 return(FXFALSE);
    143         }
    144         rb_tbl[r_sum] = tst_color;
    145         if (g_tbl[g_sum] != -1) {
    146             INIT_PRINTF(("ERROR:  non-unique g_sum=0x%03x\n", g_sum));
    147                 return(FXFALSE);
    148         }
    149         g_tbl[g_sum] = tst_color;
    150     }
    151         return(FXTRUE);
     129    INIT_INFO((2,"tst_color=0x%02x\n", tst_color));
     130    ISET(sst->c1, (tst_color << 16) | (tst_color << 8) | tst_color);
     131
     132    drawTriangle(sst, x,y,36);
     133    if(readAndSum4x4(sstbase, x,y, &r_sum,&g_sum,&b_sum) == FXFALSE)
     134        return(FXFALSE);
     135
     136    /* check sums for uniqueness and then store away */
     137    if (r_sum != b_sum) {
     138        INIT_PRINTF(("ERROR:  b_sum=0x%03x  r_sum=0x%03x\n", r_sum, b_sum));
     139        return(FXFALSE);
     140    }
     141    if (rb_tbl[r_sum] != -1) {
     142        INIT_PRINTF(("ERROR:  non-unique r/b_sum=0x%03x\n", r_sum));
     143        return(FXFALSE);
     144    }
     145    rb_tbl[r_sum] = tst_color;
     146    if (g_tbl[g_sum] != -1) {
     147        INIT_PRINTF(("ERROR:  non-unique g_sum=0x%03x\n", g_sum));
     148        return(FXFALSE);
     149    }
     150    g_tbl[g_sum] = tst_color;
     151    }
     152    return(FXTRUE);
    152153}
    153154
     
    158159    if (rb_tbl[r_sum] == -1 || g_tbl[g_sum] == -1 || rb_tbl[b_sum] == -1)
    159160    {
    160         INIT_PRINTF(("ERROR: unDither: invalid color sum\n"));
    161         return(FXFALSE);
     161    INIT_PRINTF(("ERROR: unDither: invalid color sum\n"));
     162    return(FXFALSE);
    162163    }
    163164    *result = (rb_tbl[r_sum] << 16) | (g_tbl[g_sum] << 8) | rb_tbl[b_sum];
    164         return(FXTRUE);
     165    return(FXTRUE);
    165166}
    166167
     
    179180    /* render into the frame buffer */
    180181    ISET(sst->fbzColorPath,
    181           SST_RGBSEL_TREXOUT | SST_CC_PASS | SST_ENTEXTUREMAP);
     182      SST_RGBSEL_TREXOUT | SST_CC_PASS | SST_ENTEXTUREMAP);
    182183    ISET(sst->texBaseAddr, 0);
    183184    ISET(sst->textureMode, SST_AI88 | SST_TC_PASS | SST_TCA_PASS);
     
    187188    readAndSum4x4(sstbase, x,y, &r_sum,&g_sum,&b_sum);
    188189    if(unDither(r_sum,g_sum,b_sum,&info->tmuConfig) == FXFALSE)
    189                 return(FXFALSE);
    190         if(GETENV(("SST_TMUCFG")))
     190        return(FXFALSE);
     191    if(GETENV(("SST_TMUCFG")))
    191192        SSCANF(GETENV(("SST_TMUCFG")), "%i", &info->tmuConfig);
    192193
     
    196197    ISET(SST_TREX(sst,2)->trexInit1, info->tmuInit1[2]);
    197198
    198         return(FXTRUE);
     199    return(FXTRUE);
    199200}
    200201
     
    204205
    205206static FxU32 sense(FxU32 *sstbase, sst1DeviceInfoStruct *info, FxU32 tmu,
    206                    FxU32 mem, FxU32 init)
     207           FxU32 mem, FxU32 init)
    207208{
    208209    volatile Sstregs *sst = (Sstregs *) sstbase;
     
    214215    sst1InitIdle(sstbase);
    215216
    216     ISET(sst->texBaseAddr, 0x200000>>3);        /* set to 2 MB */
    217     texAddr[0] = SENSE2;                /* write a random value */
    218     ISET(sst->texBaseAddr, 0x100000>>3);        /* set to 1 MB */
    219     texAddr[0] = SENSE1;                /* write a random value */
    220     ISET(sst->texBaseAddr, 0x000000>>3);        /* set to 0 MB */
    221     texAddr[0] = SENSE0;                /* write a random value */
    222 
    223     ISET(sst->texBaseAddr, mem>>3);             /* reset to 2 MB */
    224     drawTriangle(sst,0,0,4);            /* draw a 4x4 right triangle */
     217    ISET(sst->texBaseAddr, 0x200000>>3);    /* set to 2 MB */
     218    texAddr[0] = SENSE2;        /* write a random value */
     219    ISET(sst->texBaseAddr, 0x100000>>3);    /* set to 1 MB */
     220    texAddr[0] = SENSE1;        /* write a random value */
     221    ISET(sst->texBaseAddr, 0x000000>>3);    /* set to 0 MB */
     222    texAddr[0] = SENSE0;        /* write a random value */
     223
     224    ISET(sst->texBaseAddr, mem>>3);     /* reset to 2 MB */
     225    drawTriangle(sst,0,0,4);        /* draw a 4x4 right triangle */
    225226    sst1InitIdle(sstbase);
    226227
     
    237238FX_EXPORT FxBool FX_CSTYLE
    238239sst1InitGetTmuMemory(FxU32 *sstbase, sst1DeviceInfoStruct *info, FxU32 tmu,
    239         FxU32 *TmuMemorySize)
     240    FxU32 *TmuMemorySize)
    240241{
    241242    FxU32 i,data;
     
    244245    INIT_INFO((1,"sst1InitGetTmuMemory(0x%x, , %d)\n", sstbase,tmu));
    245246
    246         if(GETENV(("SST_TMUMEM_SIZE"))) {
    247                 *TmuMemorySize = ATOI(GETENV(("SST_TMUMEM_SIZE")));
    248                 return(FXTRUE);
    249         }
     247    if(GETENV(("SST_TMUMEM_SIZE"))) {
     248        *TmuMemorySize = ATOI(GETENV(("SST_TMUMEM_SIZE")));
     249        return(FXTRUE);
     250    }
    250251
    251252    ISET(sst->lfbMode, SST_LFB_RGBALANES_ARGB | SST_LFB_READFRONTBUFFER);
    252253    ISET(sst->fbzMode, SST_DRAWBUFFER_FRONT | SST_RGBWRMASK);
    253254    ISET(sst->fbzColorPath,
    254           SST_RGBSEL_TREXOUT | SST_CC_PASS | SST_ENTEXTUREMAP);
     255      SST_RGBSEL_TREXOUT | SST_CC_PASS | SST_ENTEXTUREMAP);
    255256    ISET(sst->textureMode, SST_RGB565 | SST_TC_REPLACE | SST_TCA_REPLACE);
    256257    ISET(sst->tLOD, 0);
     
    258259    /* setup all downstream TMUs to be in pass-thru mode */
    259260    for (i=0; i<tmu; i++)
    260         ISET(SST_TREX(sst,i)->textureMode, SST_TC_PASS | SST_TCA_PASS);
     261    ISET(SST_TREX(sst,i)->textureMode, SST_TC_PASS | SST_TCA_PASS);
    261262
    262263    /* first see if we have 4 Mbytes by writing a texel at 2MB followed by
     
    278279
    279280    INIT_PRINTF(("sst1InitGetTmuMemory() ERROR: Could not detect memory size.\n"));
    280         return(FXFALSE);
     281    return(FXFALSE);
    281282}
    282283
    283284/*---------------------------------------------------------------------------
    284285   NOTES:
    285         assumes that board and registers are initialized
    286         destroys part of the framebuffer
     286    assumes that board and registers are initialized
     287    destroys part of the framebuffer
    287288  ---------------------------------------------------------------------------*/
    288289FX_EXPORT FxBool FX_CSTYLE
     
    292293
    293294    if(initSumTables(sstbase) == FXFALSE)
    294                 return(FXFALSE);
     295        return(FXFALSE);
    295296    if(getTmuConfigData(sstbase,info) == FXFALSE)
    296                 return(FXFALSE);
    297 
    298         /* TMU memory speed */
    299         /* tmuClkFixed is no longer used... */
    300         info->tmuClkFixed = 0x0;
    301         /* tmuMemSpeed is legacy, and is not used by either Obsidian GE or Pro Fab */
    302         info->tmuMemSpeed = 0;
     297        return(FXFALSE);
     298
     299    /* TMU memory speed */
     300    /* tmuClkFixed is no longer used... */
     301    info->tmuClkFixed = 0x0;
     302    /* tmuMemSpeed is legacy, and is not used by either Obsidian GE or Pro Fab */
     303    info->tmuMemSpeed = 0;
    303304
    304305    /* count the TMUs and verify that all TMUs are the same revision */
     
    306307    info->numberTmus = 1;
    307308    if(sst1InitGetTmuMemory(sstbase, info, 0, &info->tmuMemSize[0]) == FXFALSE)
    308                 return(FXFALSE);
     309        return(FXFALSE);
    309310    INIT_INFO((1,"TMU0 memory = %d MB\n", info->tmuMemSize[0]));
    310     if (info->tmuConfig & FXBIT(6)) {           /* if TMU 1 exists */
    311         info->numberTmus++;                     /* increment TMU count */
    312         trev = (info->tmuConfig>>7) & 0x7;      /* get its revision */
    313         if (info->tmuRevision != trev) {
    314             INIT_PRINTF(("sst1InitGetDeviceInfo: ERROR, multiple different TMU revision IDs detected\n"));
    315             return(FXFALSE);
    316         }
     311    if (info->tmuConfig & FXBIT(6)) {       /* if TMU 1 exists */
     312    info->numberTmus++;         /* increment TMU count */
     313    trev = (info->tmuConfig>>7) & 0x7;  /* get its revision */
     314    if (info->tmuRevision != trev) {
     315        INIT_PRINTF(("sst1InitGetDeviceInfo: ERROR, multiple different TMU revision IDs detected\n"));
     316        return(FXFALSE);
     317    }
    317318    if(sst1InitGetTmuMemory(sstbase, info, 1, &info->tmuMemSize[1]) == FXFALSE)
    318                 return(FXFALSE);
    319     }
    320     if (info->tmuConfig & FXBIT(13)) {          /* if TMU 2 exists */
    321         info->numberTmus++;                     /* increment TMU count */
    322         trev = (info->tmuConfig>>14) & 0x7;     /* get its revision */
    323         if (info->tmuRevision != trev) {
    324             INIT_PRINTF(("sst1InitGetDeviceInfo: ERROR, multiple different TMU revision IDs detected\n"));
    325             return(FXFALSE);
    326         }
     319        return(FXFALSE);
     320    }
     321    if (info->tmuConfig & FXBIT(13)) {      /* if TMU 2 exists */
     322    info->numberTmus++;         /* increment TMU count */
     323    trev = (info->tmuConfig>>14) & 0x7; /* get its revision */
     324    if (info->tmuRevision != trev) {
     325        INIT_PRINTF(("sst1InitGetDeviceInfo: ERROR, multiple different TMU revision IDs detected\n"));
     326        return(FXFALSE);
     327    }
    327328    if(sst1InitGetTmuMemory(sstbase, info, 2, &info->tmuMemSize[2]) == FXFALSE)
    328                 return(FXFALSE);
     329        return(FXFALSE);
    329330    }
    330331    INIT_INFO((1,"numberTMus = %d\n", info->numberTmus));
     
    339340**
    340341*/
    341 #define LFB_PUTPIXEL(X, Y, DATA)        \
    342         ISET(lfbptr[((SST_LFB_ADDR+(X<<1)+(Y<<11))>>1)], DATA)
    343 #define LFB_GETPIXEL(X, Y)                      \
    344         IGET(lfbptr[((SST_LFB_ADDR+(X<<1)+(Y<<11))>>1)])
     342#define LFB_PUTPIXEL(X, Y, DATA)    \
     343    ISET(lfbptr[((SST_LFB_ADDR+(X<<1)+(Y<<11))>>1)], DATA)
     344#define LFB_GETPIXEL(X, Y)          \
     345    IGET(lfbptr[((SST_LFB_ADDR+(X<<1)+(Y<<11))>>1)])
    345346
    346347static int fbiMemSize(FxU32 *sstbase)
    347348{
    348         volatile Sstregs *sst = (Sstregs *) sstbase;
    349         volatile unsigned short *lfbptr = (unsigned short *) sstbase;
    350         FxU32 init0Save = IGET(sst->fbiInit0);
    351         FxU32 init1Save = IGET(sst->fbiInit1);
    352         FxU32 init2Save = IGET(sst->fbiInit2);
    353         int retval = 0;
    354 
    355         if(GETENV(("SST_FBIMEM_SIZE")))
    356                 return(ATOI(GETENV(("SST_FBIMEM_SIZE"))));
    357 
    358         /* Enable dram refresh, disable memory fifo, and setup memory */
    359         /* for rendering */
    360         ISET(sst->fbiInit0, IGET(sst->fbiInit0) & ~SST_MEM_FIFO_EN);
     349    volatile Sstregs *sst = (Sstregs *) sstbase;
     350    volatile unsigned short *lfbptr = (unsigned short *) sstbase;
     351    FxU32 init0Save = IGET(sst->fbiInit0);
     352    FxU32 init1Save = IGET(sst->fbiInit1);
     353    FxU32 init2Save = IGET(sst->fbiInit2);
     354    int retval = 0;
     355
     356    if(GETENV(("SST_FBIMEM_SIZE")))
     357        return(ATOI(GETENV(("SST_FBIMEM_SIZE"))));
     358
     359    /* Enable dram refresh, disable memory fifo, and setup memory */
     360    /* for rendering */
     361    ISET(sst->fbiInit0, IGET(sst->fbiInit0) & ~SST_MEM_FIFO_EN);
    361362    ISET(sst->fbiInit2, IGET(sst->fbiInit2) | SST_EN_DRAM_REFRESH);
    362         sst1InitIdleFBI(sstbase);
    363 
    364         /* Setup Basic rendering datapath */
    365         ISET(sst->fbzColorPath, SST_CC_MONE);
    366         ISET(sst->fogMode, 0x0);
    367         ISET(sst->fbzMode, SST_RGBWRMASK | SST_ZAWRMASK | SST_DRAWBUFFER_FRONT);
    368         sst1InitIdleFBI(sstbase);
    369 
    370         if(sst1InitSliDetect(sstbase))
    371                 /* SLI cannot support 4 MBytes... */
    372                 goto check2MByte;
     363    sst1InitIdleFBI(sstbase);
     364
     365    /* Setup Basic rendering datapath */
     366    ISET(sst->fbzColorPath, SST_CC_MONE);
     367    ISET(sst->fogMode, 0x0);
     368    ISET(sst->fbzMode, SST_RGBWRMASK | SST_ZAWRMASK | SST_DRAWBUFFER_FRONT);
     369    sst1InitIdleFBI(sstbase);
     370
     371    if(sst1InitSliDetect(sstbase))
     372        /* SLI cannot support 4 MBytes... */
     373        goto check2MByte;
    373374    sst1InitSetResolution(sstbase, &SST_VREZ_800X600_60, 1);
    374         sst1InitIdleFBI(sstbase);
    375 
    376         ISET(sst->lfbMode, SST_LFB_ZZ | SST_LFB_WRITEFRONTBUFFER |
    377                 SST_LFB_READDEPTHABUFFER);
    378         sst1InitIdleFBI(sstbase);
    379 
    380         /* Check for 4 MBytes... */
    381         /* Write to Zbuffer in 800x600 resolution in upper 2 MBytes of memory */
    382         LFB_PUTPIXEL(128, 100, 0xdead); /* maps to row:0x216, col:0x80, bank:0x1 */
    383         LFB_PUTPIXEL(0, 0, 0x0);
    384         LFB_PUTPIXEL(798, 599, 0xffff);
    385         LFB_PUTPIXEL(200, 200, 0x55aa); /* maps to row:0x23d, col:0x104, bank:0x0 */
    386         LFB_PUTPIXEL(20, 20, 0xffff);
    387         LFB_PUTPIXEL(400, 400, 0x0);
    388         sst1InitIdleFBI(sstbase);
    389         if((LFB_GETPIXEL(128, 100) == 0xdead) &&
    390            (LFB_GETPIXEL(200, 200) == 0x55aa)) {
    391                 retval = 4;
    392                 ISET(sst->lfbMode, (SST_LFB_565 | SST_LFB_READBACKBUFFER));
    393                 sst1InitIdleFBI(sstbase);
    394                 goto fbiMemSizeDone;
    395         }
     375    sst1InitIdleFBI(sstbase);
     376
     377    ISET(sst->lfbMode, SST_LFB_ZZ | SST_LFB_WRITEFRONTBUFFER |
     378        SST_LFB_READDEPTHABUFFER);
     379    sst1InitIdleFBI(sstbase);
     380
     381    /* Check for 4 MBytes... */
     382    /* Write to Zbuffer in 800x600 resolution in upper 2 MBytes of memory */
     383    LFB_PUTPIXEL(128, 100, 0xdead); /* maps to row:0x216, col:0x80, bank:0x1 */
     384    LFB_PUTPIXEL(0, 0, 0x0);
     385    LFB_PUTPIXEL(798, 599, 0xffff);
     386    LFB_PUTPIXEL(200, 200, 0x55aa); /* maps to row:0x23d, col:0x104, bank:0x0 */
     387    LFB_PUTPIXEL(20, 20, 0xffff);
     388    LFB_PUTPIXEL(400, 400, 0x0);
     389    sst1InitIdleFBI(sstbase);
     390    if((LFB_GETPIXEL(128, 100) == 0xdead) &&
     391       (LFB_GETPIXEL(200, 200) == 0x55aa)) {
     392        retval = 4;
     393        ISET(sst->lfbMode, (SST_LFB_565 | SST_LFB_READBACKBUFFER));
     394        sst1InitIdleFBI(sstbase);
     395        goto fbiMemSizeDone;
     396    }
    396397
    397398check2MByte:
    398         /* Check for 2 MBytes... */
    399         /* Write to color buffer in 640x480 resolution */
     399    /* Check for 2 MBytes... */
     400    /* Write to color buffer in 640x480 resolution */
    400401    sst1InitSetResolution(sstbase, &SST_VREZ_640X480_60, 0);
    401         ISET(sst->lfbMode, SST_LFB_565 | SST_LFB_WRITEFRONTBUFFER |
    402                 SST_LFB_READFRONTBUFFER);
    403         sst1InitIdleFBI(sstbase);
    404         LFB_PUTPIXEL(50, 100, 0xdead);  /* maps to row:0x1e, col:0x99, bank:0x0 */
    405         LFB_PUTPIXEL(0, 0, 0x0);
    406         LFB_PUTPIXEL(638, 479, 0xffff);
    407         ISET(sst->lfbMode, SST_LFB_565 | SST_LFB_WRITEBACKBUFFER |
    408                 SST_LFB_READFRONTBUFFER);
    409         sst1InitIdleFBI(sstbase);
    410         LFB_PUTPIXEL(178, 436, 0xaa55); /* maps to row:0x11e, col:0x99, bank:0x0 */
    411         LFB_PUTPIXEL(20, 20, 0x0);
    412         LFB_PUTPIXEL(400, 400, 0xffff);
    413         sst1InitIdleFBI(sstbase);
    414         if(LFB_GETPIXEL(50, 100) != 0xdead)
    415                 goto check1MByte;
    416         ISET(sst->lfbMode, (SST_LFB_565 | SST_LFB_READBACKBUFFER));
    417         sst1InitIdleFBI(sstbase);
    418         if(LFB_GETPIXEL(178, 436) == 0xaa55) {
    419                 retval = 2;
    420                 goto fbiMemSizeDone;
    421         }
     402    ISET(sst->lfbMode, SST_LFB_565 | SST_LFB_WRITEFRONTBUFFER |
     403        SST_LFB_READFRONTBUFFER);
     404    sst1InitIdleFBI(sstbase);
     405    LFB_PUTPIXEL(50, 100, 0xdead);  /* maps to row:0x1e, col:0x99, bank:0x0 */
     406    LFB_PUTPIXEL(0, 0, 0x0);
     407    LFB_PUTPIXEL(638, 479, 0xffff);
     408    ISET(sst->lfbMode, SST_LFB_565 | SST_LFB_WRITEBACKBUFFER |
     409        SST_LFB_READFRONTBUFFER);
     410    sst1InitIdleFBI(sstbase);
     411    LFB_PUTPIXEL(178, 436, 0xaa55); /* maps to row:0x11e, col:0x99, bank:0x0 */
     412    LFB_PUTPIXEL(20, 20, 0x0);
     413    LFB_PUTPIXEL(400, 400, 0xffff);
     414    sst1InitIdleFBI(sstbase);
     415    if(LFB_GETPIXEL(50, 100) != 0xdead)
     416        goto check1MByte;
     417    ISET(sst->lfbMode, (SST_LFB_565 | SST_LFB_READBACKBUFFER));
     418    sst1InitIdleFBI(sstbase);
     419    if(LFB_GETPIXEL(178, 436) == 0xaa55) {
     420        retval = 2;
     421        goto fbiMemSizeDone;
     422    }
    422423
    423424check1MByte:
    424         ISET(sst->lfbMode, SST_LFB_565 | SST_LFB_WRITEFRONTBUFFER |
    425                 SST_LFB_READFRONTBUFFER);
    426         sst1InitIdleFBI(sstbase);
    427         LFB_PUTPIXEL(10, 10, 0xdead);   /* maps to row:0x0, col:0x145, bank:0x0 */
    428         LFB_PUTPIXEL(8, 8, 0x0);
    429         LFB_PUTPIXEL(340, 340, 0xffff);
    430         LFB_PUTPIXEL(100, 200, 0x5a5a); /* maps to row:0x3c, col:0x112, bank:0x1 */
    431         LFB_PUTPIXEL(66, 0, 0x0);
    432         LFB_PUTPIXEL(360, 360, 0xffff);
    433         sst1InitIdleFBI(sstbase);
    434         if((LFB_GETPIXEL(10, 10) == 0xdead) &&
    435            (LFB_GETPIXEL(100, 200) == 0x5a5a))
    436                 retval = 1;
     425    ISET(sst->lfbMode, SST_LFB_565 | SST_LFB_WRITEFRONTBUFFER |
     426        SST_LFB_READFRONTBUFFER);
     427    sst1InitIdleFBI(sstbase);
     428    LFB_PUTPIXEL(10, 10, 0xdead);   /* maps to row:0x0, col:0x145, bank:0x0 */
     429    LFB_PUTPIXEL(8, 8, 0x0);
     430    LFB_PUTPIXEL(340, 340, 0xffff);
     431    LFB_PUTPIXEL(100, 200, 0x5a5a); /* maps to row:0x3c, col:0x112, bank:0x1 */
     432    LFB_PUTPIXEL(66, 0, 0x0);
     433    LFB_PUTPIXEL(360, 360, 0xffff);
     434    sst1InitIdleFBI(sstbase);
     435    if((LFB_GETPIXEL(10, 10) == 0xdead) &&
     436       (LFB_GETPIXEL(100, 200) == 0x5a5a))
     437        retval = 1;
    437438
    438439fbiMemSizeDone:
    439         /* Restore init registers to original state */
    440         ISET(sst->fbiInit0, init0Save);
    441         ISET(sst->fbiInit1, init1Save);
    442         ISET(sst->fbiInit2, init2Save);
    443         sst1InitIdleFBI(sstbase);
    444 
    445         return(retval);
     440    /* Restore init registers to original state */
     441    ISET(sst->fbiInit0, init0Save);
     442    ISET(sst->fbiInit1, init1Save);
     443    ISET(sst->fbiInit2, init2Save);
     444    sst1InitIdleFBI(sstbase);
     445
     446    return(retval);
    446447}
    447448
     
    449450sst1InitGetFbiInfo(FxU32 *sstbase, sst1DeviceInfoStruct *info)
    450451{
    451         volatile Sstregs *sst = (Sstregs *) sstbase;
     452    volatile Sstregs *sst = (Sstregs *) sstbase;
    452453
    453454    info->fbiMemSize = fbiMemSize(sstbase);
    454455
    455         /* Detect board identification and memory speed */
    456         if(GETENV(("SST_FBICFG")))
     456    /* Detect board identification and memory speed */
     457    if(GETENV(("SST_FBICFG")))
    457458        SSCANF(GETENV(("SST_FBICFG")), "%i", &info->fbiConfig);
    458459    else
    459                 info->fbiConfig = (IGET(sst->fbiInit3) & SST_FBI_MEM_TYPE) >>
    460                         SST_FBI_MEM_TYPE_SHIFT;
    461 
    462         info->fbiBoardID = (info->fbiConfig >> 2) & 0x1;
    463         /* fbiMemSpeed is legacy, and is not used by either Obsidian GE or Pro Fab */
    464         info->fbiMemSpeed = 0;
    465 
    466         /* Detect scanline interleaving */
    467         info->sstSliDetect = sst1InitSliDetect(sstbase);
     460        info->fbiConfig = (IGET(sst->fbiInit3) & SST_FBI_MEM_TYPE) >>
     461            SST_FBI_MEM_TYPE_SHIFT;
     462
     463    info->fbiBoardID = (info->fbiConfig >> 2) & 0x1;
     464    /* fbiMemSpeed is legacy, and is not used by either Obsidian GE or Pro Fab */
     465    info->fbiMemSpeed = 0;
     466
     467    /* Detect scanline interleaving */
     468    info->sstSliDetect = sst1InitSliDetect(sstbase);
    468469
    469470    return FXTRUE;
     
    504505    if(GETENV(("SST_NODEVICEINFO"))) {
    505506        /* fill device info struct with sane values... */
    506         INIT_PRINTF(("sst1DeviceInfo: Filling info Struct with default values...\n"));
    507 
    508                 if(GETENV(("SST_FBICFG")))
    509                 SSCANF(GETENV(("SST_FBICFG")), "%i", &info->fbiConfig);
    510                 else
    511                 info->fbiConfig = 0x0;
    512 
    513                 if(GETENV(("SST_TMUCFG")))
    514                 SSCANF(GETENV(("SST_TMUCFG")), "%i", &info->tmuConfig);
    515                 else
    516                 info->tmuConfig = 0x0;
     507        INIT_PRINTF(("sst1DeviceInfo: Filling info Struct with default values...\n"));
     508
     509        if(GETENV(("SST_FBICFG")))
     510            SSCANF(GETENV(("SST_FBICFG")), "%i", &info->fbiConfig);
     511        else
     512            info->fbiConfig = 0x0;
     513
     514        if(GETENV(("SST_TMUCFG")))
     515            SSCANF(GETENV(("SST_TMUCFG")), "%i", &info->tmuConfig);
     516        else
     517            info->tmuConfig = 0x0;
    517518
    518519        info->numberTmus = 1;
    519         if (info->tmuConfig & FXBIT(6)) /* if TMU 1 exists */
    520                         info->numberTmus++;
    521             if (info->tmuConfig & FXBIT(13)) /* if TMU 2 exists */
    522                         info->numberTmus++;
    523 
    524         info->tmuRevision = info->tmuConfig & 0x7;
    525 
    526                 if(GETENV(("SST_FBIMEM_SIZE")))
    527                         info->fbiMemSize = ATOI(GETENV(("SST_FBIMEM_SIZE")));
    528                 else
    529                 info->fbiMemSize = 2;
    530 
    531                 if(GETENV(("SST_TMUMEM_SIZE")))
    532                         info->tmuMemSize[0] = ATOI(GETENV(("SST_TMUMEM_SIZE")));
    533                 else
    534                 info->tmuMemSize[0] = 2;
    535                 info->tmuMemSize[1] = info->tmuMemSize[0];
    536                 info->tmuMemSize[2] = info->tmuMemSize[0];
     520        if (info->tmuConfig & FXBIT(6)) /* if TMU 1 exists */
     521            info->numberTmus++;
     522        if (info->tmuConfig & FXBIT(13)) /* if TMU 2 exists */
     523            info->numberTmus++;
     524
     525        info->tmuRevision = info->tmuConfig & 0x7;
     526
     527        if(GETENV(("SST_FBIMEM_SIZE")))
     528            info->fbiMemSize = ATOI(GETENV(("SST_FBIMEM_SIZE")));
     529        else
     530            info->fbiMemSize = 2;
     531
     532        if(GETENV(("SST_TMUMEM_SIZE")))
     533            info->tmuMemSize[0] = ATOI(GETENV(("SST_TMUMEM_SIZE")));
     534        else
     535            info->tmuMemSize[0] = 2;
     536        info->tmuMemSize[1] = info->tmuMemSize[0];
     537        info->tmuMemSize[2] = info->tmuMemSize[0];
    537538    } else {
    538                 int i;
    539 
    540                 for(i=0; i<5; i++) {
    541                         if(i)
    542                                 INIT_PRINTF(("sst1InitFillDeviceInfo(): Retry #%d for chip GetInfo()...\n", i));
    543                 /* GetFbiInfo() must be called before GetTmuInfo() */
    544                 if(sst1InitGetFbiInfo(sstbase, info) == FXFALSE)
    545                                 continue;
    546                 /* get the revision ID of each TMU and verify that they are all the
    547                            same */
    548                 if(sst1InitGetTmuInfo(sstbase, info) == FXFALSE)
    549                                 continue;
    550                         break;
    551                 }
    552                 if(i == 5)
    553                         return(FXFALSE);
     539        int i;
     540
     541        for(i=0; i<5; i++) {
     542            if(i)
     543                INIT_PRINTF(("sst1InitFillDeviceInfo(): Retry #%d for chip GetInfo()...\n", i));
     544            /* GetFbiInfo() must be called before GetTmuInfo() */
     545            if(sst1InitGetFbiInfo(sstbase, info) == FXFALSE)
     546                continue;
     547            /* get the revision ID of each TMU and verify that they are all the
     548               same */
     549            if(sst1InitGetTmuInfo(sstbase, info) == FXFALSE)
     550                continue;
     551            break;
     552        }
     553        if(i == 5)
     554            return(FXFALSE);
    554555    }
    555556    INIT_PRINTF(("sst1DeviceInfo: Board ID: Obsidian %s\n",
     
    568569    if(sst1InitUseVoodooFile == FXTRUE) {
    569570        if(iniDac == (sst1InitDacStruct *) NULL)
    570                         INIT_PRINTF(("sst1DeviceInfo: Dac Type: Unknown"));
    571                 else
    572                 INIT_PRINTF(("sst1DeviceInfo: Dac Type: %s %s\n",
    573                           iniDac->dacManufacturer, iniDac->dacDevice));
    574         } else {
    575             INIT_PRINTF(("sst1DeviceInfo: Dac Type: "));
    576             if(info->fbiDacType == SST_FBI_DACTYPE_ATT)
    577                 INIT_PRINTF(("AT&T ATT20C409\n"));
    578             else if(info->fbiDacType == SST_FBI_DACTYPE_ICS)
    579                 INIT_PRINTF(("ICS ICS5342\n"));
    580             else if(info->fbiDacType == SST_FBI_DACTYPE_TI)
    581                 INIT_PRINTF(("TI TVP3409\n"));
    582             else
    583                 INIT_PRINTF(("Unknown\n"));
    584         }
     571            INIT_PRINTF(("sst1DeviceInfo: Dac Type: Unknown"));
     572        else
     573            INIT_PRINTF(("sst1DeviceInfo: Dac Type: %s %s\n",
     574              iniDac->dacManufacturer, iniDac->dacDevice));
     575    } else {
     576        INIT_PRINTF(("sst1DeviceInfo: Dac Type: "));
     577        if(info->fbiDacType == SST_FBI_DACTYPE_ATT)
     578            INIT_PRINTF(("AT&T ATT20C409\n"));
     579        else if(info->fbiDacType == SST_FBI_DACTYPE_ICS)
     580            INIT_PRINTF(("ICS ICS5342\n"));
     581        else if(info->fbiDacType == SST_FBI_DACTYPE_TI)
     582            INIT_PRINTF(("TI TVP3409\n"));
     583        else
     584            INIT_PRINTF(("Unknown\n"));
     585    }
    585586    INIT_PRINTF(("sst1DeviceInfo: SliDetect:%d\n", info->sstSliDetect));
    586587
  • trunk/src/opengl/glide/sst1/init/initvg/parse.c

    r2885 r6653  
     1/* $Id: parse.c,v 1.2 2001-09-05 14:31:05 bird Exp $ */
    12/*
    23** THIS SOFTWARE IS SUBJECT TO COPYRIGHT PROTECTION AND IS OFFERED ONLY
    34** PURSUANT TO THE 3DFX GLIDE GENERAL PUBLIC LICENSE. THERE IS NO RIGHT
    45** TO USE THE GLIDE TRADEMARK WITHOUT PRIOR WRITTEN PERMISSION OF 3DFX
    5 ** INTERACTIVE, INC. A COPY OF THIS LICENSE MAY BE OBTAINED FROM THE 
    6 ** DISTRIBUTOR OR BY CONTACTING 3DFX INTERACTIVE INC(info@3dfx.com). 
    7 ** THIS PROGRAM IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER 
     6** INTERACTIVE, INC. A COPY OF THIS LICENSE MAY BE OBTAINED FROM THE
     7** DISTRIBUTOR OR BY CONTACTING 3DFX INTERACTIVE INC(info@3dfx.com).
     8** THIS PROGRAM IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER
    89** EXPRESSED OR IMPLIED. SEE THE 3DFX GLIDE GENERAL PUBLIC LICENSE FOR A
    9 ** FULL TEXT OF THE NON-WARRANTY PROVISIONS. 
    10 ** 
     10** FULL TEXT OF THE NON-WARRANTY PROVISIONS.
     11**
    1112** USE, DUPLICATION OR DISCLOSURE BY THE GOVERNMENT IS SUBJECT TO
    1213** RESTRICTIONS AS SET FORTH IN SUBDIVISION (C)(1)(II) OF THE RIGHTS IN
     
    1415** AND/OR IN SIMILAR OR SUCCESSOR CLAUSES IN THE FAR, DOD OR NASA FAR
    1516** SUPPLEMENT. UNPUBLISHED RIGHTS RESERVED UNDER THE COPYRIGHT LAWS OF
    16 ** THE UNITED STATES. 
    17 ** 
     17** THE UNITED STATES.
     18**
    1819** COPYRIGHT 3DFX INTERACTIVE, INC. 1999, ALL RIGHTS RESERVED
    1920**
    2021**
    21 ** $Revision: 1.1 $
    22 ** $Date: 2000-02-25 00:31:34 $
     22** $Revision: 1.2 $
     23** $Date: 2001-09-05 14:31:05 $
    2324**
    2425** Parsing code for grabbing information from "voodoo.ini" initialization file
     
    170171    /* Override voodoo.ini name */
    171172    strcpy(filename, getenv("VOODOO_FILE"));
    172     if (!(file = fopen(filename, "r"))) 
     173    if (!(file = fopen(filename, "r")))
    173174      goto __errExit;
    174175  } else {
     
    183184    while(1) {
    184185      if (!i) {
    185         if ((tmpPtr = strtok(path, ":")) == NULL)
    186           break;
     186    if ((tmpPtr = strtok(path, ":")) == NULL)
     187      break;
    187188      } else {
    188         if ((tmpPtr = strtok(NULL, ":")) == NULL)
    189           break;
     189    if ((tmpPtr = strtok(NULL, ":")) == NULL)
     190      break;
    190191      }
    191192      strcpy(filename, tmpPtr);
    192193      if (filename[strlen(filename)-1] == '\\')
    193         sprintf(filename, "%voodoo", filename);
     194    sprintf(filename, "%voodoo", filename);
    194195      else
    195         sprintf(filename, "%s/voodoo", filename);
     196    sprintf(filename, "%s/voodoo", filename);
    196197      i++;
    197198      if ((file = fopen(filename, "r")))
    198         break;
     199    break;
    199200    }
    200201  }
     
    513514                break;
    514515            }
    515             if(!(dacRdWrPtr->nextRdWr = malloc(sizeof(sst1InitDacRdWrStruct)))) 
     516            if(!(dacRdWrPtr->nextRdWr = malloc(sizeof(sst1InitDacRdWrStruct))))
    516517                return(0);
    517518
     
    898899   * string table has been freed by the c runtime but has not been set
    899900   * to NULL. Bad things happen if this memory has been unmapped by
    900    * the system or if the string cannot be found. 
     901   * the system or if the string cannot be found.
    901902   */
    902903  {
  • trunk/src/opengl/glide/sst1/init/initvg/print.c

    r2885 r6653  
     1/* $Id: print.c,v 1.2 2001-09-05 14:31:05 bird Exp $ */
    12/*
    23** THIS SOFTWARE IS SUBJECT TO COPYRIGHT PROTECTION AND IS OFFERED ONLY
    34** PURSUANT TO THE 3DFX GLIDE GENERAL PUBLIC LICENSE. THERE IS NO RIGHT
    45** TO USE THE GLIDE TRADEMARK WITHOUT PRIOR WRITTEN PERMISSION OF 3DFX
    5 ** INTERACTIVE, INC. A COPY OF THIS LICENSE MAY BE OBTAINED FROM THE 
    6 ** DISTRIBUTOR OR BY CONTACTING 3DFX INTERACTIVE INC(info@3dfx.com). 
    7 ** THIS PROGRAM IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER 
     6** INTERACTIVE, INC. A COPY OF THIS LICENSE MAY BE OBTAINED FROM THE
     7** DISTRIBUTOR OR BY CONTACTING 3DFX INTERACTIVE INC(info@3dfx.com).
     8** THIS PROGRAM IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER
    89** EXPRESSED OR IMPLIED. SEE THE 3DFX GLIDE GENERAL PUBLIC LICENSE FOR A
    9 ** FULL TEXT OF THE NON-WARRANTY PROVISIONS. 
    10 ** 
     10** FULL TEXT OF THE NON-WARRANTY PROVISIONS.
     11**
    1112** USE, DUPLICATION OR DISCLOSURE BY THE GOVERNMENT IS SUBJECT TO
    1213** RESTRICTIONS AS SET FORTH IN SUBDIVISION (C)(1)(II) OF THE RIGHTS IN
     
    1415** AND/OR IN SIMILAR OR SUCCESSOR CLAUSES IN THE FAR, DOD OR NASA FAR
    1516** SUPPLEMENT. UNPUBLISHED RIGHTS RESERVED UNDER THE COPYRIGHT LAWS OF
    16 ** THE UNITED STATES. 
    17 ** 
     17** THE UNITED STATES.
     18**
    1819** COPYRIGHT 3DFX INTERACTIVE, INC. 1999, ALL RIGHTS RESERVED
    1920**
    2021**
    21 ** $Revision: 1.1 $
    22 ** $Date: 2000-02-25 00:31:34 $
     22** $Revision: 1.2 $
     23** $Date: 2001-09-05 14:31:05 $
    2324**
    2425** Print functions for SST-1 Initialization routines
     
    4647    if(firstPass == FXTRUE) {
    4748        firstPass = FXFALSE;
    48         if (sst1InitMsgFile == NULL)
    49         {
    50           /* I couldn't initialize to stdout because stdout is not constant */
    51           sst1InitMsgFile = stdout;
    52         }
     49    if (sst1InitMsgFile == NULL)
     50    {
     51      /* I couldn't initialize to stdout because stdout is not constant */
     52      sst1InitMsgFile = stdout;
     53    }
    5354        if(GETENV(("SST_INITDEBUG")))
    5455            printIt = FXTRUE;
  • trunk/src/opengl/glide/sst1/init/initvg/sli.c

    r2885 r6653  
     1/* $Id: sli.c,v 1.2 2001-09-05 14:31:05 bird Exp $ */
    12/*
    23** THIS SOFTWARE IS SUBJECT TO COPYRIGHT PROTECTION AND IS OFFERED ONLY
    34** PURSUANT TO THE 3DFX GLIDE GENERAL PUBLIC LICENSE. THERE IS NO RIGHT
    45** TO USE THE GLIDE TRADEMARK WITHOUT PRIOR WRITTEN PERMISSION OF 3DFX
    5 ** INTERACTIVE, INC. A COPY OF THIS LICENSE MAY BE OBTAINED FROM THE 
    6 ** DISTRIBUTOR OR BY CONTACTING 3DFX INTERACTIVE INC(info@3dfx.com). 
    7 ** THIS PROGRAM IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER 
     6** INTERACTIVE, INC. A COPY OF THIS LICENSE MAY BE OBTAINED FROM THE
     7** DISTRIBUTOR OR BY CONTACTING 3DFX INTERACTIVE INC(info@3dfx.com).
     8** THIS PROGRAM IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER
    89** EXPRESSED OR IMPLIED. SEE THE 3DFX GLIDE GENERAL PUBLIC LICENSE FOR A
    9 ** FULL TEXT OF THE NON-WARRANTY PROVISIONS. 
    10 ** 
     10** FULL TEXT OF THE NON-WARRANTY PROVISIONS.
     11**
    1112** USE, DUPLICATION OR DISCLOSURE BY THE GOVERNMENT IS SUBJECT TO
    1213** RESTRICTIONS AS SET FORTH IN SUBDIVISION (C)(1)(II) OF THE RIGHTS IN
     
    1415** AND/OR IN SIMILAR OR SUCCESSOR CLAUSES IN THE FAR, DOD OR NASA FAR
    1516** SUPPLEMENT. UNPUBLISHED RIGHTS RESERVED UNDER THE COPYRIGHT LAWS OF
    16 ** THE UNITED STATES. 
    17 ** 
     17** THE UNITED STATES.
     18**
    1819** COPYRIGHT 3DFX INTERACTIVE, INC. 1999, ALL RIGHTS RESERVED
    1920**
    2021**
    21 ** $Revision: 1.1 $
    22 ** $Date: 2000-02-25 00:31:34 $
     22** $Revision: 1.2 $
     23** $Date: 2001-09-05 14:31:05 $
    2324**
    2425** Initialization code for initializing scanline interleaving
     
    8485        PCICFG_RD(SST1_PCI_INIT_ENABLE, j);
    8586        PCICFG_WR(SST1_PCI_INIT_ENABLE,
    86             (j | SST_SCANLINE_SLV_OWNPCI | SST_SCANLINE_SLI_SLV)); 
     87            (j | SST_SCANLINE_SLV_OWNPCI | SST_SCANLINE_SLI_SLV));
    8788        ISET(sstSlave->fbiInit1, IGET(sstSlave->fbiInit1) |
    8889          (SST_VIDEO_RESET | SST_EN_SCANLINE_INTERLEAVE));
     
    153154            /* 16-bit Video Output */
    154155            ISET(sstSlave->fbiInit1, (IGET(sstSlave->fbiInit1) &
    155                     ~(SST_VIDEO_VCLK_2X_OUTPUT_DEL | SST_VIDEO_VCLK_DEL)) | 
     156                    ~(SST_VIDEO_VCLK_2X_OUTPUT_DEL | SST_VIDEO_VCLK_DEL)) |
    156157                SST_EN_SCANLINE_INTERLEAVE |
    157158                /* SST_VIDEO_VID_CLK_SLAVE | */
     
    166167            ISET(sstSlave->fbiInit1, (IGET(sstSlave->fbiInit1) &
    167168                    ~(SST_VIDEO_VCLK_2X_OUTPUT_DEL | SST_VIDEO_VCLK_DEL |
    168                       SST_VIDEO_VCLK_SEL | SST_VIDEO_VCLK_2X_INPUT_DEL)) | 
     169                      SST_VIDEO_VCLK_SEL | SST_VIDEO_VCLK_2X_INPUT_DEL)) |
    169170                SST_EN_SCANLINE_INTERLEAVE |
    170171                /* SST_VIDEO_VID_CLK_SLAVE | */
     
    274275        /* 16-bit Video Output */
    275276        ISET(sstMaster->fbiInit1, (IGET(sstMaster->fbiInit1) &
    276                 ~(SST_VIDEO_VCLK_2X_OUTPUT_DEL | SST_VIDEO_VCLK_DEL)) | 
     277                ~(SST_VIDEO_VCLK_2X_OUTPUT_DEL | SST_VIDEO_VCLK_DEL)) |
    277278            SST_EN_SCANLINE_INTERLEAVE |
    278279            SST_VIDEO_VID_CLK_2X |
     
    286287        ISET(sstMaster->fbiInit1, (IGET(sstMaster->fbiInit1) &
    287288                ~(SST_VIDEO_VCLK_2X_OUTPUT_DEL | SST_VIDEO_VCLK_DEL |
    288                       SST_VIDEO_VCLK_SEL | SST_VIDEO_VCLK_2X_INPUT_DEL)) | 
     289                      SST_VIDEO_VCLK_SEL | SST_VIDEO_VCLK_2X_INPUT_DEL)) |
    289290            SST_EN_SCANLINE_INTERLEAVE |
    290291            SST_VIDEO_VID_CLK_2X |
     
    321322    PCICFG_RD(SST1_PCI_INIT_ENABLE, j);
    322323    PCICFG_WR(SST1_PCI_INIT_ENABLE,
    323         (j & ~(SST_SCANLINE_SLV_OWNPCI | SST_SCANLINE_SLI_SLV))); 
     324        (j & ~(SST_SCANLINE_SLV_OWNPCI | SST_SCANLINE_SLI_SLV)));
    324325    MasterPhysAddr = sst1CurrentBoard->physAddr;
    325326    sst1InitReturnStatus(sstbase0); /* flush pci packer with reads */
     
    332333    PCICFG_RD(SST1_PCI_INIT_ENABLE, j);
    333334    PCICFG_WR(SST1_PCI_INIT_ENABLE,
    334         ((j & ~(SST_SCANLINE_SLV_OWNPCI)) | SST_SCANLINE_SLI_SLV)); 
     335        ((j & ~(SST_SCANLINE_SLV_OWNPCI)) | SST_SCANLINE_SLI_SLV));
    335336    /* Map both boards to same Master physical address */
    336337    PCICFG_WR(PCI_BASE_ADDRESS_0, MasterPhysAddr);
     
    432433            PCICFG_WR(SST1_PCI_INIT_ENABLE,
    433434                (j | SST_SCANLINE_SLV_OWNPCI | SST_SCANLINE_SLI_SLV |
    434                  SST_INITWR_EN | SST_PCI_FIFOWR_EN)); 
     435                 SST_INITWR_EN | SST_PCI_FIFOWR_EN));
    435436            PCICFG_RD(SST1_PCI_INIT_ENABLE, j); /* delay */
    436437            ISET(sstSlave->fbiInit1, IGET(sstSlave->fbiInit1) &
     
    438439            PCICFG_RD(SST1_PCI_INIT_ENABLE, j);
    439440            PCICFG_WR(SST1_PCI_INIT_ENABLE,
    440                 (j & ~(SST_SCANLINE_SLV_OWNPCI | SST_SCANLINE_SLI_SLV))); 
     441                (j & ~(SST_SCANLINE_SLV_OWNPCI | SST_SCANLINE_SLI_SLV)));
    441442            PCICFG_RD(SST1_PCI_INIT_ENABLE, j); /* delay */
    442443            sst1InitIdle((FxU32 *) sstSlave);
  • trunk/src/opengl/glide/sst1/init/initvg/sst1init.c

    r2885 r6653  
    1 /*
     1/* $Id: sst1init.c,v 1.2 2001-09-05 14:31:06 bird Exp $ */
     2/*
    23** THIS SOFTWARE IS SUBJECT TO COPYRIGHT PROTECTION AND IS OFFERED ONLY
    34** PURSUANT TO THE 3DFX GLIDE GENERAL PUBLIC LICENSE. THERE IS NO RIGHT
    45** TO USE THE GLIDE TRADEMARK WITHOUT PRIOR WRITTEN PERMISSION OF 3DFX
    5 ** INTERACTIVE, INC. A COPY OF THIS LICENSE MAY BE OBTAINED FROM THE 
    6 ** DISTRIBUTOR OR BY CONTACTING 3DFX INTERACTIVE INC(info@3dfx.com). 
    7 ** THIS PROGRAM IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER 
     6** INTERACTIVE, INC. A COPY OF THIS LICENSE MAY BE OBTAINED FROM THE
     7** DISTRIBUTOR OR BY CONTACTING 3DFX INTERACTIVE INC(info@3dfx.com).
     8** THIS PROGRAM IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER
    89** EXPRESSED OR IMPLIED. SEE THE 3DFX GLIDE GENERAL PUBLIC LICENSE FOR A
    9 ** FULL TEXT OF THE NON-WARRANTY PROVISIONS. 
    10 ** 
     10** FULL TEXT OF THE NON-WARRANTY PROVISIONS.
     11**
    1112** USE, DUPLICATION OR DISCLOSURE BY THE GOVERNMENT IS SUBJECT TO
    1213** RESTRICTIONS AS SET FORTH IN SUBDIVISION (C)(1)(II) OF THE RIGHTS IN
     
    1415** AND/OR IN SIMILAR OR SUCCESSOR CLAUSES IN THE FAR, DOD OR NASA FAR
    1516** SUPPLEMENT. UNPUBLISHED RIGHTS RESERVED UNDER THE COPYRIGHT LAWS OF
    16 ** THE UNITED STATES. 
    17 ** 
     17** THE UNITED STATES.
     18**
    1819** COPYRIGHT 3DFX INTERACTIVE, INC. 1999, ALL RIGHTS RESERVED
    1920**
    20 ** $Revision: 1.1 $
    21 ** $Date: 2000-02-25 00:31:35 $
     21** $Revision: 1.2 $
     22** $Date: 2001-09-05 14:31:06 $
    2223**
    2324*/
     
    2829** NOTE: This code must compiled with optimizations DISABLED!!
    2930**
    30 ** The following environment variables can optionally be used to alter 
     31** The following environment variables can optionally be used to alter
    3132** functionality (A value of X is a "don't care"):
    3233**
     
    203204                &sst1InitDeviceNumber, j, 0);
    204205#else
    205             sst = pciMapCardMulti(vendorID, deviceID, sizeOfCard, 
     206            sst = pciMapCardMulti(vendorID, deviceID, sizeOfCard,
    206207                &sst1InitDeviceNumber, j, 0);
    207208#endif /* DIRECTX */
     
    331332    sst1InitReturnStatus(sstbase);
    332333    sst1InitReturnStatus(sstbase);
    333    
     334
    334335    /* Adjust Fbi-to-Trex clock delay value */
    335336    /* Adjust Trex-to-Fbi FIFO */
     
    486487            (tf2_clk_del<<SST_TEX_TF_CLK_DEL_ADJ_SHIFT);
    487488    }
    488     INIT_PRINTF(("sst1InitRegisters(): Storing TREX2INIT1=0x%x\n", 
     489    INIT_PRINTF(("sst1InitRegisters(): Storing TREX2INIT1=0x%x\n",
    489490        sst1CurrentBoard->tmuInit1[2]));
    490491
     
    709710    }
    710711#ifdef __DOS32__
    711     /* 
     712    /*
    712713     * HACK alert. -MS
    713714     *
    714715     * There's a pciClose(), but nobody calls it. This is needed by the
    715716     * DOS DPMI services to close fxmemmap.vxd.
    716      * 
     717     *
    717718     * We need to move this to the "appropriate" place, wherever that may be.
    718719     */
     
    762763            return(FXFALSE);
    763764        sst1CurrentBoard->initGrxClkDone = 0;
    764        
     765
    765766        if((++n > 1) || !SliEnable)
    766767            break;
     
    877878}
    878879
    879 static FxU32 
     880static FxU32
    880881  mtrr;
    881882
     
    886887**
    887888*/
    888 FX_EXPORT void FX_CSTYLE 
     889FX_EXPORT void FX_CSTYLE
    889890sst1InitCachingOn(void)
    890891{
    891   FxU32 
     892  FxU32
    892893    physAddr;
    893894  FxBool
     
    909910  else
    910911    return;                   /* It's already there.  We're done. */
    911  
     912
    912913  if (res)
    913914    pciSetMTRR(mtrr, physAddr, 0x1000000, PciMemTypeWriteCombining);
  • trunk/src/opengl/glide/sst1/init/initvg/util.c

    r2885 r6653  
     1/* $Id: util.c,v 1.2 2001-09-05 14:31:06 bird Exp $ */
    12/*
    23** THIS SOFTWARE IS SUBJECT TO COPYRIGHT PROTECTION AND IS OFFERED ONLY
    34** PURSUANT TO THE 3DFX GLIDE GENERAL PUBLIC LICENSE. THERE IS NO RIGHT
    45** TO USE THE GLIDE TRADEMARK WITHOUT PRIOR WRITTEN PERMISSION OF 3DFX
    5 ** INTERACTIVE, INC. A COPY OF THIS LICENSE MAY BE OBTAINED FROM THE 
    6 ** DISTRIBUTOR OR BY CONTACTING 3DFX INTERACTIVE INC(info@3dfx.com). 
    7 ** THIS PROGRAM IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER 
     6** INTERACTIVE, INC. A COPY OF THIS LICENSE MAY BE OBTAINED FROM THE
     7** DISTRIBUTOR OR BY CONTACTING 3DFX INTERACTIVE INC(info@3dfx.com).
     8** THIS PROGRAM IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER
    89** EXPRESSED OR IMPLIED. SEE THE 3DFX GLIDE GENERAL PUBLIC LICENSE FOR A
    9 ** FULL TEXT OF THE NON-WARRANTY PROVISIONS. 
    10 ** 
     10** FULL TEXT OF THE NON-WARRANTY PROVISIONS.
     11**
    1112** USE, DUPLICATION OR DISCLOSURE BY THE GOVERNMENT IS SUBJECT TO
    1213** RESTRICTIONS AS SET FORTH IN SUBDIVISION (C)(1)(II) OF THE RIGHTS IN
     
    1415** AND/OR IN SIMILAR OR SUCCESSOR CLAUSES IN THE FAR, DOD OR NASA FAR
    1516** SUPPLEMENT. UNPUBLISHED RIGHTS RESERVED UNDER THE COPYRIGHT LAWS OF
    16 ** THE UNITED STATES. 
    17 ** 
     17** THE UNITED STATES.
     18**
    1819** COPYRIGHT 3DFX INTERACTIVE, INC. 1999, ALL RIGHTS RESERVED
    1920**
    2021**
    21 ** $Revision: 1.1 $
    22 ** $Date: 2000-02-25 00:31:35 $
     22** $Revision: 1.2 $
     23** $Date: 2001-09-05 14:31:06 $
    2324**
    2425** Utility routines for SST-1 Initialization code
     
    225226    if(enable) {
    226227        /* VGA controls monitor */
    227         ISET(sst->fbiInit0, (IGET(sst->fbiInit0) & ~SST_EN_VGA_PASSTHRU) | 
     228        ISET(sst->fbiInit0, (IGET(sst->fbiInit0) & ~SST_EN_VGA_PASSTHRU) |
    228229            sst1CurrentBoard->vgaPassthruEnable);
    229230        ISET(sst->fbiInit1, IGET(sst->fbiInit1) | SST_VIDEO_BLANK_EN);
    230231    } else {
    231232        /* SST-1 controls monitor */
    232         ISET(sst->fbiInit0, (IGET(sst->fbiInit0) & ~SST_EN_VGA_PASSTHRU) | 
     233        ISET(sst->fbiInit0, (IGET(sst->fbiInit0) & ~SST_EN_VGA_PASSTHRU) |
    233234            sst1CurrentBoard->vgaPassthruDisable);
    234235        ISET(sst->fbiInit1, IGET(sst->fbiInit1) & ~SST_VIDEO_BLANK_EN);
  • trunk/src/opengl/glide/sst1/init/initvg/video.c

    r2885 r6653  
     1/* $Id: video.c,v 1.2 2001-09-05 14:31:07 bird Exp $ */
    12/*
    23** THIS SOFTWARE IS SUBJECT TO COPYRIGHT PROTECTION AND IS OFFERED ONLY
    34** PURSUANT TO THE 3DFX GLIDE GENERAL PUBLIC LICENSE. THERE IS NO RIGHT
    45** TO USE THE GLIDE TRADEMARK WITHOUT PRIOR WRITTEN PERMISSION OF 3DFX
    5 ** INTERACTIVE, INC. A COPY OF THIS LICENSE MAY BE OBTAINED FROM THE 
    6 ** DISTRIBUTOR OR BY CONTACTING 3DFX INTERACTIVE INC(info@3dfx.com). 
    7 ** THIS PROGRAM IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER 
     6** INTERACTIVE, INC. A COPY OF THIS LICENSE MAY BE OBTAINED FROM THE
     7** DISTRIBUTOR OR BY CONTACTING 3DFX INTERACTIVE INC(info@3dfx.com).
     8** THIS PROGRAM IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER
    89** EXPRESSED OR IMPLIED. SEE THE 3DFX GLIDE GENERAL PUBLIC LICENSE FOR A
    9 ** FULL TEXT OF THE NON-WARRANTY PROVISIONS. 
    10 ** 
     10** FULL TEXT OF THE NON-WARRANTY PROVISIONS.
     11**
    1112** USE, DUPLICATION OR DISCLOSURE BY THE GOVERNMENT IS SUBJECT TO
    1213** RESTRICTIONS AS SET FORTH IN SUBDIVISION (C)(1)(II) OF THE RIGHTS IN
     
    1415** AND/OR IN SIMILAR OR SUCCESSOR CLAUSES IN THE FAR, DOD OR NASA FAR
    1516** SUPPLEMENT. UNPUBLISHED RIGHTS RESERVED UNDER THE COPYRIGHT LAWS OF
    16 ** THE UNITED STATES. 
    17 ** 
     17** THE UNITED STATES.
     18**
    1819** COPYRIGHT 3DFX INTERACTIVE, INC. 1999, ALL RIGHTS RESERVED
    1920**
    2021**
    21 ** $Revision: 1.1 $
    22 ** $Date: 2000-02-25 00:31:35 $
     22** $Revision: 1.2 $
     23** $Date: 2001-09-05 14:31:07 $
    2324**
    2425** Initialization code for initializing SST-1 video unit
     
    348349    /* Reset Video Refresh Unit */
    349350    ISET(sst->fbiInit1, IGET(sst->fbiInit1) | SST_VIDEO_RESET);
    350    
     351
    351352    /* Enable video clock */
    352353    if(SLI_DRIVEOK()) {
     
    400401    /* Setup SST memory mapper for desired resolution */
    401402    if(sst1CurrentBoard->fbiMemSize == 4)
    402         sst1InitSetResolution(sstbase, sstVideoRez, 1); 
     403        sst1InitSetResolution(sstbase, sstVideoRez, 1);
    403404    else
    404         sst1InitSetResolution(sstbase, sstVideoRez, 0); 
     405        sst1InitSetResolution(sstbase, sstVideoRez, 0);
    405406
    406407    if((GETENV(("SST_TRIPLE_BUFFER"))) ||
     
    506507    if(sst1CurrentBoard->fbiMemSize == 1 && sstVideoRez->xDimension > 512)
    507508        n = 0;
    508    
     509
    509510    if(n) {
    510511        sst1CurrentBoard->fbiMemoryFifoEn = 1;
     
    530531    INIT_PRINTF(("sst1InitVideo(): Setting memory FIFO LWM to 0x%x (%d)\n",
    531532                 sst1CurrentBoard->memFifoStatusLwm,
    532                  sst1CurrentBoard->memFifoStatusLwm)); 
     533                 sst1CurrentBoard->memFifoStatusLwm));
    533534
    534535    vInClkDel = 0;
     
    781782**      Video Timing Structure
    782783*/
    783 FX_EXPORT sst1VideoTimingStruct * FX_CSTYLE sst1InitFindVideoTimingStruct(GrScreenResolution_t screenResolution, 
     784FX_EXPORT sst1VideoTimingStruct * FX_CSTYLE sst1InitFindVideoTimingStruct(GrScreenResolution_t screenResolution,
    784785                                                                          GrScreenRefresh_t screenRefresh)
    785786{
     
    995996**
    996997*/
    997 FX_EXPORT void FX_CSTYLE sst1InitSetResolution(FxU32 *sstbase, 
     998FX_EXPORT void FX_CSTYLE sst1InitSetResolution(FxU32 *sstbase,
    998999    sst1VideoTimingStruct *sstVideoRez, FxU32 Banked)
    9991000{
     
    10891090** sst1InitSetTripleBuffering():
    10901091**  Specify Video Triple Buffering
    1091 **  NOTE: sst1InitSetTripleBuffering() must be called prior to calling 
     1092**  NOTE: sst1InitSetTripleBuffering() must be called prior to calling
    10921093**   sst1InitVideo() to properly setup Video Triple Buffering
    10931094**
  • trunk/src/opengl/glide/sst1/init/vg96drvr.c

    r2885 r6653  
     1/* $Id: vg96drvr.c,v 1.2 2001-09-05 14:31:00 bird Exp $ */
    12/*
    23** THIS SOFTWARE IS SUBJECT TO COPYRIGHT PROTECTION AND IS OFFERED ONLY
    34** PURSUANT TO THE 3DFX GLIDE GENERAL PUBLIC LICENSE. THERE IS NO RIGHT
    45** TO USE THE GLIDE TRADEMARK WITHOUT PRIOR WRITTEN PERMISSION OF 3DFX
    5 ** INTERACTIVE, INC. A COPY OF THIS LICENSE MAY BE OBTAINED FROM THE 
    6 ** DISTRIBUTOR OR BY CONTACTING 3DFX INTERACTIVE INC(info@3dfx.com). 
    7 ** THIS PROGRAM IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER 
     6** INTERACTIVE, INC. A COPY OF THIS LICENSE MAY BE OBTAINED FROM THE
     7** DISTRIBUTOR OR BY CONTACTING 3DFX INTERACTIVE INC(info@3dfx.com).
     8** THIS PROGRAM IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER
    89** EXPRESSED OR IMPLIED. SEE THE 3DFX GLIDE GENERAL PUBLIC LICENSE FOR A
    9 ** FULL TEXT OF THE NON-WARRANTY PROVISIONS. 
    10 ** 
     10** FULL TEXT OF THE NON-WARRANTY PROVISIONS.
     11**
    1112** USE, DUPLICATION OR DISCLOSURE BY THE GOVERNMENT IS SUBJECT TO
    1213** RESTRICTIONS AS SET FORTH IN SUBDIVISION (C)(1)(II) OF THE RIGHTS IN
     
    1415** AND/OR IN SIMILAR OR SUCCESSOR CLAUSES IN THE FAR, DOD OR NASA FAR
    1516** SUPPLEMENT. UNPUBLISHED RIGHTS RESERVED UNDER THE COPYRIGHT LAWS OF
    16 ** THE UNITED STATES. 
    17 ** 
     17** THE UNITED STATES.
     18**
    1819** COPYRIGHT 3DFX INTERACTIVE, INC. 1999, ALL RIGHTS RESERVED
    1920**
    2021**
    21 ** $Revision: 1.1 $
    22 ** $Date: 2000-02-25 00:31:27 $
     22** $Revision: 1.2 $
     23** $Date: 2001-09-05 14:31:00 $
    2324**
    2425*/
     
    5051                        int                     *fbStride,
    5152                        sst1VideoTimingStruct   *vidTimings) {
    52     return init96SetVideo( hWnd, sRes, vRefresh, cFormat, yOrigin, 
     53    return init96SetVideo( hWnd, sRes, vRefresh, cFormat, yOrigin,
    5354                           nColBuffers, nAuxBuffers,
    5455                           &context->info.regs,
     
    7273        init96Swap( code, &context->info.regs, context->writeMethod );
    7374    return INIT_SWAP_FLIP;
    74 } 
     75}
    7576
    7677static FxU32 status( void ) {
    7778  return *(context->info.regs.hwDep.VG96RegDesc.serialStatus);
    78 } 
     79}
    7980
    8081static FxBool busy(void) {
     
    8485
    8586  return rv;
    86 } 
     87}
    8788
    8889static void idle( void ) {
     
    111112    FxBool rv = FXFALSE;
    112113    GDBG_INFO((80, "vg96drvr: control: code = %d\n", code));
    113     if (context) 
     114    if (context)
    114115        rv = init96Control( code, &context->info.regs);
    115116    return rv;
     
    160161    context->initGammaTable   = gammatable;
    161162    context->findVidTimingStruct = findvidtiming;
    162 } 
     163}
    163164#else
    164165/* I've got to stub this one to get the Voodoo Graphics glide to link */
     
    184185    context->gammaRGB         = NULL;
    185186    context->initGammaTable   = NULL;
    186     context->findVidTimingStruct = NULL; 
     187    context->findVidTimingStruct = NULL;
    187188
    188189}
  • trunk/src/opengl/glide/sst1/init/vgdrvr.c

    r2885 r6653  
     1/* $Id: vgdrvr.c,v 1.2 2001-09-05 14:31:01 bird Exp $ */
    12/*
    23** THIS SOFTWARE IS SUBJECT TO COPYRIGHT PROTECTION AND IS OFFERED ONLY
    34** PURSUANT TO THE 3DFX GLIDE GENERAL PUBLIC LICENSE. THERE IS NO RIGHT
    45** TO USE THE GLIDE TRADEMARK WITHOUT PRIOR WRITTEN PERMISSION OF 3DFX
    5 ** INTERACTIVE, INC. A COPY OF THIS LICENSE MAY BE OBTAINED FROM THE 
    6 ** DISTRIBUTOR OR BY CONTACTING 3DFX INTERACTIVE INC(info@3dfx.com). 
    7 ** THIS PROGRAM IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER 
     6** INTERACTIVE, INC. A COPY OF THIS LICENSE MAY BE OBTAINED FROM THE
     7** DISTRIBUTOR OR BY CONTACTING 3DFX INTERACTIVE INC(info@3dfx.com).
     8** THIS PROGRAM IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER
    89** EXPRESSED OR IMPLIED. SEE THE 3DFX GLIDE GENERAL PUBLIC LICENSE FOR A
    9 ** FULL TEXT OF THE NON-WARRANTY PROVISIONS. 
    10 ** 
     10** FULL TEXT OF THE NON-WARRANTY PROVISIONS.
     11**
    1112** USE, DUPLICATION OR DISCLOSURE BY THE GOVERNMENT IS SUBJECT TO
    1213** RESTRICTIONS AS SET FORTH IN SUBDIVISION (C)(1)(II) OF THE RIGHTS IN
     
    1415** AND/OR IN SIMILAR OR SUCCESSOR CLAUSES IN THE FAR, DOD OR NASA FAR
    1516** SUPPLEMENT. UNPUBLISHED RIGHTS RESERVED UNDER THE COPYRIGHT LAWS OF
    16 ** THE UNITED STATES. 
    17 ** 
     17** THE UNITED STATES.
     18**
    1819** COPYRIGHT 3DFX INTERACTIVE, INC. 1999, ALL RIGHTS RESERVED
    1920**
    2021**
    21 ** $Revision: 1.1 $
    22 ** $Date: 2000-02-25 00:31:27 $
     22** $Revision: 1.2 $
     23** $Date: 2001-09-05 14:31:01 $
    2324**
    2425*/
     
    4546    static int _w[] = {320,320,400,512,640,640,640,640,800,960,856,512};
    4647    static int _h[] = {200,240,256,384,200,350,400,480,600,720,480,256};
    47    
     48
    4849    rv = sst1InitVideo( (FxU32*)context->info.hwDep.vgInfo.vgBaseAddr,
    4950                        sRes,
    50                         vRefresh, 
     51                        vRefresh,
    5152                        vidTimings );
    5253
     
    5859        rv = sst1InitVideo( (FxU32*)context->info.hwDep.vgInfo.slaveBaseAddr,
    5960                            sRes,
    60                             vRefresh, 
     61                            vRefresh,
    6162                            vidTimings );
    6263        if ( !rv ) goto BAIL;
     
    8889
    8990    if ( info ) {
    90         rv = sst1InitGetDeviceInfo( (FxU32*)context->info.hwDep.vgInfo.vgBaseAddr, 
     91        rv = sst1InitGetDeviceInfo( (FxU32*)context->info.hwDep.vgInfo.vgBaseAddr,
    9192                                    &sstInfo );
    9293        info->hwDep.vgFIFOData.memFifoStatusLwm = sstInfo.memFifoStatusLwm;
     
    103104static InitSwapType_t FX_CALL swapBuffers( FxU32 code ) {
    104105    return INIT_SWAP_FLIP;
    105 } 
     106}
    106107
    107108static FxU32 FX_CALL status( void ) {
    108109  return sst1InitReturnStatus((FxU32 *) context->info.hwDep.vgInfo.vgBaseAddr);
    109 } 
     110}
    110111
    111112static FxBool FX_CALL busy(void) {
    112113  FxU32 stat = status();
    113114  FxBool ret = (stat & SST_BUSY) ? FXTRUE : FXFALSE;
    114  
     115
    115116  return ret;
    116 } 
     117}
    117118
    118119static void FX_CALL idle( void ) {
Note: See TracChangeset for help on using the changeset viewer.