Squashed commit of the following:
[profile/ivi/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_sampler_view *bound_sampler_views[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       boolean use_surface_copy;
39
40       struct exa_pixmap_priv *src;
41       struct exa_pixmap_priv *dst;
42
43       struct pipe_surface *src_surface;
44       struct pipe_surface *dst_surface;
45
46       struct pipe_resource *src_texture;
47    } copy;
48 };
49
50 struct exa_pixmap_priv
51 {
52    int width, height;
53
54    int flags;
55    int tex_flags;
56
57    int picture_format;
58
59    struct pipe_resource *tex;
60    struct pipe_resource *depth_stencil_tex;
61
62    struct pipe_transfer *map_transfer;
63    unsigned map_count;
64 };
65
66 #define XORG_FALLBACK(s, arg...)                              \
67 do {                                                          \
68    if (ms->debug_fallback) {                                  \
69       xf86DrvMsg(pScrn->scrnIndex, X_INFO,                    \
70                  "%s fallback " s "\n", __FUNCTION__, ##arg); \
71    }                                                          \
72    return FALSE;                                              \
73 } while(0)
74
75 struct pipe_surface *
76 xorg_gpu_surface(struct pipe_screen *scrn, struct exa_pixmap_priv *priv);
77
78 void xorg_exa_flush(struct exa_context *exa, uint pipeFlushFlags,
79                     struct pipe_fence_handle **fence);
80 void xorg_exa_finish(struct exa_context *exa);
81
82 #endif