Skip to contentSkip to conversation

drm/i915: edp resume/On time optimization.

PATCH In review [email protected] 4 participants 9 messages Dec 22, 2015 – Jan 8, 2016

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

PATCH 1/1 drm/i915: edp resume/On time optimization.

From: Abhay Kumar <[email protected]>

Make resume/on codepath not to wait for panel_power_cycle_delay(t11_t12) if this time is already spent in suspend/poweron time.

v2: Use CLOCK_BOOTTIME and remove jiffies for panel power cycle
delay calculation(Ville).

Cc Ville Syrjälä <[email protected]>
---
 drivers/gpu/drm/i915/intel_ddi.c |  3 +++
 drivers/gpu/drm/i915/intel_dp.c  | 22 ++++++++++++++--------
 drivers/gpu/drm/i915/intel_drv.h |  2 +-
 3 files changed, 18 insertions(+), 9 deletions(-)
drivers/gpu/drm/i915/intel_ddi.c +3 -0
index e6408e5..480697d 100644
@@ -2395,6 +2395,9 @@ static void intel_ddi_post_disable(struct intel_encoder *intel_encoder)
 		intel_dp_sink_dpms(intel_dp, DRM_MODE_DPMS_OFF);
 		intel_edp_panel_vdd_on(intel_dp);
 		intel_edp_panel_off(intel_dp);
+
+		/* storing panel power off time */
+		intel_dp->panel_power_off_time = ktime_get_with_offset(TK_OFFS_BOOT);
 	}
 
 	if (IS_SKYLAKE(dev) || IS_KABYLAKE(dev))
drivers/gpu/drm/i915/intel_dp.c +14 -8
index 796e3d3..c813605 100644
@@ -38,7 +38,6 @@
 #include "intel_drv.h"
 #include <drm/i915_drm.h>
 #include "i915_drv.h"
-
 #define DP_LINK_CHECK_TIMEOUT	(10 * 1000)
 
 /* Compliance test status bits  */
@@ -1812,13 +1811,22 @@ static void wait_panel_off(struct intel_dp *intel_dp)
 
 static void wait_panel_power_cycle(struct intel_dp *intel_dp)
 {
+	ktime_t panel_power_on_time;
+	u32 panel_power_off_duration;
+
 	DRM_DEBUG_KMS("Wait for panel power cycle\n");
 
-	/* When we disable the VDD override bit last we have to do the manual
-	 * wait. */
-	wait_remaining_ms_from_jiffies(intel_dp->last_power_cycle,
-				       intel_dp->panel_power_cycle_delay);
+        /* take the diffrence of currrent time and panel power off time
+           and then make panel wait for t11_t12 if needed */
+	panel_power_on_time = ktime_get_with_offset(TK_OFFS_BOOT);
+	panel_power_off_duration = (panel_power_on_time.tv64 - intel_dp->panel_power_off_time.tv64);
+	panel_power_off_duration = panel_power_off_duration / 1000000;
 
+	/* When we disable the VDD override bit last we have to do the manual
+	 * wait */
+	if (panel_power_off_duration < intel_dp->panel_power_cycle_delay)
+		wait_remaining_ms_from_jiffies(jiffies,
+				       (intel_dp->panel_power_cycle_delay - panel_power_off_duration));
 	wait_panel_status(intel_dp, IDLE_CYCLE_MASK, IDLE_CYCLE_VALUE);
 }
 
@@ -1969,7 +1977,7 @@ static void edp_panel_vdd_off_sync(struct intel_dp *intel_dp)
 	I915_READ(pp_stat_reg), I915_READ(pp_ctrl_reg));
 
 	if ((pp & POWER_TARGET_ON) == 0)
-		intel_dp->last_power_cycle = jiffies;
+		intel_dp->panel_power_off_time = ktime_get_with_offset(TK_OFFS_BOOT);
 
 	power_domain = intel_display_port_aux_power_domain(intel_encoder);
 	intel_display_power_put(dev_priv, power_domain);
@@ -2118,7 +2126,6 @@ static void edp_panel_off(struct intel_dp *intel_dp)
 	I915_WRITE(pp_ctrl_reg, pp);
 	POSTING_READ(pp_ctrl_reg);
 
-	intel_dp->last_power_cycle = jiffies;
 	wait_panel_off(intel_dp);
 
 	/* We got a reference when we enabled the VDD. */
