diff options
author | Ben Widawsky <benjamin.widawsky@intel.com> | 2014-04-29 17:52:29 -0400 |
---|---|---|
committer | Daniel Vetter <daniel.vetter@ffwll.ch> | 2014-05-05 04:56:53 -0400 |
commit | 78325f2d270897c9ee0887125b7abb963eb8efea (patch) | |
tree | 68112f7fcd949ced753c0ff964d6fa3eed5ad105 /drivers/gpu/drm/i915/intel_ringbuffer.c | |
parent | ebc348b2ad59ed5c9b22269f422d12095b640ff5 (diff) |
drm/i915: Virtualize the ringbuffer signal func
This abstraction again is in preparation for gen8. Gen8 will bring new
semantics for doing this operation.
While here, make the writes of MI_NOOPs explicit for non-existent rings.
This should have been implicit before.
NOTE: This is going to be removed in a few patches.
Reviewed-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Signed-off-by: Ben Widawsky <ben@bwidawsk.net>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Diffstat (limited to 'drivers/gpu/drm/i915/intel_ringbuffer.c')
-rw-r--r-- | drivers/gpu/drm/i915/intel_ringbuffer.c | 42 |
1 files changed, 25 insertions, 17 deletions
diff --git a/drivers/gpu/drm/i915/intel_ringbuffer.c b/drivers/gpu/drm/i915/intel_ringbuffer.c index 3076a99b2172..ea81b541ce0b 100644 --- a/drivers/gpu/drm/i915/intel_ringbuffer.c +++ b/drivers/gpu/drm/i915/intel_ringbuffer.c | |||
@@ -663,20 +663,32 @@ static void render_ring_cleanup(struct intel_ring_buffer *ring) | |||
663 | ring->scratch.obj = NULL; | 663 | ring->scratch.obj = NULL; |
664 | } | 664 | } |
665 | 665 | ||
666 | static void | 666 | static void gen6_signal(struct intel_ring_buffer *signaller) |
667 | update_mboxes(struct intel_ring_buffer *ring, | ||
668 | u32 mmio_offset) | ||
669 | { | 667 | { |
668 | struct drm_i915_private *dev_priv = signaller->dev->dev_private; | ||
669 | struct intel_ring_buffer *useless; | ||
670 | int i; | ||
671 | |||
670 | /* NB: In order to be able to do semaphore MBOX updates for varying number | 672 | /* NB: In order to be able to do semaphore MBOX updates for varying number |
671 | * of rings, it's easiest if we round up each individual update to a | 673 | * of rings, it's easiest if we round up each individual update to a |
672 | * multiple of 2 (since ring updates must always be a multiple of 2) | 674 | * multiple of 2 (since ring updates must always be a multiple of 2) |
673 | * even though the actual update only requires 3 dwords. | 675 | * even though the actual update only requires 3 dwords. |
674 | */ | 676 | */ |
675 | #define MBOX_UPDATE_DWORDS 4 | 677 | #define MBOX_UPDATE_DWORDS 4 |
676 | intel_ring_emit(ring, MI_LOAD_REGISTER_IMM(1)); | 678 | for_each_ring(useless, dev_priv, i) { |
677 | intel_ring_emit(ring, mmio_offset); | 679 | u32 mbox_reg = signaller->semaphore.mbox.signal[i]; |
678 | intel_ring_emit(ring, ring->outstanding_lazy_seqno); | 680 | if (mbox_reg != GEN6_NOSYNC) { |
679 | intel_ring_emit(ring, MI_NOOP); | 681 | intel_ring_emit(signaller, MI_LOAD_REGISTER_IMM(1)); |
682 | intel_ring_emit(signaller, mbox_reg); | ||
683 | intel_ring_emit(signaller, signaller->outstanding_lazy_seqno); | ||
684 | intel_ring_emit(signaller, MI_NOOP); | ||
685 | } else { | ||
686 | intel_ring_emit(signaller, MI_NOOP); | ||
687 | intel_ring_emit(signaller, MI_NOOP); | ||
688 | intel_ring_emit(signaller, MI_NOOP); | ||
689 | intel_ring_emit(signaller, MI_NOOP); | ||
690 | } | ||
691 | } | ||
680 | } | 692 | } |
681 | 693 | ||
682 | /** | 694 | /** |
@@ -692,9 +704,7 @@ static int | |||
692 | gen6_add_request(struct intel_ring_buffer *ring) | 704 | gen6_add_request(struct intel_ring_buffer *ring) |
693 | { | 705 | { |
694 | struct drm_device *dev = ring->dev; | 706 | struct drm_device *dev = ring->dev; |
695 | struct drm_i915_private *dev_priv = dev->dev_private; | 707 | int ret, num_dwords = 4; |
696 | struct intel_ring_buffer *useless; | ||
697 | int i, ret, num_dwords = 4; | ||
698 | 708 | ||
699 | if (i915_semaphore_is_enabled(dev)) | 709 | if (i915_semaphore_is_enabled(dev)) |
700 | num_dwords += ((I915_NUM_RINGS-1) * MBOX_UPDATE_DWORDS); | 710 | num_dwords += ((I915_NUM_RINGS-1) * MBOX_UPDATE_DWORDS); |
@@ -704,13 +714,7 @@ gen6_add_request(struct intel_ring_buffer *ring) | |||
704 | if (ret) | 714 | if (ret) |
705 | return ret; | 715 | return ret; |
706 | 716 | ||
707 | if (i915_semaphore_is_enabled(dev)) { | 717 | ring->semaphore.signal(ring); |
708 | for_each_ring(useless, dev_priv, i) { | ||
709 | u32 mbox_reg = ring->semaphore.mbox.signal[i]; | ||
710 | if (mbox_reg != GEN6_NOSYNC) | ||
711 | update_mboxes(ring, mbox_reg); | ||
712 | } | ||
713 | } | ||
714 | 718 | ||
715 | intel_ring_emit(ring, MI_STORE_DWORD_INDEX); | 719 | intel_ring_emit(ring, MI_STORE_DWORD_INDEX); |
716 | intel_ring_emit(ring, I915_GEM_HWS_INDEX << MI_STORE_DWORD_INDEX_SHIFT); | 720 | intel_ring_emit(ring, I915_GEM_HWS_INDEX << MI_STORE_DWORD_INDEX_SHIFT); |
@@ -1920,6 +1924,7 @@ int intel_init_render_ring_buffer(struct drm_device *dev) | |||
1920 | ring->get_seqno = gen6_ring_get_seqno; | 1924 | ring->get_seqno = gen6_ring_get_seqno; |
1921 | ring->set_seqno = ring_set_seqno; | 1925 | ring->set_seqno = ring_set_seqno; |
1922 | ring->semaphore.sync_to = gen6_ring_sync; | 1926 | ring->semaphore.sync_to = gen6_ring_sync; |
1927 | ring->semaphore.signal = gen6_signal; | ||
1923 | /* | 1928 | /* |
1924 | * The current semaphore is only applied on pre-gen8 platform. | 1929 | * The current semaphore is only applied on pre-gen8 platform. |
1925 | * And there is no VCS2 ring on the pre-gen8 platform. So the | 1930 | * And there is no VCS2 ring on the pre-gen8 platform. So the |
@@ -2104,6 +2109,7 @@ int intel_init_bsd_ring_buffer(struct drm_device *dev) | |||
2104 | gen6_ring_dispatch_execbuffer; | 2109 | gen6_ring_dispatch_execbuffer; |
2105 | } | 2110 | } |
2106 | ring->semaphore.sync_to = gen6_ring_sync; | 2111 | ring->semaphore.sync_to = gen6_ring_sync; |
2112 | ring->semaphore.signal = gen6_signal; | ||
2107 | /* | 2113 | /* |
2108 | * The current semaphore is only applied on pre-gen8 platform. | 2114 | * The current semaphore is only applied on pre-gen8 platform. |
2109 | * And there is no VCS2 ring on the pre-gen8 platform. So the | 2115 | * And there is no VCS2 ring on the pre-gen8 platform. So the |
@@ -2221,6 +2227,7 @@ int intel_init_blt_ring_buffer(struct drm_device *dev) | |||
2221 | ring->dispatch_execbuffer = gen6_ring_dispatch_execbuffer; | 2227 | ring->dispatch_execbuffer = gen6_ring_dispatch_execbuffer; |
2222 | } | 2228 | } |
2223 | ring->semaphore.sync_to = gen6_ring_sync; | 2229 | ring->semaphore.sync_to = gen6_ring_sync; |
2230 | ring->semaphore.signal = gen6_signal; | ||
2224 | /* | 2231 | /* |
2225 | * The current semaphore is only applied on pre-gen8 platform. And | 2232 | * The current semaphore is only applied on pre-gen8 platform. And |
2226 | * there is no VCS2 ring on the pre-gen8 platform. So the semaphore | 2233 | * there is no VCS2 ring on the pre-gen8 platform. So the semaphore |
@@ -2270,6 +2277,7 @@ int intel_init_vebox_ring_buffer(struct drm_device *dev) | |||
2270 | ring->dispatch_execbuffer = gen6_ring_dispatch_execbuffer; | 2277 | ring->dispatch_execbuffer = gen6_ring_dispatch_execbuffer; |
2271 | } | 2278 | } |
2272 | ring->semaphore.sync_to = gen6_ring_sync; | 2279 | ring->semaphore.sync_to = gen6_ring_sync; |
2280 | ring->semaphore.signal = gen6_signal; | ||
2273 | ring->semaphore.mbox.wait[RCS] = MI_SEMAPHORE_SYNC_VER; | 2281 | ring->semaphore.mbox.wait[RCS] = MI_SEMAPHORE_SYNC_VER; |
2274 | ring->semaphore.mbox.wait[VCS] = MI_SEMAPHORE_SYNC_VEV; | 2282 | ring->semaphore.mbox.wait[VCS] = MI_SEMAPHORE_SYNC_VEV; |
2275 | ring->semaphore.mbox.wait[BCS] = MI_SEMAPHORE_SYNC_VEB; | 2283 | ring->semaphore.mbox.wait[BCS] = MI_SEMAPHORE_SYNC_VEB; |