Subversion Repositories Kolibri OS

Rev

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

Rev 3266 Rev 3480
Line 164... Line 164...
164
static const intel_limit_t intel_limits_i9xx_sdvo = {
164
static const intel_limit_t intel_limits_i9xx_sdvo = {
165
        .dot = { .min = 20000, .max = 400000 },
165
        .dot = { .min = 20000, .max = 400000 },
166
        .vco = { .min = 1400000, .max = 2800000 },
166
        .vco = { .min = 1400000, .max = 2800000 },
167
        .n = { .min = 1, .max = 6 },
167
        .n = { .min = 1, .max = 6 },
168
        .m = { .min = 70, .max = 120 },
168
        .m = { .min = 70, .max = 120 },
169
        .m1 = { .min = 10, .max = 22 },
169
	.m1 = { .min = 8, .max = 18 },
170
        .m2 = { .min = 5, .max = 9 },
170
	.m2 = { .min = 3, .max = 7 },
171
        .p = { .min = 5, .max = 80 },
171
        .p = { .min = 5, .max = 80 },
172
        .p1 = { .min = 1, .max = 8 },
172
        .p1 = { .min = 1, .max = 8 },
173
	.p2 = { .dot_limit = 200000,
173
	.p2 = { .dot_limit = 200000,
174
		.p2_slow = 10, .p2_fast = 5 },
174
		.p2_slow = 10, .p2_fast = 5 },
175
	.find_pll = intel_find_best_PLL,
175
	.find_pll = intel_find_best_PLL,
Line 178... Line 178...
178
static const intel_limit_t intel_limits_i9xx_lvds = {
178
static const intel_limit_t intel_limits_i9xx_lvds = {
179
        .dot = { .min = 20000, .max = 400000 },
179
        .dot = { .min = 20000, .max = 400000 },
180
        .vco = { .min = 1400000, .max = 2800000 },
180
        .vco = { .min = 1400000, .max = 2800000 },
181
        .n = { .min = 1, .max = 6 },
181
        .n = { .min = 1, .max = 6 },
182
        .m = { .min = 70, .max = 120 },
182
        .m = { .min = 70, .max = 120 },
183
        .m1 = { .min = 10, .max = 22 },
183
	.m1 = { .min = 8, .max = 18 },
184
        .m2 = { .min = 5, .max = 9 },
184
	.m2 = { .min = 3, .max = 7 },
185
        .p = { .min = 7, .max = 98 },
185
        .p = { .min = 7, .max = 98 },
186
        .p1 = { .min = 1, .max = 8 },
186
        .p1 = { .min = 1, .max = 8 },
187
	.p2 = { .dot_limit = 112000,
187
	.p2 = { .dot_limit = 112000,
188
		.p2_slow = 14, .p2_fast = 7 },
188
		.p2_slow = 14, .p2_fast = 7 },
189
	.find_pll = intel_find_best_PLL,
189
	.find_pll = intel_find_best_PLL,
Line 426... Line 426...
426
	.find_pll = intel_vlv_find_best_pll,
426
	.find_pll = intel_vlv_find_best_pll,
427
};
427
};
Line 428... Line 428...
428
 
428
 
429
u32 intel_dpio_read(struct drm_i915_private *dev_priv, int reg)
429
u32 intel_dpio_read(struct drm_i915_private *dev_priv, int reg)
430
{
430
{
431
	unsigned long flags;
-
 
Line 432... Line -...
432
	u32 val = 0;
-
 
433
 
431
	WARN_ON(!mutex_is_locked(&dev_priv->dpio_lock));
434
	spin_lock_irqsave(&dev_priv->dpio_lock, flags);
432
 
435
	if (wait_for_atomic_us((I915_READ(DPIO_PKT) & DPIO_BUSY) == 0, 100)) {
433
	if (wait_for_atomic_us((I915_READ(DPIO_PKT) & DPIO_BUSY) == 0, 100)) {
436
		DRM_ERROR("DPIO idle wait timed out\n");
434
		DRM_ERROR("DPIO idle wait timed out\n");
Line 437... Line 435...
437
		goto out_unlock;
435
		return 0;
438
	}
436
	}
439
 
437
 
440
	I915_WRITE(DPIO_REG, reg);
438
	I915_WRITE(DPIO_REG, reg);
441
	I915_WRITE(DPIO_PKT, DPIO_RID | DPIO_OP_READ | DPIO_PORTID |
439
	I915_WRITE(DPIO_PKT, DPIO_RID | DPIO_OP_READ | DPIO_PORTID |
442
		   DPIO_BYTE);
440
		   DPIO_BYTE);
443
	if (wait_for_atomic_us((I915_READ(DPIO_PKT) & DPIO_BUSY) == 0, 100)) {
441
	if (wait_for_atomic_us((I915_READ(DPIO_PKT) & DPIO_BUSY) == 0, 100)) {
444
		DRM_ERROR("DPIO read wait timed out\n");
-
 
Line 445... Line -...
445
		goto out_unlock;
-
 
446
	}
-
 
447
	val = I915_READ(DPIO_DATA);
442
		DRM_ERROR("DPIO read wait timed out\n");
448
 
443
		return 0;
Line 449... Line 444...
449
out_unlock:
444
	}
450
	spin_unlock_irqrestore(&dev_priv->dpio_lock, flags);
445
 
451
	return val;
446
	return I915_READ(DPIO_DATA);
452
}
447
}
Line 453... Line -...
453
 
-
 
454
static void intel_dpio_write(struct drm_i915_private *dev_priv, int reg,
448
 
455
			     u32 val)
449
static void intel_dpio_write(struct drm_i915_private *dev_priv, int reg,
456
{
450
			     u32 val)
457
	unsigned long flags;
451
{
Line 458... Line 452...
458
 
452
	WARN_ON(!mutex_is_locked(&dev_priv->dpio_lock));
459
	spin_lock_irqsave(&dev_priv->dpio_lock, flags);
453
 
460
	if (wait_for_atomic_us((I915_READ(DPIO_PKT) & DPIO_BUSY) == 0, 100)) {
454
	if (wait_for_atomic_us((I915_READ(DPIO_PKT) & DPIO_BUSY) == 0, 100)) {
461
		DRM_ERROR("DPIO idle wait timed out\n");
455
		DRM_ERROR("DPIO idle wait timed out\n");
462
		goto out_unlock;
456
		return;
463
	}
457
	}
464
 
-
 
465
	I915_WRITE(DPIO_DATA, val);
-
 
466
	I915_WRITE(DPIO_REG, reg);
-
 
467
	I915_WRITE(DPIO_PKT, DPIO_RID | DPIO_OP_WRITE | DPIO_PORTID |
458
 
Line 468... Line 459...
468
		   DPIO_BYTE);
459
	I915_WRITE(DPIO_DATA, val);
469
	if (wait_for_atomic_us((I915_READ(DPIO_PKT) & DPIO_BUSY) == 0, 100))
460
	I915_WRITE(DPIO_REG, reg);
470
		DRM_ERROR("DPIO write wait timed out\n");
461
	I915_WRITE(DPIO_PKT, DPIO_RID | DPIO_OP_WRITE | DPIO_PORTID |
Line 482... Line 473...
482
	POSTING_READ(DPIO_CTL);
473
	POSTING_READ(DPIO_CTL);
483
	I915_WRITE(DPIO_CTL, 1);
474
	I915_WRITE(DPIO_CTL, 1);
484
	POSTING_READ(DPIO_CTL);
475
	POSTING_READ(DPIO_CTL);
485
}
476
}
Line 486... Line -...
486
 
-
 
487
static int intel_dual_link_lvds_callback(const struct dmi_system_id *id)
-
 
488
{
-
 
489
	DRM_INFO("Forcing lvds to dual link mode on %s\n", id->ident);
-
 
490
	return 1;
-
 
491
}
-
 
492
 
-
 
493
static const struct dmi_system_id intel_dual_link_lvds[] = {
-
 
494
	{
-
 
495
		.callback = intel_dual_link_lvds_callback,
-
 
496
		.ident = "Apple MacBook Pro (Core i5/i7 Series)",
-
 
497
		.matches = {
-
 
498
			DMI_MATCH(DMI_SYS_VENDOR, "Apple Inc."),
-
 
499
			DMI_MATCH(DMI_PRODUCT_NAME, "MacBookPro8,2"),
-
 
500
		},
-
 
501
	},
-
 
502
	{ }	/* terminating entry */
-
 
503
};
-
 
504
 
-
 
505
static bool is_dual_link_lvds(struct drm_i915_private *dev_priv,
-
 
506
			      unsigned int reg)
-
 
507
{
-
 
508
	unsigned int val;
-
 
509
 
-
 
510
	/* use the module option value if specified */
-
 
511
	if (i915_lvds_channel_mode > 0)
-
 
512
		return i915_lvds_channel_mode == 2;
-
 
513
 
-
 
514
//   if (dmi_check_system(intel_dual_link_lvds))
-
 
515
//       return true;
-
 
516
 
-
 
517
	if (dev_priv->lvds_val)
-
 
518
		val = dev_priv->lvds_val;
-
 
519
	else {
-
 
520
		/* BIOS should set the proper LVDS register value at boot, but
-
 
521
		 * in reality, it doesn't set the value when the lid is closed;
-
 
522
		 * we need to check "the value to be set" in VBT when LVDS
-
 
523
		 * register is uninitialized.
-
 
524
		 */
-
 
525
		val = I915_READ(reg);
-
 
526
		if (!(val & ~(LVDS_PIPE_MASK | LVDS_DETECTED)))
-
 
527
			val = dev_priv->bios_lvds_val;
-
 
528
		dev_priv->lvds_val = val;
-
 
529
	}
-
 
530
	return (val & LVDS_CLKB_POWER_MASK) == LVDS_CLKB_POWER_UP;
-
 
531
}
-
 
532
 
477
 
533
static const intel_limit_t *intel_ironlake_limit(struct drm_crtc *crtc,
478
static const intel_limit_t *intel_ironlake_limit(struct drm_crtc *crtc,
534
						int refclk)
479
						int refclk)
535
{
480
{
536
	struct drm_device *dev = crtc->dev;
-
 
537
	struct drm_i915_private *dev_priv = dev->dev_private;
481
	struct drm_device *dev = crtc->dev;
Line 538... Line 482...
538
	const intel_limit_t *limit;
482
	const intel_limit_t *limit;
539
 
483
 
540
	if (intel_pipe_has_type(crtc, INTEL_OUTPUT_LVDS)) {
484
	if (intel_pipe_has_type(crtc, INTEL_OUTPUT_LVDS)) {
541
		if (is_dual_link_lvds(dev_priv, PCH_LVDS)) {
485
		if (intel_is_dual_link_lvds(dev)) {
542
			/* LVDS dual channel */
486
			/* LVDS dual channel */
543
			if (refclk == 100000)
487
			if (refclk == 100000)
544
				limit = &intel_limits_ironlake_dual_lvds_100m;
488
				limit = &intel_limits_ironlake_dual_lvds_100m;
Line 560... Line 504...
560
}
504
}
Line 561... Line 505...
561
 
505
 
562
static const intel_limit_t *intel_g4x_limit(struct drm_crtc *crtc)
506
static const intel_limit_t *intel_g4x_limit(struct drm_crtc *crtc)
563
{
507
{
564
	struct drm_device *dev = crtc->dev;
-
 
565
	struct drm_i915_private *dev_priv = dev->dev_private;
508
	struct drm_device *dev = crtc->dev;
Line 566... Line 509...
566
	const intel_limit_t *limit;
509
	const intel_limit_t *limit;
567
 
510
 
568
	if (intel_pipe_has_type(crtc, INTEL_OUTPUT_LVDS)) {
511
	if (intel_pipe_has_type(crtc, INTEL_OUTPUT_LVDS)) {
569
		if (is_dual_link_lvds(dev_priv, LVDS))
512
		if (intel_is_dual_link_lvds(dev))
570
			/* LVDS with dual channel */
513
			/* LVDS with dual channel */
571
			limit = &intel_limits_g4x_dual_channel_lvds;
514
			limit = &intel_limits_g4x_dual_channel_lvds;
572
		else
515
		else
Line 696... Line 639...
696
		    int target, int refclk, intel_clock_t *match_clock,
639
		    int target, int refclk, intel_clock_t *match_clock,
697
		    intel_clock_t *best_clock)
640
		    intel_clock_t *best_clock)
Line 698... Line 641...
698
 
641
 
699
{
642
{
700
	struct drm_device *dev = crtc->dev;
-
 
701
	struct drm_i915_private *dev_priv = dev->dev_private;
643
	struct drm_device *dev = crtc->dev;
702
	intel_clock_t clock;
644
	intel_clock_t clock;
Line 703... Line 645...
703
	int err = target;
645
	int err = target;
704
 
-
 
705
	if (intel_pipe_has_type(crtc, INTEL_OUTPUT_LVDS) &&
646
 
706
	    (I915_READ(LVDS)) != 0) {
647
	if (intel_pipe_has_type(crtc, INTEL_OUTPUT_LVDS)) {
707
		/*
648
		/*
708
		 * For LVDS, if the panel is on, just rely on its current
649
		 * For LVDS just rely on its current settings for dual-channel.
709
		 * settings for dual-channel.  We haven't figured out how to
-
 
710
		 * reliably set up different single/dual channel state, if we
650
		 * We haven't figured out how to reliably set up different
711
		 * even can.
651
		 * single/dual channel state, if we even can.
712
		 */
652
		 */
713
		if (is_dual_link_lvds(dev_priv, LVDS))
653
		if (intel_is_dual_link_lvds(dev))
714
			clock.p2 = limit->p2.p2_fast;
654
			clock.p2 = limit->p2.p2_fast;
715
		else
655
		else
716
			clock.p2 = limit->p2.p2_slow;
656
			clock.p2 = limit->p2.p2_slow;
Line 761... Line 701...
761
intel_g4x_find_best_PLL(const intel_limit_t *limit, struct drm_crtc *crtc,
701
intel_g4x_find_best_PLL(const intel_limit_t *limit, struct drm_crtc *crtc,
762
			int target, int refclk, intel_clock_t *match_clock,
702
			int target, int refclk, intel_clock_t *match_clock,
763
			intel_clock_t *best_clock)
703
			intel_clock_t *best_clock)
764
{
704
{
765
	struct drm_device *dev = crtc->dev;
705
	struct drm_device *dev = crtc->dev;
766
	struct drm_i915_private *dev_priv = dev->dev_private;
-
 
767
	intel_clock_t clock;
706
	intel_clock_t clock;
768
	int max_n;
707
	int max_n;
769
	bool found;
708
	bool found;
770
	/* approximately equals target * 0.00585 */
709
	/* approximately equals target * 0.00585 */
771
	int err_most = (target >> 8) + (target >> 9);
710
	int err_most = (target >> 8) + (target >> 9);
Line 776... Line 715...
776
 
715
 
777
		if (HAS_PCH_SPLIT(dev))
716
		if (HAS_PCH_SPLIT(dev))
778
			lvds_reg = PCH_LVDS;
717
			lvds_reg = PCH_LVDS;
779
		else
718
		else
780
			lvds_reg = LVDS;
719
			lvds_reg = LVDS;
781
		if ((I915_READ(lvds_reg) & LVDS_CLKB_POWER_MASK) ==
-
 
782
		    LVDS_CLKB_POWER_UP)
720
		if (intel_is_dual_link_lvds(dev))
783
			clock.p2 = limit->p2.p2_fast;
721
			clock.p2 = limit->p2.p2_fast;
784
		else
722
		else
785
			clock.p2 = limit->p2.p2_slow;
723
			clock.p2 = limit->p2.p2_slow;
786
	} else {
724
	} else {
Line 1057... Line 995...
1057
		if (time_after(GetTimerTicks(), timeout))
995
		if (time_after(GetTimerTicks(), timeout))
1058
			WARN(1, "pipe_off wait timed out\n");
996
			WARN(1, "pipe_off wait timed out\n");
1059
	}
997
	}
1060
}
998
}
Line -... Line 999...
-
 
999
 
-
 
1000
/*
-
 
1001
 * ibx_digital_port_connected - is the specified port connected?
-
 
1002
 * @dev_priv: i915 private structure
-
 
1003
 * @port: the port to test
-
 
1004
 *
-
 
1005
 * Returns true if @port is connected, false otherwise.
-
 
1006
 */
-
 
1007
bool ibx_digital_port_connected(struct drm_i915_private *dev_priv,
-
 
1008
				struct intel_digital_port *port)
-
 
1009
{
-
 
1010
	u32 bit;
-
 
1011
 
-
 
1012
	if (HAS_PCH_IBX(dev_priv->dev)) {
-
 
1013
		switch(port->port) {
-
 
1014
		case PORT_B:
-
 
1015
			bit = SDE_PORTB_HOTPLUG;
-
 
1016
			break;
-
 
1017
		case PORT_C:
-
 
1018
			bit = SDE_PORTC_HOTPLUG;
-
 
1019
			break;
-
 
1020
		case PORT_D:
-
 
1021
			bit = SDE_PORTD_HOTPLUG;
-
 
1022
			break;
-
 
1023
		default:
-
 
1024
			return true;
-
 
1025
		}
-
 
1026
	} else {
-
 
1027
		switch(port->port) {
-
 
1028
		case PORT_B:
-
 
1029
			bit = SDE_PORTB_HOTPLUG_CPT;
-
 
1030
			break;
-
 
1031
		case PORT_C:
-
 
1032
			bit = SDE_PORTC_HOTPLUG_CPT;
-
 
1033
			break;
-
 
1034
		case PORT_D:
-
 
1035
			bit = SDE_PORTD_HOTPLUG_CPT;
-
 
1036
			break;
-
 
1037
		default:
-
 
1038
			return true;
-
 
1039
		}
-
 
1040
	}
-
 
1041
 
-
 
1042
	return I915_READ(SDEISR) & bit;
-
 
1043
}
1061
 
1044
 
1062
static const char *state_string(bool enabled)
1045
static const char *state_string(bool enabled)
1063
{
1046
{
1064
	return enabled ? "on" : "off";
1047
	return enabled ? "on" : "off";
Line 1135... Line 1118...
1135
	u32 val;
1118
	u32 val;
1136
	bool cur_state;
1119
	bool cur_state;
1137
	enum transcoder cpu_transcoder = intel_pipe_to_cpu_transcoder(dev_priv,
1120
	enum transcoder cpu_transcoder = intel_pipe_to_cpu_transcoder(dev_priv,
1138
								      pipe);
1121
								      pipe);
Line 1139... Line 1122...
1139
 
1122
 
1140
	if (IS_HASWELL(dev_priv->dev)) {
1123
	if (HAS_DDI(dev_priv->dev)) {
1141
		/* On Haswell, DDI is used instead of FDI_TX_CTL */
1124
		/* DDI does not have a specific FDI_TX register */
1142
		reg = TRANS_DDI_FUNC_CTL(cpu_transcoder);
1125
		reg = TRANS_DDI_FUNC_CTL(cpu_transcoder);
1143
		val = I915_READ(reg);
1126
		val = I915_READ(reg);
1144
		cur_state = !!(val & TRANS_DDI_FUNC_ENABLE);
1127
		cur_state = !!(val & TRANS_DDI_FUNC_ENABLE);
1145
	} else {
1128
	} else {
Line 1180... Line 1163...
1180
	/* ILK FDI PLL is always enabled */
1163
	/* ILK FDI PLL is always enabled */
1181
	if (dev_priv->info->gen == 5)
1164
	if (dev_priv->info->gen == 5)
1182
		return;
1165
		return;
Line 1183... Line 1166...
1183
 
1166
 
1184
	/* On Haswell, DDI ports are responsible for the FDI PLL setup */
1167
	/* On Haswell, DDI ports are responsible for the FDI PLL setup */
1185
	if (IS_HASWELL(dev_priv->dev))
1168
	if (HAS_DDI(dev_priv->dev))
Line 1186... Line 1169...
1186
		return;
1169
		return;
1187
 
1170
 
1188
	reg = FDI_TX_CTL(pipe);
1171
	reg = FDI_TX_CTL(pipe);
Line 1241... Line 1224...
1241
 
1224
 
1242
	/* if we need the pipe A quirk it must be always on */
1225
	/* if we need the pipe A quirk it must be always on */
1243
	if (pipe == PIPE_A && dev_priv->quirks & QUIRK_PIPEA_FORCE)
1226
	if (pipe == PIPE_A && dev_priv->quirks & QUIRK_PIPEA_FORCE)
Line -... Line 1227...
-
 
1227
		state = true;
-
 
1228
 
-
 
1229
	if (IS_HASWELL(dev_priv->dev) && cpu_transcoder != TRANSCODER_EDP &&
-
 
1230
	    !(I915_READ(HSW_PWR_WELL_DRIVER) & HSW_PWR_WELL_ENABLE)) {
1244
		state = true;
1231
		cur_state = false;
1245
 
1232
	} else {
1246
	reg = PIPECONF(cpu_transcoder);
1233
	reg = PIPECONF(cpu_transcoder);
-
 
1234
	val = I915_READ(reg);
-
 
1235
	cur_state = !!(val & PIPECONF_ENABLE);
1247
	val = I915_READ(reg);
1236
	}
1248
	cur_state = !!(val & PIPECONF_ENABLE);
1237
 
1249
	WARN(cur_state != state,
1238
	WARN(cur_state != state,
1250
	     "pipe %c assertion failure (expected %s, current %s)\n",
1239
	     "pipe %c assertion failure (expected %s, current %s)\n",
Line 1519... Line 1508...
1519
/* SBI access */
1508
/* SBI access */
1520
static void
1509
static void
1521
intel_sbi_write(struct drm_i915_private *dev_priv, u16 reg, u32 value,
1510
intel_sbi_write(struct drm_i915_private *dev_priv, u16 reg, u32 value,
1522
		enum intel_sbi_destination destination)
1511
		enum intel_sbi_destination destination)
1523
{
1512
{
1524
	unsigned long flags;
-
 
1525
	u32 tmp;
1513
	u32 tmp;
Line 1526... Line 1514...
1526
 
1514
 
-
 
1515
	WARN_ON(!mutex_is_locked(&dev_priv->dpio_lock));
1527
	spin_lock_irqsave(&dev_priv->dpio_lock, flags);
1516
 
-
 
1517
	if (wait_for((I915_READ(SBI_CTL_STAT) & SBI_BUSY) == 0,
1528
	if (wait_for((I915_READ(SBI_CTL_STAT) & SBI_BUSY) == 0, 100)) {
1518
				100)) {
1529
		DRM_ERROR("timeout waiting for SBI to become ready\n");
1519
		DRM_ERROR("timeout waiting for SBI to become ready\n");
1530
		goto out_unlock;
1520
		return;
Line 1531... Line 1521...
1531
	}
1521
	}
1532
 
1522
 
Line 1540... Line 1530...
1540
	I915_WRITE(SBI_CTL_STAT, SBI_BUSY | tmp);
1530
	I915_WRITE(SBI_CTL_STAT, SBI_BUSY | tmp);
Line 1541... Line 1531...
1541
 
1531
 
1542
	if (wait_for((I915_READ(SBI_CTL_STAT) & (SBI_BUSY | SBI_RESPONSE_FAIL)) == 0,
1532
	if (wait_for((I915_READ(SBI_CTL_STAT) & (SBI_BUSY | SBI_RESPONSE_FAIL)) == 0,
1543
				100)) {
1533
				100)) {
1544
		DRM_ERROR("timeout waiting for SBI to complete write transaction\n");
1534
		DRM_ERROR("timeout waiting for SBI to complete write transaction\n");
1545
		goto out_unlock;
1535
		return;
1546
	}
-
 
1547
 
-
 
1548
out_unlock:
-
 
1549
	spin_unlock_irqrestore(&dev_priv->dpio_lock, flags);
1536
	}
Line 1550... Line 1537...
1550
}
1537
}
1551
 
1538
 
1552
static u32
1539
static u32
1553
intel_sbi_read(struct drm_i915_private *dev_priv, u16 reg,
1540
intel_sbi_read(struct drm_i915_private *dev_priv, u16 reg,
1554
	       enum intel_sbi_destination destination)
-
 
1555
{
1541
	       enum intel_sbi_destination destination)
-
 
1542
{
Line 1556... Line -...
1556
	unsigned long flags;
-
 
1557
	u32 value = 0;
1543
	u32 value = 0;
-
 
1544
	WARN_ON(!mutex_is_locked(&dev_priv->dpio_lock));
1558
 
1545
 
1559
	spin_lock_irqsave(&dev_priv->dpio_lock, flags);
1546
	if (wait_for((I915_READ(SBI_CTL_STAT) & SBI_BUSY) == 0,
1560
	if (wait_for((I915_READ(SBI_CTL_STAT) & SBI_BUSY) == 0, 100)) {
1547
				100)) {
Line 1561... Line 1548...
1561
		DRM_ERROR("timeout waiting for SBI to become ready\n");
1548
		DRM_ERROR("timeout waiting for SBI to become ready\n");
Line 1562... Line 1549...
1562
		goto out_unlock;
1549
		return 0;
Line 1571... Line 1558...
1571
	I915_WRITE(SBI_CTL_STAT, value | SBI_BUSY);
1558
	I915_WRITE(SBI_CTL_STAT, value | SBI_BUSY);
Line 1572... Line 1559...
1572
 
1559
 
1573
	if (wait_for((I915_READ(SBI_CTL_STAT) & (SBI_BUSY | SBI_RESPONSE_FAIL)) == 0,
1560
	if (wait_for((I915_READ(SBI_CTL_STAT) & (SBI_BUSY | SBI_RESPONSE_FAIL)) == 0,
1574
				100)) {
1561
				100)) {
1575
		DRM_ERROR("timeout waiting for SBI to complete read transaction\n");
1562
		DRM_ERROR("timeout waiting for SBI to complete read transaction\n");
1576
		goto out_unlock;
1563
		return 0;
Line 1577... Line 1564...
1577
	}
1564
	}
1578
 
-
 
1579
	value = I915_READ(SBI_DATA);
-
 
1580
 
-
 
1581
out_unlock:
-
 
1582
	spin_unlock_irqrestore(&dev_priv->dpio_lock, flags);
1565
 
Line 1583... Line 1566...
1583
	return value;
1566
	return I915_READ(SBI_DATA);
1584
}
1567
}
1585
 
1568
 
Line 1710... Line 1693...
1710
	if (HAS_PCH_IBX(dev_priv->dev)) {
1693
	if (HAS_PCH_IBX(dev_priv->dev)) {
1711
		/*
1694
		/*
1712
		 * make the BPC in transcoder be consistent with
1695
		 * make the BPC in transcoder be consistent with
1713
		 * that in pipeconf reg.
1696
		 * that in pipeconf reg.
1714
		 */
1697
		 */
1715
		val &= ~PIPE_BPC_MASK;
1698
		val &= ~PIPECONF_BPC_MASK;
1716
		val |= pipeconf_val & PIPE_BPC_MASK;
1699
		val |= pipeconf_val & PIPECONF_BPC_MASK;
1717
	}
1700
	}
Line 1718... Line 1701...
1718
 
1701
 
1719
	val &= ~TRANS_INTERLACE_MASK;
1702
	val &= ~TRANS_INTERLACE_MASK;
1720
	if ((pipeconf_val & PIPECONF_INTERLACE_MASK) == PIPECONF_INTERLACED_ILK)
1703
	if ((pipeconf_val & PIPECONF_INTERLACE_MASK) == PIPECONF_INTERLACED_ILK)
Line 1738... Line 1721...
1738
 
1721
 
1739
	/* PCH only available on ILK+ */
1722
	/* PCH only available on ILK+ */
Line 1740... Line 1723...
1740
	BUG_ON(dev_priv->info->gen < 5);
1723
	BUG_ON(dev_priv->info->gen < 5);
1741
 
1724
 
1742
	/* FDI must be feeding us bits for PCH ports */
1725
	/* FDI must be feeding us bits for PCH ports */
Line 1743... Line 1726...
1743
	assert_fdi_tx_enabled(dev_priv, cpu_transcoder);
1726
	assert_fdi_tx_enabled(dev_priv, (enum pipe) cpu_transcoder);
1744
	assert_fdi_rx_enabled(dev_priv, TRANSCODER_A);
1727
	assert_fdi_rx_enabled(dev_priv, TRANSCODER_A);
1745
 
1728
 
Line 1826... Line 1809...
1826
static void intel_enable_pipe(struct drm_i915_private *dev_priv, enum pipe pipe,
1809
static void intel_enable_pipe(struct drm_i915_private *dev_priv, enum pipe pipe,
1827
			      bool pch_port)
1810
			      bool pch_port)
1828
{
1811
{
1829
	enum transcoder cpu_transcoder = intel_pipe_to_cpu_transcoder(dev_priv,
1812
	enum transcoder cpu_transcoder = intel_pipe_to_cpu_transcoder(dev_priv,
1830
								      pipe);
1813
								      pipe);
1831
	enum transcoder pch_transcoder;
1814
	enum pipe pch_transcoder;
1832
	int reg;
1815
	int reg;
1833
	u32 val;
1816
	u32 val;
Line 1834... Line 1817...
1834
 
1817
 
1835
	if (IS_HASWELL(dev_priv->dev))
1818
	if (HAS_PCH_LPT(dev_priv->dev))
1836
		pch_transcoder = TRANSCODER_A;
1819
		pch_transcoder = TRANSCODER_A;
1837
	else
1820
	else
Line 1838... Line 1821...
1838
		pch_transcoder = pipe;
1821
		pch_transcoder = pipe;
Line 1846... Line 1829...
1846
		assert_pll_enabled(dev_priv, pipe);
1829
		assert_pll_enabled(dev_priv, pipe);
1847
	else {
1830
	else {
1848
		if (pch_port) {
1831
		if (pch_port) {
1849
			/* if driving the PCH, we need FDI enabled */
1832
			/* if driving the PCH, we need FDI enabled */
1850
			assert_fdi_rx_pll_enabled(dev_priv, pch_transcoder);
1833
			assert_fdi_rx_pll_enabled(dev_priv, pch_transcoder);
1851
			assert_fdi_tx_pll_enabled(dev_priv, cpu_transcoder);
1834
			assert_fdi_tx_pll_enabled(dev_priv,
-
 
1835
						  (enum pipe) cpu_transcoder);
1852
		}
1836
		}
1853
		/* FIXME: assert CPU port conditions for SNB+ */
1837
		/* FIXME: assert CPU port conditions for SNB+ */
1854
	}
1838
	}
Line 1855... Line 1839...
1855
 
1839
 
Line 2003... Line 1987...
2003
	/* Install a fence for tiled scan-out. Pre-i965 always needs a
1987
	/* Install a fence for tiled scan-out. Pre-i965 always needs a
2004
	 * fence, whereas 965+ only requires a fence if using
1988
	 * fence, whereas 965+ only requires a fence if using
2005
	 * framebuffer compression.  For simplicity, we always install
1989
	 * framebuffer compression.  For simplicity, we always install
2006
	 * a fence as the cost is not that onerous.
1990
	 * a fence as the cost is not that onerous.
2007
	 */
1991
	 */
-
 
1992
	ret = i915_gem_object_get_fence(obj);
-
 
1993
	if (ret)
-
 
1994
		goto err_unpin;
-
 
1995
 
-
 
1996
	i915_gem_object_pin_fence(obj);
Line 2008... Line 1997...
2008
 
1997
 
2009
	dev_priv->mm.interruptible = true;
1998
	dev_priv->mm.interruptible = true;
Line 2010... Line 1999...
2010
	return 0;
1999
	return 0;
Line 2022... Line 2011...
2022
//	i915_gem_object_unpin(obj);
2011
//	i915_gem_object_unpin(obj);
2023
}
2012
}
Line 2024... Line 2013...
2024
 
2013
 
2025
/* Computes the linear offset to the base tile and adjusts x, y. bytes per pixel
2014
/* Computes the linear offset to the base tile and adjusts x, y. bytes per pixel
2026
 * is assumed to be a power-of-two. */
2015
 * is assumed to be a power-of-two. */
-
 
2016
unsigned long intel_gen4_compute_page_offset(int *x, int *y,
2027
unsigned long intel_gen4_compute_offset_xtiled(int *x, int *y,
2017
					     unsigned int tiling_mode,
2028
							unsigned int bpp,
2018
					     unsigned int cpp,
2029
							unsigned int pitch)
2019
							unsigned int pitch)
-
 
2020
{
2030
{
2021
	if (tiling_mode != I915_TILING_NONE) {
Line 2031... Line 2022...
2031
	int tile_rows, tiles;
2022
		unsigned int tile_rows, tiles;
2032
 
2023
 
-
 
2024
	tile_rows = *y / 8;
2033
	tile_rows = *y / 8;
2025
	*y %= 8;
2034
	*y %= 8;
2026
 
Line 2035... Line 2027...
2035
	tiles = *x / (512/bpp);
2027
		tiles = *x / (512/cpp);
-
 
2028
		*x %= 512/cpp;
-
 
2029
 
-
 
2030
	return tile_rows * pitch * 8 + tiles * 4096;
-
 
2031
	} else {
-
 
2032
		unsigned int offset;
-
 
2033
 
-
 
2034
		offset = *y * pitch + *x * cpp;
-
 
2035
		*y = 0;
2036
	*x %= 512/bpp;
2036
		*x = (offset & 4095) / cpp;
Line 2037... Line 2037...
2037
 
2037
		return offset & -4096;
2038
	return tile_rows * pitch * 8 + tiles * 4096;
2038
	}
2039
}
2039
}
Line 2110... Line 2110...
2110
 
2110
 
Line 2111... Line 2111...
2111
	linear_offset = y * fb->pitches[0] + x * (fb->bits_per_pixel / 8);
2111
	linear_offset = y * fb->pitches[0] + x * (fb->bits_per_pixel / 8);
2112
 
2112
 
2113
	if (INTEL_INFO(dev)->gen >= 4) {
2113
	if (INTEL_INFO(dev)->gen >= 4) {
2114
		intel_crtc->dspaddr_offset =
2114
		intel_crtc->dspaddr_offset =
2115
			intel_gen4_compute_offset_xtiled(&x, &y,
2115
			intel_gen4_compute_page_offset(&x, &y, obj->tiling_mode,
2116
							   fb->bits_per_pixel / 8,
2116
							   fb->bits_per_pixel / 8,
2117
							   fb->pitches[0]);
2117
							   fb->pitches[0]);
2118
		linear_offset -= intel_crtc->dspaddr_offset;
2118
		linear_offset -= intel_crtc->dspaddr_offset;
Line 2191... Line 2191...
2191
    default:
2191
    default:
2192
		DRM_ERROR("Unknown pixel format 0x%08x\n", fb->pixel_format);
2192
		DRM_ERROR("Unknown pixel format 0x%08x\n", fb->pixel_format);
2193
        return -EINVAL;
2193
        return -EINVAL;
2194
    }
2194
    }
Line 2195... Line 2195...
2195
 
2195
 
2196
//    if (obj->tiling_mode != I915_TILING_NONE)
2196
	if (obj->tiling_mode != I915_TILING_NONE)
2197
//        dspcntr |= DISPPLANE_TILED;
2197
		dspcntr |= DISPPLANE_TILED;
2198
//    else
2198
	else
Line 2199... Line 2199...
2199
        dspcntr &= ~DISPPLANE_TILED;
2199
        dspcntr &= ~DISPPLANE_TILED;
2200
 
2200
 
Line 2201... Line 2201...
2201
    /* must disable */
2201
    /* must disable */
Line 2202... Line 2202...
2202
    dspcntr |= DISPPLANE_TRICKLE_FEED_DISABLE;
2202
    dspcntr |= DISPPLANE_TRICKLE_FEED_DISABLE;
2203
 
2203
 
2204
    I915_WRITE(reg, dspcntr);
2204
    I915_WRITE(reg, dspcntr);
2205
 
2205
 
2206
	linear_offset = y * fb->pitches[0] + x * (fb->bits_per_pixel / 8);
2206
	linear_offset = y * fb->pitches[0] + x * (fb->bits_per_pixel / 8);
2207
	intel_crtc->dspaddr_offset =
2207
	intel_crtc->dspaddr_offset =
Line 2208... Line 2208...
2208
		intel_gen4_compute_offset_xtiled(&x, &y,
2208
		intel_gen4_compute_page_offset(&x, &y, obj->tiling_mode,
Line 2248... Line 2248...
2248
	struct drm_i915_gem_object *obj = to_intel_framebuffer(old_fb)->obj;
2248
	struct drm_i915_gem_object *obj = to_intel_framebuffer(old_fb)->obj;
2249
	struct drm_i915_private *dev_priv = obj->base.dev->dev_private;
2249
	struct drm_i915_private *dev_priv = obj->base.dev->dev_private;
2250
	bool was_interruptible = dev_priv->mm.interruptible;
2250
	bool was_interruptible = dev_priv->mm.interruptible;
2251
	int ret;
2251
	int ret;
Line 2252... Line -...
2252
 
-
 
2253
	wait_event(dev_priv->pending_flip_queue,
-
 
2254
		   atomic_read(&dev_priv->mm.wedged) ||
-
 
2255
		   atomic_read(&obj->pending_flip) == 0);
-
 
2256
 
2252
 
2257
	/* Big Hammer, we also need to ensure that any pending
2253
	/* Big Hammer, we also need to ensure that any pending
2258
	 * MI_WAIT_FOR_EVENT inside a user batch buffer on the
2254
	 * MI_WAIT_FOR_EVENT inside a user batch buffer on the
2259
	 * current scanout is retired before unpinning the old
2255
	 * current scanout is retired before unpinning the old
2260
	 * framebuffer.
2256
	 * framebuffer.
Line 2328... Line 2324...
2328
	mutex_unlock(&dev->struct_mutex);
2324
	mutex_unlock(&dev->struct_mutex);
Line 2329... Line 2325...
2329
 
2325
 
2330
    return 0;
2326
    return 0;
Line 2331... Line -...
2331
}
-
 
2332
 
-
 
2333
static void ironlake_set_pll_edp(struct drm_crtc *crtc, int clock)
-
 
2334
{
-
 
2335
	struct drm_device *dev = crtc->dev;
-
 
2336
	struct drm_i915_private *dev_priv = dev->dev_private;
-
 
2337
	u32 dpa_ctl;
-
 
2338
 
-
 
2339
	DRM_DEBUG_KMS("eDP PLL enable for clock %d\n", clock);
-
 
2340
	dpa_ctl = I915_READ(DP_A);
-
 
2341
	dpa_ctl &= ~DP_PLL_FREQ_MASK;
-
 
2342
 
-
 
2343
	if (clock < 200000) {
-
 
2344
		u32 temp;
-
 
2345
		dpa_ctl |= DP_PLL_FREQ_160MHZ;
-
 
2346
		/* workaround for 160Mhz:
-
 
2347
		   1) program 0x4600c bits 15:0 = 0x8124
-
 
2348
		   2) program 0x46010 bit 0 = 1
-
 
2349
		   3) program 0x46034 bit 24 = 1
-
 
2350
		   4) program 0x64000 bit 14 = 1
-
 
2351
		   */
-
 
2352
		temp = I915_READ(0x4600c);
-
 
2353
		temp &= 0xffff0000;
-
 
2354
		I915_WRITE(0x4600c, temp | 0x8124);
-
 
2355
 
-
 
2356
		temp = I915_READ(0x46010);
-
 
2357
		I915_WRITE(0x46010, temp | 1);
-
 
2358
 
-
 
2359
		temp = I915_READ(0x46034);
-
 
2360
		I915_WRITE(0x46034, temp | (1 << 24));
-
 
2361
	} else {
-
 
2362
		dpa_ctl |= DP_PLL_FREQ_270MHZ;
-
 
2363
	}
-
 
2364
	I915_WRITE(DP_A, dpa_ctl);
-
 
2365
 
-
 
2366
	POSTING_READ(DP_A);
-
 
2367
	udelay(500);
-
 
2368
}
2327
}
2369
 
2328
 
2370
static void intel_fdi_normal_train(struct drm_crtc *crtc)
2329
static void intel_fdi_normal_train(struct drm_crtc *crtc)
2371
{
2330
{
2372
	struct drm_device *dev = crtc->dev;
2331
	struct drm_device *dev = crtc->dev;
Line 2793... Line 2752...
2793
	/* enable PCH FDI RX PLL, wait warmup plus DMI latency */
2752
	/* enable PCH FDI RX PLL, wait warmup plus DMI latency */
2794
	reg = FDI_RX_CTL(pipe);
2753
	reg = FDI_RX_CTL(pipe);
2795
	temp = I915_READ(reg);
2754
	temp = I915_READ(reg);
2796
	temp &= ~((0x7 << 19) | (0x7 << 16));
2755
	temp &= ~((0x7 << 19) | (0x7 << 16));
2797
	temp |= (intel_crtc->fdi_lanes - 1) << 19;
2756
	temp |= (intel_crtc->fdi_lanes - 1) << 19;
2798
	temp |= (I915_READ(PIPECONF(pipe)) & PIPE_BPC_MASK) << 11;
2757
	temp |= (I915_READ(PIPECONF(pipe)) & PIPECONF_BPC_MASK) << 11;
2799
	I915_WRITE(reg, temp | FDI_RX_PLL_ENABLE);
2758
	I915_WRITE(reg, temp | FDI_RX_PLL_ENABLE);
Line 2800... Line 2759...
2800
 
2759
 
2801
	POSTING_READ(reg);
2760
	POSTING_READ(reg);
Line 2806... Line 2765...
2806
	I915_WRITE(reg, temp | FDI_PCDCLK);
2765
	I915_WRITE(reg, temp | FDI_PCDCLK);
Line 2807... Line 2766...
2807
 
2766
 
2808
	POSTING_READ(reg);
2767
	POSTING_READ(reg);
Line 2809... Line -...
2809
	udelay(200);
-
 
2810
 
-
 
2811
	/* On Haswell, the PLL configuration for ports and pipes is handled
-
 
2812
	 * separately, as part of DDI setup */
2768
	udelay(200);
2813
	if (!IS_HASWELL(dev)) {
2769
 
2814
	/* Enable CPU FDI TX PLL, always on for Ironlake */
2770
	/* Enable CPU FDI TX PLL, always on for Ironlake */
2815
	reg = FDI_TX_CTL(pipe);
2771
	reg = FDI_TX_CTL(pipe);
2816
	temp = I915_READ(reg);
2772
	temp = I915_READ(reg);
Line 2817... Line 2773...
2817
	if ((temp & FDI_TX_PLL_ENABLE) == 0) {
2773
	if ((temp & FDI_TX_PLL_ENABLE) == 0) {
2818
		I915_WRITE(reg, temp | FDI_TX_PLL_ENABLE);
2774
		I915_WRITE(reg, temp | FDI_TX_PLL_ENABLE);
2819
 
2775
 
2820
		POSTING_READ(reg);
2776
		POSTING_READ(reg);
2821
		udelay(100);
-
 
Line 2822... Line 2777...
2822
	}
2777
		udelay(100);
2823
	}
2778
	}
2824
}
2779
}
2825
 
2780
 
Line 2867... Line 2822...
2867
	POSTING_READ(reg);
2822
	POSTING_READ(reg);
Line 2868... Line 2823...
2868
 
2823
 
2869
	reg = FDI_RX_CTL(pipe);
2824
	reg = FDI_RX_CTL(pipe);
2870
	temp = I915_READ(reg);
2825
	temp = I915_READ(reg);
2871
	temp &= ~(0x7 << 16);
2826
	temp &= ~(0x7 << 16);
2872
	temp |= (I915_READ(PIPECONF(pipe)) & PIPE_BPC_MASK) << 11;
2827
	temp |= (I915_READ(PIPECONF(pipe)) & PIPECONF_BPC_MASK) << 11;
Line 2873... Line 2828...
2873
	I915_WRITE(reg, temp & ~FDI_RX_ENABLE);
2828
	I915_WRITE(reg, temp & ~FDI_RX_ENABLE);
2874
 
2829
 
Line 2896... Line 2851...
2896
		temp &= ~FDI_LINK_TRAIN_NONE;
2851
		temp &= ~FDI_LINK_TRAIN_NONE;
2897
		temp |= FDI_LINK_TRAIN_PATTERN_1;
2852
		temp |= FDI_LINK_TRAIN_PATTERN_1;
2898
	}
2853
	}
2899
	/* BPC in FDI rx is consistent with that in PIPECONF */
2854
	/* BPC in FDI rx is consistent with that in PIPECONF */
2900
	temp &= ~(0x07 << 16);
2855
	temp &= ~(0x07 << 16);
2901
	temp |= (I915_READ(PIPECONF(pipe)) & PIPE_BPC_MASK) << 11;
2856
	temp |= (I915_READ(PIPECONF(pipe)) & PIPECONF_BPC_MASK) << 11;
2902
	I915_WRITE(reg, temp);
2857
	I915_WRITE(reg, temp);
Line 2903... Line 2858...
2903
 
2858
 
2904
	POSTING_READ(reg);
2859
	POSTING_READ(reg);
2905
	udelay(100);
2860
	udelay(100);
Line 2906... Line 2861...
2906
}
2861
}
2907
 
2862
 
2908
static bool intel_crtc_has_pending_flip(struct drm_crtc *crtc)
2863
static bool intel_crtc_has_pending_flip(struct drm_crtc *crtc)
2909
{
2864
{
-
 
2865
	struct drm_device *dev = crtc->dev;
2910
	struct drm_device *dev = crtc->dev;
2866
	struct drm_i915_private *dev_priv = dev->dev_private;
2911
	struct drm_i915_private *dev_priv = dev->dev_private;
2867
	struct intel_crtc *intel_crtc = to_intel_crtc(crtc);
Line 2912... Line 2868...
2912
	unsigned long flags;
2868
	unsigned long flags;
-
 
2869
	bool pending;
2913
	bool pending;
2870
 
Line 2914... Line 2871...
2914
 
2871
	if (i915_reset_in_progress(&dev_priv->gpu_error) ||
2915
	if (atomic_read(&dev_priv->mm.wedged))
2872
	    intel_crtc->reset_counter != atomic_read(&dev_priv->gpu_error.reset_counter))
2916
		return false;
2873
		return false;
Line 2929... Line 2886...
2929
	struct drm_i915_private *dev_priv = dev->dev_private;
2886
	struct drm_i915_private *dev_priv = dev->dev_private;
Line 2930... Line 2887...
2930
 
2887
 
2931
	if (crtc->fb == NULL)
2888
	if (crtc->fb == NULL)
Line -... Line 2889...
-
 
2889
		return;
-
 
2890
 
2932
		return;
2891
	WARN_ON(waitqueue_active(&dev_priv->pending_flip_queue));
2933
 
2892
 
Line 2934... Line 2893...
2934
	wait_event(dev_priv->pending_flip_queue,
2893
	wait_event(dev_priv->pending_flip_queue,
2935
		   !intel_crtc_has_pending_flip(crtc));
2894
		   !intel_crtc_has_pending_flip(crtc));
Line 2972... Line 2931...
2972
	struct drm_device *dev = crtc->dev;
2931
	struct drm_device *dev = crtc->dev;
2973
	struct drm_i915_private *dev_priv = dev->dev_private;
2932
	struct drm_i915_private *dev_priv = dev->dev_private;
2974
	u32 divsel, phaseinc, auxdiv, phasedir = 0;
2933
	u32 divsel, phaseinc, auxdiv, phasedir = 0;
2975
	u32 temp;
2934
	u32 temp;
Line -... Line 2935...
-
 
2935
 
-
 
2936
	mutex_lock(&dev_priv->dpio_lock);
2976
 
2937
 
2977
	/* It is necessary to ungate the pixclk gate prior to programming
2938
	/* It is necessary to ungate the pixclk gate prior to programming
2978
	 * the divisors, and gate it back when it is done.
2939
	 * the divisors, and gate it back when it is done.
2979
	 */
2940
	 */
Line 3046... Line 3007...
3046
 
3007
 
3047
	/* Wait for initialization time */
3008
	/* Wait for initialization time */
Line 3048... Line 3009...
3048
	udelay(24);
3009
	udelay(24);
-
 
3010
 
-
 
3011
	I915_WRITE(PIXCLK_GATE, PIXCLK_GATE_UNGATE);
3049
 
3012
 
Line 3050... Line 3013...
3050
	I915_WRITE(PIXCLK_GATE, PIXCLK_GATE_UNGATE);
3013
	mutex_unlock(&dev_priv->dpio_lock);
3051
}
3014
}
3052
 
3015
 
Line 3126... Line 3089...
3126
 
3089
 
3127
	/* For PCH DP, enable TRANS_DP_CTL */
3090
	/* For PCH DP, enable TRANS_DP_CTL */
3128
	if (HAS_PCH_CPT(dev) &&
3091
	if (HAS_PCH_CPT(dev) &&
3129
	    (intel_pipe_has_type(crtc, INTEL_OUTPUT_DISPLAYPORT) ||
3092
	    (intel_pipe_has_type(crtc, INTEL_OUTPUT_DISPLAYPORT) ||
3130
	     intel_pipe_has_type(crtc, INTEL_OUTPUT_EDP))) {
3093
	     intel_pipe_has_type(crtc, INTEL_OUTPUT_EDP))) {
3131
		u32 bpc = (I915_READ(PIPECONF(pipe)) & PIPE_BPC_MASK) >> 5;
3094
		u32 bpc = (I915_READ(PIPECONF(pipe)) & PIPECONF_BPC_MASK) >> 5;
3132
		reg = TRANS_DP_CTL(pipe);
3095
		reg = TRANS_DP_CTL(pipe);
3133
		temp = I915_READ(reg);
3096
		temp = I915_READ(reg);
3134
		temp &= ~(TRANS_DP_PORT_SEL_MASK |
3097
		temp &= ~(TRANS_DP_PORT_SEL_MASK |
3135
			  TRANS_DP_SYNC_MASK |
3098
			  TRANS_DP_SYNC_MASK |
Line 3600... Line 3563...
3600
{
3563
{
3601
	struct intel_crtc *intel_crtc = to_intel_crtc(crtc);
3564
	struct intel_crtc *intel_crtc = to_intel_crtc(crtc);
Line 3602... Line 3565...
3602
 
3565
 
3603
	/* Stop saying we're using TRANSCODER_EDP because some other CRTC might
3566
	/* Stop saying we're using TRANSCODER_EDP because some other CRTC might
3604
	 * start using it. */
3567
	 * start using it. */
Line 3605... Line 3568...
3605
	intel_crtc->cpu_transcoder = intel_crtc->pipe;
3568
	intel_crtc->cpu_transcoder = (enum transcoder) intel_crtc->pipe;
3606
 
3569
 
Line 3607... Line 3570...
3607
	intel_ddi_put_crtc_pll(crtc);
3570
	intel_ddi_put_crtc_pll(crtc);
Line 3623... Line 3586...
3623
	/* Let userspace switch the overlay on again. In most cases userspace
3586
	/* Let userspace switch the overlay on again. In most cases userspace
3624
	 * has to recompute where to put it anyway.
3587
	 * has to recompute where to put it anyway.
3625
	 */
3588
	 */
3626
}
3589
}
Line -... Line 3590...
-
 
3590
 
-
 
3591
/**
-
 
3592
 * i9xx_fixup_plane - ugly workaround for G45 to fire up the hardware
-
 
3593
 * cursor plane briefly if not already running after enabling the display
-
 
3594
 * plane.
-
 
3595
 * This workaround avoids occasional blank screens when self refresh is
-
 
3596
 * enabled.
-
 
3597
 */
-
 
3598
static void
-
 
3599
g4x_fixup_plane(struct drm_i915_private *dev_priv, enum pipe pipe)
-
 
3600
{
-
 
3601
	u32 cntl = I915_READ(CURCNTR(pipe));
-
 
3602
 
-
 
3603
	if ((cntl & CURSOR_MODE) == 0) {
-
 
3604
		u32 fw_bcl_self = I915_READ(FW_BLC_SELF);
-
 
3605
 
-
 
3606
		I915_WRITE(FW_BLC_SELF, fw_bcl_self & ~FW_BLC_SELF_EN);
-
 
3607
		I915_WRITE(CURCNTR(pipe), CURSOR_MODE_64_ARGB_AX);
-
 
3608
		intel_wait_for_vblank(dev_priv->dev, pipe);
-
 
3609
		I915_WRITE(CURCNTR(pipe), cntl);
-
 
3610
		I915_WRITE(CURBASE(pipe), I915_READ(CURBASE(pipe)));
-
 
3611
		I915_WRITE(FW_BLC_SELF, fw_bcl_self);
-
 
3612
	}
-
 
3613
}
3627
 
3614
 
3628
static void i9xx_crtc_enable(struct drm_crtc *crtc)
3615
static void i9xx_crtc_enable(struct drm_crtc *crtc)
3629
{
3616
{
3630
    struct drm_device *dev = crtc->dev;
3617
    struct drm_device *dev = crtc->dev;
3631
    struct drm_i915_private *dev_priv = dev->dev_private;
3618
    struct drm_i915_private *dev_priv = dev->dev_private;
Line 3641... Line 3628...
3641
 
3628
 
3642
    intel_crtc->active = true;
3629
    intel_crtc->active = true;
Line 3643... Line 3630...
3643
    intel_update_watermarks(dev);
3630
    intel_update_watermarks(dev);
-
 
3631
 
-
 
3632
    intel_enable_pll(dev_priv, pipe);
-
 
3633
 
-
 
3634
	for_each_encoder_on_crtc(dev, crtc, encoder)
-
 
3635
		if (encoder->pre_enable)
3644
 
3636
			encoder->pre_enable(encoder);
3645
    intel_enable_pll(dev_priv, pipe);
3637
 
-
 
3638
    intel_enable_pipe(dev_priv, pipe, false);
-
 
3639
    intel_enable_plane(dev_priv, plane, pipe);
Line 3646... Line 3640...
3646
    intel_enable_pipe(dev_priv, pipe, false);
3640
	if (IS_G4X(dev))
3647
    intel_enable_plane(dev_priv, plane, pipe);
3641
		g4x_fixup_plane(dev_priv, pipe);
Line 3648... Line 3642...
3648
 
3642
 
Line 3663... Line 3657...
3663
    struct drm_i915_private *dev_priv = dev->dev_private;
3657
    struct drm_i915_private *dev_priv = dev->dev_private;
3664
    struct intel_crtc *intel_crtc = to_intel_crtc(crtc);
3658
    struct intel_crtc *intel_crtc = to_intel_crtc(crtc);
3665
	struct intel_encoder *encoder;
3659
	struct intel_encoder *encoder;
3666
    int pipe = intel_crtc->pipe;
3660
    int pipe = intel_crtc->pipe;
3667
    int plane = intel_crtc->plane;
3661
    int plane = intel_crtc->plane;
-
 
3662
	u32 pctl;
Line 3668... Line 3663...
3668
 
3663
 
3669
 
3664
 
Line 3682... Line 3677...
3682
    if (dev_priv->cfb_plane == plane)
3677
    if (dev_priv->cfb_plane == plane)
3683
        intel_disable_fbc(dev);
3678
        intel_disable_fbc(dev);
Line 3684... Line 3679...
3684
 
3679
 
3685
    intel_disable_plane(dev_priv, plane, pipe);
3680
    intel_disable_plane(dev_priv, plane, pipe);
-
 
3681
    intel_disable_pipe(dev_priv, pipe);
-
 
3682
 
-
 
3683
	/* Disable pannel fitter if it is on this pipe. */
-
 
3684
	pctl = I915_READ(PFIT_CONTROL);
-
 
3685
	if ((pctl & PFIT_ENABLE) &&
-
 
3686
	    ((pctl & PFIT_PIPE_MASK) >> PFIT_PIPE_SHIFT) == pipe)
-
 
3687
		I915_WRITE(PFIT_CONTROL, 0);
3686
    intel_disable_pipe(dev_priv, pipe);
3688
 
Line 3687... Line 3689...
3687
    intel_disable_pll(dev_priv, pipe);
3689
    intel_disable_pll(dev_priv, pipe);
3688
 
3690
 
3689
    intel_crtc->active = false;
3691
    intel_crtc->active = false;
Line 3748... Line 3750...
3748
		dev_priv->display.crtc_disable(crtc);
3750
		dev_priv->display.crtc_disable(crtc);
Line 3749... Line 3751...
3749
 
3751
 
3750
	intel_crtc_update_sarea(crtc, enable);
3752
	intel_crtc_update_sarea(crtc, enable);
Line 3751... Line -...
3751
}
-
 
3752
 
-
 
3753
static void intel_crtc_noop(struct drm_crtc *crtc)
-
 
3754
{
-
 
3755
}
3753
}
3756
 
3754
 
3757
static void intel_crtc_disable(struct drm_crtc *crtc)
3755
static void intel_crtc_disable(struct drm_crtc *crtc)
3758
{
3756
{
3759
	struct drm_device *dev = crtc->dev;
3757
	struct drm_device *dev = crtc->dev;
-
 
3758
	struct drm_connector *connector;
Line 3760... Line 3759...
3760
	struct drm_connector *connector;
3759
	struct drm_i915_private *dev_priv = dev->dev_private;
3761
	struct drm_i915_private *dev_priv = dev->dev_private;
3760
	struct intel_crtc *intel_crtc = to_intel_crtc(crtc);
Line -... Line 3761...
-
 
3761
 
3762
 
3762
	/* crtc should still be enabled when we disable it. */
3763
	/* crtc should still be enabled when we disable it. */
3763
	WARN_ON(!crtc->enabled);
3764
	WARN_ON(!crtc->enabled);
3764
 
Line 3765... Line 3765...
3765
 
3765
	intel_crtc->eld_vld = false;
Line 3798... Line 3798...
3798
		if (crtc->enabled)
3798
		if (crtc->enabled)
3799
			intel_crtc_disable(crtc);
3799
			intel_crtc_disable(crtc);
3800
	}
3800
	}
3801
}
3801
}
Line 3802... Line -...
3802
 
-
 
3803
void intel_encoder_noop(struct drm_encoder *encoder)
-
 
3804
{
-
 
3805
}
-
 
3806
 
3802
 
3807
void intel_encoder_destroy(struct drm_encoder *encoder)
3803
void intel_encoder_destroy(struct drm_encoder *encoder)
3808
{
3804
{
Line 3809... Line 3805...
3809
	struct intel_encoder *intel_encoder = to_intel_encoder(encoder);
3805
	struct intel_encoder *intel_encoder = to_intel_encoder(encoder);
Line 3993... Line 3989...
3993
static int i830_get_display_clock_speed(struct drm_device *dev)
3989
static int i830_get_display_clock_speed(struct drm_device *dev)
3994
{
3990
{
3995
	return 133000;
3991
	return 133000;
3996
}
3992
}
Line 3997... Line -...
3997
 
-
 
3998
struct fdi_m_n {
-
 
3999
    u32        tu;
-
 
4000
    u32        gmch_m;
-
 
4001
    u32        gmch_n;
-
 
4002
    u32        link_m;
-
 
4003
    u32        link_n;
-
 
4004
};
-
 
4005
 
3993
 
4006
static void
3994
static void
4007
fdi_reduce_ratio(u32 *num, u32 *den)
3995
intel_reduce_ratio(uint32_t *num, uint32_t *den)
4008
{
3996
{
4009
	while (*num > 0xffffff || *den > 0xffffff) {
3997
	while (*num > 0xffffff || *den > 0xffffff) {
4010
		*num >>= 1;
3998
		*num >>= 1;
4011
		*den >>= 1;
3999
		*den >>= 1;
4012
	}
4000
	}
Line 4013... Line 4001...
4013
}
4001
}
4014
 
4002
 
4015
static void
4003
void
-
 
4004
intel_link_compute_m_n(int bits_per_pixel, int nlanes,
4016
ironlake_compute_m_n(int bits_per_pixel, int nlanes, int pixel_clock,
4005
		       int pixel_clock, int link_clock,
4017
		     int link_clock, struct fdi_m_n *m_n)
4006
		       struct intel_link_m_n *m_n)
4018
{
-
 
4019
	m_n->tu = 64; /* default size */
-
 
4020
 
4007
{
4021
	/* BUG_ON(pixel_clock > INT_MAX / 36); */
4008
	m_n->tu = 64;
4022
	m_n->gmch_m = bits_per_pixel * pixel_clock;
4009
	m_n->gmch_m = bits_per_pixel * pixel_clock;
4023
	m_n->gmch_n = link_clock * nlanes * 8;
-
 
4024
	fdi_reduce_ratio(&m_n->gmch_m, &m_n->gmch_n);
4010
	m_n->gmch_n = link_clock * nlanes * 8;
4025
 
4011
	intel_reduce_ratio(&m_n->gmch_m, &m_n->gmch_n);
4026
	m_n->link_m = pixel_clock;
4012
	m_n->link_m = pixel_clock;
4027
	m_n->link_n = link_clock;
4013
	m_n->link_n = link_clock;
Line 4028... Line 4014...
4028
	fdi_reduce_ratio(&m_n->link_m, &m_n->link_n);
4014
	intel_reduce_ratio(&m_n->link_m, &m_n->link_n);
4029
}
4015
}
4030
 
4016
 
Line 4270... Line 4256...
4270
	} else {
4256
	} else {
4271
		I915_WRITE(FP1(pipe), fp);
4257
		I915_WRITE(FP1(pipe), fp);
4272
	}
4258
	}
4273
}
4259
}
Line 4274... Line -...
4274
 
-
 
4275
static void intel_update_lvds(struct drm_crtc *crtc, intel_clock_t *clock,
-
 
4276
			      struct drm_display_mode *adjusted_mode)
-
 
4277
{
-
 
4278
	struct drm_device *dev = crtc->dev;
-
 
4279
	struct drm_i915_private *dev_priv = dev->dev_private;
-
 
4280
	struct intel_crtc *intel_crtc = to_intel_crtc(crtc);
-
 
4281
	int pipe = intel_crtc->pipe;
-
 
4282
	u32 temp;
-
 
4283
 
-
 
4284
	temp = I915_READ(LVDS);
-
 
4285
	temp |= LVDS_PORT_EN | LVDS_A0A2_CLKA_POWER_UP;
-
 
4286
	if (pipe == 1) {
-
 
4287
		temp |= LVDS_PIPEB_SELECT;
-
 
4288
	} else {
-
 
4289
		temp &= ~LVDS_PIPEB_SELECT;
-
 
4290
	}
-
 
4291
	/* set the corresponsding LVDS_BORDER bit */
-
 
4292
	temp |= dev_priv->lvds_border_bits;
-
 
4293
	/* Set the B0-B3 data pairs corresponding to whether we're going to
-
 
4294
	 * set the DPLLs for dual-channel mode or not.
-
 
4295
	 */
-
 
4296
	if (clock->p2 == 7)
-
 
4297
		temp |= LVDS_B0B3_POWER_UP | LVDS_CLKB_POWER_UP;
-
 
4298
	else
-
 
4299
		temp &= ~(LVDS_B0B3_POWER_UP | LVDS_CLKB_POWER_UP);
-
 
4300
 
-
 
4301
	/* It would be nice to set 24 vs 18-bit mode (LVDS_A3_POWER_UP)
-
 
4302
	 * appropriately here, but we need to look more thoroughly into how
-
 
4303
	 * panels behave in the two modes.
-
 
4304
	 */
-
 
4305
	/* set the dithering flag on LVDS as needed */
-
 
4306
	if (INTEL_INFO(dev)->gen >= 4) {
-
 
4307
		if (dev_priv->lvds_dither)
-
 
4308
			temp |= LVDS_ENABLE_DITHER;
-
 
4309
		else
-
 
4310
			temp &= ~LVDS_ENABLE_DITHER;
-
 
4311
	}
-
 
4312
	temp &= ~(LVDS_HSYNC_POLARITY | LVDS_VSYNC_POLARITY);
-
 
4313
	if (adjusted_mode->flags & DRM_MODE_FLAG_NHSYNC)
-
 
4314
		temp |= LVDS_HSYNC_POLARITY;
-
 
4315
	if (adjusted_mode->flags & DRM_MODE_FLAG_NVSYNC)
-
 
4316
		temp |= LVDS_VSYNC_POLARITY;
-
 
4317
	I915_WRITE(LVDS, temp);
-
 
4318
}
-
 
4319
 
4260
 
4320
static void vlv_update_pll(struct drm_crtc *crtc,
4261
static void vlv_update_pll(struct drm_crtc *crtc,
4321
			   struct drm_display_mode *mode,
4262
			   struct drm_display_mode *mode,
4322
			   struct drm_display_mode *adjusted_mode,
4263
			   struct drm_display_mode *adjusted_mode,
4323
			   intel_clock_t *clock, intel_clock_t *reduced_clock,
4264
			   intel_clock_t *clock, intel_clock_t *reduced_clock,
Line 4330... Line 4271...
4330
	u32 dpll, mdiv, pdiv;
4271
	u32 dpll, mdiv, pdiv;
4331
	u32 bestn, bestm1, bestm2, bestp1, bestp2;
4272
	u32 bestn, bestm1, bestm2, bestp1, bestp2;
4332
	bool is_sdvo;
4273
	bool is_sdvo;
4333
	u32 temp;
4274
	u32 temp;
Line -... Line 4275...
-
 
4275
 
-
 
4276
	mutex_lock(&dev_priv->dpio_lock);
4334
 
4277
 
4335
	is_sdvo = intel_pipe_has_type(crtc, INTEL_OUTPUT_SDVO) ||
4278
	is_sdvo = intel_pipe_has_type(crtc, INTEL_OUTPUT_SDVO) ||
Line 4336... Line 4279...
4336
		intel_pipe_has_type(crtc, INTEL_OUTPUT_HDMI);
4279
		intel_pipe_has_type(crtc, INTEL_OUTPUT_HDMI);
4337
 
4280
 
Line 4413... Line 4356...
4413
		temp = 0x1000C4;
4356
		temp = 0x1000C4;
4414
		if(pipe == 1)
4357
		if(pipe == 1)
4415
			temp |= (1 << 21);
4358
			temp |= (1 << 21);
4416
		intel_dpio_write(dev_priv, DPIO_DATA_CHANNEL2, temp);
4359
		intel_dpio_write(dev_priv, DPIO_DATA_CHANNEL2, temp);
4417
	}
4360
	}
-
 
4361
 
-
 
4362
	mutex_unlock(&dev_priv->dpio_lock);
4418
}
4363
}
Line 4419... Line 4364...
4419
 
4364
 
4420
static void i9xx_update_pll(struct drm_crtc *crtc,
4365
static void i9xx_update_pll(struct drm_crtc *crtc,
4421
			    struct drm_display_mode *mode,
4366
			    struct drm_display_mode *mode,
Line 4424... Line 4369...
4424
			    int num_connectors)
4369
			    int num_connectors)
4425
{
4370
{
4426
	struct drm_device *dev = crtc->dev;
4371
	struct drm_device *dev = crtc->dev;
4427
	struct drm_i915_private *dev_priv = dev->dev_private;
4372
	struct drm_i915_private *dev_priv = dev->dev_private;
4428
	struct intel_crtc *intel_crtc = to_intel_crtc(crtc);
4373
	struct intel_crtc *intel_crtc = to_intel_crtc(crtc);
-
 
4374
	struct intel_encoder *encoder;
4429
	int pipe = intel_crtc->pipe;
4375
	int pipe = intel_crtc->pipe;
4430
	u32 dpll;
4376
	u32 dpll;
4431
	bool is_sdvo;
4377
	bool is_sdvo;
Line 4432... Line 4378...
4432
 
4378
 
Line 4492... Line 4438...
4492
	dpll |= DPLL_VCO_ENABLE;
4438
	dpll |= DPLL_VCO_ENABLE;
4493
	I915_WRITE(DPLL(pipe), dpll & ~DPLL_VCO_ENABLE);
4439
	I915_WRITE(DPLL(pipe), dpll & ~DPLL_VCO_ENABLE);
4494
	POSTING_READ(DPLL(pipe));
4440
	POSTING_READ(DPLL(pipe));
4495
	udelay(150);
4441
	udelay(150);
Line 4496... Line 4442...
4496
 
4442
 
4497
	/* The LVDS pin pair needs to be on before the DPLLs are enabled.
-
 
4498
	 * This is an exception to the general rule that mode_set doesn't turn
-
 
4499
	 * things on.
-
 
4500
	 */
4443
	for_each_encoder_on_crtc(dev, crtc, encoder)
4501
	if (intel_pipe_has_type(crtc, INTEL_OUTPUT_LVDS))
4444
		if (encoder->pre_pll_enable)
Line 4502... Line 4445...
4502
		intel_update_lvds(crtc, clock, adjusted_mode);
4445
			encoder->pre_pll_enable(encoder);
4503
 
4446
 
Line 4504... Line 4447...
4504
	if (intel_pipe_has_type(crtc, INTEL_OUTPUT_DISPLAYPORT))
4447
	if (intel_pipe_has_type(crtc, INTEL_OUTPUT_DISPLAYPORT))
Line 4536... Line 4479...
4536
			    int num_connectors)
4479
			    int num_connectors)
4537
{
4480
{
4538
	struct drm_device *dev = crtc->dev;
4481
	struct drm_device *dev = crtc->dev;
4539
	struct drm_i915_private *dev_priv = dev->dev_private;
4482
	struct drm_i915_private *dev_priv = dev->dev_private;
4540
	struct intel_crtc *intel_crtc = to_intel_crtc(crtc);
4483
	struct intel_crtc *intel_crtc = to_intel_crtc(crtc);
-
 
4484
	struct intel_encoder *encoder;
4541
	int pipe = intel_crtc->pipe;
4485
	int pipe = intel_crtc->pipe;
4542
	u32 dpll;
4486
	u32 dpll;
Line 4543... Line 4487...
4543
 
4487
 
Line 4569... Line 4513...
4569
	dpll |= DPLL_VCO_ENABLE;
4513
	dpll |= DPLL_VCO_ENABLE;
4570
	I915_WRITE(DPLL(pipe), dpll & ~DPLL_VCO_ENABLE);
4514
	I915_WRITE(DPLL(pipe), dpll & ~DPLL_VCO_ENABLE);
4571
	POSTING_READ(DPLL(pipe));
4515
	POSTING_READ(DPLL(pipe));
4572
	udelay(150);
4516
	udelay(150);
Line 4573... Line 4517...
4573
 
4517
 
4574
	/* The LVDS pin pair needs to be on before the DPLLs are enabled.
-
 
4575
	 * This is an exception to the general rule that mode_set doesn't turn
-
 
4576
	 * things on.
-
 
4577
	 */
4518
	for_each_encoder_on_crtc(dev, crtc, encoder)
4578
	if (intel_pipe_has_type(crtc, INTEL_OUTPUT_LVDS))
4519
		if (encoder->pre_pll_enable)
Line 4579... Line 4520...
4579
		intel_update_lvds(crtc, clock, adjusted_mode);
4520
			encoder->pre_pll_enable(encoder);
Line 4580... Line 4521...
4580
 
4521
 
4581
	I915_WRITE(DPLL(pipe), dpll);
4522
	I915_WRITE(DPLL(pipe), dpll);
Line 4764... Line 4705...
4764
		else
4705
		else
4765
			pipeconf &= ~PIPECONF_DOUBLE_WIDE;
4706
			pipeconf &= ~PIPECONF_DOUBLE_WIDE;
4766
		}
4707
		}
Line 4767... Line 4708...
4767
 
4708
 
4768
	/* default to 8bpc */
4709
	/* default to 8bpc */
4769
	pipeconf &= ~(PIPECONF_BPP_MASK | PIPECONF_DITHER_EN);
4710
	pipeconf &= ~(PIPECONF_BPC_MASK | PIPECONF_DITHER_EN);
4770
	if (is_dp) {
4711
	if (is_dp) {
4771
		if (adjusted_mode->private_flags & INTEL_MODE_DP_FORCE_6BPC) {
4712
		if (adjusted_mode->private_flags & INTEL_MODE_DP_FORCE_6BPC) {
4772
			pipeconf |= PIPECONF_BPP_6 |
4713
			pipeconf |= PIPECONF_6BPC |
4773
				    PIPECONF_DITHER_EN |
4714
				    PIPECONF_DITHER_EN |
4774
				    PIPECONF_DITHER_TYPE_SP;
4715
				    PIPECONF_DITHER_TYPE_SP;
4775
			}
4716
			}
Line 4776... Line 4717...
4776
		}
4717
		}
4777
 
4718
 
4778
	if (IS_VALLEYVIEW(dev) && intel_pipe_has_type(crtc, INTEL_OUTPUT_EDP)) {
4719
	if (IS_VALLEYVIEW(dev) && intel_pipe_has_type(crtc, INTEL_OUTPUT_EDP)) {
4779
		if (adjusted_mode->private_flags & INTEL_MODE_DP_FORCE_6BPC) {
4720
		if (adjusted_mode->private_flags & INTEL_MODE_DP_FORCE_6BPC) {
4780
			pipeconf |= PIPECONF_BPP_6 |
4721
			pipeconf |= PIPECONF_6BPC |
4781
					PIPECONF_ENABLE |
4722
					PIPECONF_ENABLE |
4782
					I965_PIPECONF_ACTIVE;
4723
					I965_PIPECONF_ACTIVE;
Line 4962... Line 4903...
4962
	}
4903
	}
Line 4963... Line 4904...
4963
 
4904
 
4964
	if (!has_vga)
4905
	if (!has_vga)
Line -... Line 4906...
-
 
4906
		return;
-
 
4907
 
4965
		return;
4908
	mutex_lock(&dev_priv->dpio_lock);
4966
 
4909
 
4967
	/* XXX: Rip out SDV support once Haswell ships for real. */
4910
	/* XXX: Rip out SDV support once Haswell ships for real. */
Line 4968... Line 4911...
4968
	if (IS_HASWELL(dev) && (dev->pci_device & 0xFF00) == 0x0C00)
4911
	if (IS_HASWELL(dev) && (dev->pci_device & 0xFF00) == 0x0C00)
Line 5104... Line 5047...
5104
 
5047
 
5105
	/* ULT uses SBI_GEN0, but ULT doesn't have VGA, so we don't care. */
5048
	/* ULT uses SBI_GEN0, but ULT doesn't have VGA, so we don't care. */
5106
	tmp = intel_sbi_read(dev_priv, SBI_DBUFF0, SBI_ICLK);
5049
	tmp = intel_sbi_read(dev_priv, SBI_DBUFF0, SBI_ICLK);
5107
	tmp |= SBI_DBUFF0_ENABLE;
5050
	tmp |= SBI_DBUFF0_ENABLE;
-
 
5051
	intel_sbi_write(dev_priv, SBI_DBUFF0, tmp, SBI_ICLK);
-
 
5052
 
5108
	intel_sbi_write(dev_priv, SBI_DBUFF0, tmp, SBI_ICLK);
5053
	mutex_unlock(&dev_priv->dpio_lock);
Line 5109... Line 5054...
5109
}
5054
}
5110
 
5055
 
5111
/*
5056
/*
Line 5158... Line 5103...
5158
	int pipe = intel_crtc->pipe;
5103
	int pipe = intel_crtc->pipe;
5159
	uint32_t val;
5104
	uint32_t val;
Line 5160... Line 5105...
5160
 
5105
 
Line 5161... Line 5106...
5161
	val = I915_READ(PIPECONF(pipe));
5106
	val = I915_READ(PIPECONF(pipe));
5162
 
5107
 
5163
	val &= ~PIPE_BPC_MASK;
5108
	val &= ~PIPECONF_BPC_MASK;
5164
	switch (intel_crtc->bpp) {
5109
	switch (intel_crtc->bpp) {
5165
	case 18:
5110
	case 18:
5166
		val |= PIPE_6BPC;
5111
		val |= PIPECONF_6BPC;
5167
		break;
5112
		break;
5168
	case 24:
5113
	case 24:
5169
		val |= PIPE_8BPC;
5114
		val |= PIPECONF_8BPC;
5170
		break;
5115
		break;
5171
	case 30:
5116
	case 30:
5172
		val |= PIPE_10BPC;
5117
		val |= PIPECONF_10BPC;
5173
		break;
5118
		break;
5174
	case 36:
5119
	case 36:
5175
		val |= PIPE_12BPC;
5120
		val |= PIPECONF_12BPC;
5176
		break;
5121
		break;
5177
	default:
5122
	default:
5178
		/* Case prevented by intel_choose_pipe_bpp_dither. */
5123
		/* Case prevented by intel_choose_pipe_bpp_dither. */
Line 5187... Line 5132...
5187
	if (adjusted_mode->flags & DRM_MODE_FLAG_INTERLACE)
5132
	if (adjusted_mode->flags & DRM_MODE_FLAG_INTERLACE)
5188
		val |= PIPECONF_INTERLACED_ILK;
5133
		val |= PIPECONF_INTERLACED_ILK;
5189
	else
5134
	else
5190
		val |= PIPECONF_PROGRESSIVE;
5135
		val |= PIPECONF_PROGRESSIVE;
Line -... Line 5136...
-
 
5136
 
-
 
5137
	if (adjusted_mode->private_flags & INTEL_MODE_LIMITED_COLOR_RANGE)
-
 
5138
		val |= PIPECONF_COLOR_RANGE_SELECT;
-
 
5139
	else
-
 
5140
		val &= ~PIPECONF_COLOR_RANGE_SELECT;
5191
 
5141
 
5192
	I915_WRITE(PIPECONF(pipe), val);
5142
	I915_WRITE(PIPECONF(pipe), val);
5193
	POSTING_READ(PIPECONF(pipe));
5143
	POSTING_READ(PIPECONF(pipe));
Line -... Line 5144...
-
 
5144
}
-
 
5145
 
-
 
5146
/*
-
 
5147
 * Set up the pipe CSC unit.
-
 
5148
 *
-
 
5149
 * Currently only full range RGB to limited range RGB conversion
-
 
5150
 * is supported, but eventually this should handle various
-
 
5151
 * RGB<->YCbCr scenarios as well.
-
 
5152
 */
-
 
5153
static void intel_set_pipe_csc(struct drm_crtc *crtc,
-
 
5154
			       const struct drm_display_mode *adjusted_mode)
-
 
5155
{
-
 
5156
	struct drm_device *dev = crtc->dev;
-
 
5157
	struct drm_i915_private *dev_priv = dev->dev_private;
-
 
5158
	struct intel_crtc *intel_crtc = to_intel_crtc(crtc);
-
 
5159
	int pipe = intel_crtc->pipe;
-
 
5160
	uint16_t coeff = 0x7800; /* 1.0 */
-
 
5161
 
-
 
5162
	/*
-
 
5163
	 * TODO: Check what kind of values actually come out of the pipe
-
 
5164
	 * with these coeff/postoff values and adjust to get the best
-
 
5165
	 * accuracy. Perhaps we even need to take the bpc value into
-
 
5166
	 * consideration.
-
 
5167
	 */
-
 
5168
 
-
 
5169
	if (adjusted_mode->private_flags & INTEL_MODE_LIMITED_COLOR_RANGE)
-
 
5170
		coeff = ((235 - 16) * (1 << 12) / 255) & 0xff8; /* 0.xxx... */
-
 
5171
 
-
 
5172
	/*
-
 
5173
	 * GY/GU and RY/RU should be the other way around according
-
 
5174
	 * to BSpec, but reality doesn't agree. Just set them up in
-
 
5175
	 * a way that results in the correct picture.
-
 
5176
	 */
-
 
5177
	I915_WRITE(PIPE_CSC_COEFF_RY_GY(pipe), coeff << 16);
-
 
5178
	I915_WRITE(PIPE_CSC_COEFF_BY(pipe), 0);
-
 
5179
 
-
 
5180
	I915_WRITE(PIPE_CSC_COEFF_RU_GU(pipe), coeff);
-
 
5181
	I915_WRITE(PIPE_CSC_COEFF_BU(pipe), 0);
-
 
5182
 
-
 
5183
	I915_WRITE(PIPE_CSC_COEFF_RV_GV(pipe), 0);
-
 
5184
	I915_WRITE(PIPE_CSC_COEFF_BV(pipe), coeff << 16);
-
 
5185
 
-
 
5186
	I915_WRITE(PIPE_CSC_PREOFF_HI(pipe), 0);
-
 
5187
	I915_WRITE(PIPE_CSC_PREOFF_ME(pipe), 0);
-
 
5188
	I915_WRITE(PIPE_CSC_PREOFF_LO(pipe), 0);
-
 
5189
 
-
 
5190
	if (INTEL_INFO(dev)->gen > 6) {
-
 
5191
		uint16_t postoff = 0;
-
 
5192
 
-
 
5193
		if (adjusted_mode->private_flags & INTEL_MODE_LIMITED_COLOR_RANGE)
-
 
5194
			postoff = (16 * (1 << 13) / 255) & 0x1fff;
-
 
5195
 
-
 
5196
		I915_WRITE(PIPE_CSC_POSTOFF_HI(pipe), postoff);
-
 
5197
		I915_WRITE(PIPE_CSC_POSTOFF_ME(pipe), postoff);
-
 
5198
		I915_WRITE(PIPE_CSC_POSTOFF_LO(pipe), postoff);
-
 
5199
 
-
 
5200
		I915_WRITE(PIPE_CSC_MODE(pipe), 0);
-
 
5201
	} else {
-
 
5202
		uint32_t mode = CSC_MODE_YUV_TO_RGB;
-
 
5203
 
-
 
5204
		if (adjusted_mode->private_flags & INTEL_MODE_LIMITED_COLOR_RANGE)
-
 
5205
			mode |= CSC_BLACK_SCREEN_OFFSET;
-
 
5206
 
-
 
5207
		I915_WRITE(PIPE_CSC_MODE(pipe), mode);
-
 
5208
	}
5194
}
5209
}
5195
 
5210
 
5196
static void haswell_set_pipeconf(struct drm_crtc *crtc,
5211
static void haswell_set_pipeconf(struct drm_crtc *crtc,
5197
				 struct drm_display_mode *adjusted_mode,
5212
				 struct drm_display_mode *adjusted_mode,
5198
				 bool dither)
5213
				 bool dither)
Line 5381... Line 5396...
5381
    struct drm_device *dev = crtc->dev;
5396
    struct drm_device *dev = crtc->dev;
5382
    struct drm_i915_private *dev_priv = dev->dev_private;
5397
    struct drm_i915_private *dev_priv = dev->dev_private;
5383
    struct intel_crtc *intel_crtc = to_intel_crtc(crtc);
5398
    struct intel_crtc *intel_crtc = to_intel_crtc(crtc);
5384
	enum transcoder cpu_transcoder = intel_crtc->cpu_transcoder;
5399
	enum transcoder cpu_transcoder = intel_crtc->cpu_transcoder;
5385
	struct intel_encoder *intel_encoder, *edp_encoder = NULL;
5400
	struct intel_encoder *intel_encoder, *edp_encoder = NULL;
5386
    struct fdi_m_n m_n = {0};
5401
	struct intel_link_m_n m_n = {0};
5387
	int target_clock, pixel_multiplier, lane, link_bw;
5402
	int target_clock, pixel_multiplier, lane, link_bw;
5388
	bool is_dp = false, is_cpu_edp = false;
5403
	bool is_dp = false, is_cpu_edp = false;
Line 5389... Line 5404...
5389
 
5404
 
5390
	for_each_encoder_on_crtc(dev, crtc, intel_encoder) {
5405
	for_each_encoder_on_crtc(dev, crtc, intel_encoder) {
Line 5433... Line 5448...
5433
 
5448
 
Line 5434... Line 5449...
5434
    intel_crtc->fdi_lanes = lane;
5449
    intel_crtc->fdi_lanes = lane;
5435
 
5450
 
5436
    if (pixel_multiplier > 1)
5451
    if (pixel_multiplier > 1)
5437
        link_bw *= pixel_multiplier;
-
 
Line 5438... Line 5452...
5438
    ironlake_compute_m_n(intel_crtc->bpp, lane, target_clock, link_bw,
5452
        link_bw *= pixel_multiplier;
5439
                 &m_n);
5453
	intel_link_compute_m_n(intel_crtc->bpp, lane, target_clock, link_bw, &m_n);
5440
 
5454
 
5441
	I915_WRITE(PIPE_DATA_M1(cpu_transcoder), TU_SIZE(m_n.tu) | m_n.gmch_m);
5455
	I915_WRITE(PIPE_DATA_M1(cpu_transcoder), TU_SIZE(m_n.tu) | m_n.gmch_m);
Line 5487... Line 5501...
5487
    /* Enable autotuning of the PLL clock (if permissible) */
5501
    /* Enable autotuning of the PLL clock (if permissible) */
5488
    factor = 21;
5502
    factor = 21;
5489
    if (is_lvds) {
5503
    if (is_lvds) {
5490
        if ((intel_panel_use_ssc(dev_priv) &&
5504
        if ((intel_panel_use_ssc(dev_priv) &&
5491
             dev_priv->lvds_ssc_freq == 100) ||
5505
             dev_priv->lvds_ssc_freq == 100) ||
5492
            (I915_READ(PCH_LVDS) & LVDS_CLKB_POWER_MASK) == LVDS_CLKB_POWER_UP)
5506
		    intel_is_dual_link_lvds(dev))
5493
            factor = 25;
5507
            factor = 25;
5494
    } else if (is_sdvo && is_tv)
5508
    } else if (is_sdvo && is_tv)
5495
        factor = 20;
5509
        factor = 20;
Line 5496... Line 5510...
5496
 
5510
 
Line 5562... Line 5576...
5562
	intel_clock_t clock, reduced_clock;
5576
	intel_clock_t clock, reduced_clock;
5563
	u32 dpll, fp = 0, fp2 = 0;
5577
	u32 dpll, fp = 0, fp2 = 0;
5564
	bool ok, has_reduced_clock = false;
5578
	bool ok, has_reduced_clock = false;
5565
	bool is_lvds = false, is_dp = false, is_cpu_edp = false;
5579
	bool is_lvds = false, is_dp = false, is_cpu_edp = false;
5566
	struct intel_encoder *encoder;
5580
	struct intel_encoder *encoder;
5567
	u32 temp;
-
 
5568
	int ret;
5581
	int ret;
5569
	bool dither, fdi_config_ok;
5582
	bool dither, fdi_config_ok;
Line 5570... Line 5583...
5570
 
5583
 
5571
	for_each_encoder_on_crtc(dev, crtc, encoder) {
5584
	for_each_encoder_on_crtc(dev, crtc, encoder) {
Line 5626... Line 5639...
5626
			return -EINVAL;
5639
			return -EINVAL;
5627
        }
5640
        }
5628
	} else
5641
	} else
5629
		intel_put_pch_pll(intel_crtc);
5642
		intel_put_pch_pll(intel_crtc);
Line 5630... Line -...
5630
 
-
 
5631
    /* The LVDS pin pair needs to be on before the DPLLs are enabled.
-
 
5632
     * This is an exception to the general rule that mode_set doesn't turn
-
 
5633
     * things on.
-
 
5634
     */
-
 
5635
    if (is_lvds) {
-
 
5636
        temp = I915_READ(PCH_LVDS);
-
 
5637
        temp |= LVDS_PORT_EN | LVDS_A0A2_CLKA_POWER_UP;
-
 
5638
		if (HAS_PCH_CPT(dev)) {
-
 
5639
			temp &= ~PORT_TRANS_SEL_MASK;
-
 
5640
			temp |= PORT_TRANS_SEL_CPT(pipe);
-
 
5641
		} else {
-
 
5642
			if (pipe == 1)
-
 
5643
                temp |= LVDS_PIPEB_SELECT;
-
 
5644
            else
-
 
5645
                temp &= ~LVDS_PIPEB_SELECT;
-
 
5646
        }
-
 
5647
 
-
 
5648
        /* set the corresponsding LVDS_BORDER bit */
-
 
5649
        temp |= dev_priv->lvds_border_bits;
-
 
5650
        /* Set the B0-B3 data pairs corresponding to whether we're going to
-
 
5651
         * set the DPLLs for dual-channel mode or not.
-
 
5652
         */
-
 
5653
        if (clock.p2 == 7)
-
 
5654
            temp |= LVDS_B0B3_POWER_UP | LVDS_CLKB_POWER_UP;
-
 
5655
        else
-
 
5656
            temp &= ~(LVDS_B0B3_POWER_UP | LVDS_CLKB_POWER_UP);
-
 
5657
 
-
 
5658
        /* It would be nice to set 24 vs 18-bit mode (LVDS_A3_POWER_UP)
-
 
5659
         * appropriately here, but we need to look more thoroughly into how
-
 
5660
         * panels behave in the two modes.
-
 
5661
         */
-
 
5662
		temp &= ~(LVDS_HSYNC_POLARITY | LVDS_VSYNC_POLARITY);
-
 
5663
        if (adjusted_mode->flags & DRM_MODE_FLAG_NHSYNC)
-
 
5664
			temp |= LVDS_HSYNC_POLARITY;
-
 
5665
        if (adjusted_mode->flags & DRM_MODE_FLAG_NVSYNC)
-
 
5666
			temp |= LVDS_VSYNC_POLARITY;
-
 
5667
        I915_WRITE(PCH_LVDS, temp);
-
 
5668
    }
-
 
5669
 
5643
 
5670
	if (is_dp && !is_cpu_edp) {
5644
	if (is_dp && !is_cpu_edp)
5671
        intel_dp_set_m_n(crtc, mode, adjusted_mode);
5645
		intel_dp_set_m_n(crtc, mode, adjusted_mode);
5672
    } else {
5646
 
5673
        /* For non-DP output, clear any trans DP clock recovery setting.*/
5647
	for_each_encoder_on_crtc(dev, crtc, encoder)
5674
        I915_WRITE(TRANSDATA_M1(pipe), 0);
5648
		if (encoder->pre_pll_enable)
5675
        I915_WRITE(TRANSDATA_N1(pipe), 0);
-
 
5676
        I915_WRITE(TRANSDPLINK_M1(pipe), 0);
-
 
5677
        I915_WRITE(TRANSDPLINK_N1(pipe), 0);
-
 
Line 5678... Line 5649...
5678
    }
5649
			encoder->pre_pll_enable(encoder);
5679
 
5650
 
Line 5680... Line 5651...
5680
	if (intel_crtc->pch_pll) {
5651
	if (intel_crtc->pch_pll) {
Line 5708... Line 5679...
5708
	 * ironlake_check_fdi_lanes. */
5679
	 * ironlake_check_fdi_lanes. */
5709
	ironlake_set_m_n(crtc, mode, adjusted_mode);
5680
	ironlake_set_m_n(crtc, mode, adjusted_mode);
Line 5710... Line 5681...
5710
 
5681
 
Line 5711... Line -...
5711
	fdi_config_ok = ironlake_check_fdi_lanes(intel_crtc);
-
 
5712
 
-
 
5713
	if (is_cpu_edp)
-
 
5714
		ironlake_set_pll_edp(crtc, adjusted_mode->clock);
5682
	fdi_config_ok = ironlake_check_fdi_lanes(intel_crtc);
Line 5715... Line 5683...
5715
 
5683
 
Line 5716... Line 5684...
5716
	ironlake_set_pipeconf(crtc, adjusted_mode, dither);
5684
	ironlake_set_pipeconf(crtc, adjusted_mode, dither);
Line 5728... Line 5696...
5728
	intel_update_linetime_watermarks(dev, pipe, adjusted_mode);
5696
	intel_update_linetime_watermarks(dev, pipe, adjusted_mode);
Line 5729... Line 5697...
5729
 
5697
 
5730
	return fdi_config_ok ? ret : -EINVAL;
5698
	return fdi_config_ok ? ret : -EINVAL;
Line -... Line 5699...
-
 
5699
}
-
 
5700
 
-
 
5701
static void haswell_modeset_global_resources(struct drm_device *dev)
-
 
5702
{
-
 
5703
	struct drm_i915_private *dev_priv = dev->dev_private;
-
 
5704
	bool enable = false;
-
 
5705
	struct intel_crtc *crtc;
-
 
5706
	struct intel_encoder *encoder;
-
 
5707
 
-
 
5708
	list_for_each_entry(crtc, &dev->mode_config.crtc_list, base.head) {
-
 
5709
		if (crtc->pipe != PIPE_A && crtc->base.enabled)
-
 
5710
			enable = true;
-
 
5711
		/* XXX: Should check for edp transcoder here, but thanks to init
-
 
5712
		 * sequence that's not yet available. Just in case desktop eDP
-
 
5713
		 * on PORT D is possible on haswell, too. */
-
 
5714
	}
-
 
5715
 
-
 
5716
	list_for_each_entry(encoder, &dev->mode_config.encoder_list,
-
 
5717
			    base.head) {
-
 
5718
		if (encoder->type != INTEL_OUTPUT_EDP &&
-
 
5719
		    encoder->connectors_active)
-
 
5720
			enable = true;
-
 
5721
	}
-
 
5722
 
-
 
5723
	/* Even the eDP panel fitter is outside the always-on well. */
-
 
5724
	if (dev_priv->pch_pf_size)
-
 
5725
		enable = true;
-
 
5726
 
-
 
5727
	intel_set_power_well(dev, enable);
5731
}
5728
}
5732
 
5729
 
5733
static int haswell_crtc_mode_set(struct drm_crtc *crtc,
5730
static int haswell_crtc_mode_set(struct drm_crtc *crtc,
5734
				 struct drm_display_mode *mode,
5731
				 struct drm_display_mode *mode,
5735
				 struct drm_display_mode *adjusted_mode,
5732
				 struct drm_display_mode *adjusted_mode,
Line 5740... Line 5737...
5740
	struct drm_i915_private *dev_priv = dev->dev_private;
5737
	struct drm_i915_private *dev_priv = dev->dev_private;
5741
	struct intel_crtc *intel_crtc = to_intel_crtc(crtc);
5738
	struct intel_crtc *intel_crtc = to_intel_crtc(crtc);
5742
	int pipe = intel_crtc->pipe;
5739
	int pipe = intel_crtc->pipe;
5743
	int plane = intel_crtc->plane;
5740
	int plane = intel_crtc->plane;
5744
	int num_connectors = 0;
5741
	int num_connectors = 0;
5745
	intel_clock_t clock, reduced_clock;
-
 
5746
	u32 dpll = 0, fp = 0, fp2 = 0;
-
 
5747
	bool ok, has_reduced_clock = false;
-
 
5748
	bool is_lvds = false, is_dp = false, is_cpu_edp = false;
5742
	bool is_dp = false, is_cpu_edp = false;
5749
	struct intel_encoder *encoder;
5743
	struct intel_encoder *encoder;
5750
	u32 temp;
-
 
5751
	int ret;
5744
	int ret;
5752
	bool dither;
5745
	bool dither;
Line 5753... Line 5746...
5753
 
5746
 
5754
	for_each_encoder_on_crtc(dev, crtc, encoder) {
5747
	for_each_encoder_on_crtc(dev, crtc, encoder) {
5755
		switch (encoder->type) {
-
 
5756
		case INTEL_OUTPUT_LVDS:
-
 
5757
			is_lvds = true;
-
 
5758
			break;
5748
		switch (encoder->type) {
5759
		case INTEL_OUTPUT_DISPLAYPORT:
5749
		case INTEL_OUTPUT_DISPLAYPORT:
5760
			is_dp = true;
5750
			is_dp = true;
5761
			break;
5751
			break;
5762
		case INTEL_OUTPUT_EDP:
5752
		case INTEL_OUTPUT_EDP:
Line 5787... Line 5777...
5787
	WARN_ON(I915_READ(DSPCNTR(plane)) & DISPLAY_PLANE_ENABLE);
5777
	WARN_ON(I915_READ(DSPCNTR(plane)) & DISPLAY_PLANE_ENABLE);
Line 5788... Line 5778...
5788
 
5778
 
5789
	if (!intel_ddi_pll_mode_set(crtc, adjusted_mode->clock))
5779
	if (!intel_ddi_pll_mode_set(crtc, adjusted_mode->clock))
Line 5790... Line -...
5790
		return -EINVAL;
-
 
5791
 
-
 
5792
	if (HAS_PCH_IBX(dev) || HAS_PCH_CPT(dev)) {
-
 
5793
		ok = ironlake_compute_clocks(crtc, adjusted_mode, &clock,
-
 
5794
					     &has_reduced_clock,
-
 
5795
					     &reduced_clock);
-
 
5796
		if (!ok) {
-
 
5797
			DRM_ERROR("Couldn't find PLL settings for mode!\n");
-
 
5798
			return -EINVAL;
-
 
5799
		}
-
 
5800
	}
5780
		return -EINVAL;
5801
 
5781
 
Line 5802... Line 5782...
5802
	/* Ensure that the cursor is valid for the new mode before changing... */
5782
	/* Ensure that the cursor is valid for the new mode before changing... */
5803
//   intel_crtc_update_cursor(crtc, true);
5783
//   intel_crtc_update_cursor(crtc, true);
5804
 
5784
 
5805
	/* determine panel color depth */
-
 
5806
	dither = intel_choose_pipe_bpp_dither(crtc, fb, &intel_crtc->bpp,
-
 
Line 5807... Line 5785...
5807
					      adjusted_mode);
5785
	/* determine panel color depth */
5808
	if (is_lvds && dev_priv->lvds_dither)
5786
	dither = intel_choose_pipe_bpp_dither(crtc, fb, &intel_crtc->bpp,
Line 5809... Line -...
5809
		dither = true;
-
 
5810
 
-
 
5811
	DRM_DEBUG_KMS("Mode for pipe %d:\n", pipe);
-
 
5812
	drm_mode_debug_printmodeline(mode);
-
 
5813
 
-
 
5814
	if (HAS_PCH_IBX(dev) || HAS_PCH_CPT(dev)) {
-
 
5815
		fp = clock.n << 16 | clock.m1 << 8 | clock.m2;
-
 
5816
		if (has_reduced_clock)
-
 
5817
			fp2 = reduced_clock.n << 16 | reduced_clock.m1 << 8 |
-
 
5818
			      reduced_clock.m2;
-
 
5819
 
-
 
5820
		dpll = ironlake_compute_dpll(intel_crtc, adjusted_mode, &clock,
-
 
5821
					     fp);
-
 
5822
 
-
 
5823
		/* CPU eDP is the only output that doesn't need a PCH PLL of its
-
 
5824
		 * own on pre-Haswell/LPT generation */
-
 
5825
		if (!is_cpu_edp) {
-
 
5826
			struct intel_pch_pll *pll;
-
 
5827
 
-
 
5828
			pll = intel_get_pch_pll(intel_crtc, dpll, fp);
-
 
5829
			if (pll == NULL) {
-
 
5830
				DRM_DEBUG_DRIVER("failed to find PLL for pipe %d\n",
-
 
5831
						 pipe);
-
 
5832
				return -EINVAL;
-
 
5833
			}
-
 
5834
		} else
-
 
5835
			intel_put_pch_pll(intel_crtc);
-
 
5836
 
-
 
5837
		/* The LVDS pin pair needs to be on before the DPLLs are
-
 
5838
		 * enabled.  This is an exception to the general rule that
-
 
5839
		 * mode_set doesn't turn things on.
-
 
5840
		 */
-
 
5841
		if (is_lvds) {
-
 
5842
			temp = I915_READ(PCH_LVDS);
-
 
5843
			temp |= LVDS_PORT_EN | LVDS_A0A2_CLKA_POWER_UP;
-
 
5844
			if (HAS_PCH_CPT(dev)) {
-
 
5845
				temp &= ~PORT_TRANS_SEL_MASK;
-
 
5846
				temp |= PORT_TRANS_SEL_CPT(pipe);
-
 
5847
	} else {
-
 
5848
				if (pipe == 1)
-
 
5849
					temp |= LVDS_PIPEB_SELECT;
-
 
5850
				else
-
 
5851
					temp &= ~LVDS_PIPEB_SELECT;
-
 
5852
			}
-
 
5853
 
-
 
5854
			/* set the corresponsding LVDS_BORDER bit */
-
 
5855
			temp |= dev_priv->lvds_border_bits;
-
 
5856
			/* Set the B0-B3 data pairs corresponding to whether
-
 
5857
			 * we're going to set the DPLLs for dual-channel mode or
-
 
5858
			 * not.
-
 
5859
			 */
-
 
5860
			if (clock.p2 == 7)
-
 
5861
				temp |= LVDS_B0B3_POWER_UP | LVDS_CLKB_POWER_UP;
-
 
5862
			else
-
 
5863
				temp &= ~(LVDS_B0B3_POWER_UP |
-
 
5864
					  LVDS_CLKB_POWER_UP);
-
 
5865
 
-
 
5866
			/* It would be nice to set 24 vs 18-bit mode
-
 
5867
			 * (LVDS_A3_POWER_UP) appropriately here, but we need to
-
 
5868
			 * look more thoroughly into how panels behave in the
-
 
5869
			 * two modes.
-
 
5870
			 */
-
 
5871
			temp &= ~(LVDS_HSYNC_POLARITY | LVDS_VSYNC_POLARITY);
-
 
5872
			if (adjusted_mode->flags & DRM_MODE_FLAG_NHSYNC)
-
 
5873
				temp |= LVDS_HSYNC_POLARITY;
-
 
5874
			if (adjusted_mode->flags & DRM_MODE_FLAG_NVSYNC)
-
 
5875
				temp |= LVDS_VSYNC_POLARITY;
5787
					      adjusted_mode);
5876
			I915_WRITE(PCH_LVDS, temp);
5788
 
5877
		}
-
 
5878
	}
-
 
5879
 
-
 
5880
	if (is_dp && !is_cpu_edp) {
-
 
5881
		intel_dp_set_m_n(crtc, mode, adjusted_mode);
-
 
5882
	} else {
-
 
5883
		if (HAS_PCH_IBX(dev) || HAS_PCH_CPT(dev)) {
-
 
5884
			/* For non-DP output, clear any trans DP clock recovery
-
 
5885
			 * setting.*/
-
 
5886
			I915_WRITE(TRANSDATA_M1(pipe), 0);
-
 
Line 5887... Line 5789...
5887
			I915_WRITE(TRANSDATA_N1(pipe), 0);
5789
	DRM_DEBUG_KMS("Mode for pipe %d:\n", pipe);
5888
			I915_WRITE(TRANSDPLINK_M1(pipe), 0);
-
 
5889
			I915_WRITE(TRANSDPLINK_N1(pipe), 0);
-
 
5890
		}
-
 
5891
	}
-
 
5892
 
-
 
5893
	intel_crtc->lowfreq_avail = false;
-
 
5894
	if (HAS_PCH_IBX(dev) || HAS_PCH_CPT(dev)) {
-
 
5895
		if (intel_crtc->pch_pll) {
-
 
5896
			I915_WRITE(intel_crtc->pch_pll->pll_reg, dpll);
-
 
5897
 
-
 
5898
			/* Wait for the clocks to stabilize. */
-
 
5899
			POSTING_READ(intel_crtc->pch_pll->pll_reg);
-
 
5900
			udelay(150);
-
 
5901
 
-
 
5902
			/* The pixel multiplier can only be updated once the
-
 
5903
			 * DPLL is enabled and the clocks are stable.
-
 
5904
			 *
-
 
5905
			 * So write it again.
-
 
5906
     */
-
 
5907
			I915_WRITE(intel_crtc->pch_pll->pll_reg, dpll);
-
 
5908
		}
-
 
5909
 
-
 
5910
		if (intel_crtc->pch_pll) {
-
 
5911
			if (is_lvds && has_reduced_clock && i915_powersave) {
-
 
5912
				I915_WRITE(intel_crtc->pch_pll->fp1_reg, fp2);
-
 
Line 5913... Line 5790...
5913
				intel_crtc->lowfreq_avail = true;
5790
	drm_mode_debug_printmodeline(mode);
Line 5914... Line 5791...
5914
			} else {
5791
 
5915
				I915_WRITE(intel_crtc->pch_pll->fp1_reg, fp);
5792
	if (is_dp && !is_cpu_edp)
Line 5916... Line -...
5916
			}
-
 
5917
		}
-
 
5918
	}
-
 
5919
 
-
 
5920
	intel_set_pipe_timings(intel_crtc, mode, adjusted_mode);
5793
		intel_dp_set_m_n(crtc, mode, adjusted_mode);
Line -... Line 5794...
-
 
5794
 
-
 
5795
	intel_crtc->lowfreq_avail = false;
5921
 
5796
 
5922
	if (!is_dp || is_cpu_edp)
5797
	intel_set_pipe_timings(intel_crtc, mode, adjusted_mode);
5923
		ironlake_set_m_n(crtc, mode, adjusted_mode);
5798
 
Line 5924... Line 5799...
5924
 
5799
	if (!is_dp || is_cpu_edp)
Line 5925... Line 5800...
5925
	if (HAS_PCH_IBX(dev) || HAS_PCH_CPT(dev))
5800
		ironlake_set_m_n(crtc, mode, adjusted_mode);
Line 6049... Line 5924...
6049
				     struct drm_crtc *crtc)
5924
				     struct drm_crtc *crtc)
6050
{
5925
{
6051
	struct drm_i915_private *dev_priv = connector->dev->dev_private;
5926
	struct drm_i915_private *dev_priv = connector->dev->dev_private;
6052
	uint8_t *eld = connector->eld;
5927
	uint8_t *eld = connector->eld;
6053
	struct drm_device *dev = crtc->dev;
5928
	struct drm_device *dev = crtc->dev;
-
 
5929
	struct intel_crtc *intel_crtc = to_intel_crtc(crtc);
6054
	uint32_t eldv;
5930
	uint32_t eldv;
6055
	uint32_t i;
5931
	uint32_t i;
6056
	int len;
5932
	int len;
6057
	int pipe = to_intel_crtc(crtc)->pipe;
5933
	int pipe = to_intel_crtc(crtc)->pipe;
6058
	int tmp;
5934
	int tmp;
Line 6090... Line 5966...
6090
	I915_WRITE(aud_config, tmp);
5966
	I915_WRITE(aud_config, tmp);
Line 6091... Line 5967...
6091
 
5967
 
Line 6092... Line 5968...
6092
	DRM_DEBUG_DRIVER("ELD on pipe %c\n", pipe_name(pipe));
5968
	DRM_DEBUG_DRIVER("ELD on pipe %c\n", pipe_name(pipe));
-
 
5969
 
Line 6093... Line 5970...
6093
 
5970
	eldv = AUDIO_ELD_VALID_A << (pipe * 4);
6094
	eldv = AUDIO_ELD_VALID_A << (pipe * 4);
5971
	intel_crtc->eld_vld = true;
6095
 
5972
 
6096
	if (intel_pipe_has_type(crtc, INTEL_OUTPUT_DISPLAYPORT)) {
5973
	if (intel_pipe_has_type(crtc, INTEL_OUTPUT_DISPLAYPORT)) {
Line 6326... Line 6203...
6326
			cntl |= CURSOR_MODE_64_ARGB_AX | MCURSOR_GAMMA_ENABLE;
6203
			cntl |= CURSOR_MODE_64_ARGB_AX | MCURSOR_GAMMA_ENABLE;
6327
		} else {
6204
		} else {
6328
			cntl &= ~(CURSOR_MODE | MCURSOR_GAMMA_ENABLE);
6205
			cntl &= ~(CURSOR_MODE | MCURSOR_GAMMA_ENABLE);
6329
			cntl |= CURSOR_MODE_DISABLE;
6206
			cntl |= CURSOR_MODE_DISABLE;
6330
		}
6207
		}
-
 
6208
		if (IS_HASWELL(dev))
-
 
6209
			cntl |= CURSOR_PIPE_CSC_ENABLE;
6331
		I915_WRITE(CURCNTR_IVB(pipe), cntl);
6210
		I915_WRITE(CURCNTR_IVB(pipe), cntl);
Line 6332... Line 6211...
6332
 
6211
 
6333
		intel_crtc->cursor_visible = visible;
6212
		intel_crtc->cursor_visible = visible;
6334
	}
6213
	}
Line 6683... Line 6562...
6683
 
6562
 
6684
	/* See if we already have a CRTC for this connector */
6563
	/* See if we already have a CRTC for this connector */
6685
	if (encoder->crtc) {
6564
	if (encoder->crtc) {
Line -... Line 6565...
-
 
6565
		crtc = encoder->crtc;
-
 
6566
 
6686
		crtc = encoder->crtc;
6567
		mutex_lock(&crtc->mutex);
6687
 
6568
 
Line 6688... Line 6569...
6688
		old->dpms_mode = connector->dpms;
6569
		old->dpms_mode = connector->dpms;
6689
		old->load_detect_temp = false;
6570
		old->load_detect_temp = false;
Line 6712... Line 6593...
6712
	if (!crtc) {
6593
	if (!crtc) {
6713
		DRM_DEBUG_KMS("no pipe available for load-detect\n");
6594
		DRM_DEBUG_KMS("no pipe available for load-detect\n");
6714
		return false;
6595
		return false;
6715
	}
6596
	}
Line -... Line 6597...
-
 
6597
 
6716
 
6598
	mutex_lock(&crtc->mutex);
6717
	intel_encoder->new_crtc = to_intel_crtc(crtc);
6599
	intel_encoder->new_crtc = to_intel_crtc(crtc);
Line 6718... Line 6600...
6718
	to_intel_connector(connector)->new_encoder = intel_encoder;
6600
	to_intel_connector(connector)->new_encoder = intel_encoder;
6719
 
6601
 
Line 6739... Line 6621...
6739
		old->release_fb = fb;
6621
		old->release_fb = fb;
6740
	} else
6622
	} else
6741
		DRM_DEBUG_KMS("reusing fbdev for load-detection framebuffer\n");
6623
		DRM_DEBUG_KMS("reusing fbdev for load-detection framebuffer\n");
6742
	if (IS_ERR(fb)) {
6624
	if (IS_ERR(fb)) {
6743
		DRM_DEBUG_KMS("failed to allocate framebuffer for load-detection\n");
6625
		DRM_DEBUG_KMS("failed to allocate framebuffer for load-detection\n");
-
 
6626
		mutex_unlock(&crtc->mutex);
6744
		return false;
6627
		return false;
6745
	}
6628
	}
Line 6746... Line 6629...
6746
 
6629
 
6747
	if (!intel_set_mode(crtc, mode, 0, 0, fb)) {
6630
	if (intel_set_mode(crtc, mode, 0, 0, fb)) {
6748
		DRM_DEBUG_KMS("failed to set mode on load-detect pipe\n");
6631
		DRM_DEBUG_KMS("failed to set mode on load-detect pipe\n");
6749
		if (old->release_fb)
6632
		if (old->release_fb)
-
 
6633
			old->release_fb->funcs->destroy(old->release_fb);
6750
			old->release_fb->funcs->destroy(old->release_fb);
6634
		mutex_unlock(&crtc->mutex);
6751
		return false;
6635
		return false;
Line 6752... Line 6636...
6752
	}
6636
	}
6753
 
6637
 
Line 6760... Line 6644...
6760
				    struct intel_load_detect_pipe *old)
6644
				    struct intel_load_detect_pipe *old)
6761
{
6645
{
6762
	struct intel_encoder *intel_encoder =
6646
	struct intel_encoder *intel_encoder =
6763
		intel_attached_encoder(connector);
6647
		intel_attached_encoder(connector);
6764
	struct drm_encoder *encoder = &intel_encoder->base;
6648
	struct drm_encoder *encoder = &intel_encoder->base;
-
 
6649
	struct drm_crtc *crtc = encoder->crtc;
Line 6765... Line 6650...
6765
 
6650
 
6766
	DRM_DEBUG_KMS("[CONNECTOR:%d:%s], [ENCODER:%d:%s]\n",
6651
	DRM_DEBUG_KMS("[CONNECTOR:%d:%s], [ENCODER:%d:%s]\n",
6767
		      connector->base.id, drm_get_connector_name(connector),
6652
		      connector->base.id, drm_get_connector_name(connector),
Line 6768... Line 6653...
6768
		      encoder->base.id, drm_get_encoder_name(encoder));
6653
		      encoder->base.id, drm_get_encoder_name(encoder));
6769
 
-
 
6770
	if (old->load_detect_temp) {
-
 
6771
		struct drm_crtc *crtc = encoder->crtc;
6654
 
6772
 
6655
	if (old->load_detect_temp) {
6773
		to_intel_connector(connector)->new_encoder = NULL;
6656
		to_intel_connector(connector)->new_encoder = NULL;
Line 6774... Line 6657...
6774
		intel_encoder->new_crtc = NULL;
6657
		intel_encoder->new_crtc = NULL;
-
 
6658
		intel_set_mode(crtc, NULL, 0, 0, NULL);
6775
		intel_set_mode(crtc, NULL, 0, 0, NULL);
6659
 
-
 
6660
		if (old->release_fb) {
Line -... Line 6661...
-
 
6661
			drm_framebuffer_unregister_private(old->release_fb);
6776
 
6662
			drm_framebuffer_unreference(old->release_fb);
6777
		if (old->release_fb)
6663
		}
Line 6778... Line 6664...
6778
			old->release_fb->funcs->destroy(old->release_fb);
6664
 
6779
 
6665
		mutex_unlock(&crtc->mutex);
6780
		return;
6666
		return;
-
 
6667
	}
-
 
6668
 
6781
	}
6669
	/* Switch crtc and encoder back off if necessary */
Line 6782... Line 6670...
6782
 
6670
	if (old->dpms_mode != DRM_MODE_DPMS_ON)
6783
	/* Switch crtc and encoder back off if necessary */
6671
		connector->funcs->dpms(connector, old->dpms_mode);
6784
	if (old->dpms_mode != DRM_MODE_DPMS_ON)
6672
 
Line 6976... Line 6864...
6976
	i915_update_gfx_val(dev->dev_private);
6864
	i915_update_gfx_val(dev->dev_private);
6977
}
6865
}
Line 6978... Line 6866...
6978
 
6866
 
6979
void intel_mark_idle(struct drm_device *dev)
6867
void intel_mark_idle(struct drm_device *dev)
6980
{
-
 
6981
}
-
 
6982
 
-
 
6983
void intel_mark_fb_busy(struct drm_i915_gem_object *obj)
-
 
6984
{
-
 
6985
	struct drm_device *dev = obj->base.dev;
6868
{
Line 6986... Line -...
6986
	struct drm_crtc *crtc;
-
 
6987
 
-
 
6988
    ENTER();
6869
	struct drm_crtc *crtc;
6989
 
6870
 
Line 6990... Line 6871...
6990
	if (!i915_powersave)
6871
	if (!i915_powersave)
6991
		return;
6872
		return;
6992
 
6873
 
Line 6993... Line -...
6993
	list_for_each_entry(crtc, &dev->mode_config.crtc_list, head) {
-
 
6994
		if (!crtc->fb)
6874
	list_for_each_entry(crtc, &dev->mode_config.crtc_list, head) {
6995
			continue;
6875
		if (!crtc->fb)
6996
 
6876
			continue;
Line 6997... Line 6877...
6997
		if (to_intel_framebuffer(crtc->fb)->obj == obj)
6877
 
6998
			intel_increase_pllclock(crtc);
6878
		intel_decrease_pllclock(crtc);
6999
	}
6879
	}
7000
}
6880
}
Line 7001... Line 6881...
7001
 
6881
 
Line 7010... Line 6890...
7010
	list_for_each_entry(crtc, &dev->mode_config.crtc_list, head) {
6890
	list_for_each_entry(crtc, &dev->mode_config.crtc_list, head) {
7011
		if (!crtc->fb)
6891
		if (!crtc->fb)
7012
			continue;
6892
			continue;
Line 7013... Line 6893...
7013
 
6893
 
7014
		if (to_intel_framebuffer(crtc->fb)->obj == obj)
6894
		if (to_intel_framebuffer(crtc->fb)->obj == obj)
7015
			intel_decrease_pllclock(crtc);
6895
			intel_increase_pllclock(crtc);
7016
	}
6896
	}
Line 7017... Line 6897...
7017
}
6897
}
7018
 
6898
 
Line 7095... Line 6975...
7095
 
6975
 
Line 7096... Line 6976...
7096
	spin_unlock_irqrestore(&dev->event_lock, flags);
6976
	spin_unlock_irqrestore(&dev->event_lock, flags);
Line 7097... Line -...
7097
 
-
 
7098
	obj = work->old_fb_obj;
-
 
7099
 
6977
 
Line 7100... Line 6978...
7100
	atomic_clear_mask(1 << intel_crtc->plane,
6978
	obj = work->old_fb_obj;
Line 7101... Line 6979...
7101
			  &obj->pending_flip.counter);
6979
 
7102
	wake_up(&dev_priv->pending_flip_queue);
6980
	wake_up_all(&dev_priv->pending_flip_queue);
Line 7393... Line 7271...
7393
				struct drm_framebuffer *fb,
7271
				struct drm_framebuffer *fb,
7394
				struct drm_pending_vblank_event *event)
7272
				struct drm_pending_vblank_event *event)
7395
{
7273
{
7396
	struct drm_device *dev = crtc->dev;
7274
	struct drm_device *dev = crtc->dev;
7397
	struct drm_i915_private *dev_priv = dev->dev_private;
7275
	struct drm_i915_private *dev_priv = dev->dev_private;
7398
	struct intel_framebuffer *intel_fb;
7276
	struct drm_framebuffer *old_fb = crtc->fb;
7399
	struct drm_i915_gem_object *obj;
7277
	struct drm_i915_gem_object *obj = to_intel_framebuffer(fb)->obj;
7400
	struct intel_crtc *intel_crtc = to_intel_crtc(crtc);
7278
	struct intel_crtc *intel_crtc = to_intel_crtc(crtc);
7401
	struct intel_unpin_work *work;
7279
	struct intel_unpin_work *work;
7402
	unsigned long flags;
7280
	unsigned long flags;
7403
	int ret;
7281
	int ret;
Line 7419... Line 7297...
7419
	if (work == NULL)
7297
	if (work == NULL)
7420
		return -ENOMEM;
7298
		return -ENOMEM;
Line 7421... Line 7299...
7421
 
7299
 
7422
	work->event = event;
7300
	work->event = event;
7423
	work->crtc = crtc;
7301
	work->crtc = crtc;
7424
	intel_fb = to_intel_framebuffer(crtc->fb);
-
 
7425
	work->old_fb_obj = intel_fb->obj;
7302
	work->old_fb_obj = to_intel_framebuffer(old_fb)->obj;
Line 7426... Line 7303...
7426
	INIT_WORK(&work->work, intel_unpin_work_fn);
7303
	INIT_WORK(&work->work, intel_unpin_work_fn);
7427
 
7304
 
7428
	ret = drm_vblank_get(dev, intel_crtc->pipe);
7305
	ret = drm_vblank_get(dev, intel_crtc->pipe);
Line 7440... Line 7317...
7440
		return -EBUSY;
7317
		return -EBUSY;
7441
	}
7318
	}
7442
	intel_crtc->unpin_work = work;
7319
	intel_crtc->unpin_work = work;
7443
	spin_unlock_irqrestore(&dev->event_lock, flags);
7320
	spin_unlock_irqrestore(&dev->event_lock, flags);
Line 7444... Line -...
7444
 
-
 
7445
	intel_fb = to_intel_framebuffer(fb);
-
 
7446
	obj = intel_fb->obj;
-
 
7447
 
7321
 
7448
	if (atomic_read(&intel_crtc->unpin_work_count) >= 2)
7322
	if (atomic_read(&intel_crtc->unpin_work_count) >= 2)
Line 7449... Line 7323...
7449
		flush_workqueue(dev_priv->wq);
7323
		flush_workqueue(dev_priv->wq);
7450
 
7324
 
Line 7460... Line 7334...
7460
 
7334
 
Line 7461... Line 7335...
7461
	work->pending_flip_obj = obj;
7335
	work->pending_flip_obj = obj;
Line 7462... Line -...
7462
 
-
 
7463
	work->enable_stall_check = true;
-
 
7464
 
-
 
7465
	/* Block clients from rendering to the new back buffer until
-
 
7466
	 * the flip occurs and the object is no longer visible.
7336
 
-
 
7337
	work->enable_stall_check = true;
Line 7467... Line 7338...
7467
	 */
7338
 
7468
	atomic_add(1 << intel_crtc->plane, &work->old_fb_obj->pending_flip);
7339
	atomic_inc(&intel_crtc->unpin_work_count);
7469
	atomic_inc(&intel_crtc->unpin_work_count);
7340
	intel_crtc->reset_counter = atomic_read(&dev_priv->gpu_error.reset_counter);
Line 7480... Line 7351...
7480
 
7351
 
Line 7481... Line 7352...
7481
	return 0;
7352
	return 0;
7482
 
7353
 
7483
cleanup_pending:
7354
cleanup_pending:
7484
	atomic_dec(&intel_crtc->unpin_work_count);
7355
	atomic_dec(&intel_crtc->unpin_work_count);
7485
	atomic_sub(1 << intel_crtc->plane, &work->old_fb_obj->pending_flip);
7356
	crtc->fb = old_fb;
7486
	drm_gem_object_unreference(&work->old_fb_obj->base);
7357
	drm_gem_object_unreference(&work->old_fb_obj->base);
Line 7487... Line 7358...
7487
	drm_gem_object_unreference(&obj->base);
7358
	drm_gem_object_unreference(&obj->base);
Line 7502... Line 7373...
7502
#endif
7373
#endif
Line 7503... Line 7374...
7503
 
7374
 
7504
static struct drm_crtc_helper_funcs intel_helper_funcs = {
7375
static struct drm_crtc_helper_funcs intel_helper_funcs = {
7505
	.mode_set_base_atomic = intel_pipe_set_base_atomic,
7376
	.mode_set_base_atomic = intel_pipe_set_base_atomic,
7506
	.load_lut = intel_crtc_load_lut,
-
 
7507
	.disable = intel_crtc_noop,
7377
	.load_lut = intel_crtc_load_lut,
Line 7508... Line 7378...
7508
};
7378
};
7509
 
7379
 
7510
bool intel_encoder_check_is_cloned(struct intel_encoder *encoder)
7380
bool intel_encoder_check_is_cloned(struct intel_encoder *encoder)
Line 7892... Line 7762...
7892
 
7762
 
7893
		assert_pipe(dev->dev_private, crtc->pipe, crtc->active);
7763
		assert_pipe(dev->dev_private, crtc->pipe, crtc->active);
7894
	}
7764
	}
Line 7895... Line 7765...
7895
}
7765
}
7896
 
7766
 
7897
bool intel_set_mode(struct drm_crtc *crtc,
7767
int intel_set_mode(struct drm_crtc *crtc,
7898
		    struct drm_display_mode *mode,
7768
		    struct drm_display_mode *mode,
7899
		    int x, int y, struct drm_framebuffer *fb)
7769
		    int x, int y, struct drm_framebuffer *fb)
7900
{
7770
{
7901
	struct drm_device *dev = crtc->dev;
7771
	struct drm_device *dev = crtc->dev;
7902
	drm_i915_private_t *dev_priv = dev->dev_private;
7772
	drm_i915_private_t *dev_priv = dev->dev_private;
7903
	struct drm_display_mode *adjusted_mode, saved_mode, saved_hwmode;
7773
	struct drm_display_mode *adjusted_mode, *saved_mode, *saved_hwmode;
7904
	struct intel_crtc *intel_crtc;
7774
	struct intel_crtc *intel_crtc;
-
 
7775
	unsigned disable_pipes, prepare_pipes, modeset_pipes;
-
 
7776
	int ret = 0;
-
 
7777
 
-
 
7778
	saved_mode = kmalloc(2 * sizeof(*saved_mode), GFP_KERNEL);
-
 
7779
	if (!saved_mode)
Line 7905... Line 7780...
7905
	unsigned disable_pipes, prepare_pipes, modeset_pipes;
7780
		return -ENOMEM;
7906
	bool ret = true;
7781
	saved_hwmode = saved_mode + 1;
Line 7907... Line 7782...
7907
 
7782
 
7908
	intel_modeset_affected_pipes(crtc, &modeset_pipes,
7783
	intel_modeset_affected_pipes(crtc, &modeset_pipes,
Line 7909... Line 7784...
7909
				     &prepare_pipes, &disable_pipes);
7784
				     &prepare_pipes, &disable_pipes);
7910
 
7785
 
Line 7911... Line 7786...
7911
	DRM_DEBUG_KMS("set mode pipe masks: modeset: %x, prepare: %x, disable: %x\n",
7786
	DRM_DEBUG_KMS("set mode pipe masks: modeset: %x, prepare: %x, disable: %x\n",
7912
		      modeset_pipes, prepare_pipes, disable_pipes);
7787
		      modeset_pipes, prepare_pipes, disable_pipes);
Line 7913... Line 7788...
7913
 
7788
 
7914
	for_each_intel_crtc_masked(dev, disable_pipes, intel_crtc)
7789
	for_each_intel_crtc_masked(dev, disable_pipes, intel_crtc)
7915
		intel_crtc_disable(&intel_crtc->base);
7790
		intel_crtc_disable(&intel_crtc->base);
7916
 
7791
 
7917
	saved_hwmode = crtc->hwmode;
7792
	*saved_hwmode = crtc->hwmode;
7918
	saved_mode = crtc->mode;
7793
	*saved_mode = crtc->mode;
7919
 
7794
 
7920
	/* Hack: Because we don't (yet) support global modeset on multiple
7795
	/* Hack: Because we don't (yet) support global modeset on multiple
7921
	 * crtcs, we don't keep track of the new mode for more than one crtc.
7796
	 * crtcs, we don't keep track of the new mode for more than one crtc.
-
 
7797
	 * Hence simply check whether any bit is set in modeset_pipes in all the
7922
	 * Hence simply check whether any bit is set in modeset_pipes in all the
7798
	 * pieces of code that are not yet converted to deal with mutliple crtcs
7923
	 * pieces of code that are not yet converted to deal with mutliple crtcs
7799
	 * changing their mode at the same time. */
7924
	 * changing their mode at the same time. */
7800
	adjusted_mode = NULL;
Line 7925... Line 7801...
7925
	adjusted_mode = NULL;
7801
	if (modeset_pipes) {
7926
	if (modeset_pipes) {
7802
		adjusted_mode = intel_modeset_adjusted_mode(crtc, mode);
Line 7950... Line 7826...
7950
 
7826
 
7951
	/* Set up the DPLL and any encoders state that needs to adjust or depend
7827
	/* Set up the DPLL and any encoders state that needs to adjust or depend
7952
	 * on the DPLL.
7828
	 * on the DPLL.
7953
	 */
7829
	 */
7954
	for_each_intel_crtc_masked(dev, modeset_pipes, intel_crtc) {
7830
	for_each_intel_crtc_masked(dev, modeset_pipes, intel_crtc) {
7955
		ret = !intel_crtc_mode_set(&intel_crtc->base,
7831
		ret = intel_crtc_mode_set(&intel_crtc->base,
7956
					   mode, adjusted_mode,
7832
					   mode, adjusted_mode,
7957
					   x, y, fb);
7833
					   x, y, fb);
7958
		if (!ret)
7834
		if (ret)
7959
		    goto done;
7835
		    goto done;
Line 7960... Line 7836...
7960
	}
7836
	}
7961
 
7837
 
Line 7975... Line 7851...
7975
	}
7851
	}
Line 7976... Line 7852...
7976
 
7852
 
7977
	/* FIXME: add subpixel order */
7853
	/* FIXME: add subpixel order */
7978
done:
7854
done:
7979
	drm_mode_destroy(dev, adjusted_mode);
7855
	drm_mode_destroy(dev, adjusted_mode);
7980
	if (!ret && crtc->enabled) {
7856
	if (ret && crtc->enabled) {
7981
		crtc->hwmode = saved_hwmode;
7857
		crtc->hwmode = *saved_hwmode;
7982
		crtc->mode = saved_mode;
7858
		crtc->mode = *saved_mode;
7983
	} else {
7859
	} else {
7984
		intel_modeset_check_state(dev);
7860
		intel_modeset_check_state(dev);
Line -... Line 7861...
-
 
7861
	}
-
 
7862
 
7985
	}
7863
out:
7986
 
7864
	kfree(saved_mode);
Line -... Line 7865...
-
 
7865
	return ret;
-
 
7866
}
-
 
7867
 
-
 
7868
void intel_crtc_restore_mode(struct drm_crtc *crtc)
-
 
7869
{
7987
	return ret;
7870
	intel_set_mode(crtc, &crtc->mode, crtc->x, crtc->y, crtc->fb);
Line 7988... Line 7871...
7988
}
7871
}
7989
 
7872
 
7990
#undef for_each_intel_crtc_masked
7873
#undef for_each_intel_crtc_masked
Line 8097... Line 7980...
8097
	struct drm_crtc *new_crtc;
7980
	struct drm_crtc *new_crtc;
8098
	struct intel_connector *connector;
7981
	struct intel_connector *connector;
8099
	struct intel_encoder *encoder;
7982
	struct intel_encoder *encoder;
8100
	int count, ro;
7983
	int count, ro;
Line 8101... Line 7984...
8101
 
7984
 
8102
	/* The upper layers ensure that we either disabl a crtc or have a list
7985
	/* The upper layers ensure that we either disable a crtc or have a list
8103
	 * of connectors. For paranoia, double-check this. */
7986
	 * of connectors. For paranoia, double-check this. */
8104
	WARN_ON(!set->fb && (set->num_connectors != 0));
7987
	WARN_ON(!set->fb && (set->num_connectors != 0));
Line 8105... Line 7988...
8105
	WARN_ON(set->fb && (set->num_connectors == 0));
7988
	WARN_ON(set->fb && (set->num_connectors == 0));
Line 8199... Line 8082...
8199
 
8082
 
8200
	BUG_ON(!set);
8083
	BUG_ON(!set);
8201
	BUG_ON(!set->crtc);
8084
	BUG_ON(!set->crtc);
Line 8202... Line -...
8202
	BUG_ON(!set->crtc->helper_private);
-
 
8203
 
-
 
8204
	if (!set->mode)
-
 
8205
		set->fb = NULL;
-
 
8206
 
8085
	BUG_ON(!set->crtc->helper_private);
8207
	/* The fb helper likes to play gross jokes with ->mode_set_config.
8086
 
8208
	 * Unfortunately the crtc helper doesn't do much at all for this case,
8087
	/* Enforce sane interface api - has been abused by the fb helper. */
8209
	 * so we have to cope with this madness until the fb helper is fixed up. */
-
 
Line 8210... Line 8088...
8210
	if (set->fb && set->num_connectors == 0)
8088
	BUG_ON(!set->mode && set->fb);
8211
		return 0;
8089
	BUG_ON(set->fb && set->num_connectors == 0);
8212
 
8090
 
8213
	if (set->fb) {
8091
	if (set->fb) {
Line 8250... Line 8128...
8250
			DRM_DEBUG_KMS("attempting to set mode from"
8128
			DRM_DEBUG_KMS("attempting to set mode from"
8251
					" userspace\n");
8129
					" userspace\n");
8252
			drm_mode_debug_printmodeline(set->mode);
8130
			drm_mode_debug_printmodeline(set->mode);
8253
		}
8131
		}
Line 8254... Line 8132...
8254
 
8132
 
8255
		if (!intel_set_mode(set->crtc, set->mode,
8133
		ret = intel_set_mode(set->crtc, set->mode,
-
 
8134
				     set->x, set->y, set->fb);
8256
				    set->x, set->y, set->fb)) {
8135
		if (ret) {
8257
			DRM_ERROR("failed to set mode on [CRTC:%d]\n",
8136
			DRM_ERROR("failed to set mode on [CRTC:%d], err = %d\n",
8258
				  set->crtc->base.id);
-
 
8259
			ret = -EINVAL;
8137
				  set->crtc->base.id, ret);
8260
			goto fail;
8138
			goto fail;
8261
		}
8139
		}
8262
	} else if (config->fb_changed) {
8140
	} else if (config->fb_changed) {
8263
		ret = intel_pipe_set_base(set->crtc,
8141
		ret = intel_pipe_set_base(set->crtc,
Line 8271... Line 8149...
8271
fail:
8149
fail:
8272
	intel_set_config_restore_state(dev, config);
8150
	intel_set_config_restore_state(dev, config);
Line 8273... Line 8151...
8273
 
8151
 
8274
	/* Try to restore the config */
8152
	/* Try to restore the config */
8275
	if (config->mode_changed &&
8153
	if (config->mode_changed &&
8276
	    !intel_set_mode(save_set.crtc, save_set.mode,
8154
	    intel_set_mode(save_set.crtc, save_set.mode,
8277
			    save_set.x, save_set.y, save_set.fb))
8155
			    save_set.x, save_set.y, save_set.fb))
Line 8278... Line 8156...
8278
		DRM_ERROR("failed to restore config after modeset failure\n");
8156
		DRM_ERROR("failed to restore config after modeset failure\n");
8279
 
8157
 
Line 8291... Line 8169...
8291
//	.page_flip = intel_crtc_page_flip,
8169
//	.page_flip = intel_crtc_page_flip,
8292
};
8170
};
Line 8293... Line 8171...
8293
 
8171
 
8294
static void intel_cpu_pll_init(struct drm_device *dev)
8172
static void intel_cpu_pll_init(struct drm_device *dev)
8295
{
8173
{
8296
	if (IS_HASWELL(dev))
8174
	if (HAS_DDI(dev))
8297
		intel_ddi_pll_init(dev);
8175
		intel_ddi_pll_init(dev);
Line 8298... Line 8176...
8298
}
8176
}
8299
 
8177
 
Line 8424... Line 8302...
8424
	if (!has_lvds && !HAS_PCH_SPLIT(dev)) {
8302
	if (!has_lvds && !HAS_PCH_SPLIT(dev)) {
8425
		/* disable the panel fitter on everything but LVDS */
8303
		/* disable the panel fitter on everything but LVDS */
8426
		I915_WRITE(PFIT_CONTROL, 0);
8304
		I915_WRITE(PFIT_CONTROL, 0);
8427
	}
8305
	}
Line 8428... Line -...
8428
 
-
 
8429
	if (!(IS_HASWELL(dev) &&
8306
 
8430
	      (I915_READ(DDI_BUF_CTL(PORT_A)) & DDI_A_4_LANES)))
8307
	if (!(HAS_DDI(dev) && (I915_READ(DDI_BUF_CTL(PORT_A)) & DDI_A_4_LANES)))
Line 8431... Line 8308...
8431
	intel_crt_init(dev);
8308
	intel_crt_init(dev);
8432
 
8309
 
Line 8433... Line 8310...
8433
	if (IS_HASWELL(dev)) {
8310
	if (HAS_DDI(dev)) {
8434
		int found;
8311
		int found;
8435
 
8312
 
Line 8475... Line 8352...
8475
			intel_dp_init(dev, PCH_DP_C, PORT_C);
8352
			intel_dp_init(dev, PCH_DP_C, PORT_C);
Line 8476... Line 8353...
8476
 
8353
 
8477
		if (I915_READ(PCH_DP_D) & DP_DETECTED)
8354
		if (I915_READ(PCH_DP_D) & DP_DETECTED)
8478
			intel_dp_init(dev, PCH_DP_D, PORT_D);
8355
			intel_dp_init(dev, PCH_DP_D, PORT_D);
8479
	} else if (IS_VALLEYVIEW(dev)) {
-
 
8480
		int found;
-
 
8481
 
8356
	} else if (IS_VALLEYVIEW(dev)) {
8482
		/* Check for built-in panel first. Shares lanes with HDMI on SDVOC */
8357
		/* Check for built-in panel first. Shares lanes with HDMI on SDVOC */
8483
		if (I915_READ(DP_C) & DP_DETECTED)
8358
		if (I915_READ(VLV_DISPLAY_BASE + DP_C) & DP_DETECTED)
Line 8484... Line 8359...
8484
			intel_dp_init(dev, DP_C, PORT_C);
8359
			intel_dp_init(dev, VLV_DISPLAY_BASE + DP_C, PORT_C);
8485
 
-
 
8486
		if (I915_READ(SDVOB) & PORT_DETECTED) {
-
 
8487
			/* SDVOB multiplex with HDMIB */
-
 
8488
			found = intel_sdvo_init(dev, SDVOB, true);
8360
 
8489
			if (!found)
8361
		if (I915_READ(VLV_DISPLAY_BASE + SDVOB) & PORT_DETECTED) {
8490
				intel_hdmi_init(dev, SDVOB, PORT_B);
8362
			intel_hdmi_init(dev, VLV_DISPLAY_BASE + SDVOB, PORT_B);
8491
			if (!found && (I915_READ(DP_B) & DP_DETECTED))
8363
			if (I915_READ(VLV_DISPLAY_BASE + DP_B) & DP_DETECTED)
Line 8492... Line 8364...
8492
				intel_dp_init(dev, DP_B, PORT_B);
8364
				intel_dp_init(dev, VLV_DISPLAY_BASE + DP_B, PORT_B);
8493
		}
8365
		}
Line 8494... Line 8366...
8494
 
8366
 
8495
		if (I915_READ(SDVOC) & PORT_DETECTED)
8367
		if (I915_READ(VLV_DISPLAY_BASE + SDVOC) & PORT_DETECTED)
Line 8496... Line 8368...
8496
			intel_hdmi_init(dev, SDVOC, PORT_C);
8368
			intel_hdmi_init(dev, VLV_DISPLAY_BASE + SDVOC, PORT_C);
Line 8633... Line 8505...
8633
 
8505
 
8634
	/* FIXME need to adjust LINOFF/TILEOFF accordingly. */
8506
	/* FIXME need to adjust LINOFF/TILEOFF accordingly. */
8635
	if (mode_cmd->offsets[0] != 0)
8507
	if (mode_cmd->offsets[0] != 0)
Line -... Line 8508...
-
 
8508
		return -EINVAL;
-
 
8509
 
-
 
8510
	drm_helper_mode_fill_fb_struct(&intel_fb->base, mode_cmd);
8636
		return -EINVAL;
8511
	intel_fb->obj = obj;
8637
 
8512
 
8638
	ret = drm_framebuffer_init(dev, &intel_fb->base, &intel_fb_funcs);
8513
	ret = drm_framebuffer_init(dev, &intel_fb->base, &intel_fb_funcs);
8639
	if (ret) {
8514
	if (ret) {
8640
		DRM_ERROR("framebuffer init failed %d\n", ret);
8515
		DRM_ERROR("framebuffer init failed %d\n", ret);
Line 8641... Line -...
8641
		return ret;
-
 
8642
	}
-
 
8643
 
8516
		return ret;
8644
	drm_helper_mode_fill_fb_struct(&intel_fb->base, mode_cmd);
8517
	}
Line 8645... Line 8518...
8645
	intel_fb->obj = obj;
8518
 
8646
	return 0;
8519
	return 0;
8647
}
8520
}
8648
 
8521
 
Line 8649... Line 8522...
8649
 
8522
 
8650
static const struct drm_mode_config_funcs intel_mode_funcs = {
8523
static const struct drm_mode_config_funcs intel_mode_funcs = {
8651
	.fb_create = NULL /*intel_user_framebuffer_create*/,
8524
	.fb_create = NULL /*intel_user_framebuffer_create*/,
8652
	.output_poll_changed = NULL /*intel_fb_output_poll_changed*/,
8525
	.output_poll_changed = intel_fb_output_poll_changed,
Line 8653... Line 8526...
8653
};
8526
};
8654
 
8527
 
8655
/* Set up chip specific display functions */
8528
/* Set up chip specific display functions */
8656
static void intel_init_display(struct drm_device *dev)
8529
static void intel_init_display(struct drm_device *dev)
8657
{
8530
{
8658
	struct drm_i915_private *dev_priv = dev->dev_private;
8531
	struct drm_i915_private *dev_priv = dev->dev_private;
8659
 
8532
 
Line 8718... Line 8591...
8718
			dev_priv->display.modeset_global_resources =
8591
			dev_priv->display.modeset_global_resources =
8719
				ivb_modeset_global_resources;
8592
				ivb_modeset_global_resources;
8720
		} else if (IS_HASWELL(dev)) {
8593
		} else if (IS_HASWELL(dev)) {
8721
			dev_priv->display.fdi_link_train = hsw_fdi_link_train;
8594
			dev_priv->display.fdi_link_train = hsw_fdi_link_train;
8722
			dev_priv->display.write_eld = haswell_write_eld;
8595
			dev_priv->display.write_eld = haswell_write_eld;
8723
		} else
-
 
8724
			dev_priv->display.update_wm = NULL;
8596
			dev_priv->display.modeset_global_resources =
-
 
8597
				haswell_modeset_global_resources;
-
 
8598
		}
8725
	} else if (IS_G4X(dev)) {
8599
	} else if (IS_G4X(dev)) {
8726
		dev_priv->display.write_eld = g4x_write_eld;
8600
		dev_priv->display.write_eld = g4x_write_eld;
8727
	}
8601
	}
Line 8728... Line 8602...
8728
 
8602
 
Line 8823... Line 8697...
8823
	/* Sony Vaio Y cannot use SSC on LVDS */
8697
	/* Sony Vaio Y cannot use SSC on LVDS */
8824
	{ 0x0046, 0x104d, 0x9076, quirk_ssc_force_disable },
8698
	{ 0x0046, 0x104d, 0x9076, quirk_ssc_force_disable },
Line 8825... Line 8699...
8825
 
8699
 
8826
	/* Acer Aspire 5734Z must invert backlight brightness */
8700
	/* Acer Aspire 5734Z must invert backlight brightness */
-
 
8701
	{ 0x2a42, 0x1025, 0x0459, quirk_invert_brightness },
-
 
8702
 
-
 
8703
	/* Acer/eMachines G725 */
-
 
8704
	{ 0x2a42, 0x1025, 0x0210, quirk_invert_brightness },
-
 
8705
 
-
 
8706
	/* Acer/eMachines e725 */
-
 
8707
	{ 0x2a42, 0x1025, 0x0212, quirk_invert_brightness },
-
 
8708
 
-
 
8709
	/* Acer/Packard Bell NCL20 */
-
 
8710
	{ 0x2a42, 0x1025, 0x034b, quirk_invert_brightness },
-
 
8711
 
-
 
8712
	/* Acer Aspire 4736Z */
8827
	{ 0x2a42, 0x1025, 0x0459, quirk_invert_brightness },
8713
	{ 0x2a42, 0x1025, 0x0260, quirk_invert_brightness },
Line 8828... Line 8714...
8828
};
8714
};
8829
 
