summaryrefslogtreecommitdiff
path: root/xc/programs/Xserver/hw/xfree86/drivers/i810/i810_dri.h
blob: 3d6acbaaea0c9280793403bf1e1cea279130834b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/i810/i810_dri.h,v 1.10 2002/12/10 01:27:04 dawes Exp $ */

#ifndef _I810_DRI_
#define _I810_DRI_

#include "xf86dri.h"
#include "xf86drm.h"
#include "i810_common.h"

#define I810_MAX_DRAWABLES 256

typedef struct {
   drmHandle regs;
   drmSize regsSize;
   drmAddress regsMap;

   drmSize backbufferSize;
   drmHandle backbuffer;

   drmSize depthbufferSize;
   drmHandle depthbuffer;

   drmHandle textures;
   int textureSize;

   drmHandle agp_buffers;
   drmSize agp_buf_size;

   int deviceID;
   int width;
   int height;
   int mem;
   int cpp;
   int bitsPerPixel;
   int fbOffset;
   int fbStride;

   int backOffset;
   int depthOffset;

   int auxPitch;
   int auxPitchBits;

   int logTextureGranularity;
   int textureOffset;

   /* For non-dma direct rendering.
    */
   int ringOffset;
   int ringSize;

   drmBufMapPtr drmBufs;
   int irq;
   unsigned int sarea_priv_offset;

} I810DRIRec, *I810DRIPtr;

/* WARNING: Do not change the SAREA structure without changing the kernel
 * as well */

#define I810_UPLOAD_TEX0IMAGE  0x1	/* handled clientside */
#define I810_UPLOAD_TEX1IMAGE  0x2	/* handled clientside */
#define I810_UPLOAD_CTX        0x4
#define I810_UPLOAD_BUFFERS    0x8
#define I810_UPLOAD_TEX0       0x10
#define I810_UPLOAD_TEX1       0x20
#define I810_UPLOAD_CLIPRECTS  0x40

typedef struct {
   unsigned char next, prev;		/* indices to form a circular LRU  */
   unsigned char in_use;		/* owned by a client, or free? */
   int age;				/* tracked by clients to update local LRU's */
} I810TexRegionRec, *I810TexRegionPtr;

typedef struct {
   unsigned int ContextState[I810_CTX_SETUP_SIZE];
   unsigned int BufferState[I810_DEST_SETUP_SIZE];
   unsigned int TexState[2][I810_TEX_SETUP_SIZE];
   unsigned int dirty;

   unsigned int nbox;
   XF86DRIClipRectRec boxes[I810_NR_SAREA_CLIPRECTS];

   /* Maintain an LRU of contiguous regions of texture space.  If
    * you think you own a region of texture memory, and it has an
    * age different to the one you set, then you are mistaken and
    * it has been stolen by another client.  If global texAge
    * hasn't changed, there is no need to walk the list.
    *
    * These regions can be used as a proxy for the fine-grained
    * texture information of other clients - by maintaining them
    * in the same lru which is used to age their own textures,
    * clients have an approximate lru for the whole of global
    * texture space, and can make informed decisions as to which
    * areas to kick out.  There is no need to choose whether to
    * kick out your own texture or someone else's - simply eject
    * them all in LRU order.
    */
 
   drmTextureRegion texList[I810_NR_TEX_REGIONS + 1];

   /* Last elt is sentinal */
   int texAge;				/* last time texture was uploaded */

   int last_enqueue;			/* last time a buffer was enqueued */
   int last_dispatch;			/* age of the most recently dispatched buffer */
   int last_quiescent;			/*  */

   int ctxOwner;			/* last context to upload state */

   int vertex_prim;

   int pf_enabled;                  /* is pageflipping allowed? */
   int pf_active;                   /* is pageflipping active right now? */
   int pf_current_page; 	    /* which buffer is being displayed? */


} I810SAREARec, *I810SAREAPtr;

typedef struct {
   /* Nothing here yet */
   int dummy;
} I810ConfigPrivRec, *I810ConfigPrivPtr;

typedef struct {
   /* Nothing here yet */
   int dummy;
} I810DRIContextRec, *I810DRIContextPtr;

#endif