Skip to contentSkip to conversation

eDP DRRS based on frontbuffer tracking

PATCH In review Vandana Kannan 6 participants 54 messages Jan 9, 2015 – Feb 11, 2015

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

v3 cover eDP DRRS based on frontbuffer tracking

This patch series inserts DRRS into frontbuffer tracking mechanism.

1. Previous submission for this feature was designed considering only eDP DRRS. In this series, apart from following fb tracking, changes have been made to make structures generic so that it can be of use to any other code addition to support DRRS with other display types.
2. DRRS support is checked based on VBT setting and panel's capability (if more than one RR is supported).
3. Based on DRRS support availability, related structures are initialized or cleaned up through calls from enable/disable DDI respectively.
4. Since flip() indicates busyness, changes have been made to invalidate DRRS during flip. This changes RR back to preferred mode RR. New work to set low RR is scheduled after a delay of 1 second.
5. This series includes patches to support RR switching on all platforms.

v2: As discussed with Daniel, discarding the patch which added a module param to specify the delay before entering DRRS. This delay has been fixed to 1 second.
The call to invalidate DRRS from page_flip still remains - will be changed (or kept as is) depending on the behavior on Android.. Right now testing is done using vbltest in libdrm.. But i-g-t for DRRS is WIP.

v3: Removed the call to invalidate DRRS from page flip. If DRRS transitions dont work on Android, then check by adding back this call. Added documentation patch and a debugfs entry to know DRRS status (this would be used in i-g-t). Added an RFC patch for i-g-t.

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

Vandana Kannan (9):
drm/i915: Modifying structures related to DRRS
drm/i915: Initialize DRRS delayed work
drm/i915: Enable/disable DRRS
drm/i915: DRRS calls based on frontbuffer
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
kms_drrs: Test DRRS entry and exit

 Documentation/DocBook/drm.tmpl           |  11 ++
 drivers/gpu/drm/i915/i915_debugfs.c      |  18 ++
 drivers/gpu/drm/i915/i915_drv.h          |  32 +++-
 drivers/gpu/drm/i915/i915_reg.h          |   1 +
 drivers/gpu/drm/i915/intel_ddi.c         |   2 +
 drivers/gpu/drm/i915/intel_display.c     |  13 +-
 drivers/gpu/drm/i915/intel_dp.c          | 303 +++++++++++++++++++++++++++----
 drivers/gpu/drm/i915/intel_drv.h         |  26 +--
 drivers/gpu/drm/i915/intel_frontbuffer.c |   2 +
 9 files changed, 340 insertions(+), 68 deletions(-)
Signature · 6 lines
2.0.1

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

PATCH v3 1/10 drm/i915: Modifying structures related to DRRS

Earlier, DRRS structures were specific to eDP (used only in intel_dp). Since DRRS can be extended to other internal display types
(if the panel supports multiple RR), modifying structures
to be part of drm_i915_private and have a provision to add display related structs like intel_dp.
Also, aligning with frontbuffer tracking mechanism, the new structure contains data for busy frontbuffer bits.

---
 drivers/gpu/drm/i915/i915_drv.h  | 32 ++++++++++++++++++-------
 drivers/gpu/drm/i915/intel_dp.c  | 50 ++++++++++++++++++----------------------
 drivers/gpu/drm/i915/intel_drv.h | 18 ---------------
 3 files changed, 47 insertions(+), 53 deletions(-)
drivers/gpu/drm/i915/i915_drv.h +24 -8
index 8f771af..ed368ca 100644
@@ -771,11 +771,33 @@ struct i915_fbc {
 	} no_fbc_reason;
 };
 
