Tizen 2.0 Release
[profile/ivi/osmesa.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 *dst_surface;
44
45       struct pipe_resource *src_texture;
46    } copy;
47 };
48
49 struct exa_pixmap_priv
50 {
51    int width, height;
52
53    int flags;
54    int tex_flags;
55
56    int picture_format;
57
58    struct pipe_resource *tex;
59    struct pipe_resource *depth_stencil_tex;
60
61    struct pipe_transfer *map_transfer;
62    unsigned map_count;
63 };
64
65 #define XORG_FALLBACK(s, arg...)                              \
66 do {                                                          \
67    if (ms->debug_fallback) {                                  \
68       xf86DrvMsg(pScrn->scrnIndex, X_INFO,                    \
69                  "%s fallback " s "\n", __FUNCTION__, ##arg); \
70    }                                                          \
71    return FALSE;                                              \
72 } while(0)
73
74 struct pipe_surface *
75 xorg_gpu_surface(struct pipe_context *pipe, struct exa_pixmap_priv *priv);
76
77 void xorg_exa_flush(struct exa_context *exa,
78                     struct pipe_fence_handle **fence);
79 void xorg_exa_finish(struct exa_context *exa);
80
81 #endif