Skip to content

Commit ce22dba

Browse files
mlankhorstdanvet
authored andcommitted
drm/i915: Move toggling planes out of crtc enable/disable.
This makes disabling planes more explicit. Signed-off-by: Maarten Lankhorst <[email protected]> [anderco: fixed warning due to using drm_crtc instead of intel_crtc] Signed-off-by: Ander Conselvan de Oliveira <[email protected]> Reviewed-by: Maarten Lankhorst <[email protected]> Signed-off-by: Daniel Vetter <[email protected]>
1 parent 7cac945 commit ce22dba

File tree

3 files changed

+31
-22
lines changed

3 files changed

+31
-22
lines changed

drivers/gpu/drm/i915/i915_debugfs.c

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3611,8 +3611,7 @@ static void hsw_trans_edp_pipe_A_crc_wa(struct drm_device *dev)
36113611
intel_display_power_get(dev_priv,
36123612
POWER_DOMAIN_PIPE_PANEL_FITTER(PIPE_A));
36133613

3614-
dev_priv->display.crtc_disable(&crtc->base);
3615-
dev_priv->display.crtc_enable(&crtc->base);
3614+
intel_crtc_reset(crtc);
36163615
}
36173616
drm_modeset_unlock_all(dev);
36183617
}
@@ -3633,8 +3632,7 @@ static void hsw_undo_trans_edp_pipe_A_crc_wa(struct drm_device *dev)
36333632
if (crtc->config->pch_pfit.force_thru) {
36343633
crtc->config->pch_pfit.force_thru = false;
36353634

3636-
dev_priv->display.crtc_disable(&crtc->base);
3637-
dev_priv->display.crtc_enable(&crtc->base);
3635+
intel_crtc_reset(crtc);
36383636

36393637
intel_display_power_put(dev_priv,
36403638
POWER_DOMAIN_PIPE_PANEL_FITTER(PIPE_A));

drivers/gpu/drm/i915/intel_display.c

Lines changed: 28 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -107,6 +107,8 @@ static void skl_init_scalers(struct drm_device *dev, struct intel_crtc *intel_cr
107107
struct intel_crtc_state *crtc_state);
108108
static int i9xx_get_refclk(const struct intel_crtc_state *crtc_state,
109109
int num_connectors);
110+
static void intel_crtc_enable_planes(struct drm_crtc *crtc);
111+
static void intel_crtc_disable_planes(struct drm_crtc *crtc);
110112

111113
static struct intel_encoder *intel_find_encoder(struct intel_connector *connector, int pipe)
112114
{
@@ -3206,6 +3208,19 @@ static void intel_update_primary_planes(struct drm_device *dev)
32063208
}
32073209
}
32083210

3211+
void intel_crtc_reset(struct intel_crtc *crtc)
3212+
{
3213+
struct drm_i915_private *dev_priv = to_i915(crtc->base.dev);
3214+
3215+
if (!crtc->active)
3216+
return;
3217+
3218+
intel_crtc_disable_planes(&crtc->base);
3219+
dev_priv->display.crtc_disable(&crtc->base);
3220+
dev_priv->display.crtc_enable(&crtc->base);
3221+
intel_crtc_enable_planes(&crtc->base);
3222+
}
3223+
32093224
void intel_prepare_reset(struct drm_device *dev)
32103225
{
32113226
struct drm_i915_private *dev_priv = to_i915(dev);
@@ -3226,8 +3241,11 @@ void intel_prepare_reset(struct drm_device *dev)
32263241
* g33 docs say we should at least disable all the planes.
32273242
*/
32283243
for_each_intel_crtc(dev, crtc) {
3229-
if (crtc->active)
3230-
dev_priv->display.crtc_disable(&crtc->base);
3244+
if (!crtc->active)
3245+
continue;
3246+
3247+
intel_crtc_disable_planes(&crtc->base);
3248+
dev_priv->display.crtc_disable(&crtc->base);
32313249
}
32323250
}
32333251

@@ -4842,8 +4860,6 @@ intel_pre_disable_primary(struct drm_crtc *crtc)
48424860

48434861
static void intel_crtc_enable_planes(struct drm_crtc *crtc)
48444862
{
4845-
struct intel_crtc *intel_crtc = to_intel_crtc(crtc);
4846-
48474863
intel_enable_primary_hw_plane(crtc->primary, crtc);
48484864
intel_enable_sprite_planes(crtc);
48494865
intel_crtc_update_cursor(crtc, true);
@@ -4949,8 +4965,6 @@ static void ironlake_crtc_enable(struct drm_crtc *crtc)
49494965

49504966
if (HAS_PCH_CPT(dev))
49514967
cpt_verify_modeset(dev, intel_crtc->pipe);
4952-
4953-
intel_crtc_enable_planes(crtc);
49544968
}
49554969

49564970
/* IPS only exists on ULT machines and is tied to pipe A. */
@@ -5074,7 +5088,6 @@ static void haswell_crtc_enable(struct drm_crtc *crtc)
50745088
/* If we change the relative order between pipe/planes enabling, we need
50755089
* to change the workaround. */
50765090
haswell_mode_set_planes_workaround(intel_crtc);
5077-
intel_crtc_enable_planes(crtc);
50785091
}
50795092

50805093
static void ironlake_pfit_disable(struct intel_crtc *crtc)
@@ -5104,8 +5117,6 @@ static void ironlake_crtc_disable(struct drm_crtc *crtc)
51045117
if (!intel_crtc->active)
51055118
return;
51065119

5107-
intel_crtc_disable_planes(crtc);
5108-
51095120
for_each_encoder_on_crtc(dev, crtc, encoder)
51105121
encoder->disable(encoder);
51115122

@@ -5168,8 +5179,6 @@ static void haswell_crtc_disable(struct drm_crtc *crtc)
51685179
if (!intel_crtc->active)
51695180
return;
51705181

5171-
intel_crtc_disable_planes(crtc);
5172-
51735182
for_each_encoder_on_crtc(dev, crtc, encoder) {
51745183
intel_opregion_notify_encoder(encoder, false);
51755184
encoder->disable(encoder);
@@ -5917,8 +5926,6 @@ static void valleyview_crtc_enable(struct drm_crtc *crtc)
59175926

59185927
for_each_encoder_on_crtc(dev, crtc, encoder)
59195928
encoder->enable(encoder);
5920-
5921-
intel_crtc_enable_planes(crtc);
59225929
}
59235930

59245931
static void i9xx_set_pll_dividers(struct intel_crtc *crtc)
@@ -5975,8 +5982,6 @@ static void i9xx_crtc_enable(struct drm_crtc *crtc)
59755982

59765983
for_each_encoder_on_crtc(dev, crtc, encoder)
59775984
encoder->enable(encoder);
5978-
5979-
intel_crtc_enable_planes(crtc);
59805985
}
59815986

59825987
static void i9xx_pfit_disable(struct intel_crtc *crtc)
@@ -6005,8 +6010,6 @@ static void i9xx_crtc_disable(struct drm_crtc *crtc)
60056010
if (!intel_crtc->active)
60066011
return;
60076012

6008-
intel_crtc_disable_planes(crtc);
6009-
60106013
/*
60116014
* On gen2 planes are double buffered but the pipe isn't, so we must
60126015
* wait for planes to fully turn off before disabling the pipe.
@@ -6070,9 +6073,11 @@ void intel_crtc_control(struct drm_crtc *crtc, bool enable)
60706073
intel_crtc->enabled_power_domains = domains;
60716074

60726075
dev_priv->display.crtc_enable(crtc);
6076+
intel_crtc_enable_planes(crtc);
60736077
}
60746078
} else {
60756079
if (intel_crtc->active) {
6080+
intel_crtc_disable_planes(crtc);
60766081
dev_priv->display.crtc_disable(crtc);
60776082

60786083
domains = intel_crtc->enabled_power_domains;
@@ -6107,6 +6112,7 @@ static void intel_crtc_disable(struct drm_crtc *crtc)
61076112
/* crtc should still be enabled when we disable it. */
61086113
WARN_ON(!crtc->state->enable);
61096114

6115+
intel_crtc_disable_planes(crtc);
61106116
dev_priv->display.crtc_disable(crtc);
61116117
dev_priv->display.off(crtc);
61126118

@@ -12346,8 +12352,10 @@ static int __intel_set_mode(struct drm_crtc *crtc,
1234612352
intel_crtc_disable(&intel_crtc->base);
1234712353

1234812354
for_each_intel_crtc_masked(dev, prepare_pipes, intel_crtc) {
12349-
if (intel_crtc->base.state->enable)
12355+
if (intel_crtc->base.state->enable) {
12356+
intel_crtc_disable_planes(&intel_crtc->base);
1235012357
dev_priv->display.crtc_disable(&intel_crtc->base);
12358+
}
1235112359
}
1235212360

1235312361
/* crtc->mode is already used by the ->mode_set callbacks, hence we need
@@ -12395,6 +12403,7 @@ static int __intel_set_mode(struct drm_crtc *crtc,
1239512403
update_scanline_offset(intel_crtc);
1239612404

1239712405
dev_priv->display.crtc_enable(&intel_crtc->base);
12406+
intel_crtc_enable_planes(&intel_crtc->base);
1239812407
}
1239912408

1240012409
/* FIXME: add subpixel order */
@@ -14839,6 +14848,7 @@ static void intel_sanitize_crtc(struct intel_crtc *crtc)
1483914848
plane = crtc->plane;
1484014849
to_intel_plane_state(crtc->base.primary->state)->visible = true;
1484114850
crtc->plane = !plane;
14851+
intel_crtc_disable_planes(&crtc->base);
1484214852
dev_priv->display.crtc_disable(&crtc->base);
1484314853
crtc->plane = plane;
1484414854

drivers/gpu/drm/i915/intel_drv.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -994,6 +994,7 @@ void intel_mark_busy(struct drm_device *dev);
994994
void intel_mark_idle(struct drm_device *dev);
995995
void intel_crtc_restore_mode(struct drm_crtc *crtc);
996996
void intel_crtc_control(struct drm_crtc *crtc, bool enable);
997+
void intel_crtc_reset(struct intel_crtc *crtc);
997998
void intel_crtc_update_dpms(struct drm_crtc *crtc);
998999
void intel_encoder_destroy(struct drm_encoder *encoder);
9991000
int intel_connector_init(struct intel_connector *);

0 commit comments

Comments
 (0)