st/xorg: split copy operation into prepare/copy/done phases
[mesa.git] / src / gallium / state_trackers / xorg / xorg_renderer.h
1 #ifndef XORG_RENDERER_H
2 #define XORG_RENDERER_H
3
4 #include "pipe/p_context.h"
5 #include "pipe/p_state.h"
6
7 struct xorg_shaders;
8 struct exa_pixmap_priv;
9
10 /* max number of vertices *
11 * max number of attributes per vertex *
12 * max number of components per attribute
13 *
14 * currently the max is 100 quads
15 */
16 #define BUF_SIZE (100 * 4 * 3 * 4)
17
18 struct xorg_renderer {
19 struct pipe_context *pipe;
20
21 struct cso_context *cso;
22 struct xorg_shaders *shaders;
23
24 int fb_width;
25 int fb_height;
26 struct pipe_constant_buffer vs_const_buffer;
27 struct pipe_constant_buffer fs_const_buffer;
28
29 float buffer[BUF_SIZE];
30 int buffer_size;
31
32 /* number of attributes per vertex for the current
33 * draw operation */
34 int attrs_per_vertex;
35 };
36
37 struct xorg_renderer *renderer_create(struct pipe_context *pipe);
38 void renderer_destroy(struct xorg_renderer *renderer);
39
40 void renderer_bind_destination(struct xorg_renderer *r,
41 struct pipe_surface *surface );
42
43 void renderer_bind_framebuffer(struct xorg_renderer *r,
44 struct exa_pixmap_priv *priv);
45 void renderer_bind_viewport(struct xorg_renderer *r,
46 struct exa_pixmap_priv *dst);
47 void renderer_set_constants(struct xorg_renderer *r,
48 int shader_type,
49 const float *buffer,
50 int size);
51
52
53 void renderer_draw_yuv(struct xorg_renderer *r,
54 int src_x, int src_y, int src_w, int src_h,
55 int dst_x, int dst_y, int dst_w, int dst_h,
56 struct pipe_texture **textures);
57
58 void renderer_begin_solid(struct xorg_renderer *r);
59 void renderer_solid(struct xorg_renderer *r,
60 int x0, int y0,
61 int x1, int y1,
62 float *color);
63
64 void renderer_begin_textures(struct xorg_renderer *r,
65 struct pipe_texture **textures,
66 int num_textures);
67 void renderer_texture(struct xorg_renderer *r,
68 int *pos,
69 int width, int height,
70 struct pipe_texture **textures,
71 int num_textures,
72 float *src_matrix,
73 float *mask_matrix);
74
75 void renderer_draw_flush(struct xorg_renderer *r);
76
77 struct pipe_texture *
78 renderer_clone_texture(struct xorg_renderer *r,
79 struct pipe_texture *src);
80
81 void renderer_copy_prepare(struct xorg_renderer *r,
82 struct pipe_surface *dst_surface,
83 struct pipe_texture *src_texture);
84
85 void renderer_copy_pixmap(struct xorg_renderer *r,
86 int dx, int dy,
87 int sx, int sy,
88 int width, int height,
89 float src_width,
90 float src_height);
91
92
93 #endif