1 diff -urN XFree86-4.3.0/xc/programs/Xserver/hw/xfree86/drivers/savage.org/savage_accel.c XFree86-4.3.0/xc/programs/Xserver/hw/xfree86/drivers/savage/savage_accel.c
2 --- XFree86-4.3.0/xc/programs/Xserver/hw/xfree86/drivers/savage.org/savage_accel.c Fri Nov 8 19:03:32 2002
3 +++ XFree86-4.3.0/xc/programs/Xserver/hw/xfree86/drivers/savage/savage_accel.c Mon May 5 12:30:22 2003
6 | HARDWARE_PATTERN_PROGRAMMED_BITS
7 | HARDWARE_PATTERN_PROGRAMMED_ORIGIN
14 | BIT_ORDER_IN_BYTE_MSBFIRST
18 xaaptr->SetupForImageWrite = SavageSetupForImageWrite;
19 xaaptr->SubsequentImageWriteRect = SavageSubsequentImageWriteRect;
21 /* WriteBitmap color expand */
24 - xaaptr->WriteBitmapFlags = NO_PLANEMASK;
25 + xaaptr->WriteBitmapFlags = NO_PLANEMASK | ROP_NEEDS_SOURCE;
26 xaaptr->WriteBitmap = SavageWriteBitmapCPUToScreenColorExpand;
29 diff -urN XFree86-4.3.0/xc/programs/Xserver/hw/xfree86/drivers/savage.org/savage_driver.c XFree86-4.3.0/xc/programs/Xserver/hw/xfree86/drivers/savage/savage_driver.c
30 --- XFree86-4.3.0/xc/programs/Xserver/hw/xfree86/drivers/savage.org/savage_driver.c Tue Feb 25 05:08:21 2003
31 +++ XFree86-4.3.0/xc/programs/Xserver/hw/xfree86/drivers/savage/savage_driver.c Mon May 5 12:30:23 2003
34 #include "extensions/dpms.h"
40 #include "savage_driver.h"
41 #include "savage_bci.h"
50 #define iabs(a) ((int)(a)>0?(a):(-(a)))
52 #define DRIVER_NAME "savage"
53 -#define DRIVER_VERSION "1.1.26"
54 +#define DRIVER_VERSION "1.1.27"
55 #define VERSION_MAJOR 1
56 #define VERSION_MINOR 1
57 -#define PATCHLEVEL 26
58 +#define PATCHLEVEL 27
59 #define SAVAGE_VERSION ((VERSION_MAJOR << 24) | \
60 (VERSION_MINOR << 16) | \
66 - "XAAFillSolidRects",
70 @@ -2363,10 +2358,8 @@
71 if (xf86DPMSInit(pScreen, SavageDPMS, 0) == FALSE)
72 xf86DrvMsg(pScrn->scrnIndex, X_ERROR, "DPMS initialization failed\n");
75 if( !psav->NoAccel && !SavagePanningCheck(pScrn) )
76 SavageInitVideo( pScreen );
79 if (serverGeneration == 1)
80 xf86ShowUnusedOptions(pScrn->scrnIndex, pScrn->options);
81 diff -urN XFree86-4.3.0/xc/programs/Xserver/hw/xfree86/drivers/savage.org/savage_driver.h XFree86-4.3.0/xc/programs/Xserver/hw/xfree86/drivers/savage/savage_driver.h
82 --- XFree86-4.3.0/xc/programs/Xserver/hw/xfree86/drivers/savage.org/savage_driver.h Sat Jan 18 16:22:30 2003
83 +++ XFree86-4.3.0/xc/programs/Xserver/hw/xfree86/drivers/savage/savage_driver.h Mon May 5 12:30:23 2003
85 int YFactor; /* overlay Y factor */
86 int displayXoffset; /* overlay X offset */
87 int displayYoffset; /* overlay Y offset */
88 - int XExpansion; /* expansion factor in x */
90 + int XExp1; /* expansion ratio in x */
92 - int YExpansion; /* expansion factor in x */
94 + int YExp1; /* expansion ratio in x */
98 diff -urN XFree86-4.3.0/xc/programs/Xserver/hw/xfree86/drivers/savage.org/savage_regs.h XFree86-4.3.0/xc/programs/Xserver/hw/xfree86/drivers/savage/savage_regs.h
99 --- XFree86-4.3.0/xc/programs/Xserver/hw/xfree86/drivers/savage.org/savage_regs.h Wed Oct 2 22:39:55 2002
100 +++ XFree86-4.3.0/xc/programs/Xserver/hw/xfree86/drivers/savage/savage_regs.h Mon May 5 12:30:23 2003
102 VGAOUT8(psav->vgaIOBase + 5, a); \
105 +#define HZEXP_COMP_1 0x54
106 +#define HZEXP_BORDER 0x58
107 #define HZEXP_FACTOR_IGA1 0x59
109 +#define VTEXP_COMP_1 0x56
110 +#define VTEXP_BORDER 0x5a
111 #define VTEXP_FACTOR_IGA1 0x5b
113 +#define EC1_CENTER_ON 0x10
114 +#define EC1_EXPAND_ON 0x0c
116 #endif /* _SAVAGE_REGS_H */
117 diff -urN XFree86-4.3.0/xc/programs/Xserver/hw/xfree86/drivers/savage.org/savage_vbe.c XFree86-4.3.0/xc/programs/Xserver/hw/xfree86/drivers/savage/savage_vbe.c
118 --- XFree86-4.3.0/xc/programs/Xserver/hw/xfree86/drivers/savage.org/savage_vbe.c Wed Oct 2 22:39:55 2002
119 +++ XFree86-4.3.0/xc/programs/Xserver/hw/xfree86/drivers/savage/savage_vbe.c Mon May 5 12:30:23 2003
121 SavageClearVM86Regs( psav->pInt10 );
122 psav->pInt10->ax = 0x4f14; /* S3 extensions */
123 psav->pInt10->bx = 0x0001; /* Set default refresh rate */
124 - psav->pInt10->cx = n;
125 + psav->pInt10->cx = n & 0x3fff;
126 psav->pInt10->di = Refresh & 0xffff;
128 xf86ExecX86int10( psav->pInt10 );
129 diff -urN XFree86-4.3.0/xc/programs/Xserver/hw/xfree86/drivers/savage.org/savage_video.c XFree86-4.3.0/xc/programs/Xserver/hw/xfree86/drivers/savage/savage_video.c
130 --- XFree86-4.3.0/xc/programs/Xserver/hw/xfree86/drivers/savage.org/savage_video.c Sun Jan 12 04:55:49 2003
131 +++ XFree86-4.3.0/xc/programs/Xserver/hw/xfree86/drivers/savage/savage_video.c Mon May 5 12:30:24 2003
134 #define TIMER_MASK (OFF_TIMER | FREE_TIMER)
137 -void SavageInitVideo(ScreenPtr pScreen) {}
138 -void SavageResetVideo(ScrnInfoPtr pScrn) {}
141 void myOUTREG( SavagePtr psav, unsigned long offset, unsigned long value );
143 static XF86VideoAdaptorPtr SavageSetupImageVideo(ScreenPtr);
147 static void OverlayParamInit(ScrnInfoPtr pScrn);
148 -static void InitStreamsForExpansion(SavagePtr psav);
149 +static void InitStreamsForExpansion(ScrnInfoPtr pScrn);
151 /*static void SavageBlockHandler(int, pointer, pointer, pointer);*/
155 /* Sequence stolen from streams.c in M7 NT driver */
160 /* Unlock extended registers. */
161 @@ -430,10 +424,20 @@
162 VGAOUT16(vgaCRIndex, 0xa039);
163 VGAOUT16(0x3c4, 0x0608);
166 + S3_SAVAGE_MOBILE_SERIES(psav->Chipset) &&
170 + OverlayParamInit( pScrn );
173 VGAOUT8( vgaCRIndex, EXT_MISC_CTRL2 );
175 if( S3_SAVAGE_MOBILE_SERIES(psav->Chipset) ||
176 - (psav->Chipset == S3_SUPERSAVAGE) ||
177 +#if 0 /* I don't think commenting this out is correct (EE) */
178 + (psav->Chipset == S3_SUPERSAVAGE) ||
180 (psav->Chipset == S3_SAVAGE2000) )
182 jStreamsControl = VGAIN8( vgaCRReg ) | ENABLE_STREAM1;
188 -RegionsEqual(RegionPtr A, RegionPtr B)
190 - int *dataA, *dataB;
193 - num = REGION_NUM_RECTS(A);
194 - if(num != REGION_NUM_RECTS(B))
197 - if((A->extents.x1 != B->extents.x1) ||
198 - (A->extents.x2 != B->extents.x2) ||
199 - (A->extents.y1 != B->extents.y1) ||
200 - (A->extents.y2 != B->extents.y2))
203 - dataA = (int*)REGION_RECTS(A);
204 - dataB = (int*)REGION_RECTS(B);
207 - if((dataA[0] != dataB[0]) || (dataA[1] != dataB[1]))
219 Takes the dst box in standard X BoxRec form (top and left
222 REGION_EMPTY(pScrn->pScreen, &pPriv->clip);
224 - SavageStreamsOff( pScrn );
227 + SavageStreamsOff( pScrn );
229 xf86FreeOffscreenArea(pPriv->area);
231 @@ -1283,9 +1256,11 @@
232 ssControl |= (1 << 24);
233 OUTREG(SSTREAM_CONTROL_REG, ssControl);
236 /* Set color key on primary. */
238 SavageSetColorKey( pScrn );
241 /* Set FIFO L2 on second stream. */
243 @@ -1358,10 +1333,10 @@
247 - drw_w = (float)(drw_w * psav->XExp1)/(float)psav->XExp2 + 1;
248 - drw_h = (float)(drw_h * psav->YExp1)/(float)psav->YExp2 + 1;
249 - dstBox->x1 = (float)(dstBox->x1 * psav->XExp1)/(float)psav->XExp2;
250 - dstBox->y1 = (float)(dstBox->y1 * psav->YExp1)/(float)psav->YExp2;
251 + drw_w = (drw_w * psav->XExp1)/psav->XExp2 + 1;
252 + drw_h = (drw_h * psav->YExp1)/psav->YExp2 + 1;
253 + dstBox->x1 = (dstBox->x1 * psav->XExp1)/psav->XExp2;
254 + dstBox->y1 = (dstBox->y1 * psav->YExp1)/psav->YExp2;
255 dstBox->x1 += psav->displayXoffset;
256 dstBox->y1 += psav->displayYoffset;
258 @@ -1378,14 +1353,16 @@
262 - OUTREG(SEC_STREAM_FBUF_ADDR0, (offset + (x1>>15)) & 0x3ffff0 );
263 + OUTREG(SEC_STREAM_FBUF_ADDR0, (offset + (x1>>15)) & 0x7ffff0 );
264 OUTREG(SEC_STREAM_STRIDE, pitch & 0xfff );
265 OUTREG(SEC_STREAM_WINDOW_START, ((dstBox->x1+1) << 16) | (dstBox->y1+1) );
266 OUTREG(SEC_STREAM_WINDOW_SZ, ((drw_w) << 16) | drw_h );
269 /* Set color key on primary. */
271 SavageSetColorKey( pScrn );
274 /* Set FIFO L2 on second stream. */
276 @@ -1424,6 +1401,20 @@
277 int top, left, npixels, nlines;
280 +/* xf86ErrorFVerb(XVTRACE,"SavagePutImage\n"); */
282 + if( psav->cxScreen != pScrn->currentMode->HDisplay )
284 + /* The mode has changed. Recompute the offsets. */
287 + S3_SAVAGE_MOBILE_SERIES(psav->Chipset) &&
291 + OverlayParamInit( pScrn );
295 if(drw_w > 16384) drw_w = 16384;
297 @@ -1519,18 +1510,19 @@
298 SavageCopyData(buf, dst_start, srcPitch, dstPitch, nlines, npixels);
302 + /* We need to enable the video before we draw the chroma color.
303 + Otherwise, we get blue flashes. */
305 + SavageDisplayVideo(pScrn, id, offset, width, height, dstPitch,
306 + x1, y1, x2, y2, &dstBox, src_w, src_h, drw_w, drw_h);
308 /* update cliplist */
309 - if(!RegionsEqual(&pPriv->clip, clipBoxes)) {
310 - REGION_COPY(pScreen, &pPriv->clip, clipBoxes);
311 + if(!REGION_EQUAL(pScrn->pScreen, &pPriv->clip, clipBoxes)) {
312 + REGION_COPY(pScrn->pScreen, &pPriv->clip, clipBoxes);
314 - XAAFillSolidRects(pScrn, pPriv->colorKey, GXcopy, ~0,
315 - REGION_NUM_RECTS(clipBoxes),
316 - REGION_RECTS(clipBoxes));
317 + xf86XVFillKeyHelper(pScrn->pScreen, pPriv->colorKey, clipBoxes);
320 - SavageDisplayVideo(pScrn, id, offset, width, height, dstPitch,
321 - x1, y1, x2, y2, &dstBox, src_w, src_h, drw_w, drw_h);
323 pPriv->videoStatus = CLIENT_VIDEO_ON;
325 @@ -1692,6 +1684,7 @@
326 XF86SurfacePtr surface
328 OffscreenPrivPtr pPriv = (OffscreenPrivPtr)surface->devPrivate.ptr;
329 + xf86ErrorFVerb(XVTRACE,"SavageStopSurface\n");
332 /*SavagePtr psav = SAVPTR(surface->pScrn);*/
333 @@ -1754,6 +1747,7 @@
334 SavagePortPrivPtr portPriv = GET_PORT_PRIVATE(pScrn);
335 INT32 x1, y1, x2, y2;
337 + xf86ErrorFVerb(XVTRACE,"SavageDisplaySurface\n");
341 @@ -1777,14 +1771,12 @@
342 dstBox.y1 -= pScrn->frameY0;
343 dstBox.y2 -= pScrn->frameY0;
345 - XAAFillSolidRects(pScrn, portPriv->colorKey, GXcopy, ~0,
346 - REGION_NUM_RECTS(clipBoxes),
347 - REGION_RECTS(clipBoxes));
349 SavageDisplayVideo(pScrn, surface->id, surface->offsets[0],
350 surface->width, surface->height, surface->pitches[0],
351 x1, y1, x2, y2, &dstBox, src_w, src_h, drw_w, drw_h);
353 + xf86XVFillKeyHelper(pScrn->pScreen, portPriv->colorKey, clipBoxes);
357 if(portPriv->videoStatus & CLIENT_VIDEO_ON) {
358 @@ -1839,144 +1831,87 @@
359 SavagePtr psav = SAVPTR(pScrn);
361 psav = SAVPTR(pScrn);
362 - psav->cxScreen = psav->iResX;
363 - InitStreamsForExpansion(psav);
364 + psav->cxScreen = pScrn->currentMode->HDisplay;
365 + InitStreamsForExpansion(pScrn);
368 -/* Function to calculate lcd expansion x,yfactor and offset for overlay
369 +/* Function to calculate lcd expansion x,y factor and offset for overlay
371 -static void InitStreamsForExpansion(SavagePtr psav)
372 +static void InitStreamsForExpansion(ScrnInfoPtr pScrn)
374 + SavagePtr psav = SAVPTR(pScrn);
375 int PanelSizeX,PanelSizeY;
376 int ViewPortWidth,ViewPortHeight;
377 + int XExpansion, YExpansion;
378 int XFactor, YFactor;
379 + int Hstate, Vstate;
381 + static CARD32 Xfactors[] = {
383 + 0x00010001, /* 1 */
385 + 0x00090008, /* 3 */
386 + 0x00050004, /* 4 */
388 + 0x00030002, /* 6 */
392 + static CARD32 Yfactors[] = {
393 + 0x00010001, 0x00010001,
395 + 0x00050004, 0x00040003,
397 + 0x00020001, 0x00050002,
398 + 0x000C0005, 0x00080003,
400 + 0x00030001, 0x00040001,
405 PanelSizeX = psav->PanelX;
406 PanelSizeY = psav->PanelY;
407 - ViewPortWidth = psav->iResX;
408 - ViewPortHeight = psav->iResY;
409 + ViewPortWidth = pScrn->currentMode->HDisplay;
410 + ViewPortHeight = pScrn->currentMode->VDisplay;
412 if( PanelSizeX == 1408 )
414 - psav->XExpansion = 0x00010001;
415 - psav->YExpansion = 0x00010001;
417 + XExpansion = 0x00010001;
418 + YExpansion = 0x00010001;
420 psav->displayXoffset = 0;
421 psav->displayYoffset = 0;
423 + VGAOUT8(0x3C4, HZEXP_COMP_1);
424 + Hstate = VGAIN8(0x3C5);
425 + VGAOUT8(0x3C4, VTEXP_COMP_1);
426 + Vstate = VGAIN8(0x3C5);
427 VGAOUT8(0x3C4, HZEXP_FACTOR_IGA1);
428 - XFactor = VGAIN8(0x3C5) >> 4;
429 + XFactor = VGAIN8(0x3C5);
430 VGAOUT8(0x3C4, VTEXP_FACTOR_IGA1);
431 - YFactor = VGAIN8(0x3C5) >> 4;
432 + YFactor = VGAIN8(0x3C5);
435 + if( Hstate & EC1_EXPAND_ON )
438 - psav->XExpansion = 0x00010001;
439 - psav->displayXoffset =
440 - (((PanelSizeX - ViewPortWidth) / 2) + 0x7) & 0xFFF8;
444 - psav->XExpansion = 0x00090008;
445 - psav->displayXoffset =
446 - (((PanelSizeX - ((9 * ViewPortWidth)/8)) / 2) + 0x7) & 0xFFF8;
448 + XExpansion = Xfactors[XFactor>>4];
452 - psav->XExpansion = 0x00050004;
453 + if( Vstate & EC1_EXPAND_ON )
455 + YExpansion = Yfactors[YFactor>>4];
458 - if ((psav->cxScreen == 800) && (PanelSizeX !=1400))
460 - psav->displayXoffset =
461 - (((PanelSizeX - ((5 * ViewPortWidth)/4)) / 2) ) & 0xFFF8;
465 - psav->displayXoffset =
466 - (((PanelSizeX - ((5 * ViewPortWidth)/4)) / 2) +0x7) & 0xFFF8;
469 + psav->XExp1 = XExpansion >> 16;
470 + psav->XExp2 = XExpansion & 0xFFFF;
473 - psav->XExpansion = 0x00030002;
474 - psav->displayXoffset =
475 - (((PanelSizeX - ((3 * ViewPortWidth)/2)) / 2) + 0x7) & 0xFFF8;
477 + psav->YExp1 = YExpansion >> 16;
478 + psav->YExp2 = YExpansion & 0xFFFF;
481 - psav->XExpansion = 0x00020001;
482 - psav->displayXoffset =
483 - (((PanelSizeX - (2 * ViewPortWidth)) / 2) + 0x7) & 0xFFF8;
490 - psav->YExpansion = 0x00010001;
491 - psav->displayYoffset = (PanelSizeY - ViewPortHeight) / 2;
494 - psav->YExpansion = 0x00010001;
495 - psav->displayYoffset = (PanelSizeY - ViewPortHeight) / 2;
498 - psav->YExpansion = 0x00040003;
499 - psav->displayYoffset = (PanelSizeY - ((4 * ViewPortHeight)/3)) / 2;
502 - psav->YExpansion = 0x00050004;
503 - psav->displayYoffset = (PanelSizeY - ((5 * ViewPortHeight)/4)) / 2;
506 - psav->YExpansion = 0x00040003;
507 + psav->displayXoffset =
508 + ((PanelSizeX - (psav->XExp1 * ViewPortWidth) / psav->XExp2) / 2 + 7) & 0xfff8;
509 + psav->displayYoffset =
510 + ((PanelSizeY - (psav->YExp1 * ViewPortHeight) / psav->YExp2) / 2);
512 - if((psav->cxScreen == 1024)&&(PanelSizeX ==1400))
514 - psav->displayYoffset =
515 - ((PanelSizeY - ((4 * ViewPortHeight)/3)) / 2) - 0x1 ;
519 - psav->displayYoffset = (PanelSizeY - ((4 * ViewPortHeight)/3)) / 2;
523 - psav->YExpansion = 0x00050004;
524 - psav->displayYoffset = (PanelSizeY - ((5 * ViewPortHeight)/4)) / 2;
527 - psav->YExpansion = 0x00030002;
528 - psav->displayYoffset = (PanelSizeY - ((3 * ViewPortHeight)/2)) / 2;
531 - psav->YExpansion = 0x00020001;
532 - psav->displayYoffset = (PanelSizeY - (2 * ViewPortHeight)) /2;
535 - psav->YExpansion = 0x00090004;
536 - psav->displayYoffset = (PanelSizeY - ((9 * ViewPortHeight)/4)) /2;
539 - psav->YExpansion = 0x00110005;
540 - psav->displayYoffset = (PanelSizeY - ((11 * ViewPortHeight)/5)) /2;
543 - psav->YExpansion = 0x00070003;
544 - psav->displayYoffset = (PanelSizeY - ((7 * ViewPortHeight)/3)) /2;
547 - psav->YExpansion = 0x00050002;
548 - psav->displayYoffset = (PanelSizeY - ((5 * ViewPortHeight)/2)) /2;
551 - psav->YExpansion = 0x00040001;
552 - psav->displayYoffset = (PanelSizeY - (4 * ViewPortHeight)) /2;
555 - psav->XExp1 = psav->XExpansion >> 16;
556 - psav->XExp2 = psav->XExpansion & 0xFFFF;
557 - psav->YExp1 = psav->YExpansion >> 16;
558 - psav->YExp2 = psav->YExpansion & 0xFFFF;
559 } /* InitStreamsForExpansionPM */
561 -#endif /* XvExtension */