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