-struct i915_drrs {
-	struct intel_connector *connector;
+/**
+ * HIGH_RR is the highest eDP panel refresh rate read from EDID
+ * LOW_RR is the lowest eDP panel refresh rate found from EDID
+ * parsing for same resolution.
+ */
+enum drrs_refresh_rate_type {
+	DRRS_HIGH_RR,
+	DRRS_LOW_RR,
+	DRRS_MAX_RR, /* RR count */
+};
+
+enum drrs_support_type {
+	DRRS_NOT_SUPPORTED = 0,
+	STATIC_DRRS_SUPPORT = 1,
+	SEAMLESS_DRRS_SUPPORT = 2
 };
 
 struct intel_dp;
+struct i915_drrs {
+	struct mutex mutex;
+	struct delayed_work work;
+	struct intel_dp *dp;
+	unsigned busy_frontbuffer_bits;
+	enum drrs_refresh_rate_type refresh_rate_type;
+	enum drrs_support_type type;
+};
+
 struct i915_psr {
 	struct mutex lock;
 	bool sink_support;
@@ -1354,12 +1376,6 @@ struct ddi_vbt_port_info {
 	uint8_t supports_dp:1;
 };
 
-enum drrs_support_type {
-	DRRS_NOT_SUPPORTED = 0,
-	STATIC_DRRS_SUPPORT = 1,
-	SEAMLESS_DRRS_SUPPORT = 2
-};
-
 enum psr_lines_to_wait {
 	PSR_0_LINES_TO_WAIT = 0,
 	PSR_1_LINE_TO_WAIT,
drivers/gpu/drm/i915/intel_dp.c +23 -27

127 lines not on this page · raw message

drivers/gpu/drm/i915/intel_drv.h +0 -18
index bb871f3..2ba045d 100644
@@ -566,17 +566,6 @@ struct intel_hdmi {
 struct intel_dp_mst_encoder;
 #define DP_MAX_DOWNSTREAM_PORTS		0x10
 
-/**
- * HIGH_RR is the highest eDP panel refresh rate read from EDID
- * LOW_RR is the lowest eDP panel refresh rate found from EDID
- * parsing for same resolution.
- */
-enum edp_drrs_refresh_rate_type {
-	DRRS_HIGH_RR,
-	DRRS_LOW_RR,
-	DRRS_MAX_RR, /* RR count */
-};
-
 struct intel_dp {
 	uint32_t output_reg;
 	uint32_t aux_ch_ctl_reg;
@@ -632,12 +621,6 @@ struct intel_dp {
 				     bool has_aux_irq,
 				     int send_bytes,
 				     uint32_t aux_clock_divider);
-	struct {
-		enum drrs_support_type type;
-		enum edp_drrs_refresh_rate_type refresh_rate_type;
-		struct mutex mutex;
-	} drrs_state;
-
 };
 
 struct intel_digital_port {
@@ -1006,7 +989,6 @@ void intel_edp_backlight_off(struct intel_dp *intel_dp);
 void intel_edp_panel_vdd_on(struct intel_dp *intel_dp);
 void intel_edp_panel_on(struct intel_dp *intel_dp);
 void intel_edp_panel_off(struct intel_dp *intel_dp);
-void intel_dp_set_drrs_state(struct drm_device *dev, int refresh_rate);
 void intel_dp_add_properties(struct intel_dp *intel_dp, struct drm_connector *connector);
 void intel_dp_mst_suspend(struct drm_device *dev);
 void intel_dp_mst_resume(struct drm_device *dev);
Signature · 6 lines
2.0.1

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

Re: [PATCH 1/10] drm/i915: Modifying structures related to DRRS

I believe we could start this re-org by moving it out to intel_drrs.c renaming functions and adding entry docbook entry.

But anyway this patch is right and doesn't seem to change anything that is already working so free free to use:

I'll continue the reviews tomorrow and intend to finish by Thursday. I'll also resend 2 patches that had conflicts with latest -nightly...

Quoted 257 lines · Vandana Kannan

Earlier, DRRS structures were specific to eDP (used only in intel_dp). Since DRRS can be extended to other internal display types
(if the panel supports multiple RR), modifying structures
to be part of drm_i915_private and have a provision to add display related structs like intel_dp.
Also, aligning with frontbuffer tracking mechanism, the new structure contains data for busy frontbuffer bits.

---
 drivers/gpu/drm/i915/i915_drv.h  | 32 ++++++++++++++++++-------
 drivers/gpu/drm/i915/intel_dp.c  | 50 ++++++++++++++++++----------------------
 drivers/gpu/drm/i915/intel_drv.h | 18 ---------------
 3 files changed, 47 insertions(+), 53 deletions(-)
drivers/gpu/drm/i915/i915_drv.h +24 -8
index 8f771af..ed368ca 100644
@@ -771,11 +771,33 @@ struct i915_fbc {
        } no_fbc_reason;
 };
 
-struct i915_drrs {
-       struct intel_connector *connector;
+/**
+ * HIGH_RR is the highest eDP panel refresh rate read from EDID
+ * LOW_RR is the lowest eDP panel refresh rate found from EDID
+ * parsing for same resolution.
+ */
+enum drrs_refresh_rate_type {
+       DRRS_HIGH_RR,
+       DRRS_LOW_RR,
+       DRRS_MAX_RR, /* RR count */
+};
+
+enum drrs_support_type {
+       DRRS_NOT_SUPPORTED = 0,
+       STATIC_DRRS_SUPPORT = 1,
+       SEAMLESS_DRRS_SUPPORT = 2
 };
 
 struct intel_dp;
+struct i915_drrs {
+       struct mutex mutex;
+       struct delayed_work work;
+       struct intel_dp *dp;
+       unsigned busy_frontbuffer_bits;
+       enum drrs_refresh_rate_type refresh_rate_type;
+       enum drrs_support_type type;
+};
+
 struct i915_psr {
        struct mutex lock;
        bool sink_support;
@@ -1354,12 +1376,6 @@ struct ddi_vbt_port_info {
        uint8_t supports_dp:1;
 };
 
-enum drrs_support_type {
-       DRRS_NOT_SUPPORTED = 0,
-       STATIC_DRRS_SUPPORT = 1,
-       SEAMLESS_DRRS_SUPPORT = 2
-};
-
 enum psr_lines_to_wait {
        PSR_0_LINES_TO_WAIT = 0,
        PSR_1_LINE_TO_WAIT,
drivers/gpu/drm/i915/intel_dp.c +23 -27
index 88d81a8..778dcd0 100644
@@ -1269,7 +1269,7 @@ found:
                               &pipe_config->dp_m_n);
 
        if (intel_connector->panel.downclock_mode != NULL &&
-               intel_dp->drrs_state.type == SEAMLESS_DRRS_SUPPORT) {
+               dev_priv->drrs.type == SEAMLESS_DRRS_SUPPORT) {
                        pipe_config->has_drrs = true;
                        intel_link_compute_m_n(bpp, lane_count,
                                intel_connector->panel.downclock_mode->clock,
@@ -4745,24 +4745,24 @@ intel_dp_init_panel_power_sequencer_registers(struct drm_device *dev,
                      I915_READ(pp_div_reg));
 }
 
-void intel_dp_set_drrs_state(struct drm_device *dev, int refresh_rate)
+static void intel_dp_set_drrs_state(struct drm_device *dev, int refresh_rate)
 {
        struct drm_i915_private *dev_priv = dev->dev_private;
        struct intel_encoder *encoder;
-       struct intel_dp *intel_dp = NULL;
+       struct intel_digital_port *dig_port = NULL;
+       struct intel_dp *intel_dp = dev_priv->drrs.dp;
        struct intel_crtc_config *config = NULL;
        struct intel_crtc *intel_crtc = NULL;
-       struct intel_connector *intel_connector = dev_priv->drrs.connector;
        u32 reg, val;
-       enum edp_drrs_refresh_rate_type index = DRRS_HIGH_RR;
+       enum drrs_refresh_rate_type index = DRRS_HIGH_RR;
 
        if (refresh_rate <= 0) {
                DRM_DEBUG_KMS("Refresh rate should be positive non-zero.\n");
                return;
        }
 
-       if (intel_connector == NULL) {
-               DRM_DEBUG_KMS("DRRS supported for eDP only.\n");
+       if (intel_dp == NULL) {
+               DRM_DEBUG_KMS("DRRS not supported.\n");
                return;
        }
 
@@ -4771,8 +4771,8 @@ void intel_dp_set_drrs_state(struct drm_device *dev, int refresh_rate)
         * platforms that cannot have PSR and DRRS enabled at the same time.
         */
 
-       encoder = intel_attached_encoder(&intel_connector->base);
-       intel_dp = enc_to_intel_dp(&encoder->base);
+       dig_port = dp_to_dig_port(intel_dp);
+       encoder = &dig_port->base;
        intel_crtc = encoder->new_crtc;
 
        if (!intel_crtc) {
@@ -4782,15 +4782,16 @@ void intel_dp_set_drrs_state(struct drm_device *dev, int refresh_rate)
 
        config = &intel_crtc->config;
 
-       if (intel_dp->drrs_state.type < SEAMLESS_DRRS_SUPPORT) {
+       if (dev_priv->drrs.type < SEAMLESS_DRRS_SUPPORT) {
                DRM_DEBUG_KMS("Only Seamless DRRS supported.\n");
                return;
        }
 
-       if (intel_connector->panel.downclock_mode->vrefresh == refresh_rate)
+       if (intel_dp->attached_connector->panel.downclock_mode->vrefresh ==
+                       refresh_rate)
                index = DRRS_LOW_RR;
 
-       if (index == intel_dp->drrs_state.refresh_rate_type) {
+       if (index == dev_priv->drrs.refresh_rate_type) {
                DRM_DEBUG_KMS(
                        "DRRS requested for previously set RR...ignoring\n");
                return;
@@ -4820,23 +4821,21 @@ void intel_dp_set_drrs_state(struct drm_device *dev, int refresh_rate)
         * possible calls from user space to set differnt RR are made.
         */
 
-       mutex_lock(&intel_dp->drrs_state.mutex);
+       mutex_lock(&dev_priv->drrs.mutex);
 
-       intel_dp->drrs_state.refresh_rate_type = index;
+       dev_priv->drrs.refresh_rate_type = index;
 
-       mutex_unlock(&intel_dp->drrs_state.mutex);
+       mutex_unlock(&dev_priv->drrs.mutex);
 
        DRM_DEBUG_KMS("eDP Refresh Rate set to : %dHz\n", refresh_rate);
 }
 
 static struct drm_display_mode *
-intel_dp_drrs_init(struct intel_digital_port *intel_dig_port,
-                       struct intel_connector *intel_connector,
-                       struct drm_display_mode *fixed_mode)
+intel_dp_drrs_init(struct intel_connector *intel_connector,
+               struct drm_display_mode *fixed_mode)
 {
        struct drm_connector *connector = &intel_connector->base;
-       struct intel_dp *intel_dp = &intel_dig_port->dp;
-       struct drm_device *dev = intel_dig_port->base.base.dev;
+       struct drm_device *dev = connector->dev;
        struct drm_i915_private *dev_priv = dev->dev_private;
        struct drm_display_mode *downclock_mode = NULL;
 
@@ -4858,13 +4857,11 @@ intel_dp_drrs_init(struct intel_digital_port *intel_dig_port,
                return NULL;
        }
 
-       dev_priv->drrs.connector = intel_connector;
-
-       mutex_init(&intel_dp->drrs_state.mutex);
+       mutex_init(&dev_priv->drrs.mutex);
 
-       intel_dp->drrs_state.type = dev_priv->vbt.drrs_type;
+       dev_priv->drrs.type = dev_priv->vbt.drrs_type;
 
-       intel_dp->drrs_state.refresh_rate_type = DRRS_HIGH_RR;
+       dev_priv->drrs.refresh_rate_type = DRRS_HIGH_RR;
        DRM_DEBUG_KMS("seamless DRRS supported for eDP panel.\n");
        return downclock_mode;
 }
@@ -4884,7 +4881,7 @@ static bool intel_edp_init_connector(struct intel_dp *intel_dp,
        struct edid *edid;
        enum pipe pipe = INVALID_PIPE;
 
-       intel_dp->drrs_state.type = DRRS_NOT_SUPPORTED;
+       dev_priv->drrs.type = DRRS_NOT_SUPPORTED;
 
        if (!is_edp(intel_dp))
                return true;
@@ -4933,7 +4930,6 @@ static bool intel_edp_init_connector(struct intel_dp *intel_dp,
                if ((scan->type & DRM_MODE_TYPE_PREFERRED)) {
                        fixed_mode = drm_mode_duplicate(dev, scan);
                        downclock_mode = intel_dp_drrs_init(
-                                               intel_dig_port,
                                                intel_connector, fixed_mode);
                        break;
                }
drivers/gpu/drm/i915/intel_drv.h +0 -19
index bb871f3..2ba045d 100644
@@ -566,17 +566,6 @@ struct intel_hdmi {
 struct intel_dp_mst_encoder;
 #define DP_MAX_DOWNSTREAM_PORTS                0x10
 
-/**
- * HIGH_RR is the highest eDP panel refresh rate read from EDID
- * LOW_RR is the lowest eDP panel refresh rate found from EDID
- * parsing for same resolution.
- */
-enum edp_drrs_refresh_rate_type {
-       DRRS_HIGH_RR,
-       DRRS_LOW_RR,
-       DRRS_MAX_RR, /* RR count */
-};
-
 struct intel_dp {
        uint32_t output_reg;
        uint32_t aux_ch_ctl_reg;
@@ -632,12 +621,6 @@ struct intel_dp {
                                     bool has_aux_irq,
                                     int send_bytes,
                                     uint32_t aux_clock_divider);
-       struct {
-               enum drrs_support_type type;
-               enum edp_drrs_refresh_rate_type refresh_rate_type;
-               struct mutex mutex;
-       } drrs_state;
-
 };
 
 struct intel_digital_port {
@@ -1006,7 +989,6 @@ void intel_edp_backlight_off(struct intel_dp *intel_dp);
 void intel_edp_panel_vdd_on(struct intel_dp *intel_dp);
 void intel_edp_panel_on(struct intel_dp *intel_dp);
 void intel_edp_panel_off(struct intel_dp *intel_dp);
-void intel_dp_set_drrs_state(struct drm_device *dev, int refresh_rate);
 void intel_dp_add_properties(struct intel_dp *intel_dp, struct drm_connector *connector);
 void intel_dp_mst_suspend(struct drm_device *dev);
 void intel_dp_mst_resume(struct drm_device *dev);
--

2.0.1

_______________________________________________
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
#3 lore raw

Re: [PATCH 1/10] drm/i915: Modifying structures related to DRRS

Quoted 10 lines · Rodrigo Vivi

I believe we could start this re-org by moving it out to intel_drrs.c renaming functions and adding entry docbook entry.

But anyway this patch is right and doesn't seem to change anything that is already working so free free to use:

I'll continue the reviews tomorrow and intend to finish by Thursday. I'll also resend 2 patches that had conflicts with latest -nightly...

I merged this, but it causes a compiler warning. Which means I need the revised patches to get this all into shape asap or need to drop the patch again.
-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
#4 lore raw

Re: [PATCH 1/10] drm/i915: Modifying structures related to DRRS

Quoted 7 lines · Daniel Vetter
Quoted 6 lines · Rodrigo Vivi

I believe we could start this re-org by moving it out to intel_drrs.c renaming functions and adding entry docbook entry.

But anyway this patch is right and doesn't seem to change anything that is already working so free free to use:

Quoted 7 lines
Quoted 4 lines

I'll continue the reviews tomorrow and intend to finish by Thursday. I'll also resend 2 patches that had conflicts with latest -nightly...

I merged this, but it causes a compiler warning. Which means I need the revised patches to get this all into shape asap or need to drop the patch again.

I have just shared a new patches for the changes suggested except for igt and related debugfs entry patches [ 9 and 10]. Working on the required changes for igt and the debugfs interface. But I hope the changes required for igt need not stop other patches [1 to 8 of 10 patches].

Quoted 1 line

-Daniel

--Ram

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

#5 lore raw

PATCH v3 2/10 drm/i915: Initialize DRRS delayed work

In reply to Vandana Kannan

Add DRRS work function to trigger a switch to low refresh rate when activity is detected on screen.

---
 drivers/gpu/drm/i915/intel_dp.c | 36 ++++++++++++++++++++++++++++--------
 1 file changed, 28 insertions(+), 8 deletions(-)
drivers/gpu/drm/i915/intel_dp.c +28 -8
index 778dcd0..30b3aa1 100644
@@ -4814,20 +4814,38 @@ static void intel_dp_set_drrs_state(struct drm_device *dev, int refresh_rate)
 		I915_WRITE(reg, val);
 	}
 
+	dev_priv->drrs.refresh_rate_type = index;
+
+	DRM_DEBUG_KMS("eDP Refresh Rate set to : %dHz\n", refresh_rate);
+}
+
+static void intel_edp_drrs_work(struct work_struct *work)
+{
+	struct drm_i915_private *dev_priv =
+		container_of(work, typeof(*dev_priv), drrs.work.work);
+	struct intel_dp *intel_dp = dev_priv->drrs.dp;
+
+	mutex_lock(&dev_priv->drrs.mutex);
+
+	if (!intel_dp)
+		goto unlock;
+
 	/*
-	 * mutex taken to ensure that there is no race between differnt
-	 * drrs calls trying to update refresh rate. This scenario may occur
-	 * in future when idleness detection based DRRS in kernel and
-	 * possible calls from user space to set differnt RR are made.
+	 * The delayed work can race with an invalidate hence we need to
+	 * recheck.
 	 */
 
-	mutex_lock(&dev_priv->drrs.mutex);
+	if (dev_priv->drrs.busy_frontbuffer_bits)
+		goto unlock;
 
-	dev_priv->drrs.refresh_rate_type = index;
+	if (dev_priv->drrs.refresh_rate_type != DRRS_LOW_RR)
+		intel_dp_set_drrs_state(dev_priv->dev,
+			intel_dp->attached_connector->panel.
+			downclock_mode->vrefresh);
 
-	mutex_unlock(&dev_priv->drrs.mutex);
+unlock:
 
-	DRM_DEBUG_KMS("eDP Refresh Rate set to : %dHz\n", refresh_rate);
+	mutex_unlock(&dev_priv->drrs.mutex);
 }
 
 static struct drm_display_mode *
@@ -4857,6 +4875,8 @@ intel_dp_drrs_init(struct intel_connector *intel_connector,
 		return NULL;
 	}
 
+	INIT_DELAYED_WORK(&dev_priv->drrs.work, intel_edp_drrs_work);
+
 	mutex_init(&dev_priv->drrs.mutex);
 
 	dev_priv->drrs.type = dev_priv->vbt.drrs_type;
Signature · 6 lines
2.0.1

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

Re: [PATCH 2/10] drm/i915: Initialize DRRS delayed work

Quoted 2 lines · Vandana Kannan

Add DRRS work function to trigger a switch to low refresh rate when activity is detected on screen.

Where is this function used? How can I judge that it does the right thing?

Quoted 10 lines
---
 drivers/gpu/drm/i915/intel_dp.c | 36 ++++++++++++++++++++++++++++--------
 1 file changed, 28 insertions(+), 8 deletions(-)
drivers/gpu/drm/i915/intel_dp.c +0 -0
index 778dcd0..30b3aa1 100644

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

Quoted 9 lines
drivers/gpu/drm/i915/intel_dp.c +6 -0
@@ -4814,20 +4814,38 @@ static void intel_dp_set_drrs_state(struct drm_device *dev, int refresh_rate)
 		I915_WRITE(reg, val);
 	}
 
+	dev_priv->drrs.refresh_rate_type = index;
+
+	DRM_DEBUG_KMS("eDP Refresh Rate set to : %dHz\n", refresh_rate);
+}
+
+static void intel_edp_drrs_work(struct work_struct *work)

intel_edp_drrs_downclock_work() would be more self-descriptive

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

Quoted 9 lines
drivers/gpu/drm/i915/intel_dp.c +9 -0
+{
+	struct drm_i915_private *dev_priv =
+		container_of(work, typeof(*dev_priv), drrs.work.work);
+	struct intel_dp *intel_dp = dev_priv->drrs.dp;
+
+	mutex_lock(&dev_priv->drrs.mutex);
+
+	if (!intel_dp)
+		goto unlock;

Does dev_priv->drrs.mutex not also protect dev_priv->drrs.dp?

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

Quoted 9 lines
drivers/gpu/drm/i915/intel_dp.c +3 -4
+
 	/*
-	 * mutex taken to ensure that there is no race between differnt
-	 * drrs calls trying to update refresh rate. This scenario may occur
-	 * in future when idleness detection based DRRS in kernel and
-	 * possible calls from user space to set differnt RR are made.
+	 * The delayed work can race with an invalidate hence we need to
+	 * recheck.
 	 */

This comment no longer applies to all the other callers of intel_dp_set_drrs_state()? Or did you miss adding the lockdep_assert_held(&dev_priv->drrs.mutex)?

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

Quoted 7 lines
drivers/gpu/drm/i915/intel_dp.c +4 -2
-	mutex_lock(&dev_priv->drrs.mutex);
+	if (dev_priv->drrs.busy_frontbuffer_bits)
+		goto unlock;
 
-	dev_priv->drrs.refresh_rate_type = index;
+	if (dev_priv->drrs.refresh_rate_type != DRRS_LOW_RR)
+		intel_dp_set_drrs_state(dev_priv->dev,

Would it not be sensible for intel_dp_set_drrs_state() check for the no-op itself?

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

Quoted 2 lines
drivers/gpu/drm/i915/intel_dp.c +2 -0
+			intel_dp->attached_connector->panel.
+			downclock_mode->vrefresh);

-Chris

Signature · 5 lines
Chris Wilson, Intel Open Source Technology Centre
_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
#7 lore raw

Re: [PATCH 2/10] drm/i915: Initialize DRRS delayed work

Hi chris

Quoted 5 lines · Chris Wilson
Quoted 2 lines · Vandana Kannan

Add DRRS work function to trigger a switch to low refresh rate when activity is detected on screen.

Where is this function used? How can I judge that it does the right thing?

Thanks for catching this. There is an error in the commit message. This DRRS work function will trigger a switch to low refresh rate, when there is no activity on the screen for more than 1 sec. And this function is set as a deferred work from intel_edp_drrs_flush().
Functionality of this function can be verified from the debug logs in dmesg (lower refresh rate set will be printed out). Addition to that I am working to enable a debugfs to share the refreshrate switch info also for the debugging/testing purpose.

Quoted 14 lines
Quoted 14 lines
---
  drivers/gpu/drm/i915/intel_dp.c | 36 ++++++++++++++++++++++++++++--------
  1 file changed, 28 insertions(+), 8 deletions(-)
drivers/gpu/drm/i915/intel_dp.c +0 -0
index 778dcd0..30b3aa1 100644
@@ -4814,20 +4814,38 @@ static void intel_dp_set_drrs_state(struct drm_device *dev, int refresh_rate)
  		I915_WRITE(reg, val);
  	}
 
Quoted 7 lines

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

Quoted 6 lines
drivers/gpu/drm/i915/intel_dp.c +6 -0
+	dev_priv->drrs.refresh_rate_type = index;
+
+	DRM_DEBUG_KMS("eDP Refresh Rate set to : %dHz\n", refresh_rate);
+}
+
+static void intel_edp_drrs_work(struct work_struct *work)

intel_edp_drrs_downclock_work() would be more self-descriptive

Agreed. I will rename it in next iteration

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 4831

Quoted 10 lines
drivers/gpu/drm/i915/intel_dp.c +9 -0
+{
+	struct drm_i915_private *dev_priv =
+		container_of(work, typeof(*dev_priv), drrs.work.work);
+	struct intel_dp *intel_dp = dev_priv->drrs.dp;
+
+	mutex_lock(&dev_priv->drrs.mutex);
+
+	if (!intel_dp)
+		goto unlock;

Does dev_priv->drrs.mutex not also protect dev_priv->drrs.dp?

It should have protected. Will cover drrs.dp with drrs.mutex in next patch

Quoted 4 lines
Quoted 4 lines
drivers/gpu/drm/i915/intel_dp.c +1 -2
+
  	/*
-	 * mutex taken to ensure that there is no race between differnt
-	 * drrs calls trying to update refresh rate. This scenario may occur
Quoted 8 lines

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

Quoted 5 lines
drivers/gpu/drm/i915/intel_dp.c +2 -2
-	 * in future when idleness detection based DRRS in kernel and
-	 * possible calls from user space to set differnt RR are made.
+	 * The delayed work can race with an invalidate hence we need to
+	 * recheck.
  	 */

This comment no longer applies to all the other callers of intel_dp_set_drrs_state()? Or did you miss adding the lockdep_assert_held(&dev_priv->drrs.mutex)?

This comment was added considering the requests from userspace for new refreshrates. But a part of MIPI DRRS and media playback DRRS implementation (currently in development), I am addressing the possible race condition. So at this point in time this comment is irrelevant, hence vandana removed it.

Quoted 10 lines

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

Quoted 8 lines
drivers/gpu/drm/i915/intel_dp.c +4 -2
-	mutex_lock(&dev_priv->drrs.mutex);
+	if (dev_priv->drrs.busy_frontbuffer_bits)
+		goto unlock;
 
-	dev_priv->drrs.refresh_rate_type = index;
+	if (dev_priv->drrs.refresh_rate_type != DRRS_LOW_RR)
+		intel_dp_set_drrs_state(dev_priv->dev,

Would it not be sensible for intel_dp_set_drrs_state() check for the no-op itself?

If refresh_rate_type is already LOW_RR then we should exit the work function with no call to intel_dp_set_drrs_state(). Thats the reason the call is kept under the if condition. intel_dp_set_drrs_state() already handles if the requested vrefresh is same as the vrefresh of the current refresh_rate type.

Quoted 5 lines

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

Quoted 3 lines
drivers/gpu/drm/i915/intel_dp.c +2 -0
+			intel_dp->attached_connector->panel.
+			downclock_mode->vrefresh);

-Chris

-Ram

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

#8 lore raw

PATCH 1/1 drm/i915: Initialize DRRS delayed work

From: Vandana Kannan <[email protected]>

Add DRRS work function to trigger a switch to low refresh rate, when no activity is detected on screen till 1 sec duration.

v2: [By Ram]: drrs.dp also protected with drrs.mutex and worker function is renamed to intel_edp_drrs_downclock_work [Rodrigo]

---
 drivers/gpu/drm/i915/intel_dp.c |   38 ++++++++++++++++++++++++++++++--------
 1 file changed, 30 insertions(+), 8 deletions(-)
drivers/gpu/drm/i915/intel_dp.c +30 -8
index b38d737..c066560 100644
@@ -4815,20 +4815,40 @@ static void intel_dp_set_drrs_state(struct drm_device *dev, int refresh_rate)
 		I915_WRITE(reg, val);
 	}
 
+	dev_priv->drrs.refresh_rate_type = index;
+
+	DRM_DEBUG_KMS("eDP Refresh Rate set to : %dHz\n", refresh_rate);
+}
+
+static void intel_edp_drrs_downclock_work(struct work_struct *work)
+{
+	struct drm_i915_private *dev_priv =
+		container_of(work, typeof(*dev_priv), drrs.work.work);
+	struct intel_dp *intel_dp;
+
+	mutex_lock(&dev_priv->drrs.mutex);
+
+	intel_dp = dev_priv->drrs.dp;
+
+	if (!intel_dp)
+		goto unlock;
+
 	/*
-	 * mutex taken to ensure that there is no race between differnt
-	 * drrs calls trying to update refresh rate. This scenario may occur
-	 * in future when idleness detection based DRRS in kernel and
-	 * possible calls from user space to set differnt RR are made.
+	 * The delayed work can race with an invalidate hence we need to
+	 * recheck.
 	 */
 
-	mutex_lock(&dev_priv->drrs.mutex);
+	if (dev_priv->drrs.busy_frontbuffer_bits)
+		goto unlock;
 
-	dev_priv->drrs.refresh_rate_type = index;
+	if (dev_priv->drrs.refresh_rate_type != DRRS_LOW_RR)
+		intel_dp_set_drrs_state(dev_priv->dev,
+			intel_dp->attached_connector->panel.
+			downclock_mode->vrefresh);
 
-	mutex_unlock(&dev_priv->drrs.mutex);
+unlock:
 
-	DRM_DEBUG_KMS("eDP Refresh Rate set to : %dHz\n", refresh_rate);
+	mutex_unlock(&dev_priv->drrs.mutex);
 }
 
 static struct drm_display_mode *
@@ -4858,6 +4878,8 @@ intel_dp_drrs_init(struct intel_connector *intel_connector,
 		return NULL;
 	}
 
+	INIT_DELAYED_WORK(&dev_priv->drrs.work, intel_edp_drrs_downclock_work);
+
 	mutex_init(&dev_priv->drrs.mutex);
 
 	dev_priv->drrs.type = dev_priv->vbt.drrs_type;
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
#9 lore raw

Re: [PATCH] drm/i915: Initialize DRRS delayed work

Quoted 7 lines · Ramalingam C

From: Vandana Kannan <[email protected]>

Add DRRS work function to trigger a switch to low refresh rate, when no activity is detected on screen till 1 sec duration.

v2: [By Ram]: drrs.dp also protected with drrs.mutex and worker function is renamed to intel_edp_drrs_downclock_work [Rodrigo]

Actually comments accepted on v2 came from Chris, not from me.

Quoted 72 lines
---
 drivers/gpu/drm/i915/intel_dp.c |   38 ++++++++++++++++++++++++++++++--------
 1 file changed, 30 insertions(+), 8 deletions(-)
drivers/gpu/drm/i915/intel_dp.c +30 -9
index b38d737..c066560 100644
@@ -4815,20 +4815,40 @@ static void intel_dp_set_drrs_state(struct drm_device *dev, int refresh_rate)
                I915_WRITE(reg, val);
        }
 
+       dev_priv->drrs.refresh_rate_type = index;
+
+       DRM_DEBUG_KMS("eDP Refresh Rate set to : %dHz\n", refresh_rate);
+}
+
+static void intel_edp_drrs_downclock_work(struct work_struct *work)
+{
+       struct drm_i915_private *dev_priv =
+               container_of(work, typeof(*dev_priv), drrs.work.work);
+       struct intel_dp *intel_dp;
+
+       mutex_lock(&dev_priv->drrs.mutex);
+
+       intel_dp = dev_priv->drrs.dp;
+
+       if (!intel_dp)
+               goto unlock;
+
        /*
-        * mutex taken to ensure that there is no race between differnt
-        * drrs calls trying to update refresh rate. This scenario may occur
-        * in future when idleness detection based DRRS in kernel and
-        * possible calls from user space to set differnt RR are made.
+        * The delayed work can race with an invalidate hence we need to
+        * recheck.
         */
 
-       mutex_lock(&dev_priv->drrs.mutex);
+       if (dev_priv->drrs.busy_frontbuffer_bits)
+               goto unlock;
 
-       dev_priv->drrs.refresh_rate_type = index;
+       if (dev_priv->drrs.refresh_rate_type != DRRS_LOW_RR)
+               intel_dp_set_drrs_state(dev_priv->dev,
+                       intel_dp->attached_connector->panel.
+                       downclock_mode->vrefresh);
 
-       mutex_unlock(&dev_priv->drrs.mutex);
+unlock:
 
-       DRM_DEBUG_KMS("eDP Refresh Rate set to : %dHz\n", refresh_rate);
+       mutex_unlock(&dev_priv->drrs.mutex);
 }
 
 static struct drm_display_mode *
@@ -4858,6 +4878,8 @@ intel_dp_drrs_init(struct intel_connector *intel_connector,
                return NULL;
        }
 
+       INIT_DELAYED_WORK(&dev_priv->drrs.work, intel_edp_drrs_downclock_work);
+
        mutex_init(&dev_priv->drrs.mutex);
 
        dev_priv->drrs.type = dev_priv->vbt.drrs_type;
--

1.7.9.5

Quoted 4 lines

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

Anyway seems ok to me now:

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 v3 3/10 drm/i915: Enable/disable DRRS

In reply to Vandana Kannan

Calling enable/disable DRRS when enable/disable DDI are called. These functions are responsible for setup of drrs data (in enable) and reset of drrs (in disable).
has_drrs is true when downclock_mode is found and SEAMLESS_DRRS is set in the VBT. A check has been added for has_drrs in these functions, to make sure the functions go through only if DRRS will work on the platform with the attached panel.

---
 drivers/gpu/drm/i915/intel_ddi.c |  2 ++
 drivers/gpu/drm/i915/intel_dp.c  | 54 ++++++++++++++++++++++++++++++++++++++++
 drivers/gpu/drm/i915/intel_drv.h |  2 ++
 3 files changed, 58 insertions(+)
drivers/gpu/drm/i915/intel_ddi.c +2 -0
index 1c92ad4..c704434 100644
@@ -1605,6 +1605,7 @@ static void intel_enable_ddi(struct intel_encoder *intel_encoder)
 
 		intel_edp_backlight_on(intel_dp);
 		intel_psr_enable(intel_dp);
+		intel_edp_drrs_enable(intel_dp);
 	}
 
 	if (intel_crtc->config.has_audio) {
@@ -1630,6 +1631,7 @@ static void intel_disable_ddi(struct intel_encoder *intel_encoder)
 	if (type == INTEL_OUTPUT_EDP) {
 		struct intel_dp *intel_dp = enc_to_intel_dp(encoder);
 
+		intel_edp_drrs_disable(intel_dp);
 		intel_psr_disable(intel_dp);
 		intel_edp_backlight_off(intel_dp);
 	}
drivers/gpu/drm/i915/intel_dp.c +54 -0

60 lines not on this page · raw message

drivers/gpu/drm/i915/intel_drv.h +2 -0
index 2ba045d..6f3ad3b 100644
@@ -1003,6 +1003,8 @@ int intel_update_plane(struct drm_plane *plane, struct drm_crtc *crtc,
 		       uint32_t src_x, uint32_t src_y,
 		       uint32_t src_w, uint32_t src_h);
 int intel_disable_plane(struct drm_plane *plane);
+void intel_edp_drrs_enable(struct intel_dp *intel_dp);
+void intel_edp_drrs_disable(struct intel_dp *intel_dp);
 
 /* intel_dp_mst.c */
 int intel_dp_mst_encoder_init(struct intel_digital_port *intel_dig_port, int conn_id);
Signature · 6 lines
2.0.1

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

Re: [PATCH 3/10] drm/i915: Enable/disable DRRS

Quoted 49 lines · Vandana Kannan

Calling enable/disable DRRS when enable/disable DDI are called. These functions are responsible for setup of drrs data (in enable) and reset of drrs (in disable).
has_drrs is true when downclock_mode is found and SEAMLESS_DRRS is set in the VBT. A check has been added for has_drrs in these functions, to make sure the functions go through only if DRRS will work on the platform with the attached panel.

---
 drivers/gpu/drm/i915/intel_ddi.c |  2 ++
 drivers/gpu/drm/i915/intel_dp.c  | 54 ++++++++++++++++++++++++++++++++++++++++
 drivers/gpu/drm/i915/intel_drv.h |  2 ++
 3 files changed, 58 insertions(+)
drivers/gpu/drm/i915/intel_ddi.c +2 -0
index 1c92ad4..c704434 100644
@@ -1605,6 +1605,7 @@ static void intel_enable_ddi(struct intel_encoder *intel_encoder)
 
                intel_edp_backlight_on(intel_dp);
                intel_psr_enable(intel_dp);
+               intel_edp_drrs_enable(intel_dp);
        }
 
        if (intel_crtc->config.has_audio) {
@@ -1630,6 +1631,7 @@ static void intel_disable_ddi(struct intel_encoder *intel_encoder)
        if (type == INTEL_OUTPUT_EDP) {
                struct intel_dp *intel_dp = enc_to_intel_dp(encoder);
 
+               intel_edp_drrs_disable(intel_dp);
                intel_psr_disable(intel_dp);
                intel_edp_backlight_off(intel_dp);
        }
drivers/gpu/drm/i915/intel_dp.c +6 -0
index 30b3aa1..5e7dc7b 100644
@@ -4819,6 +4819,60 @@ static void intel_dp_set_drrs_state(struct drm_device *dev, int refresh_rate)
        DRM_DEBUG_KMS("eDP Refresh Rate set to : %dHz\n", refresh_rate);
 }
 
+void intel_edp_drrs_enable(struct intel_dp *intel_dp)
+{
+       struct drm_device *dev = intel_dp_to_dev(intel_dp);
+       struct drm_i915_private *dev_priv = dev->dev_private;
+       struct intel_digital_port *dig_port = dp_to_dig_port(intel_dp);
+       struct drm_crtc *crtc = dig_port->base.base.crtc;

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

Quoted 10 lines
drivers/gpu/drm/i915/intel_dp.c +10 -0
+       struct intel_crtc *intel_crtc = to_intel_crtc(crtc);
+
+       if (!intel_crtc->config.has_drrs) {
+               DRM_DEBUG_KMS("Panel doesn't support DRRS\n");
+               return;
+       }
+
+       mutex_lock(&dev_priv->drrs.mutex);
+       if (dev_priv->drrs.dp) {
+               DRM_DEBUG_KMS("DRRS already enabled\n");

Although I'm in favor of reducing WARNS I have to ask: should be a warn_on here?

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

Quoted 1 line
drivers/gpu/drm/i915/intel_dp.c +1 -0
+               mutex_unlock(&dev_priv->drrs.mutex);

goto unlock?

Quoted 45 lines
drivers/gpu/drm/i915/intel_dp.c +37 -0
+               return;
+       }
+
+       dev_priv->drrs.busy_frontbuffer_bits = 0;
+
+       dev_priv->drrs.dp = intel_dp;
+       mutex_unlock(&dev_priv->drrs.mutex);
+}
+
+void intel_edp_drrs_disable(struct intel_dp *intel_dp)
+{
+       struct drm_device *dev = intel_dp_to_dev(intel_dp);
+       struct drm_i915_private *dev_priv = dev->dev_private;
+       struct intel_digital_port *dig_port = dp_to_dig_port(intel_dp);
+       struct drm_crtc *crtc = dig_port->base.base.crtc;
+       struct intel_crtc *intel_crtc = to_intel_crtc(crtc);
+
+       if (!intel_crtc->config.has_drrs)
+               return;
+
+       mutex_lock(&dev_priv->drrs.mutex);
+       if (!dev_priv->drrs.dp) {
+               mutex_unlock(&dev_priv->drrs.mutex);
+               return;
+       }
+
+       if (dev_priv->drrs.refresh_rate_type == DRRS_LOW_RR)
+               intel_dp_set_drrs_state(dev_priv->dev,
+                       intel_dp->attached_connector->panel.
+                       fixed_mode->vrefresh);
+
+       dev_priv->drrs.dp = NULL;
+       mutex_unlock(&dev_priv->drrs.mutex);
+
+       cancel_delayed_work_sync(&dev_priv->drrs.work);
+}
+
 static void intel_edp_drrs_work(struct work_struct *work)
 {
        struct drm_i915_private *dev_priv =
drivers/gpu/drm/i915/intel_drv.h +0 -0
index 2ba045d..6f3ad3b 100644

drivers/gpu/drm/i915/intel_drv.h int intel_update_plane(struct drm_plane *plane, struct drm_crtc *crtc, · line 1007

Quoted 5 lines
drivers/gpu/drm/i915/intel_drv.h +2 -0
@@ -1003,6 +1003,8 @@ int intel_update_plane(struct drm_plane *plane, struct drm_crtc *crtc,
                       uint32_t src_x, uint32_t src_y,
                       uint32_t src_w, uint32_t src_h);
 int intel_disable_plane(struct drm_plane *plane);
+void intel_edp_drrs_enable(struct intel_dp *intel_dp);
+void intel_edp_drrs_disable(struct intel_dp *intel_dp);

This causes conflict on nightly. There is a rebased version at:
http://cgit.freedesktop.org/~vivijim/drm-intel/log/?h=review-drrs

Quoted 10 lines
drivers/gpu/drm/i915/intel_drv.h +0 -1
 /* intel_dp_mst.c */
 int intel_dp_mst_encoder_init(struct intel_digital_port *intel_dig_port, int conn_id);
--

2.0.1

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

with or without bikesheds in place feel free to use:

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

Re: [PATCH 3/10] drm/i915: Enable/disable DRRS

Quoted 54 lines · Rodrigo Vivi
Quoted 52 lines · Vandana Kannan

Calling enable/disable DRRS when enable/disable DDI are called. These functions are responsible for setup of drrs data (in enable) and reset of drrs (in disable).
has_drrs is true when downclock_mode is found and SEAMLESS_DRRS is set in the VBT. A check has been added for has_drrs in these functions, to make sure the functions go through only if DRRS will work on the platform with the attached panel.

---
  drivers/gpu/drm/i915/intel_ddi.c |  2 ++
  drivers/gpu/drm/i915/intel_dp.c  | 54 ++++++++++++++++++++++++++++++++++++++++
  drivers/gpu/drm/i915/intel_drv.h |  2 ++
  3 files changed, 58 insertions(+)
drivers/gpu/drm/i915/intel_ddi.c +2 -0
index 1c92ad4..c704434 100644
@@ -1605,6 +1605,7 @@ static void intel_enable_ddi(struct intel_encoder *intel_encoder)
 
                 intel_edp_backlight_on(intel_dp);
                 intel_psr_enable(intel_dp);
+               intel_edp_drrs_enable(intel_dp);
         }
 
         if (intel_crtc->config.has_audio) {
@@ -1630,6 +1631,7 @@ static void intel_disable_ddi(struct intel_encoder *intel_encoder)
         if (type == INTEL_OUTPUT_EDP) {
                 struct intel_dp *intel_dp = enc_to_intel_dp(encoder);
 
+               intel_edp_drrs_disable(intel_dp);
                 intel_psr_disable(intel_dp);
                 intel_edp_backlight_off(intel_dp);
         }
drivers/gpu/drm/i915/intel_dp.c +9 -0
index 30b3aa1..5e7dc7b 100644
@@ -4819,6 +4819,60 @@ static void intel_dp_set_drrs_state(struct drm_device *dev, int refresh_rate)
         DRM_DEBUG_KMS("eDP Refresh Rate set to : %dHz\n", refresh_rate);
  }
 
+void intel_edp_drrs_enable(struct intel_dp *intel_dp)
+{
+       struct drm_device *dev = intel_dp_to_dev(intel_dp);
+       struct drm_i915_private *dev_priv = dev->dev_private;
+       struct intel_digital_port *dig_port = dp_to_dig_port(intel_dp);
+       struct drm_crtc *crtc = dig_port->base.base.crtc;
+       struct intel_crtc *intel_crtc = to_intel_crtc(crtc);
+
+       if (!intel_crtc->config.has_drrs) {
Quoted 8 lines

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

Quoted 7 lines
drivers/gpu/drm/i915/intel_dp.c +7 -0
+               DRM_DEBUG_KMS("Panel doesn't support DRRS\n");
+               return;
+       }
+
+       mutex_lock(&dev_priv->drrs.mutex);
+       if (dev_priv->drrs.dp) {
+               DRM_DEBUG_KMS("DRRS already enabled\n");

Although I'm in favor of reducing WARNS I have to ask: should be a warn_on here?

Yes, Thats correct. we should give a warning message for repeated enable call.

Quoted 3 lines

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

Quoted 2 lines
drivers/gpu/drm/i915/intel_dp.c +1 -0
+               mutex_unlock(&dev_priv->drrs.mutex);

goto unlock?

Could avoid the repeated mutex_unlock. We will go with that.

Quoted 58 lines
Quoted 45 lines
drivers/gpu/drm/i915/intel_dp.c +37 -0
+               return;
+       }
+
+       dev_priv->drrs.busy_frontbuffer_bits = 0;
+
+       dev_priv->drrs.dp = intel_dp;
+       mutex_unlock(&dev_priv->drrs.mutex);
+}
+
+void intel_edp_drrs_disable(struct intel_dp *intel_dp)
+{
+       struct drm_device *dev = intel_dp_to_dev(intel_dp);
+       struct drm_i915_private *dev_priv = dev->dev_private;
+       struct intel_digital_port *dig_port = dp_to_dig_port(intel_dp);
+       struct drm_crtc *crtc = dig_port->base.base.crtc;
+       struct intel_crtc *intel_crtc = to_intel_crtc(crtc);
+
+       if (!intel_crtc->config.has_drrs)
+               return;
+
+       mutex_lock(&dev_priv->drrs.mutex);
+       if (!dev_priv->drrs.dp) {
+               mutex_unlock(&dev_priv->drrs.mutex);
+               return;
+       }
+
+       if (dev_priv->drrs.refresh_rate_type == DRRS_LOW_RR)
+               intel_dp_set_drrs_state(dev_priv->dev,
+                       intel_dp->attached_connector->panel.
+                       fixed_mode->vrefresh);
+
+       dev_priv->drrs.dp = NULL;
+       mutex_unlock(&dev_priv->drrs.mutex);
+
+       cancel_delayed_work_sync(&dev_priv->drrs.work);
+}
+
  static void intel_edp_drrs_work(struct work_struct *work)
  {
         struct drm_i915_private *dev_priv =
drivers/gpu/drm/i915/intel_drv.h +0 -0
index 2ba045d..6f3ad3b 100644

drivers/gpu/drm/i915/intel_drv.h int intel_update_plane(struct drm_plane *plane, struct drm_crtc *crtc, · line 1007

Quoted 5 lines
drivers/gpu/drm/i915/intel_drv.h +2 -0
@@ -1003,6 +1003,8 @@ int intel_update_plane(struct drm_plane *plane, struct drm_crtc *crtc,
                        uint32_t src_x, uint32_t src_y,
                        uint32_t src_w, uint32_t src_h);
  int intel_disable_plane(struct drm_plane *plane);
+void intel_edp_drrs_enable(struct intel_dp *intel_dp);
+void intel_edp_drrs_disable(struct intel_dp *intel_dp);

This causes conflict on nightly. There is a rebased version at:
http://cgit.freedesktop.org/~vivijim/drm-intel/log/?h=review-drrs

Quoted 5 lines
drivers/gpu/drm/i915/intel_drv.h +0 -1
  /* intel_dp_mst.c */
  int intel_dp_mst_encoder_init(struct intel_digital_port *intel_dig_port, int conn_id);
--

2.0.1

Quoted 7 lines
Quoted 4 lines

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

with or without bikesheds in place feel free to use:

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

#13 lore raw

PATCH 1/1 drm/i915: Enable/disable DRRS

From: Vandana Kannan <[email protected]>

Calling enable/disable DRRS when enable/disable DDI are called. These functions are responsible for setup of drrs data (in enable) and reset of drrs (in disable).
has_drrs is true when downclock_mode is found and SEAMLESS_DRRS is set in the VBT. A check has been added for has_drrs in these functions, to make sure the functions go through only if DRRS will work on the platform with the attached panel.

V2: [By Ram]: WARN_ON is used when intel_edp_drrs_enable() is called more than once [Rodrigo]

---
 drivers/gpu/drm/i915/intel_ddi.c |    2 ++
 drivers/gpu/drm/i915/intel_dp.c  |   55 ++++++++++++++++++++++++++++++++++++++
 drivers/gpu/drm/i915/intel_drv.h |    2 ++
 3 files changed, 59 insertions(+)
drivers/gpu/drm/i915/intel_ddi.c +2 -0
index f10ec26..ad8b73d 100644
@@ -1610,6 +1610,7 @@ static void intel_enable_ddi(struct intel_encoder *intel_encoder)
 
 		intel_edp_backlight_on(intel_dp);
 		intel_psr_enable(intel_dp);
+		intel_edp_drrs_enable(intel_dp);
 	}
 
 	if (intel_crtc->config->has_audio) {
@@ -1635,6 +1636,7 @@ static void intel_disable_ddi(struct intel_encoder *intel_encoder)
 	if (type == INTEL_OUTPUT_EDP) {
 		struct intel_dp *intel_dp = enc_to_intel_dp(encoder);
 
+		intel_edp_drrs_disable(intel_dp);
 		intel_psr_disable(intel_dp);
 		intel_edp_backlight_off(intel_dp);
 	}
drivers/gpu/drm/i915/intel_dp.c +55 -0

61 lines not on this page · raw message

drivers/gpu/drm/i915/intel_drv.h +2 -0
index e957d4d..5a14725 100644
@@ -1030,6 +1030,8 @@ int intel_update_plane(struct drm_plane *plane, struct drm_crtc *crtc,
 		       uint32_t src_w, uint32_t src_h);
 int intel_disable_plane(struct drm_plane *plane);
 void intel_plane_destroy(struct drm_plane *plane);
+void intel_edp_drrs_enable(struct intel_dp *intel_dp);
+void intel_edp_drrs_disable(struct intel_dp *intel_dp);
 
 /* intel_dp_mst.c */
 int intel_dp_mst_encoder_init(struct intel_digital_port *intel_dig_port, int conn_id);
Signature · 6 lines
1.7.9.5

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

Re: [PATCH] drm/i915: Enable/disable DRRS

re Reviewed-by: Rodrigo Vivi <[email protected]>

Quoted 128 lines · Ramalingam C

From: Vandana Kannan <[email protected]>

Calling enable/disable DRRS when enable/disable DDI are called. These functions are responsible for setup of drrs data (in enable) and reset of drrs (in disable).
has_drrs is true when downclock_mode is found and SEAMLESS_DRRS is set in the VBT. A check has been added for has_drrs in these functions, to make sure the functions go through only if DRRS will work on the platform with the attached panel.

V2: [By Ram]: WARN_ON is used when intel_edp_drrs_enable() is called more than once [Rodrigo]

---
 drivers/gpu/drm/i915/intel_ddi.c |    2 ++
 drivers/gpu/drm/i915/intel_dp.c  |   55 ++++++++++++++++++++++++++++++++++++++
 drivers/gpu/drm/i915/intel_drv.h |    2 ++
 3 files changed, 59 insertions(+)
drivers/gpu/drm/i915/intel_ddi.c +2 -0
index f10ec26..ad8b73d 100644
@@ -1610,6 +1610,7 @@ static void intel_enable_ddi(struct intel_encoder *intel_encoder)
 
                intel_edp_backlight_on(intel_dp);
                intel_psr_enable(intel_dp);
+               intel_edp_drrs_enable(intel_dp);
        }
 
        if (intel_crtc->config->has_audio) {
@@ -1635,6 +1636,7 @@ static void intel_disable_ddi(struct intel_encoder *intel_encoder)
        if (type == INTEL_OUTPUT_EDP) {
                struct intel_dp *intel_dp = enc_to_intel_dp(encoder);
 
+               intel_edp_drrs_disable(intel_dp);
                intel_psr_disable(intel_dp);
                intel_edp_backlight_off(intel_dp);
        }
drivers/gpu/drm/i915/intel_dp.c +55 -0
index c066560..f843fe0 100644
@@ -4820,6 +4820,61 @@ static void intel_dp_set_drrs_state(struct drm_device *dev, int refresh_rate)
        DRM_DEBUG_KMS("eDP Refresh Rate set to : %dHz\n", refresh_rate);
 }
 
+void intel_edp_drrs_enable(struct intel_dp *intel_dp)
+{
+       struct drm_device *dev = intel_dp_to_dev(intel_dp);
+       struct drm_i915_private *dev_priv = dev->dev_private;
+       struct intel_digital_port *dig_port = dp_to_dig_port(intel_dp);
+       struct drm_crtc *crtc = dig_port->base.base.crtc;
+       struct intel_crtc *intel_crtc = to_intel_crtc(crtc);
+
+       if (!intel_crtc->config->has_drrs) {
+               DRM_DEBUG_KMS("Panel doesn't support DRRS\n");
+               return;
+       }
+
+       mutex_lock(&dev_priv->drrs.mutex);
+       if (WARN_ON(dev_priv->drrs.dp)) {
+               DRM_ERROR("DRRS already enabled\n");
+               goto unlock;
+       }
+
+       dev_priv->drrs.busy_frontbuffer_bits = 0;
+
+       dev_priv->drrs.dp = intel_dp;
+
+unlock:
+       mutex_unlock(&dev_priv->drrs.mutex);
+}
+
+void intel_edp_drrs_disable(struct intel_dp *intel_dp)
+{
+       struct drm_device *dev = intel_dp_to_dev(intel_dp);
+       struct drm_i915_private *dev_priv = dev->dev_private;
+       struct intel_digital_port *dig_port = dp_to_dig_port(intel_dp);
+       struct drm_crtc *crtc = dig_port->base.base.crtc;
+       struct intel_crtc *intel_crtc = to_intel_crtc(crtc);
+
+       if (!intel_crtc->config->has_drrs)
+               return;
+
+       mutex_lock(&dev_priv->drrs.mutex);
+       if (!dev_priv->drrs.dp) {
+               mutex_unlock(&dev_priv->drrs.mutex);
+               return;
+       }
+
+       if (dev_priv->drrs.refresh_rate_type == DRRS_LOW_RR)
+               intel_dp_set_drrs_state(dev_priv->dev,
+                       intel_dp->attached_connector->panel.
+                       fixed_mode->vrefresh);
+
+       dev_priv->drrs.dp = NULL;
+       mutex_unlock(&dev_priv->drrs.mutex);
+
+       cancel_delayed_work_sync(&dev_priv->drrs.work);
+}
+
 static void intel_edp_drrs_downclock_work(struct work_struct *work)
 {
        struct drm_i915_private *dev_priv =
drivers/gpu/drm/i915/intel_drv.h +2 -1
index e957d4d..5a14725 100644
@@ -1030,6 +1030,8 @@ int intel_update_plane(struct drm_plane *plane, struct drm_crtc *crtc,
                       uint32_t src_w, uint32_t src_h);
 int intel_disable_plane(struct drm_plane *plane);
 void intel_plane_destroy(struct drm_plane *plane);
+void intel_edp_drrs_enable(struct intel_dp *intel_dp);
+void intel_edp_drrs_disable(struct intel_dp *intel_dp);
 
 /* intel_dp_mst.c */
 int intel_dp_mst_encoder_init(struct intel_digital_port *intel_dig_port, int conn_id);
--

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
#15 lore raw

Re: [PATCH] drm/i915: Enable/disable DRRS

In reply to Ramalingam C
Quoted 10 lines · Ramalingam C

From: Vandana Kannan <[email protected]>

Calling enable/disable DRRS when enable/disable DDI are called. These functions are responsible for setup of drrs data (in enable) and reset of drrs (in disable).
has_drrs is true when downclock_mode is found and SEAMLESS_DRRS is set in the VBT. A check has been added for has_drrs in these functions, to make sure the functions go through only if DRRS will work on the platform with the attached panel.

Quoted 5 lines

V2: [By Ram]: WARN_ON is used when intel_edp_drrs_enable() is called more than once [Rodrigo]

Please be a bit more careful with adding sob lines - afaik Rodrigo did not handle this patch. If you just want to get people's attention, please use
Cc: instead.

Fixed while applying.
-Daniel

Quoted 113 lines
---
 drivers/gpu/drm/i915/intel_ddi.c |    2 ++
 drivers/gpu/drm/i915/intel_dp.c  |   55 ++++++++++++++++++++++++++++++++++++++
 drivers/gpu/drm/i915/intel_drv.h |    2 ++
 3 files changed, 59 insertions(+)
drivers/gpu/drm/i915/intel_ddi.c +2 -0
index f10ec26..ad8b73d 100644
@@ -1610,6 +1610,7 @@ static void intel_enable_ddi(struct intel_encoder *intel_encoder)
 
 		intel_edp_backlight_on(intel_dp);
 		intel_psr_enable(intel_dp);
+		intel_edp_drrs_enable(intel_dp);
 	}
 
 	if (intel_crtc->config->has_audio) {
@@ -1635,6 +1636,7 @@ static void intel_disable_ddi(struct intel_encoder *intel_encoder)
 	if (type == INTEL_OUTPUT_EDP) {
 		struct intel_dp *intel_dp = enc_to_intel_dp(encoder);
 
+		intel_edp_drrs_disable(intel_dp);
 		intel_psr_disable(intel_dp);
 		intel_edp_backlight_off(intel_dp);
 	}
drivers/gpu/drm/i915/intel_dp.c +55 -0
index c066560..f843fe0 100644
@@ -4820,6 +4820,61 @@ static void intel_dp_set_drrs_state(struct drm_device *dev, int refresh_rate)
 	DRM_DEBUG_KMS("eDP Refresh Rate set to : %dHz\n", refresh_rate);
 }
 
+void intel_edp_drrs_enable(struct intel_dp *intel_dp)
+{
+	struct drm_device *dev = intel_dp_to_dev(intel_dp);
+	struct drm_i915_private *dev_priv = dev->dev_private;
+	struct intel_digital_port *dig_port = dp_to_dig_port(intel_dp);
+	struct drm_crtc *crtc = dig_port->base.base.crtc;
+	struct intel_crtc *intel_crtc = to_intel_crtc(crtc);
+
+	if (!intel_crtc->config->has_drrs) {
+		DRM_DEBUG_KMS("Panel doesn't support DRRS\n");
+		return;
+	}
+
+	mutex_lock(&dev_priv->drrs.mutex);
+	if (WARN_ON(dev_priv->drrs.dp)) {
+		DRM_ERROR("DRRS already enabled\n");
+		goto unlock;
+	}
+
+	dev_priv->drrs.busy_frontbuffer_bits = 0;
+
+	dev_priv->drrs.dp = intel_dp;
+
+unlock:
+	mutex_unlock(&dev_priv->drrs.mutex);
+}
+
+void intel_edp_drrs_disable(struct intel_dp *intel_dp)
+{
+	struct drm_device *dev = intel_dp_to_dev(intel_dp);
+	struct drm_i915_private *dev_priv = dev->dev_private;
+	struct intel_digital_port *dig_port = dp_to_dig_port(intel_dp);
+	struct drm_crtc *crtc = dig_port->base.base.crtc;
+	struct intel_crtc *intel_crtc = to_intel_crtc(crtc);
+
+	if (!intel_crtc->config->has_drrs)
+		return;
+
+	mutex_lock(&dev_priv->drrs.mutex);
+	if (!dev_priv->drrs.dp) {
+		mutex_unlock(&dev_priv->drrs.mutex);
+		return;
+	}
+
+	if (dev_priv->drrs.refresh_rate_type == DRRS_LOW_RR)
+		intel_dp_set_drrs_state(dev_priv->dev,
+			intel_dp->attached_connector->panel.
+			fixed_mode->vrefresh);
+
+	dev_priv->drrs.dp = NULL;
+	mutex_unlock(&dev_priv->drrs.mutex);
+
+	cancel_delayed_work_sync(&dev_priv->drrs.work);
+}
+
 static void intel_edp_drrs_downclock_work(struct work_struct *work)
 {
 	struct drm_i915_private *dev_priv =
drivers/gpu/drm/i915/intel_drv.h +2 -0
index e957d4d..5a14725 100644
@@ -1030,6 +1030,8 @@ int intel_update_plane(struct drm_plane *plane, struct drm_crtc *crtc,
 		       uint32_t src_w, uint32_t src_h);
 int intel_disable_plane(struct drm_plane *plane);
 void intel_plane_destroy(struct drm_plane *plane);
+void intel_edp_drrs_enable(struct intel_dp *intel_dp);
+void intel_edp_drrs_disable(struct intel_dp *intel_dp);
 
 /* intel_dp_mst.c */
 int intel_dp_mst_encoder_init(struct intel_digital_port *intel_dig_port, int conn_id);
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
#16 lore raw

Re: [PATCH] drm/i915: Enable/disable DRRS

Quoted 17 lines · Daniel Vetter
Quoted 10 lines · Ramalingam C

From: Vandana Kannan <[email protected]>

Calling enable/disable DRRS when enable/disable DDI are called. These functions are responsible for setup of drrs data (in enable) and reset of drrs (in disable).
has_drrs is true when downclock_mode is found and SEAMLESS_DRRS is set in the VBT. A check has been added for has_drrs in these functions, to make sure the functions go through only if DRRS will work on the platform with the attached panel.

Quoted 5 lines

V2: [By Ram]: WARN_ON is used when intel_edp_drrs_enable() is called more than once [Rodrigo]

Quoted 6 lines

Please be a bit more careful with adding sob lines - afaik Rodrigo did not handle this patch. If you just want to get people's attention, please use
Cc: instead.

Fixed while applying.
-Daniel

that was actually my fault... I had fixed a rebase conflicted and added to a drrs-review branch at cgit.
I signed-off but didn't increment the v2 explaining the rebase.

Thanks for merging.

Quoted 123 lines
Quoted 110 lines
---
 drivers/gpu/drm/i915/intel_ddi.c |    2 ++
 drivers/gpu/drm/i915/intel_dp.c  |   55 ++++++++++++++++++++++++++++++++++++++
 drivers/gpu/drm/i915/intel_drv.h |    2 ++
 3 files changed, 59 insertions(+)
drivers/gpu/drm/i915/intel_ddi.c +2 -0
index f10ec26..ad8b73d 100644
@@ -1610,6 +1610,7 @@ static void intel_enable_ddi(struct intel_encoder *intel_encoder)
 
              intel_edp_backlight_on(intel_dp);
              intel_psr_enable(intel_dp);
+             intel_edp_drrs_enable(intel_dp);
      }
 
      if (intel_crtc->config->has_audio) {
@@ -1635,6 +1636,7 @@ static void intel_disable_ddi(struct intel_encoder *intel_encoder)
      if (type == INTEL_OUTPUT_EDP) {
              struct intel_dp *intel_dp = enc_to_intel_dp(encoder);
 
+             intel_edp_drrs_disable(intel_dp);
              intel_psr_disable(intel_dp);
              intel_edp_backlight_off(intel_dp);
      }
drivers/gpu/drm/i915/intel_dp.c +55 -0
index c066560..f843fe0 100644
@@ -4820,6 +4820,61 @@ static void intel_dp_set_drrs_state(struct drm_device *dev, int refresh_rate)
      DRM_DEBUG_KMS("eDP Refresh Rate set to : %dHz\n", refresh_rate);
 }
 
+void intel_edp_drrs_enable(struct intel_dp *intel_dp)
+{
+     struct drm_device *dev = intel_dp_to_dev(intel_dp);
+     struct drm_i915_private *dev_priv = dev->dev_private;
+     struct intel_digital_port *dig_port = dp_to_dig_port(intel_dp);
+     struct drm_crtc *crtc = dig_port->base.base.crtc;
+     struct intel_crtc *intel_crtc = to_intel_crtc(crtc);
+
+     if (!intel_crtc->config->has_drrs) {
+             DRM_DEBUG_KMS("Panel doesn't support DRRS\n");
+             return;
+     }
+
+     mutex_lock(&dev_priv->drrs.mutex);
+     if (WARN_ON(dev_priv->drrs.dp)) {
+             DRM_ERROR("DRRS already enabled\n");
+             goto unlock;
+     }
+
+     dev_priv->drrs.busy_frontbuffer_bits = 0;
+
+     dev_priv->drrs.dp = intel_dp;
+
+unlock:
+     mutex_unlock(&dev_priv->drrs.mutex);
+}
+
+void intel_edp_drrs_disable(struct intel_dp *intel_dp)
+{
+     struct drm_device *dev = intel_dp_to_dev(intel_dp);
+     struct drm_i915_private *dev_priv = dev->dev_private;
+     struct intel_digital_port *dig_port = dp_to_dig_port(intel_dp);
+     struct drm_crtc *crtc = dig_port->base.base.crtc;
+     struct intel_crtc *intel_crtc = to_intel_crtc(crtc);
+
+     if (!intel_crtc->config->has_drrs)
+             return;
+
+     mutex_lock(&dev_priv->drrs.mutex);
+     if (!dev_priv->drrs.dp) {
+             mutex_unlock(&dev_priv->drrs.mutex);
+             return;
+     }
+
+     if (dev_priv->drrs.refresh_rate_type == DRRS_LOW_RR)
+             intel_dp_set_drrs_state(dev_priv->dev,
+                     intel_dp->attached_connector->panel.
+                     fixed_mode->vrefresh);
+
+     dev_priv->drrs.dp = NULL;
+     mutex_unlock(&dev_priv->drrs.mutex);
+
+     cancel_delayed_work_sync(&dev_priv->drrs.work);
+}
+
 static void intel_edp_drrs_downclock_work(struct work_struct *work)
 {
      struct drm_i915_private *dev_priv =
drivers/gpu/drm/i915/intel_drv.h +2 -1
index e957d4d..5a14725 100644
@@ -1030,6 +1030,8 @@ int intel_update_plane(struct drm_plane *plane, struct drm_crtc *crtc,
                     uint32_t src_w, uint32_t src_h);
 int intel_disable_plane(struct drm_plane *plane);
 void intel_plane_destroy(struct drm_plane *plane);
+void intel_edp_drrs_enable(struct intel_dp *intel_dp);
+void intel_edp_drrs_disable(struct intel_dp *intel_dp);
 
 /* intel_dp_mst.c */
 int intel_dp_mst_encoder_init(struct intel_digital_port *intel_dig_port, int conn_id);
--

1.7.9.5

Quoted 4 lines

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

--
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

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
#17 lore raw

PATCH v3 4/10 drm/i915: DRRS calls based on frontbuffer

In reply to Vandana Kannan

Calls have been added to invalidate/flush DRRS whenever invalidate/flush is called as part of frontbuffer tracking.
Apart from calls as a result of GEM tracking to fb invalidate/flush, a call has been added to invalidate fb obj from crtc_page_flip as well. This is to track busyness through flip calls.
The call to fb_obj_invalidate (in flip) is placed before queuing flip for this obj.

drrs_invalidate() and drrs_flush() check for drrs.dp which would be NULL if it was setup in drrs_enable(). This covers for the condition when DRRS is not supported.

v2: Removing the call to invalidate_drrs from page_flip.
This has not been tested on Android yet, but, in case DRRS transtions do not work as expected, check by adding back this call in page_flip.

---
 drivers/gpu/drm/i915/intel_dp.c          | 51 ++++++++++++++++++++++++++++++++
 drivers/gpu/drm/i915/intel_drv.h         |  3 ++
 drivers/gpu/drm/i915/intel_frontbuffer.c |  2 ++
 3 files changed, 56 insertions(+)
drivers/gpu/drm/i915/intel_dp.c +51 -0
index 5e7dc7b..ca89e59 100644
@@ -4902,6 +4902,57 @@ unlock:
 	mutex_unlock(&dev_priv->drrs.mutex);
 }
 
+void intel_edp_drrs_invalidate(struct drm_device *dev,
+		unsigned frontbuffer_bits)
+{
+	struct drm_i915_private *dev_priv = dev->dev_private;
+	struct drm_crtc *crtc;
+	enum pipe pipe;
+
+	if (!dev_priv->drrs.dp)
+		return;
+
+	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);
+	}
+
+	frontbuffer_bits &= INTEL_FRONTBUFFER_ALL_MASK(pipe);
+
+	dev_priv->drrs.busy_frontbuffer_bits |= frontbuffer_bits;
+	mutex_unlock(&dev_priv->drrs.mutex);
+}
+
+void intel_edp_drrs_flush(struct drm_device *dev,
+		unsigned frontbuffer_bits)
+{
+	struct drm_i915_private *dev_priv = dev->dev_private;
+	struct drm_crtc *crtc;
+	enum pipe pipe;
+
+	if (!dev_priv->drrs.dp)
+		return;
+
+	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,
+				msecs_to_jiffies(1000));
+	mutex_unlock(&dev_priv->drrs.mutex);
+}
+
 static struct drm_display_mode *
 intel_dp_drrs_init(struct intel_connector *intel_connector,
 		struct drm_display_mode *fixed_mode)
drivers/gpu/drm/i915/intel_drv.h +3 -0
index 6f3ad3b..17f168a 100644
@@ -1005,6 +1005,9 @@ int intel_update_plane(struct drm_plane *plane, struct drm_crtc *crtc,
 int intel_disable_plane(struct drm_plane *plane);
 void intel_edp_drrs_enable(struct intel_dp *intel_dp);
 void intel_edp_drrs_disable(struct intel_dp *intel_dp);
+void intel_edp_drrs_invalidate(struct drm_device *dev,
+		unsigned frontbuffer_bits);
+void intel_edp_drrs_flush(struct drm_device *dev, unsigned frontbuffer_bits);
 
 /* intel_dp_mst.c */
 int intel_dp_mst_encoder_init(struct intel_digital_port *intel_dig_port, int conn_id);
drivers/gpu/drm/i915/intel_frontbuffer.c +2 -0
index 79f6d72..73cb6e0 100644
@@ -157,6 +157,7 @@ void intel_fb_obj_invalidate(struct drm_i915_gem_object *obj,
 	intel_mark_fb_busy(dev, obj->frontbuffer_bits, ring);
 
 	intel_psr_invalidate(dev, obj->frontbuffer_bits);
+	intel_edp_drrs_invalidate(dev, obj->frontbuffer_bits);
 }
 
 /**
@@ -182,6 +183,7 @@ void intel_frontbuffer_flush(struct drm_device *dev,
 
 	intel_mark_fb_busy(dev, frontbuffer_bits, NULL);
 
+	intel_edp_drrs_flush(dev, frontbuffer_bits);
 	intel_psr_flush(dev, frontbuffer_bits);
 
 	/*
Signature · 6 lines
2.0.1

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

Re: [PATCH 4/10] drm/i915: DRRS calls based on frontbuffer

looks ok for me...
you will also have conflict so a rebased version is at:
http://cgit.freedesktop.org/~vivijim/drm-intel/log/?h=review-drrs

Quoted 126 lines · Vandana Kannan

Calls have been added to invalidate/flush DRRS whenever invalidate/flush is called as part of frontbuffer tracking.
Apart from calls as a result of GEM tracking to fb invalidate/flush, a call has been added to invalidate fb obj from crtc_page_flip as well. This is to track busyness through flip calls.
The call to fb_obj_invalidate (in flip) is placed before queuing flip for this obj.

drrs_invalidate() and drrs_flush() check for drrs.dp which would be NULL if it was setup in drrs_enable(). This covers for the condition when DRRS is not supported.

v2: Removing the call to invalidate_drrs from page_flip.
This has not been tested on Android yet, but, in case DRRS transtions do not work as expected, check by adding back this call in page_flip.

---
 drivers/gpu/drm/i915/intel_dp.c          | 51 ++++++++++++++++++++++++++++++++
 drivers/gpu/drm/i915/intel_drv.h         |  3 ++
 drivers/gpu/drm/i915/intel_frontbuffer.c |  2 ++
 3 files changed, 56 insertions(+)
drivers/gpu/drm/i915/intel_dp.c +51 -0
index 5e7dc7b..ca89e59 100644
@@ -4902,6 +4902,57 @@ unlock:
        mutex_unlock(&dev_priv->drrs.mutex);
 }
 
+void intel_edp_drrs_invalidate(struct drm_device *dev,
+               unsigned frontbuffer_bits)
+{
+       struct drm_i915_private *dev_priv = dev->dev_private;
+       struct drm_crtc *crtc;
+       enum pipe pipe;
+
+       if (!dev_priv->drrs.dp)
+               return;
+
+       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);
+       }
+
+       frontbuffer_bits &= INTEL_FRONTBUFFER_ALL_MASK(pipe);
+
+       dev_priv->drrs.busy_frontbuffer_bits |= frontbuffer_bits;
+       mutex_unlock(&dev_priv->drrs.mutex);
+}
+
+void intel_edp_drrs_flush(struct drm_device *dev,
+               unsigned frontbuffer_bits)
+{
+       struct drm_i915_private *dev_priv = dev->dev_private;
+       struct drm_crtc *crtc;
+       enum pipe pipe;
+
+       if (!dev_priv->drrs.dp)
+               return;
+
+       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,
+                               msecs_to_jiffies(1000));
+       mutex_unlock(&dev_priv->drrs.mutex);
+}
+
 static struct drm_display_mode *
 intel_dp_drrs_init(struct intel_connector *intel_connector,
                struct drm_display_mode *fixed_mode)
drivers/gpu/drm/i915/intel_drv.h +3 -0
index 6f3ad3b..17f168a 100644
@@ -1005,6 +1005,9 @@ int intel_update_plane(struct drm_plane *plane, struct drm_crtc *crtc,
 int intel_disable_plane(struct drm_plane *plane);
 void intel_edp_drrs_enable(struct intel_dp *intel_dp);
 void intel_edp_drrs_disable(struct intel_dp *intel_dp);
+void intel_edp_drrs_invalidate(struct drm_device *dev,
+               unsigned frontbuffer_bits);
+void intel_edp_drrs_flush(struct drm_device *dev, unsigned frontbuffer_bits);
 
 /* intel_dp_mst.c */
 int intel_dp_mst_encoder_init(struct intel_digital_port *intel_dig_port, int conn_id);
drivers/gpu/drm/i915/intel_frontbuffer.c +2 -1
index 79f6d72..73cb6e0 100644
@@ -157,6 +157,7 @@ void intel_fb_obj_invalidate(struct drm_i915_gem_object *obj,
        intel_mark_fb_busy(dev, obj->frontbuffer_bits, ring);
 
        intel_psr_invalidate(dev, obj->frontbuffer_bits);
+       intel_edp_drrs_invalidate(dev, obj->frontbuffer_bits);
 }
 
 /**
@@ -182,6 +183,7 @@ void intel_frontbuffer_flush(struct drm_device *dev,
 
        intel_mark_fb_busy(dev, frontbuffer_bits, NULL);
 
+       intel_edp_drrs_flush(dev, frontbuffer_bits);
        intel_psr_flush(dev, frontbuffer_bits);
 
        /*
--

2.0.1

_______________________________________________
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
#19 lore raw

Re: [PATCH 4/10] drm/i915: DRRS calls based on frontbuffer

Quoted 5 lines · Rodrigo Vivi

looks ok for me...
you will also have conflict so a rebased version is at:
http://cgit.freedesktop.org/~vivijim/drm-intel/log/?h=review-drrs

Merged up to this one, thanks for patches&review.
-Daniel

Quoted 139 lines
Quoted 126 lines · Vandana Kannan

Calls have been added to invalidate/flush DRRS whenever invalidate/flush is called as part of frontbuffer tracking.
Apart from calls as a result of GEM tracking to fb invalidate/flush, a call has been added to invalidate fb obj from crtc_page_flip as well. This is to track busyness through flip calls.
The call to fb_obj_invalidate (in flip) is placed before queuing flip for this obj.

drrs_invalidate() and drrs_flush() check for drrs.dp which would be NULL if it was setup in drrs_enable(). This covers for the condition when DRRS is not supported.

v2: Removing the call to invalidate_drrs from page_flip.
This has not been tested on Android yet, but, in case DRRS transtions do not work as expected, check by adding back this call in page_flip.

---
 drivers/gpu/drm/i915/intel_dp.c          | 51 ++++++++++++++++++++++++++++++++
 drivers/gpu/drm/i915/intel_drv.h         |  3 ++
 drivers/gpu/drm/i915/intel_frontbuffer.c |  2 ++
 3 files changed, 56 insertions(+)
drivers/gpu/drm/i915/intel_dp.c +51 -0
index 5e7dc7b..ca89e59 100644
@@ -4902,6 +4902,57 @@ unlock:
        mutex_unlock(&dev_priv->drrs.mutex);
 }
 
+void intel_edp_drrs_invalidate(struct drm_device *dev,
+               unsigned frontbuffer_bits)
+{
+       struct drm_i915_private *dev_priv = dev->dev_private;
+       struct drm_crtc *crtc;
+       enum pipe pipe;
+
+       if (!dev_priv->drrs.dp)
+               return;
+
+       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);
+       }
+
+       frontbuffer_bits &= INTEL_FRONTBUFFER_ALL_MASK(pipe);
+
+       dev_priv->drrs.busy_frontbuffer_bits |= frontbuffer_bits;
+       mutex_unlock(&dev_priv->drrs.mutex);
+}
+
+void intel_edp_drrs_flush(struct drm_device *dev,
+               unsigned frontbuffer_bits)
+{
+       struct drm_i915_private *dev_priv = dev->dev_private;
+       struct drm_crtc *crtc;
+       enum pipe pipe;
+
+       if (!dev_priv->drrs.dp)
+               return;
+
+       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,
+                               msecs_to_jiffies(1000));
+       mutex_unlock(&dev_priv->drrs.mutex);
+}
+
 static struct drm_display_mode *
 intel_dp_drrs_init(struct intel_connector *intel_connector,
                struct drm_display_mode *fixed_mode)
drivers/gpu/drm/i915/intel_drv.h +3 -0
index 6f3ad3b..17f168a 100644
@@ -1005,6 +1005,9 @@ int intel_update_plane(struct drm_plane *plane, struct drm_crtc *crtc,
 int intel_disable_plane(struct drm_plane *plane);
 void intel_edp_drrs_enable(struct intel_dp *intel_dp);
 void intel_edp_drrs_disable(struct intel_dp *intel_dp);
+void intel_edp_drrs_invalidate(struct drm_device *dev,
+               unsigned frontbuffer_bits);
+void intel_edp_drrs_flush(struct drm_device *dev, unsigned frontbuffer_bits);
 
 /* intel_dp_mst.c */
 int intel_dp_mst_encoder_init(struct intel_digital_port *intel_dig_port, int conn_id);
drivers/gpu/drm/i915/intel_frontbuffer.c +2 -1
index 79f6d72..73cb6e0 100644
@@ -157,6 +157,7 @@ void intel_fb_obj_invalidate(struct drm_i915_gem_object *obj,
        intel_mark_fb_busy(dev, obj->frontbuffer_bits, ring);
 
        intel_psr_invalidate(dev, obj->frontbuffer_bits);
+       intel_edp_drrs_invalidate(dev, obj->frontbuffer_bits);
 }
 
 /**
@@ -182,6 +183,7 @@ void intel_frontbuffer_flush(struct drm_device *dev,
 
        intel_mark_fb_busy(dev, frontbuffer_bits, NULL);
 
+       intel_edp_drrs_flush(dev, frontbuffer_bits);
        intel_psr_flush(dev, frontbuffer_bits);
 
        /*
--

2.0.1

_______________________________________________
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
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
#20 lore raw

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

In reply to Vandana Kannan

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 3fe9598..ced049a 100644
@@ -4316,7 +4316,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);
 
@@ -4424,7 +4424,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);
 
@@ -5038,7 +5038,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);
 
@@ -5114,7 +5114,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);
 
@@ -5889,13 +5889,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 76b3c20..e05de19 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
#21 lore raw

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

Hi,

This is preparation patch for "[PATCH] drm/i915/bdw: Add support for DRRS to switch RR". My bad that I have misplaced this in the thread.

Quoted 137 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.

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 3fe9598..ced049a 100644
@@ -4316,7 +4316,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);
 
@@ -4424,7 +4424,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);
 
@@ -5038,7 +5038,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);
 
@@ -5114,7 +5114,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);
 
@@ -5889,13 +5889,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 76b3c20..e05de19 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
Ram

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

PATCH v3 5/10 drm/i915/bdw: Add support for DRRS to switch RR

In reply to Vandana Kannan

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.

---
 drivers/gpu/drm/i915/intel_display.c |  9 +++------
 drivers/gpu/drm/i915/intel_dp.c      | 15 ++++++++++++++-
 drivers/gpu/drm/i915/intel_drv.h     |  3 +++
 3 files changed, 20 insertions(+), 7 deletions(-)
drivers/gpu/drm/i915/intel_display.c +3 -6
index a03955d..25596ca 100644
@@ -88,9 +88,6 @@ static int intel_framebuffer_init(struct drm_device *dev,
 				  struct drm_i915_gem_object *obj);
 static void i9xx_set_pipeconf(struct intel_crtc *intel_crtc);
 static void intel_set_pipe_timings(struct intel_crtc *intel_crtc);
-static void intel_cpu_transcoder_set_m_n(struct intel_crtc *crtc,
-					 struct intel_link_m_n *m_n,
-					 struct intel_link_m_n *m2_n2);
 static void ironlake_set_pipeconf(struct drm_crtc *crtc);
 static void haswell_set_pipeconf(struct drm_crtc *crtc);
 static void intel_set_pipe_csc(struct drm_crtc *crtc);
@@ -5795,9 +5792,9 @@ static void intel_pch_transcoder_set_m_n(struct intel_crtc *crtc,
 	I915_WRITE(PCH_TRANS_LINK_N1(pipe), m_n->link_n);
 }
 
-static void intel_cpu_transcoder_set_m_n(struct intel_crtc *crtc,
-					 struct intel_link_m_n *m_n,
-					 struct intel_link_m_n *m2_n2)
+void intel_cpu_transcoder_set_m_n(struct intel_crtc *crtc,
+				 struct intel_link_m_n *m_n,
+				 struct intel_link_m_n *m2_n2)
 {
 	struct drm_device *dev = crtc->base.dev;
 	struct drm_i915_private *dev_priv = dev->dev_private;
drivers/gpu/drm/i915/intel_dp.c +14 -1
index ca89e59..85a029e 100644
@@ -4802,7 +4802,20 @@ 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);
+			break;
+		case DRRS_LOW_RR:
+			intel_cpu_transcoder_set_m_n(intel_crtc,
+					&intel_crtc->config.dp_m2_n2, NULL);
+			break;
+		case DRRS_MAX_RR:
+		default:
+			break;
+		}
+	} else if (INTEL_INFO(dev)->gen > 6) {
 		reg = PIPECONF(intel_crtc->config.cpu_transcoder);
 		val = I915_READ(reg);
 		if (index > DRRS_HIGH_RR) {
drivers/gpu/drm/i915/intel_drv.h +3 -0
index 17f168a..f5846cf 100644
@@ -953,6 +953,9 @@ void hsw_disable_pc8(struct drm_i915_private *dev_priv);
 void intel_dp_get_m_n(struct intel_crtc *crtc,
 		      struct intel_crtc_config *pipe_config);
 void intel_dp_set_m_n(struct intel_crtc *crtc);
+void intel_cpu_transcoder_set_m_n(struct intel_crtc *crtc,
+				 struct intel_link_m_n *m_n,
+				 struct intel_link_m_n *m2_n2);
 int intel_dotclock_calculate(int link_freq, const struct intel_link_m_n *m_n);
 void
 ironlake_check_encoder_dotclock(const struct intel_crtc_config *pipe_config,
Signature · 6 lines
2.0.1

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

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

Quoted 47 lines · Vandana Kannan

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.

---
 drivers/gpu/drm/i915/intel_display.c |  9 +++------
 drivers/gpu/drm/i915/intel_dp.c      | 15 ++++++++++++++-
 drivers/gpu/drm/i915/intel_drv.h     |  3 +++
 3 files changed, 20 insertions(+), 7 deletions(-)
drivers/gpu/drm/i915/intel_display.c +3 -6
index a03955d..25596ca 100644
@@ -88,9 +88,6 @@ static int intel_framebuffer_init(struct drm_device *dev,
                                  struct drm_i915_gem_object *obj);
 static void i9xx_set_pipeconf(struct intel_crtc *intel_crtc);
 static void intel_set_pipe_timings(struct intel_crtc *intel_crtc);
-static void intel_cpu_transcoder_set_m_n(struct intel_crtc *crtc,
-                                        struct intel_link_m_n *m_n,
-                                        struct intel_link_m_n *m2_n2);
 static void ironlake_set_pipeconf(struct drm_crtc *crtc);
 static void haswell_set_pipeconf(struct drm_crtc *crtc);
 static void intel_set_pipe_csc(struct drm_crtc *crtc);
@@ -5795,9 +5792,9 @@ static void intel_pch_transcoder_set_m_n(struct intel_crtc *crtc,
        I915_WRITE(PCH_TRANS_LINK_N1(pipe), m_n->link_n);
 }
 
-static void intel_cpu_transcoder_set_m_n(struct intel_crtc *crtc,
-                                        struct intel_link_m_n *m_n,
-                                        struct intel_link_m_n *m2_n2)
+void intel_cpu_transcoder_set_m_n(struct intel_crtc *crtc,
+                                struct intel_link_m_n *m_n,
+                                struct intel_link_m_n *m2_n2)
 {
        struct drm_device *dev = crtc->base.dev;
        struct drm_i915_private *dev_priv = dev->dev_private;
drivers/gpu/drm/i915/intel_dp.c +0 -0
index ca89e59..85a029e 100644
@@ -4802,7 +4802,20 @@ 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 4811

Quoted 10 lines
drivers/gpu/drm/i915/intel_dp.c +7 -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);
+                       break;
+               case DRRS_LOW_RR:
+                       intel_cpu_transcoder_set_m_n(intel_crtc,

I didn't like this mix of intel_dp_set and intel_cpu set when intel_dp_set calls cpu set only when it doesn't have pch... It seems at least strange.

Maybe change intel_dp_set_m_n to support different sets...

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

Quoted 1 line
drivers/gpu/drm/i915/intel_dp.c +1 -0
+                                       &intel_crtc->config.dp_m2_n2, NULL);

Also didn't understand why sending m2_n2 on m1_n1 and NULL on m2_n2.

Is there a way to change that function to support different ways instead of doing this?

Quoted 30 lines
drivers/gpu/drm/i915/intel_dp.c +6 -0
+                       break;
+               case DRRS_MAX_RR:
+               default:
+                       break;
+               }
+       } else if (INTEL_INFO(dev)->gen > 6) {
                reg = PIPECONF(intel_crtc->config.cpu_transcoder);
                val = I915_READ(reg);
                if (index > DRRS_HIGH_RR) {
drivers/gpu/drm/i915/intel_drv.h +3 -1
index 17f168a..f5846cf 100644
@@ -953,6 +953,9 @@ void hsw_disable_pc8(struct drm_i915_private *dev_priv);
 void intel_dp_get_m_n(struct intel_crtc *crtc,
                      struct intel_crtc_config *pipe_config);
 void intel_dp_set_m_n(struct intel_crtc *crtc);
+void intel_cpu_transcoder_set_m_n(struct intel_crtc *crtc,
+                                struct intel_link_m_n *m_n,
+                                struct intel_link_m_n *m2_n2);
 int intel_dotclock_calculate(int link_freq, const struct intel_link_m_n *m_n);
 void
 ironlake_check_encoder_dotclock(const struct intel_crtc_config *pipe_config,
--

2.0.1

_______________________________________________
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
#24 lore raw

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

Quoted 63 lines · Rodrigo Vivi
Quoted 47 lines · Vandana Kannan

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.

---
  drivers/gpu/drm/i915/intel_display.c |  9 +++------
  drivers/gpu/drm/i915/intel_dp.c      | 15 ++++++++++++++-
  drivers/gpu/drm/i915/intel_drv.h     |  3 +++
  3 files changed, 20 insertions(+), 7 deletions(-)
drivers/gpu/drm/i915/intel_display.c +3 -6
index a03955d..25596ca 100644
@@ -88,9 +88,6 @@ static int intel_framebuffer_init(struct drm_device *dev,
                                   struct drm_i915_gem_object *obj);
  static void i9xx_set_pipeconf(struct intel_crtc *intel_crtc);
  static void intel_set_pipe_timings(struct intel_crtc *intel_crtc);
-static void intel_cpu_transcoder_set_m_n(struct intel_crtc *crtc,
-                                        struct intel_link_m_n *m_n,
-                                        struct intel_link_m_n *m2_n2);
  static void ironlake_set_pipeconf(struct drm_crtc *crtc);
  static void haswell_set_pipeconf(struct drm_crtc *crtc);
  static void intel_set_pipe_csc(struct drm_crtc *crtc);
@@ -5795,9 +5792,9 @@ static void intel_pch_transcoder_set_m_n(struct intel_crtc *crtc,
         I915_WRITE(PCH_TRANS_LINK_N1(pipe), m_n->link_n);
  }
 
-static void intel_cpu_transcoder_set_m_n(struct intel_crtc *crtc,
-                                        struct intel_link_m_n *m_n,
-                                        struct intel_link_m_n *m2_n2)
+void intel_cpu_transcoder_set_m_n(struct intel_crtc *crtc,
+                                struct intel_link_m_n *m_n,
+                                struct intel_link_m_n *m2_n2)
  {
         struct drm_device *dev = crtc->base.dev;
         struct drm_i915_private *dev_priv = dev->dev_private;
drivers/gpu/drm/i915/intel_dp.c +0 -0
index ca89e59..85a029e 100644
@@ -4802,7 +4802,20 @@ 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 4811

Quoted 10 lines
drivers/gpu/drm/i915/intel_dp.c +7 -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);
+                       break;
+               case DRRS_LOW_RR:
+                       intel_cpu_transcoder_set_m_n(intel_crtc,

I didn't like this mix of intel_dp_set and intel_cpu set when intel_dp_set calls cpu set only when it doesn't have pch... It seems at least strange.

Quoted 7 lines

Maybe change intel_dp_set_m_n to support different sets...

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

Quoted 1 line
drivers/gpu/drm/i915/intel_dp.c +1 -0
+                                       &intel_crtc->config.dp_m2_n2, NULL);

Also didn't understand why sending m2_n2 on m1_n1 and NULL on m2_n2.

Is there a way to change that function to support different ways instead of doing this?

Agreed. I will rewrite the intel_dp_set_m_n to handle all different sets.

Quoted 27 lines
Quoted 27 lines
drivers/gpu/drm/i915/intel_dp.c +6 -0
+                       break;
+               case DRRS_MAX_RR:
+               default:
+                       break;
+               }
+       } else if (INTEL_INFO(dev)->gen > 6) {
                 reg = PIPECONF(intel_crtc->config.cpu_transcoder);
                 val = I915_READ(reg);
                 if (index > DRRS_HIGH_RR) {
drivers/gpu/drm/i915/intel_drv.h +3 -1
index 17f168a..f5846cf 100644
@@ -953,6 +953,9 @@ void hsw_disable_pc8(struct drm_i915_private *dev_priv);
  void intel_dp_get_m_n(struct intel_crtc *crtc,
                       struct intel_crtc_config *pipe_config);
  void intel_dp_set_m_n(struct intel_crtc *crtc);
+void intel_cpu_transcoder_set_m_n(struct intel_crtc *crtc,
+                                struct intel_link_m_n *m_n,
+                                struct intel_link_m_n *m2_n2);
  int intel_dotclock_calculate(int link_freq, const struct intel_link_m_n *m_n);
  void
  ironlake_check_encoder_dotclock(const struct intel_crtc_config *pipe_config,
--

2.0.1

Quoted 6 lines
Quoted 4 lines

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

--Ram

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

#25 lore raw

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

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]
---
 drivers/gpu/drm/i915/intel_display.c |   36 ++++++++++++++++++++++------------
 drivers/gpu/drm/i915/intel_dp.c      |   16 +++++++++++++--
 drivers/gpu/drm/i915/intel_drv.h     |   11 ++++++++++-
 3 files changed, 47 insertions(+), 16 deletions(-)
drivers/gpu/drm/i915/intel_display.c +23 -13
index 01dc80b..5712686 100644
@@ -88,9 +88,6 @@ static int intel_framebuffer_init(struct drm_device *dev,
 				  struct drm_i915_gem_object *obj);
 static void i9xx_set_pipeconf(struct intel_crtc *intel_crtc);
 static void intel_set_pipe_timings(struct intel_crtc *intel_crtc);
-static void intel_cpu_transcoder_set_m_n(struct intel_crtc *crtc,
-					 struct intel_link_m_n *m_n,
-					 struct intel_link_m_n *m2_n2);
 static void ironlake_set_pipeconf(struct drm_crtc *crtc);
 static void haswell_set_pipeconf(struct drm_crtc *crtc);
 static void intel_set_pipe_csc(struct drm_crtc *crtc);
@@ -4289,7 +4286,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);
 
@@ -4397,7 +4394,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);
 
@@ -5011,7 +5008,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);
 
@@ -5087,7 +5084,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);
 
@@ -5828,9 +5825,9 @@ static void intel_pch_transcoder_set_m_n(struct intel_crtc *crtc,
 	I915_WRITE(PCH_TRANS_LINK_N1(pipe), m_n->link_n);
 }
 
-static void intel_cpu_transcoder_set_m_n(struct intel_crtc *crtc,
-					 struct intel_link_m_n *m_n,
-					 struct intel_link_m_n *m2_n2)
+void intel_cpu_transcoder_set_m_n(struct intel_crtc *crtc,
+				 struct intel_link_m_n *m_n,
+				 struct intel_link_m_n *m2_n2)
 {
 	struct drm_device *dev = crtc->base.dev;
 	struct drm_i915_private *dev_priv = dev->dev_private;
@@ -5862,13 +5859,26 @@ 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) {
+		/* Only one register programming is supported. And m_n value
+		 * corresponding to downclock mode needs to be programmed */
+		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_dp.c +14 -2
index 955aca3..592ca3d 100644
@@ -4803,12 +4803,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;
 		}
drivers/gpu/drm/i915/intel_drv.h +10 -1
index a31dc103..193ccda 100644
@@ -587,6 +587,12 @@ struct intel_hdmi {
 struct intel_dp_mst_encoder;
 #define DP_MAX_DOWNSTREAM_PORTS		0x10
 
+/* enum to indicate the m_n value from calculated list */
+enum link_m_n_set {
+	M1_N1 = 0,
+	M2_N2
+};
+
 struct intel_dp {
 	uint32_t output_reg;
 	uint32_t aux_ch_ctl_reg;
@@ -979,7 +985,10 @@ 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);
+void intel_cpu_transcoder_set_m_n(struct intel_crtc *crtc,
+				 struct intel_link_m_n *m_n,
+				 struct intel_link_m_n *m2_n2);
 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
#26 lore raw

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

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]

---
 drivers/gpu/drm/i915/intel_display.c |   36 ++++++++++++++++++++++------------
 drivers/gpu/drm/i915/intel_dp.c      |   16 +++++++++++++--
 drivers/gpu/drm/i915/intel_drv.h     |   11 ++++++++++-
 3 files changed, 47 insertions(+), 16 deletions(-)
drivers/gpu/drm/i915/intel_display.c +23 -13
index 01dc80b..5712686 100644
@@ -88,9 +88,6 @@ static int intel_framebuffer_init(struct drm_device *dev,
 				  struct drm_i915_gem_object *obj);
 static void i9xx_set_pipeconf(struct intel_crtc *intel_crtc);
 static void intel_set_pipe_timings(struct intel_crtc *intel_crtc);
-static void intel_cpu_transcoder_set_m_n(struct intel_crtc *crtc,
-					 struct intel_link_m_n *m_n,
-					 struct intel_link_m_n *m2_n2);
 static void ironlake_set_pipeconf(struct drm_crtc *crtc);
 static void haswell_set_pipeconf(struct drm_crtc *crtc);
 static void intel_set_pipe_csc(struct drm_crtc *crtc);
@@ -4289,7 +4286,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);
 
@@ -4397,7 +4394,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);
 
@@ -5011,7 +5008,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);
 
@@ -5087,7 +5084,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);
 
@@ -5828,9 +5825,9 @@ static void intel_pch_transcoder_set_m_n(struct intel_crtc *crtc,
 	I915_WRITE(PCH_TRANS_LINK_N1(pipe), m_n->link_n);
 }
 
-static void intel_cpu_transcoder_set_m_n(struct intel_crtc *crtc,
-					 struct intel_link_m_n *m_n,
-					 struct intel_link_m_n *m2_n2)
+void intel_cpu_transcoder_set_m_n(struct intel_crtc *crtc,
+				 struct intel_link_m_n *m_n,
+				 struct intel_link_m_n *m2_n2)
 {
 	struct drm_device *dev = crtc->base.dev;
 	struct drm_i915_private *dev_priv = dev->dev_private;
@@ -5862,13 +5859,26 @@ 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) {
+		/* Only one register programming is supported. And m_n value
+		 * corresponding to downclock mode needs to be programmed */
+		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_dp.c +14 -2
index 955aca3..27ff0d4 100644
@@ -4803,12 +4803,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;
 		}
drivers/gpu/drm/i915/intel_drv.h +10 -1
index a31dc103..193ccda 100644
@@ -587,6 +587,12 @@ struct intel_hdmi {
 struct intel_dp_mst_encoder;
 #define DP_MAX_DOWNSTREAM_PORTS		0x10
 
+/* enum to indicate the m_n value from calculated list */
+enum link_m_n_set {
+	M1_N1 = 0,
+	M2_N2
+};
+
 struct intel_dp {
 	uint32_t output_reg;
 	uint32_t aux_ch_ctl_reg;
@@ -979,7 +985,10 @@ 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);
+void intel_cpu_transcoder_set_m_n(struct intel_crtc *crtc,
+				 struct intel_link_m_n *m_n,
+				 struct intel_link_m_n *m2_n2);
 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/1
#27 lore raw

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

Quoted 26 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]

---
 drivers/gpu/drm/i915/intel_display.c |   36 ++++++++++++++++++++++------------
 drivers/gpu/drm/i915/intel_dp.c      |   16 +++++++++++++--
 drivers/gpu/drm/i915/intel_drv.h     |   11 ++++++++++-
 3 files changed, 47 insertions(+), 16 deletions(-)
drivers/gpu/drm/i915/intel_display.c +0 -0
index 01dc80b..5712686 100644

drivers/gpu/drm/i915/intel_display.c static int intel_framebuffer_init(struct drm_device *dev, · line 93

Quoted 6 lines
drivers/gpu/drm/i915/intel_display.c +0 -3
@@ -88,9 +88,6 @@ static int intel_framebuffer_init(struct drm_device *dev,
                                  struct drm_i915_gem_object *obj);
 static void i9xx_set_pipeconf(struct intel_crtc *intel_crtc);
 static void intel_set_pipe_timings(struct intel_crtc *intel_crtc);
-static void intel_cpu_transcoder_set_m_n(struct intel_crtc *crtc,
-                                        struct intel_link_m_n *m_n,
-                                        struct intel_link_m_n *m2_n2);

I believe all this set_m_n changes should be in a separated preparation patch....

Quoted 97 lines
drivers/gpu/drm/i915/intel_display.c +23 -10
 static void ironlake_set_pipeconf(struct drm_crtc *crtc);
 static void haswell_set_pipeconf(struct drm_crtc *crtc);
 static void intel_set_pipe_csc(struct drm_crtc *crtc);
@@ -4289,7 +4286,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);
 
@@ -4397,7 +4394,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);
 
@@ -5011,7 +5008,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);
 
@@ -5087,7 +5084,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);
 
@@ -5828,9 +5825,9 @@ static void intel_pch_transcoder_set_m_n(struct intel_crtc *crtc,
        I915_WRITE(PCH_TRANS_LINK_N1(pipe), m_n->link_n);
 }
 
-static void intel_cpu_transcoder_set_m_n(struct intel_crtc *crtc,
-                                        struct intel_link_m_n *m_n,
-                                        struct intel_link_m_n *m2_n2)
+void intel_cpu_transcoder_set_m_n(struct intel_crtc *crtc,
+                                struct intel_link_m_n *m_n,
+                                struct intel_link_m_n *m2_n2)
 {
        struct drm_device *dev = crtc->base.dev;
        struct drm_i915_private *dev_priv = dev->dev_private;
@@ -5862,13 +5859,26 @@ 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) {
+               /* Only one register programming is supported. And m_n value
+                * corresponding to downclock mode needs to be programmed */
+               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_dp.c +6 -1
index 955aca3..27ff0d4 100644
@@ -4803,12 +4803,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:

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

Quoted 10 lines
drivers/gpu/drm/i915/intel_dp.c +8 -0
+                       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);
+

Then, only this block really related to drrs as in commit message should stay on this commit.

Quoted 38 lines
drivers/gpu/drm/i915/intel_dp.c +0 -1
                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;
                }