@@ -5122,7 +5129,6 @@ intel_dp_add_properties(struct intel_dp *intel_dp, struct drm_connector *connect
 
 static void intel_dp_init_panel_power_timestamps(struct intel_dp *intel_dp)
 {
-	intel_dp->last_power_cycle = jiffies;
 	intel_dp->last_power_on = jiffies;
 	intel_dp->last_backlight_off = jiffies;
 }
drivers/gpu/drm/i915/intel_drv.h +1 -1
index d523ebb..84ad134 100644
@@ -765,9 +765,9 @@ struct intel_dp {
 	int backlight_off_delay;
 	struct delayed_work panel_vdd_work;
 	bool want_panel_vdd;
-	unsigned long last_power_cycle;
 	unsigned long last_power_on;
 	unsigned long last_backlight_off;
+	ktime_t panel_power_off_time;
 
 	struct notifier_block edp_notifier;
 
Signature · 6 lines
1.9.1

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

✗ warning: Fi.CI.BAT

== Summary ==

== Summary ==

Built on 78deeec98b10627fe2050ce8ebfa2ea2d5b9e6c7 drm-intel-nightly: 2015y-12m-21d-16h-03m-57s UTC integration manifest

Test gem_mmap_gtt:

        Subgroup basic-small-bo:
                dmesg-warn -> PASS       (bdw-nuci7)
Test gem_storedw_loop:
        Subgroup basic-render:
                pass       -> DMESG-WARN (bdw-nuci7)
Test kms_flip:
        Subgroup basic-flip-vs-modeset:
                pass       -> DMESG-WARN (hsw-xps12)
                skip       -> PASS       (bdw-nuci7)
        Subgroup basic-plain-flip:
                skip       -> PASS       (bdw-nuci7)
                pass       -> DMESG-WARN (bdw-ultra)
Test kms_pipe_crc_basic:
        Subgroup read-crc-pipe-a:
                pass       -> DMESG-WARN (snb-dellxps)
                skip       -> PASS       (bdw-nuci7)
                dmesg-warn -> PASS       (byt-nuc)
        Subgroup read-crc-pipe-a-frame-sequence:
                skip       -> PASS       (bdw-nuci7)
        Subgroup read-crc-pipe-b:
                dmesg-warn -> PASS       (skl-i5k-2)
                dmesg-warn -> PASS       (hsw-xps12)
                skip       -> PASS       (bdw-nuci7)
        Subgroup read-crc-pipe-b-frame-sequence:
                skip       -> PASS       (bdw-nuci7)
        Subgroup read-crc-pipe-c:
                pass       -> DMESG-WARN (skl-i5k-2)
                skip       -> PASS       (bdw-nuci7)
        Subgroup suspend-read-crc-pipe-b:
                pass       -> DMESG-WARN (snb-x220t)
Test kms_setmode:
        Subgroup basic-clone-single-crtc:
                dmesg-warn -> PASS       (snb-dellxps)
Test pm_rpm:
        Subgroup basic-pci-d3-state:
                skip       -> PASS       (bdw-nuci7)
        Subgroup basic-rte:
                skip       -> PASS       (bdw-nuci7)
                dmesg-warn -> PASS       (bdw-ultra)
bdw-nuci7        total:132  pass:121  dwarn:2   dfail:0   fail:0   skip:9  
bdw-ultra        total:132  pass:124  dwarn:2   dfail:0   fail:0   skip:6  
bsw-nuc-2        total:135  pass:114  dwarn:1   dfail:0   fail:0   skip:20 
byt-nuc          total:135  pass:120  dwarn:2   dfail:0   fail:0   skip:13 
hsw-brixbox      total:135  pass:126  dwarn:2   dfail:0   fail:0   skip:7  
hsw-gt2          total:135  pass:129  dwarn:1   dfail:0   fail:1   skip:4  
hsw-xps12        total:132  pass:125  dwarn:3   dfail:0   fail:0   skip:4  
ilk-hp8440p      total:135  pass:100  dwarn:0   dfail:0   fail:0   skip:35 
ivb-t430s        total:135  pass:127  dwarn:2   dfail:0   fail:0   skip:6  
skl-i5k-2        total:135  pass:122  dwarn:5   dfail:0   fail:0   skip:8  
skl-i7k-2        total:135  pass:122  dwarn:5   dfail:0   fail:0   skip:8  
snb-dellxps      total:135  pass:121  dwarn:2   dfail:0   fail:0   skip:12 
snb-x220t        total:135  pass:121  dwarn:2   dfail:0   fail:1   skip:11 

Results at /archive/results/CI_IGT_test/Patchwork_786/

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

#2 lore raw
In reply to [email protected]

Make resume/on codepath not to wait for panel_power_cycle_delay(t11_t12) if this time is already spent in suspend/poweron time.

v2: Use CLOCK_BOOTTIME and remove jiffies for panel power cycle
delay calculation(Ville).

Cc Ville Syrjälä <[email protected]>
---
 drivers/gpu/drm/i915/intel_ddi.c |  3 +++  drivers/gpu/drm/i915/intel_dp.c  | 22 ++++++++++++++--------  drivers/gpu/drm/i915/intel_drv.h |  2 +-
 3 files changed, 18 insertions(+), 9 deletions(-)
drivers/gpu/drm/i915/intel_ddi.c +3 -0
index e6408e5..480697d 100644
@@ -2395,6 +2395,9 @@ static void intel_ddi_post_disable(struct intel_encoder *intel_encoder)
 		intel_dp_sink_dpms(intel_dp, DRM_MODE_DPMS_OFF);
 		intel_edp_panel_vdd_on(intel_dp);
 		intel_edp_panel_off(intel_dp);
+
+		/* storing panel power off time */
+		intel_dp->panel_power_off_time = ktime_get_with_offset(TK_OFFS_BOOT);
 	}
 
 	if (IS_SKYLAKE(dev) || IS_KABYLAKE(dev)) diff --git a/drivers/gpu/drm/i915/intel_dp.c b/drivers/gpu/drm/i915/intel_dp.c index 796e3d3..c813605 100644
drivers/gpu/drm/i915/intel_dp.c +15 -6
@@ -38,7 +38,6 @@
 #include "intel_drv.h"
 #include <drm/i915_drm.h>
 #include "i915_drv.h"
-
 #define DP_LINK_CHECK_TIMEOUT	(10 * 1000)
 
 /* Compliance test status bits  */
@@ -1812,13 +1811,22 @@ static void wait_panel_off(struct intel_dp *intel_dp)
 
 static void wait_panel_power_cycle(struct intel_dp *intel_dp)  {
+	ktime_t panel_power_on_time;
+	u32 panel_power_off_duration;
+
 	DRM_DEBUG_KMS("Wait for panel power cycle\n");
 
-	/* When we disable the VDD override bit last we have to do the manual
-	 * wait. */
-	wait_remaining_ms_from_jiffies(intel_dp->last_power_cycle,
-				       intel_dp->panel_power_cycle_delay);
+        /* take the diffrence of currrent time and panel power off time
+           and then make panel wait for t11_t12 if needed */
+	panel_power_on_time = ktime_get_with_offset(TK_OFFS_BOOT);
+	panel_power_off_duration = (panel_power_on_time.tv64 - intel_dp->panel_power_off_time.tv64);
+	panel_power_off_duration = panel_power_off_duration / 1000000;
 
+	/* When we disable the VDD override bit last we have to do the manual
+	 * wait */
+	if (panel_power_off_duration < intel_dp->panel_power_cycle_delay)
+		wait_remaining_ms_from_jiffies(jiffies,
+				       (intel_dp->panel_power_cycle_delay - 
+panel_power_off_duration));
 	wait_panel_status(intel_dp, IDLE_CYCLE_MASK, IDLE_CYCLE_VALUE);  }
 
@@ -1969,7 +1977,7 @@ static void edp_panel_vdd_off_sync(struct intel_dp *intel_dp)
 	I915_READ(pp_stat_reg), I915_READ(pp_ctrl_reg));
 
 	if ((pp & POWER_TARGET_ON) == 0)
