Skip to content

Commit 60acb54

Browse files
committed
drm/i915/ips: convert to struct intel_display
struct intel_display will replace struct drm_i915_private as the main device pointer for display code. Switch HSW IPS code over to it. Reviewed-by: Rodrigo Vivi <[email protected]> Signed-off-by: Jani Nikula <[email protected]> Link: https://patchwork.freedesktop.org/patch/msgid/66060d0c3fbb20e5d2c98a92133f091de6b25230.1730146000.git.jani.nikula@intel.com
1 parent a00d086 commit 60acb54

File tree

1 file changed

+26
-21
lines changed

1 file changed

+26
-21
lines changed

drivers/gpu/drm/i915/display/hsw_ips.c

Lines changed: 26 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515

1616
static void hsw_ips_enable(const struct intel_crtc_state *crtc_state)
1717
{
18+
struct intel_display *display = to_intel_display(crtc_state);
1819
struct intel_crtc *crtc = to_intel_crtc(crtc_state->uapi.crtc);
1920
struct drm_i915_private *i915 = to_i915(crtc->base.dev);
2021
u32 val;
@@ -27,16 +28,16 @@ static void hsw_ips_enable(const struct intel_crtc_state *crtc_state)
2728
* This function is called from post_plane_update, which is run after
2829
* a vblank wait.
2930
*/
30-
drm_WARN_ON(&i915->drm,
31+
drm_WARN_ON(display->drm,
3132
!(crtc_state->active_planes & ~BIT(PLANE_CURSOR)));
3233

3334
val = IPS_ENABLE;
3435

35-
if (i915->display.ips.false_color)
36+
if (display->ips.false_color)
3637
val |= IPS_FALSE_COLOR;
3738

3839
if (IS_BROADWELL(i915)) {
39-
drm_WARN_ON(&i915->drm,
40+
drm_WARN_ON(display->drm,
4041
snb_pcode_write(&i915->uncore, DISPLAY_IPS_CONTROL,
4142
val | IPS_PCODE_CONTROL));
4243
/*
@@ -46,22 +47,23 @@ static void hsw_ips_enable(const struct intel_crtc_state *crtc_state)
4647
* so we need to just enable it and continue on.
4748
*/
4849
} else {
49-
intel_de_write(i915, IPS_CTL, val);
50+
intel_de_write(display, IPS_CTL, val);
5051
/*
5152
* The bit only becomes 1 in the next vblank, so this wait here
5253
* is essentially intel_wait_for_vblank. If we don't have this
5354
* and don't wait for vblanks until the end of crtc_enable, then
5455
* the HW state readout code will complain that the expected
5556
* IPS_CTL value is not the one we read.
5657
*/
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,
5960
"Timed out waiting for IPS enable\n");
6061
}
6162
}
6263

6364
bool hsw_ips_disable(const struct intel_crtc_state *crtc_state)
6465
{
66+
struct intel_display *display = to_intel_display(crtc_state);
6567
struct intel_crtc *crtc = to_intel_crtc(crtc_state->uapi.crtc);
6668
struct drm_i915_private *i915 = to_i915(crtc->base.dev);
6769
bool need_vblank_wait = false;
@@ -70,19 +72,19 @@ bool hsw_ips_disable(const struct intel_crtc_state *crtc_state)
7072
return need_vblank_wait;
7173

7274
if (IS_BROADWELL(i915)) {
73-
drm_WARN_ON(&i915->drm,
75+
drm_WARN_ON(display->drm,
7476
snb_pcode_write(&i915->uncore, DISPLAY_IPS_CONTROL, 0));
7577
/*
7678
* Wait for PCODE to finish disabling IPS. The BSpec specified
7779
* 42ms timeout value leads to occasional timeouts so use 100ms
7880
* instead.
7981
*/
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,
8284
"Timed out waiting for IPS disable\n");
8385
} 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);
8688
}
8789

8890
/* 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)
188190

189191
bool hsw_crtc_state_ips_capable(const struct intel_crtc_state *crtc_state)
190192
{
193+
struct intel_display *display = to_intel_display(crtc_state);
191194
struct intel_crtc *crtc = to_intel_crtc(crtc_state->uapi.crtc);
192195
struct drm_i915_private *i915 = to_i915(crtc->base.dev);
193196

194197
/* IPS only exists on ULT machines and is tied to pipe A. */
195198
if (!hsw_crtc_supports_ips(crtc))
196199
return false;
197200

198-
if (!i915->display.params.enable_ips)
201+
if (!display->params.enable_ips)
199202
return false;
200203

201204
if (crtc_state->pipe_bpp > 24)
@@ -209,7 +212,7 @@ bool hsw_crtc_state_ips_capable(const struct intel_crtc_state *crtc_state)
209212
* Should measure whether using a lower cdclk w/o IPS
210213
*/
211214
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)
213216
return false;
214217

215218
return true;
@@ -259,14 +262,15 @@ int hsw_ips_compute_config(struct intel_atomic_state *state,
259262

260263
void hsw_ips_get_config(struct intel_crtc_state *crtc_state)
261264
{
265+
struct intel_display *display = to_intel_display(crtc_state);
262266
struct intel_crtc *crtc = to_intel_crtc(crtc_state->uapi.crtc);
263267
struct drm_i915_private *i915 = to_i915(crtc->base.dev);
264268

265269
if (!hsw_crtc_supports_ips(crtc))
266270
return;
267271

268272
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;
270274
} else {
271275
/*
272276
* We cannot readout IPS state on broadwell, set to
@@ -280,25 +284,25 @@ void hsw_ips_get_config(struct intel_crtc_state *crtc_state)
280284
static int hsw_ips_debugfs_false_color_get(void *data, u64 *val)
281285
{
282286
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);
284288

285-
*val = i915->display.ips.false_color;
289+
*val = display->ips.false_color;
286290

287291
return 0;
288292
}
289293

290294
static int hsw_ips_debugfs_false_color_set(void *data, u64 val)
291295
{
292296
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);
294298
struct intel_crtc_state *crtc_state;
295299
int ret;
296300

297301
ret = drm_modeset_lock(&crtc->base.mutex, NULL);
298302
if (ret)
299303
return ret;
300304

301-
i915->display.ips.false_color = val;
305+
display->ips.false_color = val;
302306

303307
crtc_state = to_intel_crtc_state(crtc->base.state);
304308

@@ -325,18 +329,19 @@ DEFINE_DEBUGFS_ATTRIBUTE(hsw_ips_debugfs_false_color_fops,
325329
static int hsw_ips_debugfs_status_show(struct seq_file *m, void *unused)
326330
{
327331
struct intel_crtc *crtc = m->private;
332+
struct intel_display *display = to_intel_display(crtc);
328333
struct drm_i915_private *i915 = to_i915(crtc->base.dev);
329334
intel_wakeref_t wakeref;
330335

331336
wakeref = intel_runtime_pm_get(&i915->runtime_pm);
332337

333338
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));
335340

336-
if (DISPLAY_VER(i915) >= 8) {
341+
if (DISPLAY_VER(display) >= 8) {
337342
seq_puts(m, "Currently: unknown\n");
338343
} else {
339-
if (intel_de_read(i915, IPS_CTL) & IPS_ENABLE)
344+
if (intel_de_read(display, IPS_CTL) & IPS_ENABLE)
340345
seq_puts(m, "Currently: enabled\n");
341346
else
342347
seq_puts(m, "Currently: disabled\n");

0 commit comments

Comments
 (0)