Switch to *_RING instead of NVDma*
[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 enum DMAObjects {
48         NvNullObject            = 0x00000000,
49         NvContextSurfaces       = 0x80000010, 
50         NvRop                   = 0x80000011, 
51         NvImagePattern          = 0x80000012, 
52         NvClipRectangle         = 0x80000013, 
53         NvSolidLine             = 0x80000014, 
54         NvImageBlit             = 0x80000015, 
55         NvRectangle             = 0x80000016, 
56         NvScaledImage           = 0x80000017, 
57         NvMemFormat             = 0x80000018,
58         Nv3D                    = 0x80000019,
59         NvImageFromCpu          = 0x8000001A,
60         NvContextBeta1          = 0x8000001B,
61         NvContextBeta4          = 0x8000001C,
62         Nv2D                    = 0x80000020,
63         NvDmaFB                 = 0xD8000001,
64         NvDmaTT                 = 0xD8000002,
65         NvDmaNotifier0          = 0xD8000003,
66
67         /*XVideo notifiers need to have consecutive handles, be careful when remapping*/
68         NvDmaXvNotifier0        = 0xE8000000,
69         NvDmaXvNotifier1        = 0xE8000001,
70         NvDmaXvNotifier2        = 0xE8000002,
71         NvDmaXvNotifier3        = 0xE8000003,
72         NvDmaXvNotifier4        = 0xE8000004,
73         NvDmaXvNotifier5        = 0xE8000005,
74 };
75
76 extern void NVDmaStartNNN(NVPtr pNv, uint32_t object, uint32_t tag, int size);
77
78 #define BEGIN_RING(obj,mthd,size) do {                                         \
79         NVDmaStartNNN(pNv, (obj), (mthd), (size));                             \
80 } while(0)
81
82 #define OUT_RING(data) do {                                                    \
83         NVDEBUG("\tOUT_RING  : @0x%08x  0x%08x\n",                             \
84                 (unsigned)(pNv->dmaCurrent), (unsigned)(data));                \
85         pNv->dmaBase[pNv->dmaCurrent++] = (data);                              \
86 } while(0)
87
88 #define OUT_RINGf(data) do {                                                   \
89         union { float v; uint32_t u; } c;                                      \
90         c.v = (data);                                                          \
91         OUT_RING(c.u);                                                         \
92 } while(0)
93
94 #define WAIT_RING(size) do {                                                   \
95         NVDmaWaitNNN(pScrn, (size));                                           \
96 } while(0)
97
98 #define FIRE_RING() do {                                                       \
99         NVDmaKickoffNNN(pNv);                                                  \
100 } while(0)
101
102 #endif /* NV_DMA_H */