public inbox for intel-gfx@lists.freedesktop.org
 help / color / mirror / Atom feed
* [PATCH v2 1/2] drm/i915: fix wait_remaining_ms_from_jiffies
@ 2014-01-29 11:25 Imre Deak
  2014-01-29 11:25 ` [PATCH v2 2/2] drm/i915: fix initial timestamps for PP sequencing logic Imre Deak
  2014-01-29 13:26 ` [PATCH v2 1/2] drm/i915: fix wait_remaining_ms_from_jiffies Chris Wilson
  0 siblings, 2 replies; 5+ messages in thread
From: Imre Deak @ 2014-01-29 11:25 UTC (permalink / raw)
  To: intel-gfx

schedule_timeout_uninterruptible() takes jiffies not ms.

v2:
- ignore the overflow issue, the practical part of that should
  be solved instead in the caller (Chris)

Signed-off-by: Imre Deak <imre.deak@intel.com>
---
 drivers/gpu/drm/i915/i915_drv.h | 12 +++++-------
 1 file changed, 5 insertions(+), 7 deletions(-)

diff --git a/drivers/gpu/drm/i915/i915_drv.h b/drivers/gpu/drm/i915/i915_drv.h
index 3673ba1..8f396b9 100644
--- a/drivers/gpu/drm/i915/i915_drv.h
+++ b/drivers/gpu/drm/i915/i915_drv.h
@@ -2647,8 +2647,7 @@ timespec_to_jiffies_timeout(const struct timespec *value)
 static inline void
 wait_remaining_ms_from_jiffies(unsigned long timestamp_jiffies, int to_wait_ms)
 {
-	unsigned long target_jiffies, tmp_jiffies;
-	unsigned int remaining_ms;
+	unsigned long target_jiffies, tmp_jiffies, remaining_jiffies;
 
 	/*
 	 * Don't re-read the value of "jiffies" every time since it may change
@@ -2659,11 +2658,10 @@ wait_remaining_ms_from_jiffies(unsigned long timestamp_jiffies, int to_wait_ms)
 			 msecs_to_jiffies_timeout(to_wait_ms);
 
 	if (time_after(target_jiffies, tmp_jiffies)) {
-		remaining_ms = jiffies_to_msecs((long)target_jiffies -
-						(long)tmp_jiffies);
-		while (remaining_ms)
-			remaining_ms =
-				schedule_timeout_uninterruptible(remaining_ms);
+		remaining_jiffies = target_jiffies - tmp_jiffies;
+		while (remaining_jiffies)
+			remaining_jiffies =
+			    schedule_timeout_uninterruptible(remaining_jiffies);
 	}
 }
 
-- 
1.8.4

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [PATCH v2 2/2] drm/i915: fix initial timestamps for PP sequencing logic
  2014-01-29 11:25 [PATCH v2 1/2] drm/i915: fix wait_remaining_ms_from_jiffies Imre Deak
@ 2014-01-29 11:25 ` Imre Deak
  2014-01-29 13:26   ` Chris Wilson
  2014-01-29 13:26 ` [PATCH v2 1/2] drm/i915: fix wait_remaining_ms_from_jiffies Chris Wilson
  1 sibling, 1 reply; 5+ messages in thread
From: Imre Deak @ 2014-01-29 11:25 UTC (permalink / raw)
  To: intel-gfx

The initial jiffies value can be non-0, so set the inital panel power
sequencer timestamps accordingly. This didn't cause a problem on 64 bit
machines but on 32 bit jiffies is initially -300*HZ, so if the panel
power is initally off in the call from edp_panel_vdd_on()->
wait_panel_power_cycle() we'd wait up to ~300 sec more than needed.

Signed-off-by: Imre Deak <imre.deak@intel.com>
---
 drivers/gpu/drm/i915/intel_dp.c | 11 ++++++++++-
 1 file changed, 10 insertions(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/i915/intel_dp.c b/drivers/gpu/drm/i915/intel_dp.c
index 553b6a5..6fd1d0c 100644
--- a/drivers/gpu/drm/i915/intel_dp.c
+++ b/drivers/gpu/drm/i915/intel_dp.c
@@ -3494,6 +3494,13 @@ 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;
+}
+
 static void
 intel_dp_init_panel_power_sequencer(struct drm_device *dev,
 				    struct intel_dp *intel_dp,
@@ -3838,8 +3845,10 @@ intel_dp_init_connector(struct intel_digital_port *intel_dig_port,
 		BUG();
 	}
 
-	if (is_edp(intel_dp))
+	if (is_edp(intel_dp)) {
+		intel_dp_init_panel_power_timestamps(intel_dp);
 		intel_dp_init_panel_power_sequencer(dev, intel_dp, &power_seq);
+	}
 
 	error = intel_dp_i2c_init(intel_dp, intel_connector, name);
 	WARN(error, "intel_dp_i2c_init failed with error %d for port %c\n",
-- 
1.8.4

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH v2 2/2] drm/i915: fix initial timestamps for PP sequencing logic
  2014-01-29 11:25 ` [PATCH v2 2/2] drm/i915: fix initial timestamps for PP sequencing logic Imre Deak
@ 2014-01-29 13:26   ` Chris Wilson
  2014-01-29 19:47     ` Daniel Vetter
  0 siblings, 1 reply; 5+ messages in thread
From: Chris Wilson @ 2014-01-29 13:26 UTC (permalink / raw)
  To: Imre Deak; +Cc: intel-gfx

On Wed, Jan 29, 2014 at 01:25:41PM +0200, Imre Deak wrote:
> The initial jiffies value can be non-0, so set the inital panel power
> sequencer timestamps accordingly. This didn't cause a problem on 64 bit
> machines but on 32 bit jiffies is initially -300*HZ, so if the panel
> power is initally off in the call from edp_panel_vdd_on()->
> wait_panel_power_cycle() we'd wait up to ~300 sec more than needed.
> 
> Signed-off-by: Imre Deak <imre.deak@intel.com>

I would have set them all to the same value personally, but
Reviewed-by: Chris Wilson <chris@chris-wilson.co.uk>
-Chris

-- 
Chris Wilson, Intel Open Source Technology Centre

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH v2 1/2] drm/i915: fix wait_remaining_ms_from_jiffies
  2014-01-29 11:25 [PATCH v2 1/2] drm/i915: fix wait_remaining_ms_from_jiffies Imre Deak
  2014-01-29 11:25 ` [PATCH v2 2/2] drm/i915: fix initial timestamps for PP sequencing logic Imre Deak
@ 2014-01-29 13:26 ` Chris Wilson
  1 sibling, 0 replies; 5+ messages in thread
From: Chris Wilson @ 2014-01-29 13:26 UTC (permalink / raw)
  To: Imre Deak; +Cc: intel-gfx

On Wed, Jan 29, 2014 at 01:25:40PM +0200, Imre Deak wrote:
> schedule_timeout_uninterruptible() takes jiffies not ms.
> 
> v2:
> - ignore the overflow issue, the practical part of that should
>   be solved instead in the caller (Chris)
> 
> Signed-off-by: Imre Deak <imre.deak@intel.com>
Reviewed-by: Chris Wilson <chris@chris-wilson.co.uk>
-Chris

-- 
Chris Wilson, Intel Open Source Technology Centre

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH v2 2/2] drm/i915: fix initial timestamps for PP sequencing logic
  2014-01-29 13:26   ` Chris Wilson
@ 2014-01-29 19:47     ` Daniel Vetter
  0 siblings, 0 replies; 5+ messages in thread
From: Daniel Vetter @ 2014-01-29 19:47 UTC (permalink / raw)
  To: Chris Wilson, Imre Deak, intel-gfx

On Wed, Jan 29, 2014 at 01:26:27PM +0000, Chris Wilson wrote:
> On Wed, Jan 29, 2014 at 01:25:41PM +0200, Imre Deak wrote:
> > The initial jiffies value can be non-0, so set the inital panel power
> > sequencer timestamps accordingly. This didn't cause a problem on 64 bit
> > machines but on 32 bit jiffies is initially -300*HZ, so if the panel
> > power is initally off in the call from edp_panel_vdd_on()->
> > wait_panel_power_cycle() we'd wait up to ~300 sec more than needed.
> > 
> > Signed-off-by: Imre Deak <imre.deak@intel.com>
> 
> I would have set them all to the same value personally, but
> Reviewed-by: Chris Wilson <chris@chris-wilson.co.uk>

Both patches merged, thanks.
-Daniel
-- 
Daniel Vetter
Software Engineer, Intel Corporation
+41 (0) 79 365 57 48 - http://blog.ffwll.ch

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2014-01-29 19:47 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-01-29 11:25 [PATCH v2 1/2] drm/i915: fix wait_remaining_ms_from_jiffies Imre Deak
2014-01-29 11:25 ` [PATCH v2 2/2] drm/i915: fix initial timestamps for PP sequencing logic Imre Deak
2014-01-29 13:26   ` Chris Wilson
2014-01-29 19:47     ` Daniel Vetter
2014-01-29 13:26 ` [PATCH v2 1/2] drm/i915: fix wait_remaining_ms_from_jiffies Chris Wilson

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox