Rev 3278 | Go to most recent revision | Only display areas with differences | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 3278 | Rev 3280 | ||
---|---|---|---|
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 | #define SRV_MASK_UPDATE 35 |
78 | 78 | ||
79 | #define SRV_I915_GEM_MMAP_GTT 31 |
79 | #define SRV_I915_GEM_MMAP_GTT 31 |
80 | 80 | ||
81 | 81 | ||
82 | #define DRM_IOCTL_GEM_CLOSE SRV_DRM_GEM_CLOSE |
82 | #define DRM_IOCTL_GEM_CLOSE SRV_DRM_GEM_CLOSE |
83 | 83 | ||
84 | #define PIXMAN_FORMAT(bpp,type,a,r,g,b) (((bpp) << 24) | \ |
84 | #define PIXMAN_FORMAT(bpp,type,a,r,g,b) (((bpp) << 24) | \ |
85 | ((type) << 16) | \ |
85 | ((type) << 16) | \ |
86 | ((a) << 12) | \ |
86 | ((a) << 12) | \ |
87 | ((r) << 8) | \ |
87 | ((r) << 8) | \ |
88 | ((g) << 4) | \ |
88 | ((g) << 4) | \ |
89 | ((b))) |
89 | ((b))) |
90 | #define PIXMAN_TYPE_OTHER 0 |
90 | #define PIXMAN_TYPE_OTHER 0 |
91 | #define PIXMAN_TYPE_A 1 |
91 | #define PIXMAN_TYPE_A 1 |
92 | #define PIXMAN_TYPE_ARGB 2 |
92 | #define PIXMAN_TYPE_ARGB 2 |
93 | #define PIXMAN_TYPE_ABGR 3 |
93 | #define PIXMAN_TYPE_ABGR 3 |
94 | #define PIXMAN_TYPE_COLOR 4 |
94 | #define PIXMAN_TYPE_COLOR 4 |
95 | #define PIXMAN_TYPE_GRAY 5 |
95 | #define PIXMAN_TYPE_GRAY 5 |
96 | #define PIXMAN_TYPE_YUY2 6 |
96 | #define PIXMAN_TYPE_YUY2 6 |
97 | #define PIXMAN_TYPE_YV12 7 |
97 | #define PIXMAN_TYPE_YV12 7 |
98 | #define PIXMAN_TYPE_BGRA 8 |
98 | #define PIXMAN_TYPE_BGRA 8 |
99 | #define PIXMAN_TYPE_RGBA 9 |
99 | #define PIXMAN_TYPE_RGBA 9 |
100 | #define PIXMAN_TYPE_ARGB_SRGB 10 |
100 | #define PIXMAN_TYPE_ARGB_SRGB 10 |
101 | 101 | ||
102 | /* 32bpp formats */ |
102 | /* 32bpp formats */ |
103 | typedef enum { |
103 | typedef enum { |
104 | 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), |
105 | 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), |
106 | 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), |
107 | 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), |
108 | 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), |
109 | 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), |
110 | 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), |
111 | 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), |
112 | 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), |
113 | 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), |
114 | 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), |
115 | 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), |
116 | 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 | 117 | ||
118 | PIXMAN_a8 = PIXMAN_FORMAT(8,PIXMAN_TYPE_A,8,0,0,0) |
118 | PIXMAN_a8 = PIXMAN_FORMAT(8,PIXMAN_TYPE_A,8,0,0,0) |
119 | 119 | ||
120 | } pixman_format_code_t; |
120 | } pixman_format_code_t; |
121 | 121 | ||
122 | typedef enum _PictFormatShort { |
122 | typedef enum _PictFormatShort { |
123 | 123 | ||
124 | PICT_a8r8g8b8 = PIXMAN_a8r8g8b8, |
124 | PICT_a8r8g8b8 = PIXMAN_a8r8g8b8, |
125 | PICT_x8r8g8b8 = PIXMAN_x8r8g8b8, |
125 | PICT_x8r8g8b8 = PIXMAN_x8r8g8b8, |
126 | PICT_a8b8g8r8 = PIXMAN_a8b8g8r8, |
126 | PICT_a8b8g8r8 = PIXMAN_a8b8g8r8, |
127 | PICT_x8b8g8r8 = PIXMAN_x8b8g8r8, |
127 | PICT_x8b8g8r8 = PIXMAN_x8b8g8r8, |
128 | PICT_b8g8r8a8 = PIXMAN_b8g8r8a8, |
128 | PICT_b8g8r8a8 = PIXMAN_b8g8r8a8, |
129 | PICT_b8g8r8x8 = PIXMAN_b8g8r8x8, |
129 | PICT_b8g8r8x8 = PIXMAN_b8g8r8x8, |
130 | 130 | ||
131 | /* 8bpp formats */ |
131 | /* 8bpp formats */ |
132 | PICT_a8 = PIXMAN_a8, |
132 | PICT_a8 = PIXMAN_a8, |
133 | 133 | ||
134 | /* 4bpp formats */ |
134 | /* 4bpp formats */ |
135 | } PictFormatShort; |
135 | } PictFormatShort; |
136 | 136 | ||
137 | #define RepeatNone 0 |
137 | #define RepeatNone 0 |
138 | #define RepeatNormal 1 |
138 | #define RepeatNormal 1 |
139 | #define RepeatPad 2 |
139 | #define RepeatPad 2 |
140 | #define RepeatReflect 3 |
140 | #define RepeatReflect 3 |
141 | 141 | ||
142 | #define PictFilterNearest 0 |
142 | #define PictFilterNearest 0 |
143 | #define PictFilterBilinear 1 |
143 | #define PictFilterBilinear 1 |
144 | 144 | ||
145 | #define PictFilterFast 2 |
145 | #define PictFilterFast 2 |
146 | #define PictFilterGood 3 |
146 | #define PictFilterGood 3 |
147 | #define PictFilterBest 4 |
147 | #define PictFilterBest 4 |
148 | 148 | ||
149 | #define PictFilterConvolution 5 |
149 | #define PictFilterConvolution 5 |
150 | 150 | ||
151 | typedef int32_t pixman_fixed_16_16_t; |
151 | typedef int32_t pixman_fixed_16_16_t; |
152 | typedef pixman_fixed_16_16_t pixman_fixed_t; |
152 | typedef pixman_fixed_16_16_t pixman_fixed_t; |
153 | 153 | ||
154 | struct pixman_transform |
154 | struct pixman_transform |
155 | { |
155 | { |
156 | pixman_fixed_t matrix[3][3]; |
156 | pixman_fixed_t matrix[3][3]; |
157 | }; |
157 | }; |
158 | 158 | ||
159 | typedef unsigned long Picture; |
159 | typedef unsigned long Picture; |
160 | typedef unsigned long PictFormat; |
160 | typedef unsigned long PictFormat; |
161 | 161 | ||
162 | typedef struct _Pixmap *PixmapPtr; |
162 | typedef struct _Pixmap *PixmapPtr; |
163 | typedef struct _Picture *PicturePtr; |
163 | typedef struct _Picture *PicturePtr; |
164 | typedef struct _Drawable *DrawablePtr; |
164 | typedef struct _Drawable *DrawablePtr; |
165 | typedef struct _PictFormat *PictFormatPtr; |
165 | typedef struct _PictFormat *PictFormatPtr; |
166 | 166 | ||
167 | typedef struct pixman_transform PictTransform, *PictTransformPtr; |
167 | typedef struct pixman_transform PictTransform, *PictTransformPtr; |
168 | 168 | ||
169 | 169 | ||
170 | 170 | ||
171 | typedef struct _Drawable { |
171 | typedef struct _Drawable { |
172 | unsigned char type; /* DRAWABLE_ |
172 | unsigned char type; /* DRAWABLE_ |
173 | unsigned char class; /* specific to type */ |
173 | unsigned char class; /* specific to type */ |
174 | unsigned char depth; |
174 | unsigned char depth; |
175 | unsigned char bitsPerPixel; |
175 | unsigned char bitsPerPixel; |
176 | unsigned int id; /* resource id */ |
176 | unsigned int id; /* resource id */ |
177 | short x; /* window: screen absolute, pixmap: 0 */ |
177 | short x; /* window: screen absolute, pixmap: 0 */ |
178 | short y; /* window: screen absolute, pixmap: 0 */ |
178 | short y; /* window: screen absolute, pixmap: 0 */ |
179 | unsigned short width; |
179 | unsigned short width; |
180 | unsigned short height; |
180 | unsigned short height; |
181 | } DrawableRec; |
181 | } DrawableRec; |
182 | 182 | ||
183 | /* |
183 | /* |
184 | * PIXMAP -- device dependent |
184 | * PIXMAP -- device dependent |
185 | */ |
185 | */ |
186 | 186 | ||
187 | typedef struct _Pixmap { |
187 | typedef struct _Pixmap { |
188 | DrawableRec drawable; |
188 | DrawableRec drawable; |
189 | // PrivateRec *devPrivates; |
189 | // PrivateRec *devPrivates; |
190 | int refcnt; |
190 | int refcnt; |
191 | 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. */ |
192 | // 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. */ |
193 | #ifdef COMPOSITE |
193 | #ifdef COMPOSITE |
194 | short screen_x; |
194 | short screen_x; |
195 | short screen_y; |
195 | short screen_y; |
196 | #endif |
196 | #endif |
197 | unsigned usage_hint; /* see CREATE_PIXMAP_USAGE_* */ |
197 | unsigned usage_hint; /* see CREATE_PIXMAP_USAGE_* */ |
198 | 198 | ||
199 | 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 */ |
200 | } PixmapRec; |
200 | } PixmapRec; |
201 | 201 | ||
202 | typedef struct _PictFormat { |
202 | typedef struct _PictFormat { |
203 | uint32_t id; |
203 | uint32_t id; |
204 | uint32_t format; /* except bpp */ |
204 | uint32_t format; /* except bpp */ |
205 | unsigned char type; |
205 | unsigned char type; |
206 | unsigned char depth; |
206 | unsigned char depth; |
207 | // DirectFormatRec direct; |
207 | // DirectFormatRec direct; |
208 | // IndexFormatRec index; |
208 | // IndexFormatRec index; |
209 | } PictFormatRec; |
209 | } PictFormatRec; |
210 | 210 | ||
211 | typedef struct _Picture { |
211 | typedef struct _Picture { |
212 | DrawablePtr pDrawable; |
212 | DrawablePtr pDrawable; |
213 | // PictFormatPtr pFormat; |
213 | // PictFormatPtr pFormat; |
214 | PictFormatShort format; /* PICT_FORMAT */ |
214 | PictFormatShort format; /* PICT_FORMAT */ |
215 | int refcnt; |
215 | int refcnt; |
216 | uint32_t id; |
216 | uint32_t id; |
217 | unsigned int repeat:1; |
217 | unsigned int repeat:1; |
218 | unsigned int graphicsExposures:1; |
218 | unsigned int graphicsExposures:1; |
219 | unsigned int subWindowMode:1; |
219 | unsigned int subWindowMode:1; |
220 | unsigned int polyEdge:1; |
220 | unsigned int polyEdge:1; |
221 | unsigned int polyMode:1; |
221 | unsigned int polyMode:1; |
222 | unsigned int freeCompClip:1; |
222 | unsigned int freeCompClip:1; |
223 | unsigned int clientClipType:2; |
223 | unsigned int clientClipType:2; |
224 | unsigned int componentAlpha:1; |
224 | unsigned int componentAlpha:1; |
225 | unsigned int repeatType:2; |
225 | unsigned int repeatType:2; |
226 | unsigned int filter:3; |
226 | unsigned int filter:3; |
227 | // unsigned int stateChanges:CPLastBit; |
227 | // unsigned int stateChanges:CPLastBit; |
228 | // unsigned int unused:18 - CPLastBit; |
228 | // unsigned int unused:18 - CPLastBit; |
229 | 229 | ||
230 | // PicturePtr alphaMap; |
230 | // PicturePtr alphaMap; |
231 | 231 | ||
232 | // PictTransform *transform; |
232 | // PictTransform *transform; |
233 | 233 | ||
234 | // SourcePictPtr pSourcePict; |
234 | // SourcePictPtr pSourcePict; |
235 | // xFixed *filter_params; |
235 | // xFixed *filter_params; |
236 | // int filter_nparams; |
236 | // int filter_nparams; |
237 | } PictureRec; |
237 | } PictureRec; |
238 | 238 | ||
239 | #define PolyModePrecise 0 |
239 | #define PolyModePrecise 0 |
240 | #define PolyModeImprecise 1 |
240 | #define PolyModeImprecise 1 |
241 | 241 | ||
242 | 242 | ||
243 | struct sna_fb |
243 | struct sna_fb |
244 | { |
244 | { |
245 | uint32_t width; |
245 | uint32_t width; |
246 | uint32_t height; |
246 | uint32_t height; |
247 | uint32_t pitch; |
247 | uint32_t pitch; |
248 | uint32_t tiling; |
248 | uint32_t tiling; |
249 | 249 | ||
250 | struct kgem_bo *fb_bo; |
250 | struct kgem_bo *fb_bo; |
251 | }; |
251 | }; |
252 | 252 | ||
253 | struct pixman_box16 |
253 | struct pixman_box16 |
254 | { |
254 | { |
255 | int16_t x1, y1, x2, y2; |
255 | int16_t x1, y1, x2, y2; |
256 | }; |
256 | }; |
257 | 257 | ||
258 | typedef struct pixman_box16 BoxRec; |
258 | typedef struct pixman_box16 BoxRec; |
259 | typedef unsigned int CARD32; |
259 | typedef unsigned int CARD32; |
260 | typedef unsigned short CARD16; |
260 | typedef unsigned short CARD16; |
261 | 261 | ||
262 | #include "sna_render.h" |
262 | #include "sna_render.h" |
263 | #include "kgem.h" |
263 | #include "kgem.h" |
264 | 264 | ||
265 | #define GXclear 0x0 |
265 | #define GXclear 0x0 |
266 | #define GXcopy 0x3 |
266 | #define GXcopy 0x3 |
267 | 267 | ||
268 | #define PictOpClear 0 |
268 | #define PictOpClear 0 |
269 | #define PictOpSrc 1 |
269 | #define PictOpSrc 1 |
270 | #define PictOpDst 2 |
270 | #define PictOpDst 2 |
271 | #define PictOpOver 3 |
271 | #define PictOpOver 3 |
272 | #define PictOpOverReverse 4 |
272 | #define PictOpOverReverse 4 |
273 | #define PictOpIn 5 |
273 | #define PictOpIn 5 |
274 | #define PictOpInReverse 6 |
274 | #define PictOpInReverse 6 |
275 | #define PictOpOut 7 |
275 | #define PictOpOut 7 |
276 | #define PictOpOutReverse 8 |
276 | #define PictOpOutReverse 8 |
277 | #define PictOpAtop 9 |
277 | #define PictOpAtop 9 |
278 | #define PictOpAtopReverse 10 |
278 | #define PictOpAtopReverse 10 |
279 | #define PictOpXor 11 |
279 | #define PictOpXor 11 |
280 | #define PictOpAdd 12 |
280 | #define PictOpAdd 12 |
281 | #define PictOpSaturate 13 |
281 | #define PictOpSaturate 13 |
282 | #define PictOpMaximum 13 |
282 | #define PictOpMaximum 13 |
283 | 283 | ||
284 | 284 | ||
285 | 285 | ||
286 | struct sna { |
286 | struct sna { |
287 | unsigned flags; |
287 | unsigned flags; |
288 | #define SNA_NO_WAIT 0x1 |
288 | #define SNA_NO_WAIT 0x1 |
289 | #define SNA_NO_FLIP 0x2 |
289 | #define SNA_NO_FLIP 0x2 |
290 | #define SNA_TRIPLE_BUFFER 0x4 |
290 | #define SNA_TRIPLE_BUFFER 0x4 |
291 | #define SNA_TEAR_FREE 0x10 |
291 | #define SNA_TEAR_FREE 0x10 |
292 | #define SNA_FORCE_SHADOW 0x20 |
292 | #define SNA_FORCE_SHADOW 0x20 |
293 | 293 | ||
294 | struct list flush_pixmaps; |
294 | struct list flush_pixmaps; |
295 | struct list active_pixmaps; |
295 | struct list active_pixmaps; |
296 | 296 | ||
297 | 297 | ||
298 | 298 | ||
299 | // int vblank_interval; |
299 | // int vblank_interval; |
300 | 300 | ||
301 | // struct list deferred_free; |
301 | // struct list deferred_free; |
302 | // struct list dirty_pixmaps; |
302 | // struct list dirty_pixmaps; |
303 | // struct list active_pixmaps; |
303 | // struct list active_pixmaps; |
304 | // struct list inactive_clock[2]; |
304 | // struct list inactive_clock[2]; |
305 | 305 | ||
306 | unsigned int tiling; |
306 | unsigned int tiling; |
307 | #define SNA_TILING_DISABLE 0x0 |
307 | #define SNA_TILING_DISABLE 0x0 |
308 | #define SNA_TILING_FB 0x1 |
308 | #define SNA_TILING_FB 0x1 |
309 | #define SNA_TILING_2D 0x2 |
309 | #define SNA_TILING_2D 0x2 |
310 | #define SNA_TILING_ALL (~0) |
310 | #define SNA_TILING_ALL (~0) |
311 | 311 | ||
312 | struct pci_device *PciInfo; |
312 | struct pci_device *PciInfo; |
313 | const struct intel_device_info *info; |
313 | const struct intel_device_info *info; |
314 | 314 | ||
315 | // PicturePtr clear; |
315 | // PicturePtr clear; |
316 | struct { |
316 | struct { |
317 | uint32_t fill_bo; |
317 | uint32_t fill_bo; |
318 | uint32_t fill_pixel; |
318 | uint32_t fill_pixel; |
319 | uint32_t fill_alu; |
319 | uint32_t fill_alu; |
320 | } blt_state; |
320 | } blt_state; |
321 | union { |
321 | union { |
322 | // struct gen2_render_state gen2; |
322 | // struct gen2_render_state gen2; |
323 | // struct gen3_render_state gen3; |
323 | struct gen3_render_state gen3; |
324 | // struct gen4_render_state gen4; |
324 | struct gen4_render_state gen4; |
325 | // struct gen5_render_state gen5; |
325 | struct gen5_render_state gen5; |
326 | struct gen6_render_state gen6; |
326 | struct gen6_render_state gen6; |
327 | struct gen7_render_state gen7; |
327 | struct gen7_render_state gen7; |
328 | } render_state; |
328 | } render_state; |
329 | 329 | ||
330 | 330 | ||
331 | /* Broken-out options. */ |
331 | /* Broken-out options. */ |
332 | // OptionInfoPtr Options; |
332 | // OptionInfoPtr Options; |
333 | 333 | ||
334 | /* Driver phase/state information */ |
334 | /* Driver phase/state information */ |
335 | // Bool suspended; |
335 | // Bool suspended; |
336 | 336 | ||
337 | struct kgem kgem; |
337 | struct kgem kgem; |
338 | struct sna_render render; |
338 | struct sna_render render; |
339 | 339 | ||
340 | #if DEBUG_MEMORY |
340 | #if DEBUG_MEMORY |
341 | struct { |
341 | struct { |
342 | int shadow_pixels_allocs; |
342 | int shadow_pixels_allocs; |
343 | int cpu_bo_allocs; |
343 | int cpu_bo_allocs; |
344 | size_t shadow_pixels_bytes; |
344 | size_t shadow_pixels_bytes; |
345 | size_t cpu_bo_bytes; |
345 | size_t cpu_bo_bytes; |
346 | } debug_memory; |
346 | } debug_memory; |
347 | #endif |
347 | #endif |
348 | }; |
348 | }; |
- | 349 | ||
- | 350 | static inline struct sna * |
|
- | 351 | to_sna_from_kgem(struct kgem *kgem) |
|
- | 352 | { |
|
- | 353 | return container_of(kgem, struct sna, kgem); |
|
349 | 354 | } |
|
350 | 355 | ||
351 | #ifndef ARRAY_SIZE |
356 | #ifndef ARRAY_SIZE |
352 | #define ARRAY_SIZE(x) (sizeof(x) / sizeof(x[0])) |
357 | #define ARRAY_SIZE(x) (sizeof(x) / sizeof(x[0])) |
353 | #endif |
358 | #endif |
354 | 359 | ||
355 | #ifndef ALIGN |
360 | #ifndef ALIGN |
356 | #define ALIGN(i,m) (((i) + (m) - 1) & ~((m) - 1)) |
361 | #define ALIGN(i,m) (((i) + (m) - 1) & ~((m) - 1)) |
357 | #endif |
362 | #endif |
358 | 363 | ||
359 | #ifndef MIN |
364 | #ifndef MIN |
360 | #define MIN(a,b) ((a) <= (b) ? (a) : (b)) |
365 | #define MIN(a,b) ((a) <= (b) ? (a) : (b)) |
361 | #endif |
366 | #endif |
362 | 367 | ||
363 | #ifndef MAX |
368 | #ifndef MAX |
364 | #define MAX(a,b) ((a) >= (b) ? (a) : (b)) |
369 | #define MAX(a,b) ((a) >= (b) ? (a) : (b)) |
365 | #endif |
370 | #endif |
366 | #endif /* _SNA_H */=>><>><>><>><>><> |
371 | #endif /* _SNA_H */=>><>><>><>><>><> |