Skip to contentSkip to conversation

eDP DRRS based on frontbuffer tracking

PATCH In review Ramalingam C 3 participants 33 messages Feb 13, 2015 – Mar 5, 2015

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

cover eDP DRRS based on frontbuffer tracking

This series includes a preparation patch for drrs support across differnt platforms in intel_dp_set_m_n along with last 5 pending patches of V3 eDP DRRS patch series.

New series is submitted to make the review more comfortable and to display the dependancy of the patches explicitly.

Durgadoss R (1):
drm/i915: Enable eDP DRRS for CHV

Ramalingam C (1):
drm/i915: Add support for DRRS in intel_dp_set_m_n

Vandana Kannan (4):
drm/i915/bdw: Add support for DRRS to switch RR
drm/i915: Support for RR switching on VLV
Documentation/drm: DocBook integration for DRRS
drm/i915: Add debugfs entry for DRRS

 Documentation/DocBook/drm.tmpl       |   11 ++++
 drivers/gpu/drm/i915/i915_debugfs.c  |   99 ++++++++++++++++++++++++++++
 drivers/gpu/drm/i915/i915_reg.h      |    1 +
 drivers/gpu/drm/i915/intel_display.c |   32 ++++++---
 drivers/gpu/drm/i915/intel_dp.c      |  121 ++++++++++++++++++++++++++++++++--
 drivers/gpu/drm/i915/intel_drv.h     |   22 ++++++-
 6 files changed, 273 insertions(+), 13 deletions(-)
Signature · 6 lines
1.7.9.5

_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
#1 lore raw

PATCH 1/6 drm/i915: Add support for DRRS in intel_dp_set_m_n

Till Gen 7 we have two sets of M_N registers, but Gen 8 onwards we have only one M_N register set. To support DRRS on both scenarios a input parameter to intel_dp_set_m_n is added.

In case of DRRS, When platform provides two set of M_N registers for dp, we can program them with two different dividers and switch between them. But when only one such register set is provided, we have to program the required divider M_N value on that registers itself.

Two enum members M1_N1 and M2_N2 are defined to represent the above scenarios.

M1_N1 : Program dp_m_n on M1_N1 registers
dp_m2_n2 on M2_N2 registers (If supported)

M2_N2 : Program dp_m2_n2 on M1_N1 registers
M2_N2 registers are not supported

---
 drivers/gpu/drm/i915/intel_display.c |   30 +++++++++++++++++++++++-------
 drivers/gpu/drm/i915/intel_drv.h     |   22 +++++++++++++++++++++-
 2 files changed, 44 insertions(+), 8 deletions(-)
drivers/gpu/drm/i915/intel_display.c +23 -7
index 3b0fe9f..2af24a7 100644
@@ -4322,7 +4322,7 @@ static void ironlake_crtc_enable(struct drm_crtc *crtc)
 		intel_prepare_shared_dpll(intel_crtc);
 
 	if (intel_crtc->config->has_dp_encoder)
-		intel_dp_set_m_n(intel_crtc);
+		intel_dp_set_m_n(intel_crtc, M1_N1);
 
 	intel_set_pipe_timings(intel_crtc);
 
@@ -4430,7 +4430,7 @@ static void haswell_crtc_enable(struct drm_crtc *crtc)
 		intel_enable_shared_dpll(intel_crtc);
 
 	if (intel_crtc->config->has_dp_encoder)
-		intel_dp_set_m_n(intel_crtc);
+		intel_dp_set_m_n(intel_crtc, M1_N1);
 
 	intel_set_pipe_timings(intel_crtc);
 
@@ -5044,7 +5044,7 @@ static void valleyview_crtc_enable(struct drm_crtc *crtc)
 	}
 
 	if (intel_crtc->config->has_dp_encoder)
-		intel_dp_set_m_n(intel_crtc);
+		intel_dp_set_m_n(intel_crtc, M1_N1);
 
 	intel_set_pipe_timings(intel_crtc);
 
@@ -5120,7 +5120,7 @@ static void i9xx_crtc_enable(struct drm_crtc *crtc)
 	i9xx_set_pll_dividers(intel_crtc);
 
 	if (intel_crtc->config->has_dp_encoder)
-		intel_dp_set_m_n(intel_crtc);
+		intel_dp_set_m_n(intel_crtc, M1_N1);
 
 	intel_set_pipe_timings(intel_crtc);
 
@@ -5895,13 +5895,29 @@ static void intel_cpu_transcoder_set_m_n(struct intel_crtc *crtc,
 	}
 }
 
