Subversion Repositories Kolibri OS

Rev

Rev 4398 | Rev 5060 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 4398 Rev 4560
Line 60... Line 60...
60
module_param_named(panel_ignore_lid, i915_panel_ignore_lid, int, 0600);
60
module_param_named(panel_ignore_lid, i915_panel_ignore_lid, int, 0600);
61
MODULE_PARM_DESC(panel_ignore_lid,
61
MODULE_PARM_DESC(panel_ignore_lid,
62
		"Override lid status (0=autodetect, 1=autodetect disabled [default], "
62
		"Override lid status (0=autodetect, 1=autodetect disabled [default], "
63
		"-1=force lid closed, -2=force lid open)");
63
		"-1=force lid closed, -2=force lid open)");
Line 64... Line 64...
64
 
64
 
65
unsigned int i915_powersave __read_mostly = 0;
65
unsigned int i915_powersave __read_mostly = 1;
66
module_param_named(powersave, i915_powersave, int, 0600);
66
module_param_named(powersave, i915_powersave, int, 0600);
67
MODULE_PARM_DESC(powersave,
67
MODULE_PARM_DESC(powersave,
Line 68... Line 68...
68
		"Enable powersavings, fbc, downclocking, etc. (default: true)");
68
		"Enable powersavings, fbc, downclocking, etc. (default: true)");
69
 
69
 
70
int i915_semaphores __read_mostly = -1;
70
int i915_semaphores __read_mostly = -1;
71
module_param_named(semaphores, i915_semaphores, int, 0600);
71
module_param_named(semaphores, i915_semaphores, int, 0400);
Line 72... Line 72...
72
MODULE_PARM_DESC(semaphores,
72
MODULE_PARM_DESC(semaphores,
73
		"Use semaphores for inter-ring sync (default: -1 (use per-chip defaults))");
73
		"Use semaphores for inter-ring sync (default: -1 (use per-chip defaults))");
74
 
74
 
75
int i915_enable_rc6 __read_mostly = 0;
75
int i915_enable_rc6 __read_mostly = -1;
76
module_param_named(i915_enable_rc6, i915_enable_rc6, int, 0400);
76
module_param_named(i915_enable_rc6, i915_enable_rc6, int, 0400);
77
MODULE_PARM_DESC(i915_enable_rc6,
77
MODULE_PARM_DESC(i915_enable_rc6,
78
		"Enable power-saving render C-state 6. "
78
		"Enable power-saving render C-state 6. "
79
		"Different stages can be selected via bitmask values "
79
		"Different stages can be selected via bitmask values "
Line 80... Line 80...
80
		"(0 = disable; 1 = enable rc6; 2 = enable deep rc6; 4 = enable deepest rc6). "
80
		"(0 = disable; 1 = enable rc6; 2 = enable deep rc6; 4 = enable deepest rc6). "
81
		"For example, 3 would enable rc6 and deep rc6, and 7 would enable everything. "
81
		"For example, 3 would enable rc6 and deep rc6, and 7 would enable everything. "
82
		"default: -1 (use per-chip default)");
82
		"default: -1 (use per-chip default)");
83
 
83
 
84
int i915_enable_fbc __read_mostly = 0;
84
int i915_enable_fbc __read_mostly = -1;
Line 120... Line 120...
120
MODULE_PARM_DESC(enable_hangcheck,
120
MODULE_PARM_DESC(enable_hangcheck,
121
		"Periodically check GPU activity for detecting hangs. "
121
		"Periodically check GPU activity for detecting hangs. "
122
		"WARNING: Disabling this can cause system wide hangs. "
122
		"WARNING: Disabling this can cause system wide hangs. "
123
		"(default: true)");
123
		"(default: true)");
Line 124... Line 124...
124
 
124
 
125
int i915_enable_ppgtt __read_mostly = 0;
125
int i915_enable_ppgtt __read_mostly = -1;
126
module_param_named(i915_enable_ppgtt, i915_enable_ppgtt, int, 0600);
126
module_param_named(i915_enable_ppgtt, i915_enable_ppgtt, int, 0400);
127
MODULE_PARM_DESC(i915_enable_ppgtt,
127
MODULE_PARM_DESC(i915_enable_ppgtt,
Line 128... Line 128...
128
		"Enable PPGTT (default: true)");
128
		"Enable PPGTT (default: true)");
129
 
129
 
Line 170... Line 170...
170
 
170
 
171
 
171
 
