Added support for PCIGART for PCI(E) cards. Bumped DRM interface patchlevel.
[platform/upstream/libdrm.git] / shared-core / nouveau_drm.h
1 /*
2  * Copyright 2005 Stephane Marchesin.
3  * All Rights Reserved.
4  *
5  * Permission is hereby granted, free of charge, to any person obtaining a
6  * copy of this software and associated documentation files (the "Software"),
7  * to deal in the Software without restriction, including without limitation
8  * the rights to use, copy, modify, merge, publish, distribute, sublicense,
9  * and/or sell copies of the Software, and to permit persons to whom the
10  * Software is furnished to do so, subject to the following conditions:
11  *
12  * The above copyright notice and this permission notice (including the next
13  * paragraph) shall be included in all copies or substantial portions of the
14  * Software.
15  *
16  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
19  * VA LINUX SYSTEMS AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
20  * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
21  * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
22  * OTHER DEALINGS IN THE SOFTWARE.
23  */
24
25 #ifndef __NOUVEAU_DRM_H__
26 #define __NOUVEAU_DRM_H__
27
28 #define NOUVEAU_DRM_HEADER_PATCHLEVEL 8
29
30 typedef struct drm_nouveau_fifo_alloc {
31         uint32_t     fb_ctxdma_handle;
32         uint32_t     tt_ctxdma_handle;
33
34         int          channel;
35         uint32_t     put_base;
36         /* FIFO control regs */
37         drm_handle_t ctrl;
38         int          ctrl_size;
39         /* DMA command buffer */
40         drm_handle_t cmdbuf;
41         int          cmdbuf_size;
42         /* Notifier memory */
43         drm_handle_t notifier;
44         int          notifier_size;
45 }
46 drm_nouveau_fifo_alloc_t;
47
48 typedef struct drm_nouveau_grobj_alloc {
49         int      channel;
50         uint32_t handle;
51         int      class;
52 }
53 drm_nouveau_grobj_alloc_t;
54
55 #define NOUVEAU_MEM_ACCESS_RO   1
56 #define NOUVEAU_MEM_ACCESS_WO   2
57 #define NOUVEAU_MEM_ACCESS_RW   3
58 typedef struct drm_nouveau_notifier_alloc {
59         int      channel;
60         uint32_t handle;
61         int      count;
62
63         uint32_t offset;
64 }
65 drm_nouveau_notifier_alloc_t;
66
67 #define NOUVEAU_MEM_FB                  0x00000001
68 #define NOUVEAU_MEM_AGP                 0x00000002
69 #define NOUVEAU_MEM_FB_ACCEPTABLE       0x00000004
70 #define NOUVEAU_MEM_AGP_ACCEPTABLE      0x00000008
71 #define NOUVEAU_MEM_PCI                 0x00000010
72 #define NOUVEAU_MEM_PCI_ACCEPTABLE      0x00000020
73 #define NOUVEAU_MEM_PINNED              0x00000040
74 #define NOUVEAU_MEM_USER_BACKED         0x00000080
75 #define NOUVEAU_MEM_MAPPED              0x00000100
76 #define NOUVEAU_MEM_INSTANCE            0x00000200 /* internal */
77 #define NOUVEAU_MEM_NOTIFIER            0x00000400 /* internal */
78
79 typedef struct drm_nouveau_mem_alloc {
80         int flags;
81         int alignment;
82         uint64_t size;  // in bytes
83         uint64_t region_offset;
84 }
85 drm_nouveau_mem_alloc_t;
86
87 typedef struct drm_nouveau_mem_free {
88         uint64_t region_offset;
89         int flags;
90 }
91 drm_nouveau_mem_free_t;
92
93 /* FIXME : maybe unify {GET,SET}PARAMs */
94 #define NOUVEAU_GETPARAM_PCI_VENDOR      3
95 #define NOUVEAU_GETPARAM_PCI_DEVICE      4
96 #define NOUVEAU_GETPARAM_BUS_TYPE        5
97 #define NOUVEAU_GETPARAM_FB_PHYSICAL     6
98 #define NOUVEAU_GETPARAM_AGP_PHYSICAL    7
99 #define NOUVEAU_GETPARAM_FB_SIZE         8
100 #define NOUVEAU_GETPARAM_AGP_SIZE        9
101 #define NOUVEAU_GETPARAM_PCI_PHYSICAL    10
102 typedef struct drm_nouveau_getparam {
103         uint64_t param;
104         uint64_t value;
105 }
106 drm_nouveau_getparam_t;
107
108 #define NOUVEAU_SETPARAM_CMDBUF_LOCATION 1
109 #define NOUVEAU_SETPARAM_CMDBUF_SIZE     2
110 typedef struct drm_nouveau_setparam {
111         uint64_t param;
112         uint64_t value;
113 }
114 drm_nouveau_setparam_t;
115
116 enum nouveau_card_type {
117         NV_UNKNOWN =0,
118         NV_01      =1,
119         NV_03      =3,
120         NV_04      =4,
121         NV_05      =5,
122         NV_10      =10,
123         NV_11      =10,
124         NV_15      =10,
125         NV_17      =17,
126         NV_20      =20,
127         NV_25      =20,
128         NV_30      =30,
129         NV_34      =30,
130         NV_40      =40,
131         NV_44      =44,
132         NV_50      =50,
133         NV_LAST    =0xffff,
134 };
135
136 enum nouveau_bus_type {
137         NV_AGP     =0,
138         NV_PCI     =1,
139         NV_PCIE    =2,
140 };
141
142 #define NOUVEAU_MAX_SAREA_CLIPRECTS 16
143
144 typedef struct drm_nouveau_sarea {
145         /* the cliprects */
146         drm_clip_rect_t boxes[NOUVEAU_MAX_SAREA_CLIPRECTS];
147         unsigned int nbox;
148 }
149 drm_nouveau_sarea_t;
150
151 #define DRM_NOUVEAU_FIFO_ALLOC      0x00
152 #define DRM_NOUVEAU_GROBJ_ALLOC     0x01
153 #define DRM_NOUVEAU_NOTIFIER_ALLOC  0x02
154 #define DRM_NOUVEAU_MEM_ALLOC       0x03
155 #define DRM_NOUVEAU_MEM_FREE        0x04
156 #define DRM_NOUVEAU_GETPARAM        0x05
157 #define DRM_NOUVEAU_SETPARAM        0x06
158
159 #endif /* __NOUVEAU_DRM_H__ */
160