1 --- XFree86-4.0.1/xc/programs/Xserver/hw/xfree86/drivers/tdfx/tdfx_dri.c.chmou Tue Sep 19 17:34:43 2000
2 +++ XFree86-4.0.1/xc/programs/Xserver/hw/xfree86/drivers/tdfx/tdfx_dri.c Tue Sep 19 18:30:25 2000
7 - ErrorF("Incorrect initialization of visuals\n");
8 + xf86DrvMsg(pScreen->myNum, X_ERROR,
9 + "Incorrect initialization of visuals\n");
11 - } else ErrorF("Created %d visuals\n", numConfigs);
17 xf86DrvMsg(pScreen->myNum, X_ERROR,
18 "Incorrect initialization of visuals\n");
20 - } else ErrorF("Created %d visuals\n", numConfigs);
24 pTDFX->numVisualConfigs = numConfigs;
27 switch (pScrn->bitsPerPixel) {
29 + xf86DrvMsg(pScreen->myNum, X_ERROR,
30 + "DRI not supported in 8 bpp mode, disabling DRI.\n");
35 + xf86DrvMsg(pScreen->myNum, X_ERROR,
36 + "DRI not supported in 24 bpp mode, disabling DRI.\n");
39 - if (pTDFX->ChipType<=PCI_CHIP_VOODOO3) return FALSE;
40 + if (pTDFX->ChipType<=PCI_CHIP_VOODOO3) {
41 + xf86DrvMsg(pScreen->myNum, X_ERROR,
42 + "DRI requires Voodoo3 or later, disabling DRI.\n");
47 /* Check that the GLX, DRI, and DRM modules have been loaded by testing
51 pDRIInfo = DRICreateInfoRec();
55 + xf86DrvMsg(pScreen->myNum, X_ERROR,
56 + "DRICreatInfoRect() failed, disabling DRI.\n");
60 pTDFX->pDRIInfo = pDRIInfo;
62 pDRIInfo->drmDriverName = TDFXKernelDriverName;
66 if (sizeof(XF86DRISAREARec)+sizeof(TDFXSAREAPriv)>SAREA_MAX) {
67 - xf86DrvMsg(pScreen->myNum, X_ERROR, "Data does not fit in SAREA\n");
68 + xf86DrvMsg(pScreen->myNum, X_ERROR, "Data does not fit in SAREA\n");
71 pDRIInfo->SAREASize = SAREA_MAX;
74 if (!(pTDFXDRI = (TDFXDRIPtr)xnfcalloc(sizeof(TDFXDRIRec),1))) {
75 + xf86DrvMsg(pScreen->myNum, X_ERROR, "DRI memory allocation failed, disabling DRI.\n");
76 DRIDestroyInfoRec(pTDFX->pDRIInfo);
80 pDRIInfo->devPrivate=0;
81 DRIDestroyInfoRec(pTDFX->pDRIInfo);
83 + xf86DrvMsg(pScreen->myNum, X_ERROR, "DRIScreenInit failed, disabling DRI.\n");
89 if (drmAddMap(pTDFX->drmSubFD, (drmHandle)pTDFX->MMIOAddr[0],
90 pTDFXDRI->regsSize, DRM_REGISTERS, 0, &pTDFXDRI->regs)<0) {
91 TDFXDRICloseScreen(pScreen);
92 + xf86DrvMsg(pScreen->myNum, X_ERROR, "drmAddMap failed, disabling DRI.\n");
95 xf86DrvMsg(pScreen->myNum, X_INFO, "[drm] Registers = 0x%08lx\n",
98 if (!(TDFXInitVisualConfigs(pScreen))) {
99 TDFXDRICloseScreen(pScreen);
100 + xf86DrvMsg(pScreen->myNum, X_ERROR, "TDFXInitVisualConfigs failed, disabling DRI.\n");
103 xf86DrvMsg(pScrn->scrnIndex, X_INFO, "visual configs initialized\n" );
104 --- XFree86-4.0.1/xc/programs/Xserver/hw/xfree86/drivers/tdfx/tdfx_driver.c.chmou Tue Sep 19 17:34:43 2000
105 +++ XFree86-4.0.1/xc/programs/Xserver/hw/xfree86/drivers/tdfx/tdfx_driver.c Tue Sep 19 18:30:25 2000
107 ClockRangePtr clockRanges;
110 - char *mod=0, *reqSym=0;
112 rgb defaultWeight = {0, 0, 0};
116 if (flags & PROBE_DETECT) {
117 TDFXProbeDDC(pScrn, pTDFX->pEnt->index);
122 /* The vgahw module should be loaded here when needed */
123 @@ -1195,7 +1194,10 @@
128 + maxm=57; /* This used to be 64, alas it seems the last 8 (funny that ?)
129 + * values cause jittering at lower resolutions. I've not done
130 + * any calculations to what the adjustment affects clock ranges,
131 + * but I can still run at 1600x1200@75Hz */
133 for (n=1; n<256; n++) {
135 @@ -1604,15 +1606,6 @@
136 pTDFX = TDFXPTR(pScrn);
137 pTDFX->stride = pScrn->displayWidth*pTDFX->cpp;
139 - /* Layout the memory. Start with all the ram */
140 - memRemaining=pScrn->videoRam<<10;
141 - /* Remove the cursor space */
142 - memRemaining-=4096;
143 - /* Remove the main screen and offscreen pixmaps */
144 - memRemaining-=pTDFX->stride*(pScrn->virtualY+128);
145 - /* Remove one scanline for page alignment */
146 - memRemaining-=4095;
147 - /* Remove the back and Z buffers */
149 screenSizeInTiles=calcBufferSize(pScrn->virtualX, pScrn->virtualY,
151 @@ -1622,41 +1615,77 @@
152 screenSizeInTiles=calcBufferSize(pScrn->virtualX, pScrn->virtualY,
155 - memRemaining-=screenSizeInTiles*2;
157 - /* Give all the rest to textures, rounded down to a page */
158 - texSize=memRemaining&~0xFFF;
160 - /* Make sure fifo has CMDFIFO_PAGES<fifoSize<255 pages */
161 - if (memRemaining-texSize<CMDFIFO_PAGES<<12)
162 - texSize=(memRemaining-(CMDFIFO_PAGES<<12))&~0xFFF;
163 - /* Fifo uses the remaining space up to 255 pages */
164 - fifoSize = (memRemaining-texSize)&~0xFFF;
165 - if (fifoSize>255<<12) fifoSize=255<<12;
167 - /* Assign the variables */
169 - pTDFX->cursorOffset=0; /* Size 1024 bytes */
171 - /* Point the fifo at the first page */
172 + memRemaining=((pScrn->videoRam<<10) - 1) &~ 0xFFF;
173 + /* Note that a page is 4096 bytes, and a */
174 + /* tile is 32 x 128 = 4096 bytes. So, */
175 + /* page and tile boundaries are the same */
176 + /* Place the depth offset first, forcing */
177 + /* it to be on an *odd* page boundary. */
178 + pTDFX->depthOffset = (memRemaining - screenSizeInTiles) &~ 0xFFF;
179 + if ((pTDFX->depthOffset & (0x1 << 12)) == 0) {
181 + xf86DrvMsg(pScrn->scrnIndex, X_INFO,
182 + "Changing depth offset from 0x%08x to 0x%08x\n",
183 + pTDFX->depthOffset,
184 + pTDFX->depthOffset - (0x1 << 12));
186 + pTDFX->depthOffset -= (0x1 << 12);
188 + /* Now, place the back buffer, forcing it */
189 + /* to be on an *even* page boundary. */
190 + pTDFX->backOffset = (pTDFX->depthOffset - screenSizeInTiles) &~ 0xFFF;
191 + if (pTDFX->backOffset & (0x1 << 12)) {
193 + xf86DrvMsg(pScrn->scrnIndex, X_INFO,
194 + "Changing back offset from 0x%08x to 0x%08x\n",
196 + pTDFX->backOffset - (0x1 << 12));
198 + pTDFX->backOffset -= (0x1 << 12);
200 + /* Now, place the front buffer, forcing */
201 + /* it to be on a page boundary too, just */
204 + = (pTDFX->backOffset - (pScrn->virtualY+128)*pTDFX->stride) &~ 0xFFF;
205 + /* Give the cmd fifo at least */
206 + /* CMDFIFO_PAGES pages, but no more than */
208 + fifoSize = ((255 <= CMDFIFO_PAGES) ? 255 : CMDFIFO_PAGES) << 12;
209 + /* We give 4096 bytes to the cursor, fifoSize to the */
210 + /* FIFO, and everything to textures. */
211 + texSize = (pTDFX->fbOffset - fifoSize - 4096);
212 + pTDFX->texOffset = pTDFX->fbOffset - texSize;
213 + pTDFX->texSize = texSize;
214 pTDFX->fifoOffset = 4096;
215 pTDFX->fifoSize = fifoSize;
218 - pTDFX->texOffset = pTDFX->fifoOffset+fifoSize;
219 - pTDFX->texSize = texSize;
222 - pTDFX->fbOffset=pTDFX->texOffset+pTDFX->texSize;
225 - pTDFX->backOffset=pTDFX->fbOffset+(pScrn->virtualY+128)*pTDFX->stride;
226 - /* Round off to a page */
227 - pTDFX->backOffset=(pTDFX->backOffset+4095)&~0xFFF;
230 - pTDFX->depthOffset=pTDFX->backOffset+screenSizeInTiles;
232 + pTDFX->cursorOffset = 0;
234 + xf86DrvMsg(pScrn->scrnIndex, X_INFO,
235 + "Cursor Offset: [0x%08X,0x%08X)\n",
236 + pTDFX->cursorOffset,
237 + pTDFX->cursorOffset+1024);
238 + xf86DrvMsg(pScrn->scrnIndex, X_INFO,
239 + "Fifo Offset: [0x%08X, 0x%08X)\n",
241 + pTDFX->fifoOffset+fifoSize);
242 + xf86DrvMsg(pScrn->scrnIndex, X_INFO,
243 + "Texture Offset: [0x%08X, 0x%08X)\n",
245 + pTDFX->texOffset + texSize);
246 + xf86DrvMsg(pScrn->scrnIndex, X_INFO,
247 + "Front Buffer Offset: [0x%08X, 0x%08X)\n",
249 + pTDFX->fbOffset + (pScrn->virtualY+128)*pTDFX->stride);
250 + xf86DrvMsg(pScrn->scrnIndex, X_INFO,
251 + "BackOffset: [0x%08X, 0x%08X)\n",
253 + pTDFX->backOffset+screenSizeInTiles);
254 + xf86DrvMsg(pScrn->scrnIndex, X_INFO,
255 + "DepthOffset: [0x%08X, 0x%08X)\n",
256 + pTDFX->depthOffset,
257 + pTDFX->depthOffset+screenSizeInTiles);
259 xf86DrvMsg(pScrn->scrnIndex, X_INFO, "Textures Memory %0.02f MB\n",
260 (float)texSize/1024.0/1024.0);
262 --- XFree86-4.0.1/xc/programs/Xserver/hw/xfree86/drivers/tdfx/tdfx_accel.c.chmou Tue Sep 19 17:34:43 2000
263 +++ XFree86-4.0.1/xc/programs/Xserver/hw/xfree86/drivers/tdfx/tdfx_accel.c Tue Sep 19 18:30:25 2000
264 @@ -163,12 +163,22 @@
268 + int TileAperturePitch, lg2TileAperturePitch;
269 if (pTDFX->cpp==2) stride=pTDFX->stride;
270 else stride=4*pTDFX->stride/pTDFX->cpp;
271 bits=pTDFX->backOffset>>12;
272 + for (lg2TileAperturePitch = 0, TileAperturePitch = 1024;
273 + (lg2TileAperturePitch < 5) &&
274 + TileAperturePitch < stride;
275 + lg2TileAperturePitch += 1, TileAperturePitch <<= 1);
277 + fprintf(stderr, "Using %d (== lg2(%d)-10) for tile aperture pitch\n",
278 + lg2TileAperturePitch, TileAperturePitch);
279 + fprintf(stderr, "stride == %d\n", stride);
281 for (chip=0; chip<pTDFX->numChips; chip++) {
282 TDFXWriteChipLongMMIO(pTDFX, chip, LFBMEMORYCONFIG, (bits&0x1FFF) |
283 - SST_RAW_LFB_ADDR_STRIDE_4K |
284 + SST_RAW_LFB_ADDR_STRIDE(lg2TileAperturePitch) |
285 ((bits&0x6000)<<10) |
286 ((stride+127)/128)<<SST_RAW_LFB_TILE_STRIDE_SHIFT);
288 --- XFree86-4.0.1/xc/programs/Xserver/hw/xfree86/drivers/tdfx/tdfx_sli.c.chmou Tue Sep 19 17:34:43 2000
289 +++ XFree86-4.0.1/xc/programs/Xserver/hw/xfree86/drivers/tdfx/tdfx_sli.c Tue Sep 19 18:30:25 2000
291 -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/tdfx/tdfx_sli.c,v 1.2 2000/06/17 18:23:23 dawes Exp $ */
294 #include "xf86_ansic.h"
295 --- XFree86-4.0.1/xc/programs/Xserver/hw/xfree86/drivers/tdfx/tdfxdefs.h.chmou Tue Sep 19 17:34:43 2000
296 +++ XFree86-4.0.1/xc/programs/Xserver/hw/xfree86/drivers/tdfx/tdfxdefs.h Tue Sep 19 18:30:25 2000
299 #define MEM_TYPE_SGRAM 0
300 #define MEM_TYPE_SDRAM 1
302 + * SST_RAW_LFB_ADDR_STRIDE(Lg2SizeInK) takes the
303 + * lfbMemoryConfig value for SGRAMStrideInTiles. This
304 + * is given by this table:
305 + * SGRAMStrideInBytes lfbMemoryConfig Value
306 + * ================== =====================
313 + * FWIW, the right hand column is log2(left hand column)-10
315 #define SST_RAW_LFB_ADDR_STRIDE_SHIFT 13
316 -#define SST_RAW_LFB_ADDR_STRIDE_4K 0x2<<SST_RAW_LFB_ADDR_STRIDE_SHIFT
317 +#define SST_RAW_LFB_ADDR_STRIDE(Lg2SizeInK) \
318 + ((Lg2SizeInK)<<SST_RAW_LFB_ADDR_STRIDE_SHIFT)
319 +#define SST_RAW_LFB_ADDR_STRIDE_4K SST_RAW_LFB_ADDR_STRIDE(2)
320 +#define SST_RAW_LFB_ADDR_STRIDE_8K SST_RAW_LFB_ADDR_STRIDE(3)
321 +#define SST_RAW_LFB_ADDR_STRIDE_16K SST_RAW_LFB_ADDR_STRIDE(4)
322 #define SST_RAW_LFB_TILE_STRIDE_SHIFT 16