aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/gpu/drm/i915/i915_drv.c
diff options
context:
space:
mode:
authorKristian Høgsberg <krh@bitplanet.net>2009-12-16 15:16:16 -0500
committerEric Anholt <eric@anholt.net>2009-12-16 16:52:53 -0500
commitcfdf1fa23f4074c9f8766dc67a928bbf680b1ac9 (patch)
tree447930bfa2f30e0e77e6ec24ed748f927e96f455 /drivers/gpu/drm/i915/i915_drv.c
parent49ae35f2dd1ff78ee88d5f8a38d0af63c3ad9f71 (diff)
drm/i915: Implement IS_* macros using static tables
Instead of using the IS_I9XX etc macros that expand to a ton of comparisons, use new struct intel_device_info to capture the capabilities of the different chipsets. The drm_i915_private struct will be initialized to point to the device info that correspond to the actual device and this way, testing for a specific capability is just a matter of checking a bit field. Signed-off-by: Kristian Høgsberg <krh@bitplanet.net> Signed-off-by: Eric Anholt <eric@anholt.net>
Diffstat (limited to 'drivers/gpu/drm/i915/i915_drv.c')
-rw-r--r--drivers/gpu/drm/i915/i915_drv.c144
1 files changed, 110 insertions, 34 deletions
diff --git a/drivers/gpu/drm/i915/i915_drv.c b/drivers/gpu/drm/i915/i915_drv.c
index b6ec949361e..1b256de2456 100644
--- a/drivers/gpu/drm/i915/i915_drv.c
+++ b/drivers/gpu/drm/i915/i915_drv.c
@@ -47,46 +47,122 @@ module_param_named(powersave, i915_powersave, int, 0400);
47 47
48static struct drm_driver driver; 48static struct drm_driver driver;
49 49
50#define INTEL_VGA_DEVICE(id) { \ 50#define INTEL_VGA_DEVICE(id, info) { \
51 .class = PCI_CLASS_DISPLAY_VGA << 8, \ 51 .class = PCI_CLASS_DISPLAY_VGA << 8, \
52 .class_mask = 0xffff00, \ 52 .class_mask = 0xffff00, \
53 .vendor = 0x8086, \ 53 .vendor = 0x8086, \
54 .device = id, \ 54 .device = id, \
55 .subvendor = PCI_ANY_ID, \ 55 .subvendor = PCI_ANY_ID, \
56 .subdevice = PCI_ANY_ID, \ 56 .subdevice = PCI_ANY_ID, \
57 .driver_data = 0 } 57 .driver_data = (unsigned long) info }
58 58
59static struct pci_device_id pciidlist[] = { 59const static struct intel_device_info intel_i830_info = {
60 INTEL_VGA_DEVICE(0x3577), 60 .is_i8xx = 1, .is_mobile = 1,
61 INTEL_VGA_DEVICE(0x2562), 61};
62 INTEL_VGA_DEVICE(0x3582), 62
63 INTEL_VGA_DEVICE(0x2572), 63const static struct intel_device_info intel_845g_info = {
64 INTEL_VGA_DEVICE(0x2582), 64 .is_i8xx = 1,
65 INTEL_VGA_DEVICE(0x258a), 65};
66 INTEL_VGA_DEVICE(0x2592), 66
67 INTEL_VGA_DEVICE(0x2772), 67const static struct intel_device_info intel_i85x_info = {
68 INTEL_VGA_DEVICE(0x27a2), 68 .is_i8xx = 1, .is_mobile = 1,
69 INTEL_VGA_DEVICE(0x27ae), 69};
70 INTEL_VGA_DEVICE(0x2972), 70
71 INTEL_VGA_DEVICE(0x2982), 71const static struct intel_device_info intel_i865g_info = {
72 INTEL_VGA_DEVICE(0x2992), 72 .is_i8xx = 1,
73 INTEL_VGA_DEVICE(0x29a2), 73};
74 INTEL_VGA_DEVICE(0x29b2), 74
75 INTEL_VGA_DEVICE(0x29c2), 75const static struct intel_device_info intel_i915g_info = {
76 INTEL_VGA_DEVICE(0x29d2), 76 .is_i915g = 1, .is_i9xx = 1,
77 INTEL_VGA_DEVICE(0x2a02), 77};
78 INTEL_VGA_DEVICE(0x2a12), 78const static struct intel_device_info intel_i915gm_info = {
79 INTEL_VGA_DEVICE(0x2a42), 79 .is_i9xx = 1, .is_mobile = 1, .has_fbc = 1,
80 INTEL_VGA_DEVICE(0x2e02), 80};
81 INTEL_VGA_DEVICE(0x2e12), 81const static struct intel_device_info intel_i945g_info = {
82 INTEL_VGA_DEVICE(0x2e22), 82 .is_i9xx = 1, .has_hotplug = 1,
83 INTEL_VGA_DEVICE(0x2e32), 83};
84 INTEL_VGA_DEVICE(0x2e42), 84const static struct intel_device_info intel_i945gm_info = {
85 INTEL_VGA_DEVICE(0xa001), 85 .is_i945gm = 1, .is_i9xx = 1, .is_mobile = 1, .has_fbc = 1,
86 INTEL_VGA_DEVICE(0xa011), 86 .has_hotplug = 1,
87 INTEL_VGA_DEVICE(0x35e8), 87};
88 INTEL_VGA_DEVICE(0x0042), 88
89 INTEL_VGA_DEVICE(0x0046), 89const static struct intel_device_info intel_i965g_info = {
90 .is_i965g = 1, .is_i9xx = 1, .has_hotplug = 1,
91};
92
93const static struct intel_device_info intel_i965gm_info = {
94 .is_i965g = 1, .is_mobile = 1, .is_i965gm = 1, .is_i9xx = 1,
95 .is_mobile = 1, .has_fbc = 1, .has_rc6 = 1,
96 .has_hotplug = 1,
97};
98
99const static struct intel_device_info intel_g33_info = {
100 .is_g33 = 1, .is_i9xx = 1, .need_gfx_hws = 1,
101 .has_hotplug = 1,
102};
103
104const static struct intel_device_info intel_g45_info = {
105 .is_i965g = 1, .is_g4x = 1, .is_i9xx = 1, .need_gfx_hws = 1,
106 .has_pipe_cxsr = 1,
107 .has_hotplug = 1,
108};
109
110const static struct intel_device_info intel_gm45_info = {
111 .is_i965g = 1, .is_mobile = 1, .is_g4x = 1, .is_i9xx = 1,
112 .is_mobile = 1, .need_gfx_hws = 1, .has_fbc = 1, .has_rc6 = 1,
113 .has_pipe_cxsr = 1,
114 .has_hotplug = 1,
115};
116
117const static struct intel_device_info intel_pineview_info = {
118 .is_g33 = 1, .is_pineview = 1, .is_mobile = 1, .is_i9xx = 1,
119 .has_pipe_cxsr = 1,
120 .has_hotplug = 1,
121};
122
123const static struct intel_device_info intel_ironlake_d_info = {
124 .is_ironlake = 1, .is_i965g = 1, .is_i9xx = 1, .need_gfx_hws = 1,
125 .has_pipe_cxsr = 1,
126 .has_hotplug = 1,
127};
128
129const static struct intel_device_info intel_ironlake_m_info = {
130 .is_ironlake = 1, .is_mobile = 1, .is_i965g = 1, .is_i9xx = 1,
131 .need_gfx_hws = 1, .has_rc6 = 1,
132 .has_hotplug = 1,
133};
134
135const static struct pci_device_id pciidlist[] = {
136 INTEL_VGA_DEVICE(0x3577, &intel_i830_info),
137 INTEL_VGA_DEVICE(0x2562, &intel_845g_info),
138 INTEL_VGA_DEVICE(0x3582, &intel_i85x_info),
139 INTEL_VGA_DEVICE(0x35e8, &intel_i85x_info),
140 INTEL_VGA_DEVICE(0x2572, &intel_i865g_info),
141 INTEL_VGA_DEVICE(0x2582, &intel_i915g_info),
142 INTEL_VGA_DEVICE(0x258a, &intel_i915g_info),
143 INTEL_VGA_DEVICE(0x2592, &intel_i915gm_info),
144 INTEL_VGA_DEVICE(0x2772, &intel_i945g_info),
145 INTEL_VGA_DEVICE(0x27a2, &intel_i945gm_info),
146 INTEL_VGA_DEVICE(0x27ae, &intel_i945gm_info),
147 INTEL_VGA_DEVICE(0x2972, &intel_i965g_info),
148 INTEL_VGA_DEVICE(0x2982, &intel_i965g_info),
149 INTEL_VGA_DEVICE(0x2992, &intel_i965g_info),
150 INTEL_VGA_DEVICE(0x29a2, &intel_i965g_info),
151 INTEL_VGA_DEVICE(0x29b2, &intel_g33_info),
152 INTEL_VGA_DEVICE(0x29c2, &intel_g33_info),
153 INTEL_VGA_DEVICE(0x29d2, &intel_g33_info),
154 INTEL_VGA_DEVICE(0x2a02, &intel_i965gm_info),
155 INTEL_VGA_DEVICE(0x2a12, &intel_i965gm_info),
156 INTEL_VGA_DEVICE(0x2a42, &intel_gm45_info),
157 INTEL_VGA_DEVICE(0x2e02, &intel_g45_info),
158 INTEL_VGA_DEVICE(0x2e12, &intel_g45_info),
159 INTEL_VGA_DEVICE(0x2e22, &intel_g45_info),
160 INTEL_VGA_DEVICE(0x2e32, &intel_g45_info),
161 INTEL_VGA_DEVICE(0x2e42, &intel_g45_info),
162 INTEL_VGA_DEVICE(0xa001, &intel_pineview_info),
163 INTEL_VGA_DEVICE(0xa011, &intel_pineview_info),
164 INTEL_VGA_DEVICE(0x0042, &intel_ironlake_d_info),
165 INTEL_VGA_DEVICE(0x0046, &intel_ironlake_m_info),
90 {0, 0, 0} 166 {0, 0, 0}
91}; 167};
92 168