Changeset 6653 for trunk/src/opengl/glide/cvg/init
- Timestamp:
- Sep 5, 2001, 4:31:14 PM (24 years ago)
- Location:
- trunk/src/opengl/glide/cvg/init
- Files:
-
- 10 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/opengl/glide/cvg/init/dac.c
r2888 r6653 1 /* $Id: dac.c,v 1.2 2001-09-05 14:30:35 bird Exp $ */ 1 2 /* 2 3 ** THIS SOFTWARE IS SUBJECT TO COPYRIGHT PROTECTION AND IS OFFERED ONLY 3 4 ** PURSUANT TO THE 3DFX GLIDE GENERAL PUBLIC LICENSE. THERE IS NO RIGHT 4 5 ** 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 8 9 ** 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 ** 11 12 ** USE, DUPLICATION OR DISCLOSURE BY THE GOVERNMENT IS SUBJECT TO 12 13 ** RESTRICTIONS AS SET FORTH IN SUBDIVISION (C)(1)(II) OF THE RIGHTS IN … … 14 15 ** AND/OR IN SIMILAR OR SUCCESSOR CLAUSES IN THE FAR, DOD OR NASA FAR 15 16 ** SUPPLEMENT. UNPUBLISHED RIGHTS RESERVED UNDER THE COPYRIGHT LAWS OF 16 ** THE UNITED STATES. 17 ** 17 ** THE UNITED STATES. 18 ** 18 19 ** COPYRIGHT 3DFX INTERACTIVE, INC. 1999, ALL RIGHTS RESERVED 19 20 ** 20 21 ** 21 ** $Revision: 1. 1 $22 ** $Date: 200 0-02-25 00:37:51 $22 ** $Revision: 1.2 $ 23 ** $Date: 2001-09-05 14:30:35 $ 23 24 ** 24 25 ** Initialization code for initializing supported SST-1 DACs … … 45 46 ** Read external DAC registers 46 47 ** NOTE: The video unit of FBI must be in reset before calling this routine. 47 ** The rendering engines of FBI and TREX must be idle before calling 48 ** The rendering engines of FBI and TREX must be idle before calling 48 49 ** this routine. 49 50 ** fbiInit23 register remapping (PCI config. initEnable[2]=1) must be … … 78 79 ** Write to external DAC registers 79 80 ** NOTE: The video unit of FBI must be in reset before calling this routine. 80 ** The rendering engines of FBI and TREX must be idle before calling 81 ** The rendering engines of FBI and TREX must be idle before calling 81 82 ** this routine. 82 83 ** … … 613 614 { 614 615 float calc; 615 616 616 617 calc = ((float) 14.318 * (float) (m + 2)) / 617 618 ((float) (n + 2) * vcoFreqDivide); … … 694 695 vcoFreq = ((float) 14.31818 * (float) (clkTiming->clkTiming_M + 2)) / 695 696 ((float) (clkTiming->clkTiming_N + 2)); 696 697 697 698 printf("freq:%.3f calc:%.3f\n", freq, clkFreq); 698 699 printf("m:%d p:%d n:%d vco:%.2f\n", clkTiming->clkTiming_M, -
trunk/src/opengl/glide/cvg/init/gamma.c
r2888 r6653 1 1 /*-*-c++-*-*/ 2 /* $Id: gamma.c,v 1.2 2001-09-05 14:30:36 bird Exp $ */ 2 3 /* 3 4 ** THIS SOFTWARE IS SUBJECT TO COPYRIGHT PROTECTION AND IS OFFERED ONLY 4 5 ** PURSUANT TO THE 3DFX GLIDE GENERAL PUBLIC LICENSE. THERE IS NO RIGHT 5 6 ** TO USE THE GLIDE TRADEMARK WITHOUT PRIOR WRITTEN PERMISSION OF 3DFX 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 7 ** INTERACTIVE, INC. A COPY OF THIS LICENSE MAY BE OBTAINED FROM THE 8 ** DISTRIBUTOR OR BY CONTACTING 3DFX INTERACTIVE INC(info@3dfx.com). 9 ** THIS PROGRAM IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER 9 10 ** EXPRESSED OR IMPLIED. SEE THE 3DFX GLIDE GENERAL PUBLIC LICENSE FOR A 10 ** FULL TEXT OF THE NON-WARRANTY PROVISIONS. 11 ** 11 ** FULL TEXT OF THE NON-WARRANTY PROVISIONS. 12 ** 12 13 ** USE, DUPLICATION OR DISCLOSURE BY THE GOVERNMENT IS SUBJECT TO 13 14 ** RESTRICTIONS AS SET FORTH IN SUBDIVISION (C)(1)(II) OF THE RIGHTS IN … … 15 16 ** AND/OR IN SIMILAR OR SUCCESSOR CLAUSES IN THE FAR, DOD OR NASA FAR 16 17 ** SUPPLEMENT. UNPUBLISHED RIGHTS RESERVED UNDER THE COPYRIGHT LAWS OF 17 ** THE UNITED STATES. 18 ** 18 ** THE UNITED STATES. 19 ** 19 20 ** COPYRIGHT 3DFX INTERACTIVE, INC. 1999, ALL RIGHTS RESERVED 20 21 ** 21 22 ** 22 ** $Revision: 1. 1 $23 ** $Date: 200 0-02-25 00:37:51 $23 ** $Revision: 1.2 $ 24 ** $Date: 2001-09-05 14:30:36 $ 24 25 ** 25 26 ** Initialization code for loading SST-1 gamma tables … … 149 150 FxU32 gcG = gammaTableG[(x<<3)]; 150 151 FxU32 gcB = gammaTableB[(x<<3)]; 151 ISET(sst->clutData, ((x<<SST_CLUTDATA_INDEX_SHIFT) | 152 ISET(sst->clutData, ((x<<SST_CLUTDATA_INDEX_SHIFT) | 152 153 (gcR<<SST_CLUTDATA_RED_SHIFT) | 153 154 (gcG<<SST_CLUTDATA_GREEN_SHIFT) | … … 217 218 FxU32 gcG = gammaTableG[(x)]; 218 219 FxU32 gcB = gammaTableB[(x)]; 219 ISET(sst->clutData, ((x<<SST_CLUTDATA_INDEX_SHIFT) | 220 ISET(sst->clutData, ((x<<SST_CLUTDATA_INDEX_SHIFT) | 220 221 (gcR<<SST_CLUTDATA_RED_SHIFT) | 221 222 (gcG<<SST_CLUTDATA_GREEN_SHIFT) | -
trunk/src/opengl/glide/cvg/init/gdebug.c
r2888 r6653 1 1 /*-*-c++-*-*/ 2 /* $Id: gdebug.c,v 1.2 2001-09-05 14:30:37 bird Exp $ */ 2 3 #include "vxd.h" 3 4 … … 6 7 ** PURSUANT TO THE 3DFX GLIDE GENERAL PUBLIC LICENSE. THERE IS NO RIGHT 7 8 ** TO USE THE GLIDE TRADEMARK WITHOUT PRIOR WRITTEN PERMISSION OF 3DFX 8 ** INTERACTIVE, INC. A COPY OF THIS LICENSE MAY BE OBTAINED FROM THE 9 ** DISTRIBUTOR OR BY CONTACTING 3DFX INTERACTIVE INC(info@3dfx.com). 10 ** THIS PROGRAM IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER 9 ** INTERACTIVE, INC. A COPY OF THIS LICENSE MAY BE OBTAINED FROM THE 10 ** DISTRIBUTOR OR BY CONTACTING 3DFX INTERACTIVE INC(info@3dfx.com). 11 ** THIS PROGRAM IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER 11 12 ** EXPRESSED OR IMPLIED. SEE THE 3DFX GLIDE GENERAL PUBLIC LICENSE FOR A 12 ** FULL TEXT OF THE NON-WARRANTY PROVISIONS. 13 ** 13 ** FULL TEXT OF THE NON-WARRANTY PROVISIONS. 14 ** 14 15 ** USE, DUPLICATION OR DISCLOSURE BY THE GOVERNMENT IS SUBJECT TO 15 16 ** RESTRICTIONS AS SET FORTH IN SUBDIVISION (C)(1)(II) OF THE RIGHTS IN … … 17 18 ** AND/OR IN SIMILAR OR SUCCESSOR CLAUSES IN THE FAR, DOD OR NASA FAR 18 19 ** SUPPLEMENT. UNPUBLISHED RIGHTS RESERVED UNDER THE COPYRIGHT LAWS OF 19 ** THE UNITED STATES. 20 ** 20 ** THE UNITED STATES. 21 ** 21 22 ** COPYRIGHT 3DFX INTERACTIVE, INC. 1999, ALL RIGHTS RESERVED 22 23 ** 23 ** $Revision: 1. 1$24 ** $Date: 200 0-02-25 00:37:51$24 ** $Revision: 1.2 $ 25 ** $Date: 2001-09-05 14:30:37 $ 25 26 */ 26 27 … … 66 67 #endif 67 68 68 static char *gdbg_myname = "gd"; // default library name69 static char gdbg_debuglevel[GDBG_MAX_LEVELS]; // array of debuglevel controls69 static char *gdbg_myname = "gd"; // default library name 70 static char gdbg_debuglevel[GDBG_MAX_LEVELS]; // array of debuglevel controls 70 71 71 72 static long gdbg_errors = 0; … … 82 83 { 83 84 if (level >= GDBG_MAX_LEVELS) 84 level = GDBG_MAX_LEVELS - 1;85 level = GDBG_MAX_LEVELS - 1; 85 86 86 87 gdbg_debuglevel[level] = value; … … 89 90 90 91 #ifndef KERNEL_NT 91 // we need to call a kernal printf. 92 // we need to call a kernal printf. 92 93 extern int __cdecl klvfprintf(FILE *stream, 93 94 const char *format, … … 95 96 #endif 96 97 97 static FILE *gdbg_msgfile; // GDBG info/error file98 static FILE *gdbg_msgfile; // GDBG info/error file 98 99 #else /* #ifdef KERNEL */ 99 100 100 static FILE *gdbg_msgfile = NULL; /*stdout;*/ // GDBG info/error file101 static FILE *gdbg_msgfile = NULL; /*stdout;*/ // GDBG info/error file 101 102 102 103 //---------------------------------------------------------------------- … … 107 108 int r0,r1,pos; 108 109 109 sscanf(buf,"%i%n",&r0,&pos); // parse the first integer110 if (buf[pos]=='-' || buf[pos]==':') { // if there's a second111 buf += pos+1;112 sscanf(buf,"%i%n",&r1,&pos);// then parse it110 sscanf(buf,"%i%n",&r0,&pos); // parse the first integer 111 if (buf[pos]=='-' || buf[pos]==':') { // if there's a second 112 buf += pos+1; 113 sscanf(buf,"%i%n",&r1,&pos); // then parse it 113 114 } 114 115 else 115 r1 = r0;116 117 if (r0 < 0) r0 = 0; // sanity checks116 r1 = r0; 117 118 if (r0 < 0) r0 = 0; // sanity checks 118 119 if (r1 >= GDBG_MAX_LEVELS) r1 = GDBG_MAX_LEVELS-1; 119 120 if (r1 < r0) r1 = r0; 120 121 121 while (r0 <= r1) // now set the debuglevel levels122 gdbg_debuglevel[r0++] = val;123 124 return buf + pos; // and return rest of string122 while (r0 <= r1) // now set the debuglevel levels 123 gdbg_debuglevel[r0++] = val; 124 125 return buf + pos; // and return rest of string 125 126 } 126 127 … … 131 132 132 133 do { 133 if (env[0] == ',')// advance past commas134 env++;135 if (env[0] == '+')// if + then enable a range136 env = setRange(env+1,1);137 else if (env[0] == '-')// if - then disable a range138 env = setRange(env+1,0);139 else {// else just a number140 if (sscanf(env,"%i%n",&level,&pos) <= 0) return;141 if (pos==0) return;// oops, guess not142 if (level >= GDBG_MAX_LEVELS) level = GDBG_MAX_LEVELS-1;143 while (level >= 0)// enable the range [0,#]144 gdbg_debuglevel[level--] = 1;145 env += pos;146 }134 if (env[0] == ',') // advance past commas 135 env++; 136 if (env[0] == '+') // if + then enable a range 137 env = setRange(env+1,1); 138 else if (env[0] == '-') // if - then disable a range 139 env = setRange(env+1,0); 140 else { // else just a number 141 if (sscanf(env,"%i%n",&level,&pos) <= 0) return; 142 if (pos==0) return; // oops, guess not 143 if (level >= GDBG_MAX_LEVELS) level = GDBG_MAX_LEVELS-1; 144 while (level >= 0) // enable the range [0,#] 145 gdbg_debuglevel[level--] = 1; 146 env += pos; 147 } 147 148 } while (env[0] == ','); 148 149 } … … 153 154 gdbg_init(void) 154 155 { 155 static int done=0; // only execute once156 static int done=0; // only execute once 156 157 char *env; 157 158 … … 163 164 164 165 #if __MWERKS__ 165 SIOUXSettings.standalone= false;166 SIOUXSettings.setupmenus= false;167 SIOUXSettings.autocloseonquit= true;168 SIOUXSettings.asktosaveonclose= false;169 #endif 170 166 SIOUXSettings.standalone = false; 167 SIOUXSettings.setupmenus = false; 168 SIOUXSettings.autocloseonquit = true; 169 SIOUXSettings.asktosaveonclose = false; 170 #endif 171 171 172 #ifdef KERNEL 172 // put code in here to set the default level173 gdbg_debuglevel[0] = 1; // always enable level 0174 gdbg_debuglevel[120] = 1; // always enable level 0173 // put code in here to set the default level 174 gdbg_debuglevel[0] = 1; // always enable level 0 175 gdbg_debuglevel[120] = 1; // always enable level 0 175 176 done = 1; 176 177 env = 0; … … 178 179 #else /* #ifdef KERNEL */ 179 180 done = 1; 180 gdbg_debuglevel[0] = 1; // always enable level 0181 gdbg_debuglevel[0] = 1; // always enable level 0 181 182 env = GETENV("GDBG_FILE"); 182 183 if (env != NULL) GDBG_SET_FILE(env); … … 193 194 gdbg_info(1,"gdbg_shutdown()\n"); 194 195 #ifndef KERNEL 195 if (gdbg_msgfile != stdout) { // close any existing output file196 if (gdbg_msgfile != stdout) { // close any existing output file 196 197 #if USE_DEBUG_STRING 197 if (!UseDebugString) 198 if (!UseDebugString) 198 199 #endif /* USE_DEBUG_STRING */ 199 200 fclose(gdbg_msgfile); … … 286 287 __asm mov ebx, format; 287 288 MyPrintf(); 288 #endif /* #ifndef KERNEL */ 289 #endif /* #ifndef KERNEL */ 289 290 290 291 } … … 307 308 308 309 if (!gdbg_debuglevel[level>=GDBG_MAX_LEVELS ? GDBG_MAX_LEVELS-1 : level]) 309 return(0);310 return(0); 310 311 #ifndef KERNEL 311 312 va_start(args, format); … … 341 342 342 343 if (!gdbg_debuglevel[level>=GDBG_MAX_LEVELS ? GDBG_MAX_LEVELS-1 : level]) 343 return(0);344 return(0); 344 345 #ifndef KERNEL 345 346 va_start(args, format); … … 406 407 va_start(args, format); 407 408 sprintf(newformat, "%s error (%s): ", gdbg_myname,kind); 408 strcat(newformat,format); // add a preamble to message409 strcat(newformat,format); // add a preamble to message 409 410 gdbg_vprintf(newformat,args); 410 gdbg_errors++; // increment the error counter411 va_end(args); 412 411 gdbg_errors++; // increment the error counter 412 va_end(args); 413 413 414 { 414 415 int i; 415 416 const int count = sizeof(errorProcList) / sizeof(errorProcList[0]); 416 417 417 418 for(i = 0; i < count; i++) { 418 419 if (errorProcList[i] != NULL) { … … 466 467 FILE *outf; 467 468 468 if (gdbg_msgfile != stdout) { // close any existing output file469 if (gdbg_msgfile != stdout) { // close any existing output file 469 470 fclose(gdbg_msgfile); 470 471 gdbg_msgfile = stdout; … … 475 476 gdbg_msgfile = (FILE *) 1; 476 477 UseDebugString = 1; 477 } else 478 } else 478 479 #endif /* USE_DEBUG_STRING */ 479 480 { 480 outf = fopen(name,"w"); // open up a new one481 outf = fopen(name,"w"); // open up a new one 481 482 if (outf) gdbg_msgfile = outf; 482 483 } … … 485 486 #else /* #ifndef KERNEL */ 486 487 return 0; 487 #endif /* #ifndef KERNEL */ 488 } 488 #endif /* #ifndef KERNEL */ 489 } -
trunk/src/opengl/glide/cvg/init/info.c
r2888 r6653 1 /* $Id: info.c,v 1.2 2001-09-05 14:30:37 bird Exp $ */ 1 2 /* 2 3 ** THIS SOFTWARE IS SUBJECT TO COPYRIGHT PROTECTION AND IS OFFERED ONLY 3 4 ** PURSUANT TO THE 3DFX GLIDE GENERAL PUBLIC LICENSE. THERE IS NO RIGHT 4 5 ** 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 8 9 ** 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 ** 11 12 ** USE, DUPLICATION OR DISCLOSURE BY THE GOVERNMENT IS SUBJECT TO 12 13 ** RESTRICTIONS AS SET FORTH IN SUBDIVISION (C)(1)(II) OF THE RIGHTS IN … … 14 15 ** AND/OR IN SIMILAR OR SUCCESSOR CLAUSES IN THE FAR, DOD OR NASA FAR 15 16 ** SUPPLEMENT. UNPUBLISHED RIGHTS RESERVED UNDER THE COPYRIGHT LAWS OF 16 ** THE UNITED STATES. 17 ** 17 ** THE UNITED STATES. 18 ** 18 19 ** COPYRIGHT 3DFX INTERACTIVE, INC. 1999, ALL RIGHTS RESERVED 19 20 ** 20 21 ** 21 ** $Revision: 1. 1 $22 ** $Date: 200 0-02-25 00:37:52 $22 ** $Revision: 1.2 $ 23 ** $Date: 2001-09-05 14:30:37 $ 23 24 ** 24 25 ** Routines to detect memory size, strapping pin, and other initialization … … 43 44 #define XY_ONE (1<<SST_XY_FRACBITS) 44 45 45 static FxBool 46 readAndSum4x4(FxU32 *sstbase, FxU32 x, FxU32 y, 47 FxU32 *r_sum, FxU32 *g_sum, FxU32 *b_sum)46 static FxBool 47 readAndSum4x4(FxU32 *sstbase, FxU32 x, FxU32 y, 48 FxU32 *r_sum, FxU32 *g_sum, FxU32 *b_sum) 48 49 { 49 50 FxU32 rd_x, rd_y; … … 56 57 sst1InitIdle(sstbase); 57 58 if (x & 1) { 58 INIT_PRINTF(("ERROR: readAndSum4x4 must have an even X (%d)\n", x));59 return(FXFALSE);59 INIT_PRINTF(("ERROR: readAndSum4x4 must have an even X (%d)\n", x)); 60 return(FXFALSE); 60 61 } 61 62 … … 65 66 *b_sum = 0; 66 67 67 for (rd_y = 0; rd_y < 4; rd_y++) { /* read 4 scanlines */68 for (rd_x = 0; rd_x < 4; rd_x ++) {69 if ((rd_x & 1)==0) {/* read 2 pixels at a time */70 rd_col =71 IGET(sstbase[(SST_LFB_ADDR + (y+rd_y)*2048 + (x+rd_x)*2) >> 2]);72 }73 else rd_col >>= 16;74 rd_r = ((rd_col >> 11) & 0x1f) << 3;75 rd_g = ((rd_col >> 5) & 0x3f) << 2;76 rd_b = ((rd_col >> 0) & 0x1f) << 3;77 *r_sum += rd_r;78 *g_sum += rd_g;79 *b_sum += rd_b;80 INIT_INFO((4,"%d,%d = rd_col: 0x%04x rgb: %02x %02x %02x\n",81 rd_x, rd_y, (rd_col & 0xffff), rd_r, rd_g, rd_b));82 }68 for (rd_y = 0; rd_y < 4; rd_y++) { /* read 4 scanlines */ 69 for (rd_x = 0; rd_x < 4; rd_x ++) { 70 if ((rd_x & 1)==0) { /* read 2 pixels at a time */ 71 rd_col = 72 IGET(sstbase[(SST_LFB_ADDR + (y+rd_y)*2048 + (x+rd_x)*2) >> 2]); 73 } 74 else rd_col >>= 16; 75 rd_r = ((rd_col >> 11) & 0x1f) << 3; 76 rd_g = ((rd_col >> 5) & 0x3f) << 2; 77 rd_b = ((rd_col >> 0) & 0x1f) << 3; 78 *r_sum += rd_r; 79 *g_sum += rd_g; 80 *b_sum += rd_b; 81 INIT_INFO((4,"%d,%d = rd_col: 0x%04x rgb: %02x %02x %02x\n", 82 rd_x, rd_y, (rd_col & 0xffff), rd_r, rd_g, rd_b)); 83 } 83 84 } 84 85 INIT_INFO((3,"sums: r_sum=0x%03x g_sum=0x%03x b_sum=0x%03x\n", 85 *r_sum, *g_sum, *b_sum));86 return(FXTRUE);86 *r_sum, *g_sum, *b_sum)); 87 return(FXTRUE); 87 88 } 88 89 … … 123 124 /* init sum array */ 124 125 for (r_sum = 0; r_sum <= 0xfff; r_sum++) { 125 rb_tbl[r_sum] = -1;126 g_tbl[r_sum] = -1;126 rb_tbl[r_sum] = -1; 127 g_tbl[r_sum] = -1; 127 128 } 128 129 … … 132 133 /* fill sum array */ 133 134 for (tst_color = 0; tst_color <= 255; tst_color++) { 134 INIT_INFO((2,"tst_color=0x%02x\n", tst_color));135 ISET(sst->c1, (tst_color << 16) | (tst_color << 8) | tst_color);136 137 drawTriangle(sst, x,y,36);138 if(readAndSum4x4(sstbase, x,y, &r_sum,&g_sum,&b_sum) == FXFALSE)139 return(FXFALSE);140 141 /* check sums for uniqueness and then store away */142 if (r_sum != b_sum) {143 INIT_PRINTF(("ERROR: b_sum=0x%03x r_sum=0x%03x\n", r_sum, b_sum));144 return(FXFALSE);145 }146 if (rb_tbl[r_sum] != -1) {147 INIT_PRINTF(("ERROR: non-unique r/b_sum=0x%03x\n", r_sum));148 return(FXFALSE);149 }150 rb_tbl[r_sum] = tst_color;151 if (g_tbl[g_sum] != -1) {152 INIT_PRINTF(("ERROR: non-unique g_sum=0x%03x\n", g_sum));153 return(FXFALSE);154 }155 g_tbl[g_sum] = tst_color;156 } 157 return(FXTRUE);135 INIT_INFO((2,"tst_color=0x%02x\n", tst_color)); 136 ISET(sst->c1, (tst_color << 16) | (tst_color << 8) | tst_color); 137 138 drawTriangle(sst, x,y,36); 139 if(readAndSum4x4(sstbase, x,y, &r_sum,&g_sum,&b_sum) == FXFALSE) 140 return(FXFALSE); 141 142 /* check sums for uniqueness and then store away */ 143 if (r_sum != b_sum) { 144 INIT_PRINTF(("ERROR: b_sum=0x%03x r_sum=0x%03x\n", r_sum, b_sum)); 145 return(FXFALSE); 146 } 147 if (rb_tbl[r_sum] != -1) { 148 INIT_PRINTF(("ERROR: non-unique r/b_sum=0x%03x\n", r_sum)); 149 return(FXFALSE); 150 } 151 rb_tbl[r_sum] = tst_color; 152 if (g_tbl[g_sum] != -1) { 153 INIT_PRINTF(("ERROR: non-unique g_sum=0x%03x\n", g_sum)); 154 return(FXFALSE); 155 } 156 g_tbl[g_sum] = tst_color; 157 } 158 return(FXTRUE); 158 159 } 159 160 … … 164 165 if (rb_tbl[r_sum] == -1 || g_tbl[g_sum] == -1 || rb_tbl[b_sum] == -1) 165 166 { 166 INIT_PRINTF(("ERROR: unDither: invalid color sum\n"));167 return(FXFALSE);167 INIT_PRINTF(("ERROR: unDither: invalid color sum\n")); 168 return(FXFALSE); 168 169 } 169 170 *result = (rb_tbl[r_sum] << 16) | (g_tbl[g_sum] << 8) | rb_tbl[b_sum]; 170 return(FXTRUE);171 return(FXTRUE); 171 172 } 172 173 … … 177 178 FxU32 r_sum, g_sum, b_sum; 178 179 SstRegs *sst = (SstRegs *) sstbase; 179 FxU32 tmuRevision;180 FxU32 tmuRevision; 180 181 181 182 /* set trex's (all 3) to output configuration bits */ … … 186 187 /* render into the frame buffer */ 187 188 ISET(sst->fbzColorPath, 188 SST_RGBSEL_TREXOUT | SST_CC_PASS | SST_ENTEXTUREMAP);189 SST_RGBSEL_TREXOUT | SST_CC_PASS | SST_ENTEXTUREMAP); 189 190 ISET(sst->texBaseAddr, 0); 190 191 ISET(sst->textureMode, SST_AI88 | SST_TC_PASS | SST_TCA_PASS); … … 193 194 194 195 readAndSum4x4(sstbase, x,y, &r_sum,&g_sum,&b_sum); 195 if(GETENV(("SSTV2_TEXMAP_DISABLE"))) {196 info->tmuConfig = 0x0;197 } else {198 if(unDither(r_sum,g_sum,b_sum,&info->tmuConfig) == FXFALSE)199 return(FXFALSE);200 }201 202 /////////////////////////203 // Get new revision...204 /////////////////////////196 if(GETENV(("SSTV2_TEXMAP_DISABLE"))) { 197 info->tmuConfig = 0x0; 198 } else { 199 if(unDither(r_sum,g_sum,b_sum,&info->tmuConfig) == FXFALSE) 200 return(FXFALSE); 201 } 202 203 ///////////////////////// 204 // Get new revision... 205 ///////////////////////// 205 206 ISET(SST_TREX(sst,0)->trexInit1, info->tmuInit1[0] | (1 << 18) | 206 (5 << SST_TEX_SEND_CONFIG_SEL_SHIFT));207 (5 << SST_TEX_SEND_CONFIG_SEL_SHIFT)); 207 208 ISET(SST_TREX(sst,1)->trexInit1, info->tmuInit1[1] | (1 << 18)); 208 209 ISET(SST_TREX(sst,2)->trexInit1, info->tmuInit1[2] | (1 << 18)); … … 210 211 /* render into the frame buffer */ 211 212 ISET(sst->fbzColorPath, 212 SST_RGBSEL_TREXOUT | SST_CC_PASS | SST_ENTEXTUREMAP);213 SST_RGBSEL_TREXOUT | SST_CC_PASS | SST_ENTEXTUREMAP); 213 214 ISET(sst->texBaseAddr, 0); 214 215 ISET(sst->textureMode, SST_AI88 | SST_TC_PASS | SST_TCA_PASS); … … 217 218 218 219 readAndSum4x4(sstbase, x,y, &r_sum,&g_sum,&b_sum); 219 if(unDither(r_sum,g_sum,b_sum,&tmuRevision) == FXFALSE)220 return(FXFALSE);221 222 info->tmuFab[0] = (tmuRevision >> 4) & 0xf;223 info->tmuFab[1] = (tmuRevision >> 12) & 0xf;224 info->tmuFab[2] = (tmuRevision >> 20) & 0xf;225 226 /* Adjust configuration structure for "new" revision ID */227 info->tmuConfig &= ~(0x7 | (0x7<<7) | (0x7<<14));228 info->tmuConfig |= (((tmuRevision & 0x7) + 3) |229 ((((tmuRevision >> 8) & 0x7) + 3) << 7) |230 ((((tmuRevision >> 16) & 0x7) + 3) << 14));220 if(unDither(r_sum,g_sum,b_sum,&tmuRevision) == FXFALSE) 221 return(FXFALSE); 222 223 info->tmuFab[0] = (tmuRevision >> 4) & 0xf; 224 info->tmuFab[1] = (tmuRevision >> 12) & 0xf; 225 info->tmuFab[2] = (tmuRevision >> 20) & 0xf; 226 227 /* Adjust configuration structure for "new" revision ID */ 228 info->tmuConfig &= ~(0x7 | (0x7<<7) | (0x7<<14)); 229 info->tmuConfig |= (((tmuRevision & 0x7) + 3) | 230 ((((tmuRevision >> 8) & 0x7) + 3) << 7) | 231 ((((tmuRevision >> 16) & 0x7) + 3) << 14)); 231 232 232 233 /* reset trex's init registers */ … … 235 236 ISET(SST_TREX(sst,2)->trexInit1, info->tmuInit1[2]); 236 237 237 if(GETENV(("SSTV2_TMUCFG")))238 if(GETENV(("SSTV2_TMUCFG"))) 238 239 SSCANF(GETENV(("SSTV2_TMUCFG")), "%i", &info->tmuConfig); 239 240 240 return(FXTRUE);241 return(FXTRUE); 241 242 } 242 243 … … 246 247 247 248 static FxU32 sense(FxU32 *sstbase, sst1DeviceInfoStruct *info, FxU32 tmu, 248 FxU32 mem, FxU32 init)249 FxU32 mem, FxU32 init) 249 250 { 250 251 SstRegs *sst = (SstRegs *) sstbase; … … 256 257 sst1InitIdle(sstbase); 257 258 258 ISET(sst->texBaseAddr, 0x200000>>3); /* set to 2 MB */259 ISET(texAddr[0], SENSE2); /* write a random value */260 261 ISET(sst->texBaseAddr, 0x100000>>3); /* set to 1 MB */262 ISET(texAddr[0], SENSE1); /* write a random value */263 264 ISET(sst->texBaseAddr, 0x000000>>3); /* set to 0 MB */265 ISET(texAddr[0], SENSE0); /* write a random value */266 267 ISET(sst->texBaseAddr, mem>>3); /* reset to 2 MB */268 drawTriangle(sst,0,0,4); /* draw a 4x4 right triangle */259 ISET(sst->texBaseAddr, 0x200000>>3); /* set to 2 MB */ 260 ISET(texAddr[0], SENSE2); /* write a random value */ 261 262 ISET(sst->texBaseAddr, 0x100000>>3); /* set to 1 MB */ 263 ISET(texAddr[0], SENSE1); /* write a random value */ 264 265 ISET(sst->texBaseAddr, 0x000000>>3); /* set to 0 MB */ 266 ISET(texAddr[0], SENSE0); /* write a random value */ 267 268 ISET(sst->texBaseAddr, mem>>3); /* reset to 2 MB */ 269 drawTriangle(sst,0,0,4); /* draw a 4x4 right triangle */ 269 270 sst1InitIdle(sstbase); 270 271 … … 281 282 FX_EXPORT FxBool FX_CSTYLE 282 283 sst1InitGetTmuMemory(FxU32 *sstbase, sst1DeviceInfoStruct *info, FxU32 tmu, 283 FxU32 *TmuMemorySize)284 FxU32 *TmuMemorySize) 284 285 { 285 286 FxU32 i,data; … … 288 289 INIT_INFO((1,"sst1InitGetTmuMemory(0x%x, , %d)\n", sstbase,tmu)); 289 290 290 if(GETENV(("SSTV2_TMU_MEMSIZE"))) {291 *TmuMemorySize = ATOI(GETENV(("SSTV2_TMU_MEMSIZE")));292 // If user specifies 2 MBytes on a 4 MBytes board, disable the293 // second RAS so that apps which may incorrectly store data in the294 // upper 2 Mbytes will not function properly...295 if(*TmuMemorySize == 2) {296 info->tmuInit0[tmu] &= ~SST_EN_TEX_MEM_SECOND_RAS;297 sst1InitIdle(sstbase);298 ISET(SST_TREX(sst,tmu)->trexInit0, info->tmuInit0[tmu]);299 sst1InitIdle(sstbase);300 }301 return(FXTRUE);302 }291 if(GETENV(("SSTV2_TMU_MEMSIZE"))) { 292 *TmuMemorySize = ATOI(GETENV(("SSTV2_TMU_MEMSIZE"))); 293 // If user specifies 2 MBytes on a 4 MBytes board, disable the 294 // second RAS so that apps which may incorrectly store data in the 295 // upper 2 Mbytes will not function properly... 296 if(*TmuMemorySize == 2) { 297 info->tmuInit0[tmu] &= ~SST_EN_TEX_MEM_SECOND_RAS; 298 sst1InitIdle(sstbase); 299 ISET(SST_TREX(sst,tmu)->trexInit0, info->tmuInit0[tmu]); 300 sst1InitIdle(sstbase); 301 } 302 return(FXTRUE); 303 } 303 304 304 305 ISET(sst->lfbMode, SST_LFB_RGBALANES_ARGB | SST_LFB_READFRONTBUFFER); 305 306 ISET(sst->fbzMode, SST_DRAWBUFFER_FRONT | SST_RGBWRMASK); 306 307 ISET(sst->fbzColorPath, 307 SST_RGBSEL_TREXOUT | SST_CC_PASS | SST_ENTEXTUREMAP);308 SST_RGBSEL_TREXOUT | SST_CC_PASS | SST_ENTEXTUREMAP); 308 309 ISET(sst->textureMode, SST_RGB565 | SST_TC_REPLACE | SST_TCA_REPLACE); 309 310 ISET(sst->tLOD, 0); … … 311 312 /* setup all downstream TMUs to be in pass-thru mode */ 312 313 for (i=0; i<tmu; i++) 313 ISET(SST_TREX(sst,i)->textureMode, SST_TC_PASS | SST_TCA_PASS);314 ISET(SST_TREX(sst,i)->textureMode, SST_TC_PASS | SST_TCA_PASS); 314 315 315 316 /* first see if we have 4 Mbytes by writing a texel at 2MB followed by … … 331 332 332 333 INIT_PRINTF(("sst1InitGetTmuMemory() ERROR: Could not detect memory size.\n")); 333 return(FXFALSE);334 return(FXFALSE); 334 335 } 335 336 336 337 /*--------------------------------------------------------------------------- 337 338 NOTES: 338 assumes that board and registers are initialized339 destroys part of the framebuffer339 assumes that board and registers are initialized 340 destroys part of the framebuffer 340 341 ---------------------------------------------------------------------------*/ 341 342 FX_EXPORT FxBool FX_CSTYLE … … 345 346 346 347 if(initSumTables(sstbase) == FXFALSE) 347 return(FXFALSE);348 return(FXFALSE); 348 349 if(getTmuConfigData(sstbase,info) == FXFALSE) 349 return(FXFALSE);350 return(FXFALSE); 350 351 351 352 info->numberTmus = 1; 352 if(GETENV(("SSTV2_TEXMAP_DISABLE"))) {353 info->tmuRevision = 4;354 sst1InitGetTmuMemory(sstbase, info, 0, &info->tmuMemSize[0]);355 info->tmuMemSize[0] = 2;356 } else {357 /* Get TMU memory size */358 info->tmuRevision = info->tmuConfig & 0x7;359 if(sst1InitGetTmuMemory(sstbase, info, 0, &info->tmuMemSize[0]) ==360 FXFALSE)361 return(FXFALSE);362 }353 if(GETENV(("SSTV2_TEXMAP_DISABLE"))) { 354 info->tmuRevision = 4; 355 sst1InitGetTmuMemory(sstbase, info, 0, &info->tmuMemSize[0]); 356 info->tmuMemSize[0] = 2; 357 } else { 358 /* Get TMU memory size */ 359 info->tmuRevision = info->tmuConfig & 0x7; 360 if(sst1InitGetTmuMemory(sstbase, info, 0, &info->tmuMemSize[0]) == 361 FXFALSE) 362 return(FXFALSE); 363 } 363 364 364 365 INIT_INFO((1,"TMU0 memory = %d MB\n", info->tmuMemSize[0])); 365 if (info->tmuConfig & FXBIT(6)) { /* if TMU 1 exists */366 info->numberTmus++;/* increment TMU count */367 trev = (info->tmuConfig>>7) & 0x7;/* get its revision */366 if (info->tmuConfig & FXBIT(6)) { /* if TMU 1 exists */ 367 info->numberTmus++; /* increment TMU count */ 368 trev = (info->tmuConfig>>7) & 0x7; /* get its revision */ 368 369 #if 0 // Ignore for now... 369 if (info->tmuRevision != trev) {370 INIT_PRINTF(("sst1InitGetDeviceInfo: ERROR, multiple different TMU revision IDs detected\n"));371 return(FXFALSE);372 }370 if (info->tmuRevision != trev) { 371 INIT_PRINTF(("sst1InitGetDeviceInfo: ERROR, multiple different TMU revision IDs detected\n")); 372 return(FXFALSE); 373 } 373 374 #endif 374 375 if(sst1InitGetTmuMemory(sstbase, info, 1, &info->tmuMemSize[1]) == FXFALSE) 375 return(FXFALSE);376 } 377 if (info->tmuConfig & FXBIT(13)) { /* if TMU 2 exists */378 info->numberTmus++;/* increment TMU count */379 trev = (info->tmuConfig>>14) & 0x7;/* get its revision */376 return(FXFALSE); 377 } 378 if (info->tmuConfig & FXBIT(13)) { /* if TMU 2 exists */ 379 info->numberTmus++; /* increment TMU count */ 380 trev = (info->tmuConfig>>14) & 0x7; /* get its revision */ 380 381 #if 0 // Ignore for now... 381 if (info->tmuRevision != trev) {382 INIT_PRINTF(("sst1InitGetDeviceInfo: ERROR, multiple different TMU revision IDs detected\n"));383 return(FXFALSE);384 }382 if (info->tmuRevision != trev) { 383 INIT_PRINTF(("sst1InitGetDeviceInfo: ERROR, multiple different TMU revision IDs detected\n")); 384 return(FXFALSE); 385 } 385 386 #endif 386 387 if(sst1InitGetTmuMemory(sstbase, info, 2, &info->tmuMemSize[2]) == FXFALSE) 387 return(FXFALSE);388 } 389 if(GETENV(("SSTV2_NUM_TMUS")))390 info->numberTmus = ATOI(GETENV(("SSTV2_NUM_TMUS")));388 return(FXFALSE); 389 } 390 if(GETENV(("SSTV2_NUM_TMUS"))) 391 info->numberTmus = ATOI(GETENV(("SSTV2_NUM_TMUS"))); 391 392 392 393 INIT_INFO((1,"numberTMus = %d\n", info->numberTmus)); … … 401 402 ** 402 403 */ 403 #define LFB_PUTPIXEL(X, Y, DATA) \404 ISET(lfbptr[((SST_LFB_ADDR+(X<<1)+(Y<<11))>>1)], DATA)405 #define LFB_GETPIXEL(X, Y) \406 IGET(lfbptr[((SST_LFB_ADDR+(X<<1)+(Y<<11))>>1)])404 #define LFB_PUTPIXEL(X, Y, DATA) \ 405 ISET(lfbptr[((SST_LFB_ADDR+(X<<1)+(Y<<11))>>1)], DATA) 406 #define LFB_GETPIXEL(X, Y) \ 407 IGET(lfbptr[((SST_LFB_ADDR+(X<<1)+(Y<<11))>>1)]) 407 408 408 409 static int fbiMemSize(FxU32 *sstbase) 409 410 { 410 SstRegs *sst = (SstRegs *) sstbase;411 volatile unsigned short *lfbptr = (unsigned short *) sstbase;412 FxU32 init0Save = IGET(sst->fbiInit0);413 FxU32 init1Save = IGET(sst->fbiInit1);414 FxU32 init2Save = IGET(sst->fbiInit2);415 int retval = 0;416 417 if(GETENV(("SSTV2_FBI_MEMSIZE")))418 return(ATOI(GETENV(("SSTV2_FBI_MEMSIZE"))));419 420 /* Enable dram refresh, disable memory fifo, and setup memory */421 /* for rendering */422 ISET(sst->fbiInit0, IGET(sst->fbiInit0) & ~SST_MEM_FIFO_EN);411 SstRegs *sst = (SstRegs *) sstbase; 412 volatile unsigned short *lfbptr = (unsigned short *) sstbase; 413 FxU32 init0Save = IGET(sst->fbiInit0); 414 FxU32 init1Save = IGET(sst->fbiInit1); 415 FxU32 init2Save = IGET(sst->fbiInit2); 416 int retval = 0; 417 418 if(GETENV(("SSTV2_FBI_MEMSIZE"))) 419 return(ATOI(GETENV(("SSTV2_FBI_MEMSIZE")))); 420 421 /* Enable dram refresh, disable memory fifo, and setup memory */ 422 /* for rendering */ 423 ISET(sst->fbiInit0, IGET(sst->fbiInit0) & ~SST_MEM_FIFO_EN); 423 424 ISET(sst->fbiInit2, IGET(sst->fbiInit2) | SST_EN_DRAM_REFRESH); 424 sst1InitIdleFBI(sstbase);425 426 /* Setup Basic rendering datapath */427 ISET(sst->fbzColorPath, SST_CC_MONE);428 ISET(sst->fogMode, 0x0);429 ISET(sst->fbzMode, SST_RGBWRMASK | SST_ZAWRMASK | SST_DRAWBUFFER_FRONT);430 sst1InitIdleFBI(sstbase);425 sst1InitIdleFBI(sstbase); 426 427 /* Setup Basic rendering datapath */ 428 ISET(sst->fbzColorPath, SST_CC_MONE); 429 ISET(sst->fogMode, 0x0); 430 ISET(sst->fbzMode, SST_RGBWRMASK | SST_ZAWRMASK | SST_DRAWBUFFER_FRONT); 431 sst1InitIdleFBI(sstbase); 431 432 432 433 sst1InitSetResolution(sstbase, &SST_VREZ_800X600_60, 1); 433 sst1InitIdleFBI(sstbase);434 435 ISET(sst->lfbMode, SST_LFB_ZZ | SST_LFB_WRITEFRONTBUFFER |436 SST_LFB_READDEPTHABUFFER);437 sst1InitIdleFBI(sstbase);438 439 /* Check for 4 MBytes... */440 /* Write to Zbuffer in 800x600 resolution in upper 2 MBytes of memory */441 LFB_PUTPIXEL(128, 100, 0xdead);/* maps to row:0x216, col:0x80, bank:0x1 */442 LFB_PUTPIXEL(0, 0, 0x0);443 LFB_PUTPIXEL(798, 599, 0xffff);444 LFB_PUTPIXEL(200, 200, 0x55aa);/* maps to row:0x23d, col:0x104, bank:0x0 */445 LFB_PUTPIXEL(20, 20, 0xffff);446 LFB_PUTPIXEL(400, 400, 0x0);447 sst1InitIdleFBI(sstbase);448 if((LFB_GETPIXEL(128, 100) == 0xdead) &&449 (LFB_GETPIXEL(200, 200) == 0x55aa)) {450 retval = 4;451 ISET(sst->lfbMode, (SST_LFB_565 | SST_LFB_READBACKBUFFER));452 sst1InitIdleFBI(sstbase);453 goto fbiMemSizeDone;454 }455 456 /* Check for 2 MBytes... */457 /* Write to color buffer in 640x480 resolution */434 sst1InitIdleFBI(sstbase); 435 436 ISET(sst->lfbMode, SST_LFB_ZZ | SST_LFB_WRITEFRONTBUFFER | 437 SST_LFB_READDEPTHABUFFER); 438 sst1InitIdleFBI(sstbase); 439 440 /* Check for 4 MBytes... */ 441 /* Write to Zbuffer in 800x600 resolution in upper 2 MBytes of memory */ 442 LFB_PUTPIXEL(128, 100, 0xdead); /* maps to row:0x216, col:0x80, bank:0x1 */ 443 LFB_PUTPIXEL(0, 0, 0x0); 444 LFB_PUTPIXEL(798, 599, 0xffff); 445 LFB_PUTPIXEL(200, 200, 0x55aa); /* maps to row:0x23d, col:0x104, bank:0x0 */ 446 LFB_PUTPIXEL(20, 20, 0xffff); 447 LFB_PUTPIXEL(400, 400, 0x0); 448 sst1InitIdleFBI(sstbase); 449 if((LFB_GETPIXEL(128, 100) == 0xdead) && 450 (LFB_GETPIXEL(200, 200) == 0x55aa)) { 451 retval = 4; 452 ISET(sst->lfbMode, (SST_LFB_565 | SST_LFB_READBACKBUFFER)); 453 sst1InitIdleFBI(sstbase); 454 goto fbiMemSizeDone; 455 } 456 457 /* Check for 2 MBytes... */ 458 /* Write to color buffer in 640x480 resolution */ 458 459 sst1InitSetResolution(sstbase, &SST_VREZ_640X480_60, 0); 459 ISET(sst->lfbMode, SST_LFB_565 | SST_LFB_WRITEFRONTBUFFER |460 SST_LFB_READFRONTBUFFER);461 sst1InitIdleFBI(sstbase);462 LFB_PUTPIXEL(50, 100, 0xdead);/* maps to row:0x1e, col:0x99, bank:0x0 */463 LFB_PUTPIXEL(0, 0, 0x0);464 LFB_PUTPIXEL(638, 479, 0xffff);465 ISET(sst->lfbMode, SST_LFB_565 | SST_LFB_WRITEBACKBUFFER |466 SST_LFB_READFRONTBUFFER);467 sst1InitIdleFBI(sstbase);468 LFB_PUTPIXEL(178, 436, 0xaa55);/* maps to row:0x11e, col:0x99, bank:0x0 */469 LFB_PUTPIXEL(20, 20, 0x0);470 LFB_PUTPIXEL(400, 400, 0xffff);471 sst1InitIdleFBI(sstbase);472 if(LFB_GETPIXEL(50, 100) != 0xdead)473 goto check1MByte;474 ISET(sst->lfbMode, (SST_LFB_565 | SST_LFB_READBACKBUFFER));475 sst1InitIdleFBI(sstbase);476 if(LFB_GETPIXEL(178, 436) == 0xaa55) {477 retval = 2;478 goto fbiMemSizeDone;479 }460 ISET(sst->lfbMode, SST_LFB_565 | SST_LFB_WRITEFRONTBUFFER | 461 SST_LFB_READFRONTBUFFER); 462 sst1InitIdleFBI(sstbase); 463 LFB_PUTPIXEL(50, 100, 0xdead); /* maps to row:0x1e, col:0x99, bank:0x0 */ 464 LFB_PUTPIXEL(0, 0, 0x0); 465 LFB_PUTPIXEL(638, 479, 0xffff); 466 ISET(sst->lfbMode, SST_LFB_565 | SST_LFB_WRITEBACKBUFFER | 467 SST_LFB_READFRONTBUFFER); 468 sst1InitIdleFBI(sstbase); 469 LFB_PUTPIXEL(178, 436, 0xaa55); /* maps to row:0x11e, col:0x99, bank:0x0 */ 470 LFB_PUTPIXEL(20, 20, 0x0); 471 LFB_PUTPIXEL(400, 400, 0xffff); 472 sst1InitIdleFBI(sstbase); 473 if(LFB_GETPIXEL(50, 100) != 0xdead) 474 goto check1MByte; 475 ISET(sst->lfbMode, (SST_LFB_565 | SST_LFB_READBACKBUFFER)); 476 sst1InitIdleFBI(sstbase); 477 if(LFB_GETPIXEL(178, 436) == 0xaa55) { 478 retval = 2; 479 goto fbiMemSizeDone; 480 } 480 481 481 482 check1MByte: 482 ISET(sst->lfbMode, SST_LFB_565 | SST_LFB_WRITEFRONTBUFFER |483 SST_LFB_READFRONTBUFFER);484 sst1InitIdleFBI(sstbase);485 LFB_PUTPIXEL(10, 10, 0xdead);/* maps to row:0x0, col:0x145, bank:0x0 */486 LFB_PUTPIXEL(8, 8, 0x0);487 LFB_PUTPIXEL(340, 340, 0xffff);488 LFB_PUTPIXEL(100, 200, 0x5a5a);/* maps to row:0x3c, col:0x112, bank:0x1 */489 LFB_PUTPIXEL(66, 0, 0x0);490 LFB_PUTPIXEL(360, 360, 0xffff);491 sst1InitIdleFBI(sstbase);492 if((LFB_GETPIXEL(10, 10) == 0xdead) &&493 (LFB_GETPIXEL(100, 200) == 0x5a5a))494 retval = 1;483 ISET(sst->lfbMode, SST_LFB_565 | SST_LFB_WRITEFRONTBUFFER | 484 SST_LFB_READFRONTBUFFER); 485 sst1InitIdleFBI(sstbase); 486 LFB_PUTPIXEL(10, 10, 0xdead); /* maps to row:0x0, col:0x145, bank:0x0 */ 487 LFB_PUTPIXEL(8, 8, 0x0); 488 LFB_PUTPIXEL(340, 340, 0xffff); 489 LFB_PUTPIXEL(100, 200, 0x5a5a); /* maps to row:0x3c, col:0x112, bank:0x1 */ 490 LFB_PUTPIXEL(66, 0, 0x0); 491 LFB_PUTPIXEL(360, 360, 0xffff); 492 sst1InitIdleFBI(sstbase); 493 if((LFB_GETPIXEL(10, 10) == 0xdead) && 494 (LFB_GETPIXEL(100, 200) == 0x5a5a)) 495 retval = 1; 495 496 496 497 fbiMemSizeDone: 497 /* Restore init registers to original state */498 ISET(sst->fbiInit0, init0Save);499 ISET(sst->fbiInit1, init1Save);500 ISET(sst->fbiInit2, init2Save);501 sst1InitIdleFBI(sstbase);502 503 return(retval);498 /* Restore init registers to original state */ 499 ISET(sst->fbiInit0, init0Save); 500 ISET(sst->fbiInit1, init1Save); 501 ISET(sst->fbiInit2, init2Save); 502 sst1InitIdleFBI(sstbase); 503 504 return(retval); 504 505 } 505 506 … … 507 508 sst1InitGetFbiInfo(FxU32 *sstbase, sst1DeviceInfoStruct *info) 508 509 { 509 SstRegs *sst = (SstRegs *) sstbase;510 SstRegs *sst = (SstRegs *) sstbase; 510 511 511 512 info->fbiMemSize = fbiMemSize(sstbase); 512 513 513 /* Detect board identification and memory speed */514 if(GETENV(("SSTV2_FBICFG")))514 /* Detect board identification and memory speed */ 515 if(GETENV(("SSTV2_FBICFG"))) 515 516 SSCANF(GETENV(("SSTV2_FBICFG")), "%i", &info->fbiConfig); 516 517 else 517 info->fbiConfig = (IGET(sst->fbiInit3) & SST_FBI_MEM_TYPE) >>518 SST_FBI_MEM_TYPE_SHIFT;519 520 info->fbiBoardID = (IGET(sst->fbiInit5) >> 5) & 0xf;521 if(IGET(sst->fbiInit7) & BIT(0))522 info->fbiBoardID |= 0x10;523 524 /* Detect scanline interleaving */525 info->sliPaired = sst1InitSliPaired(sstbase);526 info->sliDetected = sst1InitSliDetect(sstbase);518 info->fbiConfig = (IGET(sst->fbiInit3) & SST_FBI_MEM_TYPE) >> 519 SST_FBI_MEM_TYPE_SHIFT; 520 521 info->fbiBoardID = (IGET(sst->fbiInit5) >> 5) & 0xf; 522 if(IGET(sst->fbiInit7) & BIT(0)) 523 info->fbiBoardID |= 0x10; 524 525 /* Detect scanline interleaving */ 526 info->sliPaired = sst1InitSliPaired(sstbase); 527 info->sliDetected = sst1InitSliDetect(sstbase); 527 528 528 529 return FXTRUE; … … 563 564 if(GETENV(("SSTV2_NODEVICEINFO"))) { 564 565 /* fill device info struct with sane values... */ 565 INIT_PRINTF(("sst1DeviceInfo: Filling info Struct with default values...\n"));566 567 if(GETENV(("SSTV2_FBICFG")))568 SSCANF(GETENV(("SSTV2_FBICFG")), "%i", &info->fbiConfig);569 else570 info->fbiConfig = 0x0;571 572 if(GETENV(("SSTV2_TMUCFG")))573 SSCANF(GETENV(("SSTV2_TMUCFG")), "%i", &info->tmuConfig);574 else575 info->tmuConfig = 0x0;566 INIT_PRINTF(("sst1DeviceInfo: Filling info Struct with default values...\n")); 567 568 if(GETENV(("SSTV2_FBICFG"))) 569 SSCANF(GETENV(("SSTV2_FBICFG")), "%i", &info->fbiConfig); 570 else 571 info->fbiConfig = 0x0; 572 573 if(GETENV(("SSTV2_TMUCFG"))) 574 SSCANF(GETENV(("SSTV2_TMUCFG")), "%i", &info->tmuConfig); 575 else 576 info->tmuConfig = 0x0; 576 577 577 578 info->numberTmus = 1; 578 if (info->tmuConfig & FXBIT(6)) /* if TMU 1 exists */579 info->numberTmus++;580 if (info->tmuConfig & FXBIT(13)) /* if TMU 2 exists */581 info->numberTmus++;582 583 info->tmuRevision = info->tmuConfig & 0x7;584 585 if(GETENV(("SSTV2_FBI_MEMSIZE")))586 info->fbiMemSize = ATOI(GETENV(("SSTV2_FBI_MEMSIZE")));587 else588 info->fbiMemSize = 2;589 590 if(GETENV(("SSTV2_TMU_MEMSIZE")))591 info->tmuMemSize[0] = ATOI(GETENV(("SSTV2_TMU_MEMSIZE")));592 else593 info->tmuMemSize[0] = 2;594 info->tmuMemSize[1] = info->tmuMemSize[0];595 info->tmuMemSize[2] = info->tmuMemSize[0];579 if (info->tmuConfig & FXBIT(6)) /* if TMU 1 exists */ 580 info->numberTmus++; 581 if (info->tmuConfig & FXBIT(13)) /* if TMU 2 exists */ 582 info->numberTmus++; 583 584 info->tmuRevision = info->tmuConfig & 0x7; 585 586 if(GETENV(("SSTV2_FBI_MEMSIZE"))) 587 info->fbiMemSize = ATOI(GETENV(("SSTV2_FBI_MEMSIZE"))); 588 else 589 info->fbiMemSize = 2; 590 591 if(GETENV(("SSTV2_TMU_MEMSIZE"))) 592 info->tmuMemSize[0] = ATOI(GETENV(("SSTV2_TMU_MEMSIZE"))); 593 else 594 info->tmuMemSize[0] = 2; 595 info->tmuMemSize[1] = info->tmuMemSize[0]; 596 info->tmuMemSize[2] = info->tmuMemSize[0]; 596 597 } else { 597 int i;598 599 for(i=0; i<5; i++) {600 if(i)601 INIT_PRINTF(("sst1InitFillDeviceInfo(): Retry #%d for chip GetInfo()...\n", i));602 /* GetFbiInfo() must be called before GetTmuInfo() */603 if(sst1InitGetFbiInfo(sstbase, info) == FXFALSE)604 continue;605 /* get the revision ID of each TMU and verify that they are all the606 same */607 if(sst1InitGetTmuInfo(sstbase, info) == FXFALSE)608 continue;609 break;610 }611 if(i == 5)612 return(FXFALSE);613 } 614 // Measure silicon performance598 int i; 599 600 for(i=0; i<5; i++) { 601 if(i) 602 INIT_PRINTF(("sst1InitFillDeviceInfo(): Retry #%d for chip GetInfo()...\n", i)); 603 /* GetFbiInfo() must be called before GetTmuInfo() */ 604 if(sst1InitGetFbiInfo(sstbase, info) == FXFALSE) 605 continue; 606 /* get the revision ID of each TMU and verify that they are all the 607 same */ 608 if(sst1InitGetTmuInfo(sstbase, info) == FXFALSE) 609 continue; 610 break; 611 } 612 if(i == 5) 613 return(FXFALSE); 614 } 615 // Measure silicon performance 615 616 sst1InitMeasureSiProcess(sstbase, 0); // measure NAND-tree 616 617 sst1InitMeasureSiProcess(sstbase, 1); // measure NOR-tree 617 618 618 INIT_PRINTF(("sst1DeviceInfo: Board ID: %d\n", info->fbiBoardID));619 INIT_PRINTF(("sst1DeviceInfo: Board ID: %d\n", info->fbiBoardID)); 619 620 INIT_PRINTF(("sst1DeviceInfo: FbiConfig:0x%x, TmuConfig:0x%x\n", 620 621 info->fbiConfig, info->tmuConfig)); … … 630 631 if(sst1InitUseVoodooFile == FXTRUE) { 631 632 if(iniDac == (sst1InitDacStruct *) NULL) 632 INIT_PRINTF(("sst1DeviceInfo: Dac Type: Unknown"));633 else634 INIT_PRINTF(("sst1DeviceInfo: Dac Type: %s %s\n", 635 iniDac->dacManufacturer, iniDac->dacDevice));636 } else {637 INIT_PRINTF(("sst1DeviceInfo: Dac Type: "));638 if(info->fbiVideoDacType == SST_FBI_DACTYPE_ATT)639 INIT_PRINTF(("AT&T ATT20C409\n"));640 else if(info->fbiVideoDacType == SST_FBI_DACTYPE_ICS)641 INIT_PRINTF(("ICS ICS5342\n"));642 else if(info->fbiVideoDacType == SST_FBI_DACTYPE_TI)643 INIT_PRINTF(("TI TVP3409\n"));644 else645 INIT_PRINTF(("Unknown\n"));646 }633 INIT_PRINTF(("sst1DeviceInfo: Dac Type: Unknown")); 634 else 635 INIT_PRINTF(("sst1DeviceInfo: Dac Type: %s %s\n", 636 iniDac->dacManufacturer, iniDac->dacDevice)); 637 } else { 638 INIT_PRINTF(("sst1DeviceInfo: Dac Type: ")); 639 if(info->fbiVideoDacType == SST_FBI_DACTYPE_ATT) 640 INIT_PRINTF(("AT&T ATT20C409\n")); 641 else if(info->fbiVideoDacType == SST_FBI_DACTYPE_ICS) 642 INIT_PRINTF(("ICS ICS5342\n")); 643 else if(info->fbiVideoDacType == SST_FBI_DACTYPE_TI) 644 INIT_PRINTF(("TI TVP3409\n")); 645 else 646 INIT_PRINTF(("Unknown\n")); 647 } 647 648 INIT_PRINTF(("sst1DeviceInfo: SLI Detected:%d\n", info->sliDetected)); 648 649 -
trunk/src/opengl/glide/cvg/init/parse.c
r2888 r6653 1 1 /*-*-c++-*-*/ 2 /* $Id: parse.c,v 1.2 2001-09-05 14:30:38 bird Exp $ */ 2 3 /* 3 4 ** THIS SOFTWARE IS SUBJECT TO COPYRIGHT PROTECTION AND IS OFFERED ONLY 4 5 ** PURSUANT TO THE 3DFX GLIDE GENERAL PUBLIC LICENSE. THERE IS NO RIGHT 5 6 ** TO USE THE GLIDE TRADEMARK WITHOUT PRIOR WRITTEN PERMISSION OF 3DFX 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 7 ** INTERACTIVE, INC. A COPY OF THIS LICENSE MAY BE OBTAINED FROM THE 8 ** DISTRIBUTOR OR BY CONTACTING 3DFX INTERACTIVE INC(info@3dfx.com). 9 ** THIS PROGRAM IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER 9 10 ** EXPRESSED OR IMPLIED. SEE THE 3DFX GLIDE GENERAL PUBLIC LICENSE FOR A 10 ** FULL TEXT OF THE NON-WARRANTY PROVISIONS. 11 ** 11 ** FULL TEXT OF THE NON-WARRANTY PROVISIONS. 12 ** 12 13 ** USE, DUPLICATION OR DISCLOSURE BY THE GOVERNMENT IS SUBJECT TO 13 14 ** RESTRICTIONS AS SET FORTH IN SUBDIVISION (C)(1)(II) OF THE RIGHTS IN … … 15 16 ** AND/OR IN SIMILAR OR SUCCESSOR CLAUSES IN THE FAR, DOD OR NASA FAR 16 17 ** SUPPLEMENT. UNPUBLISHED RIGHTS RESERVED UNDER THE COPYRIGHT LAWS OF 17 ** THE UNITED STATES. 18 ** 18 ** THE UNITED STATES. 19 ** 19 20 ** COPYRIGHT 3DFX INTERACTIVE, INC. 1999, ALL RIGHTS RESERVED 20 21 ** 21 22 ** 22 ** $Revision: 1. 1 $23 ** $Date: 200 0-02-25 00:37:52 $23 ** $Revision: 1.2 $ 24 ** $Date: 2001-09-05 14:30:38 $ 24 25 ** 25 26 ** Parsing code for grabbing information from "voodoo2.ini" initialization file … … 84 85 int helper = (getenv(("SSTV2_DEBUGDAC"))) ? 1 : 0; 85 86 86 filename[0] = '\0';87 if (checkedFileP) goto __errExit;88 87 filename[0] = '\0'; 88 if (checkedFileP) goto __errExit; 89 89 90 #if __DOS32__ 90 {91 char fixedFilename[512], *tmpPtr;92 char path[512];93 int i;94 95 96 if(getenv("VOODOO2_FILE")) {97 /* Override voodoo2.ini name */98 strcpy(filename, getenv("VOODOO2_FILE"));99 if(!(file = fopen(filename, "r"))) goto __errExit;100 } else {101 /* Override path setting */102 if(getenv("VOODOO2_PATH"))103 strcpy(path, getenv("VOODOO2_PATH"));104 else if(getenv("PATH")) {105 strcpy(path, ".;");106 strcat(path, getenv("PATH"));107 } else108 strcpy(path, ".;");109 110 i = 0;111 while(1) {112 if(!i) {113 if((tmpPtr = strtok(path, ";")) == NULL)114 break;115 } else {116 if((tmpPtr = strtok(NULL, ";")) == NULL)117 break;118 }119 strcpy(filename, tmpPtr);120 sst1InitFixFilename(fixedFilename, filename);121 if(fixedFilename[strlen(fixedFilename)-1] == '\\')122 sprintf(filename, "%svoodoo2.var", filename);123 else124 sprintf(filename, "%s\\voodoo2.var", filename);125 i++;126 if((file = fopen(filename, "r")))127 break;128 }129 }130 }91 { 92 char fixedFilename[512], *tmpPtr; 93 char path[512]; 94 int i; 95 96 97 if(getenv("VOODOO2_FILE")) { 98 /* Override voodoo2.ini name */ 99 strcpy(filename, getenv("VOODOO2_FILE")); 100 if(!(file = fopen(filename, "r"))) goto __errExit; 101 } else { 102 /* Override path setting */ 103 if(getenv("VOODOO2_PATH")) 104 strcpy(path, getenv("VOODOO2_PATH")); 105 else if(getenv("PATH")) { 106 strcpy(path, ".;"); 107 strcat(path, getenv("PATH")); 108 } else 109 strcpy(path, ".;"); 110 111 i = 0; 112 while(1) { 113 if(!i) { 114 if((tmpPtr = strtok(path, ";")) == NULL) 115 break; 116 } else { 117 if((tmpPtr = strtok(NULL, ";")) == NULL) 118 break; 119 } 120 strcpy(filename, tmpPtr); 121 sst1InitFixFilename(fixedFilename, filename); 122 if(fixedFilename[strlen(fixedFilename)-1] == '\\') 123 sprintf(filename, "%svoodoo2.var", filename); 124 else 125 sprintf(filename, "%s\\voodoo2.var", filename); 126 i++; 127 if((file = fopen(filename, "r"))) 128 break; 129 } 130 } 131 } 131 132 #elif __MWERKS__ 132 {133 FSSpec iniSpec = {134 0, 0,135 "\pvoodoo2.var"136 };137 Boolean foundP = false;138 139 /* Check the app's directory */140 if (!foundP) {141 ProcessSerialNumber curApp;142 ProcessInfoRec appInfo;143 FSSpec appSpec;144 145 if (GetCurrentProcess(&curApp) != noErr) goto __errAppDir;146 147 /* We only care about the app's location */148 appInfo.processInfoLength = sizeof(ProcessInfoRec);149 appInfo.processName = NULL;150 appInfo.processAppSpec = &appSpec;151 if (GetProcessInformation(&curApp, &appInfo) != noErr) goto __errAppDir;152 153 {154 CInfoPBRec thePB;155 156 thePB.hFileInfo.ioCompletion = NULL;157 thePB.hFileInfo.ioNamePtr = iniSpec.name;158 thePB.hFileInfo.ioVRefNum = appSpec.vRefNum;159 thePB.hFileInfo.ioDirID = appSpec.parID;160 161 thePB.hFileInfo.ioFDirIndex = 0;162 163 foundP = ((PBGetCatInfoSync(&thePB) == noErr) &&164 ((thePB.hFileInfo.ioFlAttrib & (0x01 << 4)) == 0));165 if (foundP) {166 iniSpec.vRefNum = appSpec.vRefNum;167 iniSpec.parID = appSpec.parID;168 }169 } 170 171 __errAppDir:172 ;173 }174 175 /* Check the mac's version of the 'search path' */176 if (!foundP) {177 OSType folderList[] = { kPreferencesFolderType, kExtensionFolderType };178 int i;179 180 for(i = 0; i < sizeof(folderList) / sizeof(folderList[0]); i++) {181 short vRefNum;182 long dirId;183 184 if (FindFolder(kOnSystemDisk, folderList[i], false, 185 &vRefNum, &dirId) == noErr) {186 187 CInfoPBRec thePB;188 189 thePB.hFileInfo.ioCompletion = NULL;190 thePB.hFileInfo.ioNamePtr = iniSpec.name;191 thePB.hFileInfo.ioVRefNum = vRefNum;192 thePB.hFileInfo.ioDirID = dirId;193 194 thePB.hFileInfo.ioFDirIndex = 0;195 196 foundP = ((PBGetCatInfoSync(&thePB) == noErr) &&197 ((thePB.hFileInfo.ioFlAttrib & (0x01 << 4)) == 0));198 if (foundP) {199 iniSpec.vRefNum = vRefNum;200 iniSpec.parID = dirId;201 202 break;203 }204 }205 }206 }207 208 if (foundP) {209 short wdRefNum;210 long wdDirId;211 212 /* Change working directories, just in case the app did something else */213 if (HGetVol(NULL, &wdRefNum, &wdDirId) != noErr) goto __errFile;214 if (HSetVol(NULL, iniSpec.vRefNum, iniSpec.parID) != noErr) goto __errFile;215 216 /* NB: We leave the name trashed after this */217 p2cstr(iniSpec.name);218 file = fopen((const char*)iniSpec.name, "r");219 220 HSetVol(NULL, wdRefNum, wdDirId);221 222 __errFile:223 ;224 }225 }133 { 134 FSSpec iniSpec = { 135 0, 0, 136 "\pvoodoo2.var" 137 }; 138 Boolean foundP = false; 139 140 /* Check the app's directory */ 141 if (!foundP) { 142 ProcessSerialNumber curApp; 143 ProcessInfoRec appInfo; 144 FSSpec appSpec; 145 146 if (GetCurrentProcess(&curApp) != noErr) goto __errAppDir; 147 148 /* We only care about the app's location */ 149 appInfo.processInfoLength = sizeof(ProcessInfoRec); 150 appInfo.processName = NULL; 151 appInfo.processAppSpec = &appSpec; 152 if (GetProcessInformation(&curApp, &appInfo) != noErr) goto __errAppDir; 153 154 { 155 CInfoPBRec thePB; 156 157 thePB.hFileInfo.ioCompletion = NULL; 158 thePB.hFileInfo.ioNamePtr = iniSpec.name; 159 thePB.hFileInfo.ioVRefNum = appSpec.vRefNum; 160 thePB.hFileInfo.ioDirID = appSpec.parID; 161 162 thePB.hFileInfo.ioFDirIndex = 0; 163 164 foundP = ((PBGetCatInfoSync(&thePB) == noErr) && 165 ((thePB.hFileInfo.ioFlAttrib & (0x01 << 4)) == 0)); 166 if (foundP) { 167 iniSpec.vRefNum = appSpec.vRefNum; 168 iniSpec.parID = appSpec.parID; 169 } 170 } 171 172 __errAppDir: 173 ; 174 } 175 176 /* Check the mac's version of the 'search path' */ 177 if (!foundP) { 178 OSType folderList[] = { kPreferencesFolderType, kExtensionFolderType }; 179 int i; 180 181 for(i = 0; i < sizeof(folderList) / sizeof(folderList[0]); i++) { 182 short vRefNum; 183 long dirId; 184 185 if (FindFolder(kOnSystemDisk, folderList[i], false, 186 &vRefNum, &dirId) == noErr) { 187 188 CInfoPBRec thePB; 189 190 thePB.hFileInfo.ioCompletion = NULL; 191 thePB.hFileInfo.ioNamePtr = iniSpec.name; 192 thePB.hFileInfo.ioVRefNum = vRefNum; 193 thePB.hFileInfo.ioDirID = dirId; 194 195 thePB.hFileInfo.ioFDirIndex = 0; 196 197 foundP = ((PBGetCatInfoSync(&thePB) == noErr) && 198 ((thePB.hFileInfo.ioFlAttrib & (0x01 << 4)) == 0)); 199 if (foundP) { 200 iniSpec.vRefNum = vRefNum; 201 iniSpec.parID = dirId; 202 203 break; 204 } 205 } 206 } 207 } 208 209 if (foundP) { 210 short wdRefNum; 211 long wdDirId; 212 213 /* Change working directories, just in case the app did something else */ 214 if (HGetVol(NULL, &wdRefNum, &wdDirId) != noErr) goto __errFile; 215 if (HSetVol(NULL, iniSpec.vRefNum, iniSpec.parID) != noErr) goto __errFile; 216 217 /* NB: We leave the name trashed after this */ 218 p2cstr(iniSpec.name); 219 file = fopen((const char*)iniSpec.name, "r"); 220 221 HSetVol(NULL, wdRefNum, wdDirId); 222 223 __errFile: 224 ; 225 } 226 } 226 227 #endif 227 228 … … 261 262 262 263 __errExit: 263 checkedFileP = FXTRUE;264 checkedFileP = FXTRUE; 264 265 #endif /* !DIRECTX */ 265 266 … … 294 295 /* Override voodoo2.ini name */ 295 296 strcpy(filename, getenv("VOODOO2_FILE")); 296 if (!(file = fopen(filename, "r"))) 297 if (!(file = fopen(filename, "r"))) 297 298 goto __errExit; 298 299 } else { … … 307 308 while(1) { 308 309 if (!i) { 309 if ((tmpPtr = strtok(path, ":")) == NULL)310 break;310 if ((tmpPtr = strtok(path, ":")) == NULL) 311 break; 311 312 } else { 312 if ((tmpPtr = strtok(NULL, ":")) == NULL)313 break;313 if ((tmpPtr = strtok(NULL, ":")) == NULL) 314 break; 314 315 } 315 316 strcpy(filename, tmpPtr); 316 317 if (filename[strlen(filename)-1] == '\\') 317 sprintf(filename, "%voodoo2", filename);318 sprintf(filename, "%voodoo2", filename); 318 319 else 319 sprintf(filename, "%s/voodoo2", filename);320 sprintf(filename, "%s/voodoo2", filename); 320 321 i++; 321 322 if ((file = fopen(filename, "r"))) 322 break;323 break; 323 324 } 324 325 } … … 638 639 break; 639 640 } 640 if(!(dacRdWrPtr->nextRdWr = malloc(sizeof(sst1InitDacRdWrStruct)))) 641 if(!(dacRdWrPtr->nextRdWr = malloc(sizeof(sst1InitDacRdWrStruct)))) 641 642 return(0); 642 643 … … 982 983 983 984 #if __WIN32__ 984 FxBool GetRegistryKey(HKEY hKey, const char* keyName, 985 FxBool GetRegistryKey(HKEY hKey, const char* keyName, 985 986 char* regValBuf, FxU32 bufSize) 986 987 { … … 1004 1005 } 1005 1006 } 1006 1007 1007 1008 return retVal; 1008 } 1009 } 1009 1010 #endif /* __WIN32__ */ 1010 1011 … … 1020 1021 * string table has been freed by the c runtime but has not been set 1021 1022 * to NULL. Bad things happen if this memory has been unmapped by 1022 * the system or if the string cannot be found. 1023 * the system or if the string cannot be found. 1023 1024 */ 1024 1025 { … … 1051 1052 { 1052 1053 const char* retVal; 1053 1054 1054 1055 /* Does the real environment variable exist? 1055 1056 * This overrides everything for glide. … … 1084 1085 } 1085 1086 #endif /* __WIN32__ */ 1086 1087 1087 1088 /* Does the requested environment variable exist in "voodoo2.ini"? */ 1088 1089 /* Dump CFG Data... */ 1089 1090 if (!checkedFileP) { 1090 static FxBool inProc = FXFALSE;1091 1092 if (!inProc) {1093 inProc = FXTRUE;1094 sst1InitVoodooFile();1095 inProc = FXFALSE;1096 }1097 } 1098 1091 static FxBool inProc = FXFALSE; 1092 1093 if (!inProc) { 1094 inProc = FXTRUE; 1095 sst1InitVoodooFile(); 1096 inProc = FXFALSE; 1097 } 1098 } 1099 1099 1100 { 1100 1101 sst1InitEnvVarStruct *envVarsPtr = envVarsBase; -
trunk/src/opengl/glide/cvg/init/print.c
r2888 r6653 1 1 /*-*-c++-*-*/ 2 /* $Id: print.c,v 1.2 2001-09-05 14:30:39 bird Exp $ */ 2 3 /* 3 4 ** THIS SOFTWARE IS SUBJECT TO COPYRIGHT PROTECTION AND IS OFFERED ONLY 4 5 ** PURSUANT TO THE 3DFX GLIDE GENERAL PUBLIC LICENSE. THERE IS NO RIGHT 5 6 ** TO USE THE GLIDE TRADEMARK WITHOUT PRIOR WRITTEN PERMISSION OF 3DFX 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 7 ** INTERACTIVE, INC. A COPY OF THIS LICENSE MAY BE OBTAINED FROM THE 8 ** DISTRIBUTOR OR BY CONTACTING 3DFX INTERACTIVE INC(info@3dfx.com). 9 ** THIS PROGRAM IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER 9 10 ** EXPRESSED OR IMPLIED. SEE THE 3DFX GLIDE GENERAL PUBLIC LICENSE FOR A 10 ** FULL TEXT OF THE NON-WARRANTY PROVISIONS. 11 ** 11 ** FULL TEXT OF THE NON-WARRANTY PROVISIONS. 12 ** 12 13 ** USE, DUPLICATION OR DISCLOSURE BY THE GOVERNMENT IS SUBJECT TO 13 14 ** RESTRICTIONS AS SET FORTH IN SUBDIVISION (C)(1)(II) OF THE RIGHTS IN … … 15 16 ** AND/OR IN SIMILAR OR SUCCESSOR CLAUSES IN THE FAR, DOD OR NASA FAR 16 17 ** SUPPLEMENT. UNPUBLISHED RIGHTS RESERVED UNDER THE COPYRIGHT LAWS OF 17 ** THE UNITED STATES. 18 ** 18 ** THE UNITED STATES. 19 ** 19 20 ** COPYRIGHT 3DFX INTERACTIVE, INC. 1999, ALL RIGHTS RESERVED 20 21 ** 21 22 ** 22 ** $Revision: 1. 1 $23 ** $Date: 200 0-02-25 00:37:53 $23 ** $Revision: 1.2 $ 24 ** $Date: 2001-09-05 14:30:39 $ 24 25 ** 25 26 ** Print functions for SST-1 Initialization routines … … 54 55 if(firstPass == FXTRUE) { 55 56 firstPass = FXFALSE; 56 if (sst1InitMsgFile == NULL)57 {58 /* I couldn't initialize to stdout because stdout is not constant */59 sst1InitMsgFile = stdout;60 }57 if (sst1InitMsgFile == NULL) 58 { 59 /* I couldn't initialize to stdout because stdout is not constant */ 60 sst1InitMsgFile = stdout; 61 } 61 62 if(GETENV(("SSTV2_INITDEBUG")) || GDBG_GET_DEBUGLEVEL(5)) 62 63 printIt = FXTRUE; … … 64 65 printIt = ((sst1InitMsgFile = fopen(GETENV(("SSTV2_INITDEBUG_FILE")), "w")) != NULL); 65 66 if (!printIt) { 66 fprintf(stderr, "sst1InitPrintf(): Could not open file '%s' for logging...\n", 67 fprintf(stderr, "sst1InitPrintf(): Could not open file '%s' for logging...\n", 67 68 GETENV(("SSTV2_INITDEBUG_FILE"))); 68 69 } -
trunk/src/opengl/glide/cvg/init/sli.c
r2888 r6653 1 1 /*-*-c++-*-*/ 2 /* $Id: sli.c,v 1.2 2001-09-05 14:30:42 bird Exp $ */ 2 3 /* 3 4 ** THIS SOFTWARE IS SUBJECT TO COPYRIGHT PROTECTION AND IS OFFERED ONLY 4 5 ** PURSUANT TO THE 3DFX GLIDE GENERAL PUBLIC LICENSE. THERE IS NO RIGHT 5 6 ** TO USE THE GLIDE TRADEMARK WITHOUT PRIOR WRITTEN PERMISSION OF 3DFX 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 7 ** INTERACTIVE, INC. A COPY OF THIS LICENSE MAY BE OBTAINED FROM THE 8 ** DISTRIBUTOR OR BY CONTACTING 3DFX INTERACTIVE INC(info@3dfx.com). 9 ** THIS PROGRAM IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER 9 10 ** EXPRESSED OR IMPLIED. SEE THE 3DFX GLIDE GENERAL PUBLIC LICENSE FOR A 10 ** FULL TEXT OF THE NON-WARRANTY PROVISIONS. 11 ** 11 ** FULL TEXT OF THE NON-WARRANTY PROVISIONS. 12 ** 12 13 ** USE, DUPLICATION OR DISCLOSURE BY THE GOVERNMENT IS SUBJECT TO 13 14 ** RESTRICTIONS AS SET FORTH IN SUBDIVISION (C)(1)(II) OF THE RIGHTS IN … … 15 16 ** AND/OR IN SIMILAR OR SUCCESSOR CLAUSES IN THE FAR, DOD OR NASA FAR 16 17 ** SUPPLEMENT. UNPUBLISHED RIGHTS RESERVED UNDER THE COPYRIGHT LAWS OF 17 ** THE UNITED STATES. 18 ** 18 ** THE UNITED STATES. 19 ** 19 20 ** COPYRIGHT 3DFX INTERACTIVE, INC. 1999, ALL RIGHTS RESERVED 20 21 ** 21 ** $Revision: 1. 1 $22 ** $Date: 200 0-02-25 00:37:53 $22 ** $Revision: 1.2 $ 23 ** $Date: 2001-09-05 14:30:42 $ 23 24 ** 24 25 ** Initialization code for initializing scanline interleaving … … 182 183 PCICFG_RD(SST1_PCI_INIT_ENABLE, j); 183 184 PCICFG_WR(SST1_PCI_INIT_ENABLE, 184 ((j & ~SST_SCANLINE_SLV_OWNPCI) | SST_SCANLINE_SLI_SLV)); 185 ((j & ~SST_SCANLINE_SLV_OWNPCI) | SST_SCANLINE_SLI_SLV)); 185 186 ISET(sstSlave->fbiInit1, IGET(sstSlave->fbiInit1) | 186 187 (SST_VIDEO_RESET | SST_EN_SCANLINE_INTERLEAVE)); … … 226 227 SST_VID_CLK_DAC_DATA16_SEL); 227 228 ISET(sstSlave->fbiInit1, IGET(sstSlave->fbiInit1) & 228 ~SST_VIDEO_VID_CLK_SLAVE); 229 ~SST_VIDEO_VID_CLK_SLAVE); 229 230 sst1CurrentBoard->fbiInit6 &= ~SST_SLI_SYNC_MASTER; 230 231 sst1CurrentBoard->fbiInit6 = ((sst1CurrentBoard->fbiInit6 & … … 250 251 ISET(sstSlave->fbiInit1, (IGET(sstSlave->fbiInit1) & 251 252 ~(SST_VIDEO_VCLK_2X_OUTPUT_DEL | SST_VIDEO_VCLK_DEL | 252 SST_VIDEO_VCLK_SEL | SST_VIDEO_VCLK_2X_INPUT_DEL)) | 253 SST_VIDEO_VCLK_SEL | SST_VIDEO_VCLK_2X_INPUT_DEL)) | 253 254 SST_EN_SCANLINE_INTERLEAVE | 254 255 // SST_VIDEO_VID_CLK_SLAVE | 255 256 // SST_VIDEO_VID_CLK_2X | 256 // SST_VIDEO_INVERT_VID_CLK_2X | 257 // SST_VIDEO_INVERT_VID_CLK_2X | 257 258 SST_VIDEO_VCLK_SEL | 258 259 SST_PCI_WRWS_1 | … … 264 265 ISET(sstSlave->fbiInit1, (IGET(sstSlave->fbiInit1) & 265 266 ~(SST_VIDEO_VCLK_2X_OUTPUT_DEL | SST_VIDEO_VCLK_DEL | 266 SST_VIDEO_VCLK_SEL | SST_VIDEO_VCLK_2X_INPUT_DEL)) | 267 SST_VIDEO_VCLK_SEL | SST_VIDEO_VCLK_2X_INPUT_DEL)) | 267 268 SST_EN_SCANLINE_INTERLEAVE | 268 269 // SST_VIDEO_VID_CLK_SLAVE | … … 371 372 SST_VID_CLK_DAC_DATA16_SEL); 372 373 ISET(sstMaster->fbiInit1, IGET(sstMaster->fbiInit1) & 373 ~SST_VIDEO_VID_CLK_SLAVE); 374 ~SST_VIDEO_VID_CLK_SLAVE); 374 375 sst1CurrentBoard->fbiInit6 |= SST_SLI_SYNC_MASTER; 375 376 sst1CurrentBoard->fbiInit6 = ((sst1CurrentBoard->fbiInit6 & … … 379 380 ISET(sstMaster->fbiInit6, sst1CurrentBoard->fbiInit6); 380 381 381 // Following work well up to around 100 MHz... 382 // Following work well up to around 100 MHz... 382 383 // masterVInClkDel = 2; 383 384 // masterVOutClkDel = 0; … … 400 401 ~(SST_VIDEO_VCLK_2X_OUTPUT_DEL | SST_VIDEO_VCLK_DEL | 401 402 SST_VIDEO_VCLK_SEL | SST_VIDEO_VCLK_2X_INPUT_DEL | 402 SST_VIDEO_BLANK_EN)) | 403 SST_VIDEO_BLANK_EN)) | 403 404 SST_EN_SCANLINE_INTERLEAVE | 404 405 // SST_VIDEO_VID_CLK_2X | … … 417 418 ~(SST_VIDEO_VCLK_2X_OUTPUT_DEL | SST_VIDEO_VCLK_DEL | 418 419 SST_VIDEO_VCLK_SEL | SST_VIDEO_VCLK_2X_INPUT_DEL | 419 SST_VIDEO_BLANK_EN)) | 420 SST_VIDEO_BLANK_EN)) | 420 421 SST_EN_SCANLINE_INTERLEAVE | 421 422 // SST_VIDEO_VID_CLK_2X | … … 458 459 PCICFG_RD(SST1_PCI_INIT_ENABLE, j); 459 460 PCICFG_WR(SST1_PCI_INIT_ENABLE, 460 (j & ~(SST_SCANLINE_SLV_OWNPCI | SST_SCANLINE_SLI_SLV))); 461 (j & ~(SST_SCANLINE_SLV_OWNPCI | SST_SCANLINE_SLI_SLV))); 461 462 MasterPhysAddr = sst1CurrentBoard->physAddr[0]; 462 463 sst1InitReturnStatus(sstbase0); // flush pci packer with reads … … 485 486 if (!sst1InitCheckBoard(sstbase1)) return FXFALSE; 486 487 infoSlave = sst1CurrentBoard; 487 488 488 489 /* fbi and tmu clock freqs should be equal since they are 489 490 * both set from sst1InitCalcGrxClk. … … 491 492 if (infoMaster->fbiGrxClkFreq != infoSlave->fbiGrxClkFreq) { 492 493 /* Recompute the actual clock rates before any clocking down 493 * due to sli for some board revisions. 494 * due to sli for some board revisions. 494 495 */ 495 496 if (!sst1InitCalcGrxClk(sstbase0)) return FXFALSE; … … 513 514 * They no longer need to match, but any future calls to 514 515 * sst1InitGetDeviceInfo should now reflect the current 515 * minimized state of the world. 516 * minimized state of the world. 516 517 */ 517 518 { … … 520 521 if (infoMaster->fbiMemSize != infoSlave->fbiMemSize) { 521 522 memSize = MIN(infoMaster->fbiMemSize, infoSlave->fbiMemSize); 522 infoMaster->fbiMemSize = 523 infoMaster->fbiMemSize = 523 524 infoSlave->fbiMemSize = memSize; 524 525 } … … 581 582 sst1InitReturnStatus(sstbase1); 582 583 583 // De-assert reset to Graphics core... 584 // De-assert reset to Graphics core... 584 585 ISET(sstMaster->fbiInit0, IGET(sstMaster->fbiInit0) & ~SST_GRX_RESET); 585 586 sst1InitReturnStatus(sstbase0); … … 587 588 sst1InitReturnStatus(sstbase1); 588 589 589 // De-assert reset to Video core... 590 // De-assert reset to Video core... 590 591 ISET(sstMaster->fbiInit1, IGET(sstMaster->fbiInit1) & ~SST_VIDEO_RESET); 591 592 sst1InitReturnStatus(sstbase0); … … 707 708 else 708 709 sliDetected = sst1InitSliPaired(sstbase); 709 710 710 711 return sliDetected; 711 712 } … … 717 718 ** 718 719 */ 719 FX_ENTRY FxU32 FX_CALL 720 FX_ENTRY FxU32 FX_CALL 720 721 sst1InitSliPaired(FxU32 *sstbase) 721 722 { … … 725 726 if(firstTime) { 726 727 SstRegs* sst = (SstRegs *) sstbase; 727 728 728 729 sliPaired = (((IGET(sst->fbiInit5) & SST_SLI_DETECT) == SST_SLI_DETECT) && 729 730 (boardsInSystem > 1)); -
trunk/src/opengl/glide/cvg/init/sst1init.c
r2888 r6653 1 1 /*-*-c++-*-*/ 2 /* $Id: sst1init.c,v 1.2 2001-09-05 14:30:42 bird Exp $ */ 2 3 /* 3 4 ** THIS SOFTWARE IS SUBJECT TO COPYRIGHT PROTECTION AND IS OFFERED ONLY 4 5 ** PURSUANT TO THE 3DFX GLIDE GENERAL PUBLIC LICENSE. THERE IS NO RIGHT 5 6 ** TO USE THE GLIDE TRADEMARK WITHOUT PRIOR WRITTEN PERMISSION OF 3DFX 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 7 ** INTERACTIVE, INC. A COPY OF THIS LICENSE MAY BE OBTAINED FROM THE 8 ** DISTRIBUTOR OR BY CONTACTING 3DFX INTERACTIVE INC(info@3dfx.com). 9 ** THIS PROGRAM IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER 9 10 ** EXPRESSED OR IMPLIED. SEE THE 3DFX GLIDE GENERAL PUBLIC LICENSE FOR A 10 ** FULL TEXT OF THE NON-WARRANTY PROVISIONS. 11 ** 11 ** FULL TEXT OF THE NON-WARRANTY PROVISIONS. 12 ** 12 13 ** USE, DUPLICATION OR DISCLOSURE BY THE GOVERNMENT IS SUBJECT TO 13 14 ** RESTRICTIONS AS SET FORTH IN SUBDIVISION (C)(1)(II) OF THE RIGHTS IN … … 15 16 ** AND/OR IN SIMILAR OR SUCCESSOR CLAUSES IN THE FAR, DOD OR NASA FAR 16 17 ** SUPPLEMENT. UNPUBLISHED RIGHTS RESERVED UNDER THE COPYRIGHT LAWS OF 17 ** THE UNITED STATES. 18 ** 18 ** THE UNITED STATES. 19 ** 19 20 ** COPYRIGHT 3DFX INTERACTIVE, INC. 1999, ALL RIGHTS RESERVED 20 21 ** 21 ** $Revision: 1. 1 $22 ** $Date: 200 0-02-25 00:37:54 $22 ** $Revision: 1.2 $ 23 ** $Date: 2001-09-05 14:30:42 $ 23 24 ** 24 25 */ … … 29 30 ** NOTE: This code must compiled with optimizations DISABLED!! 30 31 ** 31 ** The following environment variables can optionally be used to alter 32 ** The following environment variables can optionally be used to alter 32 33 ** functionality (A value of X is a "don't care"): 33 34 ** … … 99 100 ** 960, (960x720) 100 101 ** 1024} (1024x768) 101 ** SSTV2_SLOWMEM_RTW X Insert wait state for read-to-write 102 ** SSTV2_SLOWMEM_RTW X Insert wait state for read-to-write 102 103 ** transitions 103 ** SSTV2_SLOWMEM_WTR X Insert wait state for write-to-read 104 ** SSTV2_SLOWMEM_WTR X Insert wait state for write-to-read 104 105 ** transitions 105 106 ** SSTV2_SLOWPCIWR X Enable 1 wait-state PCI writes … … 186 187 static FxU32 clearBoardInfo = FXTRUE; 187 188 188 FX_EXPORT FxU32 * FX_CSTYLE sst1InitMapBoardDirect(FxU32 BoardNumber, 189 FX_EXPORT FxU32 * FX_CSTYLE sst1InitMapBoardDirect(FxU32 BoardNumber, 189 190 FxBool resetSLI) 190 191 { … … 204 205 // Open PCI library (necessary for multiple calls to init routines, after 205 206 // PCI library is closed by pciClose() call in sst1InitShutdown(). 206 // 207 // 207 208 // NB: It is safe to do this even if we never called pciClose. 208 209 pciOpen(); … … 231 232 // Clear board info structure 232 233 sst1InitClearBoardInfo(); 233 234 234 235 clearBoardInfo = FXFALSE; 235 236 … … 239 240 * the vxd etc. This is not functionally longer fatal, but w/o 240 241 * it we will not be able to do things like set the caching on 241 * the board's memory etc. This is bad. 242 * the board's memory etc. This is bad. 242 243 * 243 244 * The actual cost of doing the re-mapping again is pretty low … … 323 324 FxU32 k; 324 325 SstRegs *sst; 325 326 326 327 for(k=0; k<boardsInSystemReally; k++) { 327 328 // Disable SLI if detected... … … 331 332 sst1CurrentBoard = &sst1BoardInfo[k]; 332 333 sst = (SstRegs *) sstbase; 333 334 334 335 if(IGET(sst->fbiInit1) & SST_EN_SCANLINE_INTERLEAVE) { 335 336 INIT_PRINTF(("sst1InitMapBoard(): Disabling Scanline Interleaving (board #%d)...\n", (k+1))); … … 424 425 PCICFG_WR(SST1_PCI_BUS_SNOOP0, SST_PCI_BUS_SNOOP_DEFAULT); 425 426 PCICFG_WR(SST1_PCI_BUS_SNOOP1, SST_PCI_BUS_SNOOP_DEFAULT); 426 sst1InitReturnStatus(sstbase); // Stall - can't call IdleFbi because 427 sst1InitReturnStatus(sstbase); // Stall - can't call IdleFbi because 427 428 sst1InitReturnStatus(sstbase); // FBI could be hung at this stage 428 429 sst1InitReturnStatus(sstbase); 429 430 430 431 // Adjust Trex-to-Fbi FIFO 431 432 if(GETENV(("SSTV2_TF_FIFO_THRESH"))) … … 573 574 (tf2_clkdel<<SST_TEX_TF_CLK_DEL_ADJ_SHIFT); 574 575 } 575 INIT_PRINTF(("sst1InitRegisters(): Storing TREX2INIT1=0x%x\n", 576 INIT_PRINTF(("sst1InitRegisters(): Storing TREX2INIT1=0x%x\n", 576 577 sst1CurrentBoard->tmuInit1[2])); 577 578 … … 662 663 sst1InitIdleFBINoNOP(sstbase); 663 664 664 sst1InitRenderingRegisters(sstbase); 665 sst1InitRenderingRegisters(sstbase); 665 666 sst1CurrentBoard->tmuRevision = 0xdead; // Force sst1InitFillDeviceInfo() 666 667 if(sst1InitFillDeviceInfo(sstbase, sst1CurrentBoard) == FXFALSE) { … … 909 910 #ifndef __linux__ 910 911 pciUnmapPhysical((FxU32)sst1CurrentBoard->virtAddr[0], 911 0x1000000UL);912 0x1000000UL); 912 913 #endif 913 914 914 915 if((++n > 1) || !sliEnabled) 915 916 break; 916 917 } 917 918 918 919 /* sst1InitIdle(sstbase); */ 919 920 920 921 #if !DIRECTX 921 // 922 // 922 923 // HACK alert. 923 924 // … … 940 941 // cleared next time sst1InitMapBoard() is called. 941 942 clearBoardInfo = FXTRUE; 942 943 943 944 return(FXTRUE); 944 945 } … … 980 981 devInfo.sliDetected && 981 982 !devInfo.monitorDetected) { 982 983 983 984 SstRegs* tempAddr = NULL; 984 985 … … 997 998 if (tempAddr != NULL) sstBaseAddr = tempAddr; 998 999 } 999 1000 1000 1001 return (FxU32*)sstBaseAddr; 1001 1002 } … … 1100 1101 ** 1101 1102 */ 1102 FX_ENTRY FxBool FX_CSTYLE 1103 FX_ENTRY FxBool FX_CSTYLE 1103 1104 sst1InitCaching(FxU32* sstBase, FxBool enableP) 1104 1105 { … … 1109 1110 if (enableP && (GETENV("SSTV2_IGNORE_CACHING") == NULL)) { 1110 1111 FxU32 physAddr; 1111 1112 1112 1113 /* Get the board's base. Isn't this the same as what we 1113 1114 * cary around in sst1CurrentBoard->physAddr[0]? 1114 1115 */ 1115 1116 pciGetConfigData(PCI_BASE_ADDRESS_0, sst1CurrentBoard->deviceNumber, &physAddr); 1116 1117 1117 1118 // For some reason, there sometimes is a 008 at the end of the 1118 1119 // physical address, so mask that puppy RTF out … … 1134 1135 #define kCacheSizeUncacheable (0x1000UL) 1135 1136 FxBool hasWC = pciFindMTRRMatch(physAddr, kCacheSizeWriteCombine, 1136 PciMemTypeWriteCombining, 1137 PciMemTypeWriteCombining, 1137 1138 &sst1CurrentBoard->mtrrWriteCombine); 1138 1139 FxBool hasUC = pciFindMTRRMatch(physAddr, kCacheSizeUncacheable, … … 1167 1168 1168 1169 /* We only succeed if we have them both since having only uswc 1169 * seems to cause problems. 1170 * seems to cause problems. 1170 1171 */ 1171 1172 retVal = (hasWC && hasUC); -
trunk/src/opengl/glide/cvg/init/util.c
r2888 r6653 1 1 /*-*-c++-*-*/ 2 /* $Id: util.c,v 1.2 2001-09-05 14:30:42 bird Exp $ */ 2 3 /* 3 4 ** THIS SOFTWARE IS SUBJECT TO COPYRIGHT PROTECTION AND IS OFFERED ONLY 4 5 ** PURSUANT TO THE 3DFX GLIDE GENERAL PUBLIC LICENSE. THERE IS NO RIGHT 5 6 ** TO USE THE GLIDE TRADEMARK WITHOUT PRIOR WRITTEN PERMISSION OF 3DFX 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 7 ** INTERACTIVE, INC. A COPY OF THIS LICENSE MAY BE OBTAINED FROM THE 8 ** DISTRIBUTOR OR BY CONTACTING 3DFX INTERACTIVE INC(info@3dfx.com). 9 ** THIS PROGRAM IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER 9 10 ** EXPRESSED OR IMPLIED. SEE THE 3DFX GLIDE GENERAL PUBLIC LICENSE FOR A 10 ** FULL TEXT OF THE NON-WARRANTY PROVISIONS. 11 ** 11 ** FULL TEXT OF THE NON-WARRANTY PROVISIONS. 12 ** 12 13 ** USE, DUPLICATION OR DISCLOSURE BY THE GOVERNMENT IS SUBJECT TO 13 14 ** RESTRICTIONS AS SET FORTH IN SUBDIVISION (C)(1)(II) OF THE RIGHTS IN … … 15 16 ** AND/OR IN SIMILAR OR SUCCESSOR CLAUSES IN THE FAR, DOD OR NASA FAR 16 17 ** SUPPLEMENT. UNPUBLISHED RIGHTS RESERVED UNDER THE COPYRIGHT LAWS OF 17 ** THE UNITED STATES. 18 ** 18 ** THE UNITED STATES. 19 ** 19 20 ** COPYRIGHT 3DFX INTERACTIVE, INC. 1999, ALL RIGHTS RESERVED 20 21 ** 21 ** $Revision: 1. 1 $22 ** $Date: 200 0-02-25 00:37:55 $22 ** $Revision: 1.2 $ 23 ** $Date: 2001-09-05 14:30:42 $ 23 24 ** 24 25 ** Utility routines for SST-1 Initialization code … … 345 346 if(enable) { 346 347 // VGA controls monitor 347 ISET(sst->fbiInit0, (IGET(sst->fbiInit0) & ~SST_EN_VGA_PASSTHRU) | 348 ISET(sst->fbiInit0, (IGET(sst->fbiInit0) & ~SST_EN_VGA_PASSTHRU) | 348 349 sst1CurrentBoard->vgaPassthruEnable); 349 350 ISET(sst->fbiInit1, IGET(sst->fbiInit1) | SST_VIDEO_BLANK_EN); 350 351 } else { 351 352 // SST-1 controls monitor 352 ISET(sst->fbiInit0, (IGET(sst->fbiInit0) & ~SST_EN_VGA_PASSTHRU) | 353 ISET(sst->fbiInit0, (IGET(sst->fbiInit0) & ~SST_EN_VGA_PASSTHRU) | 353 354 sst1CurrentBoard->vgaPassthruDisable); 354 355 ISET(sst->fbiInit1, IGET(sst->fbiInit1) & ~SST_VIDEO_BLANK_EN); … … 493 494 * they are managing. However, some registers cannot be accessed via 494 495 * the command fifo, and, inconveniently, these are not contiguously 495 * allocated. 496 * allocated. 496 497 */ 497 498 const FxU32 addrOffset = ((const FxU32)addr - (const FxU32)sst1CurrentBoard->virtAddr[0]); … … 545 546 ** 546 547 */ 547 FX_ENTRY FxBool FX_CALL sst1InitCmdFifo(FxU32 *sstbase, FxBool enable, 548 FX_ENTRY FxBool FX_CALL sst1InitCmdFifo(FxU32 *sstbase, FxBool enable, 548 549 FxU32 *virtAddrStart, FxU32 *memAddrStart, FxU32 *size, FxSet32Proc set32Proc) 549 550 { … … 566 567 if(enable == FXFALSE) { 567 568 // Remove any client set callbacks before continuing since 568 // these must go straight to the hw. 569 // these must go straight to the hw. 569 570 sst1CurrentBoard->set32 = NULL; 570 571 sst1CurrentBoard->fbiCmdFifoEn = 0; … … 621 622 *size = fifoSize; 622 623 623 if(!sst1InitCmdFifoDirect(sstbase, 0, 624 fifoStart, fifoSize, 624 if(!sst1InitCmdFifoDirect(sstbase, 0, 625 fifoStart, fifoSize, 625 626 directExec, disableHoles, 626 627 set32Proc)) { … … 628 629 return(FXFALSE); 629 630 } 630 631 631 632 if(sst1CurrentBoard->sliSlaveVirtAddr) { 632 633 if(!sst1InitCmdFifoDirect(sst1CurrentBoard->sliSlaveVirtAddr, 0, 633 fifoStart, fifoSize, 634 fifoStart, fifoSize, 634 635 directExec, disableHoles, 635 636 set32Proc)) { … … 646 647 ** 647 648 ** sst1InitCmdFifoDirect(): 648 ** Explicitly initialize Command FIFO. This routine is typically not 649 ** Explicitly initialize Command FIFO. This routine is typically not 649 650 ** called directly from apps. 650 651 ** … … 653 654 ** 654 655 */ 655 FX_ENTRY FxBool FX_CALL sst1InitCmdFifoDirect(FxU32 *sstbase, FxU32 which, 656 FxU32 start, FxU32 size, FxBool directExec, FxBool disableHoles, 656 FX_ENTRY FxBool FX_CALL sst1InitCmdFifoDirect(FxU32 *sstbase, FxU32 which, 657 FxU32 start, FxU32 size, FxBool directExec, FxBool disableHoles, 657 658 FxSet32Proc set32Proc) 658 659 { … … 686 687 // Disable memory-backed fifo, and disallow lfb and texture writes 687 688 // through command fifo... 688 ISET(sst->fbiInit0, (IGET(sst->fbiInit0) & 689 ISET(sst->fbiInit0, (IGET(sst->fbiInit0) & 689 690 ~(SST_MEM_FIFO_EN | SST_EN_LFB_MEMFIFO | SST_EN_TEX_MEMFIFO))); 690 691 sst1InitReturnStatus(sstbase); … … 751 752 ** and texture accesses do not pass through the command fifo. 752 753 ** WARNING: No register writes of any kind may be performed between a 753 ** sst1InitLfbLock() and sst1InitLfbUnlock() pair -- only lfb reads and 754 ** sst1InitLfbLock() and sst1InitLfbUnlock() pair -- only lfb reads and 754 755 ** writes are allowed. 755 756 */ … … 810 811 ** and texture accesses do not pass through the command fifo. 811 812 ** WARNING: No register writes of any kind may be performed between a 812 ** sst1InitLfbLock() and sst1InitLfbUnlock() pair -- only lfb reads and 813 ** sst1InitLfbLock() and sst1InitLfbUnlock() pair -- only lfb reads and 813 814 ** writes are allowed. 814 815 */ … … 925 926 (pciCntrLoad<<SST_SIPROCESS_PCI_CNTR_SHIFT) | 926 927 SST_SIPROCESS_OSC_CNTR_RESET_N | SST_SIPROCESS_OSC_NAND_SEL); 927 928 928 929 // Allow oscillator to run... 929 930 PCICFG_RD(SST1_PCI_SIPROCESS, siProcess); … … 931 932 (pciCntrLoad<<SST_SIPROCESS_PCI_CNTR_SHIFT) | 932 933 SST_SIPROCESS_OSC_CNTR_RUN | SST_SIPROCESS_OSC_NAND_SEL); 933 934 934 935 // Loop until PCI counter decrements to 0 935 936 cntr = 0 ; … … 938 939 PCICFG_RD(SST1_PCI_SIPROCESS, siProcess); 939 940 } while(siProcess & SST_SIPROCESS_PCI_CNTR); 940 941 941 942 PCICFG_RD(SST1_PCI_SIPROCESS, siProcess); 942 943 siProcess &= SST_SIPROCESS_OSC_CNTR; … … 954 955 (pciCntrLoad<<SST_SIPROCESS_PCI_CNTR_SHIFT) | 955 956 SST_SIPROCESS_OSC_CNTR_RESET_N | SST_SIPROCESS_OSC_NOR_SEL); 956 957 957 958 // Allow oscillator to run... 958 959 PCICFG_RD(SST1_PCI_SIPROCESS, siProcess); … … 960 961 (pciCntrLoad<<SST_SIPROCESS_PCI_CNTR_SHIFT) | 961 962 SST_SIPROCESS_OSC_CNTR_RUN | SST_SIPROCESS_OSC_NOR_SEL); 962 963 963 964 // Loop until PCI counter decrements to 0 964 965 cntr = 0 ; … … 967 968 PCICFG_RD(SST1_PCI_SIPROCESS, siProcess); 968 969 } while(siProcess & SST_SIPROCESS_PCI_CNTR); 969 970 970 971 PCICFG_RD(SST1_PCI_SIPROCESS, siProcess); 971 972 siProcess &= SST_SIPROCESS_OSC_CNTR; -
trunk/src/opengl/glide/cvg/init/video.c
r2888 r6653 1 1 /*-*-c++-*-*/ 2 /* $Id: video.c,v 1.2 2001-09-05 14:30:43 bird Exp $ */ 2 3 /* 3 4 ** THIS SOFTWARE IS SUBJECT TO COPYRIGHT PROTECTION AND IS OFFERED ONLY 4 5 ** PURSUANT TO THE 3DFX GLIDE GENERAL PUBLIC LICENSE. THERE IS NO RIGHT 5 6 ** TO USE THE GLIDE TRADEMARK WITHOUT PRIOR WRITTEN PERMISSION OF 3DFX 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 7 ** INTERACTIVE, INC. A COPY OF THIS LICENSE MAY BE OBTAINED FROM THE 8 ** DISTRIBUTOR OR BY CONTACTING 3DFX INTERACTIVE INC(info@3dfx.com). 9 ** THIS PROGRAM IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER 9 10 ** EXPRESSED OR IMPLIED. SEE THE 3DFX GLIDE GENERAL PUBLIC LICENSE FOR A 10 ** FULL TEXT OF THE NON-WARRANTY PROVISIONS. 11 ** 11 ** FULL TEXT OF THE NON-WARRANTY PROVISIONS. 12 ** 12 13 ** USE, DUPLICATION OR DISCLOSURE BY THE GOVERNMENT IS SUBJECT TO 13 14 ** RESTRICTIONS AS SET FORTH IN SUBDIVISION (C)(1)(II) OF THE RIGHTS IN … … 15 16 ** AND/OR IN SIMILAR OR SUCCESSOR CLAUSES IN THE FAR, DOD OR NASA FAR 16 17 ** SUPPLEMENT. UNPUBLISHED RIGHTS RESERVED UNDER THE COPYRIGHT LAWS OF 17 ** THE UNITED STATES. 18 ** 18 ** THE UNITED STATES. 19 ** 19 20 ** COPYRIGHT 3DFX INTERACTIVE, INC. 1999, ALL RIGHTS RESERVED 20 21 ** 21 ** $Revision: 1. 1 $22 ** $Date: 200 0-02-25 00:37:55 $22 ** $Revision: 1.2 $ 23 ** $Date: 2001-09-05 14:30:43 $ 23 24 ** 24 25 ** Initialization code for initializing SST-1 video unit … … 161 162 memSizeInPages <<= 1; 162 163 163 // To be compatible with Voodoo1, if there is enough memory to 164 // To be compatible with Voodoo1, if there is enough memory to 164 165 // allocate an aux buffer, then do it... 165 166 if(nCol == 2 && nAux == 0) { … … 211 212 // Reset Video Refresh Unit 212 213 ISET(sst->fbiInit1, IGET(sst->fbiInit1) | SST_VIDEO_RESET); 213 214 214 215 // Setup SST video timing registers 215 216 if(GETENV(("SSTV2_HSYNC"))) { … … 267 268 // Setup SST memory mapper for desired resolution 268 269 if(sst1CurrentBoard->fbiMemSize == 4) 269 sst1InitSetResolution(sstbase, sstVideoRez, 1); 270 sst1InitSetResolution(sstbase, sstVideoRez, 1); 270 271 else 271 sst1InitSetResolution(sstbase, sstVideoRez, 0); 272 sst1InitSetResolution(sstbase, sstVideoRez, 0); 272 273 273 274 // Calculate graphics clock frequency … … 342 343 if(sst1InitAllocBuffers(sstbase, nCol, nAux) == FXFALSE) 343 344 return(FXFALSE); 344 345 INIT_PRINTF(("sst1InitVideo(): Allocating %d Color Buffers and %d Aux Buffer(s)...\n", 345 346 INIT_PRINTF(("sst1InitVideo(): Allocating %d Color Buffers and %d Aux Buffer(s)...\n", 346 347 sst1CurrentBoard->fbiVideoColBuffs, sst1CurrentBoard->fbiVideoAuxBuffs)); 347 348 ISET(sst->fbiInit4, IGET(sst->fbiInit4) | … … 389 390 INIT_PRINTF(("sst1InitVideo(): Setting memory FIFO LWM to 0x%x (%d)\n", 390 391 sst1CurrentBoard->memFifoStatusLwm, 391 sst1CurrentBoard->memFifoStatusLwm)); 392 sst1CurrentBoard->memFifoStatusLwm)); 392 393 } 393 394 … … 665 666 ** 666 667 */ 667 static FxBool 668 static FxBool 668 669 sst1InitAllocBuffersDirect(FxU32 *sstbase, FxU32 nColorBuffs, FxU32 nAuxBuffs) 669 670 { … … 689 690 SST_BUFFER_ALLOC_3C1Z); 690 691 else { 691 INIT_PRINTF(("sst1InitAllocBuffers(): Unsupported Color/Aux buffer combination (%d/%d)\n", 692 INIT_PRINTF(("sst1InitAllocBuffers(): Unsupported Color/Aux buffer combination (%d/%d)\n", 692 693 nCol, nAux)); 693 694 return(FXFALSE); … … 698 699 } 699 700 700 FX_EXPORT FxBool FX_CSTYLE 701 FX_EXPORT FxBool FX_CSTYLE 701 702 sst1InitAllocBuffers(FxU32 *sstbase, FxU32 nColorBuffs, FxU32 nAuxBuffs) 702 703 { … … 712 713 return(FXFALSE); 713 714 714 retVal = sst1InitAllocBuffersDirect(sstbase, 715 retVal = sst1InitAllocBuffersDirect(sstbase, 715 716 nColorBuffs, nAuxBuffs); 716 717 717 718 if (retVal && sst1CurrentBoard->sliDetected) { 718 719 /* NB: When writing to the slave we need to make sure that it does 719 * not have a client callback installed. 720 * not have a client callback installed. 720 721 */ 721 722 FxSet32Proc saveProc = sst1CurrentBoard->set32; … … 797 798 ** 798 799 */ 799 FX_EXPORT void FX_CSTYLE sst1InitSetResolution(FxU32 *sstbase, 800 sst1VideoTimingStruct *sstVideoRez, 800 FX_EXPORT void FX_CSTYLE sst1InitSetResolution(FxU32 *sstbase, 801 sst1VideoTimingStruct *sstVideoRez, 801 802 FxU32 Banked) 802 803 { … … 907 908 */ 908 909 FX_EXPORT FxBool FX_CSTYLE sst1InitVideoBorder(FxU32 *sstbase, 909 FxU32 mask, 910 FxU32 mask, 910 911 FxU32 color) 911 912 { … … 949 950 950 951 FX_EXPORT sst1VideoTimingStruct* FX_CSTYLE 951 sst1InitFindVideoTimingStruct(GrScreenResolution_t screenResolution, 952 sst1InitFindVideoTimingStruct(GrScreenResolution_t screenResolution, 952 953 GrScreenRefresh_t screenRefresh) 953 954 { … … 1014 1015 1015 1016 case(GR_RESOLUTION_512x384): 1016 1017 1017 1018 if( GETENV( ("SSTV2_REFRESH_512x384") ) ) 1018 1019 refreshRate = sst1InitConvertRefreshRate( ATOI( GETENV( ("SSTV2_REFRESH_512x384") ) ) ); 1019 1020 1020 1021 if(refreshRate == GR_REFRESH_120Hz) 1021 1022 return(&SST_VREZ_512X384_120); … … 1039 1040 1040 1041 case(GR_RESOLUTION_640x400): 1041 1042 1042 1043 if( GETENV( ("SSTV2_REFRESH_640x400") ) ) 1043 1044 refreshRate = sst1InitConvertRefreshRate( ATOI( GETENV( ("SSTV2_REFRESH_640x400") ) ) ); 1044 1045 1045 1046 if(refreshRate == GR_REFRESH_120Hz) 1046 1047 return(&SST_VREZ_640X400_120); … … 1054 1055 1055 1056 case(GR_RESOLUTION_640x480): 1056 1057 1057 1058 if( GETENV( ("SSTV2_REFRESH_640x480") ) ) 1058 1059 refreshRate = sst1InitConvertRefreshRate( ATOI( GETENV( ("SSTV2_REFRESH_640x480") ) ) ); 1059 1060 1060 1061 if(refreshRate == GR_REFRESH_120Hz) 1061 1062 return(&SST_VREZ_640X480_120); … … 1069 1070 1070 1071 case(GR_RESOLUTION_800x600): 1071 1072 1072 1073 if( GETENV( ("SSTV2_REFRESH_800x600") ) ) 1073 1074 refreshRate = sst1InitConvertRefreshRate( ATOI( GETENV( ("SSTV2_REFRESH_800x600") ) ) ); 1074 1075 1075 1076 if(refreshRate == GR_REFRESH_120Hz) 1076 1077 return(&SST_VREZ_800X600_120); … … 1090 1091 if( GETENV( ("SSTV2_REFRESH_960x720") ) ) 1091 1092 refreshRate = sst1InitConvertRefreshRate( ATOI( GETENV( ("SSTV2_REFRESH_960x720") ) ) ); 1092 1093 1093 1094 if(refreshRate == GR_REFRESH_85Hz) 1094 1095 return(&SST_VREZ_960X720_85); … … 1100 1101 1101 1102 case(GR_RESOLUTION_1024x768): 1102 1103 1103 1104 if( GETENV( ("SSTV2_REFRESH_1024x768") ) ) 1104 1105 refreshRate = sst1InitConvertRefreshRate( ATOI( GETENV( ("SSTV2_REFRESH_1024x768") ) ) ); 1105 1106 1106 1107 if(refreshRate == GR_REFRESH_85Hz) 1107 1108 return(&SST_VREZ_1024X768_85); … … 1173 1174 j = IGET(sst->status); 1174 1175 } while(!(j & SST_VRETRACE)); 1175 1176 1176 1177 // Wait for active vsync 1177 1178 do { … … 1264 1265 else 1265 1266 tf2_clkdel = 0x6; 1266 } else 1267 } else 1267 1268 tf2_clkdel = 0x6; 1268 1269 … … 1274 1275 else 1275 1276 tf1_clkdel = 0x6; 1276 } else 1277 } else 1277 1278 tf1_clkdel = 0x6; 1278 1279
Note:
See TracChangeset
for help on using the changeset viewer.
