summaryrefslogtreecommitdiff
path: root/testing/xf86-video-chips/chips-1.2.4-git.patch
blob: 9d8e856a3b30a6ba973b54d999a24f62ee148344 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
diff --git a/configure.ac b/configure.ac
index 225e516..c0ed508 100644
--- a/configure.ac
+++ b/configure.ac
@@ -44,9 +44,6 @@ XORG_DEFAULT_OPTIONS
 AC_DISABLE_STATIC
 AC_PROG_LIBTOOL
 
-# Checks for programs.
-AM_PROG_CC_C_O
-
 AH_TOP([#include "xorg-server.h"])
 
 # Define a configure option for an alternate module directory
diff --git a/man/chips.man b/man/chips.man
index 740af38..0c022ee 100644
--- a/man/chips.man
+++ b/man/chips.man
@@ -165,9 +165,6 @@ Force the use of memory mapped IO where it can be used. Default: off
 Force driver to leave centering and stretching registers alone. This
 can fix some laptop suspend/resume problems. Default: off
 .TP
-.BI "Option \*qOverlay\*q"
-Enable 8+24 overlay mode.  Only appropriate for depth 24.  Default: off.
-.TP
 .BI "Option \*qColorKey\*q \*q" integer \*q
 Set the colormap index used for the transparency key for the depth 8 plane
 when operating in 8+16 overlay mode.  The value must be in the range
diff --git a/src/ct_accel.c b/src/ct_accel.c
index 3920b0a..4b5776a 100644
--- a/src/ct_accel.c
+++ b/src/ct_accel.c
@@ -428,19 +428,7 @@ chips_imagewrite:
         infoPtr->ImageWriteFlags |= NO_PLANEMASK;
 #endif
 
-
-#ifdef CHIPS_HIQV
-    if (XAAInit(pScreen, infoPtr)) {
-	if (cPtr->Flags & ChipsOverlay8plus16)      
-	    return(XAAInitDualFramebufferOverlay(pScreen,
-						 CTNAME(DepthChange)));
-	else
-	    return TRUE;
-    } else
-	return FALSE;
-#else
     return(XAAInit(pScreen, infoPtr));
-#endif
 }
 
 #ifdef CHIPS_HIQV
@@ -1243,11 +1231,6 @@ CTNAME(SubsequentScreenToScreenColorExpandFill)(ScrnInfoPtr pScrn,
 #endif
     w *= cAcl->BytesPerPixel;
     ctBLTWAIT;
-#ifdef CHIPS_HIQV
-    if ((y >= pScrn->virtualY) && (cPtr->Flags & ChipsOverlay8plus16) &&
-	    (pScrn->depth == 8))
-	ctSETPITCH(cAcl->PitchInBytes << 1, cAcl->PitchInBytes);
-#endif
     ctSETSRCADDR(srcaddr);
     ctSETDSTADDR(destaddr);
 #ifdef CHIPS_HIQV
@@ -1271,10 +1254,6 @@ CTNAME(SetupForColor8x8PatternFill)(ScrnInfoPtr pScrn, int patx, int paty,
     patternaddr = (paty * pScrn->displayWidth + 
 		   (patx & ~0x3F)) * cAcl->BytesPerPixel;
     cAcl->patternyrot = (patx & 0x3F) >> 3;
-#ifdef CHIPS_HIQV
-    if (cPtr->Flags & ChipsOverlay8plus16)
-	patternaddr += cPtr->FbOffset16;
-#endif
 
     ctBLTWAIT;
     ctSETPATSRCADDR(patternaddr);
@@ -1338,10 +1317,7 @@ CTNAME(SetupForMono8x8PatternFill)(ScrnInfoPtr pScrn, int patx, int paty,
 
 #ifdef CHIPS_HIQV
     patternaddr = paty * pScrn->displayWidth + patx;
-    if (cPtr->Flags & ChipsOverlay8plus16)
-	patternaddr = patternaddr * 2 + cPtr->FbOffset16;
-    else
-	patternaddr *= cAcl->BytesPerPixel;
+    patternaddr *= cAcl->BytesPerPixel;
 #else
     patternaddr = (paty * pScrn->displayWidth + patx) * cAcl->BytesPerPixel;
 #endif
@@ -1593,10 +1569,7 @@ CTNAME(WritePixmap)(ScrnInfoPtr pScrn, int x, int y, int w, int h,
     dwords = (((skipleft  + bytesPerLine + 0x7) & ~0x7)) >> 2;
     destaddr = (y * pScrn->displayWidth + x) * (bpp >> 3);
     destpitch = pScrn->displayWidth * (bpp >> 3);
-    if ((y >= pScrn->virtualY) && (cPtr->Flags & ChipsOverlay8plus16))
-	destaddr += cPtr->FbOffset16;
-    else
-	destaddr += cAcl->FbOffset;
+    destaddr += cAcl->FbOffset;
 
     ctBLTWAIT;
 
@@ -1681,10 +1654,7 @@ CTNAME(WritePixmap)(ScrnInfoPtr pScrn, int x, int y, int w, int h,
 	y++;
 
 	destaddr = (y * pScrn->displayWidth + x) * (bpp >> 3);
-	if ((y >= pScrn->virtualY) && (cPtr->Flags & ChipsOverlay8plus16))
-	    destaddr += cPtr->FbOffset16;
-	else
-	    destaddr += cAcl->FbOffset;
+	destaddr += cAcl->FbOffset;
 
 	ctBLTWAIT;
 	ctSETDSTADDR(destaddr);
@@ -1717,10 +1687,7 @@ CTNAME(ReadPixmap)(ScrnInfoPtr pScrn, int x, int y, int w, int h,
     dwords = (((bytesPerLine + 0x7) & ~0x7)) >> 2;
     srcaddr = (y * pScrn->displayWidth + x) * (bpp >> 3);
     srcpitch = pScrn->displayWidth * (bpp >> 3);
-    if ((y >= pScrn->virtualY) && (cPtr->Flags & ChipsOverlay8plus16))
-	srcaddr += cPtr->FbOffset16;
-    else
-	srcaddr += cAcl->FbOffset;
+    srcaddr += cAcl->FbOffset;
 
     ctBLTWAIT;
     ctSETROP( ctDSTSYSTEM | ctLEFT2RIGHT | ctTOP2BOTTOM | 
@@ -1755,10 +1722,7 @@ CTNAME(ReadPixmap)(ScrnInfoPtr pScrn, int x, int y, int w, int h,
 	dst += dstwidth;
 	y++;
 	srcaddr = (y * pScrn->displayWidth + x) * (bpp >> 3);
-	if ((y >= pScrn->virtualY) && (cPtr->Flags & ChipsOverlay8plus16))
-	    srcaddr += cPtr->FbOffset16;
-	else
-	    srcaddr += cAcl->FbOffset;
+	srcaddr += cAcl->FbOffset;
 	ctBLTWAIT;
 	ctSETSRCADDR(srcaddr);
 	ctSETHEIGHTWIDTHGO(h, bytesPerLine);
diff --git a/src/ct_driver.c b/src/ct_driver.c
index 6624b79..a2e5c94 100644
--- a/src/ct_driver.c
+++ b/src/ct_driver.c
@@ -949,7 +949,7 @@ CHIPSProbe(DriverPtr drv, int flags)
 		}
 
 	    }
-	    xfree(usedChips);
+	    free(usedChips);
 	}
     }
 
@@ -981,12 +981,12 @@ CHIPSProbe(DriverPtr drv, int flags)
 		pScrn->ValidMode     = CHIPSValidMode;
 		foundScreen = TRUE;
 	    }
-	    xfree(usedChips);
+	    free(usedChips);
 	}
     }
 #endif
     
-    xfree(devSections);
+    free(devSections);
     return foundScreen;
 }
 #endif
@@ -1446,7 +1446,12 @@ chipsPreInitHiQV(ScrnInfoPtr pScrn, int flags)
 
     hwp = VGAHWPTR(pScrn);
     vgaHWGetIOBase(hwp);
+#if GET_ABI_MAJOR(ABI_VIDEODRV_VERSION) < 12
     cPtr->PIOBase = hwp->PIOOffset;
+#else
+    cPtr->PIOBase = 0;
+#endif
+
     /*
      * Must allow ensure that storage for the 2nd set of vga registers is
      * allocated for dual channel cards
@@ -1639,55 +1644,15 @@ chipsPreInitHiQV(ScrnInfoPtr pScrn, int flags)
 	}
     }
     
-    if ((s = xf86GetOptValString(cPtr->Options, OPTION_OVERLAY))) {
-	if (!*s || !xf86NameCmp(s, "8,16") || !xf86NameCmp(s, "16,8")) {
-	  if (pScrn->bitsPerPixel == 16) {
-	    if (cPtr->Flags & ChipsLinearSupport) {
-		cPtr->Flags |= ChipsOverlay8plus16;
-		if(!xf86GetOptValInteger(
-			cPtr->Options, OPTION_COLOR_KEY, &(pScrn->colorKey)))
-		    pScrn->colorKey = TRANSPARENCY_KEY;
-		pScrn->overlayFlags = OVERLAY_8_16_DUALFB;
-		xf86DrvMsg(pScrn->scrnIndex, X_CONFIG, 
-			   "PseudoColor overlay enabled.\n");
-		if (!xf86IsOptionSet(cPtr->Options, OPTION_LCD_STRETCH))
-		    xf86DrvMsg(pScrn->scrnIndex, X_WARNING, 
-			   "                             - Forcing option \"Stretch\" \"ON\".\n");
-		if (!xf86IsOptionSet(cPtr->Options, OPTION_LCD_CENTER))
-		    xf86DrvMsg(pScrn->scrnIndex, X_WARNING, 
-			   "                             - Forcing option \"LcdCenter\" \"OFF\".\n");
-		if (cPtr->Flags & ChipsShadowFB) {
-		    xf86DrvMsg(pScrn->scrnIndex, X_WARNING,
-		           "                             - Disabling \"Shadow Framebuffer\".\n");
-		    xf86DrvMsg(pScrn->scrnIndex, X_WARNING, 
-			   "                               Not support with option \"8Plus16\".\n");
-		    cPtr->Flags &= ~ChipsShadowFB;
-		    cPtr->Rotate = 0;
-		}
-	    } else {
-		xf86DrvMsg(pScrn->scrnIndex, X_WARNING, "Option \"Overlay\" ignored. Not supported without linear addressing\n");
-	    }
-	  } else {
-	    xf86DrvMsg(pScrn->scrnIndex, X_WARNING, 
-		"Option \"Overlay\" is not supported in this configuration\n");
-	  }
-	} else {
-	    xf86DrvMsg(pScrn->scrnIndex, X_WARNING, 
-		"\"%s\" is not a valid value for Option \"Overlay\"\n", s); 
-	}
-    }
-
-    if (!(cPtr->Flags & ChipsOverlay8plus16)) {
-	if(xf86GetOptValInteger(cPtr->Options, OPTION_VIDEO_KEY,
-		&(cPtr->videoKey))) {
-	    xf86DrvMsg(pScrn->scrnIndex, X_CONFIG, "video key set to 0x%x\n",
+    if(xf86GetOptValInteger(cPtr->Options, OPTION_VIDEO_KEY,
+	&(cPtr->videoKey))) {
+         xf86DrvMsg(pScrn->scrnIndex, X_CONFIG, "video key set to 0x%x\n",
 		cPtr->videoKey);
-	} else {
-	    cPtr->videoKey =  (1 << pScrn->offset.red) | 
+    } else {
+       cPtr->videoKey =  (1 << pScrn->offset.red) | 
 			(1 << pScrn->offset.green) |
 			(((pScrn->mask.blue >> pScrn->offset.blue) - 1)
 			<< pScrn->offset.blue); 
-	}
     }
 
     if (cPtr->Flags & ChipsShadowFB) {
@@ -2335,28 +2300,16 @@ chipsPreInitHiQV(ScrnInfoPtr pScrn, int flags)
     /* and 32bits on the others. Thus multiply by a suitable factor      */  
     if (cPtr->Flags & Chips64BitMemory) {
 	if (cPtr->FrameBufferSize && (cPtr->PanelType & ChipsLCD))
-	    if (cPtr->Flags & ChipsOverlay8plus16 )
-		cPtr->MaxClock = min(cPtr->MaxClock, MemClk->Clk * 8 * 0.7 / 4);
-	    else
 		cPtr->MaxClock = min(cPtr->MaxClock,
 			     MemClk->Clk * 8 * 0.7 / (bytesPerPixel + 1));
 	else
-	    if (cPtr->Flags & ChipsOverlay8plus16)
-		cPtr->MaxClock = min(cPtr->MaxClock, MemClk->Clk * 8 * 0.7 / 3);
-	    else
 		cPtr->MaxClock = min(cPtr->MaxClock, 
 			     MemClk->Clk * 8 * 0.7 / bytesPerPixel);
     } else {
 	if (cPtr->FrameBufferSize && (cPtr->PanelType & ChipsLCD))
-	    if (cPtr->Flags & ChipsOverlay8plus16 )
-		cPtr->MaxClock = min(cPtr->MaxClock, MemClk->Clk * 4 * 0.7 / 4);
-	    else
 		cPtr->MaxClock = min(cPtr->MaxClock,
 			     MemClk->Clk * 4 * 0.7 / (bytesPerPixel + 1));
 	else
-	    if (cPtr->Flags & ChipsOverlay8plus16)
-		cPtr->MaxClock = min(cPtr->MaxClock, MemClk->Clk * 4 * 0.7 / 3);
-	    else
 		cPtr->MaxClock = min(cPtr->MaxClock, 
 			     MemClk->Clk * 4 * 0.7 / bytesPerPixel);
     }
@@ -3736,8 +3689,7 @@ CHIPSEnterVT(int scrnIndex, int flags)
     /* Should we re-save the text mode on each VT enter? */
     if(!chipsModeInit(pScrn, pScrn->currentMode))
       return FALSE;
-    if ((!(cPtr->Flags & ChipsOverlay8plus16)) 
-	&& (cPtr->Flags & ChipsVideoSupport)
+    if ((cPtr->Flags & ChipsVideoSupport)
 	&& (cPtr->Flags & ChipsLinearSupport)) 
         CHIPSResetVideo(pScrn); 
 
@@ -3788,8 +3740,7 @@ chipsLoadPalette(ScrnInfoPtr pScrn, int numColors, int *indices, LOCO *colors,
     int i, index, shift ;
     CHIPSEntPtr cPtrEnt;    
 
-    shift = ((pScrn->depth == 15) && 
-	     (!(cPtr->Flags & ChipsOverlay8plus16))) ? 3 : 0;
+    shift = (pScrn->depth == 15) ? 3 : 0;
 
     if (cPtr->UseDualChannel) {
         cPtrEnt = xf86GetEntityPrivate(pScrn->entityList[0],
@@ -3895,18 +3846,6 @@ chipsLoadPalette16(ScrnInfoPtr pScrn, int numColors, int *indices,
     hwp->disablePalette(hwp);
 }
 
-static Bool
-cfb8_16ScreenInit(ScreenPtr pScreen, pointer pbits16, pointer pbits8,
-                  int xsize, int ysize, int dpix, int dpiy,
-                  int width16, int width8)
-{
-    return
-        (fbOverlaySetupScreen(pScreen, pbits16, pbits8, xsize, ysize,
-                              dpix, dpiy, width16, width8, 16, 8) &&
-         fbOverlayFinishScreenInit(pScreen, pbits16, pbits8, xsize, ysize,
-                                   dpix, dpiy, width16, width8, 16, 8, 16, 8));
-}
-
 /* Mandatory */
 static Bool
 CHIPSScreenInit(int scrnIndex, ScreenPtr pScreen, int argc, char **argv)
@@ -3947,22 +3886,6 @@ CHIPSScreenInit(int scrnIndex, ScreenPtr pScreen, int argc, char **argv)
     if (!chipsMapMem(pScrn))
 	return FALSE;
 
-    /* Setup a pointer to the overlay if needed */
-    if (cPtr->Flags & ChipsOverlay8plus16) {
-	cPtr->FbOffset16 = pScrn->displayWidth * pScrn->virtualY;
-	cPtr->FbSize16 =  (pScrn->displayWidth << 1) * pScrn->virtualY;
-	if (cPtr->FbSize16 > (cPtr->FbMapSize - cPtr->FrameBufferSize)) {
-	    xf86DrvMsg(pScrn->scrnIndex, X_CONFIG,
-		   "Too little memory for overlay. Disabling.\n");
-	    cPtr->Flags &= ~ChipsOverlay8plus16;
-	}
-	if ((pScrn->displayWidth > 1024) || (pScrn->virtualY > 1024)) {
-	    xf86DrvMsg(pScrn->scrnIndex, X_CONFIG,
-		   "Max overlay Width/Height 1024 pixels. Disabling.\n");
-	    cPtr->Flags &= ~ChipsOverlay8plus16;
-	}
-    }
-
     /* Setup the MMIO register access functions if need */
     if (cPtr->UseFullMMIO && cPtr->MMIOBaseVGA) {
 	CHIPSSetMmioExtFuncs(cPtr);
@@ -4035,18 +3958,10 @@ CHIPSScreenInit(int scrnIndex, ScreenPtr pScreen, int argc, char **argv)
     miClearVisualTypes();
 
     /* Setup the visuals we support. */
-    if ((pScrn->bitsPerPixel == 16) && (cPtr->Flags & ChipsOverlay8plus16)){
-	if (!miSetVisualTypes(8, PseudoColorMask | GrayScaleMask,
-			      pScrn->rgbBits, PseudoColor))
-		return FALSE;
-	if (!miSetVisualTypes(16, TrueColorMask, pScrn->rgbBits, TrueColor))
-		return FALSE;
-    } else {
-      if (!miSetVisualTypes(pScrn->depth,
+    if (!miSetVisualTypes(pScrn->depth,
 			    miGetDefaultVisualMask(pScrn->depth),
 			    pScrn->rgbBits, pScrn->defaultVisual))
-	return FALSE;
-    }
+        return FALSE;
     miSetPixmapDepths ();
 
     /*
@@ -4090,13 +4005,6 @@ CHIPSScreenInit(int scrnIndex, ScreenPtr pScreen, int argc, char **argv)
 	break;
 #endif
     case 16:
-      if (cPtr->Flags & ChipsOverlay8plus16) {
-	  ret = cfb8_16ScreenInit(pScreen, (unsigned char *)FBStart + 
-				  cPtr->FbOffset16, FBStart, width, 
-				  height, pScrn->xDpi, pScrn->yDpi,
-				  displayWidth, displayWidth);
-	  break;
-      }
     default:
 	ret = fbScreenInit(pScreen, FBStart,
  		        width,height,
@@ -4223,7 +4131,7 @@ CHIPSScreenInit(int scrnIndex, ScreenPtr pScreen, int argc, char **argv)
 	}
 	if (!miInitializeBanking(pScreen, pScrn->virtualX, pScrn->virtualY,
 				 pScrn->displayWidth, pBankInfo)) {
-	    xfree(pBankInfo);
+	    free(pBankInfo);
 	    pBankInfo = NULL;
 	    return FALSE;
 	}
@@ -4244,9 +4152,6 @@ CHIPSScreenInit(int scrnIndex, ScreenPtr pScreen, int argc, char **argv)
 	if (pScrn->bitsPerPixel < 8)
 	    freespace = allocatebase - pScrn->displayWidth * 
 		    pScrn->virtualY / 2;
-	else if ((pScrn->bitsPerPixel == 16) && (cPtr->Flags & ChipsOverlay8plus16))
-	    freespace = allocatebase - pScrn->displayWidth * 
-		    pScrn->virtualY - cPtr->FbSize16;
 	else	
 	    freespace = allocatebase - pScrn->displayWidth * 
 		    pScrn->virtualY * (pScrn->bitsPerPixel >> 3);
@@ -4369,9 +4274,7 @@ CHIPSScreenInit(int scrnIndex, ScreenPtr pScreen, int argc, char **argv)
 	    AvailFBArea.y2 = cAcl->CacheEnd /
 		(pScrn->displayWidth * (pScrn->bitsPerPixel >> 3));
 
-	    if (!(cPtr->Flags & ChipsOverlay8plus16)) {     
-		xf86InitFBManager(pScreen, &AvailFBArea); 
-	    }
+	    xf86InitFBManager(pScreen, &AvailFBArea); 
 	}
 	if (cPtr->Flags & ChipsAccelSupport) {
 	    if (IS_HiQV(cPtr)) {
@@ -4425,16 +4328,10 @@ CHIPSScreenInit(int scrnIndex, ScreenPtr pScreen, int argc, char **argv)
     if (!miCreateDefColormap(pScreen))
 	return FALSE;
     
-    if ((cPtr->Flags & ChipsOverlay8plus16) && (pScrn->bitsPerPixel == 16)) {
-	if(!xf86HandleColormaps(pScreen, 256, pScrn->rgbBits, chipsLoadPalette,
-		NULL, CMAP_RELOAD_ON_MODE_SWITCH))
-	    return FALSE;
-    } else {
-	if(!xf86HandleColormaps(pScreen, 256, pScrn->rgbBits,
+    if(!xf86HandleColormaps(pScreen, 256, pScrn->rgbBits,
 		(pScrn->depth == 16 ? chipsLoadPalette16 : chipsLoadPalette),
 		NULL, CMAP_RELOAD_ON_MODE_SWITCH | CMAP_PALETTED_TRUECOLOR))
-	    return FALSE;
-    }
+	return FALSE;
     
 #ifndef XSERVER_LIBPCIACCESS
     racflag = RAC_COLORMAP;
@@ -4448,8 +4345,7 @@ CHIPSScreenInit(int scrnIndex, ScreenPtr pScreen, int argc, char **argv)
 	xf86SetSilkenMouse(pScreen);
 #endif
 
-	if ((!(cPtr->Flags & ChipsOverlay8plus16)) 
-	    && (cPtr->Flags & ChipsVideoSupport)
+	if ((cPtr->Flags & ChipsVideoSupport)
 	    && (cPtr->Flags & ChipsLinearSupport)) {
 	    CHIPSInitVideo(pScreen);
     }
@@ -4522,10 +4418,7 @@ CHIPSAdjustFrame(int scrnIndex, int x, int y, int flags)
 	Base >>= 3;
 	break;
     case 16:
-	if (!(cPtr->Flags & ChipsOverlay8plus16))
-	   Base >>= 1;
-	else
-	   Base >>= 2;
+	Base >>= 1;
 	break;
     case 24:
 	if (!IS_HiQV(cPtr))
@@ -4581,14 +4474,6 @@ CHIPSAdjustFrame(int scrnIndex, int x, int y, int flags)
 	cPtr->writeMSS(cPtr, hwp, MSS);
     }
 
-    if (cPtr->Flags & ChipsOverlay8plus16) {
-	Base = (Base << 3) & ~(unsigned long)0xF;
-
-	cPtr->writeMR(cPtr, 0x22, (cPtr->FbOffset16 + Base) & 0xF8);
-	cPtr->writeMR(cPtr, 0x23, ((cPtr->FbOffset16 + Base) >> 8) & 0xFF);
-	cPtr->writeMR(cPtr, 0x24, ((cPtr->FbOffset16 + Base) >> 16) & 0xFF);
-    }
-
 }
 
 /* Mandatory */
@@ -4652,13 +4537,6 @@ CHIPSValidMode(int scrnIndex, DisplayModePtr mode, Bool verbose, int flags)
     ScrnInfoPtr pScrn = xf86Screens[scrnIndex];
     CHIPSPtr cPtr = CHIPSPTR(pScrn);
 
-    if (flags & MODECHECK_FINAL) {
-    /* Don't subtract FrambufferSize here as it should be subtracted already */
-    if ((cPtr->Flags & ChipsOverlay8plus16) 
-      && ((pScrn->videoRam<<10) - pScrn->displayWidth * 3 * pScrn->virtualY 
-	  < 0))
-	return MODE_MEM;
-    }
     /* The tests here need to be expanded */
     if ((mode->Flags & V_INTERLACE) && (cPtr->PanelType & ChipsLCD))
 	return MODE_NO_INTERLACE;
@@ -5544,12 +5422,7 @@ chipsModeInitHiQV(ScrnInfoPtr pScrn, DisplayModePtr mode)
     } else {
 	ChipsStd->Attribute[0x10] = 0x01;   /* mode */
     }
-    if ((pScrn->bitsPerPixel == 16) && (cPtr->Flags & ChipsOverlay8plus16)) {
-	/* Make sure that the overlay isn't visible in the overscan region */
-	if (ChipsStd->Attribute[0x11] == pScrn->colorKey)
-	    ChipsStd->Attribute[0x11] = pScrn->colorKey - 1;
-    } else
-	ChipsStd->Attribute[0x11] = 0x00;   /* overscan (border) color */
+    ChipsStd->Attribute[0x11] = 0x00;   /* overscan (border) color */
     ChipsStd->Attribute[0x12] = 0x0F;   /* enable all color planes */
     ChipsStd->Attribute[0x13] = 0x00;   /* horiz pixel panning 0 */
 
@@ -5558,8 +5431,7 @@ chipsModeInitHiQV(ScrnInfoPtr pScrn, DisplayModePtr mode)
     /* set virtual screen width */
     tmp = pScrn->displayWidth >> 3;
     if (pScrn->bitsPerPixel == 16) {
-	if (!(cPtr->Flags & ChipsOverlay8plus16))
-	    tmp <<= 1;		       /* double the width of the buffer */
+	tmp <<= 1;		       /* double the width of the buffer */
     } else if (pScrn->bitsPerPixel == 24) {
 	tmp += tmp << 1;
     } else if (pScrn->bitsPerPixel == 32) {
@@ -5688,8 +5560,7 @@ chipsModeInitHiQV(ScrnInfoPtr pScrn, DisplayModePtr mode)
 
     /* centering/stretching */
     if (!xf86ReturnOptValBool(cPtr->Options, OPTION_SUSPEND_HACK, FALSE)) {
-	if (!xf86ReturnOptValBool(cPtr->Options, OPTION_LCD_STRETCH, FALSE) ||
-	(cPtr->Flags & ChipsOverlay8plus16)) {
+	if (!xf86ReturnOptValBool(cPtr->Options, OPTION_LCD_STRETCH, FALSE)) {
 	    ChipsNew->FR[0x40] &= 0xDF;    /* Disable Horizontal stretching */
 	    ChipsNew->FR[0x48] &= 0xFB;    /* Disable vertical stretching */
 	    ChipsNew->XR[0xA0] = 0x10;     /* Disable cursor stretching */
@@ -5709,8 +5580,7 @@ chipsModeInitHiQV(ScrnInfoPtr pScrn, DisplayModePtr mode)
 	}
     }
 
-    if ((xf86ReturnOptValBool(cPtr->Options, OPTION_LCD_CENTER, TRUE))
-		|| (cPtr->Flags & ChipsOverlay8plus16)) {
+    if (xf86ReturnOptValBool(cPtr->Options, OPTION_LCD_CENTER, TRUE)) {
 	ChipsNew->FR[0x40] |= 0x3;    /* Enable Horizontal centering */
 	ChipsNew->FR[0x48] |= 0x3;    /* Enable Vertical centering */
     } else {
@@ -5723,8 +5593,7 @@ chipsModeInitHiQV(ScrnInfoPtr pScrn, DisplayModePtr mode)
 	ChipsNew->XR[0x82] |=0x02;
 
     /* software mode flag */
-    ChipsNew->XR[0xE2] = chipsVideoMode(((cPtr->Flags & ChipsOverlay8plus16) ?
-	8 : pScrn->depth), (cPtr->PanelType & ChipsLCD) ?
+    ChipsNew->XR[0xE2] = chipsVideoMode((pScrn->depth), (cPtr->PanelType & ChipsLCD) ?
 	min(mode->CrtcHDisplay, cPtr->PanelSize.HDisplay) :
 	mode->CrtcHDisplay, mode->CrtcVDisplay);
 #ifdef DEBUG
@@ -5762,7 +5631,7 @@ chipsModeInitHiQV(ScrnInfoPtr pScrn, DisplayModePtr mode)
     	}
     }	    
     /* bpp depend */
-    if ((pScrn->bitsPerPixel == 16) && (!(cPtr->Flags & ChipsOverlay8plus16))) {
+    if (pScrn->bitsPerPixel == 16) {
 	ChipsNew->XR[0x81] = (ChipsNew->XR[0x81] & 0xF0) | 0x4;
 	if (cPtr->Flags & ChipsGammaSupport)
 	    ChipsNew->XR[0x82] |= 0x0C;
@@ -5915,60 +5784,7 @@ chipsModeInitHiQV(ScrnInfoPtr pScrn, DisplayModePtr mode)
     /* Turn off multimedia by default as it degrades performance */
     ChipsNew->XR[0xD0] &= 0x0f;	 
     
-    /* Setup the video/overlay */
-    if (cPtr->Flags & ChipsOverlay8plus16) {
-	ChipsNew->XR[0xD0] |= 0x10;	/* Force the Multimedia engine on */
-#ifdef SAR04
-	ChipsNew->XR[0x4F] = 0x2A;	/* SAR04 >352 pixel overlay width */
-#endif
-	ChipsNew->MR[0x1E] &= 0xE0;	/* Set Zoom and Direction */
-	if ((!(cPtr->PanelType & ChipsLCD)) && (mode->Flags & V_INTERLACE))
-	    ChipsNew->MR[0x1E] |= 0x10;	/* Interlace */
-	ChipsNew->MR[0x1F] &= 0x14;	/* Mask reserved bits */
-	ChipsNew->MR[0x1F] |= 0x08;	/* RGB 16bpp */
-	if (pScrn->weight.green == 5)
-	    ChipsNew->MR[0x1F] |= 0x01;	/* RGB 15bpp */
-
-	ChipsNew->MR[0x20] &= 0x03;	/* Mask reserved bits */
-	ChipsNew->MR[0x20] |= 0x80;	/* Auto Centre, Use mem ptr1 */
-	ChipsNew->MR[0x22] = cPtr->FbOffset16 & 0xF8;	/* Setup Pointer 1 */
-	ChipsNew->MR[0x23] = (cPtr->FbOffset16 >> 8) & 0xFF;
-	ChipsNew->MR[0x24] = (cPtr->FbOffset16 >> 16) & 0xFF;
-	ChipsNew->MR[0x25] = cPtr->FbOffset16 & 0xF8;	/* Setup Pointer 2 */
-	ChipsNew->MR[0x26] = (cPtr->FbOffset16 >> 8) & 0xFF;
-	ChipsNew->MR[0x27] = (cPtr->FbOffset16 >> 16) & 0xFF;
-	ChipsNew->MR[0x28] = (pScrn->displayWidth >> 2) - 1; /* Width */ 
-	ChipsNew->MR[0x34] = (pScrn->displayWidth >> 2) - 1;
-
-	/* Left Edge of Overlay */
-	ChipsNew->MR[0x2A] = cPtr->OverlaySkewX;
-	ChipsNew->MR[0x2B] &= 0xF8;	/* Mask reserved bits */
-	ChipsNew->MR[0x2B] |= ((cPtr->OverlaySkewX >> 8) & 0x7);
-	/* Right Edge of Overlay */
-	ChipsNew->MR[0x2C] = (cPtr->OverlaySkewX + pScrn->displayWidth - 
-							1) & 0xFF;
-	ChipsNew->MR[0x2D] &= 0xF8;	/* Mask reserved bits */
-	ChipsNew->MR[0x2D] |= ((cPtr->OverlaySkewX + pScrn->displayWidth -
-							1) >> 8) & 0x07;
-	/* Top Edge of Overlay */
-	ChipsNew->MR[0x2E] = cPtr->OverlaySkewY;
-	ChipsNew->MR[0x2F] &= 0xF8;
-	ChipsNew->MR[0x2F] |= ((cPtr->OverlaySkewY >> 8) & 0x7);
-	/* Bottom Edge of Overlay*/
-	ChipsNew->MR[0x30] = (cPtr->OverlaySkewY + pScrn->virtualY - 1 )& 0xFF;
-	ChipsNew->MR[0x31] &= 0xF8;	/* Mask reserved bits */
-	ChipsNew->MR[0x31] |= ((cPtr->OverlaySkewY + pScrn->virtualY - 
-							1 ) >> 8) & 0x07;
-
-	ChipsNew->MR[0x3C] &= 0x18;	/* Mask reserved bits */
-	ChipsNew->MR[0x3C] |= 0x07;	/* Enable keyed overlay window */
-	ChipsNew->MR[0x3D] = 0x00;
-	ChipsNew->MR[0x3E] = 0x00;
-	ChipsNew->MR[0x3F] = pScrn->colorKey; /* 8bpp transparency key */
-	ChipsNew->MR[0x40] = 0xFF;
-	ChipsNew->MR[0x41] = 0xFF;
-	ChipsNew->MR[0x42] = 0x00;
-    } else if (cPtr->Flags & ChipsVideoSupport) {
+    if (cPtr->Flags & ChipsVideoSupport) {
 #if 0   /* if we do this even though video isn't playing we kill performance */
 	ChipsNew->XR[0xD0] |= 0x10;	/* Force the Multimedia engine on */
 #endif
@@ -6877,8 +6693,7 @@ chipsRestoreExtendedRegs(ScrnInfoPtr pScrn, CHIPSRegPtr Regs)
 	}
 
 	/* Set SAR04 multimedia register correctly */
-	if ((cPtr->Flags & ChipsOverlay8plus16)
-	    || (cPtr->Flags & ChipsVideoSupport)) {
+	if ((cPtr->Flags & ChipsVideoSupport)) {
 #ifdef SAR04
 	    cPtr->writeXR(cPtr, 0x4E, 0x04);
 	    if (cPtr->readXR(cPtr, 0x4F) != Regs->XR[0x4F])
diff --git a/src/ct_driver.h b/src/ct_driver.h
index d8ce228..9033867 100644
--- a/src/ct_driver.h
+++ b/src/ct_driver.h
@@ -114,7 +114,6 @@ typedef struct {
 /* Options flags for the C&T chipsets */
 #define ChipsHWCursor		0x00001000
 #define ChipsShadowFB		0x00002000
-#define ChipsOverlay8plus16	0x00004000
 #define ChipsUseNewFB		0x00008000
 
 /* Architecture type flags */
@@ -272,11 +271,13 @@ typedef struct {
 
 typedef struct _CHIPSRec {
     pciVideoPtr		PciInfo;
+#ifndef XSERVER_LIBPCIACCESS
     PCITAG		PciTag;
+#endif
     int			Chipset;
     EntityInfoPtr       pEnt;
-    IOADDRESS		PIOBase;
-    CARD32		IOAddress;
+    unsigned long	PIOBase;
+    unsigned long	IOAddress;
     unsigned long	FbAddress;
     unsigned int	IOBase;
     unsigned char *	FbBase;
diff --git a/src/ct_video.c b/src/ct_video.c
index a68acb9..c9e5bb4 100644
--- a/src/ct_video.c
+++ b/src/ct_video.c
@@ -56,8 +56,7 @@ CHIPSInitVideo(ScreenPtr pScreen)
     CHIPSPtr cPtr = CHIPSPTR(pScrn);
     int num_adaptors;
 	
-    if (!(cPtr->Flags & ChipsOverlay8plus16) &&
-       (cPtr->Flags & ChipsVideoSupport)) {
+    if ((cPtr->Flags & ChipsVideoSupport)) {
 	newAdaptor = CHIPSSetupImageVideo(pScreen);
 	CHIPSInitOffscreenImages(pScreen);
     }
diff --git a/util/dRegs.c b/util/dRegs.c
index b7edc8f..0d2f0cb 100644
--- a/util/dRegs.c
+++ b/util/dRegs.c
@@ -1,63 +1,8 @@
-
-
-
-
-
-
-#ifdef __NetBSD__
-#  include <sys/types.h>
-#  include <machine/pio.h>
-#  include <machine/sysarch.h>
-#else
-#  if defined(SVR4) && defined(i386)
-#    include <sys/types.h>
-#    ifdef NCR
-       /* broken NCR <sys/sysi86.h> */
-#      define __STDC
-#      include <sys/sysi86.h>
-#      undef __STDC
-#    else
-#      include <sys/sysi86.h>
-#    endif
-#    ifdef SVR4
-#      if !defined(sun)
-#        include <sys/seg.h>
-#      endif
-#    endif
-#    include <sys/v86.h>
-#    if defined(sun)
-#      include <sys/psw.h>
-#    endif
-#  endif
-#  include "AsmMacros.h"
-#endif /* NetBSD */
-
 #include <unistd.h>
 #include <stdio.h>
 #include <stdlib.h>
 
-#ifdef __NetBSD__
-#  define SET_IOPL() i386_iopl(3)
-#  define RESET_IOPL() i386_iopl(0)
-#else
-#  if defined(SVR4) && defined(i386)
-#    ifndef SI86IOPL
-#      define SET_IOPL() sysi86(SI86V86,V86SC_IOPL,PS_IOPL)
-#      define RESET_IOPL() sysi86(SI86V86,V86SC_IOPL,0)
-#    else
-#      define SET_IOPL() sysi86(SI86IOPL,3)
-#      define RESET_IOPL() sysi86(SI86IOPL,0)
-#    endif
-#  else
-#    ifdef linux
-#      define SET_IOPL() iopl(3)
-#      define RESET_IOPL() iopl(0)
-#    else
-#      define SET_IOPL() (void)0
-#      define RESET_IOPL() (void)0
-#    endif
-#  endif
-#endif
+#include "iopl.h"
 
 int main(void)
 {
diff --git a/util/iopl.h b/util/iopl.h
new file mode 100644
index 0000000..e08207c
--- /dev/null
+++ b/util/iopl.h
@@ -0,0 +1,60 @@
+#ifdef __NetBSD__
+#  include <sys/types.h>
+#  include <machine/pio.h>
+#  include <machine/sysarch.h>
+#else
+#  if defined(__linux__)
+/* Can't because <sys/iopl.h> provides conflicting inb, outb, etc
+ * #    include <sys/io.h>
+ */
+int iopl(int level);
+#  endif
+#  if defined(SVR4) && defined(i386)
+#    include <sys/types.h>
+#    ifdef NCR
+       /* broken NCR <sys/sysi86.h> */
+#      define __STDC
+#      include <sys/sysi86.h>
+#      undef __STDC
+#    else
+#      include <sys/sysi86.h>
+#    endif
+#    ifdef SVR4
+#      if !defined(sun)
+#        include <sys/seg.h>
+#      endif
+#    endif
+#    include <sys/v86.h>
+#    if defined(sun)
+#      include <sys/psw.h>
+#    endif
+#  endif
+#  include "AsmMacros.h"
+#endif /* NetBSD */
+
+#include <unistd.h>
+#include <stdio.h>
+#include <stdlib.h>
+
+#ifdef __NetBSD__
+#  define SET_IOPL() i386_iopl(3)
+#  define RESET_IOPL() i386_iopl(0)
+#else
+#  if defined(SVR4) && defined(i386)
+#    ifndef SI86IOPL
+#      define SET_IOPL() sysi86(SI86V86,V86SC_IOPL,PS_IOPL)
+#      define RESET_IOPL() sysi86(SI86V86,V86SC_IOPL,0)
+#    else
+#      define SET_IOPL() sysi86(SI86IOPL,3)
+#      define RESET_IOPL() sysi86(SI86IOPL,0)
+#    endif
+#  else
+#    ifdef linux
+#      define SET_IOPL() iopl(3)
+#      define RESET_IOPL() iopl(0)
+#    else
+#      define SET_IOPL() (void)0
+#      define RESET_IOPL() (void)0
+#    endif
+#  endif
+#endif
diff --git a/util/mRegs.c b/util/mRegs.c
index f359738..843d01d 100644
--- a/util/mRegs.c
+++ b/util/mRegs.c
@@ -1,63 +1,8 @@
-
-
-
-
-
-
-#ifdef __NetBSD__
-#  include <sys/types.h>
-#  include <machine/pio.h>
-#  include <machine/sysarch.h>
-#else
-#  if defined(SVR4) && defined(i386)
-#    include <sys/types.h>
-#    ifdef NCR
-       /* broken NCR <sys/sysi86.h> */
-#      define __STDC
-#      include <sys/sysi86.h>
-#      undef __STDC
-#    else
-#      include <sys/sysi86.h>
-#    endif
-#    ifdef SVR4
-#      if !defined(sun)
-#        include <sys/seg.h>
-#      endif
-#    endif
-#    include <sys/v86.h>
-#    if defined(sun)
-#      include <sys/psw.h>
-#    endif
-#  endif
-#  include "AsmMacros.h"
-#endif /* NetBSD */
-
 #include <unistd.h>
 #include <stdio.h>
 #include <stdlib.h>
 
-#ifdef __NetBSD__
-#  define SET_IOPL() i386_iopl(3)
-#  define RESET_IOPL() i386_iopl(0)
-#else
-#  if defined(SVR4) && defined(i386)
-#    ifndef SI86IOPL
-#      define SET_IOPL() sysi86(SI86V86,V86SC_IOPL,PS_IOPL)
-#      define RESET_IOPL() sysi86(SI86V86,V86SC_IOPL,0)
-#    else
-#      define SET_IOPL() sysi86(SI86IOPL,3)
-#      define RESET_IOPL() sysi86(SI86IOPL,0)
-#    endif
-#  else
-#    ifdef linux
-#      define SET_IOPL() iopl(3)
-#      define RESET_IOPL() iopl(0)
-#    else
-#      define SET_IOPL() (void)0
-#      define RESET_IOPL() (void)0
-#    endif
-#  endif
-#endif
+#include "iopl.h"
 
 int hex2int(char* str);
 
diff --git a/util/modClock.c b/util/modClock.c
index 89a291a..45af19b 100644
--- a/util/modClock.c
+++ b/util/modClock.c
@@ -1,61 +1,12 @@
-
-#ifdef __NetBSD__
-#  include <sys/types.h>
-#  include <machine/pio.h>
-#  include <machine/sysarch.h>
-#else
-#  if defined(SVR4) && defined(i386)
-#    include <sys/types.h>
-#    ifdef NCR
-       /* broken NCR <sys/sysi86.h> */
-#      define __STDC
-#      include <sys/sysi86.h>
-#      undef __STDC
-#    else
-#      include <sys/sysi86.h>
-#    endif
-#    ifdef SVR4
-#      if !defined(sun)
-#        include <sys/seg.h>
-#      endif
-#    endif
-#    include <sys/v86.h>
-#    if defined(sun)
-#      include <sys/psw.h>
-#    endif
-#  endif
-#  include "AsmMacros.h"
-#endif /* NetBSD */
-
 #include <unistd.h>
 #include <stdio.h>
 #include <stdlib.h>
+
 #ifndef Lynx
 #include <fnmatch.h>
 #endif
 
-#ifdef __NetBSD__
-#  define SET_IOPL() i386_iopl(3)
-#  define RESET_IOPL() i386_iopl(0)
-#else
-#  if defined(SVR4) && defined(i386)
-#    ifndef SI86IOPL
-#      define SET_IOPL() sysi86(SI86V86,V86SC_IOPL,PS_IOPL)
-#      define RESET_IOPL() sysi86(SI86V86,V86SC_IOPL,0)
-#    else
-#      define SET_IOPL() sysi86(SI86IOPL,3)
-#      define RESET_IOPL() sysi86(SI86IOPL,0)
-#    endif
-#  else
-#    ifdef linux
-#      define SET_IOPL() iopl(3)
-#      define RESET_IOPL() iopl(0)
-#    else
-#      define SET_IOPL() (void)0
-#      define RESET_IOPL() (void)0
-#    endif
-#  endif
-#endif
+#include "iopl.h"
 
 #define tolerance 0.01 /* +/- 1% */