1e3adcf8fSFrançois Tigeot #ifndef _INTEL_RINGBUFFER_H_ 2e3adcf8fSFrançois Tigeot #define _INTEL_RINGBUFFER_H_ 3e3adcf8fSFrançois Tigeot 4*ba55f2f5SFrançois Tigeot #include <linux/hashtable.h> 5*ba55f2f5SFrançois Tigeot 6*ba55f2f5SFrançois Tigeot #define I915_CMD_HASH_ORDER 9 7*ba55f2f5SFrançois Tigeot 8f4e1c372SFrançois Tigeot /* 9f4e1c372SFrançois Tigeot * Gen2 BSpec "1. Programming Environment" / 1.4.4.6 "Ring Buffer Use" 10f4e1c372SFrançois Tigeot * Gen3 BSpec "vol1c Memory Interface Functions" / 2.3.4.5 "Ring Buffer Use" 11f4e1c372SFrançois Tigeot * Gen4+ BSpec "vol1c Memory Interface and Command Stream" / 5.3.4.5 "Ring Buffer Use" 12f4e1c372SFrançois Tigeot * 13f4e1c372SFrançois Tigeot * "If the Ring Buffer Head Pointer and the Tail Pointer are on the same 14f4e1c372SFrançois Tigeot * cacheline, the Head Pointer must not be greater than the Tail 15f4e1c372SFrançois Tigeot * Pointer." 16f4e1c372SFrançois Tigeot */ 17f4e1c372SFrançois Tigeot #define I915_RING_FREE_SPACE 64 18f4e1c372SFrançois Tigeot 19e3adcf8fSFrançois Tigeot struct intel_hw_status_page { 20f4e1c372SFrançois Tigeot u32 *page_addr; 21e3adcf8fSFrançois Tigeot unsigned int gfx_addr; 22e3adcf8fSFrançois Tigeot struct drm_i915_gem_object *obj; 23e3adcf8fSFrançois Tigeot }; 24e3adcf8fSFrançois Tigeot 25e3adcf8fSFrançois Tigeot #define I915_READ_TAIL(ring) I915_READ(RING_TAIL((ring)->mmio_base)) 26e3adcf8fSFrançois Tigeot #define I915_WRITE_TAIL(ring, val) I915_WRITE(RING_TAIL((ring)->mmio_base), val) 27e3adcf8fSFrançois Tigeot 28e3adcf8fSFrançois Tigeot #define I915_READ_START(ring) I915_READ(RING_START((ring)->mmio_base)) 29e3adcf8fSFrançois Tigeot #define I915_WRITE_START(ring, val) I915_WRITE(RING_START((ring)->mmio_base), val) 30e3adcf8fSFrançois Tigeot 31e3adcf8fSFrançois Tigeot #define I915_READ_HEAD(ring) I915_READ(RING_HEAD((ring)->mmio_base)) 32e3adcf8fSFrançois Tigeot #define I915_WRITE_HEAD(ring, val) I915_WRITE(RING_HEAD((ring)->mmio_base), val) 33e3adcf8fSFrançois Tigeot 34e3adcf8fSFrançois Tigeot #define I915_READ_CTL(ring) I915_READ(RING_CTL((ring)->mmio_base)) 35e3adcf8fSFrançois Tigeot #define I915_WRITE_CTL(ring, val) I915_WRITE(RING_CTL((ring)->mmio_base), val) 36e3adcf8fSFrançois Tigeot 37e3adcf8fSFrançois Tigeot #define I915_READ_IMR(ring) I915_READ(RING_IMR((ring)->mmio_base)) 38e3adcf8fSFrançois Tigeot #define I915_WRITE_IMR(ring, val) I915_WRITE(RING_IMR((ring)->mmio_base), val) 39e3adcf8fSFrançois Tigeot 40*ba55f2f5SFrançois Tigeot #define I915_READ_MODE(ring) I915_READ(RING_MI_MODE((ring)->mmio_base)) 41*ba55f2f5SFrançois Tigeot #define I915_WRITE_MODE(ring, val) I915_WRITE(RING_MI_MODE((ring)->mmio_base), val) 42*ba55f2f5SFrançois Tigeot 439edbd4a0SFrançois Tigeot enum intel_ring_hangcheck_action { 449edbd4a0SFrançois Tigeot HANGCHECK_IDLE = 0, 459edbd4a0SFrançois Tigeot HANGCHECK_WAIT, 469edbd4a0SFrançois Tigeot HANGCHECK_ACTIVE, 479edbd4a0SFrançois Tigeot HANGCHECK_KICK, 489edbd4a0SFrançois Tigeot HANGCHECK_HUNG, 499edbd4a0SFrançois Tigeot }; 505d0b1887SFrançois Tigeot 51*ba55f2f5SFrançois Tigeot #define HANGCHECK_SCORE_RING_HUNG 31 52*ba55f2f5SFrançois Tigeot 535d0b1887SFrançois Tigeot struct intel_ring_hangcheck { 54*ba55f2f5SFrançois Tigeot u64 acthd; 555d0b1887SFrançois Tigeot u32 seqno; 565d0b1887SFrançois Tigeot int score; 575d0b1887SFrançois Tigeot enum intel_ring_hangcheck_action action; 58*ba55f2f5SFrançois Tigeot int deadlock; 595d0b1887SFrançois Tigeot }; 605d0b1887SFrançois Tigeot 61*ba55f2f5SFrançois Tigeot struct intel_ringbuffer { 62e3adcf8fSFrançois Tigeot struct drm_i915_gem_object *obj; 63*ba55f2f5SFrançois Tigeot void __iomem *virtual_start; 64e3adcf8fSFrançois Tigeot 6515ac6249SFrançois Tigeot u32 head; 6615ac6249SFrançois Tigeot u32 tail; 67e3adcf8fSFrançois Tigeot int space; 68e3adcf8fSFrançois Tigeot int size; 69e3adcf8fSFrançois Tigeot int effective_size; 70e3adcf8fSFrançois Tigeot 71e3adcf8fSFrançois Tigeot /** We track the position of the requests in the ring buffer, and 72e3adcf8fSFrançois Tigeot * when each is retired we increment last_retired_head as the GPU 73e3adcf8fSFrançois Tigeot * must have finished processing the request and so we know we 74e3adcf8fSFrançois Tigeot * can advance the ringbuffer up to that position. 75e3adcf8fSFrançois Tigeot * 76e3adcf8fSFrançois Tigeot * last_retired_head is set to -1 after the value is consumed so 77e3adcf8fSFrançois Tigeot * we can detect new retirements. 78e3adcf8fSFrançois Tigeot */ 79e3adcf8fSFrançois Tigeot u32 last_retired_head; 80*ba55f2f5SFrançois Tigeot }; 81*ba55f2f5SFrançois Tigeot 82*ba55f2f5SFrançois Tigeot struct intel_engine_cs { 83*ba55f2f5SFrançois Tigeot const char *name; 84*ba55f2f5SFrançois Tigeot enum intel_ring_id { 85*ba55f2f5SFrançois Tigeot RCS = 0x0, 86*ba55f2f5SFrançois Tigeot VCS, 87*ba55f2f5SFrançois Tigeot BCS, 88*ba55f2f5SFrançois Tigeot VECS, 89*ba55f2f5SFrançois Tigeot VCS2 90*ba55f2f5SFrançois Tigeot } id; 91*ba55f2f5SFrançois Tigeot #define I915_NUM_RINGS 5 92*ba55f2f5SFrançois Tigeot #define LAST_USER_RING (VECS + 1) 93*ba55f2f5SFrançois Tigeot u32 mmio_base; 94*ba55f2f5SFrançois Tigeot struct drm_device *dev; 95*ba55f2f5SFrançois Tigeot struct intel_ringbuffer *buffer; 96*ba55f2f5SFrançois Tigeot 97*ba55f2f5SFrançois Tigeot struct intel_hw_status_page status_page; 98e3adcf8fSFrançois Tigeot 999edbd4a0SFrançois Tigeot unsigned irq_refcount; /* protected by dev_priv->irq_lock */ 10015ac6249SFrançois Tigeot u32 irq_enable_mask; /* bitmask to enable ring interrupt */ 101b030f26bSFrançois Tigeot u32 trace_irq_seqno; 102*ba55f2f5SFrançois Tigeot bool __must_check (*irq_get)(struct intel_engine_cs *ring); 103*ba55f2f5SFrançois Tigeot void (*irq_put)(struct intel_engine_cs *ring); 104e3adcf8fSFrançois Tigeot 105*ba55f2f5SFrançois Tigeot int (*init)(struct intel_engine_cs *ring); 106e3adcf8fSFrançois Tigeot 107*ba55f2f5SFrançois Tigeot void (*write_tail)(struct intel_engine_cs *ring, 10815ac6249SFrançois Tigeot u32 value); 109*ba55f2f5SFrançois Tigeot int __must_check (*flush)(struct intel_engine_cs *ring, 11015ac6249SFrançois Tigeot u32 invalidate_domains, 11115ac6249SFrançois Tigeot u32 flush_domains); 112*ba55f2f5SFrançois Tigeot int (*add_request)(struct intel_engine_cs *ring); 113b030f26bSFrançois Tigeot /* Some chipsets are not quite as coherent as advertised and need 114b030f26bSFrançois Tigeot * an expensive kick to force a true read of the up-to-date seqno. 115b030f26bSFrançois Tigeot * However, the up-to-date seqno is not always required and the last 116b030f26bSFrançois Tigeot * seen value is good enough. Note that the seqno will always be 117b030f26bSFrançois Tigeot * monotonic, even if not coherent. 118b030f26bSFrançois Tigeot */ 119*ba55f2f5SFrançois Tigeot u32 (*get_seqno)(struct intel_engine_cs *ring, 120b030f26bSFrançois Tigeot bool lazy_coherency); 121*ba55f2f5SFrançois Tigeot void (*set_seqno)(struct intel_engine_cs *ring, 122a2fdbec6SFrançois Tigeot u32 seqno); 123*ba55f2f5SFrançois Tigeot int (*dispatch_execbuffer)(struct intel_engine_cs *ring, 124*ba55f2f5SFrançois Tigeot u64 offset, u32 length, 125b5c29a34SFrançois Tigeot unsigned flags); 12615ac6249SFrançois Tigeot #define I915_DISPATCH_SECURE 0x1 12715ac6249SFrançois Tigeot #define I915_DISPATCH_PINNED 0x2 128*ba55f2f5SFrançois Tigeot void (*cleanup)(struct intel_engine_cs *ring); 129e3adcf8fSFrançois Tigeot 130*ba55f2f5SFrançois Tigeot struct { 131*ba55f2f5SFrançois Tigeot u32 sync_seqno[I915_NUM_RINGS-1]; 132*ba55f2f5SFrançois Tigeot 133*ba55f2f5SFrançois Tigeot struct { 1345d0b1887SFrançois Tigeot /* our mbox written by others */ 135*ba55f2f5SFrançois Tigeot u32 wait[I915_NUM_RINGS]; 1365d0b1887SFrançois Tigeot /* mboxes this ring signals to */ 137*ba55f2f5SFrançois Tigeot u32 signal[I915_NUM_RINGS]; 138*ba55f2f5SFrançois Tigeot } mbox; 139*ba55f2f5SFrançois Tigeot 140*ba55f2f5SFrançois Tigeot /* AKA wait() */ 141*ba55f2f5SFrançois Tigeot int (*sync_to)(struct intel_engine_cs *ring, 142*ba55f2f5SFrançois Tigeot struct intel_engine_cs *to, 143*ba55f2f5SFrançois Tigeot u32 seqno); 144*ba55f2f5SFrançois Tigeot int (*signal)(struct intel_engine_cs *signaller, 145*ba55f2f5SFrançois Tigeot /* num_dwords needed by caller */ 146*ba55f2f5SFrançois Tigeot unsigned int num_dwords); 147*ba55f2f5SFrançois Tigeot } semaphore; 1485d0b1887SFrançois Tigeot 149e3adcf8fSFrançois Tigeot /** 150e3adcf8fSFrançois Tigeot * List of objects currently involved in rendering from the 151e3adcf8fSFrançois Tigeot * ringbuffer. 152e3adcf8fSFrançois Tigeot * 153e3adcf8fSFrançois Tigeot * Includes buffers having the contents of their GPU caches 154e3adcf8fSFrançois Tigeot * flushed, not necessarily primitives. last_rendering_seqno 155e3adcf8fSFrançois Tigeot * represents when the rendering involved will be completed. 156e3adcf8fSFrançois Tigeot * 157e3adcf8fSFrançois Tigeot * A reference is held on the buffer while on this list. 158e3adcf8fSFrançois Tigeot */ 159e3adcf8fSFrançois Tigeot struct list_head active_list; 160e3adcf8fSFrançois Tigeot 161e3adcf8fSFrançois Tigeot /** 162e3adcf8fSFrançois Tigeot * List of breadcrumbs associated with GPU requests currently 163e3adcf8fSFrançois Tigeot * outstanding. 164e3adcf8fSFrançois Tigeot */ 165e3adcf8fSFrançois Tigeot struct list_head request_list; 166e3adcf8fSFrançois Tigeot 167e3adcf8fSFrançois Tigeot /** 168e3adcf8fSFrançois Tigeot * Do we have some not yet emitted requests outstanding? 169e3adcf8fSFrançois Tigeot */ 1709edbd4a0SFrançois Tigeot struct drm_i915_gem_request *preallocated_lazy_request; 1719edbd4a0SFrançois Tigeot u32 outstanding_lazy_seqno; 172b030f26bSFrançois Tigeot bool gpu_caches_dirty; 1735d0b1887SFrançois Tigeot bool fbc_dirty; 174b030f26bSFrançois Tigeot 175b030f26bSFrançois Tigeot wait_queue_head_t irq_queue; 176e3adcf8fSFrançois Tigeot 177*ba55f2f5SFrançois Tigeot struct intel_context *default_context; 178*ba55f2f5SFrançois Tigeot struct intel_context *last_context; 1795d0b1887SFrançois Tigeot 1805d0b1887SFrançois Tigeot struct intel_ring_hangcheck hangcheck; 18115ac6249SFrançois Tigeot 1829edbd4a0SFrançois Tigeot struct { 1839edbd4a0SFrançois Tigeot struct drm_i915_gem_object *obj; 1849edbd4a0SFrançois Tigeot u32 gtt_offset; 1859edbd4a0SFrançois Tigeot volatile u32 *cpu_page; 1869edbd4a0SFrançois Tigeot } scratch; 187*ba55f2f5SFrançois Tigeot 188*ba55f2f5SFrançois Tigeot bool needs_cmd_parser; 189*ba55f2f5SFrançois Tigeot 190*ba55f2f5SFrançois Tigeot /* 191*ba55f2f5SFrançois Tigeot * Table of commands the command parser needs to know about 192*ba55f2f5SFrançois Tigeot * for this ring. 193*ba55f2f5SFrançois Tigeot */ 194*ba55f2f5SFrançois Tigeot DECLARE_HASHTABLE(cmd_hash, I915_CMD_HASH_ORDER); 195*ba55f2f5SFrançois Tigeot 196*ba55f2f5SFrançois Tigeot /* 197*ba55f2f5SFrançois Tigeot * Table of registers allowed in commands that read/write registers. 198*ba55f2f5SFrançois Tigeot */ 199*ba55f2f5SFrançois Tigeot const u32 *reg_table; 200*ba55f2f5SFrançois Tigeot int reg_count; 201*ba55f2f5SFrançois Tigeot 202*ba55f2f5SFrançois Tigeot /* 203*ba55f2f5SFrançois Tigeot * Table of registers allowed in commands that read/write registers, but 204*ba55f2f5SFrançois Tigeot * only from the DRM master. 205*ba55f2f5SFrançois Tigeot */ 206*ba55f2f5SFrançois Tigeot const u32 *master_reg_table; 207*ba55f2f5SFrançois Tigeot int master_reg_count; 208*ba55f2f5SFrançois Tigeot 209*ba55f2f5SFrançois Tigeot /* 210*ba55f2f5SFrançois Tigeot * Returns the bitmask for the length field of the specified command. 211*ba55f2f5SFrançois Tigeot * Return 0 for an unrecognized/invalid command. 212*ba55f2f5SFrançois Tigeot * 213*ba55f2f5SFrançois Tigeot * If the command parser finds an entry for a command in the ring's 214*ba55f2f5SFrançois Tigeot * cmd_tables, it gets the command's length based on the table entry. 215*ba55f2f5SFrançois Tigeot * If not, it calls this function to determine the per-ring length field 216*ba55f2f5SFrançois Tigeot * encoding for the command (i.e. certain opcode ranges use certain bits 217*ba55f2f5SFrançois Tigeot * to encode the command length in the header). 218*ba55f2f5SFrançois Tigeot */ 219*ba55f2f5SFrançois Tigeot u32 (*get_cmd_length_mask)(u32 cmd_header); 220e3adcf8fSFrançois Tigeot }; 221e3adcf8fSFrançois Tigeot 222f4e1c372SFrançois Tigeot static inline bool 223*ba55f2f5SFrançois Tigeot intel_ring_initialized(struct intel_engine_cs *ring) 224f4e1c372SFrançois Tigeot { 225*ba55f2f5SFrançois Tigeot return ring->buffer && ring->buffer->obj; 226f4e1c372SFrançois Tigeot } 227f4e1c372SFrançois Tigeot 228e3adcf8fSFrançois Tigeot static inline unsigned 229*ba55f2f5SFrançois Tigeot intel_ring_flag(struct intel_engine_cs *ring) 230e3adcf8fSFrançois Tigeot { 231e3adcf8fSFrançois Tigeot return 1 << ring->id; 232e3adcf8fSFrançois Tigeot } 233e3adcf8fSFrançois Tigeot 234f4e1c372SFrançois Tigeot static inline u32 235*ba55f2f5SFrançois Tigeot intel_ring_sync_index(struct intel_engine_cs *ring, 236*ba55f2f5SFrançois Tigeot struct intel_engine_cs *other) 237e3adcf8fSFrançois Tigeot { 238e3adcf8fSFrançois Tigeot int idx; 239e3adcf8fSFrançois Tigeot 240e3adcf8fSFrançois Tigeot /* 241e3adcf8fSFrançois Tigeot * cs -> 0 = vcs, 1 = bcs 242e3adcf8fSFrançois Tigeot * vcs -> 0 = bcs, 1 = cs, 243e3adcf8fSFrançois Tigeot * bcs -> 0 = cs, 1 = vcs. 244e3adcf8fSFrançois Tigeot */ 245e3adcf8fSFrançois Tigeot 246e3adcf8fSFrançois Tigeot idx = (other - ring) - 1; 247e3adcf8fSFrançois Tigeot if (idx < 0) 248e3adcf8fSFrançois Tigeot idx += I915_NUM_RINGS; 249e3adcf8fSFrançois Tigeot 250e3adcf8fSFrançois Tigeot return idx; 251e3adcf8fSFrançois Tigeot } 252e3adcf8fSFrançois Tigeot 253f4e1c372SFrançois Tigeot static inline u32 254*ba55f2f5SFrançois Tigeot intel_read_status_page(struct intel_engine_cs *ring, 255f4e1c372SFrançois Tigeot int reg) 256e3adcf8fSFrançois Tigeot { 257f4e1c372SFrançois Tigeot /* Ensure that the compiler doesn't optimize away the load. */ 2589edbd4a0SFrançois Tigeot barrier(); 259f4e1c372SFrançois Tigeot return ring->status_page.page_addr[reg]; 260e3adcf8fSFrançois Tigeot } 261e3adcf8fSFrançois Tigeot 262a2fdbec6SFrançois Tigeot static inline void 263*ba55f2f5SFrançois Tigeot intel_write_status_page(struct intel_engine_cs *ring, 264a2fdbec6SFrançois Tigeot int reg, u32 value) 265a2fdbec6SFrançois Tigeot { 266a2fdbec6SFrançois Tigeot ring->status_page.page_addr[reg] = value; 267a2fdbec6SFrançois Tigeot } 268a2fdbec6SFrançois Tigeot 269f4e1c372SFrançois Tigeot /** 270f4e1c372SFrançois Tigeot * Reads a dword out of the status page, which is written to from the command 271f4e1c372SFrançois Tigeot * queue by automatic updates, MI_REPORT_HEAD, MI_STORE_DATA_INDEX, or 272f4e1c372SFrançois Tigeot * MI_STORE_DATA_IMM. 273f4e1c372SFrançois Tigeot * 274f4e1c372SFrançois Tigeot * The following dwords have a reserved meaning: 275f4e1c372SFrançois Tigeot * 0x00: ISR copy, updated when an ISR bit not set in the HWSTAM changes. 276f4e1c372SFrançois Tigeot * 0x04: ring 0 head pointer 277f4e1c372SFrançois Tigeot * 0x05: ring 1 head pointer (915-class) 278f4e1c372SFrançois Tigeot * 0x06: ring 2 head pointer (915-class) 279f4e1c372SFrançois Tigeot * 0x10-0x1b: Context status DWords (GM45) 280f4e1c372SFrançois Tigeot * 0x1f: Last written status offset. (GM45) 281f4e1c372SFrançois Tigeot * 282f4e1c372SFrançois Tigeot * The area from dword 0x20 to 0x3ff is available for driver usage. 283f4e1c372SFrançois Tigeot */ 284f4e1c372SFrançois Tigeot #define I915_GEM_HWS_INDEX 0x20 285f4e1c372SFrançois Tigeot #define I915_GEM_HWS_SCRATCH_INDEX 0x30 286f4e1c372SFrançois Tigeot #define I915_GEM_HWS_SCRATCH_ADDR (I915_GEM_HWS_SCRATCH_INDEX << MI_STORE_DWORD_INDEX_SHIFT) 287e3adcf8fSFrançois Tigeot 288*ba55f2f5SFrançois Tigeot void intel_stop_ring_buffer(struct intel_engine_cs *ring); 289*ba55f2f5SFrançois Tigeot void intel_cleanup_ring_buffer(struct intel_engine_cs *ring); 290f4e1c372SFrançois Tigeot 291*ba55f2f5SFrançois Tigeot int __must_check intel_ring_begin(struct intel_engine_cs *ring, int n); 292*ba55f2f5SFrançois Tigeot int __must_check intel_ring_cacheline_align(struct intel_engine_cs *ring); 293*ba55f2f5SFrançois Tigeot static inline void intel_ring_emit(struct intel_engine_cs *ring, 294f4e1c372SFrançois Tigeot u32 data) 295e3adcf8fSFrançois Tigeot { 296*ba55f2f5SFrançois Tigeot struct intel_ringbuffer *ringbuf = ring->buffer; 297*ba55f2f5SFrançois Tigeot iowrite32(data, ringbuf->virtual_start + ringbuf->tail); 298*ba55f2f5SFrançois Tigeot ringbuf->tail += 4; 299e3adcf8fSFrançois Tigeot } 300*ba55f2f5SFrançois Tigeot static inline void intel_ring_advance(struct intel_engine_cs *ring) 3019edbd4a0SFrançois Tigeot { 302*ba55f2f5SFrançois Tigeot struct intel_ringbuffer *ringbuf = ring->buffer; 303*ba55f2f5SFrançois Tigeot ringbuf->tail &= ringbuf->size - 1; 3049edbd4a0SFrançois Tigeot } 305*ba55f2f5SFrançois Tigeot void __intel_ring_advance(struct intel_engine_cs *ring); 3069edbd4a0SFrançois Tigeot 307*ba55f2f5SFrançois Tigeot int __must_check intel_ring_idle(struct intel_engine_cs *ring); 308*ba55f2f5SFrançois Tigeot void intel_ring_init_seqno(struct intel_engine_cs *ring, u32 seqno); 309*ba55f2f5SFrançois Tigeot int intel_ring_flush_all_caches(struct intel_engine_cs *ring); 310*ba55f2f5SFrançois Tigeot int intel_ring_invalidate_all_caches(struct intel_engine_cs *ring); 311e3adcf8fSFrançois Tigeot 312e3adcf8fSFrançois Tigeot int intel_init_render_ring_buffer(struct drm_device *dev); 313e3adcf8fSFrançois Tigeot int intel_init_bsd_ring_buffer(struct drm_device *dev); 314*ba55f2f5SFrançois Tigeot int intel_init_bsd2_ring_buffer(struct drm_device *dev); 315e3adcf8fSFrançois Tigeot int intel_init_blt_ring_buffer(struct drm_device *dev); 3165d0b1887SFrançois Tigeot int intel_init_vebox_ring_buffer(struct drm_device *dev); 317e3adcf8fSFrançois Tigeot 318*ba55f2f5SFrançois Tigeot u64 intel_ring_get_active_head(struct intel_engine_cs *ring); 319*ba55f2f5SFrançois Tigeot void intel_ring_setup_status_page(struct intel_engine_cs *ring); 320e3adcf8fSFrançois Tigeot 321*ba55f2f5SFrançois Tigeot static inline u32 intel_ring_get_tail(struct intel_engine_cs *ring) 322e3adcf8fSFrançois Tigeot { 323*ba55f2f5SFrançois Tigeot return ring->buffer->tail; 324e3adcf8fSFrançois Tigeot } 325e3adcf8fSFrançois Tigeot 326*ba55f2f5SFrançois Tigeot static inline u32 intel_ring_get_seqno(struct intel_engine_cs *ring) 327f4e1c372SFrançois Tigeot { 3289edbd4a0SFrançois Tigeot BUG_ON(ring->outstanding_lazy_seqno == 0); 3299edbd4a0SFrançois Tigeot return ring->outstanding_lazy_seqno; 330f4e1c372SFrançois Tigeot } 331f4e1c372SFrançois Tigeot 332*ba55f2f5SFrançois Tigeot static inline void i915_trace_irq_get(struct intel_engine_cs *ring, u32 seqno) 333f4e1c372SFrançois Tigeot { 334f4e1c372SFrançois Tigeot if (ring->trace_irq_seqno == 0 && ring->irq_get(ring)) 335f4e1c372SFrançois Tigeot ring->trace_irq_seqno = seqno; 336f4e1c372SFrançois Tigeot } 337e3adcf8fSFrançois Tigeot 338e3adcf8fSFrançois Tigeot /* DRI warts */ 339f4e1c372SFrançois Tigeot int intel_render_ring_init_dri(struct drm_device *dev, u64 start, u32 size); 340e3adcf8fSFrançois Tigeot 341e3adcf8fSFrançois Tigeot #endif /* _INTEL_RINGBUFFER_H_ */ 342