Rev 3291 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed
Rev | Author | Line No. | Line |
---|---|---|---|
3291 | Serge | 1 | #ifndef SNA_RENDER_INLINE_H |
2 | #define SNA_RENDER_INLINE_H |
||
3 | |||
4 | static inline bool need_tiling(struct sna *sna, int16_t width, int16_t height) |
||
5 | { |
||
6 | /* Is the damage area too large to fit in 3D pipeline, |
||
7 | * and so do we need to split the operation up into tiles? |
||
8 | */ |
||
9 | return (width > sna->render.max_3d_size || |
||
10 | height > sna->render.max_3d_size); |
||
11 | } |
||
12 | |||
13 | static inline bool need_redirect(struct sna *sna, PixmapPtr dst) |
||
14 | { |
||
15 | /* Is the pixmap too large to render to? */ |
||
16 | return (dst->drawable.width > sna->render.max_3d_size || |
||
17 | dst->drawable.height > sna->render.max_3d_size); |
||
18 | } |
||
19 | |||
4251 | Serge | 20 | static force_inline float pack_2s(int16_t x, int16_t y) |
3291 | Serge | 21 | { |
22 | union { |
||
23 | struct sna_coordinate p; |
||
24 | float f; |
||
25 | } u; |
||
26 | u.p.x = x; |
||
27 | u.p.y = y; |
||
28 | return u.f; |
||
29 | } |
||
30 | |||
4251 | Serge | 31 | static force_inline int vertex_space(struct sna *sna) |
3291 | Serge | 32 | { |
33 | return sna->render.vertex_size - sna->render.vertex_used; |
||
34 | } |
||
4251 | Serge | 35 | static force_inline void vertex_emit(struct sna *sna, float v) |
3291 | Serge | 36 | { |
37 | assert(sna->render.vertex_used < sna->render.vertex_size); |
||
38 | sna->render.vertices[sna->render.vertex_used++] = v; |
||
39 | } |
||
4251 | Serge | 40 | static force_inline void vertex_emit_2s(struct sna *sna, int16_t x, int16_t y) |
3291 | Serge | 41 | { |
42 | vertex_emit(sna, pack_2s(x, y)); |
||
43 | } |
||
44 | |||
4251 | Serge | 45 | static force_inline int batch_space(struct sna *sna) |
3291 | Serge | 46 | { |
47 | assert(sna->kgem.nbatch <= KGEM_BATCH_SIZE(&sna->kgem)); |
||
48 | assert(sna->kgem.nbatch + KGEM_BATCH_RESERVED <= sna->kgem.surface); |
||
49 | return sna->kgem.surface - sna->kgem.nbatch - KGEM_BATCH_RESERVED; |
||
50 | } |
||
51 | |||
4251 | Serge | 52 | static force_inline void batch_emit(struct sna *sna, uint32_t dword) |
3291 | Serge | 53 | { |
54 | assert(sna->kgem.mode != KGEM_NONE); |
||
55 | assert(sna->kgem.nbatch + KGEM_BATCH_RESERVED < sna->kgem.surface); |
||
56 | sna->kgem.batch[sna->kgem.nbatch++] = dword; |
||
57 | } |
||
58 | |||
4251 | Serge | 59 | static force_inline void batch_emit_float(struct sna *sna, float f) |
3291 | Serge | 60 | { |
61 | union { |
||
62 | uint32_t dw; |
||
63 | float f; |
||
64 | } u; |
||
65 | u.f = f; |
||
66 | batch_emit(sna, u.dw); |
||
67 | } |
||
68 | |||
69 | |||
70 | #endif /* SNA_RENDER_INLINE_H */>=>=>> |