drivers/gpu/drm/i915/intel_drv.h +10 -2
index a31dc103..193ccda 100644
@@ -587,6 +587,12 @@ struct intel_hdmi {
 struct intel_dp_mst_encoder;
 #define DP_MAX_DOWNSTREAM_PORTS                0x10
 
+/* enum to indicate the m_n value from calculated list */
+enum link_m_n_set {
+       M1_N1 = 0,
+       M2_N2
+};
+
 struct intel_dp {
        uint32_t output_reg;
        uint32_t aux_ch_ctl_reg;
@@ -979,7 +985,10 @@ 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);
+void intel_cpu_transcoder_set_m_n(struct intel_crtc *crtc,
+                                struct intel_link_m_n *m_n,
+                                struct intel_link_m_n *m2_n2);
 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

but I don't want to block progress here....
I'll let this desicion to author and maintainer and in any case feel free to use my:

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
#28 lore raw

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

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 eea9e36..d29d669 100644
@@ -4808,12 +4808,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
#29 lore raw

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

In reply to Vandana Kannan

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 40ca873..63a3fca 100644
@@ -3840,6 +3840,7 @@ enum punit_power_well {
 #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 85a029e..3362d93 100644
@@ -4819,10 +4819,16 @@ static void intel_dp_set_drrs_state(struct drm_device *dev, int refresh_rate)
 		reg = PIPECONF(intel_crtc->config.cpu_transcoder);
 		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;
 			intel_dp_set_m_n(intel_crtc);
 		} 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
2.0.1

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

Re: [PATCH 6/10] drm/i915: Support for RR switching on VLV

Quoted 53 lines · Vandana Kannan

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 40ca873..63a3fca 100644
@@ -3840,6 +3840,7 @@ enum punit_power_well {
 #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 -3
index 85a029e..3362d93 100644
@@ -4819,10 +4819,16 @@ static void intel_dp_set_drrs_state(struct drm_device *dev, int refresh_rate)
                reg = PIPECONF(intel_crtc->config.cpu_transcoder);
                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;
                        intel_dp_set_m_n(intel_crtc);
                } 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);
        }
