Skip to contentSkip to conversation

Block DC6 on Vblank enable for Panel Replay

PATCH Superseded Jouni Högander 2 participants 5 messages Sep 16, 2024

Subsystems (3)

v2 of 5 Superseded Latest is v5 →

lore
Share & tools
lore
#0 lore raw

v2 cover Block DC6 on Vblank enable for Panel Replay

We need to block DC6 entry in case of Panel Replay as enabling VBI doesn't prevent DC6 in case of Panel Replay. This causes problems if user-space is polling for vblank events.

v2: set/clear block_dc6_needed in intel_crtc_vblank_on/off

Jouni Högander (2):
drm/i915/display: Add block_dc6_needed variable into intel_crtc drm/i915/display: Prevent DC6 while vblank is enabled for Panel Replay

 drivers/gpu/drm/i915/display/intel_crtc.c     | 12 ++++++++
 .../gpu/drm/i915/display/intel_display_core.h |  2 ++
 .../gpu/drm/i915/display/intel_display_irq.c  | 28 +++++++++++++++++++
 .../drm/i915/display/intel_display_types.h    |  7 +++++
 drivers/gpu/drm/i915/display/intel_psr.c      |  1 +
 5 files changed, 50 insertions(+)
Signature · 1 line
2.34.1
#1 lore raw

PATCH v2 1/2 drm/i915/display: Add block_dc6_needed variable into intel_crtc

We need to block DC6 entry in case of Panel Replay as enabling VBI doesn't prevent DC6 in case of Panel Replay. This causes problems if user-space is polling for vblank events. For this purpose add new block_dc6_needed variable into intel_crtc. Check if eDP Panel Replay is possible and set the variable accordingly.

v2: set/clear block_dc6_needed in intel_crtc_vblank_on/off

---
 drivers/gpu/drm/i915/display/intel_crtc.c          | 12 ++++++++++++
 drivers/gpu/drm/i915/display/intel_display_types.h |  7 +++++++
 drivers/gpu/drm/i915/display/intel_psr.c           |  1 +
 3 files changed, 20 insertions(+)
drivers/gpu/drm/i915/display/intel_crtc.c +12 -0
index aed3853952be8..e00f2b0a54be6 100644
@@ -24,6 +24,7 @@
 #include "intel_display_irq.h"
 #include "intel_display_trace.h"
 #include "intel_display_types.h"
+#include "intel_dp.h"
 #include "intel_drrs.h"
 #include "intel_dsi.h"
 #include "intel_fifo_underrun.h"