172
static const struct intel_device_info intel_i915g_info = {
172
static const struct intel_device_info intel_i915g_info = {
-
 
173
	.gen = 3, .is_i915g = 1, .cursor_needs_physical = 1, .num_pipes = 2,
173
	.gen = 3, .is_i915g = 1, .cursor_needs_physical = 1, .num_pipes = 2,
174
	.has_overlay = 1, .overlay_needs_physical = 1,
174
	.has_overlay = 1, .overlay_needs_physical = 1,
175
	.ring_mask = RENDER_RING,
175
};
176
};
176
static const struct intel_device_info intel_i915gm_info = {
177
static const struct intel_device_info intel_i915gm_info = {
177
	.gen = 3, .is_mobile = 1, .num_pipes = 2,
178
	.gen = 3, .is_mobile = 1, .num_pipes = 2,
178
	.cursor_needs_physical = 1,
179
	.cursor_needs_physical = 1,
-
 
180
	.has_overlay = 1, .overlay_needs_physical = 1,
-
 
181
	.supports_tv = 1,
179
	.has_overlay = 1, .overlay_needs_physical = 1,
182
	.has_fbc = 1,
180
	.supports_tv = 1,
183
	.ring_mask = RENDER_RING,
181
};
184
};
182
static const struct intel_device_info intel_i945g_info = {
185
static const struct intel_device_info intel_i945g_info = {
-
 
186
	.gen = 3, .has_hotplug = 1, .cursor_needs_physical = 1, .num_pipes = 2,
183
	.gen = 3, .has_hotplug = 1, .cursor_needs_physical = 1, .num_pipes = 2,
187
	.has_overlay = 1, .overlay_needs_physical = 1,
184
	.has_overlay = 1, .overlay_needs_physical = 1,
188
	.ring_mask = RENDER_RING,
185
};
189
};
186
static const struct intel_device_info intel_i945gm_info = {
190
static const struct intel_device_info intel_i945gm_info = {
187
	.gen = 3, .is_i945gm = 1, .is_mobile = 1, .num_pipes = 2,
191
	.gen = 3, .is_i945gm = 1, .is_mobile = 1, .num_pipes = 2,
188
	.has_hotplug = 1, .cursor_needs_physical = 1,
192
	.has_hotplug = 1, .cursor_needs_physical = 1,
-
 
193
	.has_overlay = 1, .overlay_needs_physical = 1,
-
 
194
	.supports_tv = 1,
189
	.has_overlay = 1, .overlay_needs_physical = 1,
195
	.has_fbc = 1,
Line 190... Line 196...
190
	.supports_tv = 1,
196
	.ring_mask = RENDER_RING,
191
};
197
};
192
 
198
 
193
static const struct intel_device_info intel_i965g_info = {
199
static const struct intel_device_info intel_i965g_info = {
-
 
200
	.gen = 4, .is_broadwater = 1, .num_pipes = 2,
194
	.gen = 4, .is_broadwater = 1, .num_pipes = 2,
201
	.has_hotplug = 1,
Line 195... Line 202...
195
	.has_hotplug = 1,
202
	.has_overlay = 1,
196
	.has_overlay = 1,
203
	.ring_mask = RENDER_RING,
197
};
204
};
198
 
205
 
199
static const struct intel_device_info intel_i965gm_info = {
206
static const struct intel_device_info intel_i965gm_info = {
-
 
207
	.gen = 4, .is_crestline = 1, .num_pipes = 2,
200
	.gen = 4, .is_crestline = 1, .num_pipes = 2,
208
	.is_mobile = 1, .has_fbc = 1, .has_hotplug = 1,
Line 201... Line 209...
201
	.is_mobile = 1, .has_fbc = 1, .has_hotplug = 1,
209
	.has_overlay = 1,
202
	.has_overlay = 1,
210
	.supports_tv = 1,
203
	.supports_tv = 1,
211
	.ring_mask = RENDER_RING,
204
};
212
};
-
 
213
 
205
 
214
static const struct intel_device_info intel_g33_info = {
Line 206... Line 215...
206
static const struct intel_device_info intel_g33_info = {
215
	.gen = 3, .is_g33 = 1, .num_pipes = 2,
207
	.gen = 3, .is_g33 = 1, .num_pipes = 2,
216
	.need_gfx_hws = 1, .has_hotplug = 1,
208
	.need_gfx_hws = 1, .has_hotplug = 1,
217
	.has_overlay = 1,
209
	.has_overlay = 1,
218
	.ring_mask = RENDER_RING,
210
};
219
};
Line 211... Line 220...
211
 
220
 
212
static const struct intel_device_info intel_g45_info = {
221
static const struct intel_device_info intel_g45_info = {
213
	.gen = 4, .is_g4x = 1, .need_gfx_hws = 1, .num_pipes = 2,
222
	.gen = 4, .is_g4x = 1, .need_gfx_hws = 1, .num_pipes = 2,
214
	.has_pipe_cxsr = 1, .has_hotplug = 1,
223
	.has_pipe_cxsr = 1, .has_hotplug = 1,
215
	.has_bsd_ring = 1,
224
	.ring_mask = RENDER_RING | BSD_RING,
216
};
225
};
217
 
226
 
Line 218... Line 227...
218
static const struct intel_device_info intel_gm45_info = {
227
static const struct intel_device_info intel_gm45_info = {
219
	.gen = 4, .is_g4x = 1, .num_pipes = 2,
228
	.gen = 4, .is_g4x = 1, .num_pipes = 2,
220
	.is_mobile = 1, .need_gfx_hws = 1, .has_fbc = 1,
229
	.is_mobile = 1, .need_gfx_hws = 1, .has_fbc = 1,
Line 230... Line 239...
230
};
239
};
Line 231... Line 240...
231
 
240
 
