]>
Commit | Line | Data |
---|---|---|
8187a2b7 ZN |
1 | #ifndef _INTEL_RINGBUFFER_H_ |
2 | #define _INTEL_RINGBUFFER_H_ | |
3 | ||
4 | struct intel_hw_status_page { | |
5 | void *page_addr; | |
6 | unsigned int gfx_addr; | |
7 | struct drm_gem_object *obj; | |
8 | }; | |
9 | ||
10 | struct drm_i915_gem_execbuffer2; | |
11 | struct intel_ring_buffer { | |
12 | const char *name; | |
13 | struct ring_regs { | |
14 | u32 ctl; | |
15 | u32 head; | |
16 | u32 tail; | |
17 | u32 start; | |
18 | } regs; | |
19 | unsigned int ring_flag; | |
20 | unsigned long size; | |
21 | unsigned int alignment; | |
22 | void *virtual_start; | |
23 | struct drm_device *dev; | |
24 | struct drm_gem_object *gem_object; | |
25 | ||
26 | unsigned int head; | |
27 | unsigned int tail; | |
28 | unsigned int space; | |
29 | u32 next_seqno; | |
30 | struct intel_hw_status_page status_page; | |
31 | ||
32 | u32 irq_gem_seqno; /* last seq seem at irq time */ | |
33 | u32 waiting_gem_seqno; | |
34 | int user_irq_refcount; | |
35 | void (*user_irq_get)(struct drm_device *dev, | |
36 | struct intel_ring_buffer *ring); | |
37 | void (*user_irq_put)(struct drm_device *dev, | |
38 | struct intel_ring_buffer *ring); | |
39 | void (*setup_status_page)(struct drm_device *dev, | |
40 | struct intel_ring_buffer *ring); | |
41 | ||
42 | int (*init)(struct drm_device *dev, | |
43 | struct intel_ring_buffer *ring); | |
44 | ||
45 | unsigned int (*get_head)(struct drm_device *dev, | |
46 | struct intel_ring_buffer *ring); | |
47 | unsigned int (*get_tail)(struct drm_device *dev, | |
48 | struct intel_ring_buffer *ring); | |
49 | unsigned int (*get_active_head)(struct drm_device *dev, | |
50 | struct intel_ring_buffer *ring); | |
51 | void (*advance_ring)(struct drm_device *dev, | |
52 | struct intel_ring_buffer *ring); | |
53 | void (*flush)(struct drm_device *dev, | |
54 | struct intel_ring_buffer *ring, | |
55 | u32 invalidate_domains, | |
56 | u32 flush_domains); | |
57 | u32 (*add_request)(struct drm_device *dev, | |
58 | struct intel_ring_buffer *ring, | |
59 | struct drm_file *file_priv, | |
60 | u32 flush_domains); | |
61 | u32 (*get_gem_seqno)(struct drm_device *dev, | |
62 | struct intel_ring_buffer *ring); | |
63 | int (*dispatch_gem_execbuffer)(struct drm_device *dev, | |
64 | struct intel_ring_buffer *ring, | |
65 | struct drm_i915_gem_execbuffer2 *exec, | |
66 | struct drm_clip_rect *cliprects, | |
67 | uint64_t exec_offset); | |
68 | ||
69 | /** | |
70 | * List of objects currently involved in rendering from the | |
71 | * ringbuffer. | |
72 | * | |
73 | * Includes buffers having the contents of their GPU caches | |
74 | * flushed, not necessarily primitives. last_rendering_seqno | |
75 | * represents when the rendering involved will be completed. | |
76 | * | |
77 | * A reference is held on the buffer while on this list. | |
78 | */ | |
79 | struct list_head active_list; | |
80 | ||
81 | /** | |
82 | * List of breadcrumbs associated with GPU requests currently | |
83 | * outstanding. | |
84 | */ | |
85 | struct list_head request_list; | |
86 | ||
87 | wait_queue_head_t irq_queue; | |
88 | drm_local_map_t map; | |
89 | }; | |
90 | ||
91 | static inline u32 | |
92 | intel_read_status_page(struct intel_ring_buffer *ring, | |
93 | int reg) | |
94 | { | |
95 | u32 *regs = ring->status_page.page_addr; | |
96 | return regs[reg]; | |
97 | } | |
98 | ||
99 | int intel_init_ring_buffer(struct drm_device *dev, | |
100 | struct intel_ring_buffer *ring); | |
101 | void intel_cleanup_ring_buffer(struct drm_device *dev, | |
102 | struct intel_ring_buffer *ring); | |
103 | int intel_wait_ring_buffer(struct drm_device *dev, | |
104 | struct intel_ring_buffer *ring, int n); | |
105 | int intel_wrap_ring_buffer(struct drm_device *dev, | |
106 | struct intel_ring_buffer *ring); | |
107 | void intel_ring_begin(struct drm_device *dev, | |
108 | struct intel_ring_buffer *ring, int n); | |
109 | void intel_ring_emit(struct drm_device *dev, | |
110 | struct intel_ring_buffer *ring, u32 data); | |
111 | void intel_fill_struct(struct drm_device *dev, | |
112 | struct intel_ring_buffer *ring, | |
113 | void *data, | |
114 | unsigned int len); | |
115 | void intel_ring_advance(struct drm_device *dev, | |
116 | struct intel_ring_buffer *ring); | |
117 | ||
118 | u32 intel_ring_get_seqno(struct drm_device *dev, | |
119 | struct intel_ring_buffer *ring); | |
120 | ||
121 | extern struct intel_ring_buffer render_ring; | |
122 | extern struct intel_ring_buffer bsd_ring; | |
123 | ||
124 | #endif /* _INTEL_RINGBUFFER_H_ */ |