--

2.0.1

_______________________________________________
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
#31 lore raw

PATCH v3 7/10 drm/i915: Enable eDP DRRS for CHV

In reply to Vandana Kannan

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()

---
 drivers/gpu/drm/i915/intel_display.c | 4 ++--
 drivers/gpu/drm/i915/intel_dp.c      | 2 +-
 2 files changed, 3 insertions(+), 3 deletions(-)
drivers/gpu/drm/i915/intel_display.c +2 -2
index 25596ca..bb44fb9 100644
@@ -5810,8 +5810,8 @@ 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 &&
-			crtc->config.has_drrs) {
+		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);
 			I915_WRITE(PIPE_DATA_N2(transcoder), m2_n2->gmch_n);
drivers/gpu/drm/i915/intel_dp.c +1 -1
index 3362d93..42195fe 100644
@@ -4802,7 +4802,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);
Signature · 6 lines
2.0.1

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

Re: [PATCH 7/10] drm/i915: Enable eDP DRRS for CHV

Quoted 21 lines · Vandana Kannan

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()

---
 drivers/gpu/drm/i915/intel_display.c | 4 ++--
 drivers/gpu/drm/i915/intel_dp.c      | 2 +-
 2 files changed, 3 insertions(+), 3 deletions(-)
drivers/gpu/drm/i915/intel_display.c +0 -0
index 25596ca..bb44fb9 100644

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

