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