Rev 3291 | Go to most recent revision | Only display areas with differences | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 3291 | Rev 3769 | ||
---|---|---|---|
1 | #ifndef SNA_RENDER_H |
1 | #ifndef SNA_RENDER_H |
2 | #define SNA_RENDER_H |
2 | #define SNA_RENDER_H |
3 | 3 | ||
4 | #include "compiler.h" |
4 | #include "compiler.h" |
5 | 5 | ||
6 | #include |
6 | #include |
7 | #include |
7 | #include |
8 | 8 | ||
9 | #define GRADIENT_CACHE_SIZE 16 |
9 | #define GRADIENT_CACHE_SIZE 16 |
10 | 10 | ||
11 | #define GXinvalid 0xff |
11 | #define GXinvalid 0xff |
12 | 12 | ||
13 | #define HW_BIT_BLIT (1<<0) /* BGRX blitter */ |
13 | #define HW_BIT_BLIT (1<<0) /* BGRX blitter */ |
14 | #define HW_TEX_BLIT (1<<1) /* stretch blit */ |
14 | #define HW_TEX_BLIT (1<<1) /* stretch blit */ |
15 | #define HW_VID_BLIT (1<<2) /* planar and packed video */ |
15 | #define HW_VID_BLIT (1<<2) /* planar and packed video */ |
16 | 16 | ||
17 | struct sna; |
17 | struct sna; |
18 | struct sna_glyph; |
18 | struct sna_glyph; |
19 | struct sna_video; |
19 | struct sna_video; |
20 | struct sna_video_frame; |
20 | struct sna_video_frame; |
21 | struct brw_compile; |
21 | struct brw_compile; |
22 | 22 | ||
23 | struct sna_composite_rectangles { |
23 | struct sna_composite_rectangles { |
24 | struct sna_coordinate { |
24 | struct sna_coordinate { |
25 | int16_t x, y; |
25 | int16_t x, y; |
26 | } src, mask, dst; |
26 | } src, mask, dst; |
27 | int16_t width, height; |
27 | int16_t width, height; |
28 | }; |
28 | }; |
29 | 29 | ||
30 | struct sna_composite_op { |
30 | struct sna_composite_op { |
31 | fastcall void (*blt)(struct sna *sna, const struct sna_composite_op *op, |
31 | fastcall void (*blt)(struct sna *sna, const struct sna_composite_op *op, |
32 | const struct sna_composite_rectangles *r); |
32 | const struct sna_composite_rectangles *r); |
33 | fastcall void (*box)(struct sna *sna, |
33 | fastcall void (*box)(struct sna *sna, |
34 | const struct sna_composite_op *op, |
34 | const struct sna_composite_op *op, |
35 | const BoxRec *box); |
35 | const BoxRec *box); |
36 | void (*boxes)(struct sna *sna, const struct sna_composite_op *op, |
36 | void (*boxes)(struct sna *sna, const struct sna_composite_op *op, |
37 | const BoxRec *box, int nbox); |
37 | const BoxRec *box, int nbox); |
38 | void (*done)(struct sna *sna, const struct sna_composite_op *op); |
38 | void (*done)(struct sna *sna, const struct sna_composite_op *op); |
39 | 39 | ||
40 | struct sna_damage **damage; |
40 | struct sna_damage **damage; |
41 | 41 | ||
42 | uint32_t op; |
42 | uint32_t op; |
43 | 43 | ||
44 | struct { |
44 | struct { |
45 | PixmapPtr pixmap; |
45 | PixmapPtr pixmap; |
46 | CARD32 format; |
46 | CARD32 format; |
47 | struct kgem_bo *bo; |
47 | struct kgem_bo *bo; |
48 | int16_t x, y; |
48 | int16_t x, y; |
49 | uint16_t width, height; |
49 | uint16_t width, height; |
50 | } dst; |
50 | } dst; |
51 | 51 | ||
52 | struct sna_composite_channel { |
52 | struct sna_composite_channel { |
53 | struct kgem_bo *bo; |
53 | struct kgem_bo *bo; |
54 | PictTransform *transform; |
54 | PictTransform *transform; |
55 | uint16_t width; |
55 | uint16_t width; |
56 | uint16_t height; |
56 | uint16_t height; |
57 | uint32_t pict_format; |
57 | uint32_t pict_format; |
58 | uint32_t card_format; |
58 | uint32_t card_format; |
59 | uint32_t filter; |
59 | uint32_t filter; |
60 | uint32_t repeat; |
60 | uint32_t repeat; |
61 | uint32_t is_affine : 1; |
61 | uint32_t is_affine : 1; |
62 | uint32_t is_solid : 1; |
62 | uint32_t is_solid : 1; |
63 | uint32_t is_linear : 1; |
63 | uint32_t is_linear : 1; |
64 | uint32_t is_opaque : 1; |
64 | uint32_t is_opaque : 1; |
65 | uint32_t alpha_fixup : 1; |
65 | uint32_t alpha_fixup : 1; |
66 | uint32_t rb_reversed : 1; |
66 | uint32_t rb_reversed : 1; |
67 | int16_t offset[2]; |
67 | int16_t offset[2]; |
68 | float scale[2]; |
68 | float scale[2]; |
69 | 69 | ||
70 | // pixman_transform_t embedded_transform; |
70 | // pixman_transform_t embedded_transform; |
71 | 71 | ||
72 | union { |
72 | union { |
73 | struct { |
73 | struct { |
74 | float dx, dy, offset; |
74 | float dx, dy, offset; |
75 | } linear; |
75 | } linear; |
76 | struct { |
76 | struct { |
77 | uint32_t pixel; |
77 | uint32_t pixel; |
78 | } gen2; |
78 | } gen2; |
79 | struct gen3_shader_channel { |
79 | struct gen3_shader_channel { |
80 | int type; |
80 | int type; |
81 | uint32_t mode; |
81 | uint32_t mode; |
82 | uint32_t constants; |
82 | uint32_t constants; |
83 | } gen3; |
83 | } gen3; |
84 | } u; |
84 | } u; |
85 | } src, mask; |
85 | } src, mask; |
86 | uint32_t is_affine : 1; |
86 | uint32_t is_affine : 1; |
87 | uint32_t has_component_alpha : 1; |
87 | uint32_t has_component_alpha : 1; |
88 | uint32_t need_magic_ca_pass : 1; |
88 | uint32_t need_magic_ca_pass : 1; |
89 | uint32_t rb_reversed : 1; |
89 | uint32_t rb_reversed : 1; |
90 | 90 | ||
91 | int16_t floats_per_vertex; |
91 | int16_t floats_per_vertex; |
92 | int16_t floats_per_rect; |
92 | int16_t floats_per_rect; |
93 | fastcall void (*prim_emit)(struct sna *sna, |
93 | fastcall void (*prim_emit)(struct sna *sna, |
94 | const struct sna_composite_op *op, |
94 | const struct sna_composite_op *op, |
95 | const struct sna_composite_rectangles *r); |
95 | const struct sna_composite_rectangles *r); |
96 | 96 | ||
97 | struct sna_composite_redirect { |
97 | struct sna_composite_redirect { |
98 | struct kgem_bo *real_bo; |
98 | struct kgem_bo *real_bo; |
99 | struct sna_damage **real_damage, *damage; |
99 | struct sna_damage **real_damage, *damage; |
100 | BoxRec box; |
100 | BoxRec box; |
101 | } redirect; |
101 | } redirect; |
102 | 102 | ||
103 | union { |
103 | union { |
104 | struct sna_blt_state { |
104 | struct sna_blt_state { |
105 | PixmapPtr src_pixmap; |
105 | PixmapPtr src_pixmap; |
106 | int16_t sx, sy; |
106 | int16_t sx, sy; |
107 | 107 | ||
108 | uint32_t inplace :1; |
108 | uint32_t inplace :1; |
109 | uint32_t overwrites:1; |
109 | uint32_t overwrites:1; |
110 | uint32_t bpp : 6; |
110 | uint32_t bpp : 6; |
111 | 111 | ||
112 | uint32_t cmd; |
112 | uint32_t cmd; |
113 | uint32_t br13; |
113 | uint32_t br13; |
114 | uint32_t pitch[2]; |
114 | uint32_t pitch[2]; |
115 | uint32_t pixel; |
115 | uint32_t pixel; |
116 | struct kgem_bo *bo[2]; |
116 | struct kgem_bo *bo[2]; |
117 | } blt; |
117 | } blt; |
118 | 118 | ||
119 | struct { |
119 | struct { |
120 | float constants[8]; |
120 | float constants[8]; |
121 | uint32_t num_constants; |
121 | uint32_t num_constants; |
122 | } gen3; |
122 | } gen3; |
123 | 123 | ||
124 | struct { |
124 | struct { |
125 | int wm_kernel; |
125 | int wm_kernel; |
126 | int ve_id; |
126 | int ve_id; |
127 | } gen4; |
127 | } gen4; |
128 | 128 | ||
129 | struct { |
129 | struct { |
130 | int16_t wm_kernel; |
130 | int16_t wm_kernel; |
131 | int16_t ve_id; |
131 | int16_t ve_id; |
132 | } gen5; |
132 | } gen5; |
133 | 133 | ||
134 | struct { |
134 | struct { |
135 | uint32_t flags; |
135 | uint32_t flags; |
136 | } gen6; |
136 | } gen6; |
137 | 137 | ||
138 | struct { |
138 | struct { |
139 | uint32_t flags; |
139 | uint32_t flags; |
140 | } gen7; |
140 | } gen7; |
141 | } u; |
141 | } u; |
142 | 142 | ||
143 | void *priv; |
143 | void *priv; |
144 | }; |
144 | }; |
145 | 145 | ||
146 | struct sna_copy_op { |
146 | struct sna_copy_op { |
147 | struct sna_composite_op base; |
147 | struct sna_composite_op base; |
148 | 148 | ||
149 | void (*blt)(struct sna *sna, const struct sna_copy_op *op, |
149 | void (*blt)(struct sna *sna, const struct sna_copy_op *op, |
150 | int16_t sx, int16_t sy, |
150 | int16_t sx, int16_t sy, |
151 | int16_t w, int16_t h, |
151 | int16_t w, int16_t h, |
152 | int16_t dx, int16_t dy); |
152 | int16_t dx, int16_t dy); |
153 | void (*done)(struct sna *sna, const struct sna_copy_op *op); |
153 | void (*done)(struct sna *sna, const struct sna_copy_op *op); |
154 | }; |
154 | }; |
155 | 155 | ||
156 | struct sna_render { |
156 | struct sna_render { |
157 | int active; |
157 | int active; |
158 | 158 | ||
159 | int caps; |
159 | int caps; |
160 | 160 | ||
161 | int max_3d_size; |
161 | int max_3d_size; |
162 | int max_3d_pitch; |
162 | int max_3d_pitch; |
163 | 163 | ||
164 | unsigned prefer_gpu; |
164 | unsigned prefer_gpu; |
165 | #define PREFER_GPU_BLT 0x1 |
165 | #define PREFER_GPU_BLT 0x1 |
166 | #define PREFER_GPU_RENDER 0x2 |
166 | #define PREFER_GPU_RENDER 0x2 |
167 | #define PREFER_GPU_SPANS 0x4 |
167 | #define PREFER_GPU_SPANS 0x4 |
168 | 168 | ||
169 | bool (*composite)(struct sna *sna, uint8_t op, |
169 | bool (*composite)(struct sna *sna, uint8_t op, |
170 | PicturePtr dst, PicturePtr src, PicturePtr mask, |
170 | PicturePtr dst, PicturePtr src, PicturePtr mask, |
171 | int16_t src_x, int16_t src_y, |
171 | int16_t src_x, int16_t src_y, |
172 | int16_t msk_x, int16_t msk_y, |
172 | int16_t msk_x, int16_t msk_y, |
173 | int16_t dst_x, int16_t dst_y, |
173 | int16_t dst_x, int16_t dst_y, |
174 | int16_t w, int16_t h, |
174 | int16_t w, int16_t h, |
175 | struct sna_composite_op *tmp); |
175 | struct sna_composite_op *tmp); |
176 | 176 | ||
177 | #if 0 |
177 | #if 0 |
178 | bool (*check_composite_spans)(struct sna *sna, uint8_t op, |
178 | bool (*check_composite_spans)(struct sna *sna, uint8_t op, |
179 | PicturePtr dst, PicturePtr src, |
179 | PicturePtr dst, PicturePtr src, |
180 | int16_t w, int16_t h, unsigned flags); |
180 | int16_t w, int16_t h, unsigned flags); |
181 | bool (*composite_spans)(struct sna *sna, uint8_t op, |
181 | bool (*composite_spans)(struct sna *sna, uint8_t op, |
182 | PicturePtr dst, PicturePtr src, |
182 | PicturePtr dst, PicturePtr src, |
183 | int16_t src_x, int16_t src_y, |
183 | int16_t src_x, int16_t src_y, |
184 | int16_t dst_x, int16_t dst_y, |
184 | int16_t dst_x, int16_t dst_y, |
185 | int16_t w, int16_t h, |
185 | int16_t w, int16_t h, |
186 | unsigned flags, |
186 | unsigned flags, |
187 | struct sna_composite_spans_op *tmp); |
187 | struct sna_composite_spans_op *tmp); |
188 | #define COMPOSITE_SPANS_RECTILINEAR 0x1 |
188 | #define COMPOSITE_SPANS_RECTILINEAR 0x1 |
189 | #define COMPOSITE_SPANS_INPLACE_HINT 0x2 |
189 | #define COMPOSITE_SPANS_INPLACE_HINT 0x2 |
190 | 190 | ||
191 | bool (*video)(struct sna *sna, |
191 | bool (*video)(struct sna *sna, |
192 | struct sna_video *video, |
192 | struct sna_video *video, |
193 | struct sna_video_frame *frame, |
193 | struct sna_video_frame *frame, |
194 | RegionPtr dstRegion, |
194 | RegionPtr dstRegion, |
195 | short src_w, short src_h, |
195 | short src_w, short src_h, |
196 | short drw_w, short drw_h, |
196 | short drw_w, short drw_h, |
197 | short dx, short dy, |
197 | short dx, short dy, |
198 | PixmapPtr pixmap); |
198 | PixmapPtr pixmap); |
199 | 199 | ||
200 | bool (*fill_boxes)(struct sna *sna, |
200 | bool (*fill_boxes)(struct sna *sna, |
201 | CARD8 op, |
201 | CARD8 op, |
202 | PictFormat format, |
202 | PictFormat format, |
203 | const xRenderColor *color, |
203 | const xRenderColor *color, |
204 | PixmapPtr dst, struct kgem_bo *dst_bo, |
204 | PixmapPtr dst, struct kgem_bo *dst_bo, |
205 | const BoxRec *box, int n); |
205 | const BoxRec *box, int n); |
206 | bool (*fill)(struct sna *sna, uint8_t alu, |
206 | bool (*fill)(struct sna *sna, uint8_t alu, |
207 | PixmapPtr dst, struct kgem_bo *dst_bo, |
207 | PixmapPtr dst, struct kgem_bo *dst_bo, |
208 | uint32_t color, |
208 | uint32_t color, |
209 | struct sna_fill_op *tmp); |
209 | struct sna_fill_op *tmp); |
210 | bool (*fill_one)(struct sna *sna, PixmapPtr dst, struct kgem_bo *dst_bo, |
210 | bool (*fill_one)(struct sna *sna, PixmapPtr dst, struct kgem_bo *dst_bo, |
211 | uint32_t color, |
211 | uint32_t color, |
212 | int16_t x1, int16_t y1, int16_t x2, int16_t y2, |
212 | int16_t x1, int16_t y1, int16_t x2, int16_t y2, |
213 | uint8_t alu); |
213 | uint8_t alu); |
214 | bool (*clear)(struct sna *sna, PixmapPtr dst, struct kgem_bo *dst_bo); |
214 | bool (*clear)(struct sna *sna, PixmapPtr dst, struct kgem_bo *dst_bo); |
215 | 215 | ||
216 | bool (*copy_boxes)(struct sna *sna, uint8_t alu, |
216 | bool (*copy_boxes)(struct sna *sna, uint8_t alu, |
217 | PixmapPtr src, struct kgem_bo *src_bo, int16_t src_dx, int16_t src_dy, |
217 | PixmapPtr src, struct kgem_bo *src_bo, int16_t src_dx, int16_t src_dy, |
218 | PixmapPtr dst, struct kgem_bo *dst_bo, int16_t dst_dx, int16_t dst_dy, |
218 | PixmapPtr dst, struct kgem_bo *dst_bo, int16_t dst_dx, int16_t dst_dy, |
219 | const BoxRec *box, int n, unsigned flags); |
219 | const BoxRec *box, int n, unsigned flags); |
220 | #define COPY_LAST 0x1 |
220 | #define COPY_LAST 0x1 |
221 | #define COPY_SYNC 0x2 |
221 | #define COPY_SYNC 0x2 |
222 | 222 | ||
223 | #endif |
223 | #endif |
224 | 224 | ||
225 | bool (*blit_tex)(struct sna *sna, |
225 | bool (*blit_tex)(struct sna *sna, |
226 | uint8_t op, |
226 | uint8_t op, bool scale, |
227 | PixmapPtr src, struct kgem_bo *src_bo, |
227 | PixmapPtr src, struct kgem_bo *src_bo, |
228 | PixmapPtr mask,struct kgem_bo *mask_bo, |
228 | PixmapPtr mask,struct kgem_bo *mask_bo, |
229 | PixmapPtr dst, struct kgem_bo *dst_bo, |
229 | PixmapPtr dst, struct kgem_bo *dst_bo, |
230 | int32_t src_x, int32_t src_y, |
230 | int32_t src_x, int32_t src_y, |
231 | int32_t msk_x, int32_t msk_y, |
231 | int32_t msk_x, int32_t msk_y, |
232 | int32_t dst_x, int32_t dst_y, |
232 | int32_t dst_x, int32_t dst_y, |
233 | int32_t width, int32_t height, |
233 | int32_t width, int32_t height, |
234 | struct sna_composite_op *tmp); |
234 | struct sna_composite_op *tmp); |
235 | 235 | ||
236 | bool (*copy)(struct sna *sna, uint8_t alu, |
236 | bool (*copy)(struct sna *sna, uint8_t alu, |
237 | PixmapPtr src, struct kgem_bo *src_bo, |
237 | PixmapPtr src, struct kgem_bo *src_bo, |
238 | PixmapPtr dst, struct kgem_bo *dst_bo, |
238 | PixmapPtr dst, struct kgem_bo *dst_bo, |
239 | struct sna_copy_op *op); |
239 | struct sna_copy_op *op); |
240 | 240 | ||
241 | void (*flush)(struct sna *sna); |
241 | void (*flush)(struct sna *sna); |
242 | void (*reset)(struct sna *sna); |
242 | void (*reset)(struct sna *sna); |
243 | void (*fini)(struct sna *sna); |
243 | void (*fini)(struct sna *sna); |
244 | 244 | ||
245 | #if 0 |
245 | #if 0 |
246 | 246 | ||
247 | struct sna_alpha_cache { |
247 | struct sna_alpha_cache { |
248 | struct kgem_bo *cache_bo; |
248 | struct kgem_bo *cache_bo; |
249 | struct kgem_bo *bo[256+7]; |
249 | struct kgem_bo *bo[256+7]; |
250 | } alpha_cache; |
250 | } alpha_cache; |
251 | 251 | ||
252 | struct sna_solid_cache { |
252 | struct sna_solid_cache { |
253 | struct kgem_bo *cache_bo; |
253 | struct kgem_bo *cache_bo; |
254 | struct kgem_bo *bo[1024]; |
254 | struct kgem_bo *bo[1024]; |
255 | uint32_t color[1025]; |
255 | uint32_t color[1025]; |
256 | int last; |
256 | int last; |
257 | int size; |
257 | int size; |
258 | int dirty; |
258 | int dirty; |
259 | } solid_cache; |
259 | } solid_cache; |
260 | 260 | ||
261 | struct { |
261 | struct { |
262 | struct sna_gradient_cache { |
262 | struct sna_gradient_cache { |
263 | struct kgem_bo *bo; |
263 | struct kgem_bo *bo; |
264 | int nstops; |
264 | int nstops; |
265 | PictGradientStop *stops; |
265 | PictGradientStop *stops; |
266 | } cache[GRADIENT_CACHE_SIZE]; |
266 | } cache[GRADIENT_CACHE_SIZE]; |
267 | int size; |
267 | int size; |
268 | } gradient_cache; |
268 | } gradient_cache; |
269 | 269 | ||
270 | struct sna_glyph_cache{ |
270 | struct sna_glyph_cache{ |
271 | PicturePtr picture; |
271 | PicturePtr picture; |
272 | struct sna_glyph **glyphs; |
272 | struct sna_glyph **glyphs; |
273 | uint16_t count; |
273 | uint16_t count; |
274 | uint16_t evict; |
274 | uint16_t evict; |
275 | } glyph[2]; |
275 | } glyph[2]; |
276 | pixman_image_t *white_image; |
276 | pixman_image_t *white_image; |
277 | PicturePtr white_picture; |
277 | PicturePtr white_picture; |
278 | #if HAS_PIXMAN_GLYPHS |
278 | #if HAS_PIXMAN_GLYPHS |
279 | pixman_glyph_cache_t *glyph_cache; |
279 | pixman_glyph_cache_t *glyph_cache; |
280 | #endif |
280 | #endif |
281 | 281 | ||
282 | #endif |
282 | #endif |
283 | 283 | ||
284 | uint16_t vb_id; |
284 | uint16_t vb_id; |
285 | uint16_t vertex_offset; |
285 | uint16_t vertex_offset; |
286 | uint16_t vertex_start; |
286 | uint16_t vertex_start; |
287 | uint16_t vertex_index; |
287 | uint16_t vertex_index; |
288 | uint16_t vertex_used; |
288 | uint16_t vertex_used; |
289 | uint16_t vertex_size; |
289 | uint16_t vertex_size; |
290 | uint16_t vertex_reloc[16]; |
290 | uint16_t vertex_reloc[16]; |
291 | int nvertex_reloc; |
291 | int nvertex_reloc; |
292 | 292 | ||
293 | struct kgem_bo *vbo; |
293 | struct kgem_bo *vbo; |
294 | float *vertices; |
294 | float *vertices; |
295 | 295 | ||
296 | float vertex_data[1024]; |
296 | float vertex_data[1024]; |
297 | }; |
297 | }; |
298 | 298 | ||
299 | struct gen2_render_state { |
299 | struct gen2_render_state { |
300 | uint32_t target; |
300 | uint32_t target; |
301 | bool need_invariant; |
301 | bool need_invariant; |
302 | uint32_t logic_op_enabled; |
302 | uint32_t logic_op_enabled; |
303 | uint32_t ls1, ls2, vft; |
303 | uint32_t ls1, ls2, vft; |
304 | uint32_t diffuse; |
304 | uint32_t diffuse; |
305 | uint32_t specular; |
305 | uint32_t specular; |
306 | }; |
306 | }; |
307 | 307 | ||
308 | struct gen3_render_state { |
308 | struct gen3_render_state { |
309 | uint32_t current_dst; |
309 | uint32_t current_dst; |
310 | bool need_invariant; |
310 | bool need_invariant; |
311 | uint32_t tex_count; |
311 | uint32_t tex_count; |
312 | uint32_t last_drawrect_limit; |
312 | uint32_t last_drawrect_limit; |
313 | uint32_t last_target; |
313 | uint32_t last_target; |
314 | uint32_t last_blend; |
314 | uint32_t last_blend; |
315 | uint32_t last_constants; |
315 | uint32_t last_constants; |
316 | uint32_t last_sampler; |
316 | uint32_t last_sampler; |
317 | uint32_t last_shader; |
317 | uint32_t last_shader; |
318 | uint32_t last_diffuse; |
318 | uint32_t last_diffuse; |
319 | uint32_t last_specular; |
319 | uint32_t last_specular; |
320 | 320 | ||
321 | uint16_t last_vertex_offset; |
321 | uint16_t last_vertex_offset; |
322 | uint16_t floats_per_vertex; |
322 | uint16_t floats_per_vertex; |
323 | uint16_t last_floats_per_vertex; |
323 | uint16_t last_floats_per_vertex; |
324 | 324 | ||
325 | uint32_t tex_map[4]; |
325 | uint32_t tex_map[4]; |
326 | uint32_t tex_handle[2]; |
326 | uint32_t tex_handle[2]; |
327 | uint32_t tex_delta[2]; |
327 | uint32_t tex_delta[2]; |
328 | }; |
328 | }; |
329 | 329 | ||
330 | struct gen4_render_state { |
330 | struct gen4_render_state { |
331 | struct kgem_bo *general_bo; |
331 | struct kgem_bo *general_bo; |
332 | 332 | ||
333 | uint32_t vs; |
333 | uint32_t vs; |
334 | uint32_t sf; |
334 | uint32_t sf; |
335 | uint32_t wm; |
335 | uint32_t wm; |
336 | uint32_t cc; |
336 | uint32_t cc; |
337 | 337 | ||
338 | int ve_id; |
338 | int ve_id; |
339 | uint32_t drawrect_offset; |
339 | uint32_t drawrect_offset; |
340 | uint32_t drawrect_limit; |
340 | uint32_t drawrect_limit; |
341 | uint32_t last_pipelined_pointers; |
341 | uint32_t last_pipelined_pointers; |
342 | uint16_t last_primitive; |
342 | uint16_t last_primitive; |
343 | int16_t floats_per_vertex; |
343 | int16_t floats_per_vertex; |
344 | uint16_t surface_table; |
344 | uint16_t surface_table; |
345 | 345 | ||
346 | bool needs_invariant; |
346 | bool needs_invariant; |
347 | bool needs_urb; |
347 | bool needs_urb; |
348 | }; |
348 | }; |
349 | 349 | ||
350 | struct gen5_render_state { |
350 | struct gen5_render_state { |
351 | struct kgem_bo *general_bo; |
351 | struct kgem_bo *general_bo; |
352 | 352 | ||
353 | uint32_t vs; |
353 | uint32_t vs; |
354 | uint32_t sf[2]; |
354 | uint32_t sf[2]; |
355 | uint32_t wm; |
355 | uint32_t wm; |
356 | uint32_t cc; |
356 | uint32_t cc; |
357 | 357 | ||
358 | int ve_id; |
358 | int ve_id; |
359 | uint32_t drawrect_offset; |
359 | uint32_t drawrect_offset; |
360 | uint32_t drawrect_limit; |
360 | uint32_t drawrect_limit; |
361 | uint16_t last_primitive; |
361 | uint16_t last_primitive; |
362 | int16_t floats_per_vertex; |
362 | int16_t floats_per_vertex; |
363 | uint16_t surface_table; |
363 | uint16_t surface_table; |
364 | uint16_t last_pipelined_pointers; |
364 | uint16_t last_pipelined_pointers; |
365 | 365 | ||
366 | bool needs_invariant; |
366 | bool needs_invariant; |
367 | }; |
367 | }; |
368 | 368 | ||
369 | enum { |
369 | enum { |
370 | GEN6_WM_KERNEL_NOMASK = 0, |
370 | GEN6_WM_KERNEL_NOMASK = 0, |
371 | GEN6_WM_KERNEL_NOMASK_P, |
371 | GEN6_WM_KERNEL_NOMASK_P, |
372 | 372 | ||
373 | GEN6_WM_KERNEL_MASK, |
373 | GEN6_WM_KERNEL_MASK, |
374 | GEN6_WM_KERNEL_MASK_P, |
374 | GEN6_WM_KERNEL_MASK_P, |
375 | 375 | ||
376 | GEN6_WM_KERNEL_MASKCA, |
376 | GEN6_WM_KERNEL_MASKCA, |
377 | GEN6_WM_KERNEL_MASKCA_P, |
377 | GEN6_WM_KERNEL_MASKCA_P, |
378 | 378 | ||
379 | GEN6_WM_KERNEL_MASKSA, |
379 | GEN6_WM_KERNEL_MASKSA, |
380 | GEN6_WM_KERNEL_MASKSA_P, |
380 | GEN6_WM_KERNEL_MASKSA_P, |
381 | 381 | ||
382 | GEN6_WM_KERNEL_OPACITY, |
382 | GEN6_WM_KERNEL_OPACITY, |
383 | GEN6_WM_KERNEL_OPACITY_P, |
383 | GEN6_WM_KERNEL_OPACITY_P, |
384 | 384 | ||
385 | GEN6_WM_KERNEL_VIDEO_PLANAR, |
385 | GEN6_WM_KERNEL_VIDEO_PLANAR, |
386 | GEN6_WM_KERNEL_VIDEO_PACKED, |
386 | GEN6_WM_KERNEL_VIDEO_PACKED, |
387 | GEN6_KERNEL_COUNT |
387 | GEN6_KERNEL_COUNT |
388 | }; |
388 | }; |
389 | 389 | ||
390 | struct gen6_render_state { |
390 | struct gen6_render_state { |
391 | const struct gt_info *info; |
391 | const struct gt_info *info; |
392 | struct kgem_bo *general_bo; |
392 | struct kgem_bo *general_bo; |
393 | 393 | ||
394 | uint32_t vs_state; |
394 | uint32_t vs_state; |
395 | uint32_t sf_state; |
395 | uint32_t sf_state; |
396 | uint32_t sf_mask_state; |
396 | uint32_t sf_mask_state; |
397 | uint32_t wm_state; |
397 | uint32_t wm_state; |
398 | uint32_t wm_kernel[GEN6_KERNEL_COUNT][3]; |
398 | uint32_t wm_kernel[GEN6_KERNEL_COUNT][3]; |
399 | 399 | ||
400 | uint32_t cc_blend; |
400 | uint32_t cc_blend; |
401 | 401 | ||
402 | uint32_t drawrect_offset; |
402 | uint32_t drawrect_offset; |
403 | uint32_t drawrect_limit; |
403 | uint32_t drawrect_limit; |
404 | uint32_t blend; |
404 | uint32_t blend; |
405 | uint32_t samplers; |
405 | uint32_t samplers; |
406 | uint32_t kernel; |
406 | uint32_t kernel; |
407 | 407 | ||
408 | uint16_t num_sf_outputs; |
408 | uint16_t num_sf_outputs; |
409 | uint16_t ve_id; |
409 | uint16_t ve_id; |
410 | uint16_t last_primitive; |
410 | uint16_t last_primitive; |
411 | int16_t floats_per_vertex; |
411 | int16_t floats_per_vertex; |
412 | uint16_t surface_table; |
412 | uint16_t surface_table; |
413 | 413 | ||
414 | bool needs_invariant; |
414 | bool needs_invariant; |
415 | bool first_state_packet; |
415 | bool first_state_packet; |
416 | }; |
416 | }; |
417 | 417 | ||
418 | enum { |
418 | enum { |
419 | GEN7_WM_KERNEL_NOMASK = 0, |
419 | GEN7_WM_KERNEL_NOMASK = 0, |
420 | GEN7_WM_KERNEL_NOMASK_P, |
420 | GEN7_WM_KERNEL_NOMASK_P, |
421 | 421 | ||
422 | GEN7_WM_KERNEL_MASK, |
422 | GEN7_WM_KERNEL_MASK, |
423 | GEN7_WM_KERNEL_MASK_P, |
423 | GEN7_WM_KERNEL_MASK_P, |
424 | 424 | ||
425 | GEN7_WM_KERNEL_MASKCA, |
425 | GEN7_WM_KERNEL_MASKCA, |
426 | GEN7_WM_KERNEL_MASKCA_P, |
426 | GEN7_WM_KERNEL_MASKCA_P, |
427 | 427 | ||
428 | GEN7_WM_KERNEL_MASKSA, |
428 | GEN7_WM_KERNEL_MASKSA, |
429 | GEN7_WM_KERNEL_MASKSA_P, |
429 | GEN7_WM_KERNEL_MASKSA_P, |
430 | 430 | ||
431 | GEN7_WM_KERNEL_OPACITY, |
431 | GEN7_WM_KERNEL_OPACITY, |
432 | GEN7_WM_KERNEL_OPACITY_P, |
432 | GEN7_WM_KERNEL_OPACITY_P, |
433 | 433 | ||
434 | GEN7_WM_KERNEL_VIDEO_PLANAR, |
434 | GEN7_WM_KERNEL_VIDEO_PLANAR, |
435 | GEN7_WM_KERNEL_VIDEO_PACKED, |
435 | GEN7_WM_KERNEL_VIDEO_PACKED, |
436 | GEN7_WM_KERNEL_COUNT |
436 | GEN7_WM_KERNEL_COUNT |
437 | }; |
437 | }; |
438 | 438 | ||
439 | struct gen7_render_state { |
439 | struct gen7_render_state { |
440 | const struct gt_info *info; |
440 | const struct gt_info *info; |
441 | struct kgem_bo *general_bo; |
441 | struct kgem_bo *general_bo; |
442 | 442 | ||
443 | uint32_t vs_state; |
443 | uint32_t vs_state; |
444 | uint32_t sf_state; |
444 | uint32_t sf_state; |
445 | uint32_t sf_mask_state; |
445 | uint32_t sf_mask_state; |
446 | uint32_t wm_state; |
446 | uint32_t wm_state; |
447 | uint32_t wm_kernel[GEN7_WM_KERNEL_COUNT][3]; |
447 | uint32_t wm_kernel[GEN7_WM_KERNEL_COUNT][3]; |
448 | 448 | ||
449 | uint32_t cc_blend; |
449 | uint32_t cc_blend; |
450 | 450 | ||
451 | uint32_t drawrect_offset; |
451 | uint32_t drawrect_offset; |
452 | uint32_t drawrect_limit; |
452 | uint32_t drawrect_limit; |
453 | uint32_t blend; |
453 | uint32_t blend; |
454 | uint32_t samplers; |
454 | uint32_t samplers; |
455 | uint32_t kernel; |
455 | uint32_t kernel; |
456 | 456 | ||
457 | uint16_t num_sf_outputs; |
457 | uint16_t num_sf_outputs; |
458 | uint16_t ve_id; |
458 | uint16_t ve_id; |
459 | uint16_t last_primitive; |
459 | uint16_t last_primitive; |
460 | int16_t floats_per_vertex; |
460 | int16_t floats_per_vertex; |
461 | uint16_t surface_table; |
461 | uint16_t surface_table; |
462 | 462 | ||
463 | bool needs_invariant; |
463 | bool needs_invariant; |
464 | bool emit_flush; |
464 | bool emit_flush; |
465 | }; |
465 | }; |
466 | 466 | ||
467 | struct sna_static_stream { |
467 | struct sna_static_stream { |
468 | uint32_t size, used; |
468 | uint32_t size, used; |
469 | uint8_t *data; |
469 | uint8_t *data; |
470 | }; |
470 | }; |
471 | 471 | ||
472 | int sna_static_stream_init(struct sna_static_stream *stream); |
472 | int sna_static_stream_init(struct sna_static_stream *stream); |
473 | uint32_t sna_static_stream_add(struct sna_static_stream *stream, |
473 | uint32_t sna_static_stream_add(struct sna_static_stream *stream, |
474 | const void *data, uint32_t len, uint32_t align); |
474 | const void *data, uint32_t len, uint32_t align); |
475 | void *sna_static_stream_map(struct sna_static_stream *stream, |
475 | void *sna_static_stream_map(struct sna_static_stream *stream, |
476 | uint32_t len, uint32_t align); |
476 | uint32_t len, uint32_t align); |
477 | uint32_t sna_static_stream_offsetof(struct sna_static_stream *stream, |
477 | uint32_t sna_static_stream_offsetof(struct sna_static_stream *stream, |
478 | void *ptr); |
478 | void *ptr); |
479 | unsigned sna_static_stream_compile_sf(struct sna *sna, |
479 | unsigned sna_static_stream_compile_sf(struct sna *sna, |
480 | struct sna_static_stream *stream, |
480 | struct sna_static_stream *stream, |
481 | bool (*compile)(struct brw_compile *)); |
481 | bool (*compile)(struct brw_compile *)); |
482 | 482 | ||
483 | unsigned sna_static_stream_compile_wm(struct sna *sna, |
483 | unsigned sna_static_stream_compile_wm(struct sna *sna, |
484 | struct sna_static_stream *stream, |
484 | struct sna_static_stream *stream, |
485 | bool (*compile)(struct brw_compile *, int), |
485 | bool (*compile)(struct brw_compile *, int), |
486 | int width); |
486 | int width); |
487 | struct kgem_bo *sna_static_stream_fini(struct sna *sna, |
487 | struct kgem_bo *sna_static_stream_fini(struct sna *sna, |
488 | struct sna_static_stream *stream); |
488 | struct sna_static_stream *stream); |
489 | 489 | ||
490 | struct kgem_bo * |
490 | struct kgem_bo * |
491 | sna_render_get_solid(struct sna *sna, |
491 | sna_render_get_solid(struct sna *sna, |
492 | uint32_t color); |
492 | uint32_t color); |
493 | 493 | ||
494 | void |
494 | void |
495 | sna_render_flush_solid(struct sna *sna); |
495 | sna_render_flush_solid(struct sna *sna); |
496 | 496 | ||
497 | 497 | ||
498 | uint32_t sna_rgba_for_color(uint32_t color, int depth); |
498 | uint32_t sna_rgba_for_color(uint32_t color, int depth); |
499 | uint32_t sna_rgba_to_color(uint32_t rgba, uint32_t format); |
499 | uint32_t sna_rgba_to_color(uint32_t rgba, uint32_t format); |
500 | bool sna_get_rgba_from_pixel(uint32_t pixel, |
500 | bool sna_get_rgba_from_pixel(uint32_t pixel, |
501 | uint16_t *red, |
501 | uint16_t *red, |
502 | uint16_t *green, |
502 | uint16_t *green, |
503 | uint16_t *blue, |
503 | uint16_t *blue, |
504 | uint16_t *alpha, |
504 | uint16_t *alpha, |
505 | uint32_t format); |
505 | uint32_t format); |
506 | bool sna_picture_is_solid(PicturePtr picture, uint32_t *color); |
506 | bool sna_picture_is_solid(PicturePtr picture, uint32_t *color); |
507 | 507 | ||
508 | void no_render_init(struct sna *sna); |
508 | void no_render_init(struct sna *sna); |
509 | 509 | ||
510 | bool gen2_render_init(struct sna *sna); |
510 | bool gen2_render_init(struct sna *sna); |
511 | bool gen3_render_init(struct sna *sna); |
511 | bool gen3_render_init(struct sna *sna); |
512 | bool gen4_render_init(struct sna *sna); |
512 | bool gen4_render_init(struct sna *sna); |
513 | bool gen5_render_init(struct sna *sna); |
513 | bool gen5_render_init(struct sna *sna); |
514 | bool gen6_render_init(struct sna *sna); |
514 | bool gen6_render_init(struct sna *sna); |
515 | bool gen7_render_init(struct sna *sna); |
515 | bool gen7_render_init(struct sna *sna); |
516 | 516 | ||
517 | #if 0 |
517 | #if 0 |
518 | 518 | ||
519 | bool sna_tiling_composite(uint32_t op, |
519 | bool sna_tiling_composite(uint32_t op, |
520 | PicturePtr src, |
520 | PicturePtr src, |
521 | PicturePtr mask, |
521 | PicturePtr mask, |
522 | PicturePtr dst, |
522 | PicturePtr dst, |
523 | int16_t src_x, int16_t src_y, |
523 | int16_t src_x, int16_t src_y, |
524 | int16_t mask_x, int16_t mask_y, |
524 | int16_t mask_x, int16_t mask_y, |
525 | int16_t dst_x, int16_t dst_y, |
525 | int16_t dst_x, int16_t dst_y, |
526 | int16_t width, int16_t height, |
526 | int16_t width, int16_t height, |
527 | struct sna_composite_op *tmp); |
527 | struct sna_composite_op *tmp); |
528 | bool sna_tiling_fill_boxes(struct sna *sna, |
528 | bool sna_tiling_fill_boxes(struct sna *sna, |
529 | CARD8 op, |
529 | CARD8 op, |
530 | PictFormat format, |
530 | PictFormat format, |
531 | const xRenderColor *color, |
531 | const xRenderColor *color, |
532 | PixmapPtr dst, struct kgem_bo *dst_bo, |
532 | PixmapPtr dst, struct kgem_bo *dst_bo, |
533 | const BoxRec *box, int n); |
533 | const BoxRec *box, int n); |
534 | 534 | ||
535 | bool sna_tiling_copy_boxes(struct sna *sna, uint8_t alu, |
535 | bool sna_tiling_copy_boxes(struct sna *sna, uint8_t alu, |
536 | PixmapPtr src, struct kgem_bo *src_bo, int16_t src_dx, int16_t src_dy, |
536 | PixmapPtr src, struct kgem_bo *src_bo, int16_t src_dx, int16_t src_dy, |
537 | PixmapPtr dst, struct kgem_bo *dst_bo, int16_t dst_dx, int16_t dst_dy, |
537 | PixmapPtr dst, struct kgem_bo *dst_bo, int16_t dst_dx, int16_t dst_dy, |
538 | const BoxRec *box, int n); |
538 | const BoxRec *box, int n); |
539 | 539 | ||
540 | bool sna_tiling_blt_copy_boxes(struct sna *sna, uint8_t alu, |
540 | bool sna_tiling_blt_copy_boxes(struct sna *sna, uint8_t alu, |
541 | struct kgem_bo *src_bo, int16_t src_dx, int16_t src_dy, |
541 | struct kgem_bo *src_bo, int16_t src_dx, int16_t src_dy, |
542 | struct kgem_bo *dst_bo, int16_t dst_dx, int16_t dst_dy, |
542 | struct kgem_bo *dst_bo, int16_t dst_dx, int16_t dst_dy, |
543 | int bpp, const BoxRec *box, int nbox); |
543 | int bpp, const BoxRec *box, int nbox); |
544 | 544 | ||
545 | bool sna_blt_composite(struct sna *sna, |
545 | bool sna_blt_composite(struct sna *sna, |
546 | uint32_t op, |
546 | uint32_t op, |
547 | PicturePtr src, |
547 | PicturePtr src, |
548 | PicturePtr dst, |
548 | PicturePtr dst, |
549 | int16_t src_x, int16_t src_y, |
549 | int16_t src_x, int16_t src_y, |
550 | int16_t dst_x, int16_t dst_y, |
550 | int16_t dst_x, int16_t dst_y, |
551 | int16_t width, int16_t height, |
551 | int16_t width, int16_t height, |
552 | struct sna_composite_op *tmp, |
552 | struct sna_composite_op *tmp, |
553 | bool fallback); |
553 | bool fallback); |
554 | bool sna_blt_composite__convert(struct sna *sna, |
554 | bool sna_blt_composite__convert(struct sna *sna, |
555 | int x, int y, |
555 | int x, int y, |
556 | int width, int height, |
556 | int width, int height, |
557 | struct sna_composite_op *tmp); |
557 | struct sna_composite_op *tmp); |
558 | 558 | ||
559 | bool sna_blt_fill(struct sna *sna, uint8_t alu, |
559 | bool sna_blt_fill(struct sna *sna, uint8_t alu, |
560 | struct kgem_bo *bo, |
560 | struct kgem_bo *bo, |
561 | int bpp, |
561 | int bpp, |
562 | uint32_t pixel, |
562 | uint32_t pixel, |
563 | struct sna_fill_op *fill); |
563 | struct sna_fill_op *fill); |
564 | 564 | ||
565 | bool sna_blt_copy(struct sna *sna, uint8_t alu, |
565 | bool sna_blt_copy(struct sna *sna, uint8_t alu, |
566 | struct kgem_bo *src, |
566 | struct kgem_bo *src, |
567 | struct kgem_bo *dst, |
567 | struct kgem_bo *dst, |
568 | int bpp, |
568 | int bpp, |
569 | struct sna_copy_op *copy); |
569 | struct sna_copy_op *copy); |
570 | 570 | ||
571 | bool sna_blt_fill_boxes(struct sna *sna, uint8_t alu, |
571 | bool sna_blt_fill_boxes(struct sna *sna, uint8_t alu, |
572 | struct kgem_bo *bo, |
572 | struct kgem_bo *bo, |
573 | int bpp, |
573 | int bpp, |
574 | uint32_t pixel, |
574 | uint32_t pixel, |
575 | const BoxRec *box, int n); |
575 | const BoxRec *box, int n); |
576 | 576 | ||
577 | bool sna_blt_copy_boxes(struct sna *sna, uint8_t alu, |
577 | bool sna_blt_copy_boxes(struct sna *sna, uint8_t alu, |
578 | struct kgem_bo *src_bo, int16_t src_dx, int16_t src_dy, |
578 | struct kgem_bo *src_bo, int16_t src_dx, int16_t src_dy, |
579 | struct kgem_bo *dst_bo, int16_t dst_dx, int16_t dst_dy, |
579 | struct kgem_bo *dst_bo, int16_t dst_dx, int16_t dst_dy, |
580 | int bpp, |
580 | int bpp, |
581 | const BoxRec *box, int n); |
581 | const BoxRec *box, int n); |
582 | bool sna_blt_copy_boxes_fallback(struct sna *sna, uint8_t alu, |
582 | bool sna_blt_copy_boxes_fallback(struct sna *sna, uint8_t alu, |
583 | PixmapPtr src, struct kgem_bo *src_bo, int16_t src_dx, int16_t src_dy, |
583 | PixmapPtr src, struct kgem_bo *src_bo, int16_t src_dx, int16_t src_dy, |
584 | PixmapPtr dst, struct kgem_bo *dst_bo, int16_t dst_dx, int16_t dst_dy, |
584 | PixmapPtr dst, struct kgem_bo *dst_bo, int16_t dst_dx, int16_t dst_dy, |
585 | const BoxRec *box, int nbox); |
585 | const BoxRec *box, int nbox); |
586 | 586 | ||
587 | bool _sna_get_pixel_from_rgba(uint32_t *pixel, |
587 | bool _sna_get_pixel_from_rgba(uint32_t *pixel, |
588 | uint16_t red, |
588 | uint16_t red, |
589 | uint16_t green, |
589 | uint16_t green, |
590 | uint16_t blue, |
590 | uint16_t blue, |
591 | uint16_t alpha, |
591 | uint16_t alpha, |
592 | uint32_t format); |
592 | uint32_t format); |
593 | 593 | ||
594 | static inline bool |
594 | static inline bool |
595 | sna_get_pixel_from_rgba(uint32_t * pixel, |
595 | sna_get_pixel_from_rgba(uint32_t * pixel, |
596 | uint16_t red, |
596 | uint16_t red, |
597 | uint16_t green, |
597 | uint16_t green, |
598 | uint16_t blue, |
598 | uint16_t blue, |
599 | uint16_t alpha, |
599 | uint16_t alpha, |
600 | uint32_t format) |
600 | uint32_t format) |
601 | { |
601 | { |
602 | switch (format) { |
602 | switch (format) { |
603 | case PICT_x8r8g8b8: |
603 | case PICT_x8r8g8b8: |
604 | alpha = 0xffff; |
604 | alpha = 0xffff; |
605 | /* fall through to re-use a8r8g8b8 expansion */ |
605 | /* fall through to re-use a8r8g8b8 expansion */ |
606 | case PICT_a8r8g8b8: |
606 | case PICT_a8r8g8b8: |
607 | *pixel = ((alpha >> 8 << 24) | |
607 | *pixel = ((alpha >> 8 << 24) | |
608 | (red >> 8 << 16) | |
608 | (red >> 8 << 16) | |
609 | (green & 0xff00) | |
609 | (green & 0xff00) | |
610 | (blue >> 8)); |
610 | (blue >> 8)); |
611 | return TRUE; |
611 | return TRUE; |
612 | case PICT_a8: |
612 | case PICT_a8: |
613 | *pixel = alpha >> 8; |
613 | *pixel = alpha >> 8; |
614 | return TRUE; |
614 | return TRUE; |
615 | } |
615 | } |
616 | 616 | ||
617 | return _sna_get_pixel_from_rgba(pixel, red, green, blue, alpha, format); |
617 | return _sna_get_pixel_from_rgba(pixel, red, green, blue, alpha, format); |
618 | } |
618 | } |
619 | 619 | ||
620 | struct kgem_bo * |
620 | struct kgem_bo * |
621 | __sna_render_pixmap_bo(struct sna *sna, |
621 | __sna_render_pixmap_bo(struct sna *sna, |
622 | PixmapPtr pixmap, |
622 | PixmapPtr pixmap, |
623 | const BoxRec *box, |
623 | const BoxRec *box, |
624 | bool blt); |
624 | bool blt); |
625 | 625 | ||
626 | int |
626 | int |
627 | sna_render_pixmap_bo(struct sna *sna, |
627 | sna_render_pixmap_bo(struct sna *sna, |
628 | struct sna_composite_channel *channel, |
628 | struct sna_composite_channel *channel, |
629 | PixmapPtr pixmap, |
629 | PixmapPtr pixmap, |
630 | int16_t x, int16_t y, |
630 | int16_t x, int16_t y, |
631 | int16_t w, int16_t h, |
631 | int16_t w, int16_t h, |
632 | int16_t dst_x, int16_t dst_y); |
632 | int16_t dst_x, int16_t dst_y); |
633 | 633 | ||
634 | bool |
634 | bool |
635 | sna_render_pixmap_partial(struct sna *sna, |
635 | sna_render_pixmap_partial(struct sna *sna, |
636 | PixmapPtr pixmap, |
636 | PixmapPtr pixmap, |
637 | struct kgem_bo *bo, |
637 | struct kgem_bo *bo, |
638 | struct sna_composite_channel *channel, |
638 | struct sna_composite_channel *channel, |
639 | int16_t x, int16_t y, |
639 | int16_t x, int16_t y, |
640 | int16_t w, int16_t h); |
640 | int16_t w, int16_t h); |
641 | 641 | ||
642 | int |
642 | int |
643 | sna_render_picture_extract(struct sna *sna, |
643 | sna_render_picture_extract(struct sna *sna, |
644 | PicturePtr picture, |
644 | PicturePtr picture, |
645 | struct sna_composite_channel *channel, |
645 | struct sna_composite_channel *channel, |
646 | int16_t x, int16_t y, |
646 | int16_t x, int16_t y, |
647 | int16_t w, int16_t h, |
647 | int16_t w, int16_t h, |
648 | int16_t dst_x, int16_t dst_y); |
648 | int16_t dst_x, int16_t dst_y); |
649 | 649 | ||
650 | int |
650 | int |
651 | sna_render_picture_approximate_gradient(struct sna *sna, |
651 | sna_render_picture_approximate_gradient(struct sna *sna, |
652 | PicturePtr picture, |
652 | PicturePtr picture, |
653 | struct sna_composite_channel *channel, |
653 | struct sna_composite_channel *channel, |
654 | int16_t x, int16_t y, |
654 | int16_t x, int16_t y, |
655 | int16_t w, int16_t h, |
655 | int16_t w, int16_t h, |
656 | int16_t dst_x, int16_t dst_y); |
656 | int16_t dst_x, int16_t dst_y); |
657 | 657 | ||
658 | int |
658 | int |
659 | sna_render_picture_fixup(struct sna *sna, |
659 | sna_render_picture_fixup(struct sna *sna, |
660 | PicturePtr picture, |
660 | PicturePtr picture, |
661 | struct sna_composite_channel *channel, |
661 | struct sna_composite_channel *channel, |
662 | int16_t x, int16_t y, |
662 | int16_t x, int16_t y, |
663 | int16_t w, int16_t h, |
663 | int16_t w, int16_t h, |
664 | int16_t dst_x, int16_t dst_y); |
664 | int16_t dst_x, int16_t dst_y); |
665 | 665 | ||
666 | int |
666 | int |
667 | sna_render_picture_convert(struct sna *sna, |
667 | sna_render_picture_convert(struct sna *sna, |
668 | PicturePtr picture, |
668 | PicturePtr picture, |
669 | struct sna_composite_channel *channel, |
669 | struct sna_composite_channel *channel, |
670 | PixmapPtr pixmap, |
670 | PixmapPtr pixmap, |
671 | int16_t x, int16_t y, |
671 | int16_t x, int16_t y, |
672 | int16_t w, int16_t h, |
672 | int16_t w, int16_t h, |
673 | int16_t dst_x, int16_t dst_y, |
673 | int16_t dst_x, int16_t dst_y, |
674 | bool fixup_alpha); |
674 | bool fixup_alpha); |
675 | 675 | ||
676 | inline static void sna_render_composite_redirect_init(struct sna_composite_op *op) |
676 | inline static void sna_render_composite_redirect_init(struct sna_composite_op *op) |
677 | { |
677 | { |
678 | struct sna_composite_redirect *t = &op->redirect; |
678 | struct sna_composite_redirect *t = &op->redirect; |
679 | t->real_bo = NULL; |
679 | t->real_bo = NULL; |
680 | t->damage = NULL; |
680 | t->damage = NULL; |
681 | } |
681 | } |
682 | 682 | ||
683 | bool |
683 | bool |
684 | sna_render_composite_redirect(struct sna *sna, |
684 | sna_render_composite_redirect(struct sna *sna, |
685 | struct sna_composite_op *op, |
685 | struct sna_composite_op *op, |
686 | int x, int y, int width, int height); |
686 | int x, int y, int width, int height); |
687 | 687 | ||
688 | void |
688 | void |
689 | sna_render_composite_redirect_done(struct sna *sna, |
689 | sna_render_composite_redirect_done(struct sna *sna, |
690 | const struct sna_composite_op *op); |
690 | const struct sna_composite_op *op); |
691 | 691 | ||
692 | bool |
692 | bool |
693 | sna_composite_mask_is_opaque(PicturePtr mask); |
693 | sna_composite_mask_is_opaque(PicturePtr mask); |
694 | 694 | ||
695 | #endif |
695 | #endif |
696 | void sna_vertex_init(struct sna *sna); |
696 | void sna_vertex_init(struct sna *sna); |
697 | 697 | ||
698 | static inline void sna_vertex_lock(struct sna_render *r) |
698 | static inline void sna_vertex_lock(struct sna_render *r) |
699 | { |
699 | { |
700 | // pthread_mutex_lock(&r->lock); |
700 | // pthread_mutex_lock(&r->lock); |
701 | } |
701 | } |
702 | 702 | ||
703 | static inline void sna_vertex_acquire__locked(struct sna_render *r) |
703 | static inline void sna_vertex_acquire__locked(struct sna_render *r) |
704 | { |
704 | { |
705 | r->active++; |
705 | r->active++; |
706 | } |
706 | } |
707 | 707 | ||
708 | static inline void sna_vertex_unlock(struct sna_render *r) |
708 | static inline void sna_vertex_unlock(struct sna_render *r) |
709 | { |
709 | { |
710 | // pthread_mutex_unlock(&r->lock); |
710 | // pthread_mutex_unlock(&r->lock); |
711 | } |
711 | } |
712 | 712 | ||
713 | static inline void sna_vertex_release__locked(struct sna_render *r) |
713 | static inline void sna_vertex_release__locked(struct sna_render *r) |
714 | { |
714 | { |
715 | assert(r->active > 0); |
715 | assert(r->active > 0); |
716 | --r->active; |
716 | --r->active; |
717 | // if (--r->active == 0) |
717 | // if (--r->active == 0) |
718 | // pthread_cond_signal(&r->wait); |
718 | // pthread_cond_signal(&r->wait); |
719 | } |
719 | } |
720 | 720 | ||
721 | static inline bool sna_vertex_wait__locked(struct sna_render *r) |
721 | static inline bool sna_vertex_wait__locked(struct sna_render *r) |
722 | { |
722 | { |
723 | bool was_active = r->active; |
723 | bool was_active = r->active; |
724 | // while (r->active) |
724 | // while (r->active) |
725 | // pthread_cond_wait(&r->wait, &r->lock); |
725 | // pthread_cond_wait(&r->wait, &r->lock); |
726 | return was_active; |
726 | return was_active; |
727 | } |
727 | } |
728 | 728 | ||
729 | #endif /* SNA_RENDER_H */><>><>2)><2)>1)><1)>0)><0)> |
729 | #endif /* SNA_RENDER_H */><>><>2)><2)>1)><1)>0)><0)> |