Skip to contentSkip to conversation

drm/i915/display: Refresh global state after non-atomic sanitization

PATCH RESEND New Hanson Wang 2 participants 3 messages Nov 26

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

PATCH RESEND v2 1/1 drm/i915/display: Refresh global state after non-atomic sanitization

Hardware state readout accounts firmware planes in the global bandwidth state before sanitization. skl_dbuf_sanitize() may subsequently disable those planes through intel_plane_disable_noatomic(), which clears the CRTC-local plane data but leaves the global bandwidth entries unchanged. A later atomic check can see identical, already cleared old and new CRTC-local inputs and skip the global update. The stale data rate and plane count then remain part of the QGV bandwidth check.

The issue was reproduced on an N5105 system running mainline. After DBUF sanitization had cleared pipe B's local plane state, the global bandwidth state still accounted for 196000 kB/s and one plane.

Add intel_display_update_hw_state() to group the existing bandwidth, DBUF bandwidth and CDCLK state updates. Keep the initial update after hardware readout, and repeat it after intel_wm_sanitize(), once the non-atomic CRTC and plane sanitization is complete. Update DBUF bandwidth before CDCLK, which derives a minimum clock requirement from that state.

Also refresh the global state after intel_initial_plane_config(): failure to reconstruct a BIOS framebuffer can disable a primary plane after the main sanitization sequence has finished.

Reuse the existing accounting helpers so logically enabled but inactive CRTCs retain their memory bandwidth reservations.

Fixes 15512021eb39 ("drm/i915: Workaround broken BIOS DBUF configuration on TGL/RKL")

---
Resend v2 as a new thread at Ville's request so Patchwork can pick it up correctly and CI can run. No changes from v2.

Changes in v2:
- Add intel_display_update_hw_state() as suggested by Ville, reusing the existing BW, DBUF bandwidth and CDCLK update helpers.
- Refresh global accounting after the complete modeset sanitization sequence, including intel_wm_sanitize(), instead of adding per-CRTC update helpers to intel_plane_disable_noatomic().
- Also cover non-atomic plane disable on BIOS framebuffer takeover failure in intel_initial_plane_config().
- Preserve the initial readout update and the existing intermediate CRTC-disable bookkeeping used during sanitization.
- Add a Fixes tag for the DBUF sanitization path.

Testing:
- W=1 compilation of both changed C files for i915 and Xe display.
- Strict checkpatch passed.
- Boot-tested v2 on an affected N5105 system with HDMI connected, based on 666539eecdf4 (7.4.0-rc3+). The original DBUF sanitization path was reproduced, and pipe B's global accounting changed from 196000 kB/s and one plane to 0 kB/s and zero planes after intel_wm_sanitize().
- Post-boot inspection confirmed that pipe B contributed no bandwidth or planes to the global BW and DBUF bandwidth states. Subsequent QGV checks no longer included the stale contribution.
- This was a v1-to-v2 boot test, not an unpatched-versus-patched comparison.
- The original high-bandwidth workload, HDMI hotplug, suspend/resume, cold boot, enabled-but-inactive transitions and BIOS framebuffer reconstruction failure were not tested with v2.

 .../drm/i915/display/intel_initial_plane.c    |  4 ++++
 .../drm/i915/display/intel_modeset_setup.c    | 24 ++++++++++++++++---
 .../drm/i915/display/intel_modeset_setup.h    |  1 +
 3 files changed, 26 insertions(+), 3 deletions(-)
drivers/gpu/drm/i915/display/intel_initial_plane.c +4 -0
index 7427f41e4d7e..022798baf7e0 100644
@@ -15,6 +15,7 @@
 #include "intel_fb.h"
 #include "intel_frontbuffer.h"
 #include "intel_initial_plane.h"
+#include "intel_modeset_setup.h"
 #include "intel_parent.h"
 #include "intel_plane.h"
 
@@ -237,4 +238,7 @@ void intel_initial_plane_config(struct intel_display *display)
 
 		plane_config_fini(display, plane_config);
 	}
+
+	/* Failure to reconstruct the BIOS framebuffer may disable a plane. */
+	intel_display_update_hw_state(display);
 }
drivers/gpu/drm/i915/display/intel_modeset_setup.c +21 -3
index 6aed88173770..bb8f3acd3595 100644
@@ -14,6 +14,7 @@
 #include "i9xx_wm.h"
 #include "intel_atomic.h"
 #include "intel_bw.h"
+#include "intel_cdclk.h"
 #include "intel_cmtg.h"
 #include "intel_color.h"
 #include "intel_crtc.h"
@@ -37,6 +38,22 @@
 #include "intel_wm.h"
 #include "skl_watermark.h"
 
