Skip to contentSkip to conversation

drm/i915: Fix mistake in intel_modeset_all_pipes condition

PATCH In review Stanislav Lisovskiy 3 participants 9 messages Aug 9, 2023

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 drm/i915: Fix mistake in intel_modeset_all_pipes condition

It is supposed to be "!intel_crtc_needs_modeset" - otherwise, we are active exactly vice versa for active pipes: skipping if modeset is needed and not skipping if not needed.

---
 drivers/gpu/drm/i915/display/intel_display.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/i915/display/intel_display.c +1 -1
index 763ab569d8f32..4b1d7034078ca 100644
@@ -5439,7 +5439,7 @@ int intel_modeset_all_pipes(struct intel_atomic_state *state,
 			return PTR_ERR(crtc_state);
 
 		if (!crtc_state->hw.active ||
-		    intel_crtc_needs_modeset(crtc_state))
+		    !intel_crtc_needs_modeset(crtc_state))
 			continue;
 
 		drm_dbg_kms(&dev_priv->drm, "[CRTC:%d:%s] Full modeset due to %s\n",
Signature · 1 line
2.37.3
#1 lore raw
Quoted 3 lines · Stanislav Lisovskiy

It is supposed to be "!intel_crtc_needs_modeset" - otherwise, we are active exactly vice versa for active pipes: skipping if modeset is needed and not skipping if not needed.

If the crtc *already* needs a full modeset, there's no need to force a modeset on it.

BR,
Jani.

Quoted 19 lines
---
 drivers/gpu/drm/i915/display/intel_display.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/i915/display/intel_display.c +1 -1
index 763ab569d8f32..4b1d7034078ca 100644
@@ -5439,7 +5439,7 @@ int intel_modeset_all_pipes(struct intel_atomic_state *state,
 			return PTR_ERR(crtc_state);
 
 		if (!crtc_state->hw.active ||
-		    intel_crtc_needs_modeset(crtc_state))
+		    !intel_crtc_needs_modeset(crtc_state))
 			continue;
 
 		drm_dbg_kms(&dev_priv->drm, "[CRTC:%d:%s] Full modeset due to %s\n",
Signature · 1 line
Jani Nikula, Intel Open Source Graphics Center
#2 lore raw
Quoted 10 lines · Jani Nikula
Quoted 3 lines · Stanislav Lisovskiy

It is supposed to be "!intel_crtc_needs_modeset" - otherwise, we are active exactly vice versa for active pipes: skipping if modeset is needed and not skipping if not needed.

If the crtc *already* needs a full modeset, there's no need to force a modeset on it.

BR,
Jani.

We have curently some issue with that. There are multiple places from where intel_modeset_all_pipes is called. One is that when we do detect that mbus join state had changed. All the previous checks indicated that fastset is enough, however once we detect mbus join state had changed in skl_watermarks.c we call this function there as well and I think it might act in a wrong way then.

So basically this condition checks whether we need to force a modeset, but not if we need it, so no crtc's are supposed to escape this?
Could be then that we just calling that whole function there wrongly.

Stan

Quoted 23 lines
Quoted 20 lines
---
 drivers/gpu/drm/i915/display/intel_display.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/i915/display/intel_display.c +1 -1
index 763ab569d8f32..4b1d7034078ca 100644
@@ -5439,7 +5439,7 @@ int intel_modeset_all_pipes(struct intel_atomic_state *state,
 			return PTR_ERR(crtc_state);
 
 		if (!crtc_state->hw.active ||
-		    intel_crtc_needs_modeset(crtc_state))
+		    !intel_crtc_needs_modeset(crtc_state))
 			continue;
 
 		drm_dbg_kms(&dev_priv->drm, "[CRTC:%d:%s] Full modeset due to %s\n",
Signature · 1 line
Jani Nikula, Intel Open Source Graphics Center
#3 lore raw
Quoted 18 lines · Stanislav
Quoted 10 lines · Jani Nikula
Quoted 3 lines · Stanislav Lisovskiy

It is supposed to be "!intel_crtc_needs_modeset" - otherwise, we are active exactly vice versa for active pipes: skipping if modeset is needed and not skipping if not needed.

If the crtc *already* needs a full modeset, there's no need to force a modeset on it.

BR,
Jani.

We have curently some issue with that. There are multiple places from where intel_modeset_all_pipes is called. One is that when we do detect that mbus join state had changed. All the previous checks indicated that fastset is enough, however once we detect mbus join state had changed in skl_watermarks.c we call this function there as well and I think it might act in a wrong way then.

Quoted 3 lines

So basically this condition checks whether we need to force a modeset, but not if we need it, so no crtc's are supposed to escape this?
Could be then that we just calling that whole function there wrongly.

Simplified, it's an optimization of:

	if (crtc_state->uapi.mode_changed)
        	continue;

	crtc_state->uapi.mode_changed = true;

With your change, it becomes:

	if (!crtc_state->uapi.mode_changed)
        	continue;

	crtc_state->uapi.mode_changed = true;

and intel_modeset_all_pipes() roughly becomes a no-op.

BR,
Jani.

Quoted 26 lines

Stan

Quoted 23 lines
Quoted 20 lines
---
 drivers/gpu/drm/i915/display/intel_display.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/i915/display/intel_display.c +1 -1
index 763ab569d8f32..4b1d7034078ca 100644
@@ -5439,7 +5439,7 @@ int intel_modeset_all_pipes(struct intel_atomic_state *state,
 			return PTR_ERR(crtc_state);
 
 		if (!crtc_state->hw.active ||
-		    intel_crtc_needs_modeset(crtc_state))
+		    !intel_crtc_needs_modeset(crtc_state))
 			continue;
 
 		drm_dbg_kms(&dev_priv->drm, "[CRTC:%d:%s] Full modeset due to %s\n",
Signature · 1 line
Jani Nikula, Intel Open Source Graphics Center
Signature · 1 line
Jani Nikula, Intel Open Source Graphics Center
#4 lore raw
Quoted 30 lines · Jani Nikula
Quoted 18 lines · Stanislav
Quoted 10 lines · Jani Nikula
Quoted 3 lines · Stanislav Lisovskiy

It is supposed to be "!intel_crtc_needs_modeset" - otherwise, we are active exactly vice versa for active pipes: skipping if modeset is needed and not skipping if not needed.

If the crtc *already* needs a full modeset, there's no need to force a modeset on it.

BR,
Jani.

We have curently some issue with that. There are multiple places from where intel_modeset_all_pipes is called. One is that when we do detect that mbus join state had changed. All the previous checks indicated that fastset is enough, however once we detect mbus join state had changed in skl_watermarks.c we call this function there as well and I think it might act in a wrong way then.

Quoted 3 lines

So basically this condition checks whether we need to force a modeset, but not if we need it, so no crtc's are supposed to escape this?
Could be then that we just calling that whole function there wrongly.

Simplified, it's an optimization of:

	if (crtc_state->uapi.mode_changed)
        	continue;

	crtc_state->uapi.mode_changed = true;
Quoted 8 lines

With your change, it becomes:

	if (!crtc_state->uapi.mode_changed)
        	continue;

	crtc_state->uapi.mode_changed = true;

and intel_modeset_all_pipes() roughly becomes a no-op.

Okay, basically I was wrong in interpretation of intel_modeset_all_pipes - mine was that it is supposed to modeset only pipes, which actually _need_ a full modeset, while the real one is supposed to force a modeset on those which even don't need that.
Regarding mbus join, I think it could be just wrong to call it there rightaway.
Most likely we can live with fastset there, unless ddb allocations haven't changed(we could then just update the mbus join state)

Stan

Quoted 34 lines

BR,
Jani.

Quoted 26 lines

Stan

Quoted 23 lines
Quoted 20 lines
---
 drivers/gpu/drm/i915/display/intel_display.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/i915/display/intel_display.c +1 -1
index 763ab569d8f32..4b1d7034078ca 100644
@@ -5439,7 +5439,7 @@ int intel_modeset_all_pipes(struct intel_atomic_state *state,
 			return PTR_ERR(crtc_state);
 
 		if (!crtc_state->hw.active ||
-		    intel_crtc_needs_modeset(crtc_state))
+		    !intel_crtc_needs_modeset(crtc_state))
 			continue;
 
 		drm_dbg_kms(&dev_priv->drm, "[CRTC:%d:%s] Full modeset due to %s\n",
Signature · 1 line
Jani Nikula, Intel Open Source Graphics Center
Signature · 1 line
Jani Nikula, Intel Open Source Graphics Center
#5 lore raw
Quoted 38 lines · Stanislav
Quoted 37 lines · Jani Nikula
Quoted 18 lines · Stanislav
Quoted 10 lines · Jani Nikula
Quoted 3 lines · Stanislav Lisovskiy

It is supposed to be "!intel_crtc_needs_modeset" - otherwise, we are active exactly vice versa for active pipes: skipping if modeset is needed and not skipping if not needed.

If the crtc *already* needs a full modeset, there's no need to force a modeset on it.

BR,
Jani.

We have curently some issue with that. There are multiple places from where intel_modeset_all_pipes is called. One is that when we do detect that mbus join state had changed. All the previous checks indicated that fastset is enough, however once we detect mbus join state had changed in skl_watermarks.c we call this function there as well and I think it might act in a wrong way then.

Quoted 3 lines

So basically this condition checks whether we need to force a modeset, but not if we need it, so no crtc's are supposed to escape this?
Could be then that we just calling that whole function there wrongly.

Simplified, it's an optimization of:

	if (crtc_state->uapi.mode_changed)
        	continue;

	crtc_state->uapi.mode_changed = true;

With your change, it becomes:

	if (!crtc_state->uapi.mode_changed)
        	continue;

	crtc_state->uapi.mode_changed = true;
Quoted 8 lines
Quoted 1 line

and intel_modeset_all_pipes() roughly becomes a no-op.

Okay, basically I was wrong in interpretation of intel_modeset_all_pipes - mine was that it is supposed to modeset only pipes, which actually _need_ a full modeset, while the real one is supposed to force a modeset on those which even don't need that.
Regarding mbus join, I think it could be just wrong to call it there rightaway.
Most likely we can live with fastset there, unless ddb allocations haven't changed(we could then just update the mbus join state)

Well it's right there in skl_watermark.c lines 2618 and 3488! ;D

	/* TODO: Implement vblank synchronized MBUS joining changes */

	/*
	 * TODO: Implement vblank synchronized MBUS joining changes.
	 * Must be properly coordinated with dbuf reprogramming.
	 */

added way back when mbus programming was added in commit f4dc00863226 ("drm/i915/adl_p: MBUS programming").

It's not "wrong" per se to do a full modeset, it's just that there's a gap in handling the fastset with mbus joining changes.

BR,
Jani.

Quoted 37 lines

Stan

Quoted 34 lines

BR,
Jani.

Quoted 26 lines

Stan

Quoted 23 lines
Quoted 20 lines
---
 drivers/gpu/drm/i915/display/intel_display.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/i915/display/intel_display.c +1 -1
index 763ab569d8f32..4b1d7034078ca 100644
@@ -5439,7 +5439,7 @@ int intel_modeset_all_pipes(struct intel_atomic_state *state,
 			return PTR_ERR(crtc_state);
 
 		if (!crtc_state->hw.active ||
-		    intel_crtc_needs_modeset(crtc_state))
+		    !intel_crtc_needs_modeset(crtc_state))
 			continue;
 
 		drm_dbg_kms(&dev_priv->drm, "[CRTC:%d:%s] Full modeset due to %s\n",
Signature · 1 line
Jani Nikula, Intel Open Source Graphics Center
Signature · 1 line
Jani Nikula, Intel Open Source Graphics Center
Signature · 1 line
Jani Nikula, Intel Open Source Graphics Center
#6 lore raw

[Intel-gfx] ✗ Fi.CI.CHECKPATCH: warning for drm/i915: Fix mistake in intel_modeset_all_pipes condition

In reply to Stanislav Lisovskiy
== Series Details ==

== Series Details ==

Series: drm/i915: Fix mistake in intel_modeset_all_pipes condition
URL : https://patchwork.freedesktop.org/series/122208/
State : warning

== Summary ==

Error: dim checkpatch failed
/home/kbuild/linux/maintainer-tools/dim: line 50: /home/kbuild/.dimrc: No such file or directory

#7 lore raw

[Intel-gfx] ✗ Fi.CI.SPARSE: warning for drm/i915: Fix mistake in intel_modeset_all_pipes condition

In reply to Stanislav Lisovskiy
== Series Details ==

== Series Details ==

Series: drm/i915: Fix mistake in intel_modeset_all_pipes condition
URL : https://patchwork.freedesktop.org/series/122208/
State : warning

== Summary ==

Error: dim sparse failed
/home/kbuild/linux/maintainer-tools/dim: line 50: /home/kbuild/.dimrc: No such file or directory

#8 lore raw

[Intel-gfx] ✓ Fi.CI.BAT: success for drm/i915: Fix mistake in intel_modeset_all_pipes condition

In reply to Stanislav Lisovskiy
== Series Details ==

== Series Details ==

Series: drm/i915: Fix mistake in intel_modeset_all_pipes condition
URL : https://patchwork.freedesktop.org/series/122208/
State : success

== Summary ==

CI Bug Log - changes from CI_DRM_13492 -> Patchwork_122208v1
====================================================

Summary
-------

**SUCCESS**

No regressions found.

External URL: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_122208v1/index.html

Participating hosts (43 -> 41)
------------------------------

Missing (2): fi-kbl-soraka fi-snb-2520m

Known issues
------------

Here are the changes found in Patchwork_122208v1 that come from known issues:

### IGT changes ###

#### Issues hit ####

* igt@i915_pm_rpm@basic-pci-d3-state:
- bat-mtlp-8: [PASS][1] -> [ABORT][2] ([i915#7077] / [i915#7977] / [i915#8668])
[1]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_13492/bat-mtlp-8/igt@[email protected]
[2]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_122208v1/bat-mtlp-8/igt@[email protected]

* igt@i915_pm_rpm@module-reload:
- fi-rkl-11600: [PASS][3] -> [FAIL][4] ([i915#7940])
[3]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_13492/fi-rkl-11600/igt@[email protected]
[4]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_122208v1/fi-rkl-11600/igt@[email protected]

* igt@i915_selftest@live@requests:
- bat-rpls-2: [PASS][5] -> [ABORT][6] ([i915#7913])
[5]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_13492/bat-rpls-2/igt@i915_selftest@[email protected]
[6]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_122208v1/bat-rpls-2/igt@i915_selftest@[email protected]

* igt@kms_chamelium_hpd@common-hpd-after-suspend:
- bat-jsl-3: NOTRUN -> [SKIP][7] ([i915#7828])
[7]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_122208v1/bat-jsl-3/igt@[email protected]

* igt@kms_cursor_legacy@basic-flip-after-cursor-legacy:
- bat-adlp-6: [PASS][8] -> [DMESG-WARN][9] ([i915#7507]) +10 similar issues
[8]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_13492/bat-adlp-6/igt@[email protected]
[9]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_122208v1/bat-adlp-6/igt@[email protected]

* igt@kms_pipe_crc_basic@read-crc-frame-sequence@pipe-d-dp-3:
- bat-adlp-6: [PASS][10] -> [ABORT][11] ([i915#8668])
[10]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_13492/bat-adlp-6/igt@kms_pipe_crc_basic@[email protected]
[11]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_122208v1/bat-adlp-6/igt@kms_pipe_crc_basic@[email protected]

* igt@kms_psr@cursor_plane_move:
- bat-rplp-1: NOTRUN -> [ABORT][12] ([i915#8469] / [i915#8668])
[12]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_122208v1/bat-rplp-1/igt@kms_psr@cursor_plane_move.html

#### Possible fixes ####

* igt@gem_exec_suspend@basic-s0@smem:
- bat-jsl-3: [ABORT][13] ([i915#5122]) -> [PASS][14]
[13]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_13492/bat-jsl-3/igt@gem_exec_suspend@[email protected]
[14]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_122208v1/bat-jsl-3/igt@gem_exec_suspend@[email protected]

* igt@i915_pm_rpm@basic-rte:
- fi-cfl-8109u: [FAIL][15] ([i915#7940]) -> [PASS][16]
[15]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_13492/fi-cfl-8109u/igt@[email protected]
[16]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_122208v1/fi-cfl-8109u/igt@[email protected]
- fi-skl-guc: [FAIL][17] ([i915#7940]) -> [PASS][18]
[17]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_13492/fi-skl-guc/igt@[email protected]
[18]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_122208v1/fi-skl-guc/igt@[email protected]

* igt@i915_pm_rpm@module-reload:
- fi-tgl-1115g4: [FAIL][19] ([i915#7940]) -> [PASS][20]
[19]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_13492/fi-tgl-1115g4/igt@[email protected]
[20]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_122208v1/fi-tgl-1115g4/igt@[email protected]

* igt@i915_selftest@live@gt_mocs:
- bat-mtlp-6: [DMESG-FAIL][21] ([i915#7059]) -> [PASS][22]
[21]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_13492/bat-mtlp-6/igt@i915_selftest@live@gt_mocs.html
[22]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_122208v1/bat-mtlp-6/igt@i915_selftest@live@gt_mocs.html

* igt@i915_selftest@live@requests:
- bat-mtlp-6: [DMESG-FAIL][23] ([i915#8497]) -> [PASS][24]
[23]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_13492/bat-mtlp-6/igt@i915_selftest@[email protected]
[24]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_122208v1/bat-mtlp-6/igt@i915_selftest@[email protected]

* igt@i915_suspend@basic-s3-without-i915:
- bat-jsl-3: [FAIL][25] ([fdo#103375]) -> [PASS][26]
[25]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_13492/bat-jsl-3/igt@[email protected]
[26]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_122208v1/bat-jsl-3/igt@[email protected]

* igt@kms_pipe_crc_basic@read-crc-frame-sequence@pipe-a-edp-1:
- bat-adlp-6: [ABORT][27] ([i915#7977] / [i915#8434] / [i915#8668]) -> [PASS][28]
[27]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_13492/bat-adlp-6/igt@kms_pipe_crc_basic@[email protected]
[28]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_122208v1/bat-adlp-6/igt@kms_pipe_crc_basic@[email protected]

#### Warnings ####

* igt@core_auth@basic-auth:
- bat-adlp-11: [ABORT][29] ([i915#4423] / [i915#8011]) -> [ABORT][30] ([i915#8011])
[29]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_13492/bat-adlp-11/igt@[email protected]
[30]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_122208v1/bat-adlp-11/igt@[email protected]

* igt@kms_psr@primary_page_flip:
- bat-rplp-1: [ABORT][31] ([i915#8442] / [i915#8668] / [i915#8860]) -> [SKIP][32] ([i915#1072])
[31]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_13492/bat-rplp-1/igt@kms_psr@primary_page_flip.html
[32]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_122208v1/bat-rplp-1/igt@kms_psr@primary_page_flip.html

[fdo#103375]: https://bugs.freedesktop.org/show_bug.cgi?id=103375
[i915#1072]: https://gitlab.freedesktop.org/drm/intel/issues/1072
[i915#4423]: https://gitlab.freedesktop.org/drm/intel/issues/4423
[i915#5122]: https://gitlab.freedesktop.org/drm/intel/issues/5122
[i915#7059]: https://gitlab.freedesktop.org/drm/intel/issues/7059
[i915#7077]: https://gitlab.freedesktop.org/drm/intel/issues/7077
[i915#7507]: https://gitlab.freedesktop.org/drm/intel/issues/7507
[i915#7828]: https://gitlab.freedesktop.org/drm/intel/issues/7828
[i915#7913]: https://gitlab.freedesktop.org/drm/intel/issues/7913
[i915#7940]: https://gitlab.freedesktop.org/drm/intel/issues/7940
[i915#7977]: https://gitlab.freedesktop.org/drm/intel/issues/7977
[i915#8011]: https://gitlab.freedesktop.org/drm/intel/issues/8011
[i915#8434]: https://gitlab.freedesktop.org/drm/intel/issues/8434
[i915#8442]: https://gitlab.freedesktop.org/drm/intel/issues/8442
[i915#8469]: https://gitlab.freedesktop.org/drm/intel/issues/8469
[i915#8497]: https://gitlab.freedesktop.org/drm/intel/issues/8497
[i915#8668]: https://gitlab.freedesktop.org/drm/intel/issues/8668
[i915#8860]: https://gitlab.freedesktop.org/drm/intel/issues/8860

Build changes
-------------

* Linux: CI_DRM_13492 -> Patchwork_122208v1

CI-20190529: 20190529
CI_DRM_13492: 525b387a224ced0a360fcbf92794392999de7208 @ git://anongit.freedesktop.org/gfx-ci/linux
IGT_7422: a7b9e93b67f02d17b99f9331fdcda14e21172c8c @ https://gitlab.freedesktop.org/drm/igt-gpu-tools.git
Patchwork_122208v1: 525b387a224ced0a360fcbf92794392999de7208 @ git://anongit.freedesktop.org/gfx-ci/linux

### Linux commits

2c3cf605a9d7 drm/i915: Fix mistake in intel_modeset_all_pipes condition

== Logs ==

For more details see: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_122208v1/index.html