15
15
16
16
static void hsw_ips_enable (const struct intel_crtc_state * crtc_state )
17
17
{
18
+ struct intel_display * display = to_intel_display (crtc_state );
18
19
struct intel_crtc * crtc = to_intel_crtc (crtc_state -> uapi .crtc );
19
20
struct drm_i915_private * i915 = to_i915 (crtc -> base .dev );
20
21
u32 val ;
@@ -27,16 +28,16 @@ static void hsw_ips_enable(const struct intel_crtc_state *crtc_state)
27
28
* This function is called from post_plane_update, which is run after
28
29
* a vblank wait.
29
30
*/
30
- drm_WARN_ON (& i915 -> drm ,
31
+ drm_WARN_ON (display -> drm ,
31
32
!(crtc_state -> active_planes & ~BIT (PLANE_CURSOR )));
32
33
33
34
val = IPS_ENABLE ;
34
35
35
- if (i915 -> display . ips .false_color )
36
+ if (display -> ips .false_color )
36
37
val |= IPS_FALSE_COLOR ;
37
38
38
39
if (IS_BROADWELL (i915 )) {
39
- drm_WARN_ON (& i915 -> drm ,
40
+ drm_WARN_ON (display -> drm ,
40
41
snb_pcode_write (& i915 -> uncore , DISPLAY_IPS_CONTROL ,
41
42
val | IPS_PCODE_CONTROL ));
42
43
/*
@@ -46,22 +47,23 @@ static void hsw_ips_enable(const struct intel_crtc_state *crtc_state)
46
47
* so we need to just enable it and continue on.
47
48
*/
48
49
} else {
49
- intel_de_write (i915 , IPS_CTL , val );
50
+ intel_de_write (display , IPS_CTL , val );
50
51
/*
51
52
* The bit only becomes 1 in the next vblank, so this wait here
52
53
* is essentially intel_wait_for_vblank. If we don't have this
53
54
* and don't wait for vblanks until the end of crtc_enable, then
54
55
* the HW state readout code will complain that the expected
55
56
* IPS_CTL value is not the one we read.
56
57
*/
57
- if (intel_de_wait_for_set (i915 , IPS_CTL , IPS_ENABLE , 50 ))
58
- drm_err (& i915 -> drm ,
58
+ if (intel_de_wait_for_set (display , IPS_CTL , IPS_ENABLE , 50 ))
59
+ drm_err (display -> drm ,
59
60
"Timed out waiting for IPS enable\n" );
60
61
}
61
62
}
62
63
63
64
bool hsw_ips_disable (const struct intel_crtc_state * crtc_state )
64
65
{
66
+ struct intel_display * display = to_intel_display (crtc_state );
65
67
struct intel_crtc * crtc = to_intel_crtc (crtc_state -> uapi .crtc );
66
68
struct drm_i915_private * i915 = to_i915 (crtc -> base .dev );
67
69
bool need_vblank_wait = false;
@@ -70,19 +72,19 @@ bool hsw_ips_disable(const struct intel_crtc_state *crtc_state)
70
72
return need_vblank_wait ;
71
73
72
74
if (IS_BROADWELL (i915 )) {
73
- drm_WARN_ON (& i915 -> drm ,
75
+ drm_WARN_ON (display -> drm ,
74
76
snb_pcode_write (& i915 -> uncore , DISPLAY_IPS_CONTROL , 0 ));
75
77
/*
76
78
* Wait for PCODE to finish disabling IPS. The BSpec specified
77
79
* 42ms timeout value leads to occasional timeouts so use 100ms
78
80
* instead.
79
81
*/
80
- if (intel_de_wait_for_clear (i915 , IPS_CTL , IPS_ENABLE , 100 ))
81
- drm_err (& i915 -> drm ,
82
+ if (intel_de_wait_for_clear (display , IPS_CTL , IPS_ENABLE , 100 ))
83
+ drm_err (display -> drm ,
82
84
"Timed out waiting for IPS disable\n" );
83
85
} else {
84
- intel_de_write (i915 , IPS_CTL , 0 );
85
- intel_de_posting_read (i915 , IPS_CTL );
86
+ intel_de_write (display , IPS_CTL , 0 );
87
+ intel_de_posting_read (display , IPS_CTL );
86
88
}
87
89
88
90
/* We need to wait for a vblank before we can disable the plane. */
@@ -188,14 +190,15 @@ bool hsw_crtc_supports_ips(struct intel_crtc *crtc)
188
190
189
191
bool hsw_crtc_state_ips_capable (const struct intel_crtc_state * crtc_state )
190
192
{
193
+ struct intel_display * display = to_intel_display (crtc_state );
191
194
struct intel_crtc * crtc = to_intel_crtc (crtc_state -> uapi .crtc );
192
195
struct drm_i915_private * i915 = to_i915 (crtc -> base .dev );
193
196
194
197
/* IPS only exists on ULT machines and is tied to pipe A. */
195
198
if (!hsw_crtc_supports_ips (crtc ))
196
199
return false;
197
200
198
- if (!i915 -> display . params .enable_ips )
201
+ if (!display -> params .enable_ips )
199
202
return false;
200
203
201
204
if (crtc_state -> pipe_bpp > 24 )
@@ -209,7 +212,7 @@ bool hsw_crtc_state_ips_capable(const struct intel_crtc_state *crtc_state)
209
212
* Should measure whether using a lower cdclk w/o IPS
210
213
*/
211
214
if (IS_BROADWELL (i915 ) &&
212
- crtc_state -> pixel_rate > i915 -> display . cdclk .max_cdclk_freq * 95 / 100 )
215
+ crtc_state -> pixel_rate > display -> cdclk .max_cdclk_freq * 95 / 100 )
213
216
return false;
214
217
215
218
return true;
@@ -259,14 +262,15 @@ int hsw_ips_compute_config(struct intel_atomic_state *state,
259
262
260
263
void hsw_ips_get_config (struct intel_crtc_state * crtc_state )
261
264
{
265
+ struct intel_display * display = to_intel_display (crtc_state );
262
266
struct intel_crtc * crtc = to_intel_crtc (crtc_state -> uapi .crtc );
263
267
struct drm_i915_private * i915 = to_i915 (crtc -> base .dev );
264
268
265
269
if (!hsw_crtc_supports_ips (crtc ))
266
270
return ;
267
271
268
272
if (IS_HASWELL (i915 )) {
269
- crtc_state -> ips_enabled = intel_de_read (i915 , IPS_CTL ) & IPS_ENABLE ;
273
+ crtc_state -> ips_enabled = intel_de_read (display , IPS_CTL ) & IPS_ENABLE ;
270
274
} else {
271
275
/*
272
276
* We cannot readout IPS state on broadwell, set to
@@ -280,25 +284,25 @@ void hsw_ips_get_config(struct intel_crtc_state *crtc_state)
280
284
static int hsw_ips_debugfs_false_color_get (void * data , u64 * val )
281
285
{
282
286
struct intel_crtc * crtc = data ;
283
- struct drm_i915_private * i915 = to_i915 (crtc -> base . dev );
287
+ struct intel_display * display = to_intel_display (crtc );
284
288
285
- * val = i915 -> display . ips .false_color ;
289
+ * val = display -> ips .false_color ;
286
290
287
291
return 0 ;
288
292
}
289
293
290
294
static int hsw_ips_debugfs_false_color_set (void * data , u64 val )
291
295
{
292
296
struct intel_crtc * crtc = data ;
293
- struct drm_i915_private * i915 = to_i915 (crtc -> base . dev );
297
+ struct intel_display * display = to_intel_display (crtc );
294
298
struct intel_crtc_state * crtc_state ;
295
299
int ret ;
296
300
297
301
ret = drm_modeset_lock (& crtc -> base .mutex , NULL );
298
302
if (ret )
299
303
return ret ;
300
304
301
- i915 -> display . ips .false_color = val ;
305
+ display -> ips .false_color = val ;
302
306
303
307
crtc_state = to_intel_crtc_state (crtc -> base .state );
304
308
@@ -325,18 +329,19 @@ DEFINE_DEBUGFS_ATTRIBUTE(hsw_ips_debugfs_false_color_fops,
325
329
static int hsw_ips_debugfs_status_show (struct seq_file * m , void * unused )
326
330
{
327
331
struct intel_crtc * crtc = m -> private ;
332
+ struct intel_display * display = to_intel_display (crtc );
328
333
struct drm_i915_private * i915 = to_i915 (crtc -> base .dev );
329
334
intel_wakeref_t wakeref ;
330
335
331
336
wakeref = intel_runtime_pm_get (& i915 -> runtime_pm );
332
337
333
338
seq_printf (m , "Enabled by kernel parameter: %s\n" ,
334
- str_yes_no (i915 -> display . params .enable_ips ));
339
+ str_yes_no (display -> params .enable_ips ));
335
340
336
- if (DISPLAY_VER (i915 ) >= 8 ) {
341
+ if (DISPLAY_VER (display ) >= 8 ) {
337
342
seq_puts (m , "Currently: unknown\n" );
338
343
} else {
339
- if (intel_de_read (i915 , IPS_CTL ) & IPS_ENABLE )
344
+ if (intel_de_read (display , IPS_CTL ) & IPS_ENABLE )
340
345
seq_puts (m , "Currently: enabled\n" );
341
346
else
342
347
seq_puts (m , "Currently: disabled\n" );
0 commit comments