From: Tvrtko Ursulin <tvrtko.ursulin@linux.intel.com>
To: Intel-gfx@lists.freedesktop.org
Subject: [PATCH 6/6] drm/i915: Only grab timestamps when needed
Date: Thu, 7 Jan 2016 16:36:21 +0000 [thread overview]
Message-ID: <1452184581-21075-7-git-send-email-tvrtko.ursulin@linux.intel.com> (raw)
In-Reply-To: <1452184581-21075-1-git-send-email-tvrtko.ursulin@linux.intel.com>
From: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
No need to call ktime_get_raw_ns twice per unlimited wait and can
also elimate a local variable.
Signed-off-by: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
---
drivers/gpu/drm/i915/i915_gem.c | 12 +++++++-----
1 file changed, 7 insertions(+), 5 deletions(-)
diff --git a/drivers/gpu/drm/i915/i915_gem.c b/drivers/gpu/drm/i915/i915_gem.c
index de98dc41fb9f..c4f69579eb7a 100644
--- a/drivers/gpu/drm/i915/i915_gem.c
+++ b/drivers/gpu/drm/i915/i915_gem.c
@@ -1246,7 +1246,7 @@ int __i915_wait_request(struct drm_i915_gem_request *req,
int state = interruptible ? TASK_INTERRUPTIBLE : TASK_UNINTERRUPTIBLE;
DEFINE_WAIT(wait);
unsigned long timeout_expire;
- s64 before, now;
+ s64 before = 0;
int ret;
WARN(!intel_irqs_enabled(dev_priv), "IRQs disabled");
@@ -1266,14 +1266,17 @@ int __i915_wait_request(struct drm_i915_gem_request *req,
return -ETIME;
timeout_expire = jiffies + nsecs_to_jiffies_timeout(*timeout);
+
+ /*
+ * Record current time in case interrupted by signal, or wedged.
+ */
+ before = ktime_get_raw_ns();
}
if (INTEL_INFO(dev_priv)->gen >= 6)
gen6_rps_boost(dev_priv, rps, req->emitted_jiffies);
- /* Record current time in case interrupted by signal, or wedged */
trace_i915_gem_request_wait_begin(req);
- before = ktime_get_raw_ns();
/* Optimistic spin for the next jiffie before touching IRQs */
ret = __i915_spin_request(req, state);
@@ -1331,11 +1334,10 @@ int __i915_wait_request(struct drm_i915_gem_request *req,
finish_wait(&ring->irq_queue, &wait);
out:
- now = ktime_get_raw_ns();
trace_i915_gem_request_wait_end(req);
if (timeout) {
- s64 tres = *timeout - (now - before);
+ s64 tres = *timeout - (ktime_get_raw_ns() - before);
*timeout = tres < 0 ? 0 : tres;
--
1.9.1
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
next prev parent reply other threads:[~2016-01-07 16:36 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-01-07 16:36 [PATCH 0/6] Misc cleanups Tvrtko Ursulin
2016-01-07 16:36 ` [PATCH 1/6] drm/i915/bdw+: Replace list_del+list_add_tail with list_move_tail Tvrtko Ursulin
2016-01-07 16:45 ` Chris Wilson
2016-01-07 17:18 ` Tvrtko Ursulin
2016-01-07 16:36 ` [PATCH 2/6] drm/i915: Don't need a timer to wake us up Tvrtko Ursulin
2016-01-07 16:36 ` [PATCH 3/6] drm/i915: Avoid invariant conditionals in lrc interrupt handler Tvrtko Ursulin
2016-01-07 16:42 ` Chris Wilson
2016-01-07 17:16 ` Tvrtko Ursulin
2016-01-07 16:36 ` [PATCH 4/6] drm/i915: Fail engine initialization if LRCA is incorrectly aligned Tvrtko Ursulin
2016-01-07 16:44 ` Chris Wilson
2016-01-07 16:36 ` [PATCH 5/6] drm/i915: Cache LRCA in the context Tvrtko Ursulin
2016-01-07 16:46 ` Chris Wilson
2016-01-07 17:18 ` Tvrtko Ursulin
2016-01-07 16:36 ` Tvrtko Ursulin [this message]
2016-01-07 16:47 ` [PATCH 6/6] drm/i915: Only grab timestamps when needed Chris Wilson
2016-01-07 17:20 ` Tvrtko Ursulin
2016-01-11 9:27 ` ✓ success: Fi.CI.BAT Patchwork
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1452184581-21075-7-git-send-email-tvrtko.ursulin@linux.intel.com \
--to=tvrtko.ursulin@linux.intel.com \
--cc=Intel-gfx@lists.freedesktop.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).