-void intel_dp_set_m_n(struct intel_crtc *crtc)
+void intel_dp_set_m_n(struct intel_crtc *crtc, enum link_m_n_set m_n)
 {
+	struct intel_link_m_n *dp_m_n, *dp_m2_n2 = NULL;
+
+	if (m_n == M1_N1) {
+		dp_m_n = &crtc->config->dp_m_n;
+		dp_m2_n2 = &crtc->config->dp_m2_n2;
+	} else if (m_n == M2_N2) {
+
+		/*
+		 * M2_N2 registers are not supported. Hence m2_n2 divider value
+		 * needs to be programmed into M1_N1.
+		 */
+		dp_m_n = &crtc->config->dp_m2_n2;
+	} else {
+		DRM_ERROR("Unsupported divider value\n");
+		return;
+	}
+
 	if (crtc->config->has_pch_encoder)
 		intel_pch_transcoder_set_m_n(crtc, &crtc->config->dp_m_n);
 	else
-		intel_cpu_transcoder_set_m_n(crtc, &crtc->config->dp_m_n,
-						   &crtc->config->dp_m2_n2);
+		intel_cpu_transcoder_set_m_n(crtc, dp_m_n, dp_m2_n2);
 }
 
 static void vlv_update_pll(struct intel_crtc *crtc,
drivers/gpu/drm/i915/intel_drv.h +21 -1
index 1de8e20..1fb1529 100644
@@ -593,6 +593,26 @@ struct intel_hdmi {
 struct intel_dp_mst_encoder;
 #define DP_MAX_DOWNSTREAM_PORTS		0x10
 
+/*
+ * enum link_m_n_set:
+ *	When platform provides two set of M_N registers for dp, we can
+ *	program them and switch between them incase of DRRS.
+ *	But When only one such register is provided, we have to program the
+ *	required divider value on that registers itself based on the DRRS state.
+ *
+ * M1_N1	: Program dp_m_n on M1_N1 registers
+ *			  dp_m2_n2 on M2_N2 registers (If supported)
+ *
+ * M2_N2	: Program dp_m2_n2 on M1_N1 registers
+ *			  M2_N2 registers are not supported
+ */
+
+enum link_m_n_set {
+	/* Sets the m1_n1 and m2_n2 */
+	M1_N1 = 0,
+	M2_N2
+};
+
 struct intel_dp {
 	uint32_t output_reg;
 	uint32_t aux_ch_ctl_reg;
@@ -994,7 +1014,7 @@ void hsw_enable_pc8(struct drm_i915_private *dev_priv);
 void hsw_disable_pc8(struct drm_i915_private *dev_priv);
 void intel_dp_get_m_n(struct intel_crtc *crtc,
 		      struct intel_crtc_state *pipe_config);
-void intel_dp_set_m_n(struct intel_crtc *crtc);
+void intel_dp_set_m_n(struct intel_crtc *crtc, enum link_m_n_set m_n);
 int intel_dotclock_calculate(int link_freq, const struct intel_link_m_n *m_n);
 void
 ironlake_check_encoder_dotclock(const struct intel_crtc_state *pipe_config,
Signature · 6 lines
1.7.9.5

_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
Reviewed-by on v1 1/6
#2 lore raw

Re: [PATCH 1/6] drm/i915: Add support for DRRS in intel_dp_set_m_n

Quoted 9 lines · Ramalingam C

Till Gen 7 we have two sets of M_N registers, but Gen 8 onwards we have only one M_N register set. To support DRRS on both scenarios a input parameter to intel_dp_set_m_n is added.

In case of DRRS, When platform provides two set of M_N registers for dp, we can program them with two different dividers and switch between them. But when only one such register set is provided, we have to program the required divider M_N value on that registers itself.

Quoted 8 lines

Two enum members M1_N1 and M2_N2 are defined to represent the above scenarios.

M1_N1 : Program dp_m_n on M1_N1 registers
dp_m2_n2 on M2_N2 registers (If supported)

M2_N2 : Program dp_m2_n2 on M1_N1 registers
M2_N2 registers are not supported

On a quickly first look this enum name confused me... "Why name M2_N2 when it isn't supported?!"
But than I remembered the logic behind, read again and saw it was M2_N2 value on dp_m_n register...

Quoted 55 lines
---
 drivers/gpu/drm/i915/intel_display.c |   30 +++++++++++++++++++++++-------
 drivers/gpu/drm/i915/intel_drv.h     |   22 +++++++++++++++++++++-
 2 files changed, 44 insertions(+), 8 deletions(-)
drivers/gpu/drm/i915/intel_display.c +6 -5
index 3b0fe9f..2af24a7 100644
@@ -4322,7 +4322,7 @@ static void ironlake_crtc_enable(struct drm_crtc *crtc)
                intel_prepare_shared_dpll(intel_crtc);
 
        if (intel_crtc->config->has_dp_encoder)
-               intel_dp_set_m_n(intel_crtc);
+               intel_dp_set_m_n(intel_crtc, M1_N1);
 
        intel_set_pipe_timings(intel_crtc);
 
@@ -4430,7 +4430,7 @@ static void haswell_crtc_enable(struct drm_crtc *crtc)
                intel_enable_shared_dpll(intel_crtc);
 
        if (intel_crtc->config->has_dp_encoder)
-               intel_dp_set_m_n(intel_crtc);
+               intel_dp_set_m_n(intel_crtc, M1_N1);
 
        intel_set_pipe_timings(intel_crtc);
 
@@ -5044,7 +5044,7 @@ static void valleyview_crtc_enable(struct drm_crtc *crtc)
        }
 
        if (intel_crtc->config->has_dp_encoder)
-               intel_dp_set_m_n(intel_crtc);
+               intel_dp_set_m_n(intel_crtc, M1_N1);
 
        intel_set_pipe_timings(intel_crtc);
 
@@ -5120,7 +5120,7 @@ static void i9xx_crtc_enable(struct drm_crtc *crtc)
        i9xx_set_pll_dividers(intel_crtc);
 
        if (intel_crtc->config->has_dp_encoder)
-               intel_dp_set_m_n(intel_crtc);
+               intel_dp_set_m_n(intel_crtc, M1_N1);
 
        intel_set_pipe_timings(intel_crtc);
 
@@ -5895,13 +5895,29 @@ static void intel_cpu_transcoder_set_m_n(struct intel_crtc *crtc,
        }
 }
 
-void intel_dp_set_m_n(struct intel_crtc *crtc)
+void intel_dp_set_m_n(struct intel_crtc *crtc, enum link_m_n_set m_n)
 {
+       struct intel_link_m_n *dp_m_n, *dp_m2_n2 = NULL;

drivers/gpu/drm/i915/intel_display.c static void intel_cpu_transcoder_set_m_n(struct intel_crtc *crtc, · line 5910

Quoted 10 lines
drivers/gpu/drm/i915/intel_display.c +10 -0
+
+       if (m_n == M1_N1) {
+               dp_m_n = &crtc->config->dp_m_n;
+               dp_m2_n2 = &crtc->config->dp_m2_n2;
+       } else if (m_n == M2_N2) {
+
+               /*
+                * M2_N2 registers are not supported. Hence m2_n2 divider value
+                * needs to be programmed into M1_N1.
+                */

.. also this good comment refreshed my memory! ;)

Quoted 58 lines
drivers/gpu/drm/i915/intel_display.c +7 -2
+               dp_m_n = &crtc->config->dp_m2_n2;
+       } else {
+               DRM_ERROR("Unsupported divider value\n");
+               return;
+       }
+
        if (crtc->config->has_pch_encoder)
                intel_pch_transcoder_set_m_n(crtc, &crtc->config->dp_m_n);
        else
-               intel_cpu_transcoder_set_m_n(crtc, &crtc->config->dp_m_n,
-                                                  &crtc->config->dp_m2_n2);
+               intel_cpu_transcoder_set_m_n(crtc, dp_m_n, dp_m2_n2);
 }
 
 static void vlv_update_pll(struct intel_crtc *crtc,
drivers/gpu/drm/i915/intel_drv.h +21 -2
index 1de8e20..1fb1529 100644
@@ -593,6 +593,26 @@ struct intel_hdmi {
 struct intel_dp_mst_encoder;
 #define DP_MAX_DOWNSTREAM_PORTS                0x10
 
+/*
+ * enum link_m_n_set:
+ *     When platform provides two set of M_N registers for dp, we can
+ *     program them and switch between them incase of DRRS.
+ *     But When only one such register is provided, we have to program the
+ *     required divider value on that registers itself based on the DRRS state.
+ *
+ * M1_N1       : Program dp_m_n on M1_N1 registers
+ *                       dp_m2_n2 on M2_N2 registers (If supported)
+ *
+ * M2_N2       : Program dp_m2_n2 on M1_N1 registers
+ *                       M2_N2 registers are not supported
+ */
+
+enum link_m_n_set {
+       /* Sets the m1_n1 and m2_n2 */
+       M1_N1 = 0,
+       M2_N2
+};
+
 struct intel_dp {
        uint32_t output_reg;
        uint32_t aux_ch_ctl_reg;
@@ -994,7 +1014,7 @@ void hsw_enable_pc8(struct drm_i915_private *dev_priv);
 void hsw_disable_pc8(struct drm_i915_private *dev_priv);
 void intel_dp_get_m_n(struct intel_crtc *crtc,
                      struct intel_crtc_state *pipe_config);
-void intel_dp_set_m_n(struct intel_crtc *crtc);
+void intel_dp_set_m_n(struct intel_crtc *crtc, enum link_m_n_set m_n);
 int intel_dotclock_calculate(int link_freq, const struct intel_link_m_n *m_n);
 void
 ironlake_check_encoder_dotclock(const struct intel_crtc_state *pipe_config,
--

1.7.9.5

Quoted 4 lines

_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx

Thanks for this change.

Signature · 6 lines
Rodrigo Vivi
Blog: http://blog.vivi.eng.br
_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
#3 lore raw

PATCH 2/6 drm/i915/bdw: Add support for DRRS to switch RR

In reply to Ramalingam C

From: Vandana Kannan <[email protected]>

For Broadwell, there is one instance of Transcoder MN values per transcoder. For dynamic switching between multiple refreshr rates, M/N values may be reprogrammed on the fly. Link N programming triggers update of all data and link M & N registers and the new M/N values will be used in the next frame that is output.

V2: [By Ram]: intel_dp_set_m_n() is rewritten to accommodate

	gen >= 8 [Rodrigo]

V3: Coding style correction [Ram]
V4: [By Ram] intel_dp_set_m_n modifications are moved into a
separate patch, retaining only DRRS related changes here [Rodrigo]

---
 drivers/gpu/drm/i915/intel_dp.c |   16 ++++++++++++++--
 1 file changed, 14 insertions(+), 2 deletions(-)
drivers/gpu/drm/i915/intel_dp.c +14 -2
index 868a07b..6ffbf57 100644
@@ -4793,12 +4793,24 @@ static void intel_dp_set_drrs_state(struct drm_device *dev, int refresh_rate)
 		return;
 	}
 
-	if (INTEL_INFO(dev)->gen > 6 && INTEL_INFO(dev)->gen < 8) {
+	if (INTEL_INFO(dev)->gen >= 8) {
+		switch (index) {
+		case DRRS_HIGH_RR:
+			intel_dp_set_m_n(intel_crtc, M1_N1);
+			break;
+		case DRRS_LOW_RR:
+			intel_dp_set_m_n(intel_crtc, M2_N2);
+			break;
+		case DRRS_MAX_RR:
+		default:
+			DRM_ERROR("Unsupported refreshrate type\n");
+		}
+	} else if (INTEL_INFO(dev)->gen > 6) {
 		reg = PIPECONF(intel_crtc->config->cpu_transcoder);
 		val = I915_READ(reg);
+
 		if (index > DRRS_HIGH_RR) {
 			val |= PIPECONF_EDP_RR_MODE_SWITCH;
-			intel_dp_set_m_n(intel_crtc);
 		} else {
 			val &= ~PIPECONF_EDP_RR_MODE_SWITCH;
 		}
Signature · 6 lines
1.7.9.5

_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
#4 lore raw

Re: [PATCH 2/6] drm/i915/bdw: Add support for DRRS to switch RR

Quoted 29 lines · Ramalingam C

From: Vandana Kannan <[email protected]>

For Broadwell, there is one instance of Transcoder MN values per transcoder. For dynamic switching between multiple refreshr rates, M/N values may be reprogrammed on the fly. Link N programming triggers update of all data and link M & N registers and the new M/N values will be used in the next frame that is output.

V2: [By Ram]: intel_dp_set_m_n() is rewritten to accommodate

        gen >= 8 [Rodrigo]

V3: Coding style correction [Ram]
V4: [By Ram] intel_dp_set_m_n modifications are moved into a
separate patch, retaining only DRRS related changes here [Rodrigo]

---
 drivers/gpu/drm/i915/intel_dp.c |   16 ++++++++++++++--
 1 file changed, 14 insertions(+), 2 deletions(-)
drivers/gpu/drm/i915/intel_dp.c +0 -0
index 868a07b..6ffbf57 100644
@@ -4793,12 +4793,24 @@ static void intel_dp_set_drrs_state(struct drm_device *dev, int refresh_rate)
                return;
        }
 

drivers/gpu/drm/i915/intel_dp.c static void intel_dp_set_drrs_state(struct drm_device *dev, int refresh_rate) · line 4804

Quoted 10 lines
drivers/gpu/drm/i915/intel_dp.c +9 -1
-       if (INTEL_INFO(dev)->gen > 6 && INTEL_INFO(dev)->gen < 8) {
+       if (INTEL_INFO(dev)->gen >= 8) {
+               switch (index) {
+               case DRRS_HIGH_RR:
+                       intel_dp_set_m_n(intel_crtc, M1_N1);
+                       break;
+               case DRRS_LOW_RR:
+                       intel_dp_set_m_n(intel_crtc, M2_N2);
+                       break;
+               case DRRS_MAX_RR:

Why to redirect this to an error insted making MAX = HIGH?

Quoted 20 lines
drivers/gpu/drm/i915/intel_dp.c +5 -2
+               default:
+                       DRM_ERROR("Unsupported refreshrate type\n");
+               }
+       } else if (INTEL_INFO(dev)->gen > 6) {
                reg = PIPECONF(intel_crtc->config->cpu_transcoder);
                val = I915_READ(reg);
+
                if (index > DRRS_HIGH_RR) {
                        val |= PIPECONF_EDP_RR_MODE_SWITCH;
-                       intel_dp_set_m_n(intel_crtc);
                } else {
                        val &= ~PIPECONF_EDP_RR_MODE_SWITCH;
                }
--

1.7.9.5

_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx

Signature · 6 lines
Rodrigo Vivi
Blog: http://blog.vivi.eng.br
_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
#5 lore raw

Re: [PATCH 2/6] drm/i915/bdw: Add support for DRRS to switch RR

Hi,

Quoted 30 lines · Rodrigo Vivi
Quoted 29 lines · Ramalingam C

From: Vandana Kannan <[email protected]>

For Broadwell, there is one instance of Transcoder MN values per transcoder. For dynamic switching between multiple refreshr rates, M/N values may be reprogrammed on the fly. Link N programming triggers update of all data and link M & N registers and the new M/N values will be used in the next frame that is output.

V2: [By Ram]: intel_dp_set_m_n() is rewritten to accommodate

         gen >= 8 [Rodrigo]

V3: Coding style correction [Ram]
V4: [By Ram] intel_dp_set_m_n modifications are moved into a
separate patch, retaining only DRRS related changes here [Rodrigo]

---
  drivers/gpu/drm/i915/intel_dp.c |   16 ++++++++++++++--
  1 file changed, 14 insertions(+), 2 deletions(-)
drivers/gpu/drm/i915/intel_dp.c +0 -0
index 868a07b..6ffbf57 100644
@@ -4793,12 +4793,24 @@ static void intel_dp_set_drrs_state(struct drm_device *dev, int refresh_rate)
                 return;
         }
 
Quoted 11 lines

drivers/gpu/drm/i915/intel_dp.c static void intel_dp_set_drrs_state(struct drm_device *dev, int refresh_rate) · line 4804

Quoted 10 lines
drivers/gpu/drm/i915/intel_dp.c +9 -1
-       if (INTEL_INFO(dev)->gen > 6 && INTEL_INFO(dev)->gen < 8) {
+       if (INTEL_INFO(dev)->gen >= 8) {
+               switch (index) {
+               case DRRS_HIGH_RR:
+                       intel_dp_set_m_n(intel_crtc, M1_N1);
+                       break;
+               case DRRS_LOW_RR:
+                       intel_dp_set_m_n(intel_crtc, M2_N2);
+                       break;
+               case DRRS_MAX_RR:

Why to redirect this to an error insted making MAX = HIGH?

This DRRS state is decided within kernel based on the vrefresh requested. Hence this can't be out of HIGH/LOW. So this case can't occur. If it occurs I would like to report it as an error.

Quoted 23 lines
Quoted 21 lines
drivers/gpu/drm/i915/intel_dp.c +5 -2
+               default:
+                       DRM_ERROR("Unsupported refreshrate type\n");
+               }
+       } else if (INTEL_INFO(dev)->gen > 6) {
                 reg = PIPECONF(intel_crtc->config->cpu_transcoder);
                 val = I915_READ(reg);
+
                 if (index > DRRS_HIGH_RR) {
                         val |= PIPECONF_EDP_RR_MODE_SWITCH;
-                       intel_dp_set_m_n(intel_crtc);
                 } else {
                         val &= ~PIPECONF_EDP_RR_MODE_SWITCH;
                 }
--

1.7.9.5

_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx

Signature · 6 lines
Ram

_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
Reviewed-by
#6 lore raw

Re: [PATCH 2/6] drm/i915/bdw: Add support for DRRS to switch RR

Quoted 56 lines · Ramalingam C

Hi,

Quoted 39 lines · Rodrigo Vivi
Quoted 36 lines · Ramalingam C

From: Vandana Kannan <[email protected]>

For Broadwell, there is one instance of Transcoder MN values per transcoder.
For dynamic switching between multiple refreshr rates, M/N values may be reprogrammed on the fly. Link N programming triggers update of all data and
link M & N registers and the new M/N values will be used in the next frame
that is output.

V2: [By Ram]: intel_dp_set_m_n() is rewritten to accommodate

         gen >= 8 [Rodrigo]

V3: Coding style correction [Ram]
V4: [By Ram] intel_dp_set_m_n modifications are moved into a
separate patch, retaining only DRRS related changes here
[Rodrigo]

---
  drivers/gpu/drm/i915/intel_dp.c |   16 ++++++++++++++--
  1 file changed, 14 insertions(+), 2 deletions(-)
drivers/gpu/drm/i915/intel_dp.c +0 -0
index 868a07b..6ffbf57 100644
@@ -4793,12 +4793,24 @@ static void intel_dp_set_drrs_state(struct
 drm_device *dev, int refresh_rate)
                 return;
         }
 
Quoted 12 lines

drivers/gpu/drm/i915/intel_dp.c static void intel_dp_set_drrs_state(struct drm_device *dev, int refresh_rate) · line 4804

Quoted 10 lines
drivers/gpu/drm/i915/intel_dp.c +9 -1
-       if (INTEL_INFO(dev)->gen > 6 && INTEL_INFO(dev)->gen < 8) {
+       if (INTEL_INFO(dev)->gen >= 8) {
+               switch (index) {
+               case DRRS_HIGH_RR:
+                       intel_dp_set_m_n(intel_crtc, M1_N1);
+                       break;
+               case DRRS_LOW_RR:
+                       intel_dp_set_m_n(intel_crtc, M2_N2);
+                       break;
+               case DRRS_MAX_RR:

Why to redirect this to an error insted making MAX = HIGH?

Quoted 4 lines

This DRRS state is decided within kernel based on the vrefresh requested. Hence this can't be out of HIGH/LOW.
So this case can't occur. If it occurs I would like to report it as an error.

Thanks for the explanation

Quoted 29 lines
Quoted 18 lines
Quoted 18 lines
drivers/gpu/drm/i915/intel_dp.c +5 -1
+               default:
+                       DRM_ERROR("Unsupported refreshrate type\n");
+               }
+       } else if (INTEL_INFO(dev)->gen > 6) {
                 reg = PIPECONF(intel_crtc->config->cpu_transcoder);
                 val = I915_READ(reg);
+
                 if (index > DRRS_HIGH_RR) {
                         val |= PIPECONF_EDP_RR_MODE_SWITCH;
-                       intel_dp_set_m_n(intel_crtc);
                 } else {
                         val &= ~PIPECONF_EDP_RR_MODE_SWITCH;
                 }

--
1.7.9.5

Quoted 7 lines
Quoted 4 lines

_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx

--
Ram

Signature · 6 lines
Rodrigo Vivi
Blog: http://blog.vivi.eng.br
_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
#7 lore raw

PATCH 3/6 drm/i915: Support for RR switching on VLV

In reply to Ramalingam C

From: Vandana Kannan <[email protected]>

Definition of VLV RR switch bit and corresponding toggling in set_drrs function.

---
 drivers/gpu/drm/i915/i915_reg.h |    1 +
 drivers/gpu/drm/i915/intel_dp.c |   10 ++++++++--
 2 files changed, 9 insertions(+), 2 deletions(-)
drivers/gpu/drm/i915/i915_reg.h +1 -0
index 39bdbf9..944f788 100644
@@ -3880,6 +3880,7 @@ enum skl_disp_power_wells {
 #define   PIPECONF_INTERLACE_MODE_MASK		(7 << 21)
 #define   PIPECONF_EDP_RR_MODE_SWITCH		(1 << 20)
 #define   PIPECONF_CXSR_DOWNCLOCK	(1<<16)
+#define   PIPECONF_EDP_RR_MODE_SWITCH_VLV	(1 << 14)
 #define   PIPECONF_COLOR_RANGE_SELECT	(1 << 13)
 #define   PIPECONF_BPC_MASK	(0x7 << 5)
 #define   PIPECONF_8BPC		(0<<5)
drivers/gpu/drm/i915/intel_dp.c +8 -2
index 6ffbf57..9f3da8f 100644
@@ -4810,9 +4810,15 @@ static void intel_dp_set_drrs_state(struct drm_device *dev, int refresh_rate)
 		val = I915_READ(reg);
 
 		if (index > DRRS_HIGH_RR) {
-			val |= PIPECONF_EDP_RR_MODE_SWITCH;
+			if (IS_VALLEYVIEW(dev))
+				val |= PIPECONF_EDP_RR_MODE_SWITCH_VLV;
+			else
+				val |= PIPECONF_EDP_RR_MODE_SWITCH;
 		} else {
-			val &= ~PIPECONF_EDP_RR_MODE_SWITCH;
+			if (IS_VALLEYVIEW(dev))
+				val &= ~PIPECONF_EDP_RR_MODE_SWITCH_VLV;
+			else
+				val &= ~PIPECONF_EDP_RR_MODE_SWITCH;
 		}
 		I915_WRITE(reg, val);
 	}
Signature · 6 lines
1.7.9.5

_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
#8 lore raw

PATCH 4/6 drm/i915: Enable eDP DRRS for CHV

In reply to Ramalingam C

From: Durgadoss R <[email protected]>

This patch enables eDP DRRS for CHV by adding the
required IS_CHERRYVIEW() checks.
CHV uses the same register bit as VLV.

[Vandana]: Since CHV has 2 sets of M_N registers, it will follow the same code path as gen < 8. Added CHV check in dp_set_m_n()

[Ram]: Rebased on top of previous patch modifications

---
 drivers/gpu/drm/i915/intel_display.c |    2 +-
 drivers/gpu/drm/i915/intel_dp.c      |    2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)
drivers/gpu/drm/i915/intel_display.c +1 -1
index 2af24a7..6548524 100644
@@ -5879,7 +5879,7 @@ static void intel_cpu_transcoder_set_m_n(struct intel_crtc *crtc,
 		 * for gen < 8) and if DRRS is supported (to make sure the
 		 * registers are not unnecessarily accessed).
 		 */
-		if (m2_n2 && INTEL_INFO(dev)->gen < 8 &&
+		if (m2_n2 && (IS_CHERRYVIEW(dev) || INTEL_INFO(dev)->gen < 8) &&
 			crtc->config->has_drrs) {
 			I915_WRITE(PIPE_DATA_M2(transcoder),
 					TU_SIZE(m2_n2->tu) | m2_n2->gmch_m);
drivers/gpu/drm/i915/intel_dp.c +1 -1
index 9f3da8f..dfbe97d 100644
@@ -4793,7 +4793,7 @@ static void intel_dp_set_drrs_state(struct drm_device *dev, int refresh_rate)
 		return;
 	}
 
-	if (INTEL_INFO(dev)->gen >= 8) {
+	if (INTEL_INFO(dev)->gen >= 8 && !IS_CHERRYVIEW(dev)) {
 		switch (index) {
 		case DRRS_HIGH_RR:
 			intel_dp_set_m_n(intel_crtc, M1_N1);
Signature · 6 lines
1.7.9.5

_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
Reviewed-by on v1 4/6
#9 lore raw

Re: [PATCH 4/6] drm/i915: Enable eDP DRRS for CHV

Quoted 24 lines · Ramalingam C

From: Durgadoss R <[email protected]>

This patch enables eDP DRRS for CHV by adding the
required IS_CHERRYVIEW() checks.
CHV uses the same register bit as VLV.

[Vandana]: Since CHV has 2 sets of M_N registers, it will follow the same code path as gen < 8. Added CHV check in dp_set_m_n()

[Ram]: Rebased on top of previous patch modifications

---
 drivers/gpu/drm/i915/intel_display.c |    2 +-
 drivers/gpu/drm/i915/intel_dp.c      |    2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)
drivers/gpu/drm/i915/intel_display.c +0 -0
index 2af24a7..6548524 100644

drivers/gpu/drm/i915/intel_display.c static void intel_cpu_transcoder_set_m_n(struct intel_crtc *crtc, · line 5882

Quoted 5 lines
drivers/gpu/drm/i915/intel_display.c +1 -1
@@ -5879,7 +5879,7 @@ static void intel_cpu_transcoder_set_m_n(struct intel_crtc *crtc,
                 * for gen < 8) and if DRRS is supported (to make sure the
                 * registers are not unnecessarily accessed).
                 */
-               if (m2_n2 && INTEL_INFO(dev)->gen < 8 &&
+               if (m2_n2 && (IS_CHERRYVIEW(dev) || INTEL_INFO(dev)->gen < 8) &&

This got a bit confusing and something that looks like it will need fix on next enablings...

Quoted 19 lines
drivers/gpu/drm/i915/intel_display.c +0 -0
                        crtc->config->has_drrs) {
                        I915_WRITE(PIPE_DATA_M2(transcoder),
                                        TU_SIZE(m2_n2->tu) | m2_n2->gmch_m);
drivers/gpu/drm/i915/intel_dp.c +1 -2
index 9f3da8f..dfbe97d 100644
@@ -4793,7 +4793,7 @@ static void intel_dp_set_drrs_state(struct drm_device *dev, int refresh_rate)
                return;
        }
 
-       if (INTEL_INFO(dev)->gen >= 8) {
+       if (INTEL_INFO(dev)->gen >= 8 && !IS_CHERRYVIEW(dev)) {
                switch (index) {
                case DRRS_HIGH_RR:
                        intel_dp_set_m_n(intel_crtc, M1_N1);
--

1.7.9.5

Quoted 4 lines

_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx

But apparently is right, so feel free to use:

Signature · 6 lines
Rodrigo Vivi
Blog: http://blog.vivi.eng.br
_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
#10 lore raw

PATCH 5/6 Documentation/drm: DocBook integration for DRRS

In reply to Ramalingam C

From: Vandana Kannan <[email protected]>

Adding an overview of DRRS in general and the implementation for eDP DRRS. Also, describing the functions related to eDP DRRS.

---
 Documentation/DocBook/drm.tmpl  |   11 +++++
 drivers/gpu/drm/i915/intel_dp.c |   95 +++++++++++++++++++++++++++++++++++++++
 2 files changed, 106 insertions(+)
Documentation/DocBook/drm.tmpl +11 -0
index 249f0c9..7a45775 100644
@@ -4053,6 +4053,17 @@ int num_ioctls;</synopsis>
 !Idrivers/gpu/drm/i915/intel_fbc.c
       </sect2>
       <sect2>
+        <title>Display Refresh Rate Switching (DRRS)</title>
+!Pdrivers/gpu/drm/i915/intel_dp.c Display Refresh Rate Switching (DRRS)
+!Fdrivers/gpu/drm/i915/intel_dp.c intel_dp_set_drrs_state
+!Fdrivers/gpu/drm/i915/intel_dp.c intel_edp_drrs_enable
+!Fdrivers/gpu/drm/i915/intel_dp.c intel_edp_drrs_disable
+!Fdrivers/gpu/drm/i915/intel_dp.c intel_edp_drrs_invalidate
+!Fdrivers/gpu/drm/i915/intel_dp.c intel_edp_drrs_flush
+!Fdrivers/gpu/drm/i915/intel_dp.c intel_dp_drrs_init
+
+      </sect2>
+      <sect2>
         <title>DPIO</title>
 !Pdrivers/gpu/drm/i915/i915_reg.h DPIO
 	<table id="dpiox2">
drivers/gpu/drm/i915/intel_dp.c +95 -0

131 lines not on this page · raw message

Signature · 6 lines
1.7.9.5

_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
#11 lore raw

PATCH 6/6 drm/i915: Add debugfs entry for DRRS

In reply to Ramalingam C

From: Vandana Kannan <[email protected]>

Adding a debugfs entry to determine if DRRS is supported or not

V2: [By Ram]: Following details about the active crtc will be filled
in seq-file of the debugfs
1. Encoder output type
2. DRRS Support on this CRTC
3. DRRS current state
4. Current Vrefresh
Format is as follows:

CRTC 1:  Output: eDP, DRRS Supported: Yes (Seamless), DRRS_State: DRRS_HIGH_RR, Vrefresh: 60
CRTC 2:  Output: HDMI, DRRS Supported : No, VBT DRRS_type: Seamless
CRTC 1:  Output: eDP, DRRS Supported: Yes (Seamless), DRRS_State: DRRS_LOW_RR, Vrefresh: 40
CRTC 2:  Output: HDMI, DRRS Supported : No, VBT DRRS_type: Seamless

V3: [By Ram]: Readability is improved.
Another error case is covered [Daniel]

V4: [By Ram]: Current status of the Idleness DRRS along with
the Front buffer bits are added to the debugfs. [Rodrigo]

---
 drivers/gpu/drm/i915/i915_debugfs.c |   99 +++++++++++++++++++++++++++++++++++
 1 file changed, 99 insertions(+)
drivers/gpu/drm/i915/i915_debugfs.c +99 -0
index 164fa82..e08d63f 100644
@@ -2869,6 +2869,104 @@ static int i915_ddb_info(struct seq_file *m, void *unused)
 	return 0;
 }
 
+static void drrs_status_per_crtc(struct seq_file *m,
+		struct drm_device *dev, struct intel_crtc *intel_crtc)
+{
+	struct intel_encoder *intel_encoder;
+	struct drm_i915_private *dev_priv = dev->dev_private;
+	struct i915_drrs *drrs = &dev_priv->drrs;
+	int vrefresh = 0;
+
+	for_each_encoder_on_crtc(dev, &intel_crtc->base, intel_encoder) {
+		/* Encoder connected on this CRTC */
+		switch (intel_encoder->type) {
+		case INTEL_OUTPUT_EDP:
+			seq_puts(m, "Output: eDP, ");
+			break;
+		case INTEL_OUTPUT_DSI:
+			seq_puts(m, "Output: DSI, ");
+			break;
+		case INTEL_OUTPUT_HDMI:
+			seq_puts(m, "Output: HDMI, ");
+			break;
+		case INTEL_OUTPUT_DISPLAYPORT:
+			seq_puts(m, "Output: DP, ");
+			break;
+		default:
+			seq_printf(m, "Output: Others (id=%d), ",
+						intel_encoder->type);
+		}
+	}
+
+	if (intel_crtc->config->has_drrs) {
+		struct intel_panel *panel;
+
+		panel = &drrs->dp->attached_connector->panel;
+		/* DRRS Supported */
+		seq_puts(m, "DRRS Supported: Yes (Seamless), ");
+		seq_printf(m, "busy_frontbuffer_bits: 0x%X,\n\t",
+					drrs->busy_frontbuffer_bits);
+
+		if (drrs->busy_frontbuffer_bits) {
+			seq_puts(m, "Front buffer: busy, ");
+			seq_puts(m, "Idleness Timer: Suspended, ");
+		} else {
+			seq_puts(m, "Front buffer: Idle, ");
+			if (drrs->refresh_rate_type == DRRS_HIGH_RR)
+				seq_puts(m, "Idleness Timer: Ticking, ");
+			else
+				seq_puts(m, "Idleness Timer: Suspended, ");
+		}
+
+		if (drrs->refresh_rate_type == DRRS_HIGH_RR) {
+			seq_puts(m, "DRRS_State: DRRS_HIGH_RR, ");
+			vrefresh = panel->fixed_mode->vrefresh;
+		} else if (drrs->refresh_rate_type == DRRS_LOW_RR) {
+			seq_puts(m, "DRRS_State: DRRS_LOW_RR, ");
+			vrefresh = panel->downclock_mode->vrefresh;
+		} else {
+			seq_printf(m, "DRRS_State: Unknown(%d), ",
+						drrs->refresh_rate_type);
+		}
+		seq_printf(m, "Vrefresh: %d", vrefresh);
+
+	} else {
+		/* DRRS not supported. Print the VBT parameter*/
+		seq_puts(m, "DRRS Supported : No, ");
+		if (dev_priv->vbt.drrs_type == STATIC_DRRS_SUPPORT)
+			seq_puts(m, "VBT DRRS_type: Static");
+		else if (dev_priv->vbt.drrs_type == SEAMLESS_DRRS_SUPPORT)
+			seq_puts(m, "VBT DRRS_type: Seamless");
+		else if (dev_priv->vbt.drrs_type == DRRS_NOT_SUPPORTED)
+			seq_puts(m, "VBT DRRS_type: None");
+		else
+			seq_puts(m, "VBT DRRS_type: Unrecognized Value");
+	}
+	seq_puts(m, "\n");
+}
+
+static int i915_drrs_status(struct seq_file *m, void *unused)
+{
+	struct drm_info_node *node = m->private;
+	struct drm_device *dev = node->minor->dev;
+	struct intel_crtc *intel_crtc;
+	int active_crtc_cnt = 0;
+
+	for_each_intel_crtc(dev, intel_crtc) {
+		if (intel_crtc->active) {
+			active_crtc_cnt++;
+			seq_printf(m, "CRTC %d:  ", active_crtc_cnt);
+
+			drrs_status_per_crtc(m, dev, intel_crtc);
+		}
+	}
+
+	if (!active_crtc_cnt)
+		seq_puts(m, "No active crtc found\n");
+
+	return 0;
+}
+
 struct pipe_crc_info {
 	const char *name;
 	struct drm_device *dev;
@@ -4483,6 +4581,7 @@ static const struct drm_info_list i915_debugfs_list[] = {
 	{"i915_dp_mst_info", i915_dp_mst_info, 0},
 	{"i915_wa_registers", i915_wa_registers, 0},
 	{"i915_ddb_info", i915_ddb_info, 0},
+	{"i915_drrs_status", i915_drrs_status, 0},
 };
 #define I915_DEBUGFS_ENTRIES ARRAY_SIZE(i915_debugfs_list)
 
Signature · 6 lines
1.7.9.5

_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
#12 lore raw

Re: [PATCH 6/6] drm/i915: Add debugfs entry for DRRS

Quoted 36 lines · Ramalingam C

From: Vandana Kannan <[email protected]>

Adding a debugfs entry to determine if DRRS is supported or not

V2: [By Ram]: Following details about the active crtc will be filled
in seq-file of the debugfs
1. Encoder output type
2. DRRS Support on this CRTC
3. DRRS current state
4. Current Vrefresh
Format is as follows:

CRTC 1:  Output: eDP, DRRS Supported: Yes (Seamless), DRRS_State: DRRS_HIGH_RR, Vrefresh: 60
CRTC 2:  Output: HDMI, DRRS Supported : No, VBT DRRS_type: Seamless
CRTC 1:  Output: eDP, DRRS Supported: Yes (Seamless), DRRS_State: DRRS_LOW_RR, Vrefresh: 40
CRTC 2:  Output: HDMI, DRRS Supported : No, VBT DRRS_type: Seamless

V3: [By Ram]: Readability is improved.
Another error case is covered [Daniel]

V4: [By Ram]: Current status of the Idleness DRRS along with
the Front buffer bits are added to the debugfs. [Rodrigo]

---
 drivers/gpu/drm/i915/i915_debugfs.c |   99 +++++++++++++++++++++++++++++++++++
 1 file changed, 99 insertions(+)
drivers/gpu/drm/i915/i915_debugfs.c +0 -0
index 164fa82..e08d63f 100644
@@ -2869,6 +2869,104 @@ static int i915_ddb_info(struct seq_file *m, void *unused)
        return 0;
 }
 

drivers/gpu/drm/i915/i915_debugfs.c static int i915_ddb_info(struct seq_file *m, void *unused) · line 2881

Quoted 10 lines
drivers/gpu/drm/i915/i915_debugfs.c +10 -0
+static void drrs_status_per_crtc(struct seq_file *m,
+               struct drm_device *dev, struct intel_crtc *intel_crtc)
+{
+       struct intel_encoder *intel_encoder;
+       struct drm_i915_private *dev_priv = dev->dev_private;
+       struct i915_drrs *drrs = &dev_priv->drrs;
+       int vrefresh = 0;
+
+       for_each_encoder_on_crtc(dev, &intel_crtc->base, intel_encoder) {
+               /* Encoder connected on this CRTC */

Do you really need this info here?

Quoted 15 lines
drivers/gpu/drm/i915/i915_debugfs.c +15 -0
+               switch (intel_encoder->type) {
+               case INTEL_OUTPUT_EDP:
+                       seq_puts(m, "Output: eDP, ");
+                       break;
+               case INTEL_OUTPUT_DSI:
+                       seq_puts(m, "Output: DSI, ");
+                       break;
+               case INTEL_OUTPUT_HDMI:
+                       seq_puts(m, "Output: HDMI, ");
+                       break;
+               case INTEL_OUTPUT_DISPLAYPORT:
+                       seq_puts(m, "Output: DP, ");
+                       break;
+               default:
+                       seq_printf(m, "Output: Others (id=%d), ",

drivers/gpu/drm/i915/i915_debugfs.c static int i915_ddb_info(struct seq_file *m, void *unused) · line 2906

Quoted 10 lines
drivers/gpu/drm/i915/i915_debugfs.c +10 -0
+                                               intel_encoder->type);
+               }
+       }
+
+       if (intel_crtc->config->has_drrs) {
+               struct intel_panel *panel;
+
+               panel = &drrs->dp->attached_connector->panel;
+               /* DRRS Supported */
+               seq_puts(m, "DRRS Supported: Yes (Seamless), ");

isn't "Yes" enough? Remind that you might want to parse in the future.

Quoted 14 lines
drivers/gpu/drm/i915/i915_debugfs.c +14 -0
+               seq_printf(m, "busy_frontbuffer_bits: 0x%X,\n\t",
+                                       drrs->busy_frontbuffer_bits);
+
+               if (drrs->busy_frontbuffer_bits) {
+                       seq_puts(m, "Front buffer: busy, ");
+                       seq_puts(m, "Idleness Timer: Suspended, ");
+               } else {
+                       seq_puts(m, "Front buffer: Idle, ");
+                       if (drrs->refresh_rate_type == DRRS_HIGH_RR)
+                               seq_puts(m, "Idleness Timer: Ticking, ");
+                       else
+                               seq_puts(m, "Idleness Timer: Suspended, ");
+               }
+

drivers/gpu/drm/i915/i915_debugfs.c static int i915_ddb_info(struct seq_file *m, void *unused) · line 2930

Quoted 10 lines
drivers/gpu/drm/i915/i915_debugfs.c +10 -0
+               if (drrs->refresh_rate_type == DRRS_HIGH_RR) {
+                       seq_puts(m, "DRRS_State: DRRS_HIGH_RR, ");
+                       vrefresh = panel->fixed_mode->vrefresh;
+               } else if (drrs->refresh_rate_type == DRRS_LOW_RR) {
+                       seq_puts(m, "DRRS_State: DRRS_LOW_RR, ");
+                       vrefresh = panel->downclock_mode->vrefresh;
+               } else {
+                       seq_printf(m, "DRRS_State: Unknown(%d), ",
+                                               drrs->refresh_rate_type);
+               }

I wonder what it is printed when DRRS is supported but is disabled?

Also why not print some info like enabled/disabled?

drivers/gpu/drm/i915/i915_debugfs.c static int i915_ddb_info(struct seq_file *m, void *unused) · line 2934

Quoted 4 lines
drivers/gpu/drm/i915/i915_debugfs.c +4 -0
+               seq_printf(m, "Vrefresh: %d", vrefresh);
+
+       } else {
+               /* DRRS not supported. Print the VBT parameter*/

Why? Should be better a dmesg when enabling DRRS and print why not supported?

Is VBT only reason for not being supported? Is is information useless when drrs is supported?

Quoted 13 lines
drivers/gpu/drm/i915/i915_debugfs.c +13 -0
+               seq_puts(m, "DRRS Supported : No, ");
+               if (dev_priv->vbt.drrs_type == STATIC_DRRS_SUPPORT)
+                       seq_puts(m, "VBT DRRS_type: Static");
+               else if (dev_priv->vbt.drrs_type == SEAMLESS_DRRS_SUPPORT)
+                       seq_puts(m, "VBT DRRS_type: Seamless");
+               else if (dev_priv->vbt.drrs_type == DRRS_NOT_SUPPORTED)
+                       seq_puts(m, "VBT DRRS_type: None");
+               else
+                       seq_puts(m, "VBT DRRS_type: Unrecognized Value");
+       }
+       seq_puts(m, "\n");
+}
+

drivers/gpu/drm/i915/i915_debugfs.c static int i915_ddb_info(struct seq_file *m, void *unused) · line 2957

Quoted 10 lines
drivers/gpu/drm/i915/i915_debugfs.c +10 -0
+static int i915_drrs_status(struct seq_file *m, void *unused)
+{
+       struct drm_info_node *node = m->private;
+       struct drm_device *dev = node->minor->dev;
+       struct intel_crtc *intel_crtc;
+       int active_crtc_cnt = 0;
+
+       for_each_intel_crtc(dev, intel_crtc) {
+               if (intel_crtc->active) {
+                       active_crtc_cnt++;

isn't a bool enough?
why do you need a counter?

drivers/gpu/drm/i915/i915_debugfs.c static int i915_ddb_info(struct seq_file *m, void *unused) · line 2960

Quoted 3 lines
drivers/gpu/drm/i915/i915_debugfs.c +3 -0
+                       seq_printf(m, "CRTC %d:  ", active_crtc_cnt);
+
+                       drrs_status_per_crtc(m, dev, intel_crtc);

Since you are doing this for all active crtcs, have you considered indenting all other information per crtc to be more clean when having more than one active crtc?

Quoted 27 lines
drivers/gpu/drm/i915/i915_debugfs.c +10 -1
+               }
+       }
+
+       if (!active_crtc_cnt)
+               seq_puts(m, "No active crtc found\n");
+
+       return 0;
+}
+
 struct pipe_crc_info {
        const char *name;
        struct drm_device *dev;
@@ -4483,6 +4581,7 @@ static const struct drm_info_list i915_debugfs_list[] = {
        {"i915_dp_mst_info", i915_dp_mst_info, 0},
        {"i915_wa_registers", i915_wa_registers, 0},
        {"i915_ddb_info", i915_ddb_info, 0},
+       {"i915_drrs_status", i915_drrs_status, 0},
 };
 #define I915_DEBUGFS_ENTRIES ARRAY_SIZE(i915_debugfs_list)
 
--

1.7.9.5

_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx

Signature · 6 lines
Rodrigo Vivi
Blog: http://blog.vivi.eng.br
_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
#13 lore raw

Re: [PATCH 6/6] drm/i915: Add debugfs entry for DRRS

Hi,

Quoted 37 lines · Rodrigo Vivi
Quoted 36 lines · Ramalingam C

From: Vandana Kannan <[email protected]>

Adding a debugfs entry to determine if DRRS is supported or not

V2: [By Ram]: Following details about the active crtc will be filled
in seq-file of the debugfs
1. Encoder output type
2. DRRS Support on this CRTC
3. DRRS current state
4. Current Vrefresh
Format is as follows:

CRTC 1:  Output: eDP, DRRS Supported: Yes (Seamless), DRRS_State: DRRS_HIGH_RR, Vrefresh: 60
CRTC 2:  Output: HDMI, DRRS Supported : No, VBT DRRS_type: Seamless
CRTC 1:  Output: eDP, DRRS Supported: Yes (Seamless), DRRS_State: DRRS_LOW_RR, Vrefresh: 40
CRTC 2:  Output: HDMI, DRRS Supported : No, VBT DRRS_type: Seamless

V3: [By Ram]: Readability is improved.
Another error case is covered [Daniel]

V4: [By Ram]: Current status of the Idleness DRRS along with
the Front buffer bits are added to the debugfs. [Rodrigo]

---
  drivers/gpu/drm/i915/i915_debugfs.c |   99 +++++++++++++++++++++++++++++++++++
  1 file changed, 99 insertions(+)
drivers/gpu/drm/i915/i915_debugfs.c +0 -0
index 164fa82..e08d63f 100644
@@ -2869,6 +2869,104 @@ static int i915_ddb_info(struct seq_file *m, void *unused)
         return 0;
  }
 
Quoted 11 lines

drivers/gpu/drm/i915/i915_debugfs.c static int i915_ddb_info(struct seq_file *m, void *unused) · line 2881

Quoted 10 lines
drivers/gpu/drm/i915/i915_debugfs.c +10 -0
+static void drrs_status_per_crtc(struct seq_file *m,
+               struct drm_device *dev, struct intel_crtc *intel_crtc)
+{
+       struct intel_encoder *intel_encoder;
+       struct drm_i915_private *dev_priv = dev->dev_private;
+       struct i915_drrs *drrs = &dev_priv->drrs;
+       int vrefresh = 0;
+
+       for_each_encoder_on_crtc(dev, &intel_crtc->base, intel_encoder) {
+               /* Encoder connected on this CRTC */

Do you really need this info here?

Better to have the encoder details

Quoted 19 lines
Quoted 19 lines
drivers/gpu/drm/i915/i915_debugfs.c +18 -0
+               switch (intel_encoder->type) {
+               case INTEL_OUTPUT_EDP:
+                       seq_puts(m, "Output: eDP, ");
+                       break;
+               case INTEL_OUTPUT_DSI:
+                       seq_puts(m, "Output: DSI, ");
+                       break;
+               case INTEL_OUTPUT_HDMI:
+                       seq_puts(m, "Output: HDMI, ");
+                       break;
+               case INTEL_OUTPUT_DISPLAYPORT:
+                       seq_puts(m, "Output: DP, ");
+                       break;
+               default:
+                       seq_printf(m, "Output: Others (id=%d), ",
+                                               intel_encoder->type);
+               }
+       }
Quoted 8 lines

drivers/gpu/drm/i915/i915_debugfs.c static int i915_ddb_info(struct seq_file *m, void *unused) · line 2906

Quoted 7 lines
drivers/gpu/drm/i915/i915_debugfs.c +7 -0
+
+       if (intel_crtc->config->has_drrs) {
+               struct intel_panel *panel;
+
+               panel = &drrs->dp->attached_connector->panel;
+               /* DRRS Supported */
+               seq_puts(m, "DRRS Supported: Yes (Seamless), ");

isn't "Yes" enough? Remind that you might want to parse in the future.

Agreed. Yes alone will be simple.

Quoted 18 lines
Quoted 18 lines
drivers/gpu/drm/i915/i915_debugfs.c +17 -0
+               seq_printf(m, "busy_frontbuffer_bits: 0x%X,\n\t",
+                                       drrs->busy_frontbuffer_bits);
+
+               if (drrs->busy_frontbuffer_bits) {
+                       seq_puts(m, "Front buffer: busy, ");
+                       seq_puts(m, "Idleness Timer: Suspended, ");
+               } else {
+                       seq_puts(m, "Front buffer: Idle, ");
+                       if (drrs->refresh_rate_type == DRRS_HIGH_RR)
+                               seq_puts(m, "Idleness Timer: Ticking, ");
+                       else
+                               seq_puts(m, "Idleness Timer: Suspended, ");
+               }
+
+               if (drrs->refresh_rate_type == DRRS_HIGH_RR) {
+                       seq_puts(m, "DRRS_State: DRRS_HIGH_RR, ");
+                       vrefresh = panel->fixed_mode->vrefresh;
Quoted 8 lines

drivers/gpu/drm/i915/i915_debugfs.c static int i915_ddb_info(struct seq_file *m, void *unused) · line 2930

Quoted 7 lines
drivers/gpu/drm/i915/i915_debugfs.c +7 -0
+               } else if (drrs->refresh_rate_type == DRRS_LOW_RR) {
+                       seq_puts(m, "DRRS_State: DRRS_LOW_RR, ");
+                       vrefresh = panel->downclock_mode->vrefresh;
+               } else {
+                       seq_printf(m, "DRRS_State: Unknown(%d), ",
+                                               drrs->refresh_rate_type);
+               }

I wonder what it is printed when DRRS is supported but is disabled?

It will be printing as "Idleness Timer: Suspended". I will rename this to remove this confusions :)

Quoted 2 lines

Also why not print some info like enabled/disabled?

Sure we will do it.

Quoted 9 lines

drivers/gpu/drm/i915/i915_debugfs.c static int i915_ddb_info(struct seq_file *m, void *unused) · line 2934

Quoted 5 lines
drivers/gpu/drm/i915/i915_debugfs.c +4 -0
+               seq_printf(m, "Vrefresh: %d", vrefresh);
+
+       } else {
+               /* DRRS not supported. Print the VBT parameter*/

Why? Should be better a dmesg when enabling DRRS and print why not supported?

Is VBT only reason for not being supported? Is is information useless when drrs is supported?

VBT details and also the lower refresh rate from EDID both are controlling factors for DRRS.
If DRRS is not supported only then VBT details are added so that modes can be verified along with. Its understood that VBT supports seamless type when DRRS is supported

Quoted 18 lines
Quoted 18 lines
drivers/gpu/drm/i915/i915_debugfs.c +17 -0
+               seq_puts(m, "DRRS Supported : No, ");
+               if (dev_priv->vbt.drrs_type == STATIC_DRRS_SUPPORT)
+                       seq_puts(m, "VBT DRRS_type: Static");
+               else if (dev_priv->vbt.drrs_type == SEAMLESS_DRRS_SUPPORT)
+                       seq_puts(m, "VBT DRRS_type: Seamless");
+               else if (dev_priv->vbt.drrs_type == DRRS_NOT_SUPPORTED)
+                       seq_puts(m, "VBT DRRS_type: None");
+               else
+                       seq_puts(m, "VBT DRRS_type: Unrecognized Value");
+       }
+       seq_puts(m, "\n");
+}
+
+static int i915_drrs_status(struct seq_file *m, void *unused)
+{
+       struct drm_info_node *node = m->private;
+       struct drm_device *dev = node->minor->dev;
Quoted 8 lines

drivers/gpu/drm/i915/i915_debugfs.c static int i915_ddb_info(struct seq_file *m, void *unused) · line 2957

Quoted 6 lines
drivers/gpu/drm/i915/i915_debugfs.c +6 -0
+       struct intel_crtc *intel_crtc;
+       int active_crtc_cnt = 0;
+
+       for_each_intel_crtc(dev, intel_crtc) {
+               if (intel_crtc->active) {
+                       active_crtc_cnt++;

isn't a bool enough?
why do you need a counter?

Actually we are disabling the DRRS in case of clone mode on Android. So I added a counter for active CRTCs. So that we can inform about cloned mode. But here it doesn't make any sense.

Quoted 7 lines

drivers/gpu/drm/i915/i915_debugfs.c static int i915_ddb_info(struct seq_file *m, void *unused) · line 2960

Quoted 4 lines
drivers/gpu/drm/i915/i915_debugfs.c +3 -0
+                       seq_printf(m, "CRTC %d:  ", active_crtc_cnt);
+
+                       drrs_status_per_crtc(m, dev, intel_crtc);

Since you are doing this for all active crtcs, have you considered indenting all other information per crtc to be more clean when having more than one active crtc?

Sure. we can make more presentable.

Quoted 21 lines
Quoted 21 lines
drivers/gpu/drm/i915/i915_debugfs.c +10 -0
+               }
+       }
+
+       if (!active_crtc_cnt)
+               seq_puts(m, "No active crtc found\n");
+
+       return 0;
+}
+
  struct pipe_crc_info {
         const char *name;
         struct drm_device *dev;
@@ -4483,6 +4581,7 @@ static const struct drm_info_list i915_debugfs_list[] = {
         {"i915_dp_mst_info", i915_dp_mst_info, 0},
         {"i915_wa_registers", i915_wa_registers, 0},
         {"i915_ddb_info", i915_ddb_info, 0},
+       {"i915_drrs_status", i915_drrs_status, 0},
  };
  #define I915_DEBUGFS_ENTRIES ARRAY_SIZE(i915_debugfs_list)
 
Quoted 9 lines
Quoted 7 lines

--
1.7.9.5

_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx

I will submit a patch for this by monday.

Signature · 6 lines
Ram

_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
#14 lore raw

PATCH 1/1 drm/i915: Add debugfs entry for DRRS

From: Vandana Kannan <[email protected]>

Adding a debugfs entry to determine if DRRS is supported or not

V2: [By Ram]: Following details about the active crtc will be filled
in seq-file of the debugfs
1. Encoder output type
2. DRRS Support on this CRTC
3. DRRS current state
4. Current Vrefresh
Format is as follows:

CRTC 1:  Output: eDP, DRRS Supported: Yes (Seamless), DRRS_State: DRRS_HIGH_RR, Vrefresh: 60
CRTC 2:  Output: HDMI, DRRS Supported : No, VBT DRRS_type: Seamless
CRTC 1:  Output: eDP, DRRS Supported: Yes (Seamless), DRRS_State: DRRS_LOW_RR, Vrefresh: 40
CRTC 2:  Output: HDMI, DRRS Supported : No, VBT DRRS_type: Seamless

V3: [By Ram]: Readability is improved.
Another error case is covered [Daniel]

V4: [By Ram]: Current status of the Idleness DRRS along with
the Front buffer bits are added to the debugfs. [Rodrigo]

V5: [By Ram]: Rephrased to make it easy to understand.
And format is modified. [Rodrigo]

---
 drivers/gpu/drm/i915/i915_debugfs.c |  113 +++++++++++++++++++++++++++++++++++
 1 file changed, 113 insertions(+)
drivers/gpu/drm/i915/i915_debugfs.c +113 -0
index 164fa82..e51001c 100644
@@ -2869,6 +2869,118 @@ static int i915_ddb_info(struct seq_file *m, void *unused)
 	return 0;
 }
 
+static void drrs_status_per_crtc(struct seq_file *m,
+		struct drm_device *dev, struct intel_crtc *intel_crtc)
+{
+	struct intel_encoder *intel_encoder;
+	struct drm_i915_private *dev_priv = dev->dev_private;
+	struct i915_drrs *drrs = &dev_priv->drrs;
+	int vrefresh = 0;
+	u32 work_status;
+
+	for_each_encoder_on_crtc(dev, &intel_crtc->base, intel_encoder) {
+		/* Encoder connected on this CRTC */
+		switch (intel_encoder->type) {
+		case INTEL_OUTPUT_EDP:
+			seq_puts(m, "eDP:\n");
+			break;
+		case INTEL_OUTPUT_DSI:
+			seq_puts(m, "DSI:\n");
+			break;
+		case INTEL_OUTPUT_HDMI:
+			seq_puts(m, "HDMI:\n");
+			break;
+		case INTEL_OUTPUT_DISPLAYPORT:
+			seq_puts(m, "DP:\n");
+			break;
+		default:
+			seq_printf(m, "Other encoder (id=%d).\n",
+						intel_encoder->type);
+			return;
+		}
+	}
+
+	if (dev_priv->vbt.drrs_type == STATIC_DRRS_SUPPORT)
+		seq_puts(m, "\tVBT: DRRS_type: Static");
+	else if (dev_priv->vbt.drrs_type == SEAMLESS_DRRS_SUPPORT)
+		seq_puts(m, "\tVBT: DRRS_type: Seamless");
+	else if (dev_priv->vbt.drrs_type == DRRS_NOT_SUPPORTED)
+		seq_puts(m, "\tVBT: DRRS_type: None");
+	else
+		seq_puts(m, "\tVBT: DRRS_type: FIXME: Unrecognized Value");
+
+	seq_puts(m, "\n\n");
+
+	if (intel_crtc->config->has_drrs) {
+		struct intel_panel *panel;
+
+		panel = &drrs->dp->attached_connector->panel;
+		/* DRRS Supported */
+		seq_puts(m, "\tDRRS Supported: Yes\n");
+		seq_printf(m, "\t\tBusy_frontbuffer_bits: 0x%X",
+					drrs->busy_frontbuffer_bits);
+
+		seq_puts(m, "\n\t\t");
+		work_status = work_busy(&drrs->work.work);
+		if (drrs->busy_frontbuffer_bits) {
+			seq_puts(m, "Front buffer: Busy.\n");
+			seq_puts(m, "\t\tIdleness DRRS: Disabled");
+		} else {
+			seq_puts(m, "Front buffer: Idle");
+			seq_puts(m, "\n\t\t");
+			if (drrs->refresh_rate_type == DRRS_HIGH_RR) {
+				if (work_status)
+					seq_puts(m, "Idleness DRRS: Enabled");
+				else
+					seq_puts(m, "Idleness DRRS: Disabled");
+			} else if (drrs->refresh_rate_type == DRRS_LOW_RR) {
+				seq_puts(m, "Idleness DRRS: Enabled");
+			}
+		}
+
+		seq_puts(m, "\n\t\t");
+		if (drrs->refresh_rate_type == DRRS_HIGH_RR) {
+			seq_puts(m, "DRRS_State: DRRS_HIGH_RR\n");
+			vrefresh = panel->fixed_mode->vrefresh;
+		} else if (drrs->refresh_rate_type == DRRS_LOW_RR) {
+			seq_puts(m, "DRRS_State: DRRS_LOW_RR\n");
+			vrefresh = panel->downclock_mode->vrefresh;
+		} else {
+			seq_printf(m, "DRRS_State: Unknown(%d)\n",
+						drrs->refresh_rate_type);
+			return;
+		}
+		seq_printf(m, "\t\tVrefresh: %d", vrefresh);
+
+	} else {
+		/* DRRS not supported. Print the VBT parameter*/
+		seq_puts(m, "\tDRRS Supported : No");
+	}
+	seq_puts(m, "\n");
+}
+
+static int i915_drrs_status(struct seq_file *m, void *unused)
+{
+	struct drm_info_node *node = m->private;
+	struct drm_device *dev = node->minor->dev;
+	struct intel_crtc *intel_crtc;
+	int active_crtc_cnt = 0;
+
+	for_each_intel_crtc(dev, intel_crtc) {
+		if (intel_crtc->active) {
+			active_crtc_cnt++;
+			seq_printf(m, "\nCRTC %d:  ", active_crtc_cnt);
+
+			drrs_status_per_crtc(m, dev, intel_crtc);
+		}
+	}
+
+	if (!active_crtc_cnt)
+		seq_puts(m, "No active crtc found\n");
+
+	return 0;
+}
+
 struct pipe_crc_info {
 	const char *name;
 	struct drm_device *dev;
@@ -4483,6 +4595,7 @@ static const struct drm_info_list i915_debugfs_list[] = {
 	{"i915_dp_mst_info", i915_dp_mst_info, 0},
 	{"i915_wa_registers", i915_wa_registers, 0},
 	{"i915_ddb_info", i915_ddb_info, 0},
+	{"i915_drrs_status", i915_drrs_status, 0},
 };
 #define I915_DEBUGFS_ENTRIES ARRAY_SIZE(i915_debugfs_list)
 
Signature · 6 lines
1.7.9.5

_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
#15 lore raw

Re: [PATCH] drm/i915: Add debugfs entry for DRRS

Quoted 90 lines · Ramalingam C

From: Vandana Kannan <[email protected]>

Adding a debugfs entry to determine if DRRS is supported or not

V2: [By Ram]: Following details about the active crtc will be filled
in seq-file of the debugfs
1. Encoder output type
2. DRRS Support on this CRTC
3. DRRS current state
4. Current Vrefresh
Format is as follows:

CRTC 1:  Output: eDP, DRRS Supported: Yes (Seamless), DRRS_State: DRRS_HIGH_RR, Vrefresh: 60
CRTC 2:  Output: HDMI, DRRS Supported : No, VBT DRRS_type: Seamless
CRTC 1:  Output: eDP, DRRS Supported: Yes (Seamless), DRRS_State: DRRS_LOW_RR, Vrefresh: 40
CRTC 2:  Output: HDMI, DRRS Supported : No, VBT DRRS_type: Seamless

V3: [By Ram]: Readability is improved.
Another error case is covered [Daniel]

V4: [By Ram]: Current status of the Idleness DRRS along with
the Front buffer bits are added to the debugfs. [Rodrigo]

V5: [By Ram]: Rephrased to make it easy to understand.
And format is modified. [Rodrigo]

---
 drivers/gpu/drm/i915/i915_debugfs.c |  113 +++++++++++++++++++++++++++++++++++
 1 file changed, 113 insertions(+)
drivers/gpu/drm/i915/i915_debugfs.c +51 -0
index 164fa82..e51001c 100644
@@ -2869,6 +2869,118 @@ static int i915_ddb_info(struct seq_file *m, void *unused)
        return 0;
 }
 
+static void drrs_status_per_crtc(struct seq_file *m,
+               struct drm_device *dev, struct intel_crtc *intel_crtc)
+{
+       struct intel_encoder *intel_encoder;
+       struct drm_i915_private *dev_priv = dev->dev_private;
+       struct i915_drrs *drrs = &dev_priv->drrs;
+       int vrefresh = 0;
+       u32 work_status;
+
+       for_each_encoder_on_crtc(dev, &intel_crtc->base, intel_encoder) {
+               /* Encoder connected on this CRTC */
+               switch (intel_encoder->type) {
+               case INTEL_OUTPUT_EDP:
+                       seq_puts(m, "eDP:\n");
+                       break;
+               case INTEL_OUTPUT_DSI:
+                       seq_puts(m, "DSI:\n");
+                       break;
+               case INTEL_OUTPUT_HDMI:
+                       seq_puts(m, "HDMI:\n");
+                       break;
+               case INTEL_OUTPUT_DISPLAYPORT:
+                       seq_puts(m, "DP:\n");
+                       break;
+               default:
+                       seq_printf(m, "Other encoder (id=%d).\n",
+                                               intel_encoder->type);
+                       return;
+               }
+       }
+
+       if (dev_priv->vbt.drrs_type == STATIC_DRRS_SUPPORT)
+               seq_puts(m, "\tVBT: DRRS_type: Static");
+       else if (dev_priv->vbt.drrs_type == SEAMLESS_DRRS_SUPPORT)
+               seq_puts(m, "\tVBT: DRRS_type: Seamless");
+       else if (dev_priv->vbt.drrs_type == DRRS_NOT_SUPPORTED)
+               seq_puts(m, "\tVBT: DRRS_type: None");
+       else
+               seq_puts(m, "\tVBT: DRRS_type: FIXME: Unrecognized Value");
+
+       seq_puts(m, "\n\n");
+
+       if (intel_crtc->config->has_drrs) {
+               struct intel_panel *panel;
+
+               panel = &drrs->dp->attached_connector->panel;
+               /* DRRS Supported */
+               seq_puts(m, "\tDRRS Supported: Yes\n");
+               seq_printf(m, "\t\tBusy_frontbuffer_bits: 0x%X",
+                                       drrs->busy_frontbuffer_bits);
+

drivers/gpu/drm/i915/i915_debugfs.c static int i915_ddb_info(struct seq_file *m, void *unused) · line 2932

Quoted 10 lines
drivers/gpu/drm/i915/i915_debugfs.c +10 -0
+               seq_puts(m, "\n\t\t");
+               work_status = work_busy(&drrs->work.work);
+               if (drrs->busy_frontbuffer_bits) {
+                       seq_puts(m, "Front buffer: Busy.\n");
+                       seq_puts(m, "\t\tIdleness DRRS: Disabled");
+               } else {
+                       seq_puts(m, "Front buffer: Idle");
+                       seq_puts(m, "\n\t\t");
+                       if (drrs->refresh_rate_type == DRRS_HIGH_RR) {
+                               if (work_status)

Why do you need to check work_busy here?

Quoted 65 lines
drivers/gpu/drm/i915/i915_debugfs.c +52 -1
+                                       seq_puts(m, "Idleness DRRS: Enabled");
+                               else
+                                       seq_puts(m, "Idleness DRRS: Disabled");
+                       } else if (drrs->refresh_rate_type == DRRS_LOW_RR) {
+                               seq_puts(m, "Idleness DRRS: Enabled");
+                       }
+               }
+
+               seq_puts(m, "\n\t\t");
+               if (drrs->refresh_rate_type == DRRS_HIGH_RR) {
+                       seq_puts(m, "DRRS_State: DRRS_HIGH_RR\n");
+                       vrefresh = panel->fixed_mode->vrefresh;
+               } else if (drrs->refresh_rate_type == DRRS_LOW_RR) {
+                       seq_puts(m, "DRRS_State: DRRS_LOW_RR\n");
+                       vrefresh = panel->downclock_mode->vrefresh;
+               } else {
+                       seq_printf(m, "DRRS_State: Unknown(%d)\n",
+                                               drrs->refresh_rate_type);
+                       return;
+               }
+               seq_printf(m, "\t\tVrefresh: %d", vrefresh);
+
+       } else {
+               /* DRRS not supported. Print the VBT parameter*/
+               seq_puts(m, "\tDRRS Supported : No");
+       }
+       seq_puts(m, "\n");
+}
+
+static int i915_drrs_status(struct seq_file *m, void *unused)
+{
+       struct drm_info_node *node = m->private;
+       struct drm_device *dev = node->minor->dev;
+       struct intel_crtc *intel_crtc;
+       int active_crtc_cnt = 0;
+
+       for_each_intel_crtc(dev, intel_crtc) {
+               if (intel_crtc->active) {
+                       active_crtc_cnt++;
+                       seq_printf(m, "\nCRTC %d:  ", active_crtc_cnt);
+
+                       drrs_status_per_crtc(m, dev, intel_crtc);
+               }
+       }
+
+       if (!active_crtc_cnt)
+               seq_puts(m, "No active crtc found\n");
+
+       return 0;
+}
+
 struct pipe_crc_info {
        const char *name;
        struct drm_device *dev;
@@ -4483,6 +4595,7 @@ static const struct drm_info_list i915_debugfs_list[] = {
        {"i915_dp_mst_info", i915_dp_mst_info, 0},
        {"i915_wa_registers", i915_wa_registers, 0},
        {"i915_ddb_info", i915_ddb_info, 0},
+       {"i915_drrs_status", i915_drrs_status, 0},
 };
 #define I915_DEBUGFS_ENTRIES ARRAY_SIZE(i915_debugfs_list)
 
--

1.7.9.5

Quoted 4 lines

_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx

Thanks for the changes.
With that explained feel free to use Reviewed-by: Rodrigo Vivi <[email protected]>

Signature · 6 lines
Rodrigo Vivi
Blog: http://blog.vivi.eng.br
_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
#16 lore raw

Re: [PATCH] drm/i915: Add debugfs entry for DRRS

Quoted 94 lines · Rodrigo Vivi
Quoted 93 lines · Ramalingam C

From: Vandana Kannan <[email protected]>

Adding a debugfs entry to determine if DRRS is supported or not

V2: [By Ram]: Following details about the active crtc will be filled
in seq-file of the debugfs
1. Encoder output type
2. DRRS Support on this CRTC
3. DRRS current state
4. Current Vrefresh
Format is as follows:

CRTC 1:  Output: eDP, DRRS Supported: Yes (Seamless), DRRS_State: DRRS_HIGH_RR, Vrefresh: 60
CRTC 2:  Output: HDMI, DRRS Supported : No, VBT DRRS_type: Seamless
CRTC 1:  Output: eDP, DRRS Supported: Yes (Seamless), DRRS_State: DRRS_LOW_RR, Vrefresh: 40
CRTC 2:  Output: HDMI, DRRS Supported : No, VBT DRRS_type: Seamless

V3: [By Ram]: Readability is improved.
Another error case is covered [Daniel]

V4: [By Ram]: Current status of the Idleness DRRS along with
the Front buffer bits are added to the debugfs. [Rodrigo]

V5: [By Ram]: Rephrased to make it easy to understand.
And format is modified. [Rodrigo]

---
  drivers/gpu/drm/i915/i915_debugfs.c |  113 +++++++++++++++++++++++++++++++++++
  1 file changed, 113 insertions(+)
drivers/gpu/drm/i915/i915_debugfs.c +54 -0
index 164fa82..e51001c 100644
@@ -2869,6 +2869,118 @@ static int i915_ddb_info(struct seq_file *m, void *unused)
         return 0;
  }
 
+static void drrs_status_per_crtc(struct seq_file *m,
+               struct drm_device *dev, struct intel_crtc *intel_crtc)
+{
+       struct intel_encoder *intel_encoder;
+       struct drm_i915_private *dev_priv = dev->dev_private;
+       struct i915_drrs *drrs = &dev_priv->drrs;
+       int vrefresh = 0;
+       u32 work_status;
+
+       for_each_encoder_on_crtc(dev, &intel_crtc->base, intel_encoder) {
+               /* Encoder connected on this CRTC */
+               switch (intel_encoder->type) {
+               case INTEL_OUTPUT_EDP:
+                       seq_puts(m, "eDP:\n");
+                       break;
+               case INTEL_OUTPUT_DSI:
+                       seq_puts(m, "DSI:\n");
+                       break;
+               case INTEL_OUTPUT_HDMI:
+                       seq_puts(m, "HDMI:\n");
+                       break;
+               case INTEL_OUTPUT_DISPLAYPORT:
+                       seq_puts(m, "DP:\n");
+                       break;
+               default:
+                       seq_printf(m, "Other encoder (id=%d).\n",
+                                               intel_encoder->type);
+                       return;
+               }
+       }
+
+       if (dev_priv->vbt.drrs_type == STATIC_DRRS_SUPPORT)
+               seq_puts(m, "\tVBT: DRRS_type: Static");
+       else if (dev_priv->vbt.drrs_type == SEAMLESS_DRRS_SUPPORT)
+               seq_puts(m, "\tVBT: DRRS_type: Seamless");
+       else if (dev_priv->vbt.drrs_type == DRRS_NOT_SUPPORTED)
+               seq_puts(m, "\tVBT: DRRS_type: None");
+       else
+               seq_puts(m, "\tVBT: DRRS_type: FIXME: Unrecognized Value");
+
+       seq_puts(m, "\n\n");
+
+       if (intel_crtc->config->has_drrs) {
+               struct intel_panel *panel;
+
+               panel = &drrs->dp->attached_connector->panel;
+               /* DRRS Supported */
+               seq_puts(m, "\tDRRS Supported: Yes\n");
+               seq_printf(m, "\t\tBusy_frontbuffer_bits: 0x%X",
+                                       drrs->busy_frontbuffer_bits);
+
+               seq_puts(m, "\n\t\t");
+               work_status = work_busy(&drrs->work.work);
+               if (drrs->busy_frontbuffer_bits) {
Quoted 8 lines

drivers/gpu/drm/i915/i915_debugfs.c static int i915_ddb_info(struct seq_file *m, void *unused) · line 2932

Quoted 7 lines
drivers/gpu/drm/i915/i915_debugfs.c +7 -0
+                       seq_puts(m, "Front buffer: Busy.\n");
+                       seq_puts(m, "\t\tIdleness DRRS: Disabled");
+               } else {
+                       seq_puts(m, "Front buffer: Idle");
+                       seq_puts(m, "\n\t\t");
+                       if (drrs->refresh_rate_type == DRRS_HIGH_RR) {
+                               if (work_status)

Why do you need to check work_busy here?

This is to capture the DRRS disabled state due to function intel_edp_drrs_disable.

Quoted 73 lines
Quoted 66 lines
drivers/gpu/drm/i915/i915_debugfs.c +52 -1
+                                       seq_puts(m, "Idleness DRRS: Enabled");
+                               else
+                                       seq_puts(m, "Idleness DRRS: Disabled");
+                       } else if (drrs->refresh_rate_type == DRRS_LOW_RR) {
+                               seq_puts(m, "Idleness DRRS: Enabled");
+                       }
+               }
+
+               seq_puts(m, "\n\t\t");
+               if (drrs->refresh_rate_type == DRRS_HIGH_RR) {
+                       seq_puts(m, "DRRS_State: DRRS_HIGH_RR\n");
+                       vrefresh = panel->fixed_mode->vrefresh;
+               } else if (drrs->refresh_rate_type == DRRS_LOW_RR) {
+                       seq_puts(m, "DRRS_State: DRRS_LOW_RR\n");
+                       vrefresh = panel->downclock_mode->vrefresh;
+               } else {
+                       seq_printf(m, "DRRS_State: Unknown(%d)\n",
+                                               drrs->refresh_rate_type);
+                       return;
+               }
+               seq_printf(m, "\t\tVrefresh: %d", vrefresh);
+
+       } else {
+               /* DRRS not supported. Print the VBT parameter*/
+               seq_puts(m, "\tDRRS Supported : No");
+       }
+       seq_puts(m, "\n");
+}
+
+static int i915_drrs_status(struct seq_file *m, void *unused)
+{
+       struct drm_info_node *node = m->private;
+       struct drm_device *dev = node->minor->dev;
+       struct intel_crtc *intel_crtc;
+       int active_crtc_cnt = 0;
+
+       for_each_intel_crtc(dev, intel_crtc) {
+               if (intel_crtc->active) {
+                       active_crtc_cnt++;
+                       seq_printf(m, "\nCRTC %d:  ", active_crtc_cnt);
+
+                       drrs_status_per_crtc(m, dev, intel_crtc);
+               }
+       }
+
+       if (!active_crtc_cnt)
+               seq_puts(m, "No active crtc found\n");
+
+       return 0;
+}
+
  struct pipe_crc_info {
         const char *name;
         struct drm_device *dev;
@@ -4483,6 +4595,7 @@ static const struct drm_info_list i915_debugfs_list[] = {
         {"i915_dp_mst_info", i915_dp_mst_info, 0},
         {"i915_wa_registers", i915_wa_registers, 0},
         {"i915_ddb_info", i915_ddb_info, 0},
+       {"i915_drrs_status", i915_drrs_status, 0},
  };
  #define I915_DEBUGFS_ENTRIES ARRAY_SIZE(i915_debugfs_list)
 
--

1.7.9.5

Quoted 4 lines

_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx

Thanks for the changes.
With that explained feel free to use Reviewed-by: Rodrigo Vivi <[email protected]>

Signature · 6 lines
Ram

_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
#17 lore raw

Re: [PATCH] drm/i915: Add debugfs entry for DRRS

In reply to Ramalingam C
Quoted 19 lines · Ramalingam C

From: Vandana Kannan <[email protected]>

Adding a debugfs entry to determine if DRRS is supported or not

V2: [By Ram]: Following details about the active crtc will be filled
in seq-file of the debugfs
1. Encoder output type
2. DRRS Support on this CRTC
3. DRRS current state
4. Current Vrefresh
Format is as follows:

CRTC 1:  Output: eDP, DRRS Supported: Yes (Seamless), DRRS_State: DRRS_HIGH_RR, Vrefresh: 60
CRTC 2:  Output: HDMI, DRRS Supported : No, VBT DRRS_type: Seamless
CRTC 1:  Output: eDP, DRRS Supported: Yes (Seamless), DRRS_State: DRRS_LOW_RR, Vrefresh: 40
CRTC 2:  Output: HDMI, DRRS Supported : No, VBT DRRS_type: Seamless

V3: [By Ram]: Readability is improved.
Another error case is covered [Daniel]

Quoted 8 lines

V4: [By Ram]: Current status of the Idleness DRRS along with
the Front buffer bits are added to the debugfs. [Rodrigo]

V5: [By Ram]: Rephrased to make it easy to understand.
And format is modified. [Rodrigo]

Total absence of locking while walking modesetting structures is a bit uncool.

Quoted 48 lines
---
 drivers/gpu/drm/i915/i915_debugfs.c |  113 +++++++++++++++++++++++++++++++++++
 1 file changed, 113 insertions(+)
drivers/gpu/drm/i915/i915_debugfs.c +36 -0
index 164fa82..e51001c 100644
@@ -2869,6 +2869,118 @@ static int i915_ddb_info(struct seq_file *m, void *unused)
 	return 0;
 }
 
+static void drrs_status_per_crtc(struct seq_file *m,
+		struct drm_device *dev, struct intel_crtc *intel_crtc)
+{
+	struct intel_encoder *intel_encoder;
+	struct drm_i915_private *dev_priv = dev->dev_private;
+	struct i915_drrs *drrs = &dev_priv->drrs;
+	int vrefresh = 0;
+	u32 work_status;
+
+	for_each_encoder_on_crtc(dev, &intel_crtc->base, intel_encoder) {
+		/* Encoder connected on this CRTC */
+		switch (intel_encoder->type) {
+		case INTEL_OUTPUT_EDP:
+			seq_puts(m, "eDP:\n");
+			break;
+		case INTEL_OUTPUT_DSI:
+			seq_puts(m, "DSI:\n");
+			break;
+		case INTEL_OUTPUT_HDMI:
+			seq_puts(m, "HDMI:\n");
+			break;
+		case INTEL_OUTPUT_DISPLAYPORT:
+			seq_puts(m, "DP:\n");
+			break;
+		default:
+			seq_printf(m, "Other encoder (id=%d).\n",
+						intel_encoder->type);
+			return;
+		}
+	}
+
+	if (dev_priv->vbt.drrs_type == STATIC_DRRS_SUPPORT)
+		seq_puts(m, "\tVBT: DRRS_type: Static");
+	else if (dev_priv->vbt.drrs_type == SEAMLESS_DRRS_SUPPORT)
+		seq_puts(m, "\tVBT: DRRS_type: Seamless");
+	else if (dev_priv->vbt.drrs_type == DRRS_NOT_SUPPORTED)

drivers/gpu/drm/i915/i915_debugfs.c static int i915_ddb_info(struct seq_file *m, void *unused) · line 2917

Quoted 10 lines
drivers/gpu/drm/i915/i915_debugfs.c +10 -0
+		seq_puts(m, "\tVBT: DRRS_type: None");
+	else
+		seq_puts(m, "\tVBT: DRRS_type: FIXME: Unrecognized Value");
+
+	seq_puts(m, "\n\n");
+
+	if (intel_crtc->config->has_drrs) {
+		struct intel_panel *panel;
+
+		panel = &drrs->dp->attached_connector->panel;

Same here, chasing drrs pointers without grabbing the right locks isn't awesome either. I've merged all the other patches in this series to dinq. -Daniel

Quoted 84 lines
drivers/gpu/drm/i915/i915_debugfs.c +67 -0
+		/* DRRS Supported */
+		seq_puts(m, "\tDRRS Supported: Yes\n");
+		seq_printf(m, "\t\tBusy_frontbuffer_bits: 0x%X",
+					drrs->busy_frontbuffer_bits);
+
+		seq_puts(m, "\n\t\t");
+		work_status = work_busy(&drrs->work.work);
+		if (drrs->busy_frontbuffer_bits) {
+			seq_puts(m, "Front buffer: Busy.\n");
+			seq_puts(m, "\t\tIdleness DRRS: Disabled");
+		} else {
+			seq_puts(m, "Front buffer: Idle");
+			seq_puts(m, "\n\t\t");
+			if (drrs->refresh_rate_type == DRRS_HIGH_RR) {
+				if (work_status)
+					seq_puts(m, "Idleness DRRS: Enabled");
+				else
+					seq_puts(m, "Idleness DRRS: Disabled");
+			} else if (drrs->refresh_rate_type == DRRS_LOW_RR) {
+				seq_puts(m, "Idleness DRRS: Enabled");
+			}
+		}
+
+		seq_puts(m, "\n\t\t");
+		if (drrs->refresh_rate_type == DRRS_HIGH_RR) {
+			seq_puts(m, "DRRS_State: DRRS_HIGH_RR\n");
+			vrefresh = panel->fixed_mode->vrefresh;
+		} else if (drrs->refresh_rate_type == DRRS_LOW_RR) {
+			seq_puts(m, "DRRS_State: DRRS_LOW_RR\n");
+			vrefresh = panel->downclock_mode->vrefresh;
+		} else {
+			seq_printf(m, "DRRS_State: Unknown(%d)\n",
+						drrs->refresh_rate_type);
+			return;
+		}
+		seq_printf(m, "\t\tVrefresh: %d", vrefresh);
+
+	} else {
+		/* DRRS not supported. Print the VBT parameter*/
+		seq_puts(m, "\tDRRS Supported : No");
+	}
+	seq_puts(m, "\n");
+}
+
+static int i915_drrs_status(struct seq_file *m, void *unused)
+{
+	struct drm_info_node *node = m->private;
+	struct drm_device *dev = node->minor->dev;
+	struct intel_crtc *intel_crtc;
+	int active_crtc_cnt = 0;
+
+	for_each_intel_crtc(dev, intel_crtc) {
+		if (intel_crtc->active) {
+			active_crtc_cnt++;
+			seq_printf(m, "\nCRTC %d:  ", active_crtc_cnt);
+
+			drrs_status_per_crtc(m, dev, intel_crtc);
+		}
+	}
+
+	if (!active_crtc_cnt)
+		seq_puts(m, "No active crtc found\n");
+
+	return 0;
+}
+
 struct pipe_crc_info {
 	const char *name;
 	struct drm_device *dev;
@@ -4483,6 +4595,7 @@ static const struct drm_info_list i915_debugfs_list[] = {
 	{"i915_dp_mst_info", i915_dp_mst_info, 0},
 	{"i915_wa_registers", i915_wa_registers, 0},
 	{"i915_ddb_info", i915_ddb_info, 0},
+	{"i915_drrs_status", i915_drrs_status, 0},
 };
 #define I915_DEBUGFS_ENTRIES ARRAY_SIZE(i915_debugfs_list)
 
Signature · 6 lines
1.7.9.5

_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
Signature · 7 lines
Daniel Vetter
Software Engineer, Intel Corporation
+41 (0) 79 365 57 48 - http://blog.ffwll.ch
_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
#18 lore raw

Re: [PATCH] drm/i915: Add debugfs entry for DRRS

Quoted 170 lines · Daniel Vetter
Quoted 19 lines · Ramalingam C

From: Vandana Kannan <[email protected]>

Adding a debugfs entry to determine if DRRS is supported or not

V2: [By Ram]: Following details about the active crtc will be filled
in seq-file of the debugfs
1. Encoder output type
2. DRRS Support on this CRTC
3. DRRS current state
4. Current Vrefresh
Format is as follows:

CRTC 1:  Output: eDP, DRRS Supported: Yes (Seamless), DRRS_State: DRRS_HIGH_RR, Vrefresh: 60
CRTC 2:  Output: HDMI, DRRS Supported : No, VBT DRRS_type: Seamless
CRTC 1:  Output: eDP, DRRS Supported: Yes (Seamless), DRRS_State: DRRS_LOW_RR, Vrefresh: 40
CRTC 2:  Output: HDMI, DRRS Supported : No, VBT DRRS_type: Seamless

V3: [By Ram]: Readability is improved.
Another error case is covered [Daniel]

Quoted 8 lines

V4: [By Ram]: Current status of the Idleness DRRS along with
the Front buffer bits are added to the debugfs. [Rodrigo]

V5: [By Ram]: Rephrased to make it easy to understand.
And format is modified. [Rodrigo]

Total absence of locking while walking modesetting structures is a bit uncool.

Quoted 48 lines
---
  drivers/gpu/drm/i915/i915_debugfs.c |  113 +++++++++++++++++++++++++++++++++++
  1 file changed, 113 insertions(+)
drivers/gpu/drm/i915/i915_debugfs.c +36 -0
index 164fa82..e51001c 100644
@@ -2869,6 +2869,118 @@ static int i915_ddb_info(struct seq_file *m, void *unused)
  	return 0;
  }
 
+static void drrs_status_per_crtc(struct seq_file *m,
+		struct drm_device *dev, struct intel_crtc *intel_crtc)
+{
+	struct intel_encoder *intel_encoder;
+	struct drm_i915_private *dev_priv = dev->dev_private;
+	struct i915_drrs *drrs = &dev_priv->drrs;
+	int vrefresh = 0;
+	u32 work_status;
+
+	for_each_encoder_on_crtc(dev, &intel_crtc->base, intel_encoder) {
+		/* Encoder connected on this CRTC */
+		switch (intel_encoder->type) {
+		case INTEL_OUTPUT_EDP:
+			seq_puts(m, "eDP:\n");
+			break;
+		case INTEL_OUTPUT_DSI:
+			seq_puts(m, "DSI:\n");
+			break;
+		case INTEL_OUTPUT_HDMI:
+			seq_puts(m, "HDMI:\n");
+			break;
+		case INTEL_OUTPUT_DISPLAYPORT:
+			seq_puts(m, "DP:\n");
+			break;
+		default:
+			seq_printf(m, "Other encoder (id=%d).\n",
+						intel_encoder->type);
+			return;
+		}
+	}
+
+	if (dev_priv->vbt.drrs_type == STATIC_DRRS_SUPPORT)
+		seq_puts(m, "\tVBT: DRRS_type: Static");
+	else if (dev_priv->vbt.drrs_type == SEAMLESS_DRRS_SUPPORT)
+		seq_puts(m, "\tVBT: DRRS_type: Seamless");
+	else if (dev_priv->vbt.drrs_type == DRRS_NOT_SUPPORTED)

drivers/gpu/drm/i915/i915_debugfs.c static int i915_ddb_info(struct seq_file *m, void *unused) · line 2917

Quoted 10 lines
drivers/gpu/drm/i915/i915_debugfs.c +10 -0
+		seq_puts(m, "\tVBT: DRRS_type: None");
+	else
+		seq_puts(m, "\tVBT: DRRS_type: FIXME: Unrecognized Value");
+
+	seq_puts(m, "\n\n");
+
+	if (intel_crtc->config->has_drrs) {
+		struct intel_panel *panel;
+
+		panel = &drrs->dp->attached_connector->panel;

Same here, chasing drrs pointers without grabbing the right locks isn't awesome either. I've merged all the other patches in this series to dinq. -Daniel

Quoted 77 lines
drivers/gpu/drm/i915/i915_debugfs.c +67 -0
+		/* DRRS Supported */
+		seq_puts(m, "\tDRRS Supported: Yes\n");
+		seq_printf(m, "\t\tBusy_frontbuffer_bits: 0x%X",
+					drrs->busy_frontbuffer_bits);
+
+		seq_puts(m, "\n\t\t");
+		work_status = work_busy(&drrs->work.work);
+		if (drrs->busy_frontbuffer_bits) {
+			seq_puts(m, "Front buffer: Busy.\n");
+			seq_puts(m, "\t\tIdleness DRRS: Disabled");
+		} else {
+			seq_puts(m, "Front buffer: Idle");
+			seq_puts(m, "\n\t\t");
+			if (drrs->refresh_rate_type == DRRS_HIGH_RR) {
+				if (work_status)
+					seq_puts(m, "Idleness DRRS: Enabled");
+				else
+					seq_puts(m, "Idleness DRRS: Disabled");
+			} else if (drrs->refresh_rate_type == DRRS_LOW_RR) {
+				seq_puts(m, "Idleness DRRS: Enabled");
+			}
+		}
+
+		seq_puts(m, "\n\t\t");
+		if (drrs->refresh_rate_type == DRRS_HIGH_RR) {
+			seq_puts(m, "DRRS_State: DRRS_HIGH_RR\n");
+			vrefresh = panel->fixed_mode->vrefresh;
+		} else if (drrs->refresh_rate_type == DRRS_LOW_RR) {
+			seq_puts(m, "DRRS_State: DRRS_LOW_RR\n");
+			vrefresh = panel->downclock_mode->vrefresh;
+		} else {
+			seq_printf(m, "DRRS_State: Unknown(%d)\n",
+						drrs->refresh_rate_type);
+			return;
+		}
+		seq_printf(m, "\t\tVrefresh: %d", vrefresh);
+
+	} else {
+		/* DRRS not supported. Print the VBT parameter*/
+		seq_puts(m, "\tDRRS Supported : No");
+	}
+	seq_puts(m, "\n");
+}
+
+static int i915_drrs_status(struct seq_file *m, void *unused)
+{
+	struct drm_info_node *node = m->private;
+	struct drm_device *dev = node->minor->dev;
+	struct intel_crtc *intel_crtc;
+	int active_crtc_cnt = 0;
+
+	for_each_intel_crtc(dev, intel_crtc) {
+		if (intel_crtc->active) {
+			active_crtc_cnt++;
+			seq_printf(m, "\nCRTC %d:  ", active_crtc_cnt);
+
+			drrs_status_per_crtc(m, dev, intel_crtc);
+		}
+	}
+
+	if (!active_crtc_cnt)
+		seq_puts(m, "No active crtc found\n");
+
+	return 0;
+}
+
  struct pipe_crc_info {
  	const char *name;
  	struct drm_device *dev;
@@ -4483,6 +4595,7 @@ static const struct drm_info_list i915_debugfs_list[] = {
  	{"i915_dp_mst_info", i915_dp_mst_info, 0},
  	{"i915_wa_registers", i915_wa_registers, 0},
  	{"i915_ddb_info", i915_ddb_info, 0},
+	{"i915_drrs_status", i915_drrs_status, 0},
  };
  #define I915_DEBUGFS_ENTRIES ARRAY_SIZE(i915_debugfs_list)
 
Quoted 7 lines
Quoted 7 lines
Signature · 6 lines
1.7.9.5

_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx

Sorry for missing mutex protection. I will modify accordingly. Thanks for the review daniel.

Signature · 6 lines
Ram

_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
#19 lore raw

PATCH 1/1 drm/i915: Add debugfs entry for DRRS

From: Vandana Kannan <[email protected]>

Adding a debugfs entry to determine if DRRS is supported or not

V2: [By Ram]: Following details about the active crtc will be filled
in seq-file of the debugfs
1. Encoder output type
2. DRRS Support on this CRTC
3. DRRS current state
4. Current Vrefresh
Format is as follows:

CRTC 1:  Output: eDP, DRRS Supported: Yes (Seamless), DRRS_State: DRRS_HIGH_RR, Vrefresh: 60
CRTC 2:  Output: HDMI, DRRS Supported : No, VBT DRRS_type: Seamless
CRTC 1:  Output: eDP, DRRS Supported: Yes (Seamless), DRRS_State: DRRS_LOW_RR, Vrefresh: 40
CRTC 2:  Output: HDMI, DRRS Supported : No, VBT DRRS_type: Seamless

V3: [By Ram]: Readability is improved.
Another error case is covered [Daniel]

V4: [By Ram]: Current status of the Idleness DRRS along with
the Front buffer bits are added to the debugfs. [Rodrigo]

V5: [By Ram]: Rephrased to make it easy to understand.
And format is modified. [Rodrigo]

V6: [By Ram]: Modeset mutex are acquired for each crtc along with
renaming the Idleness detection states [Daniel]

---
 drivers/gpu/drm/i915/i915_debugfs.c |  141 +++++++++++++++++++++++++++++++++++
 1 file changed, 141 insertions(+)
drivers/gpu/drm/i915/i915_debugfs.c +141 -0
index 94b3984..90e56ca 100644
@@ -2870,6 +2870,146 @@ static int i915_ddb_info(struct seq_file *m, void *unused)
 	return 0;
 }
 
+static void drrs_status_per_crtc(struct seq_file *m,
+		struct drm_device *dev, struct intel_crtc *intel_crtc)
+{
+	struct intel_encoder *intel_encoder;
+	struct drm_i915_private *dev_priv = dev->dev_private;
+	struct i915_drrs *drrs = &dev_priv->drrs;
+	int vrefresh = 0;
+	u32 work_status;
+
+	for_each_encoder_on_crtc(dev, &intel_crtc->base, intel_encoder) {
+		/* Encoder connected on this CRTC */
+		switch (intel_encoder->type) {
+		case INTEL_OUTPUT_EDP:
+			seq_puts(m, "eDP:\n");
+			break;
+		case INTEL_OUTPUT_DSI:
+			seq_puts(m, "DSI:\n");
+			break;
+		case INTEL_OUTPUT_HDMI:
+			seq_puts(m, "HDMI:\n");
+			break;
+		case INTEL_OUTPUT_DISPLAYPORT:
+			seq_puts(m, "DP:\n");
+			break;
+		default:
+			seq_printf(m, "Other encoder (id=%d).\n",
+						intel_encoder->type);
+			return;
+		}
+	}
+
+	if (dev_priv->vbt.drrs_type == STATIC_DRRS_SUPPORT)
+		seq_puts(m, "\tVBT: DRRS_type: Static");
+	else if (dev_priv->vbt.drrs_type == SEAMLESS_DRRS_SUPPORT)
+		seq_puts(m, "\tVBT: DRRS_type: Seamless");
+	else if (dev_priv->vbt.drrs_type == DRRS_NOT_SUPPORTED)
+		seq_puts(m, "\tVBT: DRRS_type: None");
+	else
+		seq_puts(m, "\tVBT: DRRS_type: FIXME: Unrecognized Value");
+
+	seq_puts(m, "\n\n");
+
+	/*
+	 * Idleness DRRS detection states:
+	 *	Enabled   :	Idleness detection is active. When system is
+	 *			Idle for the defined duration DRRS_LOW_RR
+	 *			will be set. Or Idleness is already detected
+	 *			and DRRS_LOW_RR is applied.
+	 *	Suspended :	Due to frontbuffer's busy state, Idleness
+	 *			detection is suspended.
+	 *	Disabled  :	Idleness detection is disabled until a call is
+	 *			made to enable. No encoder pointer will be
+	 *			available.
+	 */
+	if (intel_crtc->config->has_drrs) {
+		struct intel_panel *panel;
+
+		mutex_lock(&drrs->mutex);
+		/* DRRS Supported */
+		seq_puts(m, "\tDRRS Supported: Yes\n");
+
+		/* disable_drrs() will make drrs->dp NULL */
+		if (!drrs->dp) {
+			seq_puts(m, "Idleness DRRS: Disabled");
+			mutex_unlock(&drrs->mutex);
+			return;
+		}
+
+		panel = &drrs->dp->attached_connector->panel;
+		seq_printf(m, "\t\tBusy_frontbuffer_bits: 0x%X",
+					drrs->busy_frontbuffer_bits);
+
+		seq_puts(m, "\n\t\t");
+		if (drrs->refresh_rate_type == DRRS_HIGH_RR) {
+			seq_puts(m, "DRRS_State: DRRS_HIGH_RR\n");
+			vrefresh = panel->fixed_mode->vrefresh;
+		} else if (drrs->refresh_rate_type == DRRS_LOW_RR) {
+			seq_puts(m, "DRRS_State: DRRS_LOW_RR\n");
+			vrefresh = panel->downclock_mode->vrefresh;
+		} else {
+			seq_printf(m, "DRRS_State: Unknown(%d)\n",
+						drrs->refresh_rate_type);
+			mutex_unlock(&drrs->mutex);
+			return;
+		}
+		seq_printf(m, "\t\tVrefresh: %d", vrefresh);
+
+		seq_puts(m, "\n\t\t");
+		work_status = work_busy(&drrs->work.work);
+		if (drrs->busy_frontbuffer_bits) {
+			seq_puts(m, "Front buffer: Busy.\n");
+			seq_puts(m, "\t\tIdleness DRRS: Suspended");
+		} else {
+			seq_puts(m, "Front buffer: Idle");
+			seq_puts(m, "\n\t\t");
+			if (drrs->refresh_rate_type == DRRS_HIGH_RR) {
+				if (work_status) {
+					seq_puts(m, "Idleness DRRS: Enabled");
+				} else {
+					seq_puts(m, "Idleness DRRS: Suspended.");
+					seq_puts(m, " FIXME: Shouldn't be here");
+				}
+			} else if (drrs->refresh_rate_type == DRRS_LOW_RR) {
+				seq_puts(m, "Idleness DRRS: Enabled");
+			}
+		}
+		mutex_unlock(&drrs->mutex);
+	} else {
+		/* DRRS not supported. Print the VBT parameter*/
+		seq_puts(m, "\tDRRS Supported : No");
+	}
+	seq_puts(m, "\n");
+}
+
+static int i915_drrs_status(struct seq_file *m, void *unused)
+{
+	struct drm_info_node *node = m->private;
+	struct drm_device *dev = node->minor->dev;
+	struct intel_crtc *intel_crtc;
+	int active_crtc_cnt = 0;
+
+	for_each_intel_crtc(dev, intel_crtc) {
+		drm_modeset_lock(&intel_crtc->base.mutex, NULL);
+
+		if (intel_crtc->active) {
+			active_crtc_cnt++;
+			seq_printf(m, "\nCRTC %d:  ", active_crtc_cnt);
+
+			drrs_status_per_crtc(m, dev, intel_crtc);
+		}
+
+		drm_modeset_unlock(&intel_crtc->base.mutex);
+	}
+
+	if (!active_crtc_cnt)
+		seq_puts(m, "No active crtc found\n");
+
+	return 0;
+}
+
 struct pipe_crc_info {
 	const char *name;
 	struct drm_device *dev;
@@ -4548,6 +4688,7 @@ static const struct drm_info_list i915_debugfs_list[] = {
 	{"i915_wa_registers", i915_wa_registers, 0},
 	{"i915_ddb_info", i915_ddb_info, 0},
 	{"i915_sseu_status", i915_sseu_status, 0},
+	{"i915_drrs_status", i915_drrs_status, 0},
 };
 #define I915_DEBUGFS_ENTRIES ARRAY_SIZE(i915_debugfs_list)
 
Signature · 6 lines
1.7.9.5

_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
Reviewed-by on v1 1/1
#20 lore raw

Re: [PATCH] drm/i915: Add debugfs entry for DRRS

Quoted 130 lines · Ramalingam C

From: Vandana Kannan <[email protected]>

Adding a debugfs entry to determine if DRRS is supported or not

V2: [By Ram]: Following details about the active crtc will be filled
in seq-file of the debugfs
1. Encoder output type
2. DRRS Support on this CRTC
3. DRRS current state
4. Current Vrefresh
Format is as follows:

CRTC 1:  Output: eDP, DRRS Supported: Yes (Seamless), DRRS_State: DRRS_HIGH_RR, Vrefresh: 60
CRTC 2:  Output: HDMI, DRRS Supported : No, VBT DRRS_type: Seamless
CRTC 1:  Output: eDP, DRRS Supported: Yes (Seamless), DRRS_State: DRRS_LOW_RR, Vrefresh: 40
CRTC 2:  Output: HDMI, DRRS Supported : No, VBT DRRS_type: Seamless

V3: [By Ram]: Readability is improved.
Another error case is covered [Daniel]

V4: [By Ram]: Current status of the Idleness DRRS along with
the Front buffer bits are added to the debugfs. [Rodrigo]

V5: [By Ram]: Rephrased to make it easy to understand.
And format is modified. [Rodrigo]

V6: [By Ram]: Modeset mutex are acquired for each crtc along with
renaming the Idleness detection states [Daniel]

---
 drivers/gpu/drm/i915/i915_debugfs.c |  141 +++++++++++++++++++++++++++++++++++
 1 file changed, 141 insertions(+)
drivers/gpu/drm/i915/i915_debugfs.c +88 -0
index 94b3984..90e56ca 100644
@@ -2870,6 +2870,146 @@ static int i915_ddb_info(struct seq_file *m, void *unused)
        return 0;
 }
 
+static void drrs_status_per_crtc(struct seq_file *m,
+               struct drm_device *dev, struct intel_crtc *intel_crtc)
+{
+       struct intel_encoder *intel_encoder;
+       struct drm_i915_private *dev_priv = dev->dev_private;
+       struct i915_drrs *drrs = &dev_priv->drrs;
+       int vrefresh = 0;
+       u32 work_status;
+
+       for_each_encoder_on_crtc(dev, &intel_crtc->base, intel_encoder) {
+               /* Encoder connected on this CRTC */
+               switch (intel_encoder->type) {
+               case INTEL_OUTPUT_EDP:
+                       seq_puts(m, "eDP:\n");
+                       break;
+               case INTEL_OUTPUT_DSI:
+                       seq_puts(m, "DSI:\n");
+                       break;
+               case INTEL_OUTPUT_HDMI:
+                       seq_puts(m, "HDMI:\n");
+                       break;
+               case INTEL_OUTPUT_DISPLAYPORT:
+                       seq_puts(m, "DP:\n");
+                       break;
+               default:
+                       seq_printf(m, "Other encoder (id=%d).\n",
+                                               intel_encoder->type);
+                       return;
+               }
+       }
+
+       if (dev_priv->vbt.drrs_type == STATIC_DRRS_SUPPORT)
+               seq_puts(m, "\tVBT: DRRS_type: Static");
+       else if (dev_priv->vbt.drrs_type == SEAMLESS_DRRS_SUPPORT)
+               seq_puts(m, "\tVBT: DRRS_type: Seamless");
+       else if (dev_priv->vbt.drrs_type == DRRS_NOT_SUPPORTED)
+               seq_puts(m, "\tVBT: DRRS_type: None");
+       else
+               seq_puts(m, "\tVBT: DRRS_type: FIXME: Unrecognized Value");
+
+       seq_puts(m, "\n\n");
+
+       /*
+        * Idleness DRRS detection states:
+        *      Enabled   :     Idleness detection is active. When system is
+        *                      Idle for the defined duration DRRS_LOW_RR
+        *                      will be set. Or Idleness is already detected
+        *                      and DRRS_LOW_RR is applied.
+        *      Suspended :     Due to frontbuffer's busy state, Idleness
+        *                      detection is suspended.
+        *      Disabled  :     Idleness detection is disabled until a call is
+        *                      made to enable. No encoder pointer will be
+        *                      available.
+        */
+       if (intel_crtc->config->has_drrs) {
+               struct intel_panel *panel;
+
+               mutex_lock(&drrs->mutex);
+               /* DRRS Supported */
+               seq_puts(m, "\tDRRS Supported: Yes\n");
+
+               /* disable_drrs() will make drrs->dp NULL */
+               if (!drrs->dp) {
+                       seq_puts(m, "Idleness DRRS: Disabled");
+                       mutex_unlock(&drrs->mutex);
+                       return;
+               }
+
+               panel = &drrs->dp->attached_connector->panel;
+               seq_printf(m, "\t\tBusy_frontbuffer_bits: 0x%X",
+                                       drrs->busy_frontbuffer_bits);
+
+               seq_puts(m, "\n\t\t");
+               if (drrs->refresh_rate_type == DRRS_HIGH_RR) {
+                       seq_puts(m, "DRRS_State: DRRS_HIGH_RR\n");
+                       vrefresh = panel->fixed_mode->vrefresh;
+               } else if (drrs->refresh_rate_type == DRRS_LOW_RR) {
+                       seq_puts(m, "DRRS_State: DRRS_LOW_RR\n");
+                       vrefresh = panel->downclock_mode->vrefresh;
+               } else {
+                       seq_printf(m, "DRRS_State: Unknown(%d)\n",
+                                               drrs->refresh_rate_type);
+                       mutex_unlock(&drrs->mutex);
+                       return;
+               }
+               seq_printf(m, "\t\tVrefresh: %d", vrefresh);
+
+               seq_puts(m, "\n\t\t");

drivers/gpu/drm/i915/i915_debugfs.c static int i915_ddb_info(struct seq_file *m, void *unused) · line 2970

Quoted 10 lines
drivers/gpu/drm/i915/i915_debugfs.c +10 -0
+               work_status = work_busy(&drrs->work.work);
+               if (drrs->busy_frontbuffer_bits) {
+                       seq_puts(m, "Front buffer: Busy.\n");
+                       seq_puts(m, "\t\tIdleness DRRS: Suspended");
+               } else {
+                       seq_puts(m, "Front buffer: Idle");
+                       seq_puts(m, "\n\t\t");
+                       if (drrs->refresh_rate_type == DRRS_HIGH_RR) {
+                               if (work_status) {
+                                       seq_puts(m, "Idleness DRRS: Enabled");

I couldn't understand yet why the work busy means DRRS enabled necessarily. Isn't there a more reliable way to check for DRRS enabled?

Nothing that can't be done in a followup patch... Also I'd like to see drrs status now so feel free to use

Quoted 60 lines
drivers/gpu/drm/i915/i915_debugfs.c +43 -1
+                               } else {
+                                       seq_puts(m, "Idleness DRRS: Suspended.");
+                                       seq_puts(m, " FIXME: Shouldn't be here");
+                               }
+                       } else if (drrs->refresh_rate_type == DRRS_LOW_RR) {
+                               seq_puts(m, "Idleness DRRS: Enabled");
+                       }
+               }
+               mutex_unlock(&drrs->mutex);
+       } else {
+               /* DRRS not supported. Print the VBT parameter*/
+               seq_puts(m, "\tDRRS Supported : No");
+       }
+       seq_puts(m, "\n");
+}
+
+static int i915_drrs_status(struct seq_file *m, void *unused)
+{
+       struct drm_info_node *node = m->private;
+       struct drm_device *dev = node->minor->dev;
+       struct intel_crtc *intel_crtc;
+       int active_crtc_cnt = 0;
+
+       for_each_intel_crtc(dev, intel_crtc) {
+               drm_modeset_lock(&intel_crtc->base.mutex, NULL);
+
+               if (intel_crtc->active) {
+                       active_crtc_cnt++;
+                       seq_printf(m, "\nCRTC %d:  ", active_crtc_cnt);
+
+                       drrs_status_per_crtc(m, dev, intel_crtc);
+               }
+
+               drm_modeset_unlock(&intel_crtc->base.mutex);
+       }
+
+       if (!active_crtc_cnt)
+               seq_puts(m, "No active crtc found\n");
+
+       return 0;
+}
+
 struct pipe_crc_info {
        const char *name;
        struct drm_device *dev;
@@ -4548,6 +4688,7 @@ static const struct drm_info_list i915_debugfs_list[] = {
        {"i915_wa_registers", i915_wa_registers, 0},
        {"i915_ddb_info", i915_ddb_info, 0},
        {"i915_sseu_status", i915_sseu_status, 0},
+       {"i915_drrs_status", i915_drrs_status, 0},
 };
 #define I915_DEBUGFS_ENTRIES ARRAY_SIZE(i915_debugfs_list)
 
--

1.7.9.5

_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx

Signature · 6 lines
Rodrigo Vivi
Blog: http://blog.vivi.eng.br
_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
#21 lore raw

Re: [PATCH] drm/i915: Add debugfs entry for DRRS

Quoted 136 lines · Rodrigo Vivi
Quoted 135 lines · Ramalingam C

From: Vandana Kannan <[email protected]>

Adding a debugfs entry to determine if DRRS is supported or not

V2: [By Ram]: Following details about the active crtc will be filled
in seq-file of the debugfs
1. Encoder output type
2. DRRS Support on this CRTC
3. DRRS current state
4. Current Vrefresh
Format is as follows:

CRTC 1:  Output: eDP, DRRS Supported: Yes (Seamless), DRRS_State: DRRS_HIGH_RR, Vrefresh: 60
CRTC 2:  Output: HDMI, DRRS Supported : No, VBT DRRS_type: Seamless
CRTC 1:  Output: eDP, DRRS Supported: Yes (Seamless), DRRS_State: DRRS_LOW_RR, Vrefresh: 40
CRTC 2:  Output: HDMI, DRRS Supported : No, VBT DRRS_type: Seamless

V3: [By Ram]: Readability is improved.
Another error case is covered [Daniel]

V4: [By Ram]: Current status of the Idleness DRRS along with
the Front buffer bits are added to the debugfs. [Rodrigo]

V5: [By Ram]: Rephrased to make it easy to understand.
And format is modified. [Rodrigo]

V6: [By Ram]: Modeset mutex are acquired for each crtc along with
renaming the Idleness detection states [Daniel]

---
 drivers/gpu/drm/i915/i915_debugfs.c |  141 +++++++++++++++++++++++++++++++++++
 1 file changed, 141 insertions(+)
drivers/gpu/drm/i915/i915_debugfs.c +93 -0
index 94b3984..90e56ca 100644
@@ -2870,6 +2870,146 @@ static int i915_ddb_info(struct seq_file *m, void *unused)
        return 0;
 }
 
+static void drrs_status_per_crtc(struct seq_file *m,
+               struct drm_device *dev, struct intel_crtc *intel_crtc)
+{
+       struct intel_encoder *intel_encoder;
+       struct drm_i915_private *dev_priv = dev->dev_private;
+       struct i915_drrs *drrs = &dev_priv->drrs;
+       int vrefresh = 0;
+       u32 work_status;
+
+       for_each_encoder_on_crtc(dev, &intel_crtc->base, intel_encoder) {
+               /* Encoder connected on this CRTC */
+               switch (intel_encoder->type) {
+               case INTEL_OUTPUT_EDP:
+                       seq_puts(m, "eDP:\n");
+                       break;
+               case INTEL_OUTPUT_DSI:
+                       seq_puts(m, "DSI:\n");
+                       break;
+               case INTEL_OUTPUT_HDMI:
+                       seq_puts(m, "HDMI:\n");
+                       break;
+               case INTEL_OUTPUT_DISPLAYPORT:
+                       seq_puts(m, "DP:\n");
+                       break;
+               default:
+                       seq_printf(m, "Other encoder (id=%d).\n",
+                                               intel_encoder->type);
+                       return;
+               }
+       }
+
+       if (dev_priv->vbt.drrs_type == STATIC_DRRS_SUPPORT)
+               seq_puts(m, "\tVBT: DRRS_type: Static");
+       else if (dev_priv->vbt.drrs_type == SEAMLESS_DRRS_SUPPORT)
+               seq_puts(m, "\tVBT: DRRS_type: Seamless");
+       else if (dev_priv->vbt.drrs_type == DRRS_NOT_SUPPORTED)
+               seq_puts(m, "\tVBT: DRRS_type: None");
+       else
+               seq_puts(m, "\tVBT: DRRS_type: FIXME: Unrecognized Value");
+
+       seq_puts(m, "\n\n");
+
+       /*
+        * Idleness DRRS detection states:
+        *      Enabled   :     Idleness detection is active. When system is
+        *                      Idle for the defined duration DRRS_LOW_RR
+        *                      will be set. Or Idleness is already detected
+        *                      and DRRS_LOW_RR is applied.
+        *      Suspended :     Due to frontbuffer's busy state, Idleness
+        *                      detection is suspended.
+        *      Disabled  :     Idleness detection is disabled until a call is
+        *                      made to enable. No encoder pointer will be
+        *                      available.
+        */
+       if (intel_crtc->config->has_drrs) {
+               struct intel_panel *panel;
+
+               mutex_lock(&drrs->mutex);
+               /* DRRS Supported */
+               seq_puts(m, "\tDRRS Supported: Yes\n");
+
+               /* disable_drrs() will make drrs->dp NULL */
+               if (!drrs->dp) {
+                       seq_puts(m, "Idleness DRRS: Disabled");
+                       mutex_unlock(&drrs->mutex);
+                       return;
+               }
+
+               panel = &drrs->dp->attached_connector->panel;
+               seq_printf(m, "\t\tBusy_frontbuffer_bits: 0x%X",
+                                       drrs->busy_frontbuffer_bits);
+
+               seq_puts(m, "\n\t\t");
+               if (drrs->refresh_rate_type == DRRS_HIGH_RR) {
+                       seq_puts(m, "DRRS_State: DRRS_HIGH_RR\n");
+                       vrefresh = panel->fixed_mode->vrefresh;
+               } else if (drrs->refresh_rate_type == DRRS_LOW_RR) {
+                       seq_puts(m, "DRRS_State: DRRS_LOW_RR\n");
+                       vrefresh = panel->downclock_mode->vrefresh;
+               } else {
+                       seq_printf(m, "DRRS_State: Unknown(%d)\n",
+                                               drrs->refresh_rate_type);
+                       mutex_unlock(&drrs->mutex);
+                       return;
+               }
+               seq_printf(m, "\t\tVrefresh: %d", vrefresh);
+
+               seq_puts(m, "\n\t\t");
+               work_status = work_busy(&drrs->work.work);
+               if (drrs->busy_frontbuffer_bits) {
+                       seq_puts(m, "Front buffer: Busy.\n");
+                       seq_puts(m, "\t\tIdleness DRRS: Suspended");
+               } else {
Quoted 8 lines

drivers/gpu/drm/i915/i915_debugfs.c static int i915_ddb_info(struct seq_file *m, void *unused) · line 2970

Quoted 5 lines
drivers/gpu/drm/i915/i915_debugfs.c +5 -0
+                       seq_puts(m, "Front buffer: Idle");
+                       seq_puts(m, "\n\t\t");
+                       if (drrs->refresh_rate_type == DRRS_HIGH_RR) {
+                               if (work_status) {
+                                       seq_puts(m, "Idleness DRRS: Enabled");

I couldn't understand yet why the work busy means DRRS enabled necessarily. Isn't there a more reliable way to check for DRRS enabled?

Yeah that seems wrong really and will just confuse people. I'll remove this code. Also it's usually much more informative to dump all the frontbuffer bits instead of just a busy/idle answer - if there's a bug in the frontbuffer tracking it's good to know where the busy bits come from.

Applied the patch with those changes.
-Daniel

Quoted 70 lines

Nothing that can't be done in a followup patch... Also I'd like to see drrs status now so feel free to use

Quoted 60 lines
drivers/gpu/drm/i915/i915_debugfs.c +43 -1
+                               } else {
+                                       seq_puts(m, "Idleness DRRS: Suspended.");
+                                       seq_puts(m, " FIXME: Shouldn't be here");
+                               }
+                       } else if (drrs->refresh_rate_type == DRRS_LOW_RR) {
+                               seq_puts(m, "Idleness DRRS: Enabled");
+                       }
+               }
+               mutex_unlock(&drrs->mutex);
+       } else {
+               /* DRRS not supported. Print the VBT parameter*/
+               seq_puts(m, "\tDRRS Supported : No");
+       }
+       seq_puts(m, "\n");
+}
+
+static int i915_drrs_status(struct seq_file *m, void *unused)
+{
+       struct drm_info_node *node = m->private;
+       struct drm_device *dev = node->minor->dev;
+       struct intel_crtc *intel_crtc;
+       int active_crtc_cnt = 0;
+
+       for_each_intel_crtc(dev, intel_crtc) {
+               drm_modeset_lock(&intel_crtc->base.mutex, NULL);
+
+               if (intel_crtc->active) {
+                       active_crtc_cnt++;
+                       seq_printf(m, "\nCRTC %d:  ", active_crtc_cnt);
+
+                       drrs_status_per_crtc(m, dev, intel_crtc);
+               }
+
+               drm_modeset_unlock(&intel_crtc->base.mutex);
+       }
+
+       if (!active_crtc_cnt)
+               seq_puts(m, "No active crtc found\n");
+
+       return 0;
+}
+
 struct pipe_crc_info {
        const char *name;
        struct drm_device *dev;
@@ -4548,6 +4688,7 @@ static const struct drm_info_list i915_debugfs_list[] = {
        {"i915_wa_registers", i915_wa_registers, 0},
        {"i915_ddb_info", i915_ddb_info, 0},
        {"i915_sseu_status", i915_sseu_status, 0},
+       {"i915_drrs_status", i915_drrs_status, 0},
 };
 #define I915_DEBUGFS_ENTRIES ARRAY_SIZE(i915_debugfs_list)
 
--

1.7.9.5

_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx

Signature · 2 lines
Rodrigo Vivi
Blog: http://blog.vivi.eng.br
Signature · 7 lines
Daniel Vetter
Software Engineer, Intel Corporation
+41 (0) 79 365 57 48 - http://blog.ffwll.ch
_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
#22 lore raw

Re: [PATCH] drm/i915: Add debugfs entry for DRRS

Quoted 107 lines · Daniel Vetter
Quoted 106 lines · Rodrigo Vivi
Quoted 105 lines · Ramalingam C

From: Vandana Kannan <[email protected]>

Adding a debugfs entry to determine if DRRS is supported or not

V2: [By Ram]: Following details about the active crtc will be filled
in seq-file of the debugfs
1. Encoder output type
2. DRRS Support on this CRTC
3. DRRS current state
4. Current Vrefresh
Format is as follows:

CRTC 1:  Output: eDP, DRRS Supported: Yes (Seamless), DRRS_State: DRRS_HIGH_RR, Vrefresh: 60
CRTC 2:  Output: HDMI, DRRS Supported : No, VBT DRRS_type: Seamless
CRTC 1:  Output: eDP, DRRS Supported: Yes (Seamless), DRRS_State: DRRS_LOW_RR, Vrefresh: 40
CRTC 2:  Output: HDMI, DRRS Supported : No, VBT DRRS_type: Seamless

V3: [By Ram]: Readability is improved.
Another error case is covered [Daniel]

V4: [By Ram]: Current status of the Idleness DRRS along with
the Front buffer bits are added to the debugfs. [Rodrigo]

V5: [By Ram]: Rephrased to make it easy to understand.
And format is modified. [Rodrigo]

V6: [By Ram]: Modeset mutex are acquired for each crtc along with
renaming the Idleness detection states [Daniel]

---
  drivers/gpu/drm/i915/i915_debugfs.c |  141 +++++++++++++++++++++++++++++++++++
  1 file changed, 141 insertions(+)
drivers/gpu/drm/i915/i915_debugfs.c +63 -0
index 94b3984..90e56ca 100644
@@ -2870,6 +2870,146 @@ static int i915_ddb_info(struct seq_file *m, void *unused)
         return 0;
  }
 
+static void drrs_status_per_crtc(struct seq_file *m,
+               struct drm_device *dev, struct intel_crtc *intel_crtc)
+{
+       struct intel_encoder *intel_encoder;
+       struct drm_i915_private *dev_priv = dev->dev_private;
+       struct i915_drrs *drrs = &dev_priv->drrs;
+       int vrefresh = 0;
+       u32 work_status;
+
+       for_each_encoder_on_crtc(dev, &intel_crtc->base, intel_encoder) {
+               /* Encoder connected on this CRTC */
+               switch (intel_encoder->type) {
+               case INTEL_OUTPUT_EDP:
+                       seq_puts(m, "eDP:\n");
+                       break;
+               case INTEL_OUTPUT_DSI:
+                       seq_puts(m, "DSI:\n");
+                       break;
+               case INTEL_OUTPUT_HDMI:
+                       seq_puts(m, "HDMI:\n");
+                       break;
+               case INTEL_OUTPUT_DISPLAYPORT:
+                       seq_puts(m, "DP:\n");
+                       break;
+               default:
+                       seq_printf(m, "Other encoder (id=%d).\n",
+                                               intel_encoder->type);
+                       return;
+               }
+       }
+
+       if (dev_priv->vbt.drrs_type == STATIC_DRRS_SUPPORT)
+               seq_puts(m, "\tVBT: DRRS_type: Static");
+       else if (dev_priv->vbt.drrs_type == SEAMLESS_DRRS_SUPPORT)
+               seq_puts(m, "\tVBT: DRRS_type: Seamless");
+       else if (dev_priv->vbt.drrs_type == DRRS_NOT_SUPPORTED)
+               seq_puts(m, "\tVBT: DRRS_type: None");
+       else
+               seq_puts(m, "\tVBT: DRRS_type: FIXME: Unrecognized Value");
+
+       seq_puts(m, "\n\n");
+
+       /*
+        * Idleness DRRS detection states:
+        *      Enabled   :     Idleness detection is active. When system is
+        *                      Idle for the defined duration DRRS_LOW_RR
+        *                      will be set. Or Idleness is already detected
+        *                      and DRRS_LOW_RR is applied.
+        *      Suspended :     Due to frontbuffer's busy state, Idleness
+        *                      detection is suspended.
+        *      Disabled  :     Idleness detection is disabled until a call is
+        *                      made to enable. No encoder pointer will be
+        *                      available.
+        */
+       if (intel_crtc->config->has_drrs) {
+               struct intel_panel *panel;
+
+               mutex_lock(&drrs->mutex);
+               /* DRRS Supported */
+               seq_puts(m, "\tDRRS Supported: Yes\n");
+
+               /* disable_drrs() will make drrs->dp NULL */
+               if (!drrs->dp) {
Quoted 8 lines
Quoted 8 lines

drivers/gpu/drm/i915/i915_debugfs.c static int i915_ddb_info(struct seq_file *m, void *unused) · line 2943

Quoted 8 lines
drivers/gpu/drm/i915/i915_debugfs.c +8 -0
+                       seq_puts(m, "Idleness DRRS: Disabled");
+                       mutex_unlock(&drrs->mutex);
+                       return;
+               }
+
+               panel = &drrs->dp->attached_connector->panel;
+               seq_printf(m, "\t\tBusy_frontbuffer_bits: 0x%X",
+                                       drrs->busy_frontbuffer_bits);

Front buffer bits are added here.

Quoted 29 lines
Quoted 21 lines
Quoted 21 lines
drivers/gpu/drm/i915/i915_debugfs.c +21 -0
+
+               seq_puts(m, "\n\t\t");
+               if (drrs->refresh_rate_type == DRRS_HIGH_RR) {
+                       seq_puts(m, "DRRS_State: DRRS_HIGH_RR\n");
+                       vrefresh = panel->fixed_mode->vrefresh;
+               } else if (drrs->refresh_rate_type == DRRS_LOW_RR) {
+                       seq_puts(m, "DRRS_State: DRRS_LOW_RR\n");
+                       vrefresh = panel->downclock_mode->vrefresh;
+               } else {
+                       seq_printf(m, "DRRS_State: Unknown(%d)\n",
+                                               drrs->refresh_rate_type);
+                       mutex_unlock(&drrs->mutex);
+                       return;
+               }
+               seq_printf(m, "\t\tVrefresh: %d", vrefresh);
+
+               seq_puts(m, "\n\t\t");
+               work_status = work_busy(&drrs->work.work);
+               if (drrs->busy_frontbuffer_bits) {
+                       seq_puts(m, "Front buffer: Busy.\n");
+                       seq_puts(m, "\t\tIdleness DRRS: Suspended");
Quoted 8 lines

drivers/gpu/drm/i915/i915_debugfs.c static int i915_ddb_info(struct seq_file *m, void *unused) · line 2970

Quoted 6 lines
drivers/gpu/drm/i915/i915_debugfs.c +6 -0
+               } else {
+                       seq_puts(m, "Front buffer: Idle");
+                       seq_puts(m, "\n\t\t");
+                       if (drrs->refresh_rate_type == DRRS_HIGH_RR) {
+                               if (work_status) {
+                                       seq_puts(m, "Idleness DRRS: Enabled");

I couldn't understand yet why the work busy means DRRS enabled necessarily. Isn't there a more reliable way to check for DRRS enabled?

Quoted 2 lines

Yeah that seems wrong really and will just confuse people. I'll remove this code.

When the front buffer bit indicates Idle and the DRRS state is DRRS_HIGH_RR then we should have the downclock_work scheduled. I was double checking that here. If you are removing that I am fine with that.

Quoted 3 lines

Also it's usually much more informative to dump all the frontbuffer bits instead of just a busy/idle answer - if there's a bug in the frontbuffer tracking it's good to know where the busy bits come from.

Already we have added the front buffer bits in the string.

Quoted 73 lines

Applied the patch with those changes.
-Daniel

Quoted 69 lines

Nothing that can't be done in a followup patch... Also I'd like to see drrs status now so feel free to use

Quoted 60 lines
drivers/gpu/drm/i915/i915_debugfs.c +43 -1
+                               } else {
+                                       seq_puts(m, "Idleness DRRS: Suspended.");
+                                       seq_puts(m, " FIXME: Shouldn't be here");
+                               }
+                       } else if (drrs->refresh_rate_type == DRRS_LOW_RR) {
+                               seq_puts(m, "Idleness DRRS: Enabled");
+                       }
+               }
+               mutex_unlock(&drrs->mutex);
+       } else {
+               /* DRRS not supported. Print the VBT parameter*/
+               seq_puts(m, "\tDRRS Supported : No");
+       }
+       seq_puts(m, "\n");
+}
+
+static int i915_drrs_status(struct seq_file *m, void *unused)
+{
+       struct drm_info_node *node = m->private;
+       struct drm_device *dev = node->minor->dev;
+       struct intel_crtc *intel_crtc;
+       int active_crtc_cnt = 0;
+
+       for_each_intel_crtc(dev, intel_crtc) {
+               drm_modeset_lock(&intel_crtc->base.mutex, NULL);
+
+               if (intel_crtc->active) {
+                       active_crtc_cnt++;
+                       seq_printf(m, "\nCRTC %d:  ", active_crtc_cnt);
+
+                       drrs_status_per_crtc(m, dev, intel_crtc);
+               }
+
+               drm_modeset_unlock(&intel_crtc->base.mutex);
+       }
+
+       if (!active_crtc_cnt)
+               seq_puts(m, "No active crtc found\n");
+
+       return 0;
+}
+
  struct pipe_crc_info {
         const char *name;
         struct drm_device *dev;
@@ -4548,6 +4688,7 @@ static const struct drm_info_list i915_debugfs_list[] = {
         {"i915_wa_registers", i915_wa_registers, 0},
         {"i915_ddb_info", i915_ddb_info, 0},
         {"i915_sseu_status", i915_sseu_status, 0},
+       {"i915_drrs_status", i915_drrs_status, 0},
  };
  #define I915_DEBUGFS_ENTRIES ARRAY_SIZE(i915_debugfs_list)
 
--

1.7.9.5

_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx

Signature · 2 lines
Rodrigo Vivi
Blog: http://blog.vivi.eng.br
Signature · 6 lines
Ram

_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
#23 lore raw

Re: [PATCH] drm/i915: Add debugfs entry for DRRS

Quoted 5 lines · Ramalingam C
Quoted 3 lines · Daniel Vetter

Also it's usually much more informative to dump all the frontbuffer bits instead of just a busy/idle answer - if there's a bug in the frontbuffer tracking it's good to know where the busy bits come from.

Already we have added the front buffer bits in the string.

Indeed, removed the additional line.
-Daniel

Signature · 7 lines
Daniel Vetter
Software Engineer, Intel Corporation
+41 (0) 79 365 57 48 - http://blog.ffwll.ch
_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
#24 lore raw

PATCH 1/1 drm/i915: Enhancing eDP DRRS debug message

In reply to Ramalingam C

When Downclock mode is not found, the same info is added to the corresponding debug log.

---
 drivers/gpu/drm/i915/intel_dp.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/i915/intel_dp.c +1 -1
index e9862e7..8d674f4 100644
@@ -5083,7 +5083,7 @@ intel_dp_drrs_init(struct intel_connector *intel_connector,
 					(dev, fixed_mode, connector);
 
 	if (!downclock_mode) {
-		DRM_DEBUG_KMS("DRRS not supported\n");
+		DRM_DEBUG_KMS("Downclock mode is not found. DRRS not supported\n");
 		return NULL;
 	}
 
Signature · 6 lines
1.7.9.5

_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
Reviewed-by on v1 1/1
#25 lore raw

Re: [PATCH] drm/i915: Enhancing eDP DRRS debug message

Quoted 28 lines · Ramalingam C

When Downclock mode is not found, the same info is added to the corresponding debug log.

---
 drivers/gpu/drm/i915/intel_dp.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/i915/intel_dp.c +1 -2
index e9862e7..8d674f4 100644
@@ -5083,7 +5083,7 @@ intel_dp_drrs_init(struct intel_connector *intel_connector,
                                        (dev, fixed_mode, connector);
 
        if (!downclock_mode) {
-               DRM_DEBUG_KMS("DRRS not supported\n");
+               DRM_DEBUG_KMS("Downclock mode is not found. DRRS not supported\n");
                return NULL;
        }
 
--

1.7.9.5

_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx

Signature · 6 lines
Rodrigo Vivi
Blog: http://blog.vivi.eng.br
_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
#26 lore raw
In reply to Ramalingam C
Quoted 10 lines · Ramalingam C

This series includes a preparation patch for drrs support across differnt platforms in intel_dp_set_m_n along with last 5 pending patches of V3 eDP DRRS patch series.

New series is submitted to make the review more comfortable and to display the dependancy of the patches explicitly.

Durgadoss R (1):
drm/i915: Enable eDP DRRS for CHV

Quoted 8 lines

Ramalingam C (1):
drm/i915: Add support for DRRS in intel_dp_set_m_n

Vandana Kannan (4):
drm/i915/bdw: Add support for DRRS to switch RR
drm/i915: Support for RR switching on VLV
Documentation/drm: DocBook integration for DRRS
drm/i915: Add debugfs entry for DRRS

Ok I've reviewed the locking for DRRS quickly now that it's all merged and it's deadlock-y:

intel_edp_drrs_downclock_work grabs the drrs mutex. But in the disable function we cancel that work and wait for that to complete (cancel_sync) while holding the lock.

Which means if the async work is running this will deadlock. The work cancel must be moved out of the critical section, and the work must double-check (after taking the lock) that drrs hasn't been disabled meanwhile (by checking drrs.dp, which we already do). intel_psr.c contains all that logic as an example.

While you do that follow-up patch could we extract the drrs code into a new intel_drrs.c file? That would also simplify the kerneldoc includes a bit.

Cheers, Daniel

Quoted 12 lines
 Documentation/DocBook/drm.tmpl       |   11 ++++
 drivers/gpu/drm/i915/i915_debugfs.c  |   99 ++++++++++++++++++++++++++++
 drivers/gpu/drm/i915/i915_reg.h      |    1 +
 drivers/gpu/drm/i915/intel_display.c |   32 ++++++---
 drivers/gpu/drm/i915/intel_dp.c      |  121 ++++++++++++++++++++++++++++++++--
 drivers/gpu/drm/i915/intel_drv.h     |   22 ++++++-
 6 files changed, 273 insertions(+), 13 deletions(-)
Signature · 1 line
1.7.9.5
Signature · 7 lines
Daniel Vetter
Software Engineer, Intel Corporation
+41 (0) 79 365 57 48 - http://blog.ffwll.ch
_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
#27 lore raw
Quoted 32 lines · Daniel Vetter
Quoted 10 lines · Ramalingam C

This series includes a preparation patch for drrs support across differnt platforms in intel_dp_set_m_n along with last 5 pending patches of V3 eDP DRRS patch series.

New series is submitted to make the review more comfortable and to display the dependancy of the patches explicitly.

Durgadoss R (1):
drm/i915: Enable eDP DRRS for CHV

Quoted 8 lines

Ramalingam C (1):
drm/i915: Add support for DRRS in intel_dp_set_m_n

Vandana Kannan (4):
drm/i915/bdw: Add support for DRRS to switch RR drm/i915: Support for RR switching on VLV Documentation/drm: DocBook integration for DRRS drm/i915: Add debugfs entry for DRRS

Ok I've reviewed the locking for DRRS quickly now that it's all merged and it's deadlock-y:

intel_edp_drrs_downclock_work grabs the drrs mutex. But in the disable function we cancel that work and wait for that to complete (cancel_sync) while holding the lock.

Which means if the async work is running this will deadlock. The work cancel must be moved out of the critical section, and the work must double-check (after taking the lock) that drrs hasn't been disabled meanwhile (by checking drrs.dp, which we already do). intel_psr.c contains all that logic as an example.

Quoted 5 lines

While you do that follow-up patch could we extract the drrs code into a new intel_drrs.c file? That would also simplify the kerneldoc includes a bit.

Cheers, Daniel

Missed the possible deadlock window. I will upload a patch moving the cancellation of the deferred work out of the mutex protection asap.

As a heads up, in VPG we have implemented MIPI DRRS and also content based DRRS.

MIPI DRRS:
We have extended the DRRS to DSI encoder also on android codelines for BYT and CHV.

Content based DRRS:
We have implemented the interfaces
to expose the DRRS capability and and the vrefresh supported to receive the request for the new vrefresh.

So based on required FPS for the display content to be rendered userspace, will place a request for the new vrefresh.

We have verified the functionality of this implementation on android devices for almost an year now. I will rework on the implementation to adapt to the DRM-intel and submit a RFC to explain the complete design.

This RFC will have the generalized DRRS state machine for all encoders like eDP and DSI along with encoder support for DSI and eDP. So as a result we will have the generic code for drrs state machine in intel_drrs.c totally separated from the encoder related code. Can we wait till then?

--Ram

Quoted 11 lines
Quoted 11 lines
  Documentation/DocBook/drm.tmpl       |   11 ++++
  drivers/gpu/drm/i915/i915_debugfs.c  |   99 ++++++++++++++++++++++++++++
  drivers/gpu/drm/i915/i915_reg.h      |    1 +
  drivers/gpu/drm/i915/intel_display.c |   32 ++++++---
  drivers/gpu/drm/i915/intel_dp.c      |  121 ++++++++++++++++++++++++++++++++--
  drivers/gpu/drm/i915/intel_drv.h     |   22 ++++++-
  6 files changed, 273 insertions(+), 13 deletions(-)
Signature · 1 line
1.7.9.5

_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx

#28 lore raw
Quoted 45 lines · Ramalingam C
Quoted 32 lines · Daniel Vetter
Quoted 10 lines · Ramalingam C

This series includes a preparation patch for drrs support across differnt platforms in intel_dp_set_m_n along with last 5 pending patches of V3 eDP DRRS patch series.

New series is submitted to make the review more comfortable and to display the dependancy of the patches explicitly.

Durgadoss R (1):
drm/i915: Enable eDP DRRS for CHV

Quoted 8 lines

Ramalingam C (1):
drm/i915: Add support for DRRS in intel_dp_set_m_n

Vandana Kannan (4):
drm/i915/bdw: Add support for DRRS to switch RR
drm/i915: Support for RR switching on VLV
Documentation/drm: DocBook integration for DRRS
drm/i915: Add debugfs entry for DRRS

Ok I've reviewed the locking for DRRS quickly now that it's all merged and it's deadlock-y:

intel_edp_drrs_downclock_work grabs the drrs mutex. But in the disable function we cancel that work and wait for that to complete (cancel_sync) while holding the lock.

Which means if the async work is running this will deadlock. The work cancel must be moved out of the critical section, and the work must double-check (after taking the lock) that drrs hasn't been disabled meanwhile (by checking drrs.dp, which we already do). intel_psr.c contains all that logic as an example.

Quoted 5 lines

While you do that follow-up patch could we extract the drrs code into a new intel_drrs.c file? That would also simplify the kerneldoc includes a bit.

Cheers, Daniel

Missed the possible deadlock window. I will upload a patch moving the cancellation of the deferred work out of the mutex protection asap.

As a heads up, in VPG we have implemented MIPI DRRS and also content based DRRS.

Quoted 7 lines

MIPI DRRS:
We have extended the DRRS to DSI encoder also on android codelines for BYT and CHV.

Content based DRRS:
We have implemented the interfaces

What kind of interface? Imo we should do this by adjusting the frequecy of the mode, with a suitable modeset fastpath.
-Daniel

Quoted 11 lines

to expose the DRRS capability and and the vrefresh supported to receive the request for the new vrefresh.

So based on required FPS for the display content to be rendered userspace, will place a request for the new vrefresh.

We have verified the functionality of this implementation on android devices for almost an year now.
I will rework on the implementation to adapt to the DRM-intel and submit a RFC to explain the complete design.

Quoted 5 lines

This RFC will have the generalized DRRS state machine for all encoders like eDP and DSI along with encoder support for DSI and eDP.
So as a result we will have the generic code for drrs state machine in intel_drrs.c totally separated from the encoder related code. Can we wait till then?

The deadlock fix should land asap. Or do you mean something else? -Daniel

Quoted 15 lines

--Ram

Quoted 11 lines
Quoted 11 lines
 Documentation/DocBook/drm.tmpl       |   11 ++++
 drivers/gpu/drm/i915/i915_debugfs.c  |   99 ++++++++++++++++++++++++++++
 drivers/gpu/drm/i915/i915_reg.h      |    1 +
 drivers/gpu/drm/i915/intel_display.c |   32 ++++++---
 drivers/gpu/drm/i915/intel_dp.c      |  121 ++++++++++++++++++++++++++++++++--
 drivers/gpu/drm/i915/intel_drv.h     |   22 ++++++-
 6 files changed, 273 insertions(+), 13 deletions(-)
Signature · 1 line
1.7.9.5
Signature · 7 lines
Daniel Vetter
Software Engineer, Intel Corporation
+41 (0) 79 365 57 48 - http://blog.ffwll.ch
_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
#29 lore raw
Quoted 50 lines · Daniel Vetter
Quoted 49 lines · Ramalingam C
Quoted 32 lines · Daniel Vetter
Quoted 10 lines · Ramalingam C

This series includes a preparation patch for drrs support across differnt platforms in intel_dp_set_m_n along with last 5 pending patches of V3 eDP DRRS patch series.

New series is submitted to make the review more comfortable and to display the dependancy of the patches explicitly.

Durgadoss R (1):
drm/i915: Enable eDP DRRS for CHV

Quoted 8 lines

Ramalingam C (1):
drm/i915: Add support for DRRS in intel_dp_set_m_n

Vandana Kannan (4):
drm/i915/bdw: Add support for DRRS to switch RR drm/i915: Support for RR switching on VLV Documentation/drm: DocBook integration for DRRS drm/i915: Add debugfs entry for DRRS

Ok I've reviewed the locking for DRRS quickly now that it's all merged and it's deadlock-y:

intel_edp_drrs_downclock_work grabs the drrs mutex. But in the disable function we cancel that work and wait for that to complete (cancel_sync) while holding the lock.

Which means if the async work is running this will deadlock. The work cancel must be moved out of the critical section, and the work must double-check (after taking the lock) that drrs hasn't been disabled meanwhile (by checking drrs.dp, which we already do). intel_psr.c contains all that logic as an example.

Quoted 5 lines

While you do that follow-up patch could we extract the drrs code into a new intel_drrs.c file? That would also simplify the kerneldoc includes a bit.

Cheers, Daniel

Missed the possible deadlock window. I will upload a patch moving the cancellation of the deferred work out of the mutex protection asap.

As a heads up, in VPG we have implemented MIPI DRRS and also content based DRRS.

MIPI DRRS:
We have extended the DRRS to DSI encoder also on android codelines for BYT and CHV.

Quoted 5 lines
Quoted 2 lines

Content based DRRS:
We have implemented the interfaces

What kind of interface? Imo we should do this by adjusting the frequecy of the mode, with a suitable modeset fastpath.
-Daniel

We have used the specific path in modeset to request for the DRRS vrefresh. And used a drm property to expose the DRRS type.

Quoted 12 lines
Quoted 12 lines

to expose the DRRS capability and and the vrefresh supported to receive the request for the new vrefresh.

So based on required FPS for the display content to be rendered userspace, will place a request for the new vrefresh.

We have verified the functionality of this implementation on android devices for almost an year now.
I will rework on the implementation to adapt to the DRM-intel and submit a RFC to explain the complete design.

Quoted 6 lines
Quoted 5 lines

This RFC will have the generalized DRRS state machine for all encoders like eDP and DSI along with encoder support for DSI and eDP.
So as a result we will have the generic code for drrs state machine in intel_drrs.c totally separated from the encoder related code. Can we wait till then?

The deadlock fix should land asap. Or do you mean something else?

Patch to fix deadlock will be submitted asap in early monday after required testing. I was asking regarding the DRRS code separation.

Quoted 15 lines

-Daniel

Quoted 13 lines

--Ram

Quoted 11 lines
Quoted 11 lines
  Documentation/DocBook/drm.tmpl       |   11 ++++
  drivers/gpu/drm/i915/i915_debugfs.c  |   99 ++++++++++++++++++++++++++++
  drivers/gpu/drm/i915/i915_reg.h      |    1 +
  drivers/gpu/drm/i915/intel_display.c |   32 ++++++---
  drivers/gpu/drm/i915/intel_dp.c      |  121 ++++++++++++++++++++++++++++++++--
  drivers/gpu/drm/i915/intel_drv.h     |   22 ++++++-
  6 files changed, 273 insertions(+), 13 deletions(-)
Signature · 1 line
1.7.9.5
Signature · 6 lines
Ram

_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
#30 lore raw

PATCH 1/1 drm/i915: Fixing mutex deadlock window at eDP DRRS

In invalidate and flush functions of eDP DRRS, if deferred downclock work starts execution at a time window between acquiring the drrs mutex and cancellation of the deferred work (intel_edp_drrs_downclock_work), then deferred work will find drrs mutex locked and wait for the same.

Meanwhile the function that acquired mutex drrs invalidate/flush will wait for the completion of the deferred work before releasing the mutex. Thats a deadlock.

To avoid such deadlock scenario, this change cancels the deferred work before acquiring the mutex at invalidate and flush functions.

---
 drivers/gpu/drm/i915/intel_dp.c |    7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)
drivers/gpu/drm/i915/intel_dp.c +4 -3
index d1141d3..0a57763 100644
@@ -4966,12 +4966,13 @@ void intel_edp_drrs_invalidate(struct drm_device *dev,
 	if (!dev_priv->drrs.dp)
 		return;
 
+	cancel_delayed_work_sync(&dev_priv->drrs.work);
+
 	mutex_lock(&dev_priv->drrs.mutex);
 	crtc = dp_to_dig_port(dev_priv->drrs.dp)->base.base.crtc;
 	pipe = to_intel_crtc(crtc)->pipe;
 
 	if (dev_priv->drrs.refresh_rate_type == DRRS_LOW_RR) {
-		cancel_delayed_work_sync(&dev_priv->drrs.work);
 		intel_dp_set_drrs_state(dev_priv->dev,
 				dev_priv->drrs.dp->attached_connector->panel.
 				fixed_mode->vrefresh);
@@ -5004,13 +5005,13 @@ void intel_edp_drrs_flush(struct drm_device *dev,
 	if (!dev_priv->drrs.dp)
 		return;
 
+	cancel_delayed_work_sync(&dev_priv->drrs.work);
+
 	mutex_lock(&dev_priv->drrs.mutex);
 	crtc = dp_to_dig_port(dev_priv->drrs.dp)->base.base.crtc;
 	pipe = to_intel_crtc(crtc)->pipe;
 	dev_priv->drrs.busy_frontbuffer_bits &= ~frontbuffer_bits;
 
-	cancel_delayed_work_sync(&dev_priv->drrs.work);
-
 	if (dev_priv->drrs.refresh_rate_type != DRRS_LOW_RR &&
 			!dev_priv->drrs.busy_frontbuffer_bits)
 		schedule_delayed_work(&dev_priv->drrs.work,
Signature · 6 lines
1.7.9.5

_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
Reviewed-by on v1 1/1
#31 lore raw

Re: [PATCH] drm/i915: Fixing mutex deadlock window at eDP DRRS

Looks enough for me...

Quoted 60 lines · Ramalingam C

In invalidate and flush functions of eDP DRRS, if deferred downclock work starts execution at a time window between acquiring the drrs mutex and cancellation of the deferred work (intel_edp_drrs_downclock_work), then deferred work will find drrs mutex locked and wait for the same.

Meanwhile the function that acquired mutex drrs invalidate/flush will wait for the completion of the deferred work before releasing the mutex. Thats a deadlock.

To avoid such deadlock scenario, this change cancels the deferred work before acquiring the mutex at invalidate and flush functions.

---
 drivers/gpu/drm/i915/intel_dp.c |    7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)
drivers/gpu/drm/i915/intel_dp.c +4 -4
index d1141d3..0a57763 100644
@@ -4966,12 +4966,13 @@ void intel_edp_drrs_invalidate(struct drm_device *dev,
        if (!dev_priv->drrs.dp)
                return;
 
+       cancel_delayed_work_sync(&dev_priv->drrs.work);
+
        mutex_lock(&dev_priv->drrs.mutex);
        crtc = dp_to_dig_port(dev_priv->drrs.dp)->base.base.crtc;
        pipe = to_intel_crtc(crtc)->pipe;
 
        if (dev_priv->drrs.refresh_rate_type == DRRS_LOW_RR) {
-               cancel_delayed_work_sync(&dev_priv->drrs.work);
                intel_dp_set_drrs_state(dev_priv->dev,
                                dev_priv->drrs.dp->attached_connector->panel.
                                fixed_mode->vrefresh);
@@ -5004,13 +5005,13 @@ void intel_edp_drrs_flush(struct drm_device *dev,
        if (!dev_priv->drrs.dp)
                return;
 
+       cancel_delayed_work_sync(&dev_priv->drrs.work);
+
        mutex_lock(&dev_priv->drrs.mutex);
        crtc = dp_to_dig_port(dev_priv->drrs.dp)->base.base.crtc;
        pipe = to_intel_crtc(crtc)->pipe;
        dev_priv->drrs.busy_frontbuffer_bits &= ~frontbuffer_bits;
 
-       cancel_delayed_work_sync(&dev_priv->drrs.work);
-
        if (dev_priv->drrs.refresh_rate_type != DRRS_LOW_RR &&
                        !dev_priv->drrs.busy_frontbuffer_bits)
                schedule_delayed_work(&dev_priv->drrs.work,
--

1.7.9.5

_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx

Signature · 6 lines
Rodrigo Vivi
Blog: http://blog.vivi.eng.br
_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
#32 lore raw

Re: [PATCH] drm/i915: Fixing mutex deadlock window at eDP DRRS

Quoted 19 lines · Rodrigo Vivi

Looks enough for me...

Quoted 14 lines · Ramalingam C

In invalidate and flush functions of eDP DRRS, if deferred downclock work starts execution at a time window between acquiring the drrs mutex and cancellation of the deferred work (intel_edp_drrs_downclock_work), then deferred work will find drrs mutex locked and wait for the same.

Meanwhile the function that acquired mutex drrs invalidate/flush will wait for the completion of the deferred work before releasing the mutex. Thats a deadlock.

To avoid such deadlock scenario, this change cancels the deferred work before acquiring the mutex at invalidate and flush functions.

Queued for -next, thanks for the patch.
-Daniel

Quoted 52 lines
Quoted 46 lines
---
 drivers/gpu/drm/i915/intel_dp.c |    7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)
drivers/gpu/drm/i915/intel_dp.c +4 -4
index d1141d3..0a57763 100644
@@ -4966,12 +4966,13 @@ void intel_edp_drrs_invalidate(struct drm_device *dev,
        if (!dev_priv->drrs.dp)
                return;
 
+       cancel_delayed_work_sync(&dev_priv->drrs.work);
+
        mutex_lock(&dev_priv->drrs.mutex);
        crtc = dp_to_dig_port(dev_priv->drrs.dp)->base.base.crtc;
        pipe = to_intel_crtc(crtc)->pipe;
 
        if (dev_priv->drrs.refresh_rate_type == DRRS_LOW_RR) {
-               cancel_delayed_work_sync(&dev_priv->drrs.work);
                intel_dp_set_drrs_state(dev_priv->dev,
                                dev_priv->drrs.dp->attached_connector->panel.
                                fixed_mode->vrefresh);
@@ -5004,13 +5005,13 @@ void intel_edp_drrs_flush(struct drm_device *dev,
        if (!dev_priv->drrs.dp)
                return;
 
+       cancel_delayed_work_sync(&dev_priv->drrs.work);
+
        mutex_lock(&dev_priv->drrs.mutex);
        crtc = dp_to_dig_port(dev_priv->drrs.dp)->base.base.crtc;
        pipe = to_intel_crtc(crtc)->pipe;
        dev_priv->drrs.busy_frontbuffer_bits &= ~frontbuffer_bits;
 
-       cancel_delayed_work_sync(&dev_priv->drrs.work);
-
        if (dev_priv->drrs.refresh_rate_type != DRRS_LOW_RR &&
                        !dev_priv->drrs.busy_frontbuffer_bits)
                schedule_delayed_work(&dev_priv->drrs.work,
--

1.7.9.5

_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx

Signature · 2 lines
Rodrigo Vivi
Blog: http://blog.vivi.eng.br
Signature · 7 lines
Daniel Vetter
Software Engineer, Intel Corporation
+41 (0) 79 365 57 48 - http://blog.ffwll.ch
_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx