diff options
author | Chris Wilson <chris@chris-wilson.co.uk> | 2017-09-25 13:49:27 +0100 |
---|---|---|
committer | Chris Wilson <chris@chris-wilson.co.uk> | 2017-09-25 20:36:02 +0100 |
commit | 3f9e6cd8230a413fdf462aba35ea6b6166fa3631 (patch) | |
tree | 4f83611861a25f1a3ad4a4621f802a032d2f3ed5 /drivers/gpu/drm/i915/intel_lrc.c | |
parent | 6b12ca569bb2f864892c41dbbb0f88f3f9952bf3 (diff) | |
download | op-kernel-dev-3f9e6cd8230a413fdf462aba35ea6b6166fa3631.zip op-kernel-dev-3f9e6cd8230a413fdf462aba35ea6b6166fa3631.tar.gz |
drm/i915/execlists: Microoptimise execlists_cancel_port_request()
Just rearrange the code slightly to trim the number of iterations
required.
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Link: https://patchwork.freedesktop.org/patch/msgid/20170925124929.16974-1-chris@chris-wilson.co.uk
Reviewed-by: Mika Kuoppala <mika.kuoppala@linux.intel.com>
Diffstat (limited to 'drivers/gpu/drm/i915/intel_lrc.c')
-rw-r--r-- | drivers/gpu/drm/i915/intel_lrc.c | 17 |
1 files changed, 10 insertions, 7 deletions
diff --git a/drivers/gpu/drm/i915/intel_lrc.c b/drivers/gpu/drm/i915/intel_lrc.c index 3623403..2c07f3c 100644 --- a/drivers/gpu/drm/i915/intel_lrc.c +++ b/drivers/gpu/drm/i915/intel_lrc.c @@ -571,14 +571,17 @@ done: execlists_submit_ports(engine); } -static void execlist_cancel_port_requests(struct intel_engine_execlists *execlists) +static void +execlist_cancel_port_requests(struct intel_engine_execlists *execlists) { - unsigned int i; - - for (i = 0; i < ARRAY_SIZE(execlists->port); i++) - i915_gem_request_put(port_request(&execlists->port[i])); + struct execlist_port *port = execlists->port; + unsigned int num_ports = ARRAY_SIZE(execlists->port); - memset(execlists->port, 0, sizeof(execlists->port)); + while (num_ports-- && port_isset(port)) { + i915_gem_request_put(port_request(port)); + memset(port, 0, sizeof(*port)); + port++; + } } static void execlists_cancel_requests(struct intel_engine_cs *engine) @@ -625,7 +628,7 @@ static void execlists_cancel_requests(struct intel_engine_cs *engine) execlists->queue = RB_ROOT; execlists->first = NULL; - GEM_BUG_ON(port_isset(&execlists->port[0])); + GEM_BUG_ON(port_isset(execlists->port)); /* * The port is checked prior to scheduling a tasklet, but |