232
static const struct intel_device_info intel_ironlake_d_info = {
241
static const struct intel_device_info intel_ironlake_d_info = {
233
	.gen = 5, .num_pipes = 2,
242
	.gen = 5, .num_pipes = 2,
234
	.need_gfx_hws = 1, .has_hotplug = 1,
243
	.need_gfx_hws = 1, .has_hotplug = 1,
235
	.has_bsd_ring = 1,
244
	.ring_mask = RENDER_RING | BSD_RING,
Line 236... Line 245...
236
};
245
};
237
 
246
 
238
static const struct intel_device_info intel_ironlake_m_info = {
247
static const struct intel_device_info intel_ironlake_m_info = {
239
	.gen = 5, .is_mobile = 1, .num_pipes = 2,
248
	.gen = 5, .is_mobile = 1, .num_pipes = 2,
240
	.need_gfx_hws = 1, .has_hotplug = 1,
249
	.need_gfx_hws = 1, .has_hotplug = 1,
241
	.has_fbc = 1,
250
	.has_fbc = 1,
Line 242... Line 251...
242
	.has_bsd_ring = 1,
251
	.ring_mask = RENDER_RING | BSD_RING,
243
};
252
};
244
 
253
 
245
static const struct intel_device_info intel_sandybridge_d_info = {
254
static const struct intel_device_info intel_sandybridge_d_info = {
246
	.gen = 6, .num_pipes = 2,
255
	.gen = 6, .num_pipes = 2,
247
	.need_gfx_hws = 1, .has_hotplug = 1,
256
	.need_gfx_hws = 1, .has_hotplug = 1,
248
    .has_bsd_ring = 1,
-
 
249
    .has_blt_ring = 1,
257
	.has_fbc = 1,
Line 250... Line 258...
250
	.has_llc = 1,
258
	.ring_mask = RENDER_RING | BSD_RING | BLT_RING,
251
	.has_force_wake = 1,
259
	.has_llc = 1,
252
};
260
};
253
 
261
 
254
static const struct intel_device_info intel_sandybridge_m_info = {
-
 
255
	.gen = 6, .is_mobile = 1, .num_pipes = 2,
262
static const struct intel_device_info intel_sandybridge_m_info = {
256
	.need_gfx_hws = 1, .has_hotplug = 1,
263
	.gen = 6, .is_mobile = 1, .num_pipes = 2,
257
    .has_fbc      = 1,
-
 
258
    .has_bsd_ring = 1,
264
	.need_gfx_hws = 1, .has_hotplug = 1,
Line 259... Line 265...
259
    .has_blt_ring = 1,
265
    .has_fbc      = 1,
260
	.has_llc = 1,
266
	.ring_mask = RENDER_RING | BSD_RING | BLT_RING,
261
	.has_force_wake = 1,
267
	.has_llc = 1,
262
};
268
};
263
 
269
 
264
#define GEN7_FEATURES  \
270
#define GEN7_FEATURES  \
265
	.gen = 7, .num_pipes = 3, \
-
 
Line 266... Line 271...
266
	.need_gfx_hws = 1, .has_hotplug = 1, \
271
	.gen = 7, .num_pipes = 3, \
267
	.has_bsd_ring = 1, \
272
	.need_gfx_hws = 1, .has_hotplug = 1, \
268
	.has_blt_ring = 1, \
273
	.has_fbc = 1, \
269
	.has_llc = 1, \
274
	.ring_mask = RENDER_RING | BSD_RING | BLT_RING, \
Line 270... Line 275...
270
	.has_force_wake = 1
275
	.has_llc = 1
271
 
276
 
272
static const struct intel_device_info intel_ivybridge_d_info = {
277
static const struct intel_device_info intel_ivybridge_d_info = {
273
	GEN7_FEATURES,
278
	GEN7_FEATURES,
274
	.is_ivybridge = 1,
-
 
275
};
279
	.is_ivybridge = 1,
Line 276... Line 280...
276
 
280
};
277
static const struct intel_device_info intel_ivybridge_m_info = {
281
 
278
	GEN7_FEATURES,
282
static const struct intel_device_info intel_ivybridge_m_info = {
Line 291... Line 295...
291
	GEN7_FEATURES,
295
	GEN7_FEATURES,
292
	.is_mobile = 1,
296
	.is_mobile = 1,
293
	.num_pipes = 2,
297
	.num_pipes = 2,
294
	.is_valleyview = 1,
298
	.is_valleyview = 1,
295
	.display_mmio_offset = VLV_DISPLAY_BASE,
299
	.display_mmio_offset = VLV_DISPLAY_BASE,
-
 
300
	.has_fbc = 0, /* legal, last one wins */
296
	.has_llc = 0, /* legal, last one wins */
301
	.has_llc = 0, /* legal, last one wins */
297
};
302
};
Line 298... Line 303...
298
 
303
 
