Comment out NVDmaKickoff() in NVResetGraphics(). NVResetGraphics is called twice...
[nouveau] / src / nv_dma.h
1
2  /***************************************************************************\
3 |*                                                                           *|
4 |*       Copyright 2003 NVIDIA, Corporation.  All rights reserved.           *|
5 |*                                                                           *|
6 |*     NOTICE TO USER:   The source code  is copyrighted under  U.S. and     *|
7 |*     international laws.  Users and possessors of this source code are     *|
8 |*     hereby granted a nonexclusive,  royalty-free copyright license to     *|
9 |*     use this code in individual and commercial software.                  *|
10 |*                                                                           *|
11 |*     Any use of this source code must include,  in the user documenta-     *|
12 |*     tion and  internal comments to the code,  notices to the end user     *|
13 |*     as follows:                                                           *|
14 |*                                                                           *|
15 |*       Copyright 2003 NVIDIA, Corporation.  All rights reserved.           *|
16 |*                                                                           *|
17 |*     NVIDIA, CORPORATION MAKES NO REPRESENTATION ABOUT THE SUITABILITY     *|
18 |*     OF  THIS SOURCE  CODE  FOR ANY PURPOSE.  IT IS  PROVIDED  "AS IS"     *|
19 |*     WITHOUT EXPRESS OR IMPLIED WARRANTY OF ANY KIND.  NVIDIA, CORPOR-     *|
20 |*     ATION DISCLAIMS ALL WARRANTIES  WITH REGARD  TO THIS SOURCE CODE,     *|
21 |*     INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGE-     *|
22 |*     MENT,  AND FITNESS  FOR A PARTICULAR PURPOSE.   IN NO EVENT SHALL     *|
23 |*     NVIDIA, CORPORATION  BE LIABLE FOR ANY SPECIAL,  INDIRECT,  INCI-     *|
24 |*     DENTAL, OR CONSEQUENTIAL DAMAGES,  OR ANY DAMAGES  WHATSOEVER RE-     *|
25 |*     SULTING FROM LOSS OF USE,  DATA OR PROFITS,  WHETHER IN AN ACTION     *|
26 |*     OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,  ARISING OUT OF     *|
27 |*     OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOURCE CODE.     *|
28 |*                                                                           *|
29 |*     U.S. Government  End  Users.   This source code  is a "commercial     *|
30 |*     item,"  as that  term is  defined at  48 C.F.R. 2.101 (OCT 1995),     *|
31 |*     consisting  of "commercial  computer  software"  and  "commercial     *|
32 |*     computer  software  documentation,"  as such  terms  are  used in     *|
33 |*     48 C.F.R. 12.212 (SEPT 1995)  and is provided to the U.S. Govern-     *|
34 |*     ment only as  a commercial end item.   Consistent with  48 C.F.R.     *|
35 |*     12.212 and  48 C.F.R. 227.7202-1 through  227.7202-4 (JUNE 1995),     *|
36 |*     all U.S. Government End Users  acquire the source code  with only     *|
37 |*     those rights set forth herein.                                        *|
38 |*                                                                           *|
39  \***************************************************************************/
40
41 /* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/nv/nv_dma.h,v 1.4 2004/03/20 01:52:16 mvojkovi Exp $ */
42 #ifndef NV_DMA_H
43 #define NV_DMA_H
44
45 #define NVDEBUG if (NV_DMA_DEBUG) ErrorF
46
47 #define NV_DMA_ACCES_RW 0
48 #define NV_DMA_ACCES_RO 1
49 #define NV_DMA_ACCES_WO 2
50 #define NV_DMA_TARGET_VIDMEM 0
51 /*
52 #define NV_DMA_TARGET_VIDMEM_TILED 1
53 #define NV_DMA_TARGET_PCI 2
54 */
55 #define NV_DMA_TARGET_AGP 3
56 void NVDmaCreateDMAObject(NVPtr pNv, int handle, int target, CARD32 base_address, CARD32 size, int access);
57
58 Bool NVDmaWaitForNotifier(NVPtr pNv, void *notifier);
59 void *NVDmaCreateNotifier(NVPtr pNv, int handle);
60     
61 #define NV_DMA_CONTEXT_FLAGS_PATCH_ROP_AND 0x1
62 #define NV_DMA_CONTEXT_FLAGS_PATCH_SRCCOPY 0x2
63 #define NV_DMA_CONTEXT_FLAGS_CLIP_ENABLE 0x4
64 #define NV_DMA_CONTEXT_FLAGS_MONO 0x8
65 void NVDmaCreateContextObject(NVPtr pNv, int handle, int class, CARD32 flags,
66                               CARD32 dma_in, CARD32 dma_out, CARD32 dma_notifier);
67 Bool NVInitDma(ScrnInfoPtr pScrn);
68
69
70 enum DMAObjects {
71         NvContextSurfaces = 0x80000010, 
72         NvRop = 0x80000011, 
73         NvImagePattern = 0x80000012, 
74         NvClipRectangle = 0x80000013, 
75         NvSolidLine = 0x80000014, 
76         NvImageBlit = 0x80000015, 
77         NvRectangle = 0x80000016, 
78         NvScaledImage = 0x80000017, 
79         NvGraphicsToAGP = 0x80000018, 
80         NvAGPToGraphics = 0x80000019,
81         NvDmaFB = 0xD8000001,
82         NvDmaAGP = 0xD8000002,
83         NvDmaNotifier0 = 0xD8000003
84 };
85 enum DMASubchannel {
86         NvSubContextSurfaces = 0, 
87         NvSubRop = 1, 
88         NvSubImagePattern = 2, 
89         NvSubClipRectangle = 3, 
90         NvSubSolidLine = 4, 
91         NvSubImageBlit = 5, 
92         NvSubRectangle = 6, 
93         NvSubScaledImage = 7, 
94         NvSubGraphicsToAGP = 7
95 };
96
97 #define NVDmaNext(pNv, data) {                           \
98      (pNv)->dmaBase[(pNv)->dmaCurrent++] = (data);       \
99      NVDEBUG("\tNVDmaNext: 0x%08x\n", (data));           \
100 }
101
102 #define NVDmaStart(pNv, subchannel, tag, size) {                        \
103         if((pNv)->dmaFree <= (size))                                    \
104             NVDmaWait(pNv, size);                                       \
105         NVDEBUG("NVDmaStart: subc=%d, cmd=%x, num=%d\n", (subchannel), (tag), (size)); \
106         NVDmaNext(pNv, ((size) << 18) | ((subchannel) << 13) | (tag));  \
107         (pNv)->dmaFree -= ((size) + 1);                                 \
108     }
109
110 #define NVDmaSetObjectOnSubchannel(pNv, subchannel, object) \
111     NVDmaStart(pNv, subchannel, 0, 1);                      \
112     NVDmaNext(pNv,object);
113
114 #define SURFACE_FORMAT                                              0x00000300
115 #define SURFACE_FORMAT_Y8                                           0x00000001
116 #define SURFACE_FORMAT_X1R5G5B5                                     0x00000002
117 #define SURFACE_FORMAT_R5G6B5                                       0x00000004
118 #define SURFACE_FORMAT_X8R8G8B8                                     0x00000006
119 #define SURFACE_FORMAT_A8R8G8B8                                     0x0000000a
120 #define SURFACE_PITCH                                               0x00000304
121 #define SURFACE_PITCH_SRC                                           15:0
122 #define SURFACE_PITCH_DST                                           31:16
123 #define SURFACE_OFFSET_SRC                                          0x00000308
124 #define SURFACE_OFFSET_DST                                          0x0000030C
125
126 #define ROP_SET                                                     0x00000300
127
128 #define PATTERN_FORMAT                                              0x00000300
129 #define PATTERN_FORMAT_DEPTH8                                       0x00000003
130 #define PATTERN_FORMAT_DEPTH16                                      0x00000001
131 #define PATTERN_FORMAT_DEPTH24                                      0x00000003
132 #define PATTERN_COLOR_0                                             0x00000310
133 #define PATTERN_COLOR_1                                             0x00000314
134 #define PATTERN_PATTERN_0                                           0x00000318
135 #define PATTERN_PATTERN_1                                           0x0000031C
136
137 #define CLIP_POINT                                                  0x00000300
138 #define CLIP_POINT_X                                                15:0
139 #define CLIP_POINT_Y                                                31:16
140 #define CLIP_SIZE                                                   0x00000304
141 #define CLIP_SIZE_WIDTH                                             15:0
142 #define CLIP_SIZE_HEIGHT                                            31:16
143
144 #define LINE_FORMAT                                                 0x00000300
145 #define LINE_FORMAT_DEPTH8                                          0x00000003
146 #define LINE_FORMAT_DEPTH16                                         0x00000001
147 #define LINE_FORMAT_DEPTH24                                         0x00000003
148 #define LINE_COLOR                                                  0x00000304
149 #define LINE_MAX_LINES                                              16
150 #define LINE_LINES(i)                                               0x00000400\
151                                                                     +(i)*8
152 #define LINE_LINES_POINT0_X                                         15:0
153 #define LINE_LINES_POINT0_Y                                         31:16 
154 #define LINE_LINES_POINT1_X                                         47:32
155 #define LINE_LINES_POINT1_Y                                         63:48
156
157 #define BLIT_POINT_SRC                                              0x00000300
158 #define BLIT_POINT_SRC_X                                            15:0
159 #define BLIT_POINT_SRC_Y                                            31:16
160 #define BLIT_POINT_DST                                              0x00000304
161 #define BLIT_POINT_DST_X                                            15:0
162 #define BLIT_POINT_DST_Y                                            31:16
163 #define BLIT_SIZE                                                   0x00000308
164 #define BLIT_SIZE_WIDTH                                             15:0
165 #define BLIT_SIZE_HEIGHT                                            31:16
166
167 #define RECT_FORMAT                                                 0x00000300
168 #define RECT_FORMAT_DEPTH8                                          0x00000003
169 #define RECT_FORMAT_DEPTH16                                         0x00000001
170 #define RECT_FORMAT_DEPTH24                                         0x00000003
171 #define RECT_SOLID_COLOR                                            0x000003FC
172 #define RECT_SOLID_RECTS_MAX_RECTS                                  32
173 #define RECT_SOLID_RECTS(i)                                         0x00000400\
174                                                                     +(i)*8
175 #define RECT_SOLID_RECTS_Y                                          15:0
176 #define RECT_SOLID_RECTS_X                                          31:16
177 #define RECT_SOLID_RECTS_HEIGHT                                     47:32
178 #define RECT_SOLID_RECTS_WIDTH                                      63:48
179
180 #define RECT_EXPAND_ONE_COLOR_CLIP                                  0x000007EC
181 #define RECT_EXPAND_ONE_COLOR_CLIP_POINT0_X                         15:0
182 #define RECT_EXPAND_ONE_COLOR_CLIP_POINT0_Y                         31:16
183 #define RECT_EXPAND_ONE_COLOR_CLIP_POINT1_X                         47:32
184 #define RECT_EXPAND_ONE_COLOR_CLIP_POINT1_Y                         63:48
185 #define RECT_EXPAND_ONE_COLOR_COLOR                                 0x000007F4
186 #define RECT_EXPAND_ONE_COLOR_SIZE                                  0x000007F8
187 #define RECT_EXPAND_ONE_COLOR_SIZE_WIDTH                            15:0
188 #define RECT_EXPAND_ONE_COLOR_SIZE_HEIGHT                           31:16
189 #define RECT_EXPAND_ONE_COLOR_POINT                                 0x000007FC
190 #define RECT_EXPAND_ONE_COLOR_POINT_X                               15:0
191 #define RECT_EXPAND_ONE_COLOR_POINT_Y                               31:16
192 #define RECT_EXPAND_ONE_COLOR_DATA_MAX_DWORDS                       128
193 #define RECT_EXPAND_ONE_COLOR_DATA(i)                               0x00000800\
194                                                                     +(i)*4
195
196 #define RECT_EXPAND_TWO_COLOR_CLIP                                  0x00000BE4
197 #define RECT_EXPAND_TWO_COLOR_CLIP_POINT0_X                         15:0
198 #define RECT_EXPAND_TWO_COLOR_CLIP_POINT0_Y                         31:16
199 #define RECT_EXPAND_TWO_COLOR_CLIP_POINT1_X                         47:32
200 #define RECT_EXPAND_TWO_COLOR_CLIP_POINT1_Y                         63:48
201 #define RECT_EXPAND_TWO_COLOR_COLOR_0                               0x00000BEC
202 #define RECT_EXPAND_TWO_COLOR_COLOR_1                               0x00000BF0
203 #define RECT_EXPAND_TWO_COLOR_SIZE_IN                               0x00000BF4
204 #define RECT_EXPAND_TWO_COLOR_SIZE_IN_WIDTH                         15:0
205 #define RECT_EXPAND_TWO_COLOR_SIZE_IN_HEIGHT                        31:16
206 #define RECT_EXPAND_TWO_COLOR_SIZE_OUT                              0x00000BF8
207 #define RECT_EXPAND_TWO_COLOR_SIZE_OUT_WIDTH                        15:0
208 #define RECT_EXPAND_TWO_COLOR_SIZE_OUT_HEIGHT                       31:16
209 #define RECT_EXPAND_TWO_COLOR_POINT                                 0x00000BFC
210 #define RECT_EXPAND_TWO_COLOR_POINT_X                               15:0
211 #define RECT_EXPAND_TWO_COLOR_POINT_Y                               31:16
212 #define RECT_EXPAND_TWO_COLOR_DATA_MAX_DWORDS                       128
213 #define RECT_EXPAND_TWO_COLOR_DATA(i)                               0x00000C00\
214                                                                     +(i)*4
215
216 #define STRETCH_BLIT_FORMAT                                         0x00000300
217 #define STRETCH_BLIT_FORMAT_DEPTH8                                  0x00000004
218 #define STRETCH_BLIT_FORMAT_DEPTH16                                 0x00000007
219 #define STRETCH_BLIT_FORMAT_DEPTH24                                 0x00000004
220 #define STRETCH_BLIT_FORMAT_A8R8G8B8                                0x00000003
221 #define STRETCH_BLIT_FORMAT_X8R8G8B8                                0x00000004
222 #define STRETCH_BLIT_FORMAT_YUYV                                    0x00000005
223 #define STRETCH_BLIT_FORMAT_UYVY                                    0x00000006
224 #define STRETCH_BLIT_OPERATION                                      0x00000304
225 #define STRETCH_BLIT_OPERATION_ROP                                  0x00000001
226 #define STRETCH_BLIT_OPERATION_COPY                                 0x00000003
227 #define STRETCH_BLIT_OPERATION_BLEND                                0x00000002
228 #define STRETCH_BLIT_CLIP_POINT                                     0x00000308
229 #define STRETCH_BLIT_CLIP_POINT_X                                   15:0 
230 #define STRETCH_BLIT_CLIP_POINT_Y                                   31:16
231 #define STRETCH_BLIT_CLIP_POINT                                     0x00000308
232 #define STRETCH_BLIT_CLIP_SIZE                                      0x0000030C
233 #define STRETCH_BLIT_CLIP_SIZE_WIDTH                                15:0
234 #define STRETCH_BLIT_CLIP_SIZE_HEIGHT                               31:16
235 #define STRETCH_BLIT_DST_POINT                                      0x00000310
236 #define STRETCH_BLIT_DST_POINT_X                                    15:0
237 #define STRETCH_BLIT_DST_POINT_Y                                    31:16
238 #define STRETCH_BLIT_DST_SIZE                                       0x00000314
239 #define STRETCH_BLIT_DST_SIZE_WIDTH                                 15:0
240 #define STRETCH_BLIT_DST_SIZE_HEIGHT                                31:16
241 #define STRETCH_BLIT_DU_DX                                          0x00000318
242 #define STRETCH_BLIT_DV_DY                                          0x0000031C
243 #define STRETCH_BLIT_SRC_SIZE                                       0x00000400
244 #define STRETCH_BLIT_SRC_SIZE_WIDTH                                 15:0
245 #define STRETCH_BLIT_SRC_SIZE_HEIGHT                                31:16
246 #define STRETCH_BLIT_SRC_FORMAT                                     0x00000404
247 #define STRETCH_BLIT_SRC_FORMAT_PITCH                               15:0
248 #define STRETCH_BLIT_SRC_FORMAT_ORIGIN                              23:16
249 #define STRETCH_BLIT_SRC_FORMAT_ORIGIN_CENTER                       0x00000001
250 #define STRETCH_BLIT_SRC_FORMAT_ORIGIN_CORNER                       0x00000002
251 #define STRETCH_BLIT_SRC_FORMAT_FILTER                              31:24
252 #define STRETCH_BLIT_SRC_FORMAT_FILTER_POINT_SAMPLE                 0x00000000
253 #define STRETCH_BLIT_SRC_FORMAT_FILTER_BILINEAR                     0x00000001
254 #define STRETCH_BLIT_SRC_OFFSET                                     0x00000408
255 #define STRETCH_BLIT_SRC_POINT                                      0x0000040C
256 #define STRETCH_BLIT_SRC_POINT_U                                    15:0
257 #define STRETCH_BLIT_SRC_POINT_V                                    31:16
258
259
260 #define MEMFORMAT_NOTIFY                                0x00000104
261 #define MEMFORMAT_DMA_NOTIFY                            0x00000180
262 #define MEMFORMAT_OFFSET_IN                             0x0000030C
263 #define MEMFORMAT_OFFSET_OUT                            0x00000310
264 #define MEMFORMAT_PITCH_IN                              0x00000314
265 #define MEMFORMAT_PITCH_OUT                             0x00000318
266 #define MEMFORMAT_LINE_LENGTH_IN                        0x0000031C
267 #define MEMFORMAT_LINE_COUNT                            0x00000320
268
269
270 #endif /* NV_DMA_H */