Tizen 2.0 Release
[profile/ivi/osmesa.git] / src / mesa / drivers / dri / i810 / server / i810_dri.h
1
2 #ifndef _I810_DRI_
3 #define _I810_DRI_
4
5 #include "xf86drm.h"
6 #include "i810_common.h"
7
8 #define I810_MAX_DRAWABLES 256
9
10 typedef struct {
11    drm_handle_t regs;
12    drmSize regsSize;
13
14    drmSize backbufferSize;
15    drm_handle_t backbuffer;
16
17    drmSize depthbufferSize;
18    drm_handle_t depthbuffer;
19
20    drm_handle_t textures;
21    int textureSize;
22
23    drm_handle_t agp_buffers;
24    drmSize agp_buf_size;
25
26    int deviceID;
27    int width;
28    int height;
29    int mem;
30    int cpp;
31    int bitsPerPixel;
32    int fbOffset;
33    int fbStride;
34
35    int backOffset;
36    int depthOffset;
37
38    int auxPitch;
39    int auxPitchBits;
40
41    int logTextureGranularity;
42    int textureOffset;
43
44    /* For non-dma direct rendering.
45     */
46    int ringOffset;
47    int ringSize;
48
49    drmBufMapPtr drmBufs;
50    int irq;
51    unsigned int sarea_priv_offset;
52
53 } I810DRIRec, *I810DRIPtr;
54
55 /* WARNING: Do not change the SAREA structure without changing the kernel
56  * as well */
57
58 #define I810_UPLOAD_TEX0IMAGE  0x1      /* handled clientside */
59 #define I810_UPLOAD_TEX1IMAGE  0x2      /* handled clientside */
60 #define I810_UPLOAD_CTX        0x4
61 #define I810_UPLOAD_BUFFERS    0x8
62 #define I810_UPLOAD_TEX0       0x10
63 #define I810_UPLOAD_TEX1       0x20
64 #define I810_UPLOAD_CLIPRECTS  0x40
65
66 typedef struct {
67    unsigned char next, prev;            /* indices to form a circular LRU  */
68    unsigned char in_use;                /* owned by a client, or free? */
69    int age;                             /* tracked by clients to update local LRU's */
70 } I810TexRegionRec, *I810TexRegionPtr;
71
72 typedef struct {
73    unsigned int ContextState[I810_CTX_SETUP_SIZE];
74    unsigned int BufferState[I810_DEST_SETUP_SIZE];
75    unsigned int TexState[2][I810_TEX_SETUP_SIZE];
76    unsigned int dirty;
77
78    unsigned int nbox;
79    drm_clip_rect_t boxes[I810_NR_SAREA_CLIPRECTS];
80
81    /* Maintain an LRU of contiguous regions of texture space.  If
82     * you think you own a region of texture memory, and it has an
83     * age different to the one you set, then you are mistaken and
84     * it has been stolen by another client.  If global texAge
85     * hasn't changed, there is no need to walk the list.
86     *
87     * These regions can be used as a proxy for the fine-grained
88     * texture information of other clients - by maintaining them
89     * in the same lru which is used to age their own textures,
90     * clients have an approximate lru for the whole of global
91     * texture space, and can make informed decisions as to which
92     * areas to kick out.  There is no need to choose whether to
93     * kick out your own texture or someone else's - simply eject
94     * them all in LRU order.
95     */
96  
97    drmTextureRegion texList[I810_NR_TEX_REGIONS + 1];
98
99    /* Last elt is sentinal */
100    int texAge;                          /* last time texture was uploaded */
101
102    int last_enqueue;                    /* last time a buffer was enqueued */
103    int last_dispatch;                   /* age of the most recently dispatched buffer */
104    int last_quiescent;                  /*  */
105
106    int ctxOwner;                        /* last context to upload state */
107
108    int vertex_prim;
109
110    int pf_enabled;                  /* is pageflipping allowed? */
111    int pf_active;                   /* is pageflipping active right now? */
112    int pf_current_page;             /* which buffer is being displayed? */
113
114
115 } I810SAREARec, *I810SAREAPtr;
116
117 typedef struct {
118    /* Nothing here yet */
119    int dummy;
120 } I810ConfigPrivRec, *I810ConfigPrivPtr;
121
122 typedef struct {
123    /* Nothing here yet */
124    int dummy;
125 } I810DRIContextRec, *I810DRIContextPtr;
126
127 #endif