From mboxrd@z Thu Jan 1 00:00:00 1970 From: Ben Widawsky Subject: Re: [PATCH 18/19] drm/i915: save some time when waiting the eDP timings Date: Mon, 25 Nov 2013 14:17:55 -0800 Message-ID: <20131125221755.GA19602@bwidawsk.net> References: <1385048853-1579-1-git-send-email-przanoni@gmail.com> <1385048853-1579-19-git-send-email-przanoni@gmail.com> <20131121160017.GD9515@nuc-i3427.alporthouse.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: Received: from mail.bwidawsk.net (bwidawsk.net [166.78.191.112]) by gabe.freedesktop.org (Postfix) with ESMTP id 99382FB2BB for ; Mon, 25 Nov 2013 14:18:00 -0800 (PST) Content-Disposition: inline In-Reply-To: <20131121160017.GD9515@nuc-i3427.alporthouse.com> List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: intel-gfx-bounces@lists.freedesktop.org Errors-To: intel-gfx-bounces@lists.freedesktop.org To: Chris Wilson , Paulo Zanoni , intel-gfx@lists.freedesktop.org, Paulo Zanoni List-Id: intel-gfx@lists.freedesktop.org On Thu, Nov 21, 2013 at 04:00:17PM +0000, Chris Wilson wrote: > On Thu, Nov 21, 2013 at 01:47:32PM -0200, Paulo Zanoni wrote: > > From: Paulo Zanoni > > > > The eDP spec defines some points where after you do action A, you have > > to wait some time before action B. The thing is that in our driver > > action B does not happen exactly after action A, but we still use > > msleep() calls directly. What this patch happens is that we record the > > timestamp of when action A happened, then, just before action B, we > > look at how much time has passed and only sleep the remaining amount > > needed. > > > > With this change, I am able to save about 5-20ms (out of the total > > 200ms) of the backlight_off delay and completely skip the 1ms > > backlight_on delay. The 600ms vdd_off delay doesn't happen during > > normal usage anymore due to a previous patch. > > > > Signed-off-by: Paulo Zanoni > > --- > > drivers/gpu/drm/i915/intel_dp.c | 38 +++++++++++++++++++++++++++++++++++--- > > drivers/gpu/drm/i915/intel_drv.h | 3 +++ > > 2 files changed, 38 insertions(+), 3 deletions(-) > > > > diff --git a/drivers/gpu/drm/i915/intel_dp.c b/drivers/gpu/drm/i915/intel_dp.c > > index b438e76..3a1ca80 100644 > > --- a/drivers/gpu/drm/i915/intel_dp.c > > +++ b/drivers/gpu/drm/i915/intel_dp.c > > @@ -1051,12 +1051,41 @@ static void ironlake_wait_panel_off(struct intel_dp *intel_dp) > > ironlake_wait_panel_status(intel_dp, IDLE_OFF_MASK, IDLE_OFF_VALUE); > > } > > > > +static void ironlake_wait_jiffies_delay(unsigned long timestamp, > > + int to_wait_ms) > This is not hw specific, so just > intel_wait_until_after(timestamp_jiffies, to_wait_ms) Can't we do this with our existing wait_for, and get all the other junk we've crammed in there? wait_for(false, timestamp + to_wait_ms) Or do I have this all wrong? > > > +{ > > + unsigned long target = timestamp + msecs_to_jiffies(to_wait_ms); > > + unsigned long diff; > > + > > + if (time_after(target, jiffies)) { > > + diff = (long)target - (long)jiffies; > > + msleep(diff); > > msleep() expects a duration in ms, diff is in jiffies. > -Chris > > -- > Chris Wilson, Intel Open Source Technology Centre > _______________________________________________ > Intel-gfx mailing list > Intel-gfx@lists.freedesktop.org > http://lists.freedesktop.org/mailman/listinfo/intel-gfx -- Ben Widawsky, Intel Open Source Technology Center