Subversion Repositories Kolibri OS

Rev

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

Rev 6084 Rev 6937
Line 82... Line 82...
82
	}
82
	}
Line 83... Line 83...
83
 
83
 
84
	return true;
84
	return true;
Line 85... Line -...
85
}
-
 
86
 
-
 
87
/**
-
 
88
 * i9xx_check_fifo_underruns - check for fifo underruns
-
 
89
 * @dev_priv: i915 device instance
-
 
90
 *
-
 
91
 * This function checks for fifo underruns on GMCH platforms. This needs to be
-
 
92
 * done manually on modeset to make sure that we catch all underruns since they
-
 
93
 * do not generate an interrupt by themselves on these platforms.
85
}
94
 */
86
 
95
void i9xx_check_fifo_underruns(struct drm_i915_private *dev_priv)
-
 
96
{
-
 
97
	struct intel_crtc *crtc;
-
 
98
 
-
 
99
	spin_lock_irq(&dev_priv->irq_lock);
87
static void i9xx_check_fifo_underruns(struct intel_crtc *crtc)
100
 
88
{
101
	for_each_intel_crtc(dev_priv->dev, crtc) {
89
	struct drm_i915_private *dev_priv = to_i915(crtc->base.dev);
Line 102... Line 90...
102
		u32 reg = PIPESTAT(crtc->pipe);
90
	i915_reg_t reg = PIPESTAT(crtc->pipe);
103
		u32 pipestat;
-
 
Line 104... Line -...
104
 
-
 
105
		if (crtc->cpu_fifo_underrun_disabled)
91
	u32 pipestat = I915_READ(reg) & 0xffff0000;
106
			continue;
92
 
Line 107... Line 93...
107
 
93
	assert_spin_locked(&dev_priv->irq_lock);
108
		pipestat = I915_READ(reg) & 0xffff0000;
94
 
Line 109... Line 95...
109
		if ((pipestat & PIPE_FIFO_UNDERRUN_STATUS) == 0)
95
		if ((pipestat & PIPE_FIFO_UNDERRUN_STATUS) == 0)
110
			continue;
96
		return;
Line 111... Line -...
111
 
-
 
112
		I915_WRITE(reg, pipestat | PIPE_FIFO_UNDERRUN_STATUS);
-
 
113
		POSTING_READ(reg);
-
 
114
 
97
 
115
		DRM_ERROR("pipe %c underrun\n", pipe_name(crtc->pipe));
98
		I915_WRITE(reg, pipestat | PIPE_FIFO_UNDERRUN_STATUS);
116
	}
99
		POSTING_READ(reg);
117
 
100
 
118
	spin_unlock_irq(&dev_priv->irq_lock);
101
		DRM_ERROR("pipe %c underrun\n", pipe_name(crtc->pipe));
119
}
102
	}
120
 
103
 
Line 121... Line 104...
121
static void i9xx_set_fifo_underrun_reporting(struct drm_device *dev,
104
static void i9xx_set_fifo_underrun_reporting(struct drm_device *dev,
Line 122... Line 105...
122
					     enum pipe pipe,
105
					     enum pipe pipe,
Line 143... Line 126...
143
	struct drm_i915_private *dev_priv = dev->dev_private;
126
	struct drm_i915_private *dev_priv = dev->dev_private;
144
	uint32_t bit = (pipe == PIPE_A) ? DE_PIPEA_FIFO_UNDERRUN :
127
	uint32_t bit = (pipe == PIPE_A) ? DE_PIPEA_FIFO_UNDERRUN :
145
					  DE_PIPEB_FIFO_UNDERRUN;
128
					  DE_PIPEB_FIFO_UNDERRUN;
Line 146... Line 129...
146
 
129
 
147
	if (enable)
130
	if (enable)
148
		ironlake_enable_display_irq(dev_priv, bit);
131
		ilk_enable_display_irq(dev_priv, bit);
149
	else
132
	else
-
 
133
		ilk_disable_display_irq(dev_priv, bit);
-
 
134
}
-
 
135
 
-
 
136
static void ivybridge_check_fifo_underruns(struct intel_crtc *crtc)
-
 
137
{
-
 
138
	struct drm_i915_private *dev_priv = to_i915(crtc->base.dev);
-
 
139
	enum pipe pipe = crtc->pipe;
-
 
140
	uint32_t err_int = I915_READ(GEN7_ERR_INT);
-
 
141
 
-
 
142
	assert_spin_locked(&dev_priv->irq_lock);
-
 
143
 
-
 
144
	if ((err_int & ERR_INT_FIFO_UNDERRUN(pipe)) == 0)
-
 
145
		return;
-
 
146
 
-
 
147
	I915_WRITE(GEN7_ERR_INT, ERR_INT_FIFO_UNDERRUN(pipe));
-
 
148
	POSTING_READ(GEN7_ERR_INT);
-
 
149
 
150
		ironlake_disable_display_irq(dev_priv, bit);
150
	DRM_ERROR("fifo underrun on pipe %c\n", pipe_name(pipe));
Line 151... Line 151...
151
}
151
}
152
 