@@ -123,6 +124,15 @@ u32 intel_crtc_max_vblank_count(const struct intel_crtc_state *crtc_state)
 void intel_crtc_vblank_on(const struct intel_crtc_state *crtc_state)
 {
 	struct intel_crtc *crtc = to_intel_crtc(crtc_state->uapi.crtc);
+	struct intel_encoder *encoder;
+
+	for_each_encoder_on_crtc(crtc->base.dev, &crtc->base, encoder) {
+		struct intel_dp *intel_dp = enc_to_intel_dp(encoder);
+
+		if (intel_dp_is_edp(intel_dp) &&
+		    CAN_PANEL_REPLAY(intel_dp))
+			crtc->block_dc6_needed = true;
+	}
 
 	assert_vblank_disabled(&crtc->base);
 	drm_crtc_set_max_vblank_count(&crtc->base,
@@ -150,6 +160,8 @@ void intel_crtc_vblank_off(const struct intel_crtc_state *crtc_state)
 
 	drm_crtc_vblank_off(&crtc->base);
 	assert_vblank_disabled(&crtc->base);
+
+	crtc->block_dc6_needed = false;
 }
 
 struct intel_crtc_state *intel_crtc_state_alloc(struct intel_crtc *crtc)
drivers/gpu/drm/i915/display/intel_display_types.h +7 -0
index 000ab373c8879..df0c3eb750809 100644
@@ -1413,6 +1413,13 @@ struct intel_crtc {
 #ifdef CONFIG_DEBUG_FS
 	struct intel_pipe_crc pipe_crc;
 #endif
+
+	/*
+	 * We need to block DC6 entry in case of Panel Replay as enabling VBI doesn't
+	 * prevent DC6 in case of Panel Replay. This causes problems if user-space is
+	 * polling for vblank events.
+	 */
+	u8 block_dc6_needed;
 };
 
 struct intel_plane {
drivers/gpu/drm/i915/display/intel_psr.c +1 -0
index 1a4ef231a53ca..71ef64a51bacc 100644
@@ -35,6 +35,7 @@
 #include "intel_cursor_regs.h"
 #include "intel_ddi.h"
 #include "intel_de.h"
+#include "intel_display_irq.h"
 #include "intel_display_types.h"
 #include "intel_dp.h"
 #include "intel_dp_aux.h"
Signature · 1 line
2.34.1
#2 lore raw

PATCH v2 2/2 drm/i915/display: Prevent DC6 while vblank is enabled for Panel Replay

In reply to Jouni Högander

We need to block DC6 entry in case of Panel Replay as enabling VBI doesn't prevent DC6 in case of Panel Replay. This causes problems if user-space is polling for vblank events.

Fix this by setting target DC state as DC_STATE_EN_UPTO_DC5 when both source and sink are supporting eDP Panel Replay and VBI is enabled.

v2:
- use READ_ONCE in intel_display_vblank_work
- use DC_STATE_DISABLE instead of DC_STATE_EN_UPTO_DC6
- use intel_crtc->block_dc6_needed

---
 .../gpu/drm/i915/display/intel_display_core.h |  2 ++
 .../gpu/drm/i915/display/intel_display_irq.c  | 28 +++++++++++++++++++
 2 files changed, 30 insertions(+)
drivers/gpu/drm/i915/display/intel_display_core.h +2 -0
index 0a711114ff2b4..0707bc2047931 100644
@@ -457,6 +457,8 @@ struct intel_display {
 		/* For i915gm/i945gm vblank irq workaround */
 		u8 vblank_enabled;
 
+		struct work_struct vblank_work;
+
 		u32 de_irq_mask[I915_MAX_PIPES];
 		u32 pipestat_irq_mask[I915_MAX_PIPES];
 	} irq;
drivers/gpu/drm/i915/display/intel_display_irq.c +28 -0
index 8f13f148c73e3..4bdc67e1baa31 100644
@@ -1361,16 +1361,38 @@ static bool gen11_dsi_configure_te(struct intel_crtc *intel_crtc,
 	return true;
 }
 
+static void intel_display_vblank_work(struct work_struct *work)
+{
+	struct intel_display *display =
+		container_of(work, typeof(*display), irq.vblank_work);
+	struct drm_i915_private *i915 = to_i915(display->drm);
+	u8 vblank_enabled = READ_ONCE(display->irq.vblank_enabled);
+
+	/*
+	 * NOTE: intel_display_power_set_target_dc_state is used only by PSR
+	 * code for DC3CO handling. DC3CO target state is currently disabled in
+	 * PSR code. If DC3CO is taken into use we need take that into account
+	 * here as well.
+	 */
+	intel_display_power_set_target_dc_state(i915, vblank_enabled ? DC_STATE_DISABLE :
+						DC_STATE_EN_UPTO_DC6);
+}
+
 int bdw_enable_vblank(struct drm_crtc *_crtc)
 {
 	struct intel_crtc *crtc = to_intel_crtc(_crtc);
+	struct intel_display *display = to_intel_display(crtc);
 	struct drm_i915_private *dev_priv = to_i915(crtc->base.dev);
 	enum pipe pipe = crtc->pipe;
 	unsigned long irqflags;
+	u8 block_dc6_needed = READ_ONCE(crtc->block_dc6_needed);
 
 	if (gen11_dsi_configure_te(crtc, true))
 		return 0;
 
+	if (display->irq.vblank_enabled++ == 0 && block_dc6_needed)
+		schedule_work(&display->irq.vblank_work);
+
 	spin_lock_irqsave(&dev_priv->irq_lock, irqflags);
 	bdw_enable_pipe_irq(dev_priv, pipe, GEN8_PIPE_VBLANK);
 	spin_unlock_irqrestore(&dev_priv->irq_lock, irqflags);
@@ -1436,6 +1458,7 @@ void ilk_disable_vblank(struct drm_crtc *crtc)
 void bdw_disable_vblank(struct drm_crtc *_crtc)
 {
 	struct intel_crtc *crtc = to_intel_crtc(_crtc);
+	struct intel_display *display = to_intel_display(crtc);
 	struct drm_i915_private *dev_priv = to_i915(crtc->base.dev);
 	enum pipe pipe = crtc->pipe;
 	unsigned long irqflags;
@@ -1446,6 +1469,9 @@ void bdw_disable_vblank(struct drm_crtc *_crtc)
 	spin_lock_irqsave(&dev_priv->irq_lock, irqflags);
 	bdw_disable_pipe_irq(dev_priv, pipe, GEN8_PIPE_VBLANK);
 	spin_unlock_irqrestore(&dev_priv->irq_lock, irqflags);
+
+	if (--display->irq.vblank_enabled == 0)
+		schedule_work(&display->irq.vblank_work);
 }
 
 void vlv_display_irq_reset(struct drm_i915_private *dev_priv)
@@ -1871,4 +1897,6 @@ void intel_display_irq_init(struct drm_i915_private *i915)
 		i915->display.irq.display_irqs_enabled = false;
 
 	intel_hotplug_irq_init(i915);
+
+	INIT_WORK(&i915->display.irq.vblank_work, intel_display_vblank_work);
 }
Signature · 1 line
2.34.1
#4 lore raw

✗ Fi.CI.BAT: failure for Block DC6 on Vblank enable for Panel Replay (rev2)

In reply to Jouni Högander
== Series Details ==

== Series Details ==

Series: Block DC6 on Vblank enable for Panel Replay (rev2)
URL : https://patchwork.freedesktop.org/series/138630/
State : failure

== Summary ==

CI Bug Log - changes from CI_DRM_15420 -> Patchwork_138630v2
====================================================

Summary
-------

**FAILURE**

Serious unknown changes coming with Patchwork_138630v2 absolutely need to be verified manually.

If you think the reported changes have nothing to do with the changes
introduced in Patchwork_138630v2, please notify your bug team ([email protected]) to allow them to document this new failure mode, which will reduce false positives in CI.

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

Participating hosts (40 -> 39)
------------------------------

Additional (1): bat-arlh-3
Missing (2): fi-glk-j4005 fi-bsw-n3050

Possible new issues
-------------------

Here are the unknown changes that may have been introduced in Patchwork_138630v2:

### IGT changes ###

#### Possible regressions ####

* igt@i915_module_load@load:
- fi-pnv-d510: [PASS][1] -> [ABORT][2]
[1]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_15420/fi-pnv-d510/igt@[email protected]
[2]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_138630v2/fi-pnv-d510/igt@[email protected]
- fi-ilk-650: [PASS][3] -> [ABORT][4]
[3]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_15420/fi-ilk-650/igt@[email protected]
[4]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_138630v2/fi-ilk-650/igt@[email protected]
- fi-blb-e6850: [PASS][5] -> [ABORT][6]
[5]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_15420/fi-blb-e6850/igt@[email protected]
[6]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_138630v2/fi-blb-e6850/igt@[email protected]
- fi-ivb-3770: [PASS][7] -> [ABORT][8]
[7]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_15420/fi-ivb-3770/igt@[email protected]
[8]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_138630v2/fi-ivb-3770/igt@[email protected]

* igt@kms_busy@basic:
- fi-cfl-8109u: [PASS][9] -> [INCOMPLETE][10]
[9]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_15420/fi-cfl-8109u/igt@[email protected]
[10]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_138630v2/fi-cfl-8109u/igt@[email protected]

* igt@kms_flip@basic-flip-vs-dpms:
- fi-elk-e7500: [PASS][11] -> [ABORT][12] +1 other test abort
[11]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_15420/fi-elk-e7500/igt@[email protected]
[12]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_138630v2/fi-elk-e7500/igt@[email protected]

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

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

### IGT changes ###

#### Issues hit ####

* igt@kms_busy@basic@modeset:
- fi-cfl-8109u: [PASS][13] -> [INCOMPLETE][14] ([i915#10056])
[13]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_15420/fi-cfl-8109u/igt@kms_busy@[email protected]
[14]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_138630v2/fi-cfl-8109u/igt@kms_busy@[email protected]

#### Possible fixes ####

* igt@fbdev@write:
- bat-arls-1: [DMESG-FAIL][15] ([i915#12102]) -> [PASS][16]
[15]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_15420/bat-arls-1/igt@[email protected]
[16]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_138630v2/bat-arls-1/igt@[email protected]

* igt@i915_selftest@live:
- bat-arls-1: [DMESG-WARN][17] ([i915#10341] / [i915#12133]) -> [PASS][18]
[17]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_15420/bat-arls-1/igt@[email protected]
[18]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_138630v2/bat-arls-1/igt@[email protected]
- bat-atsm-1: [INCOMPLETE][19] ([i915#12133]) -> [PASS][20]
[19]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_15420/bat-atsm-1/igt@[email protected]
[20]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_138630v2/bat-atsm-1/igt@[email protected]

* igt@i915_selftest@live@hangcheck:
- bat-arls-1: [DMESG-WARN][21] ([i915#11349]) -> [PASS][22]
[21]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_15420/bat-arls-1/igt@i915_selftest@[email protected]
[22]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_138630v2/bat-arls-1/igt@i915_selftest@[email protected]

* igt@i915_selftest@live@requests:
- bat-atsm-1: [INCOMPLETE][23] ([i915#12237]) -> [PASS][24]
[23]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_15420/bat-atsm-1/igt@i915_selftest@[email protected]
[24]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_138630v2/bat-atsm-1/igt@i915_selftest@[email protected]

#### Warnings ####

* igt@fbdev@read:
- bat-arls-1: [FAIL][25] ([i915#12030]) -> [DMESG-WARN][26] ([i915#12102])
[25]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_15420/bat-arls-1/igt@[email protected]
[26]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_138630v2/bat-arls-1/igt@[email protected]

* igt@i915_module_load@reload:
- bat-arls-5: [DMESG-WARN][27] ([i915#11637]) -> [DMESG-WARN][28] ([i915#11637] / [i915#1982])
[27]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_15420/bat-arls-5/igt@[email protected]
[28]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_138630v2/bat-arls-5/igt@[email protected]

{name}: This element is suppressed. This means it is ignored when computing
the status of the difference (SUCCESS, WARNING, or FAILURE).

[i915#10056]: https://gitlab.freedesktop.org/drm/i915/kernel/-/issues/10056
[i915#10196]: https://gitlab.freedesktop.org/drm/i915/kernel/-/issues/10196
[i915#10341]: https://gitlab.freedesktop.org/drm/i915/kernel/-/issues/10341
[i915#11343]: https://gitlab.freedesktop.org/drm/i915/kernel/-/issues/11343
[i915#11346]: https://gitlab.freedesktop.org/drm/i915/kernel/-/issues/11346
[i915#11349]: https://gitlab.freedesktop.org/drm/i915/kernel/-/issues/11349
[i915#11637]: https://gitlab.freedesktop.org/drm/i915/kernel/-/issues/11637
[i915#11666]: https://gitlab.freedesktop.org/drm/i915/kernel/-/issues/11666
[i915#11671]: https://gitlab.freedesktop.org/drm/i915/kernel/-/issues/11671
[i915#11681]: https://gitlab.freedesktop.org/drm/i915/kernel/-/issues/11681
[i915#11723]: https://gitlab.freedesktop.org/drm/i915/kernel/-/issues/11723
[i915#11724]: https://gitlab.freedesktop.org/drm/i915/kernel/-/issues/11724
[i915#11725]: https://gitlab.freedesktop.org/drm/i915/kernel/-/issues/11725
[i915#11726]: https://gitlab.freedesktop.org/drm/i915/kernel/-/issues/11726
[i915#12030]: https://gitlab.freedesktop.org/drm/i915/kernel/-/issues/12030
[i915#12061]: https://gitlab.freedesktop.org/drm/i915/kernel/-/issues/12061
[i915#12102]: https://gitlab.freedesktop.org/drm/i915/kernel/-/issues/12102
[i915#12133]: https://gitlab.freedesktop.org/drm/i915/kernel/-/issues/12133
[i915#12203]: https://gitlab.freedesktop.org/drm/i915/kernel/-/issues/12203
[i915#12237]: https://gitlab.freedesktop.org/drm/i915/kernel/-/issues/12237
[i915#1982]: https://gitlab.freedesktop.org/drm/i915/kernel/-/issues/1982
[i915#8809]: https://gitlab.freedesktop.org/drm/i915/kernel/-/issues/8809
[i915#9318]: https://gitlab.freedesktop.org/drm/i915/kernel/-/issues/9318
[i915#9886]: https://gitlab.freedesktop.org/drm/i915/kernel/-/issues/9886

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

* Linux: CI_DRM_15420 -> Patchwork_138630v2

CI-20190529: 20190529
CI_DRM_15420: 69e534b8a94723926a286f6aa2e2999cd99bcb45 @ git://anongit.freedesktop.org/gfx-ci/linux
IGT_8020: 7860f9a9394da0a18fc0bf0223a79b533e569f95 @ https://gitlab.freedesktop.org/drm/igt-gpu-tools.git
Patchwork_138630v2: 69e534b8a94723926a286f6aa2e2999cd99bcb45 @ git://anongit.freedesktop.org/gfx-ci/linux

== Logs ==

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