299
static const struct intel_device_info intel_valleyview_d_info = {
304
static const struct intel_device_info intel_valleyview_d_info = {
300
	GEN7_FEATURES,
305
	GEN7_FEATURES,
301
	.num_pipes = 2,
306
	.num_pipes = 2,
302
	.is_valleyview = 1,
307
	.is_valleyview = 1,
-
 
308
	.display_mmio_offset = VLV_DISPLAY_BASE,
303
	.display_mmio_offset = VLV_DISPLAY_BASE,
309
	.has_fbc = 0, /* legal, last one wins */
304
	.has_llc = 0, /* legal, last one wins */
310
	.has_llc = 0, /* legal, last one wins */
Line 305... Line 311...
305
};
311
};
306
 
312
 
307
static const struct intel_device_info intel_haswell_d_info = {
313
static const struct intel_device_info intel_haswell_d_info = {
308
	GEN7_FEATURES,
314
	GEN7_FEATURES,
309
	.is_haswell = 1,
315
	.is_haswell = 1,
310
	.has_ddi = 1,
316
	.has_ddi = 1,
311
	.has_fpga_dbg = 1,
317
	.has_fpga_dbg = 1,
Line 312... Line 318...
312
	.has_vebox_ring = 1,
318
	.ring_mask = RENDER_RING | BSD_RING | BLT_RING | VEBOX_RING,
313
};
319
};
314
 
320
 
315
static const struct intel_device_info intel_haswell_m_info = {
321
static const struct intel_device_info intel_haswell_m_info = {
316
	GEN7_FEATURES,
322
	GEN7_FEATURES,
317
	.is_haswell = 1,
323
	.is_haswell = 1,
-
 
324
	.is_mobile = 1,
-
 
325
	.has_ddi = 1,
-
 
326
	.has_fpga_dbg = 1,
-
 
327
	.ring_mask = RENDER_RING | BSD_RING | BLT_RING | VEBOX_RING,
-
 
328
};
-
 
329
 
-
 
330
static const struct intel_device_info intel_broadwell_d_info = {
318
	.is_mobile = 1,
331
	.gen = 8, .num_pipes = 3,
-
 
332
	.need_gfx_hws = 1, .has_hotplug = 1,
-
 
333
	.ring_mask = RENDER_RING | BSD_RING | BLT_RING | VEBOX_RING,
-
 
334
	.has_llc = 1,
-
 
335
	.has_ddi = 1,
-
 
336
};
-
 
337
 
-
 
338
static const struct intel_device_info intel_broadwell_m_info = {
-
 
339
	.gen = 8, .is_mobile = 1, .num_pipes = 3,
319
	.has_ddi = 1,
340
	.need_gfx_hws = 1, .has_hotplug = 1,
320
	.has_fpga_dbg = 1,
341
	.ring_mask = RENDER_RING | BSD_RING | BLT_RING | VEBOX_RING,
Line 321... Line 342...
321
	.has_fbc = 1,
342
	.has_llc = 1,
322
	.has_vebox_ring = 1,
343
	.has_ddi = 1,
323
};
344
};
Line 347... Line 368...
347
	INTEL_IVB_M_IDS(&intel_ivybridge_m_info),	\
368
	INTEL_IVB_M_IDS(&intel_ivybridge_m_info),	\
348
	INTEL_IVB_D_IDS(&intel_ivybridge_d_info),	\
369
	INTEL_IVB_D_IDS(&intel_ivybridge_d_info),	\
349
	INTEL_HSW_D_IDS(&intel_haswell_d_info), \
370
	INTEL_HSW_D_IDS(&intel_haswell_d_info), \
350
	INTEL_HSW_M_IDS(&intel_haswell_m_info), \
371
	INTEL_HSW_M_IDS(&intel_haswell_m_info), \
351
	INTEL_VLV_M_IDS(&intel_valleyview_m_info),	\
372
	INTEL_VLV_M_IDS(&intel_valleyview_m_info),	\
352
	INTEL_VLV_D_IDS(&intel_valleyview_d_info)
373
	INTEL_VLV_D_IDS(&intel_valleyview_d_info),	\
-
 
374
	INTEL_BDW_M_IDS(&intel_broadwell_m_info),	\
-
 
375
	INTEL_BDW_D_IDS(&intel_broadwell_d_info)
Line 353... Line 376...
353
 
376
 
354
static const struct pci_device_id pciidlist[] = {       /* aka */
377
static const struct pci_device_id pciidlist[] = {       /* aka */
355
	INTEL_PCI_IDS,
378
	INTEL_PCI_IDS,
356
    {0, 0, 0}
379
    {0, 0, 0}
Line 403... Line 426...
403
                DRM_DEBUG_KMS("Found CougarPoint PCH\n");
426
                DRM_DEBUG_KMS("Found CougarPoint PCH\n");
404
				WARN_ON(!(IS_GEN6(dev) || IS_IVYBRIDGE(dev)));
427
				WARN_ON(!(IS_GEN6(dev) || IS_IVYBRIDGE(dev)));
405
            } else if (id == INTEL_PCH_PPT_DEVICE_ID_TYPE) {
428
            } else if (id == INTEL_PCH_PPT_DEVICE_ID_TYPE) {
406
                /* PantherPoint is CPT compatible */
429
                /* PantherPoint is CPT compatible */
407
                dev_priv->pch_type = PCH_CPT;
430
                dev_priv->pch_type = PCH_CPT;
408
                DRM_DEBUG_KMS("Found PatherPoint PCH\n");
431
				DRM_DEBUG_KMS("Found PantherPoint PCH\n");
409
				WARN_ON(!(IS_GEN6(dev) || IS_IVYBRIDGE(dev)));
432
				WARN_ON(!(IS_GEN6(dev) || IS_IVYBRIDGE(dev)));
410
			} else if (id == INTEL_PCH_LPT_DEVICE_ID_TYPE) {
433
			} else if (id == INTEL_PCH_LPT_DEVICE_ID_TYPE) {
411
				dev_priv->pch_type = PCH_LPT;
434
				dev_priv->pch_type = PCH_LPT;
412
				DRM_DEBUG_KMS("Found LynxPoint PCH\n");
435
				DRM_DEBUG_KMS("Found LynxPoint PCH\n");
413
				WARN_ON(!IS_HASWELL(dev));
436
				WARN_ON(!IS_HASWELL(dev));
414
				WARN_ON(IS_ULT(dev));
437
				WARN_ON(IS_ULT(dev));
-
 
438
			} else if (IS_BROADWELL(dev)) {
-
 
439
				dev_priv->pch_type = PCH_LPT;
-
 
440
				dev_priv->pch_id =
-
 
441
					INTEL_PCH_LPT_LP_DEVICE_ID_TYPE;
-
 
442
				DRM_DEBUG_KMS("This is Broadwell, assuming "
-
 
443
					      "LynxPoint LP PCH\n");
415
			} else if (id == INTEL_PCH_LPT_LP_DEVICE_ID_TYPE) {
444
			} else if (id == INTEL_PCH_LPT_LP_DEVICE_ID_TYPE) {
416
				dev_priv->pch_type = PCH_LPT;
445
				dev_priv->pch_type = PCH_LPT;
417
				DRM_DEBUG_KMS("Found LynxPoint LP PCH\n");
446
				DRM_DEBUG_KMS("Found LynxPoint LP PCH\n");
418
				WARN_ON(!IS_HASWELL(dev));
447
				WARN_ON(!IS_HASWELL(dev));
419
				WARN_ON(!IS_ULT(dev));
448
				WARN_ON(!IS_ULT(dev));
Line 431... Line 460...
431
}
460
}
Line 432... Line 461...
432
 
461
 
433
bool i915_semaphore_is_enabled(struct drm_device *dev)
462
bool i915_semaphore_is_enabled(struct drm_device *dev)
434
{
463
{
435
	if (INTEL_INFO(dev)->gen < 6)
464
	if (INTEL_INFO(dev)->gen < 6)
-
 
465
		return false;
-
 
466
 
-
 
467
	/* Until we get further testing... */
-
 
468
	if (IS_GEN8(dev)) {
-
 
469
		WARN_ON(!i915_preliminary_hw_support);
-
 
470
		return false;
Line 436... Line 471...
436
		return 0;
471
	}
437
 
472
 
Line 438... Line 473...
438
	if (i915_semaphores >= 0)
473
	if (i915_semaphores >= 0)
439
		return i915_semaphores;
474
		return i915_semaphores;
440
 
475
 
441
#ifdef CONFIG_INTEL_IOMMU
476
#ifdef CONFIG_INTEL_IOMMU
442
	/* Enable semaphores on SNB when IO remapping is off */
477
	/* Enable semaphores on SNB when IO remapping is off */
Line 443... Line 478...
443
	if (INTEL_INFO(dev)->gen == 6 && intel_iommu_gfx_mapped)
478
	if (INTEL_INFO(dev)->gen == 6 && intel_iommu_gfx_mapped)
444
		return false;
479
		return false;
Line 445... Line 480...
445
#endif
480
#endif
446
 
481
 
447
	return 1;
482
	return true;
448
}
483
}
449
 
484
 
Line -... Line 485...
-
 
485
#if 0
-
 