152
 
153
static void ivybridge_set_fifo_underrun_reporting(struct drm_device *dev,
153
static void ivybridge_set_fifo_underrun_reporting(struct drm_device *dev,
Line 159... Line 159...
159
		I915_WRITE(GEN7_ERR_INT, ERR_INT_FIFO_UNDERRUN(pipe));
159
		I915_WRITE(GEN7_ERR_INT, ERR_INT_FIFO_UNDERRUN(pipe));
Line 160... Line 160...
160
 
160
 
161
		if (!ivb_can_enable_err_int(dev))
161
		if (!ivb_can_enable_err_int(dev))
Line 162... Line 162...
162
			return;
162
			return;
163
 
163
 
164
		ironlake_enable_display_irq(dev_priv, DE_ERR_INT_IVB);
164
		ilk_enable_display_irq(dev_priv, DE_ERR_INT_IVB);
Line 165... Line 165...
165
	} else {
165
	} else {
166
		ironlake_disable_display_irq(dev_priv, DE_ERR_INT_IVB);
166
		ilk_disable_display_irq(dev_priv, DE_ERR_INT_IVB);
167
 
167
 
168
		if (old &&
168
		if (old &&
Line 176... Line 176...
176
static void broadwell_set_fifo_underrun_reporting(struct drm_device *dev,
176
static void broadwell_set_fifo_underrun_reporting(struct drm_device *dev,
177
						  enum pipe pipe, bool enable)
177
						  enum pipe pipe, bool enable)
178
{
178
{
179
	struct drm_i915_private *dev_priv = dev->dev_private;
179
	struct drm_i915_private *dev_priv = dev->dev_private;
Line 180... Line -...
180
 
-
 
181
	assert_spin_locked(&dev_priv->irq_lock);
-
 
182
 
180
 
183
	if (enable)
181
	if (enable)
184
		dev_priv->de_irq_mask[pipe] &= ~GEN8_PIPE_FIFO_UNDERRUN;
182
		bdw_enable_pipe_irq(dev_priv, pipe, GEN8_PIPE_FIFO_UNDERRUN);
185
	else
183
	else
186
		dev_priv->de_irq_mask[pipe] |= GEN8_PIPE_FIFO_UNDERRUN;
-
 
187
	I915_WRITE(GEN8_DE_PIPE_IMR(pipe), dev_priv->de_irq_mask[pipe]);
-
 
188
	POSTING_READ(GEN8_DE_PIPE_IMR(pipe));
184
		bdw_disable_pipe_irq(dev_priv, pipe, GEN8_PIPE_FIFO_UNDERRUN);
Line 189... Line 185...
189
}
185
}
190
 
186
 
191
static void ibx_set_fifo_underrun_reporting(struct drm_device *dev,
187
static void ibx_set_fifo_underrun_reporting(struct drm_device *dev,
Line 200... Line 196...
200
		ibx_enable_display_interrupt(dev_priv, bit);
196
		ibx_enable_display_interrupt(dev_priv, bit);
201
	else
197
	else
202
		ibx_disable_display_interrupt(dev_priv, bit);
198
		ibx_disable_display_interrupt(dev_priv, bit);
203
}
199
}
Line -... Line 200...
-
 
200
 
-
 
201
static void cpt_check_pch_fifo_underruns(struct intel_crtc *crtc)
-
 
202
{
-
 
203
	struct drm_i915_private *dev_priv = to_i915(crtc->base.dev);
-
 
204
	enum transcoder pch_transcoder = (enum transcoder) crtc->pipe;
-
 
205
	uint32_t serr_int = I915_READ(SERR_INT);
-
 
206
 
-
 
207
	assert_spin_locked(&dev_priv->irq_lock);
-
 
208
 
-
 
209
	if ((serr_int & SERR_INT_TRANS_FIFO_UNDERRUN(pch_transcoder)) == 0)
-
 
210
		return;
-
 
211
 
-
 
212
	I915_WRITE(SERR_INT, SERR_INT_TRANS_FIFO_UNDERRUN(pch_transcoder));
-
 
213
	POSTING_READ(SERR_INT);
-
 
214
 
-
 
215
	DRM_ERROR("pch fifo underrun on pch transcoder %c\n",
-
 
216
		  transcoder_name(pch_transcoder));
-
 
217
}
204
 
218
 
205
static void cpt_set_fifo_underrun_reporting(struct drm_device *dev,
219
static void cpt_set_fifo_underrun_reporting(struct drm_device *dev,
206
					    enum transcoder pch_transcoder,
220
					    enum transcoder pch_transcoder,
207
					    bool enable, bool old)
221
					    bool enable, bool old)
208
{
222
{
Line 373... Line 387...
373
	if (intel_set_pch_fifo_underrun_reporting(dev_priv, pch_transcoder,
387
	if (intel_set_pch_fifo_underrun_reporting(dev_priv, pch_transcoder,
374
						  false))
388
						  false))
375
		DRM_ERROR("PCH transcoder %c FIFO underrun\n",
389
		DRM_ERROR("PCH transcoder %c FIFO underrun\n",
376
			  transcoder_name(pch_transcoder));
390
			  transcoder_name(pch_transcoder));
377
}
391
}
-
 
392
 
-
 
393
/**
-
 
394
 * intel_check_cpu_fifo_underruns - check for CPU fifo underruns immediately
-
 
395
 * @dev_priv: i915 device instance
-
 
396
 *
-
 
397
 * Check for CPU fifo underruns immediately. Useful on IVB/HSW where the shared
-
 
398
 * error interrupt may have been disabled, and so CPU fifo underruns won't
-
 
399
 * necessarily raise an interrupt, and on GMCH platforms where underruns never
-
 
400
 * raise an interrupt.
-
 
401
 */
-
 
402
void intel_check_cpu_fifo_underruns(struct drm_i915_private *dev_priv)
-
 
403
{
-
 
404
	struct intel_crtc *crtc;
-
 
405
 
-
 
406
	spin_lock_irq(&dev_priv->irq_lock);
-
 
407
 
-
 
408
	for_each_intel_crtc(dev_priv->dev, crtc) {
-
 
409
		if (crtc->cpu_fifo_underrun_disabled)
-
 
410
			continue;
-
 
411
 
-
 
412
		if (HAS_GMCH_DISPLAY(dev_priv))
-
 
413
			i9xx_check_fifo_underruns(crtc);
-
 
414
		else if (IS_GEN7(dev_priv))
-
 
415
			ivybridge_check_fifo_underruns(crtc);
-
 
416
	}
-
 
417
 
-
 
418
	spin_unlock_irq(&dev_priv->irq_lock);
-
 
419
}
-
 
420
 
-
 
421
/**
-
 
422
 * intel_check_pch_fifo_underruns - check for PCH fifo underruns immediately
-
 
423
 * @dev_priv: i915 device instance
-
 
424
 *
-
 
425
 * Check for PCH fifo underruns immediately. Useful on CPT/PPT where the shared
-
 
426
 * error interrupt may have been disabled, and so PCH fifo underruns won't
-
 
427
 * necessarily raise an interrupt.
-
 
428
 */
-
 
429
void intel_check_pch_fifo_underruns(struct drm_i915_private *dev_priv)
-
 
430
{
-
 
431
	struct intel_crtc *crtc;
-
 
432
 
-
 
433
	spin_lock_irq(&dev_priv->irq_lock);
-
 
434
 
-
 
435
	for_each_intel_crtc(dev_priv->dev, crtc) {
-
 
436
		if (crtc->pch_fifo_underrun_disabled)
-
 
437
			continue;
-
 
438
 
-
 
439
		if (HAS_PCH_CPT(dev_priv))
-
 
440
			cpt_check_pch_fifo_underruns(crtc);
-
 
441
	}
-
 
442
 
-
 
443
	spin_unlock_irq(&dev_priv->irq_lock);
-
 
444
}