summaryrefslogtreecommitdiffstats
path: root/abs/core/xf86-video-intel/git-fixes.patch
blob: 7ee0d50bbf7e3f4ab5fdb57657aeb0e1dffb70c9 (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
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
diff --git a/NEWS b/NEWS
index ea92bcf..61866b0 100644
--- a/NEWS
+++ b/NEWS
@@ -2,9 +2,9 @@ Release 2.15.0 (2011-04-14)
 ==============================
 We are pleased to announce this major release of the xf86-video-intel
 driver, roughly on schedule at 3 months since 2.14.0. With the many bug
-fixes in this release, we encourage everyone to upgrade to 2.14.
+fixes in this release, we encourage everyone to upgrade to 2.15.
 
-The priority for this quarter has been simply to unexciting and stabilise
+The priority for this quarter has been simply to be unexciting and stabilise
 the driver further, seeking to capitalise upon the improvements elsewhere
 in the stack.
 
diff --git a/configure.ac b/configure.ac
index fd5a3cf..9449e56 100644
--- a/configure.ac
+++ b/configure.ac
@@ -77,9 +77,7 @@ AC_ARG_WITH(xorg-module-dir,
             [moduledir="$libdir/xorg/modules"])
 
 AC_ARG_ENABLE(dri, AS_HELP_STRING([--disable-dri],
-                                  [Disable DRI support [[default=auto]]]),
-              [DRI="$enableval"],
-              [DRI=auto])
+                                  [Disable DRI support [[default=auto]]]))
 
 AC_ARG_ENABLE(xvmc, AS_HELP_STRING([--disable-xvmc],
                                   [Disable XvMC support [[default=yes]]]),
@@ -106,40 +104,48 @@ XORG_DRIVER_CHECK_EXT(DPMSExtension, xextproto)
 # Obtain compiler/linker options for the driver dependencies
 PKG_CHECK_MODULES(XORG, [xorg-server >= 1.6 xproto fontsproto $REQUIRED_MODULES])
 PKG_CHECK_MODULES(DRM, [libdrm >= 2.4.23])
+PKG_CHECK_MODULES(DRI, [xf86driproto], , DRI=no)
 PKG_CHECK_MODULES(PCIACCESS, [pciaccess >= 0.10])
 
 sdkdir=`$PKG_CONFIG --variable=sdkdir xorg-server`
 
-save_CFLAGS="$CFLAGS"
-CFLAGS="$XORG_CFLAGS $DRI_CFLAGS $DRM_CFLAGS"
-CPPFLAGS="$XORG_CFLAGS $DRI_CFLAGS $DRM_CFLAGS"
-AC_MSG_CHECKING([whether to include DRI support])
-if test x$DRI != xno; then
-        AC_CHECK_FILE([${sdkdir}/dri.h],
-                      [have_dri_h="yes"], [have_dri_h="no"])
-        AC_CHECK_FILE([${sdkdir}/sarea.h],
-                      [have_sarea_h="yes"], [have_sarea_h="no"])
-        AC_CHECK_FILE([${sdkdir}/dristruct.h],
-                      [have_dristruct_h="yes"], [have_dristruct_h="no"])
+if test "x$enable_dri" != "xno"; then
+        save_CFLAGS="$CFLAGS"
+        save_CPPFLAGS="$CPPFLAGS"
+        CFLAGS="$XORG_CFLAGS $DRI_CFLAGS $DRM_CFLAGS"
+        CPPFLAGS="$XORG_CFLAGS $DRI_CFLAGS $DRM_CFLAGS"
+        AC_CHECK_HEADERS([dri.h sarea.h dristruct.h],, [DRI=no],
+                [/* for dri.h */
+                 #include <xf86str.h>
+                 /* for dristruct.h */
+                 #include <xorg-server.h>
+                 #ifdef HAVE_DRI_H
+                 # include <dri.h>
+                 #endif
+                 #ifdef HAVE_SAREA_H
+                 # include <sarea.h>
+                 #endif
+                ])
+        CFLAGS="$save_CFLAGS $DEBUGFLAGS"
+        CPPFLAGS="$save_CPPFLAGS"
+else
+        DRI=no
 fi
+
 AC_MSG_CHECKING([whether to include DRI support])
-if test x$DRI = xauto; then
-        if test "$have_dri_h" = yes -a \
-                "$have_sarea_h" = yes -a \
-                "$have_dristruct_h" = yes; then
-                DRI="yes"
-        else
-                DRI="no"
-        fi
-fi
-AC_MSG_RESULT([$DRI])
-CFLAGS="$save_CFLAGS $DEBUGFLAGS"
+AC_MSG_RESULT([${DRI-yes}])
 
-AM_CONDITIONAL(DRI, test x$DRI = xyes)
-if test "$DRI" = yes; then
-        PKG_CHECK_MODULES(DRI, [xf86driproto])
+AM_CONDITIONAL(DRI, test x$DRI != xno)
+if test "x$DRI" != "xno"; then
         AC_DEFINE(XF86DRI,1,[Enable DRI driver support])
         AC_DEFINE(XF86DRI_DEVEL,1,[Enable developmental DRI driver support])
+else
+        DRI_CFLAGS=""
+        DRI_LIBS=""
+
+        if test "x$enable_dri" = "xyes"; then
+                AC_MSG_ERROR([DRI requested but prerequisites not found])
+        fi
 fi
 
 if test "$XVMC" = yes; then
diff --git a/src/i965_render.c b/src/i965_render.c
index bfcd3f2..b76107d 100644
--- a/src/i965_render.c
+++ b/src/i965_render.c
@@ -182,6 +182,10 @@ i965_check_composite(int op,
 		     int width, int height)
 {
 	ScrnInfoPtr scrn = xf86Screens[dest_picture->pDrawable->pScreen->myNum];
+	intel_screen_private *intel = intel_get_screen_private(scrn);
+
+	if (IS_GEN7(intel))
+		return FALSE;
 
 	/* Check for unsupported compositing operations. */
 	if (op >= sizeof(i965_blend_op) / sizeof(i965_blend_op[0])) {
diff --git a/src/i965_video.c b/src/i965_video.c
index c757681..53a9394 100644
--- a/src/i965_video.c
+++ b/src/i965_video.c
@@ -1210,7 +1210,7 @@ I965DisplayVideoTextured(ScrnInfoPtr scrn,
 			intel_batch_submit(scrn);
 		}
 
-		intel_batch_start_atomic(scrn, 100);
+		intel_batch_start_atomic(scrn, 150);
 
 		i965_emit_video_setup(scrn, surface_state_binding_table_bo, n_src_surf, pixmap);
 
diff --git a/src/intel_batchbuffer.c b/src/intel_batchbuffer.c
index 289ed2b..d0a41aa 100644
--- a/src/intel_batchbuffer.c
+++ b/src/intel_batchbuffer.c
@@ -175,13 +175,6 @@ void intel_batch_emit_flush(ScrnInfoPtr scrn)
 	intel_batch_do_flush(scrn);
 }
 
-static Bool intel_batch_needs_flush(intel_screen_private *intel)
-{
-	ScreenPtr screen = intel->scrn->pScreen;
-	PixmapPtr pixmap = screen->GetScreenPixmap(screen);
-	return intel_get_pixmap_private(pixmap)->batch_write;
-}
-
 void intel_batch_submit(ScrnInfoPtr scrn)
 {
 	intel_screen_private *intel = intel_get_screen_private(scrn);
@@ -218,7 +211,9 @@ void intel_batch_submit(ScrnInfoPtr scrn)
 		ret = drm_intel_bo_mrb_exec(intel->batch_bo,
 				intel->batch_used*4,
 				NULL, 0, 0xffffffff,
-				IS_GEN6(intel) ? intel->current_batch: I915_EXEC_DEFAULT);
+				(HAS_BLT(intel) ?
+				 intel->current_batch:
+				 I915_EXEC_DEFAULT));
 	}
 
 	if (ret != 0) {
@@ -241,8 +236,6 @@ void intel_batch_submit(ScrnInfoPtr scrn)
 		}
 	}
 
