From mboxrd@z Thu Jan 1 00:00:00 1970 From: Jani Nikula Subject: Re: [PATCH] drm/i915: use hrtimer in wait for vblank Date: Mon, 24 Mar 2014 11:23:58 +0200 Message-ID: <8761n4vtjl.fsf@intel.com> References: <1395648818-14310-1-git-send-email-arun.r.murthy@intel.com> <20140324085134.GJ4366@nuc-i3427.alporthouse.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: Received: from mga11.intel.com (mga11.intel.com [192.55.52.93]) by gabe.freedesktop.org (Postfix) with ESMTP id 61A9B6E909 for ; Mon, 24 Mar 2014 02:24:01 -0700 (PDT) In-Reply-To: <20140324085134.GJ4366@nuc-i3427.alporthouse.com> List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: intel-gfx-bounces@lists.freedesktop.org Sender: "Intel-gfx" To: Chris Wilson , Arun R Murthy Cc: airlied@linux.ie, daniel.vetter@ffwll.ch, intel-gfx@lists.freedesktop.org List-Id: intel-gfx@lists.freedesktop.org On Mon, 24 Mar 2014, Chris Wilson wrote: > On Mon, Mar 24, 2014 at 01:43:38PM +0530, Arun R Murthy wrote: >> In wait for vblank use usleep_range, which will use hrtimers instead of >> msleep. Using msleep(1~20) there are more chances of sleeping for 20ms. >> Using usleep_range uses hrtimers and hence are precise, worst case will >> trigger an interrupt at the higher/max timeout. >> >> Signed-off-by: Arun R Murthy >> --- >> drivers/gpu/drm/i915/intel_drv.h | 2 +- >> 1 file changed, 1 insertion(+), 1 deletion(-) >> >> diff --git a/drivers/gpu/drm/i915/intel_drv.h b/drivers/gpu/drm/i915/intel_drv.h >> index 44067bc..079280a 100644 >> --- a/drivers/gpu/drm/i915/intel_drv.h >> +++ b/drivers/gpu/drm/i915/intel_drv.h >> @@ -52,7 +52,7 @@ >> break; \ >> } \ >> if (W && drm_can_sleep()) { \ >> - msleep(W); \ >> + usleep_range(W * 1000, W * 2 * 1000); \ >> } else { \ >> cpu_relax(); \ >> } \ > > Ok. But W is still just a random value we picked for being the mininum > legal value for msleep(). So just usleep_range(500, 2000) or somesuch > will be fine. We can rename W to CAN_SLEEP it that helps. We do use _wait_for directly from intel_dp.c with W == 10 to not retry so many times on what's expected to be a long wait. BR, Jani. > -Chris > > -- > Chris Wilson, Intel Open Source Technology Centre -- Jani Nikula, Intel Open Source Technology Center