drm/i915: Dumb down the semaphore logic
Subsystems (2)
PATCH 1/1 drm/i915: Dumb down the semaphore logic
While I think the previous code is correct, it was hard to follow and hard to debug. Since we already have a ring abstraction, might as well use it to handle the semaphore updates and compares.
I don't expect this code to make semaphores better or worse, but you never know...
Cc Chris Wilson <[email protected]>
Cc Daniel Vetter <[email protected]>
Cc Eric Anholt <[email protected]>
Signed-off-by Ben Widawsky <[email protected]>
--- drivers/gpu/drm/i915/i915_gem_execbuffer.c | 3 +- drivers/gpu/drm/i915/i915_reg.h | 7 + drivers/gpu/drm/i915/intel_ringbuffer.c | 171 ++++++++++++++++++++------- drivers/gpu/drm/i915/intel_ringbuffer.h | 7 +- 4 files changed, 139 insertions(+), 49 deletions(-)
drivers/gpu/drm/i915/i915_gem_execbuffer.c +2 -1
@@ -784,7 +784,8 @@ i915_gem_execbuffer_sync_rings(struct drm_i915_gem_object *obj, } from->sync_seqno[idx] = seqno; -return intel_ring_sync (to, from, seqno -1 ); + +return to->sync_to (to, from, seqno -1 ); } static int
drivers/gpu/drm/i915/i915_reg.h +7 -0
@@ -194,6 +194,13 @@#define MI_SEMAPHORE_UPDATE (1<<21)#define MI_SEMAPHORE_COMPARE (1<<20)#define MI_SEMAPHORE_REGISTER (1<<18) +#define MI_SEMAPHORE_SYNC_RV (2<<16) +#define MI_SEMAPHORE_SYNC_RB (0<<16) +#define MI_SEMAPHORE_SYNC_VR (0<<16) +#define MI_SEMAPHORE_SYNC_VB (2<<16) +#define MI_SEMAPHORE_SYNC_BR (2<<16) +#define MI_SEMAPHORE_SYNC_BV (0<<16) +#define MI_SEMAPHORE_SYNC_INVALID (1<<0)/* * 3D instructions used by the kernel */
drivers/gpu/drm/i915/intel_ringbuffer.c +126 -45
248 lines not on this page · raw message
drivers/gpu/drm/i915/intel_ringbuffer.h +4 -3
@@ -75,7 +75,11 @@ struct intel_ring_buffer {int (*dispatch_execbuffer)(struct intel_ring_buffer *ring,u32 offset,u32 length);void (*cleanup)(struct intel_ring_buffer *ring); +int (*sync_to)(struct intel_ring_buffer *ring, +struct intel_ring_buffer *to, +u32 seqno); +u32 semaphore_register[3 ];/** * List of objects currently involved in rendering from the * ringbuffer.
@@ -180,9 +184,6 @@ static inline void intel_ring_emit(struct intel_ring_buffer *ring,void intel_ring_advance (struct intel_ring_buffer *ring);u32 intel_ring_get_seqno (struct intel_ring_buffer *ring); -int intel_ring_sync (struct intel_ring_buffer *ring, -struct intel_ring_buffer *to, -u32 seqno);int intel_init_render_ring_buffer (struct drm_device *dev);int intel_init_bsd_ring_buffer (struct drm_device *dev);
Signature · 1 line
1.7.6.1
Quoted 11 lines · On Sun, 4 Sep 2011 20:52:42 -0700 Ben Widawsky <[email protected]> wrote:
While I think the previous code is correct, it was hard to follow and hard to debug. Since we already have a ring abstraction, might as well use it to handle the semaphore updates and compares.
I don't expect this code to make semaphores better or worse, but you never know...
Cc Chris Wilson <[email protected]>Cc Daniel Vetter <[email protected]>Cc Eric Anholt <[email protected]>Signed-off-by Ben Widawsky <[email protected]>
I just realized I forgot to use the new invalid #define in the code. I'll resubmit that tomorrow.
Ben