486
static int i915_drm_freeze(struct drm_device *dev)
450
#if 0
487
{
451
static int i915_drm_freeze(struct drm_device *dev)
488
	struct drm_i915_private *dev_priv = dev->dev_private;
452
{
489
	struct drm_crtc *crtc;
453
	struct drm_i915_private *dev_priv = dev->dev_private;
490
 
Line 454... Line 491...
454
	struct drm_crtc *crtc;
491
	intel_runtime_pm_get(dev_priv);
455
 
492
 
456
	/* ignore lid events during suspend */
493
	/* ignore lid events during suspend */
457
	mutex_lock(&dev_priv->modeset_restore_lock);
494
	mutex_lock(&dev_priv->modeset_restore_lock);
Line 458... Line 495...
458
	dev_priv->modeset_restore = MODESET_SUSPENDED;
495
	dev_priv->modeset_restore = MODESET_SUSPENDED;
Line 459... Line 496...
459
	mutex_unlock(&dev_priv->modeset_restore_lock);
496
	mutex_unlock(&dev_priv->modeset_restore_lock);
Line 460... Line 497...
460
 
497
 
461
	/* We do a lot of poking in a lot of registers, make sure they work
498
	/* We do a lot of poking in a lot of registers, make sure they work
462
	 * properly. */
499
	 * properly. */
Line 463... Line -...
463
	hsw_disable_package_c8(dev_priv);
-
 
464
	intel_set_power_well(dev, true);
500
	hsw_disable_package_c8(dev_priv);
465
 
-
 
466
	drm_kms_helper_poll_disable(dev);
501
	intel_display_set_init_power(dev, true);
467
 
502
 
468
	pci_save_state(dev->pdev);
503
	drm_kms_helper_poll_disable(dev);
469
 
504
 
470
	/* If KMS is active, we do the leavevt stuff here */
505
	pci_save_state(dev->pdev);
Line 486... Line 521...
486
		dev_priv->enable_hotplug_processing = false;
521
		dev_priv->enable_hotplug_processing = false;
487
		/*
522
		/*
488
		 * Disable CRTCs directly since we want to preserve sw state
523
		 * Disable CRTCs directly since we want to preserve sw state
489
		 * for _thaw.
524
		 * for _thaw.
490
		 */
525
		 */
-
 
526
		mutex_lock(&dev->mode_config.mutex);
491
		list_for_each_entry(crtc, &dev->mode_config.crtc_list, head)
527
		list_for_each_entry(crtc, &dev->mode_config.crtc_list, head)
492
			dev_priv->display.crtc_disable(crtc);
528
			dev_priv->display.crtc_disable(crtc);
-
 
529
		mutex_unlock(&dev->mode_config.mutex);
Line 493... Line 530...
493
 
530
 
494
		intel_modeset_suspend_hw(dev);
531
		intel_modeset_suspend_hw(dev);
Line -... Line 532...
-
 
532
	}
-
 
533
 
495
	}
534
	i915_gem_suspend_gtt_mappings(dev);
Line 496... Line 535...
496
 
535
 
Line 497... Line 536...
497
	i915_save_state(dev);
536
	i915_save_state(dev);
Line 563... Line 602...
563
 
602
 
564
	/* Just fire off a uevent and let userspace tell us what to do */
603
	/* Just fire off a uevent and let userspace tell us what to do */
565
	drm_helper_hpd_irq_event(dev);
604
	drm_helper_hpd_irq_event(dev);
Line 566... Line 605...
566
}
605
}
567
 
606
 
568
static int __i915_drm_thaw(struct drm_device *dev)
607
static int __i915_drm_thaw(struct drm_device *dev, bool restore_gtt_mappings)
569
{
608
{
Line -... Line 609...
-
 
609
	struct drm_i915_private *dev_priv = dev->dev_private;
-
 
610
	int error = 0;
-
 
611
 
-
 
612
	intel_uncore_early_sanitize(dev);
-
 
613
 
-
 
614
	intel_uncore_sanitize(dev);
-
 
615
 
-
 
616
	if (drm_core_check_feature(dev, DRIVER_MODESET) &&
-
 
617
	    restore_gtt_mappings) {
-
 
618
		mutex_lock(&dev->struct_mutex);
-
 
619
		i915_gem_restore_gtt_mappings(dev);
-
 
620
		mutex_unlock(&dev->struct_mutex);
-
 
621
	}
570
	struct drm_i915_private *dev_priv = dev->dev_private;
622
 
571
	int error = 0;
623
	intel_power_domains_init_hw(dev);
Line 572... Line 624...
572
 
624
 
573
	i915_restore_state(dev);
625
	i915_restore_state(dev);
Line 586... Line 638...
586
		drm_irq_install(dev);
638
		drm_irq_install(dev);
Line 587... Line 639...
587
 
639
 
Line 588... Line 640...
588
		intel_modeset_init_hw(dev);
640
		intel_modeset_init_hw(dev);
-
 
641
 
589
 
642
		drm_modeset_lock_all(dev);
590
		drm_modeset_lock_all(dev);
643
		drm_mode_config_reset(dev);
Line 591... Line 644...
591
		intel_modeset_setup_hw_state(dev, true);
644
		intel_modeset_setup_hw_state(dev, true);
592
		drm_modeset_unlock_all(dev);
645
		drm_modeset_unlock_all(dev);
Line 622... Line 675...
622
	hsw_enable_package_c8(dev_priv);
675
	hsw_enable_package_c8(dev_priv);
Line 623... Line 676...
623
 
676
 
624
	mutex_lock(&dev_priv->modeset_restore_lock);
677
	mutex_lock(&dev_priv->modeset_restore_lock);
625
	dev_priv->modeset_restore = MODESET_DONE;
678
	dev_priv->modeset_restore = MODESET_DONE;
-
 
679
	mutex_unlock(&dev_priv->modeset_restore_lock);
-
 
680
 
626
	mutex_unlock(&dev_priv->modeset_restore_lock);
681
	intel_runtime_pm_put(dev_priv);
627
	return error;
682
	return error;
Line 628... Line 683...
628
}
683
}
629
 
684
 
630
static int i915_drm_thaw(struct drm_device *dev)
-
 
631
{
-
 
632
	int error = 0;
-
 
633
 
-
 
634
	intel_uncore_sanitize(dev);
685
static int i915_drm_thaw(struct drm_device *dev)
635
 
-
 
636
	if (drm_core_check_feature(dev, DRIVER_MODESET)) {
-
 
637
		mutex_lock(&dev->struct_mutex);
-
 
638
		i915_gem_restore_gtt_mappings(dev);
-
 
639
		mutex_unlock(&dev->struct_mutex);
686
{
Line 640... Line 687...
640
	} else if (drm_core_check_feature(dev, DRIVER_MODESET))
687
	if (drm_core_check_feature(dev, DRIVER_MODESET))
641
		i915_check_and_clear_faults(dev);
-
 
642
 
-
 
643
	__i915_drm_thaw(dev);
688
		i915_check_and_clear_faults(dev);
Line 644... Line 689...
644
 
689
 
645
	return error;
690
	return __i915_drm_thaw(dev, true);
646
}
691
}
Line 656... Line 701...
656
	if (pci_enable_device(dev->pdev))
701
	if (pci_enable_device(dev->pdev))
657
		return -EIO;
702
		return -EIO;
Line 658... Line 703...
658
 
703
 
Line 659... Line -...
659
	pci_set_master(dev->pdev);
-
 
660
 
-
 
661
	intel_uncore_sanitize(dev);
704
	pci_set_master(dev->pdev);
662
 
705
 
663
	/*
706
	/*
-
 
707
	 * Platforms with opregion should have sane BIOS, older ones (gen3 and
664
	 * Platforms with opregion should have sane BIOS, older ones (gen3 and
708
	 * earlier) need to restore the GTT mappings since the BIOS might clear
665
	 * earlier) need this since the BIOS might clear all our scratch PTEs.
-
 
666
	 */
709
	 * all our scratch PTEs.
667
	if (drm_core_check_feature(dev, DRIVER_MODESET) &&
-
 
668
	    !dev_priv->opregion.header) {
-
 
669
		mutex_lock(&dev->struct_mutex);
-
 
670
		i915_gem_restore_gtt_mappings(dev);
-
 
671
		mutex_unlock(&dev->struct_mutex);
-
 
672
	}
-
 
673
 
710
	 */
674
	ret = __i915_drm_thaw(dev);
711
	ret = __i915_drm_thaw(dev, !dev_priv->opregion.header);
Line 675... Line 712...
675
	if (ret)
712
	if (ret)
676
		return ret;
713
		return ret;
Line 707... Line 744...
707
 
744
 
Line 708... Line 745...
708
	i915_gem_reset(dev);
745
	i915_gem_reset(dev);
Line 709... Line -...
709
 
-
 
710
	simulated = dev_priv->gpu_error.stop_rings != 0;
-
 
711
 
-
 
712
	if (!simulated && get_seconds() - dev_priv->gpu_error.last_reset < 5) {
-
 
713
		DRM_ERROR("GPU hanging too fast, declaring wedged!\n");
746
 
Line 714... Line 747...
714
		ret = -ENODEV;
747
	simulated = dev_priv->gpu_error.stop_rings != 0;
715
	} else {
748
 
716
		ret = intel_gpu_reset(dev);
749
		ret = intel_gpu_reset(dev);
717
 
750
 
718
		/* Also reset the gpu hangman. */
751
		/* Also reset the gpu hangman. */
719
		if (simulated) {
752
		if (simulated) {
720
			DRM_INFO("Simulated gpu hang, resetting stop_rings\n");
753
			DRM_INFO("Simulated gpu hang, resetting stop_rings\n");
721
			dev_priv->gpu_error.stop_rings = 0;
754
			dev_priv->gpu_error.stop_rings = 0;
722
			if (ret == -ENODEV) {
755
			if (ret == -ENODEV) {
723
				DRM_ERROR("Reset not implemented, but ignoring "
-
 
724
					  "error for simulated gpu hangs\n");
-
 
725
				ret = 0;
756
			DRM_INFO("Reset not implemented, but ignoring "
-
 
757
					  "error for simulated gpu hangs\n");
726
			}
758
				ret = 0;
727
		} else
759
			}
728
			dev_priv->gpu_error.last_reset = get_seconds();
760
	}
729
	}
761
 
730
	if (ret) {
762
	if (ret) {
Line 731... Line 763...
731
		DRM_ERROR("Failed to reset chip.\n");
763
		DRM_ERROR("Failed to reset chip: %i\n", ret);
Line 747... Line 779...
747
	 * was running at the time of the reset (i.e. we weren't VT
779
	 * was running at the time of the reset (i.e. we weren't VT
748
	 * switched away).
780
	 * switched away).
749
	 */
781
	 */
750
	if (drm_core_check_feature(dev, DRIVER_MODESET) ||
782
	if (drm_core_check_feature(dev, DRIVER_MODESET) ||
751
			!dev_priv->ums.mm_suspended) {
783
			!dev_priv->ums.mm_suspended) {
752
		struct intel_ring_buffer *ring;
-
 
753
		int i;
-
 
754
 
-
 
755
		dev_priv->ums.mm_suspended = 0;
784
		dev_priv->ums.mm_suspended = 0;
Line 756... Line 785...
756
 
785
 
757
		i915_gem_init_swizzling(dev);
-
 
758
 
-
 
759
		for_each_ring(ring, dev_priv, i)
-
 
760
			ring->init(ring);
-
 
761
 
-
 
762
		i915_gem_context_init(dev);
-
 
763
		if (dev_priv->mm.aliasing_ppgtt) {
-
 
764
			ret = dev_priv->mm.aliasing_ppgtt->enable(dev);
-
 
765
			if (ret)
-
 
766
				i915_gem_cleanup_aliasing_ppgtt(dev);
-
 
767
		}
-
 
768
 
-
 
769
		/*
-
 
770
		 * It would make sense to re-init all the other hw state, at
-
 
771
		 * least the rps/rc6/emon init done within modeset_init_hw. For
-
 
772
		 * some unknown reason, this blows up my ilk, so don't.
-
 
773
		 */
-
 
774
 
786
		ret = i915_gem_init_hw(dev);
-
 
787
		mutex_unlock(&dev->struct_mutex);
-
 
788
		if (ret) {
-
 
789
			DRM_ERROR("Failed hw init on reset %d\n", ret);
-
 
790
			return ret;
Line 775... Line 791...
775
		mutex_unlock(&dev->struct_mutex);
791
		}
776
 
792
 
777
		drm_irq_uninstall(dev);
793
		drm_irq_uninstall(dev);
778
		drm_irq_install(dev);
794
		drm_irq_install(dev);
Line 787... Line 803...
787
static int i915_pci_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
803
static int i915_pci_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
788
{
804
{
789
	struct intel_device_info *intel_info =
805
	struct intel_device_info *intel_info =
790
		(struct intel_device_info *) ent->driver_data;
806
		(struct intel_device_info *) ent->driver_data;
Line -... Line 807...
-
 
807
 
-
 
808
	if (IS_PRELIMINARY_HW(intel_info) && !i915_preliminary_hw_support) {
-
 
809
		DRM_INFO("This hardware requires preliminary hardware support.\n"
-
 
810
			 "See CONFIG_DRM_I915_PRELIMINARY_HW_SUPPORT, and/or modparam preliminary_hw_support\n");
-
 
811
		return -ENODEV;
-
 
812
	}
791
 
813
 
792
	/* Only bind to function 0 of the device. Early generations
814
	/* Only bind to function 0 of the device. Early generations
793
	 * used function 1 as a placeholder for multi-head. This causes
815
	 * used function 1 as a placeholder for multi-head. This causes
794
	 * us confusion instead, especially on the systems where both
816
	 * us confusion instead, especially on the systems where both
795
	 * functions have the same PCI-ID!
817
	 * functions have the same PCI-ID!
Line 879... Line 901...
879
	struct drm_device *drm_dev = pci_get_drvdata(pdev);
901
	struct drm_device *drm_dev = pci_get_drvdata(pdev);
Line 880... Line 902...
880
 
902
 
881
	return i915_drm_freeze(drm_dev);
903
	return i915_drm_freeze(drm_dev);
Line -... Line 904...
-
 
904
}
882
}
905
 
Line 883... Line 906...
883
 
906
 
884
#endif
907
#endif
885
 
908
 
886
static struct drm_driver driver = {
909
static struct drm_driver driver = {
887
    /* Don't use MTRRs here; the Xserver or userspace app should
910
    /* Don't use MTRRs here; the Xserver or userspace app should
888
     * deal with them for Intel hardware.
911
     * deal with them for Intel hardware.
889
     */
912
     */
890
    .driver_features =
913
    .driver_features =
891
	    DRIVER_USE_AGP | DRIVER_REQUIRE_AGP |
914
	    DRIVER_USE_AGP |
892
	    DRIVER_HAVE_IRQ | DRIVER_IRQ_SHARED | DRIVER_GEM | DRIVER_PRIME |
915
	    DRIVER_HAVE_IRQ | DRIVER_IRQ_SHARED | DRIVER_GEM | DRIVER_PRIME |
893
	    DRIVER_RENDER,
916
	    DRIVER_RENDER,
Line 907... Line 930...
907
//    .master_destroy = i915_master_destroy,
930
//    .master_destroy = i915_master_destroy,
908
#if defined(CONFIG_DEBUG_FS)
931
#if defined(CONFIG_DEBUG_FS)
909
	.debugfs_init = i915_debugfs_init,
932
	.debugfs_init = i915_debugfs_init,
910
	.debugfs_cleanup = i915_debugfs_cleanup,
933
	.debugfs_cleanup = i915_debugfs_cleanup,
911
#endif
934
#endif
912
    .gem_init_object = i915_gem_init_object,
-
 
913
    .gem_free_object = i915_gem_free_object,
935
    .gem_free_object = i915_gem_free_object,
Line 914... Line 936...
914
 
936
 
915
//    .prime_handle_to_fd = drm_gem_prime_handle_to_fd,
937
//    .prime_handle_to_fd = drm_gem_prime_handle_to_fd,
916
//    .prime_fd_to_handle = drm_gem_prime_fd_to_handle,
938
//    .prime_fd_to_handle = drm_gem_prime_fd_to_handle,