1 #ifndef _INTEL_RINGBUFFER_H_
2 #define _INTEL_RINGBUFFER_H_
4 struct intel_hw_status_page
{
7 struct drm_gem_object
*obj
;
10 struct drm_i915_gem_execbuffer2
;
11 struct intel_ring_buffer
{
25 unsigned int alignment
;
27 struct drm_device
*dev
;
28 struct drm_gem_object
*gem_object
;
33 struct intel_hw_status_page status_page
;
35 u32 irq_gem_seqno
; /* last seq seem at irq time */
36 u32 waiting_gem_seqno
;
37 int user_irq_refcount
;
38 void (*user_irq_get
)(struct drm_device
*dev
,
39 struct intel_ring_buffer
*ring
);
40 void (*user_irq_put
)(struct drm_device
*dev
,
41 struct intel_ring_buffer
*ring
);
42 void (*setup_status_page
)(struct drm_device
*dev
,
43 struct intel_ring_buffer
*ring
);
45 int (*init
)(struct drm_device
*dev
,
46 struct intel_ring_buffer
*ring
);
48 unsigned int (*get_head
)(struct drm_device
*dev
,
49 struct intel_ring_buffer
*ring
);
50 unsigned int (*get_tail
)(struct drm_device
*dev
,
51 struct intel_ring_buffer
*ring
);
52 void (*set_tail
)(struct drm_device
*dev
,
54 unsigned int (*get_active_head
)(struct drm_device
*dev
,
55 struct intel_ring_buffer
*ring
);
56 void (*flush
)(struct drm_device
*dev
,
57 struct intel_ring_buffer
*ring
,
58 u32 invalidate_domains
,
60 u32 (*add_request
)(struct drm_device
*dev
,
61 struct intel_ring_buffer
*ring
,
62 struct drm_file
*file_priv
,
64 u32 (*get_gem_seqno
)(struct drm_device
*dev
,
65 struct intel_ring_buffer
*ring
);
66 int (*dispatch_gem_execbuffer
)(struct drm_device
*dev
,
67 struct intel_ring_buffer
*ring
,
68 struct drm_i915_gem_execbuffer2
*exec
,
69 struct drm_clip_rect
*cliprects
,
70 uint64_t exec_offset
);
73 * List of objects currently involved in rendering from the
76 * Includes buffers having the contents of their GPU caches
77 * flushed, not necessarily primitives. last_rendering_seqno
78 * represents when the rendering involved will be completed.
80 * A reference is held on the buffer while on this list.
82 struct list_head active_list
;
85 * List of breadcrumbs associated with GPU requests currently
88 struct list_head request_list
;
91 * Do we have some not yet emitted requests outstanding?
93 bool outstanding_lazy_request
;
95 wait_queue_head_t irq_queue
;
100 intel_read_status_page(struct intel_ring_buffer
*ring
,
103 u32
*regs
= ring
->status_page
.page_addr
;
107 int intel_init_ring_buffer(struct drm_device
*dev
,
108 struct intel_ring_buffer
*ring
);
109 void intel_cleanup_ring_buffer(struct drm_device
*dev
,
110 struct intel_ring_buffer
*ring
);
111 int intel_wait_ring_buffer(struct drm_device
*dev
,
112 struct intel_ring_buffer
*ring
, int n
);
113 int intel_wrap_ring_buffer(struct drm_device
*dev
,
114 struct intel_ring_buffer
*ring
);
115 void intel_ring_begin(struct drm_device
*dev
,
116 struct intel_ring_buffer
*ring
, int n
);
118 static inline void intel_ring_emit(struct drm_device
*dev
,
119 struct intel_ring_buffer
*ring
,
122 unsigned int *virt
= ring
->virtual_start
+ ring
->tail
;
127 void intel_fill_struct(struct drm_device
*dev
,
128 struct intel_ring_buffer
*ring
,
131 void intel_ring_advance(struct drm_device
*dev
,
132 struct intel_ring_buffer
*ring
);
134 u32
intel_ring_get_seqno(struct drm_device
*dev
,
135 struct intel_ring_buffer
*ring
);
137 int intel_init_render_ring_buffer(struct drm_device
*dev
);
138 int intel_init_bsd_ring_buffer(struct drm_device
*dev
);
140 #endif /* _INTEL_RINGBUFFER_H_ */