8715
 
8830
static void intel_init_quirks(struct drm_device *dev)
8716
static void intel_init_quirks(struct drm_device *dev)
Line 8851... Line 8737...
8851
/* Disable the VGA plane that we never use */
8737
/* Disable the VGA plane that we never use */
8852
static void i915_disable_vga(struct drm_device *dev)
8738
static void i915_disable_vga(struct drm_device *dev)
8853
{
8739
{
8854
	struct drm_i915_private *dev_priv = dev->dev_private;
8740
	struct drm_i915_private *dev_priv = dev->dev_private;
8855
	u8 sr1;
8741
	u8 sr1;
8856
	u32 vga_reg;
-
 
8857
 
-
 
8858
	if (HAS_PCH_SPLIT(dev))
-
 
8859
		vga_reg = CPU_VGACNTRL;
8742
	u32 vga_reg = i915_vgacntrl_reg(dev);
8860
	else
-
 
8861
		vga_reg = VGACNTRL;
-
 
Line 8862... Line 8743...
8862
 
8743
 
8863
//   vga_get_uninterruptible(dev->pdev, VGA_RSRC_LEGACY_IO);
8744
//   vga_get_uninterruptible(dev->pdev, VGA_RSRC_LEGACY_IO);
8864
    out8(SR01, VGA_SR_INDEX);
8745
    out8(SR01, VGA_SR_INDEX);
8865
    sr1 = in8(VGA_SR_DATA);
8746
    sr1 = in8(VGA_SR_DATA);
Line 8871... Line 8752...
8871
	POSTING_READ(vga_reg);
8752
	POSTING_READ(vga_reg);
8872
}
8753
}
Line 8873... Line 8754...
8873
 
