Linux Kernel  3.7.1
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
intel_ringbuffer.h
Go to the documentation of this file.
1 #ifndef _INTEL_RINGBUFFER_H_
2 #define _INTEL_RINGBUFFER_H_
3 
6  unsigned int gfx_addr;
8 };
9 
10 #define I915_READ_TAIL(ring) I915_READ(RING_TAIL((ring)->mmio_base))
11 #define I915_WRITE_TAIL(ring, val) I915_WRITE(RING_TAIL((ring)->mmio_base), val)
12 
13 #define I915_READ_START(ring) I915_READ(RING_START((ring)->mmio_base))
14 #define I915_WRITE_START(ring, val) I915_WRITE(RING_START((ring)->mmio_base), val)
15 
16 #define I915_READ_HEAD(ring) I915_READ(RING_HEAD((ring)->mmio_base))
17 #define I915_WRITE_HEAD(ring, val) I915_WRITE(RING_HEAD((ring)->mmio_base), val)
18 
19 #define I915_READ_CTL(ring) I915_READ(RING_CTL((ring)->mmio_base))
20 #define I915_WRITE_CTL(ring, val) I915_WRITE(RING_CTL((ring)->mmio_base), val)
21 
22 #define I915_READ_IMR(ring) I915_READ(RING_IMR((ring)->mmio_base))
23 #define I915_WRITE_IMR(ring, val) I915_WRITE(RING_IMR((ring)->mmio_base), val)
24 
25 #define I915_READ_NOPID(ring) I915_READ(RING_NOPID((ring)->mmio_base))
26 #define I915_READ_SYNC_0(ring) I915_READ(RING_SYNC_0((ring)->mmio_base))
27 #define I915_READ_SYNC_1(ring) I915_READ(RING_SYNC_1((ring)->mmio_base))
28 
30  const char *name;
32  RCS = 0x0,
33  VCS,
34  BCS,
35  } id;
36 #define I915_NUM_RINGS 3
39  struct drm_device *dev;
41 
44  int space;
45  int size;
48 
58 
59  u32 irq_refcount; /* protected by dev_priv->irq_lock */
60  u32 irq_enable_mask; /* bitmask to enable ring interrupt */
65 
67 
69  u32 value);
71  u32 invalidate_domains,
72  u32 flush_domains);
74  u32 *seqno);
75  /* Some chipsets are not quite as coherent as advertised and need
76  * an expensive kick to force a true read of the up-to-date seqno.
77  * However, the up-to-date seqno is not always required and the last
78  * seen value is good enough. Note that the seqno will always be
79  * monotonic, even if not coherent.
80  */
82  bool lazy_coherency);
84  u32 offset, u32 length);
87  struct intel_ring_buffer *to,
88  u32 seqno);
89 
90  u32 semaphore_register[3]; /*our mbox written by others */
91  u32 signal_mbox[2]; /* mboxes this ring signals to */
103 
109 
115 
117 
124 
125  void *private;
126 };
127 
128 static inline bool
129 intel_ring_initialized(struct intel_ring_buffer *ring)
130 {
131  return ring->obj != NULL;
132 }
133 
134 static inline unsigned
135 intel_ring_flag(struct intel_ring_buffer *ring)
136 {
137  return 1 << ring->id;
138 }
139 
140 static inline u32
141 intel_ring_sync_index(struct intel_ring_buffer *ring,
142  struct intel_ring_buffer *other)
143 {
144  int idx;
145 
146  /*
147  * cs -> 0 = vcs, 1 = bcs
148  * vcs -> 0 = bcs, 1 = cs,
149  * bcs -> 0 = cs, 1 = vcs.
150  */
151 
152  idx = (other - ring) - 1;
153  if (idx < 0)
154  idx += I915_NUM_RINGS;
155 
156  return idx;
157 }
158 
159 static inline u32
160 intel_read_status_page(struct intel_ring_buffer *ring,
161  int reg)
162 {
163  /* Ensure that the compiler doesn't optimize away the load. */
164  barrier();
165  return ring->status_page.page_addr[reg];
166 }
167 
183 #define I915_GEM_HWS_INDEX 0x20
184 
186 
188 static inline int intel_wait_ring_idle(struct intel_ring_buffer *ring)
189 {
190  return intel_wait_ring_buffer(ring, ring->size - 8);
191 }
192 
193 int __must_check intel_ring_begin(struct intel_ring_buffer *ring, int n);
194 
195 static inline void intel_ring_emit(struct intel_ring_buffer *ring,
196  u32 data)
197 {
198  iowrite32(data, ring->virtual_start + ring->tail);
199  ring->tail += 4;
200 }
201 
202 void intel_ring_advance(struct intel_ring_buffer *ring);
203 
207 
211 
214 
215 static inline u32 intel_ring_get_tail(struct intel_ring_buffer *ring)
216 {
217  return ring->tail;
218 }
219 
220 static inline void i915_trace_irq_get(struct intel_ring_buffer *ring, u32 seqno)
221 {
222  if (ring->trace_irq_seqno == 0 && ring->irq_get(ring))
223  ring->trace_irq_seqno = seqno;
224 }
225 
226 /* DRI warts */
228 
229 #endif /* _INTEL_RINGBUFFER_H_ */