st/xorg: use surface_copy for blits if available
[mesa.git] / src / gallium / state_trackers / xorg / xorg_exa.h
1 #ifndef XORG_EXA_H
2 #define XORG_EXA_H
3
4 #include "xorg_tracker.h"
5
6 #include <pipe/p_state.h>
7
8 struct cso_context;
9 struct xorg_shaders;
10
11 /* src + mask + dst */
12 #define MAX_EXA_SAMPLERS 3
13
14 struct exa_context
15 {
16 ExaDriverPtr pExa;
17 struct pipe_context *pipe;
18 struct pipe_screen *scrn;
19 struct xorg_renderer *renderer;
20
21 struct pipe_texture *bound_textures[MAX_EXA_SAMPLERS];
22 int num_bound_samplers;
23
24 float solid_color[4];
25 boolean has_solid_color;
26
27 boolean accel;
28
29 /* float[9] projective matrix bound to pictures */
30 struct {
31 float src[9];
32 float mask[9];
33 boolean has_src;
34 boolean has_mask;
35 } transform;
36
37 struct {
38 struct exa_pixmap_priv *src;
39 struct exa_pixmap_priv *dst;
40
41 struct pipe_surface *src_surface;
42 struct pipe_surface *dst_surface;
43 } copy;
44 };
45
46 struct exa_pixmap_priv
47 {
48 int flags;
49 int tex_flags;
50
51 int picture_format;
52
53 struct pipe_texture *tex;
54 struct pipe_texture *depth_stencil_tex;
55
56 struct pipe_transfer *map_transfer;
57 unsigned map_count;
58 };
59
60 #define XORG_FALLBACK(s, arg...) \
61 do { \
62 if (ms->debug_fallback) { \
63 xf86DrvMsg(pScrn->scrnIndex, X_INFO, \
64 "%s fallback " s "\n", __FUNCTION__, ##arg); \
65 } \
66 return FALSE; \
67 } while(0)
68
69 struct pipe_surface *
70 xorg_gpu_surface(struct pipe_screen *scrn, struct exa_pixmap_priv *priv);
71
72 void xorg_exa_flush(struct exa_context *exa, uint pipeFlushFlags,
73 struct pipe_fence_handle **fence);
74 void xorg_exa_finish(struct exa_context *exa);
75
76 #endif