-	intel->needs_flush |= intel_batch_needs_flush(intel);
-
 	while (!list_is_empty(&intel->batch_pixmaps)) {
 		struct intel_pixmap *entry;
 
diff --git a/src/intel_batchbuffer.h b/src/intel_batchbuffer.h
index 605932a..f5f118e 100644
--- a/src/intel_batchbuffer.h
+++ b/src/intel_batchbuffer.h
@@ -50,14 +50,14 @@ static inline int intel_vertex_space(intel_screen_private *intel)
 }
 
 static inline void
-intel_batch_require_space(ScrnInfoPtr scrn, intel_screen_private *intel, unsigned int sz)
+intel_batch_require_space(ScrnInfoPtr scrn, intel_screen_private *intel, int sz)
 {
 	assert(sz < intel->batch_bo->size - 8);
 	if (intel_batch_space(intel) < sz)
 		intel_batch_submit(scrn);
 }
 
-static inline void intel_batch_start_atomic(ScrnInfoPtr scrn, unsigned int sz)
+static inline void intel_batch_start_atomic(ScrnInfoPtr scrn, int sz)
 {
 	intel_screen_private *intel = intel_get_screen_private(scrn);
 
@@ -137,6 +137,8 @@ intel_batch_mark_pixmap_domains(intel_screen_private *intel,
 
 	priv->batch_write |= write_domain != 0;
 	priv->busy = 1;
+
+	intel->needs_flush |= write_domain != 0;
 }
 
 static inline void
diff --git a/src/intel_display.c b/src/intel_display.c
index b6592c4..b55b110 100644
--- a/src/intel_display.c
+++ b/src/intel_display.c
@@ -1607,7 +1607,7 @@ Bool intel_mode_pre_init(ScrnInfoPtr scrn, int fd, int cpp)
 	gp.value = &has_flipping;
 	(void)drmCommandWriteRead(intel->drmSubFD, DRM_I915_GETPARAM, &gp,
 				  sizeof(gp));
-	if (has_flipping) {
+	if (has_flipping && intel->swapbuffers_wait) {
 		xf86DrvMsg(scrn->scrnIndex, X_INFO,
 			   "Kernel page flipping support detected, enabling\n");
 		intel->use_pageflipping = TRUE;
diff --git a/src/intel_dri.c b/src/intel_dri.c
index a39b512..48d0f56 100644
--- a/src/intel_dri.c
+++ b/src/intel_dri.c
@@ -182,6 +182,8 @@ static PixmapPtr fixup_shadow(DrawablePtr drawable, PixmapPtr pixmap)
 	/* And redirect the pixmap to the new bo (for 3D). */
 	intel_set_pixmap_private(old, priv);
 	old->refcnt++;
+
+	intel_get_screen_private(xf86Screens[screen->myNum])->needs_flush = TRUE;
 	return old;
 }
 
@@ -425,7 +427,7 @@ I830DRI2CopyRegion(DrawablePtr drawable, RegionPtr pRegion,
 
 	/* Wait for the scanline to be outside the region to be copied */
 	if (pixmap_is_scanout(get_drawable_pixmap(dst)) &&
-	    intel->swapbuffers_wait) {
+	    intel->swapbuffers_wait && INTEL_INFO(intel)->gen < 60) {
 		BoxPtr box;
 		BoxRec crtcbox;
 		int y1, y2;
diff --git a/src/intel_driver.c b/src/intel_driver.c
index e867351..8666421 100644
--- a/src/intel_driver.c
+++ b/src/intel_driver.c
@@ -84,7 +84,6 @@ USE OR OTHER DEALINGS IN THE SOFTWARE.
  */
 
 typedef enum {
-   OPTION_ACCELMETHOD,
    OPTION_DRI,
    OPTION_VIDEO_KEY,
    OPTION_COLOR_KEY,
@@ -105,7 +104,6 @@ typedef enum {
 } I830Opts;
 
 static OptionInfoRec I830Options[] = {
-   {OPTION_ACCELMETHOD,	"AccelMethod",	OPTV_ANYSTR,	{0},	FALSE},
    {OPTION_DRI,		"DRI",		OPTV_BOOLEAN,	{0},	TRUE},
    {OPTION_COLOR_KEY,	"ColorKey",	OPTV_INTEGER,	{0},	FALSE},
    {OPTION_VIDEO_KEY,	"VideoKey",	OPTV_INTEGER,	{0},	FALSE},
@@ -328,10 +326,10 @@ static void intel_check_dri_option(ScrnInfoPtr scrn)
 	if (!xf86ReturnOptValBool(intel->Options, OPTION_DRI, TRUE))
 		intel->directRenderingType = DRI_DISABLED;
 
-	if (scrn->depth != 16 && scrn->depth != 24) {
+	if (scrn->depth != 16 && scrn->depth != 24 && scrn->depth != 30) {
 		xf86DrvMsg(scrn->scrnIndex, X_CONFIG,
 			   "DRI is disabled because it "
-			   "runs only at depths 16 and 24.\n");
+			   "runs only at depths 16, 24, and 30.\n");
 		intel->directRenderingType = DRI_DISABLED;
 	}
 }
@@ -586,6 +584,7 @@ static Bool I830PreInit(ScrnInfoPtr scrn, int flags)
 	case 15:
 	case 16:
 	case 24:
+	case 30:
 		break;
 	default:
 		xf86DrvMsg(scrn->scrnIndex, X_ERROR,
@@ -658,8 +657,6 @@ static Bool I830PreInit(ScrnInfoPtr scrn, int flags)
 	intel->swapbuffers_wait = xf86ReturnOptValBool(intel->Options,
 						       OPTION_SWAPBUFFERS_WAIT,
 						       TRUE);
-	if (IS_GEN6(intel))
-		intel->swapbuffers_wait = FALSE;
 
 	xf86DrvMsg(scrn->scrnIndex, X_CONFIG, "Framebuffer %s\n",
 		   intel->tiling & INTEL_TILING_FB ? "tiled" : "linear");
diff --git a/src/intel_driver.h b/src/intel_driver.h
index 2e72177..4a584fe 100644
--- a/src/intel_driver.h
+++ b/src/intel_driver.h
@@ -184,6 +184,13 @@
 #define PCI_CHIP_SANDYBRIDGE_M_GT2_PLUS	0x0126
 #define PCI_CHIP_SANDYBRIDGE_BRIDGE_S	0x0108	/* Server */
 #define PCI_CHIP_SANDYBRIDGE_S_GT	0x010A
+
+#define PCI_CHIP_IVYBRIDGE_M_GT1	0x0156
+#define PCI_CHIP_IVYBRIDGE_M_GT2	0x0166
+#define PCI_CHIP_IVYBRIDGE_D_GT1	0x0152
+#define PCI_CHIP_IVYBRIDGE_D_GT2	0x0162
+#define PCI_CHIP_IVYBRIDGE_S_GT1	0x015a
+
 #endif
 
 #define I85X_CAPID			0x44
@@ -209,6 +216,7 @@
 #define IS_GEN4(intel) IS_GENx(intel, 4)
 #define IS_GEN5(intel) IS_GENx(intel, 5)
 #define IS_GEN6(intel) IS_GENx(intel, 6)
+#define IS_GEN7(intel) IS_GENx(intel, 7)
 
 /* Some chips have specific errata (or limits) that we need to workaround. */
 #define IS_I830(intel) (DEVICE_ID((intel)->PciInfo) == PCI_CHIP_I830_M)
@@ -222,6 +230,7 @@
 
 /* supports Y tiled surfaces (pre-965 Mesa isn't ready yet) */
 #define SUPPORTS_YTILING(pI810) (INTEL_INFO(intel)->gen >= 40)
+#define HAS_BLT(pI810) (INTEL_INFO(intel)->gen >= 60)
 
 extern SymTabRec *intel_chipsets;
 
diff --git a/src/intel_module.c b/src/intel_module.c
index 8416544..9468e72 100644
--- a/src/intel_module.c
+++ b/src/intel_module.c
@@ -39,6 +39,8 @@
 
 #include <xf86drmMode.h>
 
+static struct intel_device_info *chipset_info;
+
 static const struct intel_device_info intel_i81x_info = {
 	.gen = 10,
 };
@@ -71,329 +73,148 @@ static const struct intel_device_info intel_sandybridge_info = {
 	.gen = 60,
 };
 
+static const struct intel_device_info intel_ivybridge_info = {
+	.gen = 70,
+};
+
 static const SymTabRec _intel_chipsets[] = {
-    {PCI_CHIP_I810,		"i810"},
-    {PCI_CHIP_I810_DC100,	"i810-dc100"},
-    {PCI_CHIP_I810_E,		"i810e"},
-    {PCI_CHIP_I815,		"i815"},
-    {PCI_CHIP_I830_M,		"i830M"},
-    {PCI_CHIP_845_G,		"845G"},
-    {PCI_CHIP_I854,		"854"},
-    {PCI_CHIP_I855_GM,		"852GM/855GM"},
-    {PCI_CHIP_I865_G,		"865G"},
-    {PCI_CHIP_I915_G,		"915G"},
-    {PCI_CHIP_E7221_G,		"E7221 (i915)"},
-    {PCI_CHIP_I915_GM,		"915GM"},
-    {PCI_CHIP_I945_G,		"945G"},
-    {PCI_CHIP_I945_GM,		"945GM"},
-    {PCI_CHIP_I945_GME,		"945GME"},
-    {PCI_CHIP_PINEVIEW_M,	"Pineview GM"},
-    {PCI_CHIP_PINEVIEW_G,	"Pineview G"},
-    {PCI_CHIP_I965_G,		"965G"},
-    {PCI_CHIP_G35_G,		"G35"},
-    {PCI_CHIP_I965_Q,		"965Q"},
-    {PCI_CHIP_I946_GZ,		"946GZ"},
-    {PCI_CHIP_I965_GM,		"965GM"},
-    {PCI_CHIP_I965_GME,		"965GME/GLE"},
-    {PCI_CHIP_G33_G,		"G33"},
-    {PCI_CHIP_Q35_G,		"Q35"},
-    {PCI_CHIP_Q33_G,		"Q33"},
-    {PCI_CHIP_GM45_GM,		"GM45"},
-    {PCI_CHIP_G45_E_G,		"4 Series"},
-    {PCI_CHIP_G45_G,		"G45/G43"},
-    {PCI_CHIP_Q45_G,		"Q45/Q43"},
-    {PCI_CHIP_G41_G,		"G41"},
-    {PCI_CHIP_B43_G,		"B43"},
-    {PCI_CHIP_B43_G1,		"B43"},
-    {PCI_CHIP_IRONLAKE_D_G,		"Clarkdale"},
-    {PCI_CHIP_IRONLAKE_M_G,		"Arrandale"},
-    {PCI_CHIP_SANDYBRIDGE_GT1,	"Sandybridge" },
-    {PCI_CHIP_SANDYBRIDGE_GT2,	"Sandybridge" },
-    {PCI_CHIP_SANDYBRIDGE_GT2_PLUS,	"Sandybridge" },
-    {PCI_CHIP_SANDYBRIDGE_M_GT1,	"Sandybridge" },
-    {PCI_CHIP_SANDYBRIDGE_M_GT2,	"Sandybridge" },
-    {PCI_CHIP_SANDYBRIDGE_M_GT2_PLUS,	"Sandybridge" },
-    {PCI_CHIP_SANDYBRIDGE_S_GT,	"Sandybridge" },
-    {-1,				NULL}
+	{PCI_CHIP_I810,				"i810"},
+	{PCI_CHIP_I810_DC100,			"i810-dc100"},
+	{PCI_CHIP_I810_E,			"i810e"},
+	{PCI_CHIP_I815,				"i815"},
+	{PCI_CHIP_I830_M,			"i830M"},
+	{PCI_CHIP_845_G,			"845G"},
+	{PCI_CHIP_I854,				"854"},
+	{PCI_CHIP_I855_GM,			"852GM/855GM"},
+	{PCI_CHIP_I865_G,			"865G"},
+	{PCI_CHIP_I915_G,			"915G"},
+	{PCI_CHIP_E7221_G,			"E7221 (i915)"},
+	{PCI_CHIP_I915_GM,			"915GM"},
+	{PCI_CHIP_I945_G,			"945G"},
+	{PCI_CHIP_I945_GM,			"945GM"},
+	{PCI_CHIP_I945_GME,			"945GME"},
+	{PCI_CHIP_PINEVIEW_M,			"Pineview GM"},
+	{PCI_CHIP_PINEVIEW_G,			"Pineview G"},
+	{PCI_CHIP_I965_G,			"965G"},
+	{PCI_CHIP_G35_G,			"G35"},
+	{PCI_CHIP_I965_Q,			"965Q"},
+	{PCI_CHIP_I946_GZ,			"946GZ"},
+	{PCI_CHIP_I965_GM,			"965GM"},
+	{PCI_CHIP_I965_GME,			"965GME/GLE"},
+	{PCI_CHIP_G33_G,			"G33"},
+	{PCI_CHIP_Q35_G,			"Q35"},
+	{PCI_CHIP_Q33_G,			"Q33"},
+	{PCI_CHIP_GM45_GM,			"GM45"},
+	{PCI_CHIP_G45_E_G,			"4 Series"},
+	{PCI_CHIP_G45_G,			"G45/G43"},
+	{PCI_CHIP_Q45_G,			"Q45/Q43"},
+	{PCI_CHIP_G41_G,			"G41"},
+	{PCI_CHIP_B43_G,			"B43"},
+	{PCI_CHIP_B43_G1,			"B43"},
+	{PCI_CHIP_IRONLAKE_D_G,			"Clarkdale"},
+	{PCI_CHIP_IRONLAKE_M_G,			"Arrandale"},
+	{PCI_CHIP_SANDYBRIDGE_GT1,		"Sandybridge Desktop (GT1)" },
+	{PCI_CHIP_SANDYBRIDGE_GT2,		"Sandybridge Desktop (GT2)" },
+	{PCI_CHIP_SANDYBRIDGE_GT2_PLUS,		"Sandybridge Desktop (GT2+)" },
+	{PCI_CHIP_SANDYBRIDGE_M_GT1,		"Sandybridge Mobile (GT1)" },
+	{PCI_CHIP_SANDYBRIDGE_M_GT2,		"Sandybridge Mobile (GT2)" },
+	{PCI_CHIP_SANDYBRIDGE_M_GT2_PLUS,	"Sandybridge Mobile (GT2+)" },
+	{PCI_CHIP_SANDYBRIDGE_S_GT,		"Sandybridge Server" },
+	{PCI_CHIP_IVYBRIDGE_M_GT1,		"Ivybridge Mobile (GT1)" },
+	{PCI_CHIP_IVYBRIDGE_M_GT2,		"Ivybridge Mobile (GT2)" },
+	{PCI_CHIP_IVYBRIDGE_D_GT1,		"Ivybridge Desktop (GT1)" },
+	{PCI_CHIP_IVYBRIDGE_D_GT2,		"Ivybridge Desktop (GT2)" },
+	{PCI_CHIP_IVYBRIDGE_S_GT1,		"Ivybridge Server" },
+	{-1,					NULL}
 };
 SymTabRec *intel_chipsets = (SymTabRec *) _intel_chipsets;
 
 #define INTEL_DEVICE_MATCH(d,i) \
-{ 0x8086, (d), PCI_MATCH_ANY, PCI_MATCH_ANY, 0, 0, (i) }
+    { 0x8086, (d), PCI_MATCH_ANY, PCI_MATCH_ANY, 0, 0, (intptr_t)(i) }
 
 static const struct pci_id_match intel_device_match[] = {
-    INTEL_DEVICE_MATCH (PCI_CHIP_I810, 0 ),
-    INTEL_DEVICE_MATCH (PCI_CHIP_I810_DC100, 0 ),
-    INTEL_DEVICE_MATCH (PCI_CHIP_I810_E, 0 ),
-    INTEL_DEVICE_MATCH (PCI_CHIP_I815, 0 ),
-    INTEL_DEVICE_MATCH (PCI_CHIP_I830_M, 0 ),
-    INTEL_DEVICE_MATCH (PCI_CHIP_845_G, 0 ),
-    INTEL_DEVICE_MATCH (PCI_CHIP_I854, 0 ),
-    INTEL_DEVICE_MATCH (PCI_CHIP_I855_GM, 0 ),
-    INTEL_DEVICE_MATCH (PCI_CHIP_I865_G, 0 ),
-    INTEL_DEVICE_MATCH (PCI_CHIP_I915_G, 0 ),
-    INTEL_DEVICE_MATCH (PCI_CHIP_E7221_G, 0 ),
-    INTEL_DEVICE_MATCH (PCI_CHIP_I915_GM, 0 ),
-    INTEL_DEVICE_MATCH (PCI_CHIP_I945_G, 0 ),
-    INTEL_DEVICE_MATCH (PCI_CHIP_I945_GM, 0 ),
-    INTEL_DEVICE_MATCH (PCI_CHIP_I945_GME, 0 ),
-    INTEL_DEVICE_MATCH (PCI_CHIP_PINEVIEW_M, 0 ),
-    INTEL_DEVICE_MATCH (PCI_CHIP_PINEVIEW_G, 0 ),
-    INTEL_DEVICE_MATCH (PCI_CHIP_I965_G, 0 ),
-    INTEL_DEVICE_MATCH (PCI_CHIP_G35_G, 0 ),
-    INTEL_DEVICE_MATCH (PCI_CHIP_I965_Q, 0 ),
-    INTEL_DEVICE_MATCH (PCI_CHIP_I946_GZ, 0 ),
-    INTEL_DEVICE_MATCH (PCI_CHIP_I965_GM, 0 ),
-    INTEL_DEVICE_MATCH (PCI_CHIP_I965_GME, 0 ),
-    INTEL_DEVICE_MATCH (PCI_CHIP_G33_G, 0 ),
-    INTEL_DEVICE_MATCH (PCI_CHIP_Q35_G, 0 ),
-    INTEL_DEVICE_MATCH (PCI_CHIP_Q33_G, 0 ),
-    INTEL_DEVICE_MATCH (PCI_CHIP_GM45_GM, 0 ),
-    INTEL_DEVICE_MATCH (PCI_CHIP_G45_E_G, 0 ),
-    INTEL_DEVICE_MATCH (PCI_CHIP_G45_G, 0 ),
-    INTEL_DEVICE_MATCH (PCI_CHIP_Q45_G, 0 ),
-    INTEL_DEVICE_MATCH (PCI_CHIP_G41_G, 0 ),
-    INTEL_DEVICE_MATCH (PCI_CHIP_B43_G, 0 ),
-    INTEL_DEVICE_MATCH (PCI_CHIP_IRONLAKE_D_G, 0 ),
-    INTEL_DEVICE_MATCH (PCI_CHIP_IRONLAKE_M_G, 0 ),
-    INTEL_DEVICE_MATCH (PCI_CHIP_SANDYBRIDGE_GT1, 0 ),
-    INTEL_DEVICE_MATCH (PCI_CHIP_SANDYBRIDGE_GT2, 0 ),
-    INTEL_DEVICE_MATCH (PCI_CHIP_SANDYBRIDGE_GT2_PLUS, 0 ),
-    INTEL_DEVICE_MATCH (PCI_CHIP_SANDYBRIDGE_M_GT1, 0 ),
-    INTEL_DEVICE_MATCH (PCI_CHIP_SANDYBRIDGE_M_GT2, 0 ),
-    INTEL_DEVICE_MATCH (PCI_CHIP_SANDYBRIDGE_M_GT2_PLUS, 0 ),
-    INTEL_DEVICE_MATCH (PCI_CHIP_SANDYBRIDGE_S_GT, 0 ),
-    { 0, 0, 0 },
-};
-
-static PciChipsets intel_pci_chipsets[] = {
-    {PCI_CHIP_I810,		PCI_CHIP_I810,		NULL},
-    {PCI_CHIP_I810_DC100,	PCI_CHIP_I810_DC100,	NULL},
-    {PCI_CHIP_I810_E,		PCI_CHIP_I810_E,	NULL},
-    {PCI_CHIP_I815,		PCI_CHIP_I815,		NULL},
-    {PCI_CHIP_I830_M,		PCI_CHIP_I830_M,	NULL},
-    {PCI_CHIP_845_G,		PCI_CHIP_845_G,		NULL},
-    {PCI_CHIP_I854,		PCI_CHIP_I854,		NULL},
-    {PCI_CHIP_I855_GM,		PCI_CHIP_I855_GM,	NULL},
-    {PCI_CHIP_I865_G,		PCI_CHIP_I865_G,	NULL},
-    {PCI_CHIP_I915_G,		PCI_CHIP_I915_G,	NULL},
-    {PCI_CHIP_E7221_G,		PCI_CHIP_E7221_G,	NULL},
-    {PCI_CHIP_I915_GM,		PCI_CHIP_I915_GM,	NULL},
-    {PCI_CHIP_I945_G,		PCI_CHIP_I945_G,	NULL},
-    {PCI_CHIP_I945_GM,		PCI_CHIP_I945_GM,	NULL},
-    {PCI_CHIP_I945_GME,		PCI_CHIP_I945_GME,	NULL},
-    {PCI_CHIP_PINEVIEW_M,	PCI_CHIP_PINEVIEW_M,	NULL},
-    {PCI_CHIP_PINEVIEW_G,	PCI_CHIP_PINEVIEW_G,		NULL},
-    {PCI_CHIP_I965_G,		PCI_CHIP_I965_G,	NULL},
-    {PCI_CHIP_G35_G,		PCI_CHIP_G35_G,		NULL},
-    {PCI_CHIP_I965_Q,		PCI_CHIP_I965_Q,	NULL},
-    {PCI_CHIP_I946_GZ,		PCI_CHIP_I946_GZ,	NULL},
-    {PCI_CHIP_I965_GM,		PCI_CHIP_I965_GM,	NULL},
-    {PCI_CHIP_I965_GME,		PCI_CHIP_I965_GME,	NULL},
-    {PCI_CHIP_G33_G,		PCI_CHIP_G33_G,		NULL},
-    {PCI_CHIP_Q35_G,		PCI_CHIP_Q35_G,		NULL},
-    {PCI_CHIP_Q33_G,		PCI_CHIP_Q33_G,		NULL},
-    {PCI_CHIP_GM45_GM,		PCI_CHIP_GM45_GM,	NULL},
-    {PCI_CHIP_G45_E_G,		PCI_CHIP_G45_E_G,	NULL},
-    {PCI_CHIP_G45_G,		PCI_CHIP_G45_G,		NULL},
-    {PCI_CHIP_Q45_G,		PCI_CHIP_Q45_G,		NULL},
-    {PCI_CHIP_G41_G,		PCI_CHIP_G41_G,		NULL},
-    {PCI_CHIP_B43_G,		PCI_CHIP_B43_G,		NULL},
-    {PCI_CHIP_IRONLAKE_D_G,	PCI_CHIP_IRONLAKE_D_G,	NULL},
-    {PCI_CHIP_IRONLAKE_M_G,	PCI_CHIP_IRONLAKE_M_G,	NULL},
-    {PCI_CHIP_SANDYBRIDGE_GT1,	PCI_CHIP_SANDYBRIDGE_GT1,	NULL},
-    {PCI_CHIP_SANDYBRIDGE_GT2,	PCI_CHIP_SANDYBRIDGE_GT2,	NULL},
-    {PCI_CHIP_SANDYBRIDGE_GT2_PLUS,	PCI_CHIP_SANDYBRIDGE_GT2_PLUS,	NULL},
-    {PCI_CHIP_SANDYBRIDGE_M_GT1,	PCI_CHIP_SANDYBRIDGE_M_GT1,	NULL},
-    {PCI_CHIP_SANDYBRIDGE_M_GT2,	PCI_CHIP_SANDYBRIDGE_M_GT2,	NULL},
-    {PCI_CHIP_SANDYBRIDGE_M_GT2_PLUS,	PCI_CHIP_SANDYBRIDGE_M_GT2_PLUS, NULL},
-    {PCI_CHIP_SANDYBRIDGE_S_GT,		PCI_CHIP_SANDYBRIDGE_S_GT,	NULL},
-    {-1,				-1, NULL }
+	INTEL_DEVICE_MATCH (PCI_CHIP_I810, &intel_i81x_info ),
+	INTEL_DEVICE_MATCH (PCI_CHIP_I810_DC100, &intel_i81x_info ),
+	INTEL_DEVICE_MATCH (PCI_CHIP_I810_E, &intel_i81x_info ),
+	INTEL_DEVICE_MATCH (PCI_CHIP_I815, &intel_i81x_info ),
+
+	INTEL_DEVICE_MATCH (PCI_CHIP_I830_M, &intel_i8xx_info ),
+	INTEL_DEVICE_MATCH (PCI_CHIP_845_G, &intel_i8xx_info ),
+	INTEL_DEVICE_MATCH (PCI_CHIP_I854, &intel_i8xx_info ),
+	INTEL_DEVICE_MATCH (PCI_CHIP_I855_GM, &intel_i8xx_info ),
+	INTEL_DEVICE_MATCH (PCI_CHIP_I865_G, &intel_i8xx_info ),
+
+	INTEL_DEVICE_MATCH (PCI_CHIP_I915_G, &intel_i915_info ),
+	INTEL_DEVICE_MATCH (PCI_CHIP_E7221_G, &intel_i915_info ),
+	INTEL_DEVICE_MATCH (PCI_CHIP_I915_GM, &intel_i915_info ),
+	INTEL_DEVICE_MATCH (PCI_CHIP_I945_G, &intel_i915_info ),
+	INTEL_DEVICE_MATCH (PCI_CHIP_I945_GM, &intel_i915_info ),
+	INTEL_DEVICE_MATCH (PCI_CHIP_I945_GME, &intel_i915_info ),
+
+	INTEL_DEVICE_MATCH (PCI_CHIP_PINEVIEW_M, &intel_g33_info ),
+	INTEL_DEVICE_MATCH (PCI_CHIP_PINEVIEW_G, &intel_g33_info ),
+	INTEL_DEVICE_MATCH (PCI_CHIP_G33_G, &intel_g33_info ),
+	INTEL_DEVICE_MATCH (PCI_CHIP_Q33_G, &intel_g33_info ),
+	/* Another marketing win: Q35 is another g33 device not a gen4 part
+	 * like its G35 brethren.
+	 */
+	INTEL_DEVICE_MATCH (PCI_CHIP_Q35_G, &intel_g33_info ),
+
+	INTEL_DEVICE_MATCH (PCI_CHIP_I965_G, &intel_i965_info ),
+	INTEL_DEVICE_MATCH (PCI_CHIP_G35_G, &intel_i965_info ),
+	INTEL_DEVICE_MATCH (PCI_CHIP_I965_Q, &intel_i965_info ),
+	INTEL_DEVICE_MATCH (PCI_CHIP_I946_GZ, &intel_i965_info ),
+	INTEL_DEVICE_MATCH (PCI_CHIP_I965_GM, &intel_i965_info ),
+	INTEL_DEVICE_MATCH (PCI_CHIP_I965_GME, &intel_i965_info ),
+
+	INTEL_DEVICE_MATCH (PCI_CHIP_GM45_GM, &intel_g4x_info ),
+	INTEL_DEVICE_MATCH (PCI_CHIP_G45_E_G, &intel_g4x_info ),
+	INTEL_DEVICE_MATCH (PCI_CHIP_G45_G, &intel_g4x_info ),
+	INTEL_DEVICE_MATCH (PCI_CHIP_Q45_G, &intel_g4x_info ),
+	INTEL_DEVICE_MATCH (PCI_CHIP_G41_G, &intel_g4x_info ),
+	INTEL_DEVICE_MATCH (PCI_CHIP_B43_G, &intel_g4x_info ),
+	INTEL_DEVICE_MATCH (PCI_CHIP_B43_G1, &intel_g4x_info ),
+
+	INTEL_DEVICE_MATCH (PCI_CHIP_IRONLAKE_D_G, &intel_ironlake_info ),
+	INTEL_DEVICE_MATCH (PCI_CHIP_IRONLAKE_M_G, &intel_ironlake_info ),
+
+	INTEL_DEVICE_MATCH (PCI_CHIP_SANDYBRIDGE_GT1, &intel_sandybridge_info ),
+	INTEL_DEVICE_MATCH (PCI_CHIP_SANDYBRIDGE_GT2, &intel_sandybridge_info ),
+	INTEL_DEVICE_MATCH (PCI_CHIP_SANDYBRIDGE_GT2_PLUS, &intel_sandybridge_info ),
+	INTEL_DEVICE_MATCH (PCI_CHIP_SANDYBRIDGE_M_GT1, &intel_sandybridge_info ),
+	INTEL_DEVICE_MATCH (PCI_CHIP_SANDYBRIDGE_M_GT2, &intel_sandybridge_info ),
+	INTEL_DEVICE_MATCH (PCI_CHIP_SANDYBRIDGE_M_GT2_PLUS, &intel_sandybridge_info ),
+	INTEL_DEVICE_MATCH (PCI_CHIP_SANDYBRIDGE_S_GT, &intel_sandybridge_info ),
+
+	INTEL_DEVICE_MATCH (PCI_CHIP_IVYBRIDGE_M_GT1, &intel_ivybridge_info ),
+	INTEL_DEVICE_MATCH (PCI_CHIP_IVYBRIDGE_M_GT2, &intel_ivybridge_info ),
+	INTEL_DEVICE_MATCH (PCI_CHIP_IVYBRIDGE_D_GT1, &intel_ivybridge_info ),
+	INTEL_DEVICE_MATCH (PCI_CHIP_IVYBRIDGE_D_GT2, &intel_ivybridge_info ),
+	INTEL_DEVICE_MATCH (PCI_CHIP_IVYBRIDGE_S_GT1, &intel_ivybridge_info ),
+
+	{ 0, 0, 0 },
 };
 
 void intel_detect_chipset(ScrnInfoPtr scrn,
 			  struct pci_device *pci,
 			  struct intel_chipset *chipset)
 {
-    uint32_t capid;
-
-    switch (DEVICE_ID(pci)) {
-    case PCI_CHIP_I810:
-	chipset->name = "i810";
-	chipset->info = &intel_i81x_info;
-	break;
-    case PCI_CHIP_I810_DC100:
-	chipset->name = "i810-dc100";
-	chipset->info = &intel_i81x_info;
-	break;
-    case PCI_CHIP_I810_E:
-	chipset->name = "i810e";
-	chipset->info = &intel_i81x_info;
-	break;
-    case PCI_CHIP_I815:
-	chipset->name = "i815";
-	chipset->info = &intel_i81x_info;
-	break;
-    case PCI_CHIP_I830_M:
-	chipset->name = "830M";
-	chipset->info = &intel_i8xx_info;
-	break;
-    case PCI_CHIP_845_G:
-	chipset->name = "845G";
-	chipset->info = &intel_i8xx_info;
-	break;
-    case PCI_CHIP_I854:
-	chipset->name = "854";
-	chipset->info = &intel_i8xx_info;
-	break;
-    case PCI_CHIP_I855_GM:
-	/* Check capid register to find the chipset variant */
-	pci_device_cfg_read_u32(pci, &capid, I85X_CAPID);
-	chipset->variant =
-	    (capid >> I85X_VARIANT_SHIFT) & I85X_VARIANT_MASK;
-	switch (chipset->variant) {
-	case I855_GM:
-	    chipset->name = "855GM";
-	    break;
-	case I855_GME:
-	    chipset->name = "855GME";
-	    break;
-	case I852_GM:
-	    chipset->name = "852GM";
-	    break;
-	case I852_GME:
-	    chipset->name = "852GME";
-	    break;
-	default:
-	    xf86DrvMsg(scrn->scrnIndex, X_INFO,
-		       "Unknown 852GM/855GM variant: 0x%x)\n",
-		       chipset->variant);
-	    chipset->name = "852GM/855GM (unknown variant)";
-	    break;
+	int i;
+
+	chipset->info = chipset_info;
+
+	for (i = 0; intel_chipsets[i].name != NULL; i++) {
+		if (DEVICE_ID(pci) == intel_chipsets[i].token) {
+			chipset->name = intel_chipsets[i].name;
+			break;
+		}
+	}
+	if (intel_chipsets[i].name == NULL) {
+		chipset->name = "unknown chipset";
 	}
-	chipset->info = &intel_i8xx_info;
-	break;
-    case PCI_CHIP_I865_G:
-	chipset->name = "865G";
-	chipset->info = &intel_i8xx_info;
-	break;
-    case PCI_CHIP_I915_G:
-	chipset->name = "915G";
-	chipset->info = &intel_i915_info;
-	break;
-    case PCI_CHIP_E7221_G:
-	chipset->name = "E7221 (i915)";
-	chipset->info = &intel_i915_info;
-	break;
-    case PCI_CHIP_I915_GM:
-	chipset->name = "915GM";
-	chipset->info = &intel_i915_info;
-	break;
-    case PCI_CHIP_I945_G:
-	chipset->name = "945G";
-	chipset->info = &intel_i915_info;
-	break;
-    case PCI_CHIP_I945_GM:
-	chipset->name = "945GM";
-	chipset->info = &intel_i915_info;
-	break;
-    case PCI_CHIP_I945_GME:
-	chipset->name = "945GME";
-	chipset->info = &intel_i915_info;
-	break;
-    case PCI_CHIP_PINEVIEW_M:
-	chipset->name = "Pineview GM";
-	chipset->info = &intel_g33_info;
-	break;
-    case PCI_CHIP_PINEVIEW_G:
-	chipset->name = "Pineview G";
-	chipset->info = &intel_g33_info;
-	break;
-    case PCI_CHIP_I965_G:
-	chipset->name = "965G";
-	chipset->info = &intel_i965_info;
-	break;
-    case PCI_CHIP_G35_G:
-	chipset->name = "G35";
-	chipset->info = &intel_i965_info;
-	break;
-    case PCI_CHIP_I965_Q:
-	chipset->name = "965Q";
-	chipset->info = &intel_i965_info;
-	break;
-    case PCI_CHIP_I946_GZ:
-	chipset->name = "946GZ";
-	chipset->info = &intel_i965_info;
-	break;
-    case PCI_CHIP_I965_GM:
-	chipset->name = "965GM";
-	chipset->info = &intel_i965_info;
-	break;
-    case PCI_CHIP_I965_GME:
-	chipset->name = "965GME/GLE";
-	chipset->info = &intel_i965_info;
-	break;
-    case PCI_CHIP_G33_G:
-	chipset->name = "G33";
-	chipset->info = &intel_g33_info;
-	break;
-    case PCI_CHIP_Q35_G:
-	chipset->name = "Q35";
-	chipset->info = &intel_g33_info;
-	break;
-    case PCI_CHIP_Q33_G:
-	chipset->name = "Q33";
-	chipset->info = &intel_g33_info;
-	break;
-    case PCI_CHIP_GM45_GM:
-	chipset->name = "GM45";
-	chipset->info = &intel_g4x_info;
-	break;
-    case PCI_CHIP_G45_E_G:
-	chipset->name = "4 Series";
-	chipset->info = &intel_g4x_info;
-	break;
-    case PCI_CHIP_G45_G:
-	chipset->name = "G45/G43";
-	chipset->info = &intel_g4x_info;
-	break;
-    case PCI_CHIP_Q45_G:
-	chipset->name = "Q45/Q43";
-	chipset->info = &intel_g4x_info;
-	break;
-    case PCI_CHIP_G41_G:
-	chipset->name = "G41";
-	chipset->info = &intel_g4x_info;
-	break;
-    case PCI_CHIP_B43_G:
-	chipset->name = "B43";
-	chipset->info = &intel_g4x_info;
-	break;
-    case PCI_CHIP_IRONLAKE_D_G:
-	chipset->name = "Clarkdale";
-	chipset->info = &intel_ironlake_info;
-	break;
-    case PCI_CHIP_IRONLAKE_M_G:
-	chipset->name = "Arrandale";
-	chipset->info = &intel_ironlake_info;
-	break;
-    case PCI_CHIP_SANDYBRIDGE_GT1:
-    case PCI_CHIP_SANDYBRIDGE_GT2:
-    case PCI_CHIP_SANDYBRIDGE_GT2_PLUS:
-    case PCI_CHIP_SANDYBRIDGE_M_GT1:
-    case PCI_CHIP_SANDYBRIDGE_M_GT2:
-    case PCI_CHIP_SANDYBRIDGE_M_GT2_PLUS:
-    case PCI_CHIP_SANDYBRIDGE_S_GT:
-	chipset->name = "Sandybridge";
-	chipset->info = &intel_sandybridge_info;
-	break;
-    default:
-	chipset->name = "unknown chipset";
-	break;
-    }
-
-    xf86DrvMsg(scrn->scrnIndex, X_INFO,
-	       "Integrated Graphics Chipset: Intel(R) %s\n", chipset->name);
+
+	xf86DrvMsg(scrn->scrnIndex, X_INFO,
+		   "Integrated Graphics Chipset: Intel(R) %s\n", chipset->name);
 }
 
 /*
@@ -404,30 +225,30 @@ void intel_detect_chipset(ScrnInfoPtr scrn,
  */
 static void intel_identify(int flags)
 {
-    xf86PrintChipsets(INTEL_NAME,
-		      "Driver for Intel Integrated Graphics Chipsets",
-		      intel_chipsets);
+	xf86PrintChipsets(INTEL_NAME,
+			  "Driver for Intel Integrated Graphics Chipsets",
+			  intel_chipsets);
 }
 
 static Bool intel_driver_func(ScrnInfoPtr pScrn,
 			      xorgDriverFuncOp op,
 			      pointer ptr)
 {
-    xorgHWFlags *flag;
+	xorgHWFlags *flag;
 
-    switch (op) {
-    case GET_REQUIRED_HW_INTERFACES:
-	flag = (CARD32*)ptr;
+	switch (op) {
+	case GET_REQUIRED_HW_INTERFACES:
+		flag = (CARD32*)ptr;
 #ifdef KMS_ONLY
-	(*flag) = 0;
+		(*flag) = 0;
 #else
-	(*flag) = HW_IO | HW_MMIO;
+		(*flag) = HW_IO | HW_MMIO;
 #endif
-	return TRUE;
-    default:
-	/* Unknown or deprecated function */
-	return FALSE;
-    }
+		return TRUE;
+	default:
+		/* Unknown or deprecated function */
+		return FALSE;
+	}
 }
 
 static Bool has_kernel_mode_setting(struct pci_device *dev)
@@ -458,55 +279,65 @@ static Bool has_kernel_mode_setting(struct pci_device *dev)
  * Setup the dispatch table for the rest of the driver functions.
  *
  */
-static Bool intel_pci_probe (DriverPtr		driver,
-			     int		entity_num,
-			     struct pci_device	*device,
-			     intptr_t		match_data)
+static Bool intel_pci_probe(DriverPtr		driver,
+			    int			entity_num,
+			    struct pci_device	*device,
+			    intptr_t		match_data)
 {
-    ScrnInfoPtr scrn;
+	ScrnInfoPtr scrn;
+	PciChipsets intel_pci_chipsets[ARRAY_SIZE(intel_chipsets)];
+	int i;
+
+	chipset_info = (void *)match_data;
 
-    if (!has_kernel_mode_setting(device)) {
+	if (!has_kernel_mode_setting(device)) {
 #if KMS_ONLY
-	    return FALSE;
+		return FALSE;
 #else
-	    switch (DEVICE_ID(device)) {
-	    case PCI_CHIP_I810:
-	    case PCI_CHIP_I810_DC100:
-	    case PCI_CHIP_I810_E:
-	    case PCI_CHIP_I815:
-		    break;
-	    default:
-		    return FALSE;
-	    }
+		switch (DEVICE_ID(device)) {
+		case PCI_CHIP_I810:
+		case PCI_CHIP_I810_DC100:
+		case PCI_CHIP_I810_E:
+		case PCI_CHIP_I815:
+			break;
+		default:
+			return FALSE;
+		}
 #endif
-    }
+	}
 
-    scrn = xf86ConfigPciEntity(NULL, 0, entity_num, intel_pci_chipsets,
-			       NULL, NULL, NULL, NULL, NULL);
-    if (scrn != NULL) {
-	scrn->driverVersion = INTEL_VERSION;
-	scrn->driverName = INTEL_DRIVER_NAME;
-	scrn->name = INTEL_NAME;
-	scrn->Probe = NULL;
+	for (i = 0; i < ARRAY_SIZE(intel_chipsets); i++) {
+		intel_pci_chipsets[i].numChipset = intel_chipsets[i].token;
+		intel_pci_chipsets[i].PCIid = intel_chipsets[i].token;
+		intel_pci_chipsets[i].dummy = NULL;
+	}
+
+	scrn = xf86ConfigPciEntity(NULL, 0, entity_num, intel_pci_chipsets,
+				   NULL, NULL, NULL, NULL, NULL);
+	if (scrn != NULL) {
+		scrn->driverVersion = INTEL_VERSION;
+		scrn->driverName = INTEL_DRIVER_NAME;
+		scrn->name = INTEL_NAME;
+		scrn->Probe = NULL;
 
 #if KMS_ONLY
-	intel_init_scrn(scrn);
+		intel_init_scrn(scrn);
 #else
-	switch (DEVICE_ID(device)) {
-	case PCI_CHIP_I810:
-	case PCI_CHIP_I810_DC100:
-	case PCI_CHIP_I810_E:
-	case PCI_CHIP_I815:
-	    lg_i810_init(scrn);
-	    break;
-
-	default:
-	    intel_init_scrn(scrn);
-	    break;
-	}
+		switch (DEVICE_ID(device)) {
+		case PCI_CHIP_I810:
+		case PCI_CHIP_I810_DC100:
+		case PCI_CHIP_I810_E:
+		case PCI_CHIP_I815:
+			lg_i810_init(scrn);
+			break;
+
+		default:
+			intel_init_scrn(scrn);
+			break;
+		}
 #endif
-    }
-    return scrn != NULL;
+	}
+	return scrn != NULL;
 }
 
 #ifdef XFree86LOADER
@@ -514,16 +345,16 @@ static Bool intel_pci_probe (DriverPtr		driver,
 static MODULESETUPPROTO(intel_setup);
 
 static XF86ModuleVersionInfo intel_version = {
-    "intel",
-    MODULEVENDORSTRING,
-    MODINFOSTRING1,
-    MODINFOSTRING2,
-    XORG_VERSION_CURRENT,
-    INTEL_VERSION_MAJOR, INTEL_VERSION_MINOR, INTEL_VERSION_PATCH,
-    ABI_CLASS_VIDEODRV,
-    ABI_VIDEODRV_VERSION,
-    MOD_CLASS_VIDEODRV,
-    {0, 0, 0, 0}
+	"intel",
+	MODULEVENDORSTRING,
+	MODINFOSTRING1,
+	MODINFOSTRING2,
+	XORG_VERSION_CURRENT,
+	INTEL_VERSION_MAJOR, INTEL_VERSION_MINOR, INTEL_VERSION_PATCH,
+	ABI_CLASS_VIDEODRV,
+	ABI_VIDEODRV_VERSION,
+	MOD_CLASS_VIDEODRV,
+	{0, 0, 0, 0}
 };
 
 static const OptionInfoRec *
@@ -546,16 +377,16 @@ intel_available_options(int chipid, int busid)
 }
 
 static DriverRec intel = {
-    INTEL_VERSION,
-    INTEL_DRIVER_NAME,
-    intel_identify,
-    NULL,
-    intel_available_options,
-    NULL,
-    0,
-    intel_driver_func,
-    intel_device_match,
-    intel_pci_probe
+	INTEL_VERSION,
+	INTEL_DRIVER_NAME,
+	intel_identify,
+	NULL,
+	intel_available_options,
+	NULL,
+	0,
+	intel_driver_func,
+	intel_device_match,
+	intel_pci_probe
 };
 
 static pointer intel_setup(pointer module,
@@ -563,24 +394,24 @@ static pointer intel_setup(pointer module,
 			   int *errmaj,
 			   int *errmin)
 {
-    static Bool setupDone = 0;
-
-    /* This module should be loaded only once, but check to be sure.
-    */
-    if (!setupDone) {
-	setupDone = 1;
-	xf86AddDriver(&intel, module, HaveDriverFuncs);
-
-	/*
-	 * The return value must be non-NULL on success even though there
-	 * is no TearDownProc.
-	 */
-	return (pointer) 1;
-    } else {
-	if (errmaj)
-	    *errmaj = LDR_ONCEONLY;
-	return NULL;
-    }
+	static Bool setupDone = 0;
+
+	/* This module should be loaded only once, but check to be sure.
+	*/
+	if (!setupDone) {
+		setupDone = 1;
+		xf86AddDriver(&intel, module, HaveDriverFuncs);
+
+		/*
+		 * The return value must be non-NULL on success even though there
+		 * is no TearDownProc.
+		 */
+		return (pointer) 1;
+	} else {
+		if (errmaj)
+			*errmaj = LDR_ONCEONLY;
+		return NULL;
+	}
 }
 
 _X_EXPORT XF86ModuleData intelModuleData = { &intel_version, intel_setup, NULL };
diff --git a/src/intel_video.c b/src/intel_video.c
index 499614f..021ca5f 100644
--- a/src/intel_video.c
+++ b/src/intel_video.c
@@ -1599,6 +1599,7 @@ I830PutImageTextured(ScrnInfoPtr scrn,
 					 pixmap);
 	}
 
+	intel_get_screen_private(scrn)->needs_flush = TRUE;
 	DamageDamageRegion(drawable, clipBoxes);
 
 	return Success;