aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/gpu/drm/i915/intel_ringbuffer.h
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/gpu/drm/i915/intel_ringbuffer.h')
-rw-r--r--drivers/gpu/drm/i915/intel_ringbuffer.h90
1 files changed, 79 insertions, 11 deletions
diff --git a/drivers/gpu/drm/i915/intel_ringbuffer.h b/drivers/gpu/drm/i915/intel_ringbuffer.h
index e72017bdcd7f..ed5941078f92 100644
--- a/drivers/gpu/drm/i915/intel_ringbuffer.h
+++ b/drivers/gpu/drm/i915/intel_ringbuffer.h
@@ -40,6 +40,32 @@ struct intel_hw_status_page {
40#define I915_READ_MODE(ring) I915_READ(RING_MI_MODE((ring)->mmio_base)) 40#define I915_READ_MODE(ring) I915_READ(RING_MI_MODE((ring)->mmio_base))
41#define I915_WRITE_MODE(ring, val) I915_WRITE(RING_MI_MODE((ring)->mmio_base), val) 41#define I915_WRITE_MODE(ring, val) I915_WRITE(RING_MI_MODE((ring)->mmio_base), val)
42 42
43/* seqno size is actually only a uint32, but since we plan to use MI_FLUSH_DW to
44 * do the writes, and that must have qw aligned offsets, simply pretend it's 8b.
45 */
46#define i915_semaphore_seqno_size sizeof(uint64_t)
47#define GEN8_SIGNAL_OFFSET(__ring, to) \
48 (i915_gem_obj_ggtt_offset(dev_priv->semaphore_obj) + \
49 ((__ring)->id * I915_NUM_RINGS * i915_semaphore_seqno_size) + \
50 (i915_semaphore_seqno_size * (to)))
51
52#define GEN8_WAIT_OFFSET(__ring, from) \
53 (i915_gem_obj_ggtt_offset(dev_priv->semaphore_obj) + \
54 ((from) * I915_NUM_RINGS * i915_semaphore_seqno_size) + \
55 (i915_semaphore_seqno_size * (__ring)->id))
56
57#define GEN8_RING_SEMAPHORE_INIT do { \
58 if (!dev_priv->semaphore_obj) { \
59 break; \
60 } \
61 ring->semaphore.signal_ggtt[RCS] = GEN8_SIGNAL_OFFSET(ring, RCS); \
62 ring->semaphore.signal_ggtt[VCS] = GEN8_SIGNAL_OFFSET(ring, VCS); \
63 ring->semaphore.signal_ggtt[BCS] = GEN8_SIGNAL_OFFSET(ring, BCS); \
64 ring->semaphore.signal_ggtt[VECS] = GEN8_SIGNAL_OFFSET(ring, VECS); \
65 ring->semaphore.signal_ggtt[VCS2] = GEN8_SIGNAL_OFFSET(ring, VCS2); \
66 ring->semaphore.signal_ggtt[ring->id] = MI_SEMAPHORE_SYNC_INVALID; \
67 } while(0)
68
43enum intel_ring_hangcheck_action { 69enum intel_ring_hangcheck_action {
44 HANGCHECK_IDLE = 0, 70 HANGCHECK_IDLE = 0,
45 HANGCHECK_WAIT, 71 HANGCHECK_WAIT,
@@ -127,15 +153,55 @@ struct intel_engine_cs {
127#define I915_DISPATCH_PINNED 0x2 153#define I915_DISPATCH_PINNED 0x2
128 void (*cleanup)(struct intel_engine_cs *ring); 154 void (*cleanup)(struct intel_engine_cs *ring);
129 155
156 /* GEN8 signal/wait table - never trust comments!
157 * signal to signal to signal to signal to signal to
158 * RCS VCS BCS VECS VCS2
159 * --------------------------------------------------------------------
160 * RCS | NOP (0x00) | VCS (0x08) | BCS (0x10) | VECS (0x18) | VCS2 (0x20) |
161 * |-------------------------------------------------------------------
162 * VCS | RCS (0x28) | NOP (0x30) | BCS (0x38) | VECS (0x40) | VCS2 (0x48) |
163 * |-------------------------------------------------------------------
164 * BCS | RCS (0x50) | VCS (0x58) | NOP (0x60) | VECS (0x68) | VCS2 (0x70) |
165 * |-------------------------------------------------------------------
166 * VECS | RCS (0x78) | VCS (0x80) | BCS (0x88) | NOP (0x90) | VCS2 (0x98) |
167 * |-------------------------------------------------------------------
168 * VCS2 | RCS (0xa0) | VCS (0xa8) | BCS (0xb0) | VECS (0xb8) | NOP (0xc0) |
169 * |-------------------------------------------------------------------
170 *
171 * Generalization:
172 * f(x, y) := (x->id * NUM_RINGS * seqno_size) + (seqno_size * y->id)
173 * ie. transpose of g(x, y)
174 *
175 * sync from sync from sync from sync from sync from
176 * RCS VCS BCS VECS VCS2
177 * --------------------------------------------------------------------
178 * RCS | NOP (0x00) | VCS (0x28) | BCS (0x50) | VECS (0x78) | VCS2 (0xa0) |
179 * |-------------------------------------------------------------------
180 * VCS | RCS (0x08) | NOP (0x30) | BCS (0x58) | VECS (0x80) | VCS2 (0xa8) |
181 * |-------------------------------------------------------------------
182 * BCS | RCS (0x10) | VCS (0x38) | NOP (0x60) | VECS (0x88) | VCS2 (0xb0) |
183 * |-------------------------------------------------------------------
184 * VECS | RCS (0x18) | VCS (0x40) | BCS (0x68) | NOP (0x90) | VCS2 (0xb8) |
185 * |-------------------------------------------------------------------
186 * VCS2 | RCS (0x20) | VCS (0x48) | BCS (0x70) | VECS (0x98) | NOP (0xc0) |
187 * |-------------------------------------------------------------------
188 *
189 * Generalization:
190 * g(x, y) := (y->id * NUM_RINGS * seqno_size) + (seqno_size * x->id)
191 * ie. transpose of f(x, y)
192 */
130 struct { 193 struct {
131 u32 sync_seqno[I915_NUM_RINGS-1]; 194 u32 sync_seqno[I915_NUM_RINGS-1];
132 195
133 struct { 196 union {
134 /* our mbox written by others */ 197 struct {
135 u32 wait[I915_NUM_RINGS]; 198 /* our mbox written by others */
136 /* mboxes this ring signals to */ 199 u32 wait[I915_NUM_RINGS];
137 u32 signal[I915_NUM_RINGS]; 200 /* mboxes this ring signals to */
138 } mbox; 201 u32 signal[I915_NUM_RINGS];
202 } mbox;
203 u64 signal_ggtt[I915_NUM_RINGS];
204 };
139 205
140 /* AKA wait() */ 206 /* AKA wait() */
141 int (*sync_to)(struct intel_engine_cs *ring, 207 int (*sync_to)(struct intel_engine_cs *ring,
@@ -238,9 +304,11 @@ intel_ring_sync_index(struct intel_engine_cs *ring,
238 int idx; 304 int idx;
239 305
240 /* 306 /*
241 * cs -> 0 = vcs, 1 = bcs 307 * rcs -> 0 = vcs, 1 = bcs, 2 = vecs, 3 = vcs2;
242 * vcs -> 0 = bcs, 1 = cs, 308 * vcs -> 0 = bcs, 1 = vecs, 2 = vcs2, 3 = rcs;
243 * bcs -> 0 = cs, 1 = vcs. 309 * bcs -> 0 = vecs, 1 = vcs2. 2 = rcs, 3 = vcs;
310 * vecs -> 0 = vcs2, 1 = rcs, 2 = vcs, 3 = bcs;
311 * vcs2 -> 0 = rcs, 1 = vcs, 2 = bcs, 3 = vecs;
244 */ 312 */
245 313
246 idx = (other - ring) - 1; 314 idx = (other - ring) - 1;
@@ -318,9 +386,9 @@ int intel_init_vebox_ring_buffer(struct drm_device *dev);
318u64 intel_ring_get_active_head(struct intel_engine_cs *ring); 386u64 intel_ring_get_active_head(struct intel_engine_cs *ring);
319void intel_ring_setup_status_page(struct intel_engine_cs *ring); 387void intel_ring_setup_status_page(struct intel_engine_cs *ring);
320 388
321static inline u32 intel_ring_get_tail(struct intel_engine_cs *ring) 389static inline u32 intel_ring_get_tail(struct intel_ringbuffer *ringbuf)
322{ 390{
323 return ring->buffer->tail; 391 return ringbuf->tail;
324} 392}
325 393
326static inline u32 intel_ring_get_seqno(struct intel_engine_cs *ring) 394static inline u32 intel_ring_get_seqno(struct intel_engine_cs *ring)