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.h66
1 files changed, 36 insertions, 30 deletions
diff --git a/drivers/gpu/drm/i915/intel_ringbuffer.h b/drivers/gpu/drm/i915/intel_ringbuffer.h
index 525e7d3edda8..9725f783db20 100644
--- a/drivers/gpu/drm/i915/intel_ringbuffer.h
+++ b/drivers/gpu/drm/i915/intel_ringbuffer.h
@@ -7,25 +7,31 @@ struct intel_hw_status_page {
7 struct drm_gem_object *obj; 7 struct drm_gem_object *obj;
8}; 8};
9 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#define I915_READ_START(ring) I915_READ(RING_START(ring->mmio_base))
13#define I915_WRITE_START(ring, val) I915_WRITE(RING_START(ring->mmio_base), val)
14#define I915_READ_HEAD(ring) I915_READ(RING_HEAD(ring->mmio_base))
15#define I915_WRITE_HEAD(ring, val) I915_WRITE(RING_HEAD(ring->mmio_base), val)
16#define I915_READ_CTL(ring) I915_READ(RING_CTL(ring->mmio_base))
17#define I915_WRITE_CTL(ring, val) I915_WRITE(RING_CTL(ring->mmio_base), val)
18
10struct drm_i915_gem_execbuffer2; 19struct drm_i915_gem_execbuffer2;
11struct intel_ring_buffer { 20struct intel_ring_buffer {
12 const char *name; 21 const char *name;
13 struct ring_regs { 22 enum intel_ring_id {
14 u32 ctl; 23 RING_RENDER = 0x1,
15 u32 head; 24 RING_BSD = 0x2,
16 u32 tail; 25 } id;
17 u32 start; 26 u32 mmio_base;
18 } regs;
19 unsigned int ring_flag;
20 unsigned long size; 27 unsigned long size;
21 unsigned int alignment;
22 void *virtual_start; 28 void *virtual_start;
23 struct drm_device *dev; 29 struct drm_device *dev;
24 struct drm_gem_object *gem_object; 30 struct drm_gem_object *gem_object;
25 31
26 unsigned int head; 32 unsigned int head;
27 unsigned int tail; 33 unsigned int tail;
28 unsigned int space; 34 int space;
29 struct intel_hw_status_page status_page; 35 struct intel_hw_status_page status_page;
30 36
31 u32 irq_gem_seqno; /* last seq seem at irq time */ 37 u32 irq_gem_seqno; /* last seq seem at irq time */
@@ -35,30 +41,22 @@ struct intel_ring_buffer {
35 struct intel_ring_buffer *ring); 41 struct intel_ring_buffer *ring);
36 void (*user_irq_put)(struct drm_device *dev, 42 void (*user_irq_put)(struct drm_device *dev,
37 struct intel_ring_buffer *ring); 43 struct intel_ring_buffer *ring);
38 void (*setup_status_page)(struct drm_device *dev,
39 struct intel_ring_buffer *ring);
40 44
41 int (*init)(struct drm_device *dev, 45 int (*init)(struct drm_device *dev,
42 struct intel_ring_buffer *ring); 46 struct intel_ring_buffer *ring);
43 47
44 unsigned int (*get_head)(struct drm_device *dev, 48 void (*set_tail)(struct drm_device *dev,
45 struct intel_ring_buffer *ring); 49 struct intel_ring_buffer *ring,
46 unsigned int (*get_tail)(struct drm_device *dev, 50 u32 value);
47 struct intel_ring_buffer *ring);
48 unsigned int (*get_active_head)(struct drm_device *dev,
49 struct intel_ring_buffer *ring);
50 void (*advance_ring)(struct drm_device *dev,
51 struct intel_ring_buffer *ring);
52 void (*flush)(struct drm_device *dev, 51 void (*flush)(struct drm_device *dev,
53 struct intel_ring_buffer *ring, 52 struct intel_ring_buffer *ring,
54 u32 invalidate_domains, 53 u32 invalidate_domains,
55 u32 flush_domains); 54 u32 flush_domains);
56 u32 (*add_request)(struct drm_device *dev, 55 u32 (*add_request)(struct drm_device *dev,
57 struct intel_ring_buffer *ring, 56 struct intel_ring_buffer *ring,
58 struct drm_file *file_priv,
59 u32 flush_domains); 57 u32 flush_domains);
60 u32 (*get_gem_seqno)(struct drm_device *dev, 58 u32 (*get_seqno)(struct drm_device *dev,
61 struct intel_ring_buffer *ring); 59 struct intel_ring_buffer *ring);
62 int (*dispatch_gem_execbuffer)(struct drm_device *dev, 60 int (*dispatch_gem_execbuffer)(struct drm_device *dev,
63 struct intel_ring_buffer *ring, 61 struct intel_ring_buffer *ring,
64 struct drm_i915_gem_execbuffer2 *exec, 62 struct drm_i915_gem_execbuffer2 *exec,
@@ -83,6 +81,11 @@ struct intel_ring_buffer {
83 */ 81 */
84 struct list_head request_list; 82 struct list_head request_list;
85 83
84 /**
85 * Do we have some not yet emitted requests outstanding?
86 */
87 bool outstanding_lazy_request;
88
86 wait_queue_head_t irq_queue; 89 wait_queue_head_t irq_queue;
87 drm_local_map_t map; 90 drm_local_map_t map;
88}; 91};
@@ -96,15 +99,13 @@ intel_read_status_page(struct intel_ring_buffer *ring,
96} 99}
97 100
98int intel_init_ring_buffer(struct drm_device *dev, 101int intel_init_ring_buffer(struct drm_device *dev,
99 struct intel_ring_buffer *ring); 102 struct intel_ring_buffer *ring);
100void intel_cleanup_ring_buffer(struct drm_device *dev, 103void intel_cleanup_ring_buffer(struct drm_device *dev,
101 struct intel_ring_buffer *ring); 104 struct intel_ring_buffer *ring);
102int intel_wait_ring_buffer(struct drm_device *dev, 105int intel_wait_ring_buffer(struct drm_device *dev,
103 struct intel_ring_buffer *ring, int n); 106 struct intel_ring_buffer *ring, int n);
104int intel_wrap_ring_buffer(struct drm_device *dev,
105 struct intel_ring_buffer *ring);
106void intel_ring_begin(struct drm_device *dev, 107void intel_ring_begin(struct drm_device *dev,
107 struct intel_ring_buffer *ring, int n); 108 struct intel_ring_buffer *ring, int n);
108 109
109static inline void intel_ring_emit(struct drm_device *dev, 110static inline void intel_ring_emit(struct drm_device *dev,
110 struct intel_ring_buffer *ring, 111 struct intel_ring_buffer *ring,
@@ -125,7 +126,12 @@ void intel_ring_advance(struct drm_device *dev,
125u32 intel_ring_get_seqno(struct drm_device *dev, 126u32 intel_ring_get_seqno(struct drm_device *dev,
126 struct intel_ring_buffer *ring); 127 struct intel_ring_buffer *ring);
127 128
128extern struct intel_ring_buffer render_ring; 129int intel_init_render_ring_buffer(struct drm_device *dev);
129extern struct intel_ring_buffer bsd_ring; 130int intel_init_bsd_ring_buffer(struct drm_device *dev);
131
132u32 intel_ring_get_active_head(struct drm_device *dev,
133 struct intel_ring_buffer *ring);
134void intel_ring_setup_status_page(struct drm_device *dev,
135 struct intel_ring_buffer *ring);
130 136
131#endif /* _INTEL_RINGBUFFER_H_ */ 137#endif /* _INTEL_RINGBUFFER_H_ */