4
#define GRADIENT_CACHE_SIZE 16
6
#define fastcall __attribute__((regparm(3)))
11
struct sna_video_frame;
13
struct sna_composite_rectangles {
14
struct sna_coordinate {
17
int16_t width, height;
20
struct sna_composite_op {
21
fastcall void (*blt)(struct sna *sna, const struct sna_composite_op *op,
22
const struct sna_composite_rectangles *r);
23
void (*boxes)(struct sna *sna, const struct sna_composite_op *op,
24
const BoxRec *box, int nbox);
25
void (*done)(struct sna *sna, const struct sna_composite_op *op);
27
struct sna_damage **damage;
36
uint16_t width, height;
39
struct sna_composite_channel {
41
PictTransform *transform;
48
uint32_t is_affine : 1;
49
uint32_t is_solid : 1;
50
uint32_t is_opaque : 1;
51
uint32_t alpha_fixup : 1;
52
uint32_t rb_reversed : 1;
60
struct gen3_shader_channel {
67
uint32_t is_affine : 1;
68
uint32_t has_component_alpha : 1;
69
uint32_t need_magic_ca_pass : 1;
70
uint32_t rb_reversed : 1;
72
int floats_per_vertex;
73
fastcall void (*prim_emit)(struct sna *sna,
74
const struct sna_composite_op *op,
75
const struct sna_composite_rectangles *r);
77
struct sna_composite_redirect {
78
struct kgem_bo *real_bo;
83
struct sna_blt_state {
88
uint32_t overwrites:1;
94
struct kgem_bo *bo[2];
103
uint32_t num_constants;
134
struct sna_composite_spans_op {
135
struct sna_composite_op base;
137
void (*box)(struct sna *sna, const struct sna_composite_spans_op *op,
138
const BoxRec *box, float opacity);
139
void (*boxes)(struct sna *sna, const struct sna_composite_spans_op *op,
140
const BoxRec *box, int nbox,
142
void (*done)(struct sna *sna, const struct sna_composite_spans_op *op);
144
void (*prim_emit)(struct sna *sna,
145
const struct sna_composite_spans_op *op,
151
struct sna_composite_op base;
153
void (*blt)(struct sna *sna, const struct sna_fill_op *op,
154
int16_t x, int16_t y, int16_t w, int16_t h);
155
void (*done)(struct sna *sna, const struct sna_fill_op *op);
159
struct sna_composite_op base;
161
void (*blt)(struct sna *sna, const struct sna_copy_op *op,
162
int16_t sx, int16_t sy,
163
int16_t w, int16_t h,
164
int16_t dx, int16_t dy);
165
void (*done)(struct sna *sna, const struct sna_copy_op *op);
171
Bool (*composite)(struct sna *sna, uint8_t op,
172
PicturePtr dst, PicturePtr src, PicturePtr mask,
173
int16_t src_x, int16_t src_y,
174
int16_t msk_x, int16_t msk_y,
175
int16_t dst_x, int16_t dst_y,
176
int16_t w, int16_t h,
177
struct sna_composite_op *tmp);
179
Bool (*composite_spans)(struct sna *sna, uint8_t op,
180
PicturePtr dst, PicturePtr src,
181
int16_t src_x, int16_t src_y,
182
int16_t dst_x, int16_t dst_y,
183
int16_t w, int16_t h,
184
struct sna_composite_spans_op *tmp);
186
Bool (*video)(struct sna *sna,
187
struct sna_video *video,
188
struct sna_video_frame *frame,
190
short src_w, short src_h,
191
short drw_w, short drw_h,
194
Bool (*fill_boxes)(struct sna *sna,
197
const xRenderColor *color,
198
PixmapPtr dst, struct kgem_bo *dst_bo,
199
const BoxRec *box, int n);
200
Bool (*fill)(struct sna *sna, uint8_t alu,
201
PixmapPtr dst, struct kgem_bo *dst_bo,
203
struct sna_fill_op *tmp);
205
Bool (*copy_boxes)(struct sna *sna, uint8_t alu,
206
PixmapPtr src, struct kgem_bo *src_bo, int16_t src_dx, int16_t src_dy,
207
PixmapPtr dst, struct kgem_bo *dst_bo, int16_t dst_dx, int16_t dst_dy,
208
const BoxRec *box, int n);
209
Bool (*copy)(struct sna *sna, uint8_t alu,
210
PixmapPtr src, struct kgem_bo *src_bo,
211
PixmapPtr dst, struct kgem_bo *dst_bo,
212
struct sna_copy_op *op);
214
void (*flush)(struct sna *sna);
215
void (*reset)(struct sna *sna);
216
void (*fini)(struct sna *sna);
218
struct sna_solid_cache {
219
struct kgem_bo *cache_bo;
220
uint32_t color[1024];
221
struct kgem_bo *bo[1024];
228
struct sna_gradient_cache {
231
PictGradientStop *stops;
232
} cache[GRADIENT_CACHE_SIZE];
236
struct sna_glyph_cache{
238
struct sna_glyph **glyphs;
243
uint16_t vertex_start;
244
uint16_t vertex_index;
245
uint16_t vertex_used;
246
uint16_t vertex_reloc[8];
248
float vertex_data[16*1024];
249
const struct sna_composite_op *op;
252
struct gen2_render_state {
255
Bool logic_op_enabled;
256
uint16_t vertex_offset;
259
struct gen3_render_state {
260
uint32_t current_dst;
263
uint32_t last_drawrect_limit;
264
uint32_t last_target;
266
uint32_t last_constants;
267
uint32_t last_sampler;
268
uint32_t last_shader;
269
uint32_t last_diffuse;
270
uint32_t last_specular;
272
uint16_t vertex_offset;
273
uint16_t last_vertex_offset;
274
uint16_t floats_per_vertex;
275
uint16_t last_floats_per_vertex;
278
uint32_t tex_handle[2];
279
uint32_t tex_delta[2];
282
struct gen4_render_state {
283
struct kgem_bo *general_bo;
291
uint32_t drawrect_offset;
292
uint32_t drawrect_limit;
294
uint16_t vertex_offset;
295
uint16_t last_primitive;
296
int16_t floats_per_vertex;
297
uint16_t surface_table;
298
uint16_t last_pipelined_pointers;
300
Bool needs_invariant;
304
struct gen5_render_state {
305
struct kgem_bo *general_bo;
313
uint32_t drawrect_offset;
314
uint32_t drawrect_limit;
316
uint16_t vertex_offset;
317
uint16_t last_primitive;
318
int16_t floats_per_vertex;
319
uint16_t surface_table;
320
uint16_t last_pipelined_pointers;
322
Bool needs_invariant;
326
GEN6_WM_KERNEL_NOMASK = 0,
327
GEN6_WM_KERNEL_NOMASK_PROJECTIVE,
330
GEN6_WM_KERNEL_MASK_PROJECTIVE,
332
GEN6_WM_KERNEL_MASKCA,
333
GEN6_WM_KERNEL_MASKCA_PROJECTIVE,
335
GEN6_WM_KERNEL_MASKCA_SRCALPHA,
336
GEN6_WM_KERNEL_MASKCA_SRCALPHA_PROJECTIVE,
338
GEN6_WM_KERNEL_VIDEO_PLANAR,
339
GEN6_WM_KERNEL_VIDEO_PACKED,
343
struct gen6_render_state {
344
struct kgem_bo *general_bo;
348
uint32_t sf_mask_state;
350
uint32_t wm_kernel[GEN6_KERNEL_COUNT];
355
uint32_t drawrect_offset;
356
uint32_t drawrect_limit;
361
uint16_t num_sf_outputs;
364
uint16_t vertex_offset;
365
uint16_t last_primitive;
366
int16_t floats_per_vertex;
367
uint16_t surface_table;
369
Bool needs_invariant;
373
GEN7_WM_KERNEL_NOMASK = 0,
374
GEN7_WM_KERNEL_NOMASK_PROJECTIVE,
377
GEN7_WM_KERNEL_MASK_PROJECTIVE,
379
GEN7_WM_KERNEL_MASKCA,
380
GEN7_WM_KERNEL_MASKCA_PROJECTIVE,
382
GEN7_WM_KERNEL_MASKCA_SRCALPHA,
383
GEN7_WM_KERNEL_MASKCA_SRCALPHA_PROJECTIVE,
385
GEN7_WM_KERNEL_VIDEO_PLANAR,
386
GEN7_WM_KERNEL_VIDEO_PACKED,
390
struct gen7_render_state {
391
struct kgem_bo *general_bo;
395
uint32_t sf_mask_state;
397
uint32_t wm_kernel[GEN6_KERNEL_COUNT];
402
uint32_t drawrect_offset;
403
uint32_t drawrect_limit;
408
uint16_t num_sf_outputs;
411
uint16_t vertex_offset;
412
uint16_t last_primitive;
413
int16_t floats_per_vertex;
414
uint16_t surface_table;
416
Bool needs_invariant;
419
struct sna_static_stream {
424
int sna_static_stream_init(struct sna_static_stream *stream);
425
uint32_t sna_static_stream_add(struct sna_static_stream *stream,
426
const void *data, uint32_t len, uint32_t align);
427
void *sna_static_stream_map(struct sna_static_stream *stream,
428
uint32_t len, uint32_t align);
429
uint32_t sna_static_stream_offsetof(struct sna_static_stream *stream,
431
struct kgem_bo *sna_static_stream_fini(struct sna *sna,
432
struct sna_static_stream *stream);
435
sna_render_get_solid(struct sna *sna,
439
sna_render_flush_solid(struct sna *sna);
442
sna_render_get_gradient(struct sna *sna,
443
PictGradient *pattern);
445
uint32_t sna_rgba_for_color(uint32_t color, int depth);
446
Bool sna_picture_is_solid(PicturePtr picture, uint32_t *color);
448
void no_render_init(struct sna *sna);
450
Bool gen2_render_init(struct sna *sna);
451
Bool gen3_render_init(struct sna *sna);
452
Bool gen4_render_init(struct sna *sna);
453
Bool gen5_render_init(struct sna *sna);
454
Bool gen6_render_init(struct sna *sna);
455
Bool gen7_render_init(struct sna *sna);
457
Bool sna_tiling_composite(struct sna *sna,
462
int16_t src_x, int16_t src_y,
463
int16_t mask_x, int16_t mask_y,
464
int16_t dst_x, int16_t dst_y,
465
int16_t width, int16_t height,
466
struct sna_composite_op *tmp);
468
Bool sna_blt_composite(struct sna *sna,
472
int16_t src_x, int16_t src_y,
473
int16_t dst_x, int16_t dst_y,
474
int16_t width, int16_t height,
475
struct sna_composite_op *tmp);
477
bool sna_blt_fill(struct sna *sna, uint8_t alu,
481
struct sna_fill_op *fill);
483
bool sna_blt_copy(struct sna *sna, uint8_t alu,
487
struct sna_copy_op *copy);
489
Bool sna_blt_fill_boxes(struct sna *sna, uint8_t alu,
493
const BoxRec *box, int n);
495
Bool sna_blt_copy_boxes(struct sna *sna, uint8_t alu,
496
struct kgem_bo *src_bo, int16_t src_dx, int16_t src_dy,
497
struct kgem_bo *dst_bo, int16_t dst_dx, int16_t dst_dy,
499
const BoxRec *box, int n);
501
Bool sna_get_pixel_from_rgba(uint32_t *pixel,
509
sna_render_pixmap_bo(struct sna *sna,
510
struct sna_composite_channel *channel,
512
int16_t x, int16_t y,
513
int16_t w, int16_t h,
514
int16_t dst_x, int16_t dst_y);
517
sna_render_picture_extract(struct sna *sna,
519
struct sna_composite_channel *channel,
520
int16_t x, int16_t y,
521
int16_t w, int16_t h,
522
int16_t dst_x, int16_t dst_y);
525
sna_render_picture_fixup(struct sna *sna,
527
struct sna_composite_channel *channel,
528
int16_t x, int16_t y,
529
int16_t w, int16_t h,
530
int16_t dst_x, int16_t dst_y);
533
sna_render_picture_convert(struct sna *sna,
535
struct sna_composite_channel *channel,
537
int16_t x, int16_t y,
538
int16_t w, int16_t h,
539
int16_t dst_x, int16_t dst_y);
542
sna_render_composite_redirect(struct sna *sna,
543
struct sna_composite_op *op,
544
int x, int y, int width, int height);
547
sna_render_composite_redirect_done(struct sna *sna,
548
const struct sna_composite_op *op);
550
#endif /* SNA_RENDER_H */