All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/9] drm/i915: Make ptr_unpack_bits() more function-like
@ 2017-05-03 11:37 Chris Wilson
  2017-05-03 11:37 ` [PATCH 2/9] drm/i915: Redefine ptr_pack_bits() and friends Chris Wilson
                   ` (8 more replies)
  0 siblings, 9 replies; 33+ messages in thread
From: Chris Wilson @ 2017-05-03 11:37 UTC (permalink / raw)
  To: intel-gfx

ptr_unpack_bits() is a function-like macro, as such it is meant to be
replaceable by a function. In this case, we should be passing in the
out-param as a pointer.

Bizarrely this does affect code generation:

function                                     old     new   delta
i915_gem_object_pin_map                      409     389     -20

An improvement(?) in this case, but one can't help wonder what
strict-aliasing optimisations we are preventing.

The generated code looks identical in using ptr_unpack_bits (no extra
motions to stack, the pointer and bits appear to be kept in registers),
the difference appears to be code ordering and with a reorder it is able
to use smaller forward jumps.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Reviewed-by: Joonas Lahtinen <joonas.lahtinen@linux.intel.com>
---
 drivers/gpu/drm/i915/i915_gem.c   | 2 +-
 drivers/gpu/drm/i915/i915_utils.h | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/gpu/drm/i915/i915_gem.c b/drivers/gpu/drm/i915/i915_gem.c
index 0f8046e0a63c..a0186a5df05b 100644
--- a/drivers/gpu/drm/i915/i915_gem.c
+++ b/drivers/gpu/drm/i915/i915_gem.c
@@ -2631,7 +2631,7 @@ void *i915_gem_object_pin_map(struct drm_i915_gem_object *obj,
 	}
 	GEM_BUG_ON(!obj->mm.pages);
 
-	ptr = ptr_unpack_bits(obj->mm.mapping, has_type);
+	ptr = ptr_unpack_bits(obj->mm.mapping, &has_type);
 	if (ptr && has_type != type) {
 		if (pinned) {
 			ret = -EBUSY;
diff --git a/drivers/gpu/drm/i915/i915_utils.h b/drivers/gpu/drm/i915/i915_utils.h
index c5455d36b617..aca11aad5da7 100644
--- a/drivers/gpu/drm/i915/i915_utils.h
+++ b/drivers/gpu/drm/i915/i915_utils.h
@@ -77,7 +77,7 @@
 
 #define ptr_unpack_bits(ptr, bits) ({					\
 	unsigned long __v = (unsigned long)(ptr);			\
-	(bits) = __v & ~PAGE_MASK;					\
+	*(bits) = __v & ~PAGE_MASK;					\
 	(typeof(ptr))(__v & PAGE_MASK);					\
 })
 
-- 
2.11.0

_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply related	[flat|nested] 33+ messages in thread

end of thread, other threads:[~2017-05-05 14:26 UTC | newest]

Thread overview: 33+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-05-03 11:37 [PATCH 1/9] drm/i915: Make ptr_unpack_bits() more function-like Chris Wilson
2017-05-03 11:37 ` [PATCH 2/9] drm/i915: Redefine ptr_pack_bits() and friends Chris Wilson
2017-05-03 11:37 ` [PATCH 3/9] drm/i915/execlists: Pack the count into the low bits of the port.request Chris Wilson
2017-05-05 10:49   ` Tvrtko Ursulin
2017-05-05 11:16     ` Chris Wilson
2017-05-05 11:58       ` Tvrtko Ursulin
2017-05-03 11:37 ` [PATCH 4/9] drm/i915: Don't mark an execlists context-switch when idle Chris Wilson
2017-05-03 11:37 ` [PATCH 5/9] drm/i915: Use a define for the default priority [0] Chris Wilson
2017-05-04 13:32   ` Joonas Lahtinen
2017-05-04 13:58     ` Chris Wilson
2017-05-05  8:31       ` Mika Kuoppala
2017-05-05  9:13         ` Chris Wilson
2017-05-05  9:21           ` Tvrtko Ursulin
2017-05-05  9:50             ` Chris Wilson
2017-05-03 11:37 ` [PATCH 6/9] drm/i915: Split execlist priority queue into rbtree + linked list Chris Wilson
2017-05-05 13:19   ` Tvrtko Ursulin
2017-05-05 13:32     ` Chris Wilson
2017-05-05 13:37       ` Tvrtko Ursulin
2017-05-05 13:51         ` Chris Wilson
2017-05-05 14:20           ` Tvrtko Ursulin
2017-05-05 14:26             ` Chris Wilson
2017-05-05 13:50   ` Tvrtko Ursulin
2017-05-05 14:04     ` Chris Wilson
2017-05-05 14:24       ` Tvrtko Ursulin
2017-05-03 11:37 ` [PATCH 7/9] drm/i915/execlists: Reduce lock context between schedule/submit_request Chris Wilson
2017-05-05 12:13   ` Chris Wilson
2017-05-05 13:30   ` Tvrtko Ursulin
2017-05-05 13:38     ` Chris Wilson
2017-05-03 11:37 ` [PATCH 8/9] drm/i915: Stop inlining the execlists IRQ handler Chris Wilson
2017-05-04 13:55   ` Mika Kuoppala
2017-05-03 11:37 ` [PATCH 9/9] drm/i915: Don't force serialisation on marking up execlists irq posted Chris Wilson
2017-05-05 13:34   ` Tvrtko Ursulin
2017-05-03 12:25 ` ✓ Fi.CI.BAT: success for series starting with [1/9] drm/i915: Make ptr_unpack_bits() more function-like Patchwork

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.