8754
 
8874
void intel_modeset_init_hw(struct drm_device *dev)
8755
void intel_modeset_init_hw(struct drm_device *dev)
8875
{
-
 
8876
	/* We attempt to init the necessary power wells early in the initialization
-
 
8877
	 * time, so the subsystems that expect power to be enabled can work.
-
 
8878
	 */
8756
{
Line 8879... Line 8757...
8879
	intel_init_power_wells(dev);
8757
	intel_init_power_well(dev);
Line 8880... Line 8758...
8880
 
8758
 
Line 8916... Line 8794...
8916
		dev->mode_config.max_height = 4096;
8794
		dev->mode_config.max_height = 4096;
8917
	} else {
8795
	} else {
8918
		dev->mode_config.max_width = 8192;
8796
		dev->mode_config.max_width = 8192;
8919
		dev->mode_config.max_height = 8192;
8797
		dev->mode_config.max_height = 8192;
8920
	}
8798
	}
8921
	dev->mode_config.fb_base = dev_priv->mm.gtt_base_addr;
8799
	dev->mode_config.fb_base = dev_priv->gtt.mappable_base;
Line 8922... Line 8800...
8922
 
8800
 
8923
	DRM_DEBUG_KMS("%d display pipe%s available.\n",
8801
	DRM_DEBUG_KMS("%d display pipe%s available.\n",
Line 8924... Line 8802...
8924
		      dev_priv->num_pipe, dev_priv->num_pipe > 1 ? "s" : "");
8802
		      dev_priv->num_pipe, dev_priv->num_pipe > 1 ? "s" : "");
