st/xorg: Fallback if picture format doesn't match texture format
[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 /* float[9] projective matrix bound to pictures */
28 struct {
29 float src[9];
30 float mask[9];
31 boolean has_src;
32 boolean has_mask;
33 } transform;
34
35 struct {
36 struct exa_pixmap_priv *src;
37 struct exa_pixmap_priv *dst;
38 } copy;
39 };
40
41 struct exa_pixmap_priv
42 {
43 int flags;
44 int tex_flags;
45
46 int picture_format;
47
48 struct pipe_texture *tex;
49 struct pipe_texture *depth_stencil_tex;
50
51 struct pipe_transfer *map_transfer;
52 unsigned map_count;
53 };
54
55 #define XORG_FALLBACK(s, arg...) \
56 do { \
57 if (ms->debug_fallback) { \
58 xf86DrvMsg(pScrn->scrnIndex, X_INFO, \
59 "%s fallback " s "\n", __FUNCTION__, ##arg); \
60 } \
61 return FALSE; \
62 } while(0)
63
64 struct pipe_surface *
65 xorg_gpu_surface(struct pipe_screen *scrn, struct exa_pixmap_priv *priv);
66
67 void xorg_exa_flush(struct exa_context *exa, uint pipeFlushFlags,
68 struct pipe_fence_handle **fence);
69 void xorg_exa_finish(struct exa_context *exa);
70
71 #endif