diff mbox

[2/2] drm/i915: Move execlists port head instead of memmoving array

Message ID 20171130091028.18818-3-mika.kuoppala@linux.intel.com (mailing list archive)
State New, archived
Headers show

Commit Message

Mika Kuoppala Nov. 30, 2017, 9:10 a.m. UTC
From: Mika Kuoppala <mika.kuoppala@intel.com>

As all our access to execlist ports are through head and tail
helpers, we can now move the head instead of memmoving the array.

v2: use memset (Chris)

Cc: Michał Winiarski <michal.winiarski@intel.com>
Cc: Joonas Lahtinen <joonas.lahtinen@linux.intel.com>
Cc: Chris Wilson <chris@chris-wilson.co.uk>
Signed-off-by: Mika Kuoppala <mika.kuoppala@linux.intel.com>
Reviewed-by: Chris Wilson <chris@chris-wilson.co.uk>
---
 drivers/gpu/drm/i915/intel_ringbuffer.h | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

Comments

Chris Wilson Nov. 30, 2017, 10:26 a.m. UTC | #1
Quoting Mika Kuoppala (2017-11-30 09:10:28)
> From: Mika Kuoppala <mika.kuoppala@intel.com>
> 
> As all our access to execlist ports are through head and tail
> helpers, we can now move the head instead of memmoving the array.
> 
> v2: use memset (Chris)
> 
> Cc: Michał Winiarski <michal.winiarski@intel.com>
> Cc: Joonas Lahtinen <joonas.lahtinen@linux.intel.com>
> Cc: Chris Wilson <chris@chris-wilson.co.uk>
> Signed-off-by: Mika Kuoppala <mika.kuoppala@linux.intel.com>
> Reviewed-by: Chris Wilson <chris@chris-wilson.co.uk>

This patch:
add/remove: 0/0 grow/shrink: 0/3 up/down: 0/-58 (-58)
function                                     old     new   delta
execlists_cancel_port_requests               299     288     -11
guc_submission_tasklet                      1660    1643     -17
execlists_submission_tasklet                2245    2215     -30

Overall:
add/remove: 0/0 grow/shrink: 4/2 up/down: 322/-2 (320)
function                                     old     new   delta
guc_submission_tasklet                      1488    1643    +155
execlists_submission_tasklet                2129    2215     +86
intel_engine_dump                           2234    2281     +47
execlists_cancel_port_requests               254     288     +34
intel_engine_init_cmd_parser                1134    1133      -1
capture                                     5700    5699      -1

Better. Still room for improvement, 2215 bytes worth :)
-Chris
diff mbox

Patch

diff --git a/drivers/gpu/drm/i915/intel_ringbuffer.h b/drivers/gpu/drm/i915/intel_ringbuffer.h
index 17f1fb4ded89..6a3cb8e09ed6 100644
--- a/drivers/gpu/drm/i915/intel_ringbuffer.h
+++ b/drivers/gpu/drm/i915/intel_ringbuffer.h
@@ -685,13 +685,13 @@  static inline struct execlist_port *
 execlists_head_complete(struct intel_engine_execlists * const execlists,
 			struct execlist_port * const port)
 {
-	const unsigned int m = execlists->port_mask;
-
-	GEM_BUG_ON(port_index(port, execlists) != 0);
+	GEM_BUG_ON(port_index(port, execlists) != execlists->port_head);
+	GEM_BUG_ON(!port_isset(port));
 	GEM_BUG_ON(!execlists_is_active(execlists, EXECLISTS_ACTIVE_USER));
 
-	memmove(port, port + 1, m * sizeof(struct execlist_port));
-	memset(port + m, 0, sizeof(struct execlist_port));
+	memset(port, 0, sizeof(*port));
+
+	execlists->port_head = port_head_add(execlists, 1);
 
 	return execlists_port_head(execlists);
 }