Line 8934... Line 8812...
8934
	intel_pch_pll_init(dev);
8812
	intel_pch_pll_init(dev);
Line 8935... Line 8813...
8935
 
8813
 
8936
	/* Just disable it once at startup */
8814
	/* Just disable it once at startup */
8937
	i915_disable_vga(dev);
8815
	i915_disable_vga(dev);
-
 
8816
	intel_setup_outputs(dev);
-
 
8817
 
-
 
8818
	/* Just in case the BIOS is doing something questionable. */
8938
	intel_setup_outputs(dev);
8819
	intel_disable_fbc(dev);
Line 8939... Line 8820...
8939
}
8820
}
8940
 
8821
 
8941
static void
8822
static void
Line 9127... Line 9008...
9127
	u32 tmp;
9008
	u32 tmp;
9128
	struct intel_crtc *crtc;
9009
	struct intel_crtc *crtc;
9129
	struct intel_encoder *encoder;
9010
	struct intel_encoder *encoder;
9130
	struct intel_connector *connector;
9011
	struct intel_connector *connector;
Line 9131... Line 9012...
9131
 
9012
 
9132
	if (IS_HASWELL(dev)) {
9013
	if (HAS_DDI(dev)) {
Line 9133... Line 9014...
9133
		tmp = I915_READ(TRANS_DDI_FUNC_CTL(TRANSCODER_EDP));
9014
		tmp = I915_READ(TRANS_DDI_FUNC_CTL(TRANSCODER_EDP));
9134
 
9015
 
9135
		if (tmp & TRANS_DDI_FUNC_ENABLE) {
9016
		if (tmp & TRANS_DDI_FUNC_ENABLE) {
Line 9168... Line 9049...
9168
		DRM_DEBUG_KMS("[CRTC:%d] hw state readout: %s\n",
9049
		DRM_DEBUG_KMS("[CRTC:%d] hw state readout: %s\n",
9169
			      crtc->base.base.id,
9050
			      crtc->base.base.id,
9170
			      crtc->active ? "enabled" : "disabled");
9051
			      crtc->active ? "enabled" : "disabled");
9171
	}
9052
	}
Line 9172... Line 9053...
9172
 
9053
 
9173
	if (IS_HASWELL(dev))
9054
	if (HAS_DDI(dev))
Line 9174... Line 9055...
9174
		intel_ddi_setup_hw_pll_state(dev);
9055
		intel_ddi_setup_hw_pll_state(dev);
9175
 
9056
 
9176
	list_for_each_entry(encoder, &dev->mode_config.encoder_list,
9057
	list_for_each_entry(encoder, &dev->mode_config.encoder_list,
Line 9219... Line 9100...
9219
		intel_sanitize_crtc(crtc);
9100
		intel_sanitize_crtc(crtc);
9220
	}
9101
	}
Line 9221... Line 9102...
9221
 
9102
 
9222
	if (force_restore) {
9103
	if (force_restore) {
9223
		for_each_pipe(pipe) {
9104
		for_each_pipe(pipe) {
9224
			crtc = to_intel_crtc(dev_priv->pipe_to_crtc_mapping[pipe]);
-
 
9225
			intel_set_mode(&crtc->base, &crtc->base.mode,
-
 
9226
				       crtc->base.x, crtc->base.y, crtc->base.fb);
9105
			intel_crtc_restore_mode(dev_priv->pipe_to_crtc_mapping[pipe]);
Line 9227... Line 9106...
9227
		}
9106
		}
9228
 
9107
 
9229
//       i915_redisable_vga(dev);
9108
//       i915_redisable_vga(dev);