+/**
+ * intel_display_update_hw_state - synchronize global display accounting
+ * @display: display instance
+ *
+ * Update the global state from the current CRTC and plane state during
+ * hardware state setup, with atomic commits excluded. Call this again
+ * after non-atomic sanitization has changed the local state.
+ */
+void intel_display_update_hw_state(struct intel_display *display)
+{
+	intel_bw_update_hw_state(display);
+	/* CDCLK requirements depend on the DBUF bandwidth state. */
+	intel_dbuf_bw_update_hw_state(display);
+	intel_cdclk_update_hw_state(display);
+}
+
 static void intel_crtc_disable_noatomic_begin(struct intel_crtc *crtc,
 					      struct drm_modeset_acquire_ctx *ctx)
 {
@@ -877,9 +894,7 @@ static void intel_modeset_readout_hw_state(struct intel_display *display)
 	if (DISPLAY_VER(display) >= 9)
 		intel_wm_get_hw_state(display);
 
-	intel_bw_update_hw_state(display);
-	intel_dbuf_bw_update_hw_state(display);
-	intel_cdclk_update_hw_state(display);
+	intel_display_update_hw_state(display);
 
 	intel_pmdemand_init_pmdemand_params(display, pmdemand_state);
 }
@@ -995,6 +1010,9 @@ void intel_modeset_setup_hw_state(struct intel_display *display,
 		intel_wm_get_hw_state(display);
 	intel_wm_sanitize(display);
 
+	/* Sanitization may have disabled planes without an atomic commit. */
+	intel_display_update_hw_state(display);
+
 	for_each_intel_crtc(display, crtc) {
 		struct intel_crtc_state *crtc_state =
 			to_intel_crtc_state(crtc->base.state);
drivers/gpu/drm/i915/display/intel_modeset_setup.h +1 -0
index f5e6f3ae9572..28a9165f7fca 100644
@@ -9,6 +9,7 @@
 struct drm_modeset_acquire_ctx;
 struct intel_display;
 
+void intel_display_update_hw_state(struct intel_display *display);
 void intel_modeset_setup_hw_state(struct intel_display *display,
 				  struct drm_modeset_acquire_ctx *ctx);
 

base-commit: 666539eecdf4db623f5e3c3e55cf9f2dfad24aa4

Signature · 1 line
2.34.1
#1 lore raw

✗ LGCI.VerificationFailed: failure for drm/i915/display: Refresh global state after non-atomic sanitization

== Series Details ==

== Series Details ==

Series: drm/i915/display: Refresh global state after non-atomic sanitization
URL : https://patchwork.freedesktop.org/series/179670/
State : failure

== Summary ==

Series author address '[email protected]' is not on the allowlist, which prevents CI from being automatically triggered. If you want CI to run for this series, ask Patchwork project owners to click 'retest' on the series in Patchwork. Exception occurred during validation, bailing out!
Build URL: http://gfx-ci.igk.intel.com:8080/job/CI_PW_kernel/193828/ (on built-in)

#2 lore raw

✓ i915.CI.BAT: success for drm/i915/display: Refresh global state after non-atomic sanitization (rev2)

In reply to Hanson Wang
== Series Details ==

== Series Details ==

Series: drm/i915/display: Refresh global state after non-atomic sanitization (rev2)
URL : https://patchwork.freedesktop.org/series/179670/
State : success

== Summary ==

CI Bug Log - changes from CI_DRM_19614 -> Patchwork_179670v2
====================================================

Summary
-------

**SUCCESS**

No regressions found.

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

Participating hosts (40 -> 38)
------------------------------

Missing (2): bat-dg2-13 fi-glk-j4005

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

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

### IGT changes ###

#### Issues hit ####

* igt@kms_pm_rpm@basic-pci-d3-state:
- bat-rpls-4: [PASS][1] -> [DMESG-WARN][2] ([i915#13400])
[1]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_19614/bat-rpls-4/igt@[email protected]
[2]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_179670v2/bat-rpls-4/igt@[email protected]

#### Possible fixes ####

* igt@i915_selftest@live:
- fi-skl-6600u: [INCOMPLETE][3] -> [PASS][4] +1 other test pass
[3]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_19614/fi-skl-6600u/igt@[email protected]
[4]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_179670v2/fi-skl-6600u/igt@[email protected]

* igt@vgem_basic@unload:
- bat-rpls-4: [DMESG-WARN][5] ([i915#13400]) -> [PASS][6]
[5]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_19614/bat-rpls-4/igt@[email protected]
[6]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_179670v2/bat-rpls-4/igt@[email protected]

[i915#13400]: https://gitlab.freedesktop.org/drm/i915/kernel/-/issues/13400

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

* Linux: CI_DRM_19614 -> Patchwork_179670v2

CI-20190529: 20190529
CI_DRM_19614: 38fc48e17b82ca1d9903a982ce596280f8172326 @ git://anongit.freedesktop.org/gfx-ci/linux
IGT_9204: 52e9317c945f97f29fbec75be29280fc7b00cf32 @ https://gitlab.freedesktop.org/drm/igt-gpu-tools.git
Patchwork_179670v2: 38fc48e17b82ca1d9903a982ce596280f8172326 @ git://anongit.freedesktop.org/gfx-ci/linux

== Logs ==

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