Quoted 7 lines
drivers/gpu/drm/i915/intel_display.c +2 -2
@@ -5810,8 +5810,8 @@ 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 &&
-                       crtc->config.has_drrs) {
+               if (m2_n2 && (IS_CHERRYVIEW(dev) || INTEL_INFO(dev)->gen < 8)
+                       && crtc->config.has_drrs) {

This change here doesn't seem safe. As I told on previous comment I'd prefer changing intel_dp_set_m_n instead of re-using this intel_cpu one...

Quoted 23 lines
drivers/gpu/drm/i915/intel_display.c +0 -0
                        I915_WRITE(PIPE_DATA_M2(transcoder),
                                        TU_SIZE(m2_n2->tu) | m2_n2->gmch_m);
                        I915_WRITE(PIPE_DATA_N2(transcoder), m2_n2->gmch_n);
drivers/gpu/drm/i915/intel_dp.c +1 -2
index 3362d93..42195fe 100644
@@ -4802,7 +4802,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);
--

2.0.1

_______________________________________________
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
#33 lore raw

Re: [PATCH 7/10] drm/i915: Enable eDP DRRS for CHV

Hi

Quoted 18 lines · Rodrigo Vivi
Quoted 16 lines · Vandana Kannan

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()

---
  drivers/gpu/drm/i915/intel_display.c | 4 ++--
  drivers/gpu/drm/i915/intel_dp.c      | 2 +-
  2 files changed, 3 insertions(+), 3 deletions(-)
Quoted 15 lines

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

Quoted 12 lines
drivers/gpu/drm/i915/intel_display.c +2 -2
index 25596ca..bb44fb9 100644
@@ -5810,8 +5810,8 @@ 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 &&
-                       crtc->config.has_drrs) {
+               if (m2_n2 && (IS_CHERRYVIEW(dev) || INTEL_INFO(dev)->gen < 8)
+                       && crtc->config.has_drrs) {

This change here doesn't seem safe. As I told on previous comment I'd prefer changing intel_dp_set_m_n instead of re-using this intel_cpu one...

Though I am rewriting the intel_dp_set_m_n() that will reuse intel_cpu_transcoder_set_m_n() within. But as a result, i am going to avoid the parallel usage of intel_cpu_transcoder_set_m_n() and intel_dp_set_m_n(). So I am afraid this check for inclusion of cherryview for m2_n2 programming will be part of the newer code also.

Appending the RFC for the newer intel_dp_set_m_n() implementation below. Please review.

RFC starts here:

 drivers/gpu/drm/i915/intel_display.c |   19 ++++++++++++++++---
 drivers/gpu/drm/i915/intel_dp.c      |    6 ++----
 drivers/gpu/drm/i915/intel_drv.h     |    8 +++++++-
 3 files changed, 25 insertions(+), 8 deletions(-)
drivers/gpu/drm/i915/intel_display.c +0 -0
index 061a253..59cc87f 100644
@@ -5829,13 +5829,26 @@ 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 set = M1_N1)
{
+ struct intel_link_m_n *dp_m_n, *dp_m2_n2;
+
+ if (set == M1_N1) {
+ dp_m_n = &crtc->config.dp_m_n;
+ dp_m2_n2 = &crtc->config.dp_m2_n2;
+ } else if (set == M2_N2) {

+               /* Only one register programming is supported */
+               dp_m_n = &crtc->config.dp_m_n;
+               dp_m2_n2 = NULL;

+ } 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_dp.c +1 -1
index b315292..784b8dd 100644
@@ -4817,11 +4817,10 @@ static void intel_dp_set_drrs_state(struct drm_device *dev, int refresh_rate)
        if (INTEL_INFO(dev)->gen >= 8 && !IS_CHERRYVIEW(dev)) {
                switch(index) {
                case DRRS_HIGH_RR:
- intel_dp_set_m_n(intel_crtc);
+                       intel_dp_set_m_n(intel_crtc, M1_N1);

break;
case DRRS_LOW_RR:
- intel_cpu_transcoder_set_m_n(intel_crtc,
- &intel_crtc->config.dp_m2_n2, NULL);
+ intel_dp_set_m_n(intel_crtc, M2_N2);
break;
case DRRS_MAX_RR:
default:
@@ -4835,7 +4834,6 @@ static void intel_dp_set_drrs_state(struct drm_device *dev, int refresh_rate)

                                val |= PIPECONF_EDP_RR_MODE_SWITCH_VLV;
else
                                val |= PIPECONF_EDP_RR_MODE_SWITCH;
- intel_dp_set_m_n(intel_crtc);
                } else {
                        if (IS_VALLEYVIEW(dev))
                                val &= ~PIPECONF_EDP_RR_MODE_SWITCH_VLV;
drivers/gpu/drm/i915/intel_drv.h +7 -1
index 86d31f2..910e613 100644
@@ -595,6 +595,12 @@ struct intel_hdmi {
 struct intel_dp_mst_encoder;
 #define DP_MAX_DOWNSTREAM_PORTS 0x10
 
+enum link_m_n_set {
+       M1_N1 = 0,
+ M2_N2,
+ DIVIDER_MAX
+};
+
 struct intel_dp {
        uint32_t output_reg;
        uint32_t aux_ch_ctl_reg;
@@ -983,7 +989,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_config *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 set = M1_N1);
 void intel_cpu_transcoder_set_m_n(struct intel_crtc *crtc,
                                 struct intel_link_m_n *m_n,
                                 struct intel_link_m_n *m2_n2);
Signature · 1 line
1.7.9.5
Quoted 20 lines
Quoted 20 lines
drivers/gpu/drm/i915/intel_display.c +0 -0
                         I915_WRITE(PIPE_DATA_M2(transcoder),
                                         TU_SIZE(m2_n2->tu) | m2_n2->gmch_m);
                         I915_WRITE(PIPE_DATA_N2(transcoder), m2_n2->gmch_n);
drivers/gpu/drm/i915/intel_dp.c +1 -2
index 3362d93..42195fe 100644
@@ -4802,7 +4802,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);
--

2.0.1

Quoted 6 lines
Quoted 4 lines

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

--Ram

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

maintainer
#34 lore raw

Re: [PATCH 7/10] drm/i915: Enable eDP DRRS for CHV

Quoted 183 lines · Ramalingam C

Hi

Quoted 18 lines · Rodrigo Vivi
Quoted 16 lines · Vandana Kannan

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()

---
 drivers/gpu/drm/i915/intel_display.c | 4 ++--
 drivers/gpu/drm/i915/intel_dp.c      | 2 +-
 2 files changed, 3 insertions(+), 3 deletions(-)
Quoted 15 lines

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

Quoted 12 lines
drivers/gpu/drm/i915/intel_display.c +2 -2
index 25596ca..bb44fb9 100644
@@ -5810,8 +5810,8 @@ 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 &&
-                       crtc->config.has_drrs) {
+               if (m2_n2 && (IS_CHERRYVIEW(dev) || INTEL_INFO(dev)->gen < 8)
+                       && crtc->config.has_drrs) {

This change here doesn't seem safe. As I told on previous comment I'd prefer changing intel_dp_set_m_n instead of re-using this intel_cpu one...

Though I am rewriting the intel_dp_set_m_n() that will reuse intel_cpu_transcoder_set_m_n() within.
But as a result, i am going to avoid the parallel usage of intel_cpu_transcoder_set_m_n() and intel_dp_set_m_n(). So I am afraid this check for inclusion of cherryview for m2_n2 programming will be part of the newer code also.

Appending the RFC for the newer intel_dp_set_m_n() implementation below. Please review.

RFC starts here:

 drivers/gpu/drm/i915/intel_display.c |   19
++++++++++++++++---                
 drivers/gpu/drm/i915/intel_dp.c      |    6
++----                             
 drivers/gpu/drm/i915/intel_drv.h     |    8
+++++++-                           
 3 files changed, 25 insertions(+), 8 deletions(-) 
drivers/gpu/drm/i915/intel_display.c +0 -0
index 061a253..59cc87f

100644
---
a/drivers/gpu/drm/i915/intel_display.c
+++
b/drivers/gpu/drm/i915/intel_display.c

drivers/gpu/drm/i915/intel_display.c +8 -1
@@ -5829,13 +5829,26 @@ 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 set
 = M1_N1)  
 {                                                                              
+       struct intel_link_m_n *dp_m_n,
 *dp_m2_n2;                               
+                                                                               
+       if (set == M1_N1)
 {                                                     
+               dp_m_n =
 &crtc->config.dp_m_n;                                  
+               dp_m2_n2 =
 &crtc->config.dp_m2_n2;                              
+       } else if (set == M2_N2)
 {                                              
+               /* Only one register programming is supported

*/
+ dp_m_n =
&crtc->config.dp_m_n;
+ dp_m2_n2 =
NULL;
+ } else
{
+ DRM_ERROR("Unsupported divider value
\n");
+
return;

drivers/gpu/drm/i915/intel_display.c +2 -0
+       }                                                                       
+                                                                               
        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_dp.c +0 -0
index b315292..784b8dd

100644
---
a/drivers/gpu/drm/i915/intel_dp.c
+++
b/drivers/gpu/drm/i915/intel_dp.c

drivers/gpu/drm/i915/intel_dp.c +0 -0
@@ -4817,11 +4817,10 @@ static void intel_dp_set_drrs_state(struct
 drm_device *dev, int refresh_rate)
        if (INTEL_INFO(dev)->gen >= 8 && !IS_CHERRYVIEW(dev))
 {                 
                switch(index)
 {                                                 
                case

DRRS_HIGH_RR:
-
intel_dp_set_m_n(intel_crtc);
+ intel_dp_set_m_n(intel_crtc,
M1_N1);

break;
case
DRRS_LOW_RR:
-
intel_cpu_transcoder_set_m_n(intel_crtc,
- &intel_crtc->config.dp_m2_n2,
NULL);
+ intel_dp_set_m_n(intel_crtc,
M2_N2);

break;
case
DRRS_MAX_RR:

default:

drivers/gpu/drm/i915/intel_dp.c +0 -0
@@ -4835,7 +4834,6 @@ static void intel_dp_set_drrs_state(struct
 drm_device *dev, int refresh_rate)
                                val |=
 PIPECONF_EDP_RR_MODE_SWITCH_VLV;         
 

else

                                val |=
PIPECONF_EDP_RR_MODE_SWITCH;             
-
intel_dp_set_m_n(intel_crtc);                           
                } else
{                                                        
                        if
(IS_VALLEYVIEW(dev))                                 
                                val &=

~PIPECONF_EDP_RR_MODE_SWITCH_VLV;

drivers/gpu/drm/i915/intel_drv.h +0 -0
index 86d31f2..910e613

100644
---
a/drivers/gpu/drm/i915/intel_drv.h
+++
b/drivers/gpu/drm/i915/intel_drv.h

drivers/gpu/drm/i915/intel_drv.h +0 -0
@@ -595,6 +595,12 @@ struct intel_hdmi
 {                                        
 struct
 intel_dp_mst_encoder;                                                   
 #define DP_MAX_DOWNSTREAM_PORTS

0x10

Quoted 8 lines

+enum link_m_n_set
{
+ M1_N1 =
0,
+
M2_N2,
+
DIVIDER_MAX

do we need this divider_max here?

Quoted 18 lines
drivers/gpu/drm/i915/intel_drv.h +2 -0
+};                                                                             
+                                                                               
 struct intel_dp
{                                                              
        uint32_t
output_reg;                                                    
        uint32_t

aux_ch_ctl_reg;

drivers/gpu/drm/i915/intel_drv.h +0 -1
@@ -983,7 +989,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_config
 *pipe_config);                   
-void intel_dp_set_m_n(struct intel_crtc

*crtc);

Quoted 37 lines

+void intel_dp_set_m_n(struct intel_crtc *crtc, enum link_m_n_set set = M1_N1);
void intel_cpu_transcoder_set_m_n(struct intel_crtc
*crtc,
struct intel_link_m_n
*m_n,
struct intel_link_m_n
*m2_n2);

Signature · 1 line
1.7.9.5   
Quoted 20 lines
Quoted 20 lines
drivers/gpu/drm/i915/intel_display.c +0 -0
                        I915_WRITE(PIPE_DATA_M2(transcoder),
                                        TU_SIZE(m2_n2->tu) | m2_n2->gmch_m);
                        I915_WRITE(PIPE_DATA_N2(transcoder), m2_n2->gmch_n);
drivers/gpu/drm/i915/intel_dp.c +1 -2
index 3362d93..42195fe 100644
@@ -4802,7 +4802,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);
--

2.0.1

Quoted 6 lines
Quoted 4 lines

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

--Ram

But overall it is better and much more clear than previous version. Thanks

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

#35 lore raw

Re: [PATCH 7/10] drm/i915: Enable eDP DRRS for CHV

Quoted 184 lines · Rodrigo Vivi
Quoted 183 lines · Ramalingam C

Hi

Quoted 18 lines · Rodrigo Vivi
Quoted 16 lines · Vandana Kannan

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()

---
  drivers/gpu/drm/i915/intel_display.c | 4 ++--
  drivers/gpu/drm/i915/intel_dp.c      | 2 +-
  2 files changed, 3 insertions(+), 3 deletions(-)
Quoted 15 lines

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

Quoted 12 lines
drivers/gpu/drm/i915/intel_display.c +2 -2
index 25596ca..bb44fb9 100644
@@ -5810,8 +5810,8 @@ 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 &&
-                       crtc->config.has_drrs) {
+               if (m2_n2 && (IS_CHERRYVIEW(dev) || INTEL_INFO(dev)->gen < 8)
+                       && crtc->config.has_drrs) {

This change here doesn't seem safe. As I told on previous comment I'd prefer changing intel_dp_set_m_n instead of re-using this intel_cpu one...

Though I am rewriting the intel_dp_set_m_n() that will reuse intel_cpu_transcoder_set_m_n() within.
But as a result, i am going to avoid the parallel usage of intel_cpu_transcoder_set_m_n() and intel_dp_set_m_n(). So I am afraid this check for inclusion of cherryview for m2_n2 programming will be part of the newer code also.

Appending the RFC for the newer intel_dp_set_m_n() implementation below. Please review.

RFC starts here:

  drivers/gpu/drm/i915/intel_display.c |   19
++++++++++++++++---
  drivers/gpu/drm/i915/intel_dp.c      |    6
++----
  drivers/gpu/drm/i915/intel_drv.h     |    8
+++++++-
  3 files changed, 25 insertions(+), 8 deletions(-)
drivers/gpu/drm/i915/intel_display.c +0 -0
index 061a253..59cc87f

100644
---
a/drivers/gpu/drm/i915/intel_display.c
+++
b/drivers/gpu/drm/i915/intel_display.c

drivers/gpu/drm/i915/intel_display.c +8 -1
@@ -5829,13 +5829,26 @@ 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 set
 = M1_N1)
  {
+       struct intel_link_m_n *dp_m_n,
 *dp_m2_n2;
+
+       if (set == M1_N1)
 {
+               dp_m_n =
 &crtc->config.dp_m_n;
+               dp_m2_n2 =
 &crtc->config.dp_m2_n2;
+       } else if (set == M2_N2)
 {
+               /* Only one register programming is supported

*/
+ dp_m_n =
&crtc->config.dp_m_n;
+ dp_m2_n2 =
NULL;
+ } else
{
+ DRM_ERROR("Unsupported divider value
\n");
+
return;

drivers/gpu/drm/i915/intel_display.c +2 -0
+       }
+
         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_dp.c +0 -0
index b315292..784b8dd

100644
---
a/drivers/gpu/drm/i915/intel_dp.c
+++
b/drivers/gpu/drm/i915/intel_dp.c

drivers/gpu/drm/i915/intel_dp.c +0 -0
@@ -4817,11 +4817,10 @@ static void intel_dp_set_drrs_state(struct
 drm_device *dev, int refresh_rate)
         if (INTEL_INFO(dev)->gen >= 8 && !IS_CHERRYVIEW(dev))
 {
                 switch(index)
 {
                 case

DRRS_HIGH_RR:
-
intel_dp_set_m_n(intel_crtc);
+ intel_dp_set_m_n(intel_crtc,
M1_N1);

break;
case
DRRS_LOW_RR:
-
intel_cpu_transcoder_set_m_n(intel_crtc,
- &intel_crtc->config.dp_m2_n2,
NULL);
+ intel_dp_set_m_n(intel_crtc,
M2_N2);

break;
case
DRRS_MAX_RR:

default:

drivers/gpu/drm/i915/intel_dp.c +0 -0
@@ -4835,7 +4834,6 @@ static void intel_dp_set_drrs_state(struct
 drm_device *dev, int refresh_rate)
                                 val |=
 PIPECONF_EDP_RR_MODE_SWITCH_VLV;
 

else

                                 val |=
PIPECONF_EDP_RR_MODE_SWITCH;
-
intel_dp_set_m_n(intel_crtc);
                 } else
{
                         if
(IS_VALLEYVIEW(dev))
                                 val &=

~PIPECONF_EDP_RR_MODE_SWITCH_VLV;

drivers/gpu/drm/i915/intel_drv.h +0 -0
index 86d31f2..910e613

100644
---
a/drivers/gpu/drm/i915/intel_drv.h
+++
b/drivers/gpu/drm/i915/intel_drv.h

drivers/gpu/drm/i915/intel_drv.h +0 -0
@@ -595,6 +595,12 @@ struct intel_hdmi
 {
  struct
 intel_dp_mst_encoder;
  #define DP_MAX_DOWNSTREAM_PORTS

0x10

Quoted 9 lines
Quoted 8 lines

+enum link_m_n_set
{
+ M1_N1 =
0,
+
M2_N2,
+
DIVIDER_MAX

do we need this divider_max here?

We dont need this. Removed it in the original patch.

Quoted 48 lines
Quoted 48 lines
drivers/gpu/drm/i915/intel_drv.h +2 -0
+};
+
  struct intel_dp
{
         uint32_t
output_reg;
         uint32_t

aux_ch_ctl_reg;

drivers/gpu/drm/i915/intel_drv.h +0 -1
@@ -983,7 +989,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_config
 *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 set = M1_N1);
void intel_cpu_transcoder_set_m_n(struct intel_crtc
*crtc,
struct intel_link_m_n
*m_n,
struct intel_link_m_n
*m2_n2);
--
1.7.9.5

Quoted 19 lines
Quoted 19 lines
drivers/gpu/drm/i915/intel_display.c +0 -0
                         I915_WRITE(PIPE_DATA_M2(transcoder),
                                         TU_SIZE(m2_n2->tu) | m2_n2->gmch_m);
                         I915_WRITE(PIPE_DATA_N2(transcoder), m2_n2->gmch_n);
drivers/gpu/drm/i915/intel_dp.c +1 -2
index 3362d93..42195fe 100644
@@ -4802,7 +4802,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);
--

2.0.1

Quoted 8 lines
Quoted 6 lines
Quoted 5 lines
Quoted 4 lines

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

--Ram

But overall it is better and much more clear than previous version.

I have submitted this change for the intel_dp_set_m_n() as V2 of patch set 5/10. So this patch [7/10] doesn't have any change.

Quoted 2 lines

Thanks

--Ram

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

Reviewed-by on v3 7/10
#36 lore raw

Re: [PATCH 7/10] drm/i915: Enable eDP DRRS for CHV

In reply to Vandana Kannan
Quoted 51 lines · Vandana Kannan

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()

---
 drivers/gpu/drm/i915/intel_display.c | 4 ++--
 drivers/gpu/drm/i915/intel_dp.c      | 2 +-
 2 files changed, 3 insertions(+), 3 deletions(-)
drivers/gpu/drm/i915/intel_display.c +2 -2
index 25596ca..bb44fb9 100644
@@ -5810,8 +5810,8 @@ 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 &&
-                       crtc->config.has_drrs) {
+               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);
                        I915_WRITE(PIPE_DATA_N2(transcoder), m2_n2->gmch_n);
drivers/gpu/drm/i915/intel_dp.c +1 -2
index 3362d93..42195fe 100644
@@ -4802,7 +4802,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);
--

2.0.1

_______________________________________________
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
#37 lore raw

PATCH v3 8/10 Documentation/drm: DocBook integration for DRRS

In reply to Vandana Kannan

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 3b2571e..8c844b4 100644
@@ -4042,6 +4042,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
2.0.1

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

Re: [PATCH 8/10] Documentation/drm: DocBook integration for DRRS

Great!

Although I'd prefer at intel_drrs.c.. ;)

Quoted 179 lines · Vandana Kannan

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 3b2571e..8c844b4 100644
@@ -4042,6 +4042,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 -1
index 42195fe..eda90d6 100644
@@ -4745,6 +4745,18 @@ intel_dp_init_panel_power_sequencer_registers(struct drm_device *dev,
                      I915_READ(pp_div_reg));
 }
 
+/**
+ * intel_dp_set_drrs_state - program registers for RR switch to take effect
+ * @dev: DRM device
+ * @refresh_rate: RR to be programmed
+ *
+ * This function gets called when refresh rate (RR) has to be changed from
+ * one frequency to another. Switches can be between high and low RR
+ * supported by the panel or to any other RR based on media playback (in
+ * this case, RR value needs to be passed from user space).
+ *
+ * The caller of this function needs to take a lock on dev_priv->drrs.
+ */
 static void intel_dp_set_drrs_state(struct drm_device *dev, int refresh_rate)
 {
        struct drm_i915_private *dev_priv = dev->dev_private;
@@ -4838,6 +4850,12 @@ static void intel_dp_set_drrs_state(struct drm_device *dev, int refresh_rate)
        DRM_DEBUG_KMS("eDP Refresh Rate set to : %dHz\n", refresh_rate);
 }
 
+/**
+ * intel_edp_drrs_enable - init drrs struct if supported
+ * @intel_dp: DP struct
+ *
+ * Initializes frontbuffer_bits and drrs.dp
+ */
 void intel_edp_drrs_enable(struct intel_dp *intel_dp)
 {
        struct drm_device *dev = intel_dp_to_dev(intel_dp);
@@ -4864,6 +4882,11 @@ void intel_edp_drrs_enable(struct intel_dp *intel_dp)
        mutex_unlock(&dev_priv->drrs.mutex);
 }
 
+/**
+ * intel_edp_drrs_disable - Disable DRRS
+ * @intel_dp: DP struct
+ *
+ */
 void intel_edp_drrs_disable(struct intel_dp *intel_dp)
 {
        struct drm_device *dev = intel_dp_to_dev(intel_dp);
@@ -4921,6 +4944,17 @@ unlock:
        mutex_unlock(&dev_priv->drrs.mutex);
 }
 
+/**
+ * intel_edp_drrs_invalidate - Invalidate DRRS
+ * @dev: DRM device
+ * @frontbuffer_bits: frontbuffer plane tracking bits
+ *
+ * When there is a disturbance on screen (due to cursor movement/time
+ * update etc), DRRS needs to be invalidated, i.e. need to switch to
+ * high RR.
+ *
+ * Dirty frontbuffers relevant to DRRS are tracked in busy_frontbuffer_bits.
+ */
 void intel_edp_drrs_invalidate(struct drm_device *dev,
                unsigned frontbuffer_bits)
 {
@@ -4948,6 +4982,17 @@ void intel_edp_drrs_invalidate(struct drm_device *dev,
        mutex_unlock(&dev_priv->drrs.mutex);
 }
 
+/**
+ * intel_edp_drrs_flush - Flush DRRS
+ * @dev: DRM device
+ * @frontbuffer_bits: frontbuffer plane tracking bits
+ *
+ * When there is no movement on screen, DRRS work can be scheduled.
+ * This DRRS work is responsible for setting relevant registers after a
+ * timeout of 1 second.
+ *
+ * Dirty frontbuffers relevant to DRRS are tracked in busy_frontbuffer_bits.
+ */
 void intel_edp_drrs_flush(struct drm_device *dev,
                unsigned frontbuffer_bits)
 {
@@ -4972,6 +5017,56 @@ void intel_edp_drrs_flush(struct drm_device *dev,
        mutex_unlock(&dev_priv->drrs.mutex);
 }
 
+/**
+ * DOC: Display Refresh Rate Switching (DRRS)
+ *
+ * Display Refresh Rate Switching (DRRS) is a power conservation feature
+ * which enables swtching between low and high refresh rates,
+ * dynamically, based on the usage scenario. This feature is applicable
+ * for internal panels.
+ *
+ * Indication that the panel supports DRRS is given by the panel EDID, which
+ * would list multiple refresh rates for one resolution.
+ *
+ * DRRS is of 2 types - static and seamless.
+ * Static DRRS involves changing refresh rate (RR) by doing a full modeset
+ * (may appear as a blink on screen) and is used in dock-undock scenario.
+ * Seamless DRRS involves changing RR without any visual effect to the user
+ * and can be used during normal system usage. This is done by programming
+ * certain registers.
+ *
+ * Support for static/seamless DRRS may be indicated in the VBT based on
+ * inputs from the panel spec.
+ *
+ * DRRS saves power by switching to low RR based on usage scenarios.
+ *
+ * eDP DRRS:-
+ *        The implementation is based on frontbuffer tracking implementation.
+ * When there is a disturbance on the screen triggered by user activity or a
+ * periodic system activity, DRRS is disabled (RR is changed to high RR).
+ * When there is no movement on screen, after a timeout of 1 second, a switch
+ * to low RR is made.
+ *        For integration with frontbuffer tracking code,
+ * intel_edp_drrs_invalidate() and intel_edp_drrs_flush() are called.
+ *
+ * DRRS can be further extended to support other internal panels and also
+ * the scenario of video playback wherein RR is set based on the rate
+ * requested by userspace.
+ */
+
+/**
+ * intel_dp_drrs_init - Init basic DRRS work and mutex.
+ * @intel_connector: eDP connector
+ * @fixed_mode: preferred mode of panel
+ *
+ * This function is  called only once at driver load to initialize basic
+ * DRRS stuff.
+ *
+ * Returns:
+ * Downclock mode if panel supports it, else return NULL.
+ * DRRS support is determined by the presence of downclock mode (apart
+ * from VBT setting).
+ */
 static struct drm_display_mode *
 intel_dp_drrs_init(struct intel_connector *intel_connector,
                struct drm_display_mode *fixed_mode)
--

2.0.1

_______________________________________________
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
#39 lore raw

Re: [PATCH 8/10] Documentation/drm: DocBook integration for DRRS

Quoted 17 lines · Rodrigo Vivi

Great!

Although I'd prefer at intel_drrs.c.. ;)

Quoted 9 lines · Vandana Kannan

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(+)
Quoted 16 lines
Quoted 6 lines
Documentation/DocBook/drm.tmpl +0 -0
index 3b2571e..8c844b4 100644
@@ -4042,6 +4042,17 @@ int num_ioctls;</synopsis>
 !Idrivers/gpu/drm/i915/intel_fbc.c

Documentation/DocBook/drm.tmpl int num_ioctls;</synopsis> · line 4052

Quoted 10 lines
Documentation/DocBook/drm.tmpl +8 -0
       </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

Yeah extracting intel_drrs.c would be better since then we could just slurp in everything from that file. But better to do that once the patches have all been merged.

Wrt the series I've merged the first patch, for the others there seems to still be some review comments (and a bit of rebasing) pending. -Daniel

Quoted 164 lines
Quoted 154 lines
Documentation/DocBook/drm.tmpl +3 -0
+
+      </sect2>
+      <sect2>
         <title>DPIO</title>
 !Pdrivers/gpu/drm/i915/i915_reg.h DPIO
        <table id="dpiox2">
drivers/gpu/drm/i915/intel_dp.c +95 -1
index 42195fe..eda90d6 100644
@@ -4745,6 +4745,18 @@ intel_dp_init_panel_power_sequencer_registers(struct drm_device *dev,
                      I915_READ(pp_div_reg));
 }
 
+/**
+ * intel_dp_set_drrs_state - program registers for RR switch to take effect
+ * @dev: DRM device
+ * @refresh_rate: RR to be programmed
+ *
+ * This function gets called when refresh rate (RR) has to be changed from
+ * one frequency to another. Switches can be between high and low RR
+ * supported by the panel or to any other RR based on media playback (in
+ * this case, RR value needs to be passed from user space).
+ *
+ * The caller of this function needs to take a lock on dev_priv->drrs.
+ */
 static void intel_dp_set_drrs_state(struct drm_device *dev, int refresh_rate)
 {
        struct drm_i915_private *dev_priv = dev->dev_private;
@@ -4838,6 +4850,12 @@ static void intel_dp_set_drrs_state(struct drm_device *dev, int refresh_rate)
        DRM_DEBUG_KMS("eDP Refresh Rate set to : %dHz\n", refresh_rate);
 }
 
+/**
+ * intel_edp_drrs_enable - init drrs struct if supported
+ * @intel_dp: DP struct
+ *
+ * Initializes frontbuffer_bits and drrs.dp
+ */
 void intel_edp_drrs_enable(struct intel_dp *intel_dp)
 {
        struct drm_device *dev = intel_dp_to_dev(intel_dp);
@@ -4864,6 +4882,11 @@ void intel_edp_drrs_enable(struct intel_dp *intel_dp)
        mutex_unlock(&dev_priv->drrs.mutex);
 }
 
+/**
+ * intel_edp_drrs_disable - Disable DRRS
+ * @intel_dp: DP struct
+ *
+ */
 void intel_edp_drrs_disable(struct intel_dp *intel_dp)
 {
        struct drm_device *dev = intel_dp_to_dev(intel_dp);
@@ -4921,6 +4944,17 @@ unlock:
        mutex_unlock(&dev_priv->drrs.mutex);
 }
 
+/**
+ * intel_edp_drrs_invalidate - Invalidate DRRS
+ * @dev: DRM device
+ * @frontbuffer_bits: frontbuffer plane tracking bits
+ *
+ * When there is a disturbance on screen (due to cursor movement/time
+ * update etc), DRRS needs to be invalidated, i.e. need to switch to
+ * high RR.
+ *
+ * Dirty frontbuffers relevant to DRRS are tracked in busy_frontbuffer_bits.
+ */
 void intel_edp_drrs_invalidate(struct drm_device *dev,
                unsigned frontbuffer_bits)
 {
@@ -4948,6 +4982,17 @@ void intel_edp_drrs_invalidate(struct drm_device *dev,
        mutex_unlock(&dev_priv->drrs.mutex);
 }
 
+/**
+ * intel_edp_drrs_flush - Flush DRRS
+ * @dev: DRM device
+ * @frontbuffer_bits: frontbuffer plane tracking bits
+ *
+ * When there is no movement on screen, DRRS work can be scheduled.
+ * This DRRS work is responsible for setting relevant registers after a
+ * timeout of 1 second.
+ *
+ * Dirty frontbuffers relevant to DRRS are tracked in busy_frontbuffer_bits.
+ */
 void intel_edp_drrs_flush(struct drm_device *dev,
                unsigned frontbuffer_bits)
 {
@@ -4972,6 +5017,56 @@ void intel_edp_drrs_flush(struct drm_device *dev,
        mutex_unlock(&dev_priv->drrs.mutex);
 }
 
+/**
+ * DOC: Display Refresh Rate Switching (DRRS)
+ *
+ * Display Refresh Rate Switching (DRRS) is a power conservation feature
+ * which enables swtching between low and high refresh rates,
+ * dynamically, based on the usage scenario. This feature is applicable
+ * for internal panels.
+ *
+ * Indication that the panel supports DRRS is given by the panel EDID, which
+ * would list multiple refresh rates for one resolution.
+ *
+ * DRRS is of 2 types - static and seamless.
+ * Static DRRS involves changing refresh rate (RR) by doing a full modeset
+ * (may appear as a blink on screen) and is used in dock-undock scenario.
+ * Seamless DRRS involves changing RR without any visual effect to the user
+ * and can be used during normal system usage. This is done by programming
+ * certain registers.
+ *
+ * Support for static/seamless DRRS may be indicated in the VBT based on
+ * inputs from the panel spec.
+ *
+ * DRRS saves power by switching to low RR based on usage scenarios.
+ *
+ * eDP DRRS:-
+ *        The implementation is based on frontbuffer tracking implementation.
+ * When there is a disturbance on the screen triggered by user activity or a
+ * periodic system activity, DRRS is disabled (RR is changed to high RR).
+ * When there is no movement on screen, after a timeout of 1 second, a switch
+ * to low RR is made.
+ *        For integration with frontbuffer tracking code,
+ * intel_edp_drrs_invalidate() and intel_edp_drrs_flush() are called.
+ *
+ * DRRS can be further extended to support other internal panels and also
+ * the scenario of video playback wherein RR is set based on the rate
+ * requested by userspace.
+ */
+
+/**
+ * intel_dp_drrs_init - Init basic DRRS work and mutex.
+ * @intel_connector: eDP connector
+ * @fixed_mode: preferred mode of panel
+ *
+ * This function is  called only once at driver load to initialize basic
+ * DRRS stuff.
+ *
+ * Returns:
+ * Downclock mode if panel supports it, else return NULL.
+ * DRRS support is determined by the presence of downclock mode (apart
+ * from VBT setting).
+ */
 static struct drm_display_mode *
 intel_dp_drrs_init(struct intel_connector *intel_connector,
                struct drm_display_mode *fixed_mode)
--

2.0.1

_______________________________________________
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
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
#40 lore raw

PATCH v3 9/10 drm/i915: Add debugfs entry for DRRS

In reply to Vandana Kannan

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

---
 drivers/gpu/drm/i915/i915_debugfs.c | 18 ++++++++++++++++++
 1 file changed, 18 insertions(+)
drivers/gpu/drm/i915/i915_debugfs.c +18 -0
index e515aad..544b4c3 100644
@@ -2825,6 +2825,23 @@ static int i915_ddb_info(struct seq_file *m, void *unused)
 	return 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 *crtc;
+
+	for_each_intel_crtc(dev, crtc) {
+		if (crtc->active) {
+			if (crtc->config.has_drrs)
+				seq_puts(m, "DRRS enabled");
+			else
+				seq_puts(m, "DRRS disabled");
+		}
+	}
+	return 0;
+}
+
 struct pipe_crc_info {
 	const char *name;
 	struct drm_device *dev;
@@ -4437,6 +4454,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
2.0.1

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

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

Quoted 13 lines · Vandana Kannan

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

---
 drivers/gpu/drm/i915/i915_debugfs.c | 18 ++++++++++++++++++
 1 file changed, 18 insertions(+)
drivers/gpu/drm/i915/i915_debugfs.c +0 -0
index e515aad..544b4c3 100644
@@ -2825,6 +2825,23 @@ 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 2835

Quoted 10 lines
drivers/gpu/drm/i915/i915_debugfs.c +8 -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 *crtc;
+
+	for_each_intel_crtc(dev, crtc) {
+		if (crtc->active) {

Don't you want to know which CRTC this is? Would this not be better extending display_info with the extra CRTC status?

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

Quoted 6 lines
drivers/gpu/drm/i915/i915_debugfs.c +6 -0
+			if (crtc->config.has_drrs)
+				seq_puts(m, "DRRS enabled");
+			else
+				seq_puts(m, "DRRS disabled");
+		}
+	}

-Chris

Signature · 5 lines
Chris Wilson, Intel Open Source Technology Centre
_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
#42 lore raw

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

Quoted 16 lines · Chris Wilson
Quoted 15 lines · Vandana Kannan

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

---
 drivers/gpu/drm/i915/i915_debugfs.c | 18 ++++++++++++++++++
 1 file changed, 18 insertions(+)
drivers/gpu/drm/i915/i915_debugfs.c +0 -0
index e515aad..544b4c3 100644
@@ -2825,6 +2825,23 @@ static int i915_ddb_info(struct seq_file *m, void *unused)
      return 0;
 }
 
Quoted 13 lines

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

Quoted 8 lines
drivers/gpu/drm/i915/i915_debugfs.c +8 -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 *crtc;
+
+     for_each_intel_crtc(dev, crtc) {
+             if (crtc->active) {

Don't you want to know which CRTC this is? Would this not be better extending display_info with the extra CRTC status?

Quoted 1 line
drivers/gpu/drm/i915/i915_debugfs.c +1 -0
+                     if (crtc->config.has_drrs)

Also it just shows if panel supports drrs, not if it is enabled...

Quoted 13 lines

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

Quoted 5 lines
drivers/gpu/drm/i915/i915_debugfs.c +5 -0
+                             seq_puts(m, "DRRS enabled");
+                     else
+                             seq_puts(m, "DRRS disabled");
+             }
+     }

-Chris

--
Chris Wilson, Intel Open Source Technology Centre
_______________________________________________
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
#43 lore raw

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

Hi

Quoted 28 lines · Rodrigo Vivi
Quoted 27 lines · Chris Wilson
Quoted 13 lines · Vandana Kannan

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

---
  drivers/gpu/drm/i915/i915_debugfs.c | 18 ++++++++++++++++++
  1 file changed, 18 insertions(+)
drivers/gpu/drm/i915/i915_debugfs.c +0 -0
index e515aad..544b4c3 100644
@@ -2825,6 +2825,23 @@ 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 2835

Quoted 10 lines
drivers/gpu/drm/i915/i915_debugfs.c +8 -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 *crtc;
+
+     for_each_intel_crtc(dev, crtc) {
+             if (crtc->active) {

Don't you want to know which CRTC this is? Would this not be better extending display_info with the extra CRTC status?

Quoted 2 lines
Quoted 1 line

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

Quoted 1 line
drivers/gpu/drm/i915/i915_debugfs.c +1 -0
+                     if (crtc->config.has_drrs)

Also it just shows if panel supports drrs, not if it is enabled...

Yes. We need to provide information on the platform's DRRS capability, crtc and the current DRRS state (LOW_RR/HIGH_RR). I am working on the same.

Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
drivers/gpu/drm/i915/i915_debugfs.c +5 -0
+                             seq_puts(m, "DRRS enabled");
+                     else
+                             seq_puts(m, "DRRS disabled");
+             }
+     }
Quoted 10 lines
Quoted 8 lines

-Chris

--
Chris Wilson, Intel Open Source Technology Centre
_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx

--Ram

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

#44 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
---
 drivers/gpu/drm/i915/i915_debugfs.c |   93 +++++++++++++++++++++++++++++++++++
 1 file changed, 93 insertions(+)
drivers/gpu/drm/i915/i915_debugfs.c +93 -0
index 2ad4c48..47f1f65 100644
@@ -2819,6 +2819,98 @@ static int i915_ddb_info(struct seq_file *m, void *unused)
 	return 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 drm_i915_private *dev_priv = dev->dev_private;
+	struct i915_drrs *drrs = &dev_priv->drrs;
+	struct intel_crtc *intel_crtc;
+	struct intel_encoder *intel_encoder;
+	int active_crtc_cnt = 0, vrefresh = 0;
+
+	for_each_intel_crtc(dev, intel_crtc) {
+		if (intel_crtc->active) {
+			active_crtc_cnt++;
+			seq_puts(m, "CRTC");
+			seq_put_decimal_ull(m, ' ', active_crtc_cnt);
+			seq_puts(m, ":  ");
+			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_puts(m, "Output: Others (id");
+					seq_put_decimal_ull(m, '=',
+							intel_encoder->type);
+					seq_puts(m, "), ");
+				}
+			}
+
+			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), ");
+				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_puts(m, "DRRS_State: Unknown");
+					seq_put_decimal_ull(m, '(',
+						drrs->refresh_rate_type);
+					seq_puts(m, "), ");
+				}
+				seq_puts(m, "Vrefresh:");
+				seq_put_decimal_ull(m, ' ', 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");
+				}
+			}
+			seq_puts(m, "\n");
+		}
+	}
+
+	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;
@@ -4433,6 +4525,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
#45 lore raw

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

Quoted 103 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
---
 drivers/gpu/drm/i915/i915_debugfs.c |   93 +++++++++++++++++++++++++++++++++++
 1 file changed, 93 insertions(+)
drivers/gpu/drm/i915/i915_debugfs.c +72 -0
index 2ad4c48..47f1f65 100644
@@ -2819,6 +2819,98 @@ static int i915_ddb_info(struct seq_file *m, void *unused)
 	return 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 drm_i915_private *dev_priv = dev->dev_private;
+	struct i915_drrs *drrs = &dev_priv->drrs;
+	struct intel_crtc *intel_crtc;
+	struct intel_encoder *intel_encoder;
+	int active_crtc_cnt = 0, vrefresh = 0;
+
+	for_each_intel_crtc(dev, intel_crtc) {
+		if (intel_crtc->active) {
+			active_crtc_cnt++;
+			seq_puts(m, "CRTC");
+			seq_put_decimal_ull(m, ' ', active_crtc_cnt);
+			seq_puts(m, ":  ");
+			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_puts(m, "Output: Others (id");
+					seq_put_decimal_ull(m, '=',
+							intel_encoder->type);
+					seq_puts(m, "), ");
+				}
+			}
+
+			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), ");
+				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_puts(m, "DRRS_State: Unknown");
+					seq_put_decimal_ull(m, '(',
+						drrs->refresh_rate_type);
+					seq_puts(m, "), ");
+				}
+				seq_puts(m, "Vrefresh:");
+				seq_put_decimal_ull(m, ' ', 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,

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

Quoted 10 lines
drivers/gpu/drm/i915/i915_debugfs.c +10 -0
+						"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");
+				}
+			}

This is an example of were strictly following checkpatch warnings and pedantically breaking lines results in rather hard to read code:
The function is really long, and has about 6 indent levels. Imo it would greatly benefit from extracting some helper functions to do the inner-level printing. There's piles of examples in i915_debugfs where we loop over a bunch of objects and punt all the real output to a small helper function.
-Daniel

Quoted 28 lines
drivers/gpu/drm/i915/i915_debugfs.c +11 -0
+			seq_puts(m, "\n");
+		}
+	}
+
+	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;
@@ -4433,6 +4525,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
#46 lore raw

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

