Merge branch 'nouveau-import'
[mesa.git] / src / mesa / drivers / dri / gamma / server / glint_dri.h
1 /* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/glint/glint_dri.h,v 1.7 2002/10/30 12:52:16 alanh Exp $ */
2 /**************************************************************************
3
4 Copyright 1998-1999 Precision Insight, Inc., Cedar Park, Texas.
5 All Rights Reserved.
6
7 Permission is hereby granted, free of charge, to any person obtaining a
8 copy of this software and associated documentation files (the
9 "Software"), to deal in the Software without restriction, including
10 without limitation the rights to use, copy, modify, merge, publish,
11 distribute, sub license, and/or sell copies of the Software, and to
12 permit persons to whom the Software is furnished to do so, subject to
13 the following conditions:
14
15 The above copyright notice and this permission notice (including the
16 next paragraph) shall be included in all copies or substantial portions
17 of the Software.
18
19 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
20 OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
21 MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
22 IN NO EVENT SHALL PRECISION INSIGHT AND/OR ITS SUPPLIERS BE LIABLE FOR
23 ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
24
25 TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
26 SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
27
28 **************************************************************************/
29
30 /*
31 * Author:
32 * Jens Owen <jens@tungstengraphics.com>
33 *
34 */
35
36 #ifndef _GLINT_DRI_H_
37 #define _GLINT_DRI_H_
38
39 #include "xf86drm.h"
40 #include "glint_common.h"
41
42 typedef struct {
43 unsigned int GDeltaMode;
44 unsigned int GDepthMode;
45 unsigned int GGeometryMode;
46 unsigned int GTransformMode;
47 } GAMMAContextRegionRec, *GAMMAContextRegionPtr;
48
49 typedef struct {
50 unsigned char next, prev; /* indices to form a circular LRU */
51 unsigned char in_use; /* owned by a client, or free? */
52 int age; /* tracked by clients to update local LRU's */
53 } GAMMATextureRegionRec, *GAMMATextureRegionPtr;
54
55 typedef struct {
56 GAMMAContextRegionRec context_state;
57
58 unsigned int dirty;
59
60 /* Maintain an LRU of contiguous regions of texture space. If
61 * you think you own a region of texture memory, and it has an
62 * age different to the one you set, then you are mistaken and
63 * it has been stolen by another client. If global texAge
64 * hasn't changed, there is no need to walk the list.
65 *
66 * These regions can be used as a proxy for the fine-grained
67 * texture information of other clients - by maintaining them
68 * in the same lru which is used to age their own textures,
69 * clients have an approximate lru for the whole of global
70 * texture space, and can make informed decisions as to which
71 * areas to kick out. There is no need to choose whether to
72 * kick out your own texture or someone else's - simply eject
73 * them all in LRU order.
74 */
75
76 #define GAMMA_NR_TEX_REGIONS 64
77 GAMMATextureRegionRec texList[GAMMA_NR_TEX_REGIONS+1];
78 /* Last elt is sentinal */
79 int texAge; /* last time texture was uploaded */
80 int last_enqueue; /* last time a buffer was enqueued */
81 int last_dispatch; /* age of the most recently dispatched buffer */
82 int last_quiescent; /* */
83 int ctxOwner; /* last context to upload state */
84
85 int vertex_prim;
86 } GLINTSAREADRIRec, *GLINTSAREADRIPtr;
87
88 /*
89 * Glint specific record passed back to client driver
90 * via DRIGetDeviceInfo request
91 */
92 typedef struct {
93 drmRegion registers0;
94 drmRegion registers1;
95 drmRegion registers2;
96 drmRegion registers3;
97 int numMultiDevices;
98 int pprod;
99 int cpp;
100 int frontOffset;
101 int frontPitch;
102 int backOffset;
103 int backPitch;
104 int backX;
105 int backY;
106 int depthOffset;
107 int depthPitch;
108 int textureSize;
109 int logTextureGranularity;
110 } GLINTDRIRec, *GLINTDRIPtr;
111
112 #define GLINT_DRI_BUF_COUNT 256
113 #define GLINT_DRI_BUF_SIZE 4096
114
115 #define GAMMA_NR_TEX_REGIONS 64
116
117 #define DMA_WRITE(val,reg) \
118 do { \
119 pGlint->buf2D++ = Glint##reg##Tag; \
120 pGlint->buf2D++ = val; \
121 } while (0)
122
123 #endif /* _GLINT_DRI_H_ */