Rev 3263 | Go to most recent revision | Only display areas with differences | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 3263 | Rev 3278 | ||
---|---|---|---|
1 | /************************************************************************** |
1 | /************************************************************************** |
2 | 2 | ||
3 | Copyright 1998-1999 Precision Insight, Inc., Cedar Park, Texas. |
3 | Copyright 1998-1999 Precision Insight, Inc., Cedar Park, Texas. |
4 | Copyright © 2002 David Dawes |
4 | Copyright © 2002 David Dawes |
5 | 5 | ||
6 | All Rights Reserved. |
6 | All Rights Reserved. |
7 | 7 | ||
8 | Permission is hereby granted, free of charge, to any person obtaining a |
8 | Permission is hereby granted, free of charge, to any person obtaining a |
9 | copy of this software and associated documentation files (the |
9 | copy of this software and associated documentation files (the |
10 | "Software"), to deal in the Software without restriction, including |
10 | "Software"), to deal in the Software without restriction, including |
11 | without limitation the rights to use, copy, modify, merge, publish, |
11 | without limitation the rights to use, copy, modify, merge, publish, |
12 | distribute, sub license, and/or sell copies of the Software, and to |
12 | distribute, sub license, and/or sell copies of the Software, and to |
13 | permit persons to whom the Software is furnished to do so, subject to |
13 | permit persons to whom the Software is furnished to do so, subject to |
14 | the following conditions: |
14 | the following conditions: |
15 | 15 | ||
16 | The above copyright notice and this permission notice (including the |
16 | The above copyright notice and this permission notice (including the |
17 | next paragraph) shall be included in all copies or substantial portions |
17 | next paragraph) shall be included in all copies or substantial portions |
18 | of the Software. |
18 | of the Software. |
19 | 19 | ||
20 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS |
20 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS |
21 | OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF |
21 | OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF |
22 | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. |
22 | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. |
23 | IN NO EVENT SHALL PRECISION INSIGHT AND/OR ITS SUPPLIERS BE LIABLE FOR |
23 | IN NO EVENT SHALL PRECISION INSIGHT AND/OR ITS SUPPLIERS BE LIABLE FOR |
24 | ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, |
24 | ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, |
25 | TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE |
25 | TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE |
26 | SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
26 | SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
27 | 27 | ||
28 | **************************************************************************/ |
28 | **************************************************************************/ |
29 | 29 | ||
30 | /* |
30 | /* |
31 | * Authors: |
31 | * Authors: |
32 | * Keith Whitwell |
32 | * Keith Whitwell |
33 | * David Dawes |
33 | * David Dawes |
34 | * |
34 | * |
35 | */ |
35 | */ |
36 | 36 | ||
37 | #ifndef _SNA_H_ |
37 | #ifndef _SNA_H_ |
38 | #define _SNA_H_ |
38 | #define _SNA_H_ |
39 | 39 | ||
40 | #ifdef HAVE_CONFIG_H |
40 | #ifdef HAVE_CONFIG_H |
41 | #include "config.h" |
41 | #include "config.h" |
42 | #endif |
42 | #endif |
43 | 43 | ||
44 | #include |
44 | #include |
45 | #include |
45 | #include |
46 | #include |
46 | #include |
47 | #include |
47 | #include |
48 | 48 | ||
49 | #include "intel_driver.h" |
49 | #include "intel_driver.h" |
50 | #include "pciaccess.h" |
50 | #include "pciaccess.h" |
51 | 51 | ||
52 | #include "compiler.h" |
52 | #include "compiler.h" |
53 | 53 | ||
54 | //#define DBG(x) |
54 | //#define DBG(x) |
55 | //#define DBG(x) ErrorF x |
55 | //#define DBG(x) ErrorF x |
56 | 56 | ||
57 | #define assert(x) |
57 | #define assert(x) |
58 | 58 | ||
59 | 59 | ||
60 | int drmIoctl(int fd, unsigned long request, void *arg); |
60 | int drmIoctl(int fd, unsigned long request, void *arg); |
61 | 61 | ||
62 | 62 | ||
63 | #define SRV_GET_PCI_INFO 20 |
63 | #define SRV_GET_PCI_INFO 20 |
64 | #define SRV_GET_PARAM 21 |
64 | #define SRV_GET_PARAM 21 |
65 | #define SRV_I915_GEM_CREATE 22 |
65 | #define SRV_I915_GEM_CREATE 22 |
66 | #define SRV_DRM_GEM_CLOSE 23 |
66 | #define SRV_DRM_GEM_CLOSE 23 |
67 | #define SRV_I915_GEM_PIN 24 |
67 | #define SRV_I915_GEM_PIN 24 |
68 | #define SRV_I915_GEM_SET_CACHEING 25 |
68 | #define SRV_I915_GEM_SET_CACHEING 25 |
69 | #define SRV_I915_GEM_GET_APERTURE 26 |
69 | #define SRV_I915_GEM_GET_APERTURE 26 |
70 | #define SRV_I915_GEM_PWRITE 27 |
70 | #define SRV_I915_GEM_PWRITE 27 |
71 | #define SRV_I915_GEM_BUSY 28 |
71 | #define SRV_I915_GEM_BUSY 28 |
72 | #define SRV_I915_GEM_SET_DOMAIN 29 |
72 | #define SRV_I915_GEM_SET_DOMAIN 29 |
73 | #define SRV_I915_GEM_MMAP 30 |
73 | #define SRV_I915_GEM_MMAP 30 |
74 | #define SRV_I915_GEM_THROTTLE 32 |
74 | #define SRV_I915_GEM_THROTTLE 32 |
75 | #define SRV_FBINFO 33 |
75 | #define SRV_FBINFO 33 |
76 | #define SRV_I915_GEM_EXECBUFFER2 34 |
76 | #define SRV_I915_GEM_EXECBUFFER2 34 |
- | 77 | #define SRV_MASK_UPDATE 35 |
|
77 | 78 | ||
78 | #define SRV_I915_GEM_MMAP_GTT 31 |
79 | #define SRV_I915_GEM_MMAP_GTT 31 |
79 | 80 | ||
80 | 81 | ||
81 | #define DRM_IOCTL_GEM_CLOSE SRV_DRM_GEM_CLOSE |
82 | #define DRM_IOCTL_GEM_CLOSE SRV_DRM_GEM_CLOSE |
82 | 83 | ||
83 | #define PIXMAN_FORMAT(bpp,type,a,r,g,b) (((bpp) << 24) | \ |
84 | #define PIXMAN_FORMAT(bpp,type,a,r,g,b) (((bpp) << 24) | \ |
84 | ((type) << 16) | \ |
85 | ((type) << 16) | \ |
85 | ((a) << 12) | \ |
86 | ((a) << 12) | \ |
86 | ((r) << 8) | \ |
87 | ((r) << 8) | \ |
87 | ((g) << 4) | \ |
88 | ((g) << 4) | \ |
88 | ((b))) |
89 | ((b))) |
89 | #define PIXMAN_TYPE_OTHER 0 |
90 | #define PIXMAN_TYPE_OTHER 0 |
90 | #define PIXMAN_TYPE_A 1 |
91 | #define PIXMAN_TYPE_A 1 |
91 | #define PIXMAN_TYPE_ARGB 2 |
92 | #define PIXMAN_TYPE_ARGB 2 |
92 | #define PIXMAN_TYPE_ABGR 3 |
93 | #define PIXMAN_TYPE_ABGR 3 |
93 | #define PIXMAN_TYPE_COLOR 4 |
94 | #define PIXMAN_TYPE_COLOR 4 |
94 | #define PIXMAN_TYPE_GRAY 5 |
95 | #define PIXMAN_TYPE_GRAY 5 |
95 | #define PIXMAN_TYPE_YUY2 6 |
96 | #define PIXMAN_TYPE_YUY2 6 |
96 | #define PIXMAN_TYPE_YV12 7 |
97 | #define PIXMAN_TYPE_YV12 7 |
97 | #define PIXMAN_TYPE_BGRA 8 |
98 | #define PIXMAN_TYPE_BGRA 8 |
98 | #define PIXMAN_TYPE_RGBA 9 |
99 | #define PIXMAN_TYPE_RGBA 9 |
99 | #define PIXMAN_TYPE_ARGB_SRGB 10 |
100 | #define PIXMAN_TYPE_ARGB_SRGB 10 |
100 | 101 | ||
101 | /* 32bpp formats */ |
102 | /* 32bpp formats */ |
102 | typedef enum { |
103 | typedef enum { |
103 | PIXMAN_a8r8g8b8 = PIXMAN_FORMAT(32,PIXMAN_TYPE_ARGB,8,8,8,8), |
104 | PIXMAN_a8r8g8b8 = PIXMAN_FORMAT(32,PIXMAN_TYPE_ARGB,8,8,8,8), |
104 | PIXMAN_x8r8g8b8 = PIXMAN_FORMAT(32,PIXMAN_TYPE_ARGB,0,8,8,8), |
105 | PIXMAN_x8r8g8b8 = PIXMAN_FORMAT(32,PIXMAN_TYPE_ARGB,0,8,8,8), |
105 | PIXMAN_a8b8g8r8 = PIXMAN_FORMAT(32,PIXMAN_TYPE_ABGR,8,8,8,8), |
106 | PIXMAN_a8b8g8r8 = PIXMAN_FORMAT(32,PIXMAN_TYPE_ABGR,8,8,8,8), |
106 | PIXMAN_x8b8g8r8 = PIXMAN_FORMAT(32,PIXMAN_TYPE_ABGR,0,8,8,8), |
107 | PIXMAN_x8b8g8r8 = PIXMAN_FORMAT(32,PIXMAN_TYPE_ABGR,0,8,8,8), |
107 | PIXMAN_b8g8r8a8 = PIXMAN_FORMAT(32,PIXMAN_TYPE_BGRA,8,8,8,8), |
108 | PIXMAN_b8g8r8a8 = PIXMAN_FORMAT(32,PIXMAN_TYPE_BGRA,8,8,8,8), |
108 | PIXMAN_b8g8r8x8 = PIXMAN_FORMAT(32,PIXMAN_TYPE_BGRA,0,8,8,8), |
109 | PIXMAN_b8g8r8x8 = PIXMAN_FORMAT(32,PIXMAN_TYPE_BGRA,0,8,8,8), |
109 | PIXMAN_r8g8b8a8 = PIXMAN_FORMAT(32,PIXMAN_TYPE_RGBA,8,8,8,8), |
110 | PIXMAN_r8g8b8a8 = PIXMAN_FORMAT(32,PIXMAN_TYPE_RGBA,8,8,8,8), |
110 | PIXMAN_r8g8b8x8 = PIXMAN_FORMAT(32,PIXMAN_TYPE_RGBA,0,8,8,8), |
111 | PIXMAN_r8g8b8x8 = PIXMAN_FORMAT(32,PIXMAN_TYPE_RGBA,0,8,8,8), |
111 | PIXMAN_x14r6g6b6 = PIXMAN_FORMAT(32,PIXMAN_TYPE_ARGB,0,6,6,6), |
112 | PIXMAN_x14r6g6b6 = PIXMAN_FORMAT(32,PIXMAN_TYPE_ARGB,0,6,6,6), |
112 | PIXMAN_x2r10g10b10 = PIXMAN_FORMAT(32,PIXMAN_TYPE_ARGB,0,10,10,10), |
113 | PIXMAN_x2r10g10b10 = PIXMAN_FORMAT(32,PIXMAN_TYPE_ARGB,0,10,10,10), |
113 | PIXMAN_a2r10g10b10 = PIXMAN_FORMAT(32,PIXMAN_TYPE_ARGB,2,10,10,10), |
114 | PIXMAN_a2r10g10b10 = PIXMAN_FORMAT(32,PIXMAN_TYPE_ARGB,2,10,10,10), |
114 | PIXMAN_x2b10g10r10 = PIXMAN_FORMAT(32,PIXMAN_TYPE_ABGR,0,10,10,10), |
115 | PIXMAN_x2b10g10r10 = PIXMAN_FORMAT(32,PIXMAN_TYPE_ABGR,0,10,10,10), |
115 | PIXMAN_a2b10g10r10 = PIXMAN_FORMAT(32,PIXMAN_TYPE_ABGR,2,10,10,10) |
116 | PIXMAN_a2b10g10r10 = PIXMAN_FORMAT(32,PIXMAN_TYPE_ABGR,2,10,10,10), |
- | 117 | ||
- | 118 | PIXMAN_a8 = PIXMAN_FORMAT(8,PIXMAN_TYPE_A,8,0,0,0) |
|
116 | 119 | ||
117 | } pixman_format_code_t; |
120 | } pixman_format_code_t; |
- | 121 | ||
- | 122 | typedef enum _PictFormatShort { |
|
- | 123 | ||
- | 124 | PICT_a8r8g8b8 = PIXMAN_a8r8g8b8, |
|
- | 125 | PICT_x8r8g8b8 = PIXMAN_x8r8g8b8, |
|
- | 126 | PICT_a8b8g8r8 = PIXMAN_a8b8g8r8, |
|
- | 127 | PICT_x8b8g8r8 = PIXMAN_x8b8g8r8, |
|
- | 128 | PICT_b8g8r8a8 = PIXMAN_b8g8r8a8, |
|
- | 129 | PICT_b8g8r8x8 = PIXMAN_b8g8r8x8, |
|
- | 130 | ||
- | 131 | /* 8bpp formats */ |
|
- | 132 | PICT_a8 = PIXMAN_a8, |
|
- | 133 | ||
- | 134 | /* 4bpp formats */ |
|
- | 135 | } PictFormatShort; |
|
- | 136 | ||
- | 137 | #define RepeatNone 0 |
|
- | 138 | #define RepeatNormal 1 |
|
- | 139 | #define RepeatPad 2 |
|
- | 140 | #define RepeatReflect 3 |
|
- | 141 | ||
- | 142 | #define PictFilterNearest 0 |
|
- | 143 | #define PictFilterBilinear 1 |
|
- | 144 | ||
- | 145 | #define PictFilterFast 2 |
|
- | 146 | #define PictFilterGood 3 |
|
- | 147 | #define PictFilterBest 4 |
|
- | 148 | ||
- | 149 | #define PictFilterConvolution 5 |
|
- | 150 | ||
- | 151 | typedef int32_t pixman_fixed_16_16_t; |
|
- | 152 | typedef pixman_fixed_16_16_t pixman_fixed_t; |
|
- | 153 | ||
- | 154 | struct pixman_transform |
|
- | 155 | { |
|
- | 156 | pixman_fixed_t matrix[3][3]; |
|
118 | 157 | }; |
|
119 | 158 | ||
120 | typedef unsigned long Picture; |
159 | typedef unsigned long Picture; |
121 | typedef unsigned long PictFormat; |
160 | typedef unsigned long PictFormat; |
122 | 161 | ||
123 | typedef struct _Pixmap *PixmapPtr; |
162 | typedef struct _Pixmap *PixmapPtr; |
124 | typedef struct _Picture *PicturePtr; |
163 | typedef struct _Picture *PicturePtr; |
- | 164 | typedef struct _Drawable *DrawablePtr; |
|
- | 165 | typedef struct _PictFormat *PictFormatPtr; |
|
- | 166 | ||
- | 167 | typedef struct pixman_transform PictTransform, *PictTransformPtr; |
|
- | 168 | ||
- | 169 | ||
125 | 170 | ||
126 | typedef struct _Drawable { |
171 | typedef struct _Drawable { |
127 | unsigned char type; /* DRAWABLE_ |
172 | unsigned char type; /* DRAWABLE_ |
128 | unsigned char class; /* specific to type */ |
173 | unsigned char class; /* specific to type */ |
129 | unsigned char depth; |
174 | unsigned char depth; |
130 | unsigned char bitsPerPixel; |
175 | unsigned char bitsPerPixel; |
131 | unsigned int id; /* resource id */ |
176 | unsigned int id; /* resource id */ |
132 | short x; /* window: screen absolute, pixmap: 0 */ |
177 | short x; /* window: screen absolute, pixmap: 0 */ |
133 | short y; /* window: screen absolute, pixmap: 0 */ |
178 | short y; /* window: screen absolute, pixmap: 0 */ |
134 | unsigned short width; |
179 | unsigned short width; |
135 | unsigned short height; |
180 | unsigned short height; |
136 | } DrawableRec; |
181 | } DrawableRec; |
137 | 182 | ||
138 | /* |
183 | /* |
139 | * PIXMAP -- device dependent |
184 | * PIXMAP -- device dependent |
140 | */ |
185 | */ |
141 | 186 | ||
142 | typedef struct _Pixmap { |
187 | typedef struct _Pixmap { |
143 | DrawableRec drawable; |
188 | DrawableRec drawable; |
144 | // PrivateRec *devPrivates; |
189 | // PrivateRec *devPrivates; |
145 | int refcnt; |
190 | int refcnt; |
146 | int devKind; /* This is the pitch of the pixmap, typically width*bpp/8. */ |
191 | int devKind; /* This is the pitch of the pixmap, typically width*bpp/8. */ |
147 | // DevUnion devPrivate; /* When !NULL, devPrivate.ptr points to the raw pixel data. */ |
192 | // DevUnion devPrivate; /* When !NULL, devPrivate.ptr points to the raw pixel data. */ |
148 | #ifdef COMPOSITE |
193 | #ifdef COMPOSITE |
149 | short screen_x; |
194 | short screen_x; |
150 | short screen_y; |
195 | short screen_y; |
151 | #endif |
196 | #endif |
152 | unsigned usage_hint; /* see CREATE_PIXMAP_USAGE_* */ |
197 | unsigned usage_hint; /* see CREATE_PIXMAP_USAGE_* */ |
153 | 198 | ||
154 | PixmapPtr master_pixmap; /* pointer to master copy of pixmap for pixmap sharing */ |
199 | PixmapPtr master_pixmap; /* pointer to master copy of pixmap for pixmap sharing */ |
155 | } PixmapRec; |
200 | } PixmapRec; |
- | 201 | ||
- | 202 | typedef struct _PictFormat { |
|
- | 203 | uint32_t id; |
|
- | 204 | uint32_t format; /* except bpp */ |
|
- | 205 | unsigned char type; |
|
- | 206 | unsigned char depth; |
|
- | 207 | // DirectFormatRec direct; |
|
- | 208 | // IndexFormatRec index; |
|
- | 209 | } PictFormatRec; |
|
- | 210 | ||
- | 211 | typedef struct _Picture { |
|
- | 212 | DrawablePtr pDrawable; |
|
- | 213 | // PictFormatPtr pFormat; |
|
- | 214 | PictFormatShort format; /* PICT_FORMAT */ |
|
- | 215 | int refcnt; |
|
- | 216 | uint32_t id; |
|
- | 217 | unsigned int repeat:1; |
|
- | 218 | unsigned int graphicsExposures:1; |
|
- | 219 | unsigned int subWindowMode:1; |
|
- | 220 | unsigned int polyEdge:1; |
|
- | 221 | unsigned int polyMode:1; |
|
- | 222 | unsigned int freeCompClip:1; |
|
- | 223 | unsigned int clientClipType:2; |
|
- | 224 | unsigned int componentAlpha:1; |
|
- | 225 | unsigned int repeatType:2; |
|
- | 226 | unsigned int filter:3; |
|
- | 227 | // unsigned int stateChanges:CPLastBit; |
|
- | 228 | // unsigned int unused:18 - CPLastBit; |
|
- | 229 | ||
- | 230 | // PicturePtr alphaMap; |
|
- | 231 | ||
- | 232 | // PictTransform *transform; |
|
- | 233 | ||
- | 234 | // SourcePictPtr pSourcePict; |
|
- | 235 | // xFixed *filter_params; |
|
- | 236 | // int filter_nparams; |
|
- | 237 | } PictureRec; |
|
- | 238 | ||
- | 239 | #define PolyModePrecise 0 |
|
- | 240 | #define PolyModeImprecise 1 |
|
156 | 241 | ||
157 | 242 | ||
158 | struct sna_fb |
243 | struct sna_fb |
159 | { |
244 | { |
160 | uint32_t width; |
245 | uint32_t width; |
161 | uint32_t height; |
246 | uint32_t height; |
162 | uint32_t pitch; |
247 | uint32_t pitch; |
163 | uint32_t tiling; |
248 | uint32_t tiling; |
164 | 249 | ||
165 | struct kgem_bo *fb_bo; |
250 | struct kgem_bo *fb_bo; |
166 | }; |
251 | }; |
167 | 252 | ||
168 | struct pixman_box16 |
253 | struct pixman_box16 |
169 | { |
254 | { |
170 | int16_t x1, y1, x2, y2; |
255 | int16_t x1, y1, x2, y2; |
171 | }; |
256 | }; |
172 | 257 | ||
173 | typedef struct pixman_box16 BoxRec; |
258 | typedef struct pixman_box16 BoxRec; |
174 | typedef unsigned int CARD32; |
259 | typedef unsigned int CARD32; |
175 | typedef unsigned short CARD16; |
260 | typedef unsigned short CARD16; |
176 | 261 | ||
177 | #include "sna_render.h" |
262 | #include "sna_render.h" |
178 | #include "kgem.h" |
263 | #include "kgem.h" |
179 | 264 | ||
180 | #define GXclear 0x0 |
265 | #define GXclear 0x0 |
181 | #define GXcopy 0x3 |
266 | #define GXcopy 0x3 |
182 | 267 | ||
183 | #define PictOpClear 0 |
268 | #define PictOpClear 0 |
184 | #define PictOpSrc 1 |
269 | #define PictOpSrc 1 |
185 | #define PictOpDst 2 |
270 | #define PictOpDst 2 |
186 | #define PictOpOver 3 |
271 | #define PictOpOver 3 |
187 | #define PictOpOverReverse 4 |
272 | #define PictOpOverReverse 4 |
188 | #define PictOpIn 5 |
273 | #define PictOpIn 5 |
189 | #define PictOpInReverse 6 |
274 | #define PictOpInReverse 6 |
190 | #define PictOpOut 7 |
275 | #define PictOpOut 7 |
191 | #define PictOpOutReverse 8 |
276 | #define PictOpOutReverse 8 |
192 | #define PictOpAtop 9 |
277 | #define PictOpAtop 9 |
193 | #define PictOpAtopReverse 10 |
278 | #define PictOpAtopReverse 10 |
194 | #define PictOpXor 11 |
279 | #define PictOpXor 11 |
195 | #define PictOpAdd 12 |
280 | #define PictOpAdd 12 |
196 | #define PictOpSaturate 13 |
281 | #define PictOpSaturate 13 |
197 | #define PictOpMaximum 13 |
282 | #define PictOpMaximum 13 |
198 | 283 | ||
199 | 284 | ||
200 | 285 | ||
201 | struct sna { |
286 | struct sna { |
202 | unsigned flags; |
287 | unsigned flags; |
203 | #define SNA_NO_WAIT 0x1 |
288 | #define SNA_NO_WAIT 0x1 |
204 | #define SNA_NO_FLIP 0x2 |
289 | #define SNA_NO_FLIP 0x2 |
205 | #define SNA_TRIPLE_BUFFER 0x4 |
290 | #define SNA_TRIPLE_BUFFER 0x4 |
206 | #define SNA_TEAR_FREE 0x10 |
291 | #define SNA_TEAR_FREE 0x10 |
207 | #define SNA_FORCE_SHADOW 0x20 |
292 | #define SNA_FORCE_SHADOW 0x20 |
208 | 293 | ||
209 | struct list flush_pixmaps; |
294 | struct list flush_pixmaps; |
210 | struct list active_pixmaps; |
295 | struct list active_pixmaps; |
211 | 296 | ||
212 | 297 | ||
213 | 298 | ||
214 | // int vblank_interval; |
299 | // int vblank_interval; |
215 | 300 | ||
216 | // struct list deferred_free; |
301 | // struct list deferred_free; |
217 | // struct list dirty_pixmaps; |
302 | // struct list dirty_pixmaps; |
218 | // struct list active_pixmaps; |
303 | // struct list active_pixmaps; |
219 | // struct list inactive_clock[2]; |
304 | // struct list inactive_clock[2]; |
220 | 305 | ||
221 | unsigned int tiling; |
306 | unsigned int tiling; |
222 | #define SNA_TILING_DISABLE 0x0 |
307 | #define SNA_TILING_DISABLE 0x0 |
223 | #define SNA_TILING_FB 0x1 |
308 | #define SNA_TILING_FB 0x1 |
224 | #define SNA_TILING_2D 0x2 |
309 | #define SNA_TILING_2D 0x2 |
225 | #define SNA_TILING_ALL (~0) |
310 | #define SNA_TILING_ALL (~0) |
226 | 311 | ||
227 | struct pci_device *PciInfo; |
312 | struct pci_device *PciInfo; |
228 | const struct intel_device_info *info; |
313 | const struct intel_device_info *info; |
229 | 314 | ||
230 | // PicturePtr clear; |
315 | // PicturePtr clear; |
231 | struct { |
316 | struct { |
232 | uint32_t fill_bo; |
317 | uint32_t fill_bo; |
233 | uint32_t fill_pixel; |
318 | uint32_t fill_pixel; |
234 | uint32_t fill_alu; |
319 | uint32_t fill_alu; |
235 | } blt_state; |
320 | } blt_state; |
236 | union { |
321 | union { |
237 | // struct gen2_render_state gen2; |
322 | // struct gen2_render_state gen2; |
238 | // struct gen3_render_state gen3; |
323 | // struct gen3_render_state gen3; |
239 | // struct gen4_render_state gen4; |
324 | // struct gen4_render_state gen4; |
240 | // struct gen5_render_state gen5; |
325 | // struct gen5_render_state gen5; |
241 | struct gen6_render_state gen6; |
326 | struct gen6_render_state gen6; |
242 | struct gen7_render_state gen7; |
327 | struct gen7_render_state gen7; |
243 | } render_state; |
328 | } render_state; |
244 | 329 | ||
245 | 330 | ||
246 | /* Broken-out options. */ |
331 | /* Broken-out options. */ |
247 | // OptionInfoPtr Options; |
332 | // OptionInfoPtr Options; |
248 | 333 | ||
249 | /* Driver phase/state information */ |
334 | /* Driver phase/state information */ |
250 | // Bool suspended; |
335 | // Bool suspended; |
251 | 336 | ||
252 | struct kgem kgem; |
337 | struct kgem kgem; |
253 | struct sna_render render; |
338 | struct sna_render render; |
254 | 339 | ||
255 | #if DEBUG_MEMORY |
340 | #if DEBUG_MEMORY |
256 | struct { |
341 | struct { |
257 | int shadow_pixels_allocs; |
342 | int shadow_pixels_allocs; |
258 | int cpu_bo_allocs; |
343 | int cpu_bo_allocs; |
259 | size_t shadow_pixels_bytes; |
344 | size_t shadow_pixels_bytes; |
260 | size_t cpu_bo_bytes; |
345 | size_t cpu_bo_bytes; |
261 | } debug_memory; |
346 | } debug_memory; |
262 | #endif |
347 | #endif |
263 | }; |
348 | }; |
264 | - | ||
265 | static inline int vertex_space(struct sna *sna) |
- | |
266 | { |
- | |
267 | return sna->render.vertex_size - sna->render.vertex_used; |
- | |
268 | } |
- | |
269 | - | ||
270 | static inline void vertex_emit(struct sna *sna, float v) |
- | |
271 | { |
- | |
272 | assert(sna->render.vertex_used < sna->render.vertex_size); |
- | |
273 | sna->render.vertices[sna->render.vertex_used++] = v; |
- | |
274 | } |
- | |
275 | - | ||
276 | static inline void vertex_emit_2s(struct sna *sna, int16_t x, int16_t y) |
- | |
277 | { |
- | |
278 | int16_t *v = (int16_t *)&sna->render.vertices[sna->render.vertex_used++]; |
- | |
279 | assert(sna->render.vertex_used <= sna->render.vertex_size); |
- | |
280 | v[0] = x; |
- | |
281 | v[1] = y; |
- | |
282 | } |
- | |
283 | - | ||
284 | static inline void batch_emit(struct sna *sna, uint32_t dword) |
- | |
285 | { |
- | |
286 | assert(sna->kgem.mode != KGEM_NONE); |
- | |
287 | assert(sna->kgem.nbatch + KGEM_BATCH_RESERVED < sna->kgem.surface); |
- | |
288 | sna->kgem.batch[sna->kgem.nbatch++] = dword; |
- | |
289 | } |
349 | |
290 | 350 | ||
291 | #ifndef ARRAY_SIZE |
351 | #ifndef ARRAY_SIZE |
292 | #define ARRAY_SIZE(x) (sizeof(x) / sizeof(x[0])) |
352 | #define ARRAY_SIZE(x) (sizeof(x) / sizeof(x[0])) |
293 | #endif |
353 | #endif |
294 | 354 | ||
295 | #ifndef ALIGN |
355 | #ifndef ALIGN |
296 | #define ALIGN(i,m) (((i) + (m) - 1) & ~((m) - 1)) |
356 | #define ALIGN(i,m) (((i) + (m) - 1) & ~((m) - 1)) |
297 | #endif |
357 | #endif |
298 | 358 | ||
299 | #ifndef MIN |
359 | #ifndef MIN |
300 | #define MIN(a,b) ((a) <= (b) ? (a) : (b)) |
360 | #define MIN(a,b) ((a) <= (b) ? (a) : (b)) |
301 | #endif |
361 | #endif |
302 | 362 | ||
303 | #ifndef MAX |
363 | #ifndef MAX |
304 | #define MAX(a,b) ((a) >= (b) ? (a) : (b)) |
364 | #define MAX(a,b) ((a) >= (b) ? (a) : (b)) |
305 | #endif |
365 | #endif |
306 | #endif /* _SNA_H */=>>=>>><>><>><>><>><> |
366 | #endif /* _SNA_H */=>><>><>><>><>><> |