Quoted 114 lines · Daniel Vetter
Quoted 103 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
---
  drivers/gpu/drm/i915/i915_debugfs.c |   93 +++++++++++++++++++++++++++++++++++
  1 file changed, 93 insertions(+)
drivers/gpu/drm/i915/i915_debugfs.c +72 -0
index 2ad4c48..47f1f65 100644
@@ -2819,6 +2819,98 @@ static int i915_ddb_info(struct seq_file *m, void *unused)
  	return 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 drm_i915_private *dev_priv = dev->dev_private;
+	struct i915_drrs *drrs = &dev_priv->drrs;
+	struct intel_crtc *intel_crtc;
+	struct intel_encoder *intel_encoder;
+	int active_crtc_cnt = 0, vrefresh = 0;
+
+	for_each_intel_crtc(dev, intel_crtc) {
+		if (intel_crtc->active) {
+			active_crtc_cnt++;
+			seq_puts(m, "CRTC");
+			seq_put_decimal_ull(m, ' ', active_crtc_cnt);
+			seq_puts(m, ":  ");
+			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_puts(m, "Output: Others (id");
+					seq_put_decimal_ull(m, '=',
+							intel_encoder->type);
+					seq_puts(m, "), ");
+				}
+			}
+
+			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), ");
+				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_puts(m, "DRRS_State: Unknown");
+					seq_put_decimal_ull(m, '(',
+						drrs->refresh_rate_type);
+					seq_puts(m, "), ");
+				}
+				seq_puts(m, "Vrefresh:");
+				seq_put_decimal_ull(m, ' ', 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,

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

Quoted 10 lines
drivers/gpu/drm/i915/i915_debugfs.c +10 -0
+						"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");
+				}
+			}
Quoted 8 lines

This is an example of were strictly following checkpatch warnings and pedantically breaking lines results in rather hard to read code:
The function is really long, and has about 6 indent levels. Imo it would greatly benefit from extracting some helper functions to do the inner-level printing. There's piles of examples in i915_debugfs where we loop over a bunch of objects and punt all the real output to a small helper function.
-Daniel

Thanks Daniel. Submitting a patch in few mins. --Ram

Quoted 21 lines
Quoted 21 lines
drivers/gpu/drm/i915/i915_debugfs.c +11 -0
+			seq_puts(m, "\n");
+		}
+	}
+
+	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;
@@ -4433,6 +4525,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

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

#47 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]

---
 drivers/gpu/drm/i915/i915_debugfs.c |   85 +++++++++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)
drivers/gpu/drm/i915/i915_debugfs.c +85 -0
index 2ad4c48..45beb32 100644
@@ -2819,6 +2819,90 @@ 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), ");
+		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;
@@ -4433,6 +4517,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
Reviewed-by on v1 1/1
#48 lore raw

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

Quoted 131 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]

---
 drivers/gpu/drm/i915/i915_debugfs.c |   85 +++++++++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)
drivers/gpu/drm/i915/i915_debugfs.c +85 -1
index 2ad4c48..45beb32 100644
@@ -2819,6 +2819,90 @@ 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), ");
+               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;
@@ -4433,6 +4517,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

Debug still don't show current enabled/disabled drrs status. it also could have frontbuffer bits...

Anyway this one looks ok and better than first version 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
#49 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]

---
 drivers/gpu/drm/i915/i915_debugfs.c |   99 +++++++++++++++++++++++++++++++++++
 1 file changed, 99 insertions(+)
drivers/gpu/drm/i915/i915_debugfs.c +99 -0
index 9af17fb..a2f702a 100644
@@ -2855,6 +2855,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;
@@ -4469,6 +4567,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
#50 lore raw

PATCH v3 10/10 kms_drrs: Test DRRS entry and exit

In reply to Vandana Kannan

This test just display a frame on screen, waits for 1 second to enter DRRS and displays another frame to exit DRRS.
TODO:- Notify the user about which refresh rate was used at different stages.

---
 tests/Makefile.sources |   1 +
 tests/kms_drrs.c       | 225 +++++++++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 226 insertions(+)
 mode change 100644 => 100755 tests/Makefile.sources
 create mode 100644 tests/kms_drrs.c
tests/Makefile.sources +1 -0
old mode 100644
new mode 100755
index 967dc8f..fbc0977
@@ -64,6 +64,7 @@ TESTS_progs_M = \
 	gem_write_read_ring_switch \
 	kms_addfb \
 	kms_cursor_crc \
+	kms_drrs \
 	kms_fbc_crc \
 	kms_flip \
 	kms_flip_event_leak \
tests/kms_drrs.c new file +225 -0

225 lines not on this page · raw message

Signature · 6 lines
2.0.1

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

Re: [PATCH 10/10] kms_drrs: Test DRRS entry and exit

I didn't get how it shows different rates if the i915_drrs_status only shows if panel supports or not.

Maybe the debugfs file could contain more info for each crtc connect, crtc info, if panel connected there supports, if it is enabled and also current freq.. then parse all here properly.

But one thing I don't know how to cover but it would be good is to check for flickers...

Quoted 264 lines · Vandana Kannan

This test just display a frame on screen, waits for 1 second to enter DRRS and displays another frame to exit DRRS.
TODO:- Notify the user about which refresh rate was used at different stages.

---
 tests/Makefile.sources |   1 +
 tests/kms_drrs.c       | 225 +++++++++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 226 insertions(+)
 mode change 100644 => 100755 tests/Makefile.sources
 create mode 100644 tests/kms_drrs.c
tests/Makefile.sources +1 -0
old mode 100644
new mode 100755
index 967dc8f..fbc0977
@@ -64,6 +64,7 @@ TESTS_progs_M = \
        gem_write_read_ring_switch \
        kms_addfb \
        kms_cursor_crc \
+       kms_drrs \
        kms_fbc_crc \
        kms_flip \
        kms_flip_event_leak \
