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