Subversion Repositories Kolibri OS

Rev

Rev 3260 | Rev 3480 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed

<
Rev Author Line No. Line
2325 Serge 1
/* i915_drv.c -- i830,i845,i855,i865,i915 driver -*- linux-c -*-
2
 */
3
/*
4
 *
5
 * Copyright 2003 Tungsten Graphics, Inc., Cedar Park, Texas.
6
 * All Rights Reserved.
7
 *
8
 * Permission is hereby granted, free of charge, to any person obtaining a
9
 * copy of this software and associated documentation files (the
10
 * "Software"), to deal in the Software without restriction, including
11
 * without limitation the rights to use, copy, modify, merge, publish,
12
 * distribute, sub license, and/or sell copies of the Software, and to
13
 * permit persons to whom the Software is furnished to do so, subject to
14
 * the following conditions:
15
 *
16
 * The above copyright notice and this permission notice (including the
17
 * next paragraph) shall be included in all copies or substantial portions
18
 * of the Software.
19
 *
20
 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
21
 * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
22
 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
23
 * IN NO EVENT SHALL TUNGSTEN GRAPHICS AND/OR ITS SUPPLIERS BE LIABLE FOR
24
 * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
25
 * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
26
 * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
27
 *
28
 */
29
 
2330 Serge 30
//#include 
3031 serge 31
#include 
32
#include 
2330 Serge 33
#include "i915_drv.h"
34
#include "intel_drv.h"
2325 Serge 35
 
36
#include 
37
#include 
38
#include 
39
#include 
40
#include 
41
 
3031 serge 42
#include 
43
 
2325 Serge 44
#include 
45
 
2330 Serge 46
#define __read_mostly
2327 Serge 47
 
2338 Serge 48
int init_display_kms(struct drm_device *dev);
2330 Serge 49
 
2340 Serge 50
struct drm_device *main_device;
2338 Serge 51
 
3255 Serge 52
struct drm_file *drm_file_handlers[256];
53
 
3031 serge 54
static int i915_modeset __read_mostly = 1;
55
MODULE_PARM_DESC(modeset,
56
		"Use kernel modesetting [KMS] (0=DRM_I915_KMS from .config, "
57
		"1=on, -1=force vga console preference [default])");
58
 
59
 
2332 Serge 60
int i915_panel_ignore_lid __read_mostly         =  0;
3031 serge 61
MODULE_PARM_DESC(panel_ignore_lid,
62
		"Override lid status (0=autodetect [default], 1=lid open, "
63
		"-1=lid closed)");
2330 Serge 64
 
2332 Serge 65
unsigned int i915_powersave  __read_mostly      =  0;
3031 serge 66
MODULE_PARM_DESC(powersave,
67
		"Enable powersavings, fbc, downclocking, etc. (default: true)");
2330 Serge 68
 
3031 serge 69
int i915_semaphores __read_mostly = -1;
2330 Serge 70
 
3031 serge 71
MODULE_PARM_DESC(semaphores,
72
		"Use semaphores for inter-ring sync (default: -1 (use per-chip defaults))");
2330 Serge 73
 
3031 serge 74
int i915_enable_rc6 __read_mostly      = 0;
75
MODULE_PARM_DESC(i915_enable_rc6,
76
		"Enable power-saving render C-state 6. "
77
		"Different stages can be selected via bitmask values "
78
		"(0 = disable; 1 = enable rc6; 2 = enable deep rc6; 4 = enable deepest rc6). "
79
		"For example, 3 would enable rc6 and deep rc6, and 7 would enable everything. "
80
		"default: -1 (use per-chip default)");
81
 
82
int i915_enable_fbc __read_mostly      =  0;
83
MODULE_PARM_DESC(i915_enable_fbc,
84
		"Enable frame buffer compression for power savings "
85
		"(default: -1 (use per-chip default))");
86
 
2330 Serge 87
unsigned int i915_lvds_downclock  __read_mostly =  0;
3031 serge 88
MODULE_PARM_DESC(lvds_downclock,
89
		"Use panel (LVDS/eDP) downclocking for power savings "
90
		"(default: false)");
2330 Serge 91
 
3031 serge 92
int i915_lvds_channel_mode __read_mostly;
93
MODULE_PARM_DESC(lvds_channel_mode,
94
		 "Specify LVDS channel mode "
95
		 "(0=probe BIOS [default], 1=single-channel, 2=dual-channel)");
2330 Serge 96
 
3031 serge 97
int i915_panel_use_ssc __read_mostly = -1;
98
MODULE_PARM_DESC(lvds_use_ssc,
99
		"Use Spread Spectrum Clock with panels [LVDS/eDP] "
100
		"(default: auto from VBT)");
101
 
2332 Serge 102
int i915_vbt_sdvo_panel_type __read_mostly      = -1;
3031 serge 103
MODULE_PARM_DESC(vbt_sdvo_panel_type,
104
		"Override/Ignore selection of SDVO panel mode in the VBT "
105
		"(-2=ignore, -1=auto [default], index in VBT BIOS table)");
2330 Serge 106
 
3031 serge 107
static bool i915_try_reset __read_mostly = true;
108
MODULE_PARM_DESC(reset, "Attempt GPU resets (default: true)");
109
 
110
bool i915_enable_hangcheck __read_mostly = false;
111
MODULE_PARM_DESC(enable_hangcheck,
112
		"Periodically check GPU activity for detecting hangs. "
113
		"WARNING: Disabling this can cause system wide hangs. "
114
		"(default: true)");
115
 
116
int i915_enable_ppgtt __read_mostly = false;
117
MODULE_PARM_DESC(i915_enable_ppgtt,
118
		"Enable PPGTT (default: true)");
119
 
120
unsigned int i915_preliminary_hw_support __read_mostly = true;
121
MODULE_PARM_DESC(preliminary_hw_support,
122
		"Enable preliminary hardware support. "
123
		"Enable Haswell and ValleyView Support. "
124
		"(default: false)");
125
 
126
 
2326 Serge 127
#define PCI_VENDOR_ID_INTEL        0x8086
128
 
2325 Serge 129
#define INTEL_VGA_DEVICE(id, info) {        \
2342 Serge 130
	.class = PCI_BASE_CLASS_DISPLAY << 16,	\
2325 Serge 131
    .class_mask = 0xff0000,                 \
132
    .vendor = 0x8086,                       \
133
    .device = id,                           \
134
    .subvendor = PCI_ANY_ID,                \
135
    .subdevice = PCI_ANY_ID,                \
136
    .driver_data = (unsigned long) info }
137
 
2339 Serge 138
 
139
static const struct intel_device_info intel_i915g_info = {
140
	.gen = 3, .is_i915g = 1, .cursor_needs_physical = 1,
141
	.has_overlay = 1, .overlay_needs_physical = 1,
142
};
143
static const struct intel_device_info intel_i915gm_info = {
144
	.gen = 3, .is_mobile = 1,
145
	.cursor_needs_physical = 1,
146
	.has_overlay = 1, .overlay_needs_physical = 1,
147
	.supports_tv = 1,
148
};
149
static const struct intel_device_info intel_i945g_info = {
150
	.gen = 3, .has_hotplug = 1, .cursor_needs_physical = 1,
151
	.has_overlay = 1, .overlay_needs_physical = 1,
152
};
153
static const struct intel_device_info intel_i945gm_info = {
154
	.gen = 3, .is_i945gm = 1, .is_mobile = 1,
155
	.has_hotplug = 1, .cursor_needs_physical = 1,
156
	.has_overlay = 1, .overlay_needs_physical = 1,
157
	.supports_tv = 1,
158
};
159
 
160
static const struct intel_device_info intel_i965g_info = {
161
	.gen = 4, .is_broadwater = 1,
162
	.has_hotplug = 1,
163
	.has_overlay = 1,
164
};
165
 
166
static const struct intel_device_info intel_i965gm_info = {
167
	.gen = 4, .is_crestline = 1,
168
	.is_mobile = 1, .has_fbc = 1, .has_hotplug = 1,
169
	.has_overlay = 1,
170
	.supports_tv = 1,
171
};
172
 
173
static const struct intel_device_info intel_g33_info = {
174
	.gen = 3, .is_g33 = 1,
175
	.need_gfx_hws = 1, .has_hotplug = 1,
176
	.has_overlay = 1,
177
};
178
 
179
static const struct intel_device_info intel_g45_info = {
180
	.gen = 4, .is_g4x = 1, .need_gfx_hws = 1,
181
	.has_pipe_cxsr = 1, .has_hotplug = 1,
182
	.has_bsd_ring = 1,
183
};
184
 
185
static const struct intel_device_info intel_gm45_info = {
186
	.gen = 4, .is_g4x = 1,
187
	.is_mobile = 1, .need_gfx_hws = 1, .has_fbc = 1,
188
	.has_pipe_cxsr = 1, .has_hotplug = 1,
189
	.supports_tv = 1,
190
	.has_bsd_ring = 1,
191
};
192
 
193
static const struct intel_device_info intel_pineview_info = {
194
	.gen = 3, .is_g33 = 1, .is_pineview = 1, .is_mobile = 1,
195
	.need_gfx_hws = 1, .has_hotplug = 1,
196
	.has_overlay = 1,
197
};
198
 
199
static const struct intel_device_info intel_ironlake_d_info = {
200
	.gen = 5,
3031 serge 201
	.need_gfx_hws = 1, .has_hotplug = 1,
2339 Serge 202
	.has_bsd_ring = 1,
203
};
204
 
205
static const struct intel_device_info intel_ironlake_m_info = {
206
	.gen = 5, .is_mobile = 1,
207
	.need_gfx_hws = 1, .has_hotplug = 1,
208
	.has_fbc = 1,
209
	.has_bsd_ring = 1,
210
};
211
 
2325 Serge 212
static const struct intel_device_info intel_sandybridge_d_info = {
213
    .gen = 6,
2330 Serge 214
	.need_gfx_hws = 1, .has_hotplug = 1,
2325 Serge 215
    .has_bsd_ring = 1,
216
    .has_blt_ring = 1,
3031 serge 217
	.has_llc = 1,
218
	.has_force_wake = 1,
2325 Serge 219
};
220
 
221
static const struct intel_device_info intel_sandybridge_m_info = {
2330 Serge 222
	.gen = 6, .is_mobile = 1,
223
	.need_gfx_hws = 1, .has_hotplug = 1,
2325 Serge 224
    .has_fbc      = 1,