tests/kms_drrs.c new file +225 -1
new file mode 100644
index 0000000..5a360f3
@@ -0,0 +1,225 @@
+/*
+ * Copyright © 2013 Intel Corporation
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the next
+ * paragraph) shall be included in all copies or substantial portions of the
+ * Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
+ * IN THE SOFTWARE.
+ *
+ */
+
+#include "drmtest.h"
+#include "igt_debugfs.h"
+#include "igt_kms.h"
+#include "intel_chipset.h"
+#include "intel_batchbuffer.h"
+#include "ioctl_wrappers.h"
+
+IGT_TEST_DESCRIPTION(
+"Performs write operations and then waits for DRRS to be enabled and then "
+"disturbs the contents of the screen once again to disable DRRS.");
+
+typedef struct {
+       int drm_fd;
+       uint32_t devid;
+       uint32_t handle[2];
+       igt_display_t display;
+       igt_output_t *output;
+       enum pipe pipe;
+       igt_plane_t *primary;
+       struct igt_fb fb[2];
+       uint32_t fb_id[2];
+} data_t;
+
+static bool drrs_enabled(data_t *data)
+{
+       FILE *status;
+       char str[64] = {};
+
+       status = igt_debugfs_fopen("i915_drrs_status", "r");
+       igt_assert(status);
+
+       fread(str, sizeof(str) - 1, 1, status);
+       fclose(status);
+       return strstr(str, "DRRS enabled") != NULL;
+}
+
+static bool prepare_crtc(data_t *data)
+{
+       igt_display_t *display = &data->display;
+       igt_output_t *output = data->output;
+
+       /* select the pipe we want to use */
+       igt_output_set_pipe(output, data->pipe);
+       igt_display_commit(display);
+
+       if (!output->valid) {
+               igt_output_set_pipe(output, PIPE_ANY);
+               igt_display_commit(display);
+               return false;
+       }
+
+       return true;
+}
+
+static bool prepare_test(data_t *data)
+{
+       igt_display_t *display = &data->display;
+       igt_output_t *output = data->output;
+       drmModeModeInfo *mode;
+
+       data->primary = igt_output_get_plane(data->output, IGT_PLANE_PRIMARY);
+       mode = igt_output_get_mode(data->output);
+
+       data->fb_id[0] = igt_create_color_fb(data->drm_fd, mode->hdisplay, mode->vdisplay,
+                       DRM_FORMAT_XRGB8888,
+                       I915_TILING_X,
+                       0.0, 0.0, 0.0, &data->fb[0]);
+       igt_assert(data->fb_id[0]);
+       data->fb_id[1] = igt_create_color_fb(data->drm_fd, mode->hdisplay, mode->vdisplay,
+                       DRM_FORMAT_XRGB8888,
+                       I915_TILING_X,
+                       0.1, 0.1, 0.1,
+                       &data->fb[1]);
+       igt_assert(data->fb_id[1]);
+
+       data->handle[0] = data->fb[0].gem_handle;
+       data->handle[1] = data->fb[1].gem_handle;
+
+       /* scanout = fb[1] */
+       igt_plane_set_fb(data->primary, &data->fb[1]);
+       igt_display_commit(display);
+       usleep(1000000);
+
+       if (!drrs_enabled(data)) {
+               igt_info("DRRS not enabled\n");
+
+               igt_plane_set_fb(data->primary, NULL);
+               igt_output_set_pipe(output, PIPE_ANY);
+               igt_display_commit(display);
+
+               igt_remove_fb(data->drm_fd, &data->fb[0]);
+               igt_remove_fb(data->drm_fd, &data->fb[1]);
+               return false;
+       }
+
+       igt_wait_for_vblank(data->drm_fd, data->pipe);
+
+       /* scanout = fb[0] */
+       igt_plane_set_fb(data->primary, &data->fb[0]);
+       igt_display_commit(display);
+       usleep(100000);
+
+       igt_wait_for_vblank(data->drm_fd, data->pipe);
+
+       return true;
+}
+
+static void finish_crtc(data_t *data)
+{
+       igt_plane_set_fb(data->primary, NULL);
+       igt_output_set_pipe(data->output, PIPE_ANY);
+       igt_display_commit(&data->display);
+
+       igt_remove_fb(data->drm_fd, &data->fb[0]);
+       igt_remove_fb(data->drm_fd, &data->fb[1]);
+}
+
+static void reset_display(data_t *data)
+{
+       igt_display_t *display = &data->display;
+
+       for_each_connected_output(display, data->output) {
+               if (data->output->valid) {
+                       data->primary =  igt_output_get_plane(data->output,
+                                                       IGT_PLANE_PRIMARY);
+                       igt_plane_set_fb(data->primary, NULL);
+               }
+               igt_output_set_pipe(data->output, PIPE_ANY);
+       }
+}
+
+static void run_test(data_t *data)
+{
+       igt_display_t *display = &data->display;
+       int valid_tests = 0;
+
+       reset_display(data);
+
+       for_each_connected_output(display, data->output) {
+               for_each_pipe(display, data->pipe) {
+                       if (!prepare_crtc(data))
+                               continue;
+
+                       igt_info("Beginning %s on pipe %s, connector %s\n",
+                                       igt_subtest_name(),
+                                       kmstest_pipe_name(data->pipe),
+                                       igt_output_name(data->output));
+
+                       if (!prepare_test(data)) {
+                               igt_info("%s on pipe %s, connector %s: SKIPPED\n",
+                                               igt_subtest_name(),
+                                               kmstest_pipe_name(data->pipe),
+                                               igt_output_name(data->output));
+                               continue;
+                       }
+
+                       valid_tests++;
+
+                       igt_info("%s on pipe %s, connector %s: PASSED\n",
+                                       igt_subtest_name(),
+                                       kmstest_pipe_name(data->pipe),
+                                       igt_output_name(data->output));
+
+                       finish_crtc(data);
+               }
+       }
+
+       igt_require_f(valid_tests, "no valid crtc/connector combinations found\n");
+}
+
+igt_main
+{
+       data_t data = {};
+
+       igt_skip_on_simulation();
+
+       igt_fixture {
+               char buf[64];
+               FILE *status;
+
+               data.drm_fd = drm_open_any_master();
+
+               data.devid = intel_get_drm_devid(data.drm_fd);
+
+               status = igt_debugfs_fopen("i915_drrs_status", "r");
+               igt_require_f(status, "No i915_drrs_status found\n");
+               fread(buf, sizeof(buf), 1, status);
+               fclose(status);
+               buf[sizeof(buf) - 1] = '\0';
+               igt_require_f(!strstr(buf, "disabled"),
+                               "DRRS not supported:check VBT/panel caps\n");
+
+               igt_display_init(&data.display, data.drm_fd);
+       }
+
+       run_test(&data);
+
+       igt_fixture {
+               igt_display_fini(&data.display);
+       }
+}
--

2.0.1

_______________________________________________
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
#52 lore raw

Re: [PATCH 10/10] kms_drrs: Test DRRS entry and exit

Quoted 6 lines · Rodrigo Vivi

I didn't get how it shows different rates if the i915_drrs_status only shows if panel supports or not.

Maybe the debugfs file could contain more info for each crtc connect, crtc info, if panel connected there supports, if it is enabled and also current freq.. then parse all here properly.

Yeah, giving the testcase minimal functional testing by making sure the kernel goes into low-RR mode when it should would be good. I think with fbc/psr tests we're more than covered on the functional side for testing that we don't miss updates.

Quoted 2 lines

But one thing I don't know how to cover but it would be good is to check for flickers...

I don't think that's possible unfortunately :( We just have to wait for random bug reports. Also this time around we do respect the various vbt and panel settings, so hopefully this works better than the old lvds drrs code we have merged already.
-Daniel

Quoted 276 lines
Quoted 264 lines · Vandana Kannan

This test just display a frame on screen, waits for 1 second to enter DRRS and displays another frame to exit DRRS.
TODO:- Notify the user about which refresh rate was used at different stages.

---
 tests/Makefile.sources |   1 +
 tests/kms_drrs.c       | 225 +++++++++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 226 insertions(+)
 mode change 100644 => 100755 tests/Makefile.sources
 create mode 100644 tests/kms_drrs.c
tests/Makefile.sources +1 -0
old mode 100644
new mode 100755
index 967dc8f..fbc0977
@@ -64,6 +64,7 @@ TESTS_progs_M = \
        gem_write_read_ring_switch \
        kms_addfb \
        kms_cursor_crc \
+       kms_drrs \
        kms_fbc_crc \
        kms_flip \
        kms_flip_event_leak \
tests/kms_drrs.c new file +225 -1
new file mode 100644
index 0000000..5a360f3
@@ -0,0 +1,225 @@
+/*
+ * Copyright © 2013 Intel Corporation
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the next
+ * paragraph) shall be included in all copies or substantial portions of the
+ * Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
+ * IN THE SOFTWARE.
+ *
+ */
+
+#include "drmtest.h"
+#include "igt_debugfs.h"
+#include "igt_kms.h"
+#include "intel_chipset.h"
+#include "intel_batchbuffer.h"
+#include "ioctl_wrappers.h"
+
+IGT_TEST_DESCRIPTION(
+"Performs write operations and then waits for DRRS to be enabled and then "
+"disturbs the contents of the screen once again to disable DRRS.");
+
+typedef struct {
+       int drm_fd;
+       uint32_t devid;
+       uint32_t handle[2];
+       igt_display_t display;
+       igt_output_t *output;
+       enum pipe pipe;
+       igt_plane_t *primary;
+       struct igt_fb fb[2];
+       uint32_t fb_id[2];
+} data_t;
+
+static bool drrs_enabled(data_t *data)
+{
+       FILE *status;
+       char str[64] = {};
+
+       status = igt_debugfs_fopen("i915_drrs_status", "r");
+       igt_assert(status);
+
+       fread(str, sizeof(str) - 1, 1, status);
+       fclose(status);
+       return strstr(str, "DRRS enabled") != NULL;
+}
+
+static bool prepare_crtc(data_t *data)
+{
+       igt_display_t *display = &data->display;
+       igt_output_t *output = data->output;
+
+       /* select the pipe we want to use */
+       igt_output_set_pipe(output, data->pipe);
+       igt_display_commit(display);
+
+       if (!output->valid) {
+               igt_output_set_pipe(output, PIPE_ANY);
+               igt_display_commit(display);
+               return false;
+       }
+
+       return true;
+}
+
+static bool prepare_test(data_t *data)
+{
+       igt_display_t *display = &data->display;
+       igt_output_t *output = data->output;
+       drmModeModeInfo *mode;
+
+       data->primary = igt_output_get_plane(data->output, IGT_PLANE_PRIMARY);
+       mode = igt_output_get_mode(data->output);
+
+       data->fb_id[0] = igt_create_color_fb(data->drm_fd, mode->hdisplay, mode->vdisplay,
+                       DRM_FORMAT_XRGB8888,
+                       I915_TILING_X,
+                       0.0, 0.0, 0.0, &data->fb[0]);
+       igt_assert(data->fb_id[0]);
+       data->fb_id[1] = igt_create_color_fb(data->drm_fd, mode->hdisplay, mode->vdisplay,
+                       DRM_FORMAT_XRGB8888,
+                       I915_TILING_X,
+                       0.1, 0.1, 0.1,
+                       &data->fb[1]);
+       igt_assert(data->fb_id[1]);
+
+       data->handle[0] = data->fb[0].gem_handle;
+       data->handle[1] = data->fb[1].gem_handle;
+
+       /* scanout = fb[1] */
+       igt_plane_set_fb(data->primary, &data->fb[1]);
+       igt_display_commit(display);
+       usleep(1000000);
+
+       if (!drrs_enabled(data)) {
+               igt_info("DRRS not enabled\n");
+
+               igt_plane_set_fb(data->primary, NULL);
+               igt_output_set_pipe(output, PIPE_ANY);
+               igt_display_commit(display);
+
+               igt_remove_fb(data->drm_fd, &data->fb[0]);
+               igt_remove_fb(data->drm_fd, &data->fb[1]);
+               return false;
+       }
+
+       igt_wait_for_vblank(data->drm_fd, data->pipe);
+
+       /* scanout = fb[0] */
+       igt_plane_set_fb(data->primary, &data->fb[0]);
+       igt_display_commit(display);
+       usleep(100000);
+
+       igt_wait_for_vblank(data->drm_fd, data->pipe);
+
+       return true;
+}
+
+static void finish_crtc(data_t *data)
+{
+       igt_plane_set_fb(data->primary, NULL);
+       igt_output_set_pipe(data->output, PIPE_ANY);
+       igt_display_commit(&data->display);
+
+       igt_remove_fb(data->drm_fd, &data->fb[0]);
+       igt_remove_fb(data->drm_fd, &data->fb[1]);
+}
+
+static void reset_display(data_t *data)
+{
+       igt_display_t *display = &data->display;
+
+       for_each_connected_output(display, data->output) {
+               if (data->output->valid) {
+                       data->primary =  igt_output_get_plane(data->output,
+                                                       IGT_PLANE_PRIMARY);
+                       igt_plane_set_fb(data->primary, NULL);
+               }
+               igt_output_set_pipe(data->output, PIPE_ANY);
+       }
+}
+
+static void run_test(data_t *data)
+{
+       igt_display_t *display = &data->display;
+       int valid_tests = 0;
+
+       reset_display(data);
+
+       for_each_connected_output(display, data->output) {
+               for_each_pipe(display, data->pipe) {
+                       if (!prepare_crtc(data))
+                               continue;
+
+                       igt_info("Beginning %s on pipe %s, connector %s\n",
+                                       igt_subtest_name(),
+                                       kmstest_pipe_name(data->pipe),
+                                       igt_output_name(data->output));
+
+                       if (!prepare_test(data)) {
+                               igt_info("%s on pipe %s, connector %s: SKIPPED\n",
+                                               igt_subtest_name(),
+                                               kmstest_pipe_name(data->pipe),
+                                               igt_output_name(data->output));
+                               continue;
+                       }
+
+                       valid_tests++;
+
+                       igt_info("%s on pipe %s, connector %s: PASSED\n",
+                                       igt_subtest_name(),
+                                       kmstest_pipe_name(data->pipe),
+                                       igt_output_name(data->output));
+
+                       finish_crtc(data);
+               }
+       }
+
+       igt_require_f(valid_tests, "no valid crtc/connector combinations found\n");
+}
+
+igt_main
+{
+       data_t data = {};
+
+       igt_skip_on_simulation();
+
+       igt_fixture {
+               char buf[64];
+               FILE *status;
+
+               data.drm_fd = drm_open_any_master();
+
+               data.devid = intel_get_drm_devid(data.drm_fd);
+
+               status = igt_debugfs_fopen("i915_drrs_status", "r");
+               igt_require_f(status, "No i915_drrs_status found\n");
+               fread(buf, sizeof(buf), 1, status);
+               fclose(status);
+               buf[sizeof(buf) - 1] = '\0';
+               igt_require_f(!strstr(buf, "disabled"),
+                               "DRRS not supported:check VBT/panel caps\n");
+
+               igt_display_init(&data.display, data.drm_fd);
+       }
+
+       run_test(&data);
+
+       igt_fixture {
+               igt_display_fini(&data.display);
+       }
+}
--

2.0.1

_______________________________________________
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
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
#53 lore raw

Re: [PATCH 10/10] kms_drrs: Test DRRS entry and exit

hi,

Quoted 11 lines · Daniel Vetter
Quoted 6 lines · Rodrigo Vivi

I didn't get how it shows different rates if the i915_drrs_status only shows if panel supports or not.

Maybe the debugfs file could contain more info for each crtc connect, crtc info, if panel connected there supports, if it is enabled and also current freq.. then parse all here properly.

Yeah, giving the testcase minimal functional testing by making sure the kernel goes into low-RR mode when it should would be good. I think with fbc/psr tests we're more than covered on the functional side for testing that we don't miss updates.

working on providing more details from debugfs and parsing the same at igt. I will submit a patch once it is completed.

Quoted 283 lines
Quoted 2 lines

But one thing I don't know how to cover but it would be good is to check for flickers...

I don't think that's possible unfortunately :( We just have to wait for random bug reports. Also this time around we do respect the various vbt and panel settings, so hopefully this works better than the old lvds drrs code we have merged already.
-Daniel

Quoted 275 lines
Quoted 264 lines · Vandana Kannan

This test just display a frame on screen, waits for 1 second to enter DRRS and displays another frame to exit DRRS.
TODO:- Notify the user about which refresh rate was used at different stages.

---
  tests/Makefile.sources |   1 +
  tests/kms_drrs.c       | 225 +++++++++++++++++++++++++++++++++++++++++++++++++
  2 files changed, 226 insertions(+)

mode change 100644 => 100755 tests/Makefile.sources create mode 100644 tests/kms_drrs.c

tests/Makefile.sources +1 -0
old mode 100644
new mode 100755
index 967dc8f..fbc0977
@@ -64,6 +64,7 @@ TESTS_progs_M = \
         gem_write_read_ring_switch \
         kms_addfb \
         kms_cursor_crc \
+       kms_drrs \
         kms_fbc_crc \
         kms_flip \
         kms_flip_event_leak \
tests/kms_drrs.c new file +225 -1
new file mode 100644
index 0000000..5a360f3
@@ -0,0 +1,225 @@
+/*
+ * Copyright © 2013 Intel Corporation
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the next
+ * paragraph) shall be included in all copies or substantial portions of the
+ * Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
+ * IN THE SOFTWARE.
+ *
+ */
+
+#include "drmtest.h"
+#include "igt_debugfs.h"
+#include "igt_kms.h"
+#include "intel_chipset.h"
+#include "intel_batchbuffer.h"
+#include "ioctl_wrappers.h"
+
+IGT_TEST_DESCRIPTION(
+"Performs write operations and then waits for DRRS to be enabled and then "
+"disturbs the contents of the screen once again to disable DRRS.");
+
+typedef struct {
+       int drm_fd;
+       uint32_t devid;
+       uint32_t handle[2];
+       igt_display_t display;
+       igt_output_t *output;
+       enum pipe pipe;
+       igt_plane_t *primary;
+       struct igt_fb fb[2];
+       uint32_t fb_id[2];
+} data_t;
+
+static bool drrs_enabled(data_t *data)
+{
+       FILE *status;
+       char str[64] = {};
+
+       status = igt_debugfs_fopen("i915_drrs_status", "r");
+       igt_assert(status);
+
+       fread(str, sizeof(str) - 1, 1, status);
+       fclose(status);
+       return strstr(str, "DRRS enabled") != NULL;
+}
+
+static bool prepare_crtc(data_t *data)
+{
+       igt_display_t *display = &data->display;
+       igt_output_t *output = data->output;
+
+       /* select the pipe we want to use */
+       igt_output_set_pipe(output, data->pipe);
+       igt_display_commit(display);
+
+       if (!output->valid) {
+               igt_output_set_pipe(output, PIPE_ANY);
+               igt_display_commit(display);
+               return false;
+       }
+
+       return true;
+}
+
+static bool prepare_test(data_t *data)
+{
+       igt_display_t *display = &data->display;
+       igt_output_t *output = data->output;
+       drmModeModeInfo *mode;
+
+       data->primary = igt_output_get_plane(data->output, IGT_PLANE_PRIMARY);
+       mode = igt_output_get_mode(data->output);
+
+       data->fb_id[0] = igt_create_color_fb(data->drm_fd, mode->hdisplay, mode->vdisplay,
+                       DRM_FORMAT_XRGB8888,
+                       I915_TILING_X,
+                       0.0, 0.0, 0.0, &data->fb[0]);
+       igt_assert(data->fb_id[0]);
+       data->fb_id[1] = igt_create_color_fb(data->drm_fd, mode->hdisplay, mode->vdisplay,
+                       DRM_FORMAT_XRGB8888,
+                       I915_TILING_X,
+                       0.1, 0.1, 0.1,
+                       &data->fb[1]);
+       igt_assert(data->fb_id[1]);
+
+       data->handle[0] = data->fb[0].gem_handle;
+       data->handle[1] = data->fb[1].gem_handle;
+
+       /* scanout = fb[1] */
+       igt_plane_set_fb(data->primary, &data->fb[1]);
+       igt_display_commit(display);
+       usleep(1000000);
+
+       if (!drrs_enabled(data)) {
+               igt_info("DRRS not enabled\n");
+
+               igt_plane_set_fb(data->primary, NULL);
+               igt_output_set_pipe(output, PIPE_ANY);
+               igt_display_commit(display);
+
+               igt_remove_fb(data->drm_fd, &data->fb[0]);
+               igt_remove_fb(data->drm_fd, &data->fb[1]);
+               return false;
+       }
+
+       igt_wait_for_vblank(data->drm_fd, data->pipe);
+
+       /* scanout = fb[0] */
+       igt_plane_set_fb(data->primary, &data->fb[0]);
+       igt_display_commit(display);
+       usleep(100000);
+
+       igt_wait_for_vblank(data->drm_fd, data->pipe);
+
+       return true;
+}
+
+static void finish_crtc(data_t *data)
+{
+       igt_plane_set_fb(data->primary, NULL);
+       igt_output_set_pipe(data->output, PIPE_ANY);
+       igt_display_commit(&data->display);
+
+       igt_remove_fb(data->drm_fd, &data->fb[0]);
+       igt_remove_fb(data->drm_fd, &data->fb[1]);
+}
+
+static void reset_display(data_t *data)
+{
+       igt_display_t *display = &data->display;
+
+       for_each_connected_output(display, data->output) {
+               if (data->output->valid) {
+                       data->primary =  igt_output_get_plane(data->output,
+                                                       IGT_PLANE_PRIMARY);
+                       igt_plane_set_fb(data->primary, NULL);
+               }
+               igt_output_set_pipe(data->output, PIPE_ANY);
+       }
+}
+
+static void run_test(data_t *data)
+{
+       igt_display_t *display = &data->display;
+       int valid_tests = 0;
+
+       reset_display(data);
+
+       for_each_connected_output(display, data->output) {
+               for_each_pipe(display, data->pipe) {
+                       if (!prepare_crtc(data))
+                               continue;
+
+                       igt_info("Beginning %s on pipe %s, connector %s\n",
+                                       igt_subtest_name(),
+                                       kmstest_pipe_name(data->pipe),
+                                       igt_output_name(data->output));
+
+                       if (!prepare_test(data)) {
+                               igt_info("%s on pipe %s, connector %s: SKIPPED\n",
+                                               igt_subtest_name(),
+                                               kmstest_pipe_name(data->pipe),
+                                               igt_output_name(data->output));
+                               continue;
+                       }
+
+                       valid_tests++;
+
+                       igt_info("%s on pipe %s, connector %s: PASSED\n",
+                                       igt_subtest_name(),
+                                       kmstest_pipe_name(data->pipe),
+                                       igt_output_name(data->output));
+
+                       finish_crtc(data);
+               }
+       }
+
+       igt_require_f(valid_tests, "no valid crtc/connector combinations found\n");
+}
+
+igt_main
+{
+       data_t data = {};
+
+       igt_skip_on_simulation();
+
+       igt_fixture {
+               char buf[64];
+               FILE *status;
+
+               data.drm_fd = drm_open_any_master();
+
+               data.devid = intel_get_drm_devid(data.drm_fd);
+
+               status = igt_debugfs_fopen("i915_drrs_status", "r");
+               igt_require_f(status, "No i915_drrs_status found\n");
+               fread(buf, sizeof(buf), 1, status);
+               fclose(status);
+               buf[sizeof(buf) - 1] = '\0';
+               igt_require_f(!strstr(buf, "disabled"),
+                               "DRRS not supported:check VBT/panel caps\n");
+
+               igt_display_init(&data.display, data.drm_fd);
+       }
+
+       run_test(&data);
+
+       igt_fixture {
+               igt_display_fini(&data.display);
+       }
+}
--

2.0.1

_______________________________________________
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

--Ram

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