-		intel_dp->last_power_cycle = jiffies;
+		intel_dp->panel_power_off_time = ktime_get_with_offset(TK_OFFS_BOOT);
 
 	power_domain = intel_display_port_aux_power_domain(intel_encoder);
 	intel_display_power_put(dev_priv, power_domain); @@ -2118,7 +2126,6 @@ static void edp_panel_off(struct intel_dp *intel_dp)

I915_WRITE(pp_ctrl_reg, pp);
POSTING_READ(pp_ctrl_reg);

- intel_dp->last_power_cycle = jiffies;
wait_panel_off(intel_dp);

/* We got a reference when we enabled the VDD. */ @@ -5122,7 +5129,6 @@ intel_dp_add_properties(struct intel_dp *intel_dp, struct drm_connector *connect

static void intel_dp_init_panel_power_timestamps(struct intel_dp *intel_dp) {
- intel_dp->last_power_cycle = jiffies;
intel_dp->last_power_on = jiffies;
intel_dp->last_backlight_off = jiffies; } diff --git a/drivers/gpu/drm/i915/intel_drv.h b/drivers/gpu/drm/i915/intel_drv.h
index d523ebb..84ad134 100644

drivers/gpu/drm/i915/intel_drv.h +1 -1
@@ -765,9 +765,9 @@ struct intel_dp {
 	int backlight_off_delay;
 	struct delayed_work panel_vdd_work;
 	bool want_panel_vdd;
-	unsigned long last_power_cycle;
 	unsigned long last_power_on;
 	unsigned long last_backlight_off;
+	ktime_t panel_power_off_time;
 
 	struct notifier_block edp_notifier;
 

Ville,

Is this patch is coming close to what you wanted?

Regards,
Abhay Kumar

--
1.9.1

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

#3 lore raw
Quoted 3 lines · Abhay

Ville,

Is this patch is coming close to what you wanted?

Please don't bottom-post but not quote properly - no one will ever find your comment and assume you accidentally sent out the patch twice. If you have to use a broken mailer that can't quote, then top-post. But please just install something that does work (I personally use Thunderbird on Windows, it getst the job done). Anything else just doesn't work.

Thanks, Daniel

Signature · 7 lines
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch
_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
#4 lore raw
Quoted 11 lines · Daniel Vetter
Quoted 3 lines · Abhay

Ville,

Is this patch is coming close to what you wanted?

Please don't bottom-post but not quote properly - no one will ever find your comment and assume you accidentally sent out the patch twice. If you have to use a broken mailer that can't quote, then top-post. But please just install something that does work (I personally use Thunderbird on Windows, it getst the job done). Anything else just doesn't work.

Thanks, Daniel

Thanks Daniel. I used wrong email client. Will take care of this from next time for bottom post.

Regards,
Abhay Kumar

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

#5 lore raw
In reply to [email protected]
Quoted 99 lines · Abhay

From: Abhay Kumar <[email protected]>

Make resume/on codepath not to wait for panel_power_cycle_delay(t11_t12) if this time is already spent in suspend/poweron time.

v2: Use CLOCK_BOOTTIME and remove jiffies for panel power cycle
delay calculation(Ville).

Cc Ville Syrjälä <[email protected]>
---
  drivers/gpu/drm/i915/intel_ddi.c |  3 +++
  drivers/gpu/drm/i915/intel_dp.c  | 22 ++++++++++++++--------
  drivers/gpu/drm/i915/intel_drv.h |  2 +-
  3 files changed, 18 insertions(+), 9 deletions(-)
drivers/gpu/drm/i915/intel_ddi.c +3 -0
index e6408e5..480697d 100644
@@ -2395,6 +2395,9 @@ static void intel_ddi_post_disable(struct intel_encoder *intel_encoder)
  		intel_dp_sink_dpms(intel_dp, DRM_MODE_DPMS_OFF);
  		intel_edp_panel_vdd_on(intel_dp);
  		intel_edp_panel_off(intel_dp);
+
+		/* storing panel power off time */
+		intel_dp->panel_power_off_time = ktime_get_with_offset(TK_OFFS_BOOT);
  	}
 
  	if (IS_SKYLAKE(dev) || IS_KABYLAKE(dev))
drivers/gpu/drm/i915/intel_dp.c +14 -8
index 796e3d3..c813605 100644
@@ -38,7 +38,6 @@
  #include "intel_drv.h"
  #include <drm/i915_drm.h>
  #include "i915_drv.h"
-
  #define DP_LINK_CHECK_TIMEOUT	(10 * 1000)
 
  /* Compliance test status bits  */
@@ -1812,13 +1811,22 @@ static void wait_panel_off(struct intel_dp *intel_dp)
 
  static void wait_panel_power_cycle(struct intel_dp *intel_dp)
  {
+	ktime_t panel_power_on_time;
+	u32 panel_power_off_duration;
+
  	DRM_DEBUG_KMS("Wait for panel power cycle\n");
 
-	/* When we disable the VDD override bit last we have to do the manual
-	 * wait. */
-	wait_remaining_ms_from_jiffies(intel_dp->last_power_cycle,
-				       intel_dp->panel_power_cycle_delay);
+        /* take the diffrence of currrent time and panel power off time
+           and then make panel wait for t11_t12 if needed */
+	panel_power_on_time = ktime_get_with_offset(TK_OFFS_BOOT);
+	panel_power_off_duration = (panel_power_on_time.tv64 - intel_dp->panel_power_off_time.tv64);
+	panel_power_off_duration = panel_power_off_duration / 1000000;
 
+	/* When we disable the VDD override bit last we have to do the manual
+	 * wait */
+	if (panel_power_off_duration < intel_dp->panel_power_cycle_delay)
+		wait_remaining_ms_from_jiffies(jiffies,
+				       (intel_dp->panel_power_cycle_delay - panel_power_off_duration));
  	wait_panel_status(intel_dp, IDLE_CYCLE_MASK, IDLE_CYCLE_VALUE);
  }
 
@@ -1969,7 +1977,7 @@ static void edp_panel_vdd_off_sync(struct intel_dp *intel_dp)
  	I915_READ(pp_stat_reg), I915_READ(pp_ctrl_reg));
 
  	if ((pp & POWER_TARGET_ON) == 0)
-		intel_dp->last_power_cycle = jiffies;
+		intel_dp->panel_power_off_time = ktime_get_with_offset(TK_OFFS_BOOT);
 
  	power_domain = intel_display_port_aux_power_domain(intel_encoder);
  	intel_display_power_put(dev_priv, power_domain);
@@ -2118,7 +2126,6 @@ static void edp_panel_off(struct intel_dp *intel_dp)
  	I915_WRITE(pp_ctrl_reg, pp);
  	POSTING_READ(pp_ctrl_reg);
 
-	intel_dp->last_power_cycle = jiffies;
  	wait_panel_off(intel_dp);
 
  	/* We got a reference when we enabled the VDD. */
@@ -5122,7 +5129,6 @@ intel_dp_add_properties(struct intel_dp *intel_dp, struct drm_connector *connect
 
  static void intel_dp_init_panel_power_timestamps(struct intel_dp *intel_dp)
  {
-	intel_dp->last_power_cycle = jiffies;
  	intel_dp->last_power_on = jiffies;
  	intel_dp->last_backlight_off = jiffies;
  }
drivers/gpu/drm/i915/intel_drv.h +0 -0
index d523ebb..84ad134 100644

drivers/gpu/drm/i915/intel_drv.h struct intel_dp { · line 773

Quoted 10 lines
drivers/gpu/drm/i915/intel_drv.h +1 -1
@@ -765,9 +765,9 @@ struct intel_dp {
  	int backlight_off_delay;
  	struct delayed_work panel_vdd_work;
  	bool want_panel_vdd;
-	unsigned long last_power_cycle;
  	unsigned long last_power_on;
  	unsigned long last_backlight_off;
+	ktime_t panel_power_off_time;
 
  	struct notifier_block edp_notifier;
 

Is this close to what you wanted? thoughts?
Pardon me for pinging again as last time send with wrong email client.

Regards,
Abhay Kumar

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

#6 lore raw
In reply to [email protected]
Quoted 7 lines · On Mon, Dec 21, 2015 at 05:18:52PM -0800, [email protected] wrote:

From: Abhay Kumar <[email protected]>

Make resume/on codepath not to wait for panel_power_cycle_delay(t11_t12) if this time is already spent in suspend/poweron time.

v2: Use CLOCK_BOOTTIME and remove jiffies for panel power cycle
delay calculation(Ville).

The approach seems reasonable enough to me. There are a few issues with the patch though, see below.

Quoted 14 lines
Cc Ville Syrjälä <[email protected]>
---
 drivers/gpu/drm/i915/intel_ddi.c |  3 +++
 drivers/gpu/drm/i915/intel_dp.c  | 22 ++++++++++++++--------
 drivers/gpu/drm/i915/intel_drv.h |  2 +-
 3 files changed, 18 insertions(+), 9 deletions(-)
drivers/gpu/drm/i915/intel_ddi.c +0 -0
index e6408e5..480697d 100644

drivers/gpu/drm/i915/intel_ddi.c static void intel_ddi_post_disable(struct intel_encoder *intel_encoder) · line 2399

Quoted 5 lines
drivers/gpu/drm/i915/intel_ddi.c +2 -0
@@ -2395,6 +2395,9 @@ static void intel_ddi_post_disable(struct intel_encoder *intel_encoder)
 		intel_dp_sink_dpms(intel_dp, DRM_MODE_DPMS_OFF);
 		intel_edp_panel_vdd_on(intel_dp);
 		intel_edp_panel_off(intel_dp);
+
+		/* storing panel power off time */

The comment seems rather pointless.

drivers/gpu/drm/i915/intel_ddi.c static void intel_ddi_post_disable(struct intel_encoder *intel_encoder) · line 2400

Quoted 1 line
drivers/gpu/drm/i915/intel_ddi.c +1 -0
+		intel_dp->panel_power_off_time = ktime_get_with_offset(TK_OFFS_BOOT);

There appears to be a wrapper for this: ktime_get_boottime().

Not sure why you're adding this here anyway. Should be enough to just replace the places where we currently sample jiffies to sample the boot clock AFAICS.

drivers/gpu/drm/i915/intel_dp.c line 41

Quoted 12 lines
drivers/gpu/drm/i915/intel_ddi.c +0 -0
 	}
 
 	if (IS_SKYLAKE(dev) || IS_KABYLAKE(dev))
drivers/gpu/drm/i915/intel_dp.c +0 -1
index 796e3d3..c813605 100644
@@ -38,7 +38,6 @@
 #include "intel_drv.h"
 #include <drm/i915_drm.h>
 #include "i915_drv.h"
-

Spurious change.

Quoted 8 lines
drivers/gpu/drm/i915/intel_dp.c +1 -0
 #define DP_LINK_CHECK_TIMEOUT	(10 * 1000)
 
 /* Compliance test status bits  */
@@ -1812,13 +1811,22 @@ static void wait_panel_off(struct intel_dp *intel_dp)
 
 static void wait_panel_power_cycle(struct intel_dp *intel_dp)
 {
+	ktime_t panel_power_on_time;

drivers/gpu/drm/i915/intel_dp.c static void wait_panel_off(struct intel_dp *intel_dp) · line 1820

Quoted 10 lines
drivers/gpu/drm/i915/intel_dp.c +4 -4
+	u32 panel_power_off_duration;
+
 	DRM_DEBUG_KMS("Wait for panel power cycle\n");
 
-	/* When we disable the VDD override bit last we have to do the manual
-	 * wait. */
-	wait_remaining_ms_from_jiffies(intel_dp->last_power_cycle,
-				       intel_dp->panel_power_cycle_delay);
+        /* take the diffrence of currrent time and panel power off time
+           and then make panel wait for t11_t12 if needed */

Indent fail. Also the comment isn't in proper format.

drivers/gpu/drm/i915/intel_dp.c static void wait_panel_off(struct intel_dp *intel_dp) · line 1823

Quoted 3 lines
drivers/gpu/drm/i915/intel_dp.c +3 -0
+	panel_power_on_time = ktime_get_with_offset(TK_OFFS_BOOT);
+	panel_power_off_duration = (panel_power_on_time.tv64 - intel_dp->panel_power_off_time.tv64);
+	panel_power_off_duration = panel_power_off_duration / 1000000;

ktime_ms_delta() perhaps?

drivers/gpu/drm/i915/intel_dp.c static void wait_panel_off(struct intel_dp *intel_dp) · line 1826

Quoted 3 lines
drivers/gpu/drm/i915/intel_dp.c +2 -0
+	/* When we disable the VDD override bit last we have to do the manual
+	 * wait */

This comment formatting is a bit wonky too. Maybe polish it up while at it.

Quoted 16 lines
drivers/gpu/drm/i915/intel_dp.c +4 -1
+	if (panel_power_off_duration < intel_dp->panel_power_cycle_delay)
+		wait_remaining_ms_from_jiffies(jiffies,
+				       (intel_dp->panel_power_cycle_delay - panel_power_off_duration));
 	wait_panel_status(intel_dp, IDLE_CYCLE_MASK, IDLE_CYCLE_VALUE);
 }
 
@@ -1969,7 +1977,7 @@ static void edp_panel_vdd_off_sync(struct intel_dp *intel_dp)
 	I915_READ(pp_stat_reg), I915_READ(pp_ctrl_reg));
 
 	if ((pp & POWER_TARGET_ON) == 0)
-		intel_dp->last_power_cycle = jiffies;
+		intel_dp->panel_power_off_time = ktime_get_with_offset(TK_OFFS_BOOT);
 
 	power_domain = intel_display_port_aux_power_domain(intel_encoder);
 	intel_display_power_put(dev_priv, power_domain);

drivers/gpu/drm/i915/intel_dp.c static void edp_panel_off(struct intel_dp *intel_dp) · line 2121

Quoted 4 lines
drivers/gpu/drm/i915/intel_dp.c +0 -1
@@ -2118,7 +2126,6 @@ static void edp_panel_off(struct intel_dp *intel_dp)
 	I915_WRITE(pp_ctrl_reg, pp);
 	POSTING_READ(pp_ctrl_reg);
 
-	intel_dp->last_power_cycle = jiffies;

Removing this doens't seem correct. Instead we should sample the clock here as well.

drivers/gpu/drm/i915/intel_dp.c intel_dp_add_properties(struct intel_dp *intel_dp, struct drm_connector *connect · line 5125

Quoted 8 lines
drivers/gpu/drm/i915/intel_dp.c +0 -1
 	wait_panel_off(intel_dp);
 
 	/* We got a reference when we enabled the VDD. */
@@ -5122,7 +5129,6 @@ intel_dp_add_properties(struct intel_dp *intel_dp, struct drm_connector *connect
 
 static void intel_dp_init_panel_power_timestamps(struct intel_dp *intel_dp)
 {
-	intel_dp->last_power_cycle = jiffies;

and I suppose here too.

Quoted 20 lines
drivers/gpu/drm/i915/intel_dp.c +0 -0
 	intel_dp->last_power_on = jiffies;
 	intel_dp->last_backlight_off = jiffies;
 }
drivers/gpu/drm/i915/intel_drv.h +1 -1
index d523ebb..84ad134 100644
@@ -765,9 +765,9 @@ struct intel_dp {
 	int backlight_off_delay;
 	struct delayed_work panel_vdd_work;
 	bool want_panel_vdd;
-	unsigned long last_power_cycle;
 	unsigned long last_power_on;
 	unsigned long last_backlight_off;
+	ktime_t panel_power_off_time;
 
 	struct notifier_block edp_notifier;
 
Signature · 1 line
1.9.1
Signature · 6 lines
Ville Syrjälä
Intel OTC
_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
#7 lore raw
Quoted 72 lines · Ville Syrjälä
Quoted 7 lines · On Mon, Dec 21, 2015 at 05:18:52PM -0800, [email protected] wrote:

From: Abhay Kumar <[email protected]>

Make resume/on codepath not to wait for panel_power_cycle_delay(t11_t12) if this time is already spent in suspend/poweron time.

v2: Use CLOCK_BOOTTIME and remove jiffies for panel power cycle
delay calculation(Ville).

The approach seems reasonable enough to me. There are a few issues with the patch though, see below.

Quoted 13 lines
Cc Ville Syrjälä <[email protected]>
---
  drivers/gpu/drm/i915/intel_ddi.c |  3 +++
  drivers/gpu/drm/i915/intel_dp.c  | 22 ++++++++++++++--------
  drivers/gpu/drm/i915/intel_drv.h |  2 +-
  3 files changed, 18 insertions(+), 9 deletions(-)
drivers/gpu/drm/i915/intel_ddi.c +0 -0
index e6408e5..480697d 100644

drivers/gpu/drm/i915/intel_ddi.c static void intel_ddi_post_disable(struct intel_encoder *intel_encoder) · line 2399

Quoted 5 lines
drivers/gpu/drm/i915/intel_ddi.c +2 -0
@@ -2395,6 +2395,9 @@ static void intel_ddi_post_disable(struct intel_encoder *intel_encoder)
  		intel_dp_sink_dpms(intel_dp, DRM_MODE_DPMS_OFF);
  		intel_edp_panel_vdd_on(intel_dp);
  		intel_edp_panel_off(intel_dp);
+
+		/* storing panel power off time */

The comment seems rather pointless.

drivers/gpu/drm/i915/intel_ddi.c static void intel_ddi_post_disable(struct intel_encoder *intel_encoder) · line 2400

Quoted 1 line
drivers/gpu/drm/i915/intel_ddi.c +1 -0
+		intel_dp->panel_power_off_time = ktime_get_with_offset(TK_OFFS_BOOT);

There appears to be a wrapper for this: ktime_get_boottime().

Not sure why you're adding this here anyway. Should be enough to just replace the places where we currently sample jiffies to sample the boot clock AFAICS.

drivers/gpu/drm/i915/intel_dp.c line 41

Quoted 12 lines
drivers/gpu/drm/i915/intel_ddi.c +0 -0
  	}
 
  	if (IS_SKYLAKE(dev) || IS_KABYLAKE(dev))
drivers/gpu/drm/i915/intel_dp.c +0 -1
index 796e3d3..c813605 100644
@@ -38,7 +38,6 @@
  #include "intel_drv.h"
  #include <drm/i915_drm.h>
  #include "i915_drv.h"
-

Spurious change.

Quoted 8 lines
drivers/gpu/drm/i915/intel_dp.c +1 -0
  #define DP_LINK_CHECK_TIMEOUT	(10 * 1000)
 
  /* Compliance test status bits  */
@@ -1812,13 +1811,22 @@ static void wait_panel_off(struct intel_dp *intel_dp)
 
  static void wait_panel_power_cycle(struct intel_dp *intel_dp)
  {
+	ktime_t panel_power_on_time;

drivers/gpu/drm/i915/intel_dp.c static void wait_panel_off(struct intel_dp *intel_dp) · line 1820

Quoted 10 lines
drivers/gpu/drm/i915/intel_dp.c +4 -4
+	u32 panel_power_off_duration;
+
  	DRM_DEBUG_KMS("Wait for panel power cycle\n");
 
-	/* When we disable the VDD override bit last we have to do the manual
-	 * wait. */
-	wait_remaining_ms_from_jiffies(intel_dp->last_power_cycle,
-				       intel_dp->panel_power_cycle_delay);
+        /* take the diffrence of currrent time and panel power off time
+           and then make panel wait for t11_t12 if needed */

Indent fail. Also the comment isn't in proper format.

Quoted 4 lines

drivers/gpu/drm/i915/intel_dp.c static void wait_panel_off(struct intel_dp *intel_dp) · line 1823

Quoted 3 lines
drivers/gpu/drm/i915/intel_dp.c +3 -0
+	panel_power_on_time = ktime_get_with_offset(TK_OFFS_BOOT);
+	panel_power_off_duration = (panel_power_on_time.tv64 - intel_dp->panel_power_off_time.tv64);
+	panel_power_off_duration = panel_power_off_duration / 1000000;

ktime_ms_delta() perhaps?

sure.

Quoted 26 lines

drivers/gpu/drm/i915/intel_dp.c static void wait_panel_off(struct intel_dp *intel_dp) · line 1826

Quoted 4 lines
drivers/gpu/drm/i915/intel_dp.c +2 -0
+	/* When we disable the VDD override bit last we have to do the manual
+	 * wait */

This comment formatting is a bit wonky too. Maybe polish it up while at it.

Quoted 19 lines
drivers/gpu/drm/i915/intel_dp.c +4 -1
+	if (panel_power_off_duration < intel_dp->panel_power_cycle_delay)
+		wait_remaining_ms_from_jiffies(jiffies,
+				       (intel_dp->panel_power_cycle_delay - panel_power_off_duration));
  	wait_panel_status(intel_dp, IDLE_CYCLE_MASK, IDLE_CYCLE_VALUE);
  }
 
@@ -1969,7 +1977,7 @@ static void edp_panel_vdd_off_sync(struct intel_dp *intel_dp)
  	I915_READ(pp_stat_reg), I915_READ(pp_ctrl_reg));
 
  	if ((pp & POWER_TARGET_ON) == 0)
-		intel_dp->last_power_cycle = jiffies;
+		intel_dp->panel_power_off_time = ktime_get_with_offset(TK_OFFS_BOOT);
 
  	power_domain = intel_display_port_aux_power_domain(intel_encoder);
  	intel_display_power_put(dev_priv, power_domain);
@@ -2118,7 +2126,6 @@ static void edp_panel_off(struct intel_dp *intel_dp)
  	I915_WRITE(pp_ctrl_reg, pp);
  	POSTING_READ(pp_ctrl_reg);
 
Quoted 3 lines

drivers/gpu/drm/i915/intel_dp.c static void edp_panel_off(struct intel_dp *intel_dp) · line 2121

Quoted 1 line
drivers/gpu/drm/i915/intel_dp.c +0 -1
-	intel_dp->last_power_cycle = jiffies;

Removing this doens't seem correct. Instead we should sample the clock here as well.

Do we really need "last_power_cycle" ? As the ktime_get_bootime() will always calculate the boot time in fresh boot from zero and we only need to track the delta time when we go to suspend and resume. this is the reason i removed last_power_cycle sampling and also initialization. Please let me know if this is ok and make sense?

Quoted 27 lines

drivers/gpu/drm/i915/intel_dp.c intel_dp_add_properties(struct intel_dp *intel_dp, struct drm_connector *connect · line 5125

Quoted 9 lines
drivers/gpu/drm/i915/intel_dp.c +0 -1
  	wait_panel_off(intel_dp);
 
  	/* We got a reference when we enabled the VDD. */
@@ -5122,7 +5129,6 @@ intel_dp_add_properties(struct intel_dp *intel_dp, struct drm_connector *connect
 
  static void intel_dp_init_panel_power_timestamps(struct intel_dp *intel_dp)
  {
-	intel_dp->last_power_cycle = jiffies;

and I suppose here too.

Quoted 16 lines
drivers/gpu/drm/i915/intel_dp.c +0 -0
  	intel_dp->last_power_on = jiffies;
  	intel_dp->last_backlight_off = jiffies;
  }
drivers/gpu/drm/i915/intel_drv.h +1 -1
index d523ebb..84ad134 100644
@@ -765,9 +765,9 @@ struct intel_dp {
  	int backlight_off_delay;
  	struct delayed_work panel_vdd_work;
  	bool want_panel_vdd;
-	unsigned long last_power_cycle;
  	unsigned long last_power_on;
  	unsigned long last_backlight_off;
+	ktime_t panel_power_off_time;
 
Quoted 4 lines
Quoted 4 lines
drivers/gpu/drm/i915/intel_drv.h +0 -0
  	struct notifier_block edp_notifier;
 
Signature · 1 line
1.9.1

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

#8 lore raw
Quoted 106 lines · Abhay
Quoted 72 lines · Ville Syrjälä
Quoted 7 lines · On Mon, Dec 21, 2015 at 05:18:52PM -0800, [email protected] wrote:

From: Abhay Kumar <[email protected]>

Make resume/on codepath not to wait for panel_power_cycle_delay(t11_t12) if this time is already spent in suspend/poweron time.

v2: Use CLOCK_BOOTTIME and remove jiffies for panel power cycle
delay calculation(Ville).

The approach seems reasonable enough to me. There are a few issues with the patch though, see below.

Quoted 13 lines
Cc Ville Syrjälä <[email protected]>
---
  drivers/gpu/drm/i915/intel_ddi.c |  3 +++
  drivers/gpu/drm/i915/intel_dp.c  | 22 ++++++++++++++--------
  drivers/gpu/drm/i915/intel_drv.h |  2 +-
  3 files changed, 18 insertions(+), 9 deletions(-)
drivers/gpu/drm/i915/intel_ddi.c +0 -0
index e6408e5..480697d 100644

drivers/gpu/drm/i915/intel_ddi.c static void intel_ddi_post_disable(struct intel_encoder *intel_encoder) · line 2399

Quoted 5 lines
drivers/gpu/drm/i915/intel_ddi.c +2 -0
@@ -2395,6 +2395,9 @@ static void intel_ddi_post_disable(struct intel_encoder *intel_encoder)
  		intel_dp_sink_dpms(intel_dp, DRM_MODE_DPMS_OFF);
  		intel_edp_panel_vdd_on(intel_dp);
  		intel_edp_panel_off(intel_dp);
+
+		/* storing panel power off time */

The comment seems rather pointless.

drivers/gpu/drm/i915/intel_ddi.c static void intel_ddi_post_disable(struct intel_encoder *intel_encoder) · line 2400

Quoted 1 line
drivers/gpu/drm/i915/intel_ddi.c +1 -0
+		intel_dp->panel_power_off_time = ktime_get_with_offset(TK_OFFS_BOOT);

There appears to be a wrapper for this: ktime_get_boottime().

Not sure why you're adding this here anyway. Should be enough to just replace the places where we currently sample jiffies to sample the boot clock AFAICS.

drivers/gpu/drm/i915/intel_dp.c line 41

Quoted 12 lines
drivers/gpu/drm/i915/intel_ddi.c +0 -0
  	}
 
  	if (IS_SKYLAKE(dev) || IS_KABYLAKE(dev))
drivers/gpu/drm/i915/intel_dp.c +0 -1
index 796e3d3..c813605 100644
@@ -38,7 +38,6 @@
  #include "intel_drv.h"
  #include <drm/i915_drm.h>
  #include "i915_drv.h"
-

Spurious change.

Quoted 8 lines
drivers/gpu/drm/i915/intel_dp.c +1 -0
  #define DP_LINK_CHECK_TIMEOUT	(10 * 1000)
 
  /* Compliance test status bits  */
@@ -1812,13 +1811,22 @@ static void wait_panel_off(struct intel_dp *intel_dp)
 
  static void wait_panel_power_cycle(struct intel_dp *intel_dp)
  {
+	ktime_t panel_power_on_time;

drivers/gpu/drm/i915/intel_dp.c static void wait_panel_off(struct intel_dp *intel_dp) · line 1820

Quoted 10 lines
drivers/gpu/drm/i915/intel_dp.c +4 -4
+	u32 panel_power_off_duration;
+
  	DRM_DEBUG_KMS("Wait for panel power cycle\n");
 
-	/* When we disable the VDD override bit last we have to do the manual
-	 * wait. */
-	wait_remaining_ms_from_jiffies(intel_dp->last_power_cycle,
-				       intel_dp->panel_power_cycle_delay);
+        /* take the diffrence of currrent time and panel power off time
+           and then make panel wait for t11_t12 if needed */

Indent fail. Also the comment isn't in proper format.

Quoted 4 lines

drivers/gpu/drm/i915/intel_dp.c static void wait_panel_off(struct intel_dp *intel_dp) · line 1823

Quoted 3 lines
drivers/gpu/drm/i915/intel_dp.c +3 -0
+	panel_power_on_time = ktime_get_with_offset(TK_OFFS_BOOT);
+	panel_power_off_duration = (panel_power_on_time.tv64 - intel_dp->panel_power_off_time.tv64);
+	panel_power_off_duration = panel_power_off_duration / 1000000;

ktime_ms_delta() perhaps?

sure.

Quoted 26 lines

drivers/gpu/drm/i915/intel_dp.c static void wait_panel_off(struct intel_dp *intel_dp) · line 1826

Quoted 4 lines
drivers/gpu/drm/i915/intel_dp.c +2 -0
+	/* When we disable the VDD override bit last we have to do the manual
+	 * wait */

This comment formatting is a bit wonky too. Maybe polish it up while at it.

Quoted 19 lines
drivers/gpu/drm/i915/intel_dp.c +4 -1
+	if (panel_power_off_duration < intel_dp->panel_power_cycle_delay)
+		wait_remaining_ms_from_jiffies(jiffies,
+				       (intel_dp->panel_power_cycle_delay - panel_power_off_duration));
  	wait_panel_status(intel_dp, IDLE_CYCLE_MASK, IDLE_CYCLE_VALUE);
  }
 
@@ -1969,7 +1977,7 @@ static void edp_panel_vdd_off_sync(struct intel_dp *intel_dp)
  	I915_READ(pp_stat_reg), I915_READ(pp_ctrl_reg));
 
  	if ((pp & POWER_TARGET_ON) == 0)
-		intel_dp->last_power_cycle = jiffies;
+		intel_dp->panel_power_off_time = ktime_get_with_offset(TK_OFFS_BOOT);
 
  	power_domain = intel_display_port_aux_power_domain(intel_encoder);
  	intel_display_power_put(dev_priv, power_domain);
@@ -2118,7 +2126,6 @@ static void edp_panel_off(struct intel_dp *intel_dp)
  	I915_WRITE(pp_ctrl_reg, pp);
  	POSTING_READ(pp_ctrl_reg);
 
Quoted 6 lines
Quoted 3 lines

drivers/gpu/drm/i915/intel_dp.c static void edp_panel_off(struct intel_dp *intel_dp) · line 2121

Quoted 1 line
drivers/gpu/drm/i915/intel_dp.c +0 -1
-	intel_dp->last_power_cycle = jiffies;

Removing this doens't seem correct. Instead we should sample the clock here as well.

Do we really need "last_power_cycle" ? As the ktime_get_bootime() will always calculate the boot time in fresh boot from zero and we only need to track the delta time when we go to suspend and resume.

We need to track if from when the last power cycle was initiated.

Quoted 34 lines

this is the reason i removed last_power_cycle sampling and also initialization. Please let me know if this is ok and make sense?

Quoted 31 lines

drivers/gpu/drm/i915/intel_dp.c intel_dp_add_properties(struct intel_dp *intel_dp, struct drm_connector *connect · line 5125

Quoted 9 lines
drivers/gpu/drm/i915/intel_dp.c +0 -1
  	wait_panel_off(intel_dp);
 
  	/* We got a reference when we enabled the VDD. */
@@ -5122,7 +5129,6 @@ intel_dp_add_properties(struct intel_dp *intel_dp, struct drm_connector *connect
 
  static void intel_dp_init_panel_power_timestamps(struct intel_dp *intel_dp)
  {
-	intel_dp->last_power_cycle = jiffies;

and I suppose here too.

Quoted 20 lines
drivers/gpu/drm/i915/intel_dp.c +0 -0
  	intel_dp->last_power_on = jiffies;
  	intel_dp->last_backlight_off = jiffies;
  }
drivers/gpu/drm/i915/intel_drv.h +1 -1
index d523ebb..84ad134 100644
@@ -765,9 +765,9 @@ struct intel_dp {
  	int backlight_off_delay;
  	struct delayed_work panel_vdd_work;
  	bool want_panel_vdd;
-	unsigned long last_power_cycle;
  	unsigned long last_power_on;
  	unsigned long last_backlight_off;
+	ktime_t panel_power_off_time;
 
  	struct notifier_block edp_notifier;
 
Signature · 1 line
1.9.1
Signature · 6 lines
Ville Syrjälä
Intel OTC
_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx