Commit | Line | Data |
---|---|---|
94580299 BS |
1 | #ifndef __NOUVEAU_DRMCLI_H__ |
2 | #define __NOUVEAU_DRMCLI_H__ | |
3 | ||
77145f1c BS |
4 | #define DRIVER_AUTHOR "Nouveau Project" |
5 | #define DRIVER_EMAIL "nouveau@lists.freedesktop.org" | |
6 | ||
7 | #define DRIVER_NAME "nouveau" | |
8 | #define DRIVER_DESC "nVidia Riva/TNT/GeForce/Quadro/Tesla" | |
9 | #define DRIVER_DATE "20120801" | |
10 | ||
11 | #define DRIVER_MAJOR 1 | |
12 | #define DRIVER_MINOR 1 | |
7820e5ee | 13 | #define DRIVER_PATCHLEVEL 2 |
142c21b8 CB |
14 | |
15 | /* | |
16 | * 1.1.1: | |
17 | * - added support for tiled system memory buffer objects | |
18 | * - added support for NOUVEAU_GETPARAM_GRAPH_UNITS on [nvc0,nve0]. | |
19 | * - added support for compressed memory storage types on [nvc0,nve0]. | |
20 | * - added support for software methods 0x600,0x644,0x6ac on nvc0 | |
21 | * to control registers on the MPs to enable performance counters, | |
22 | * and to control the warp error enable mask (OpenGL requires out of | |
23 | * bounds access to local memory to be silently ignored / return 0). | |
7820e5ee MK |
24 | * 1.1.2: |
25 | * - fixes multiple bugs in flip completion events and timestamping | |
142c21b8 | 26 | */ |
77145f1c | 27 | |
94580299 | 28 | #include <core/client.h> |
1d7c71a3 | 29 | #include <core/event.h> |
94580299 | 30 | |
0ad72863 BS |
31 | #include <nvif/client.h> |
32 | #include <nvif/device.h> | |
33 | ||
ebb945a9 BS |
34 | #include <subdev/vm.h> |
35 | ||
94580299 BS |
36 | #include <drmP.h> |
37 | #include <drm/nouveau_drm.h> | |
38 | ||
612a9aab LT |
39 | #include <drm/ttm/ttm_bo_api.h> |
40 | #include <drm/ttm/ttm_bo_driver.h> | |
41 | #include <drm/ttm/ttm_placement.h> | |
42 | #include <drm/ttm/ttm_memory.h> | |
43 | #include <drm/ttm/ttm_module.h> | |
44 | #include <drm/ttm/ttm_page_alloc.h> | |
ebb945a9 BS |
45 | |
46 | struct nouveau_channel; | |
8ba9ff11 | 47 | struct platform_device; |
ebb945a9 BS |
48 | |
49 | #define DRM_FILE_PAGE_OFFSET (0x100000000ULL >> PAGE_SHIFT) | |
50 | ||
ebb945a9 | 51 | #include "nouveau_fence.h" |
77145f1c | 52 | #include "nouveau_bios.h" |
ebb945a9 BS |
53 | |
54 | struct nouveau_drm_tile { | |
55 | struct nouveau_fence *fence; | |
56 | bool used; | |
57 | }; | |
58 | ||
0ad72863 BS |
59 | enum nouveau_drm_object_route { |
60 | NVDRM_OBJECT_NVIF = 0, | |
61 | NVDRM_OBJECT_USIF, | |
62 | NVDRM_OBJECT_ABI16, | |
63 | }; | |
64 | ||
65 | enum nouveau_drm_notify_route { | |
66 | NVDRM_NOTIFY_NVIF = 0, | |
67 | NVDRM_NOTIFY_USIF | |
68 | }; | |
69 | ||
94580299 | 70 | enum nouveau_drm_handle { |
26fdd78c BS |
71 | NVDRM_CLIENT = 0xffffffff, |
72 | NVDRM_DEVICE = 0xdddddddd, | |
73 | NVDRM_CONTROL = 0xdddddddc, | |
2332b311 | 74 | NVDRM_DISPLAY = 0xd1500000, |
26fdd78c BS |
75 | NVDRM_PUSH = 0xbbbb0000, /* |= client chid */ |
76 | NVDRM_CHAN = 0xcccc0000, /* |= client chid */ | |
69a6146d | 77 | NVDRM_NVSW = 0x55550000, |
94580299 BS |
78 | }; |
79 | ||
80 | struct nouveau_cli { | |
0ad72863 | 81 | struct nvif_client base; |
3ee6f5b5 | 82 | struct nouveau_vm *vm; /*XXX*/ |
94580299 BS |
83 | struct list_head head; |
84 | struct mutex mutex; | |
ebb945a9 | 85 | void *abi16; |
94580299 BS |
86 | }; |
87 | ||
ebb945a9 BS |
88 | static inline struct nouveau_cli * |
89 | nouveau_cli(struct drm_file *fpriv) | |
90 | { | |
91 | return fpriv ? fpriv->driver_priv : NULL; | |
92 | } | |
93 | ||
967e7bde | 94 | #include <nvif/object.h> |
967e7bde | 95 | #include <nvif/device.h> |
db2bec18 | 96 | |
5addcf0a DA |
97 | extern int nouveau_runtime_pm; |
98 | ||
94580299 BS |
99 | struct nouveau_drm { |
100 | struct nouveau_cli client; | |
101 | struct drm_device *dev; | |
102 | ||
967e7bde | 103 | struct nvif_device device; |
94580299 | 104 | struct list_head clients; |
cb75d97e BS |
105 | |
106 | struct { | |
107 | enum { | |
108 | UNKNOWN = 0, | |
109 | DISABLE = 1, | |
110 | ENABLED = 2 | |
111 | } stat; | |
112 | u32 base; | |
113 | u32 size; | |
114 | } agp; | |
ebb945a9 BS |
115 | |
116 | /* TTM interface support */ | |
117 | struct { | |
118 | struct drm_global_reference mem_global_ref; | |
119 | struct ttm_bo_global_ref bo_global_ref; | |
120 | struct ttm_bo_device bdev; | |
121 | atomic_t validate_sequence; | |
122 | int (*move)(struct nouveau_channel *, | |
123 | struct ttm_buffer_object *, | |
124 | struct ttm_mem_reg *, struct ttm_mem_reg *); | |
1bb3f6a2 | 125 | struct nouveau_channel *chan; |
0ad72863 | 126 | struct nvif_object copy; |
ebb945a9 BS |
127 | int mtrr; |
128 | } ttm; | |
129 | ||
130 | /* GEM interface support */ | |
131 | struct { | |
132 | u64 vram_available; | |
133 | u64 gart_available; | |
134 | } gem; | |
135 | ||
136 | /* synchronisation */ | |
137 | void *fence; | |
138 | ||
139 | /* context for accelerated drm-internal operations */ | |
49981046 | 140 | struct nouveau_channel *cechan; |
ebb945a9 BS |
141 | struct nouveau_channel *channel; |
142 | struct nouveau_gpuobj *notify; | |
143 | struct nouveau_fbdev *fbcon; | |
0ad72863 BS |
144 | struct nvif_object nvsw; |
145 | struct nvif_object ntfy; | |
ebb945a9 BS |
146 | |
147 | /* nv10-nv40 tiling regions */ | |
148 | struct { | |
149 | struct nouveau_drm_tile reg[15]; | |
150 | spinlock_t lock; | |
151 | } tile; | |
51a3d342 | 152 | |
77145f1c BS |
153 | /* modesetting */ |
154 | struct nvbios vbios; | |
155 | struct nouveau_display *display; | |
51a3d342 | 156 | struct backlight_device *backlight; |
77145f1c BS |
157 | |
158 | /* power management */ | |
b9ed919f | 159 | struct nouveau_hwmon *hwmon; |
26fdd78c | 160 | struct nouveau_sysfs *sysfs; |
5addcf0a DA |
161 | |
162 | /* display power reference */ | |
163 | bool have_disp_power_ref; | |
164 | ||
165 | struct dev_pm_domain vga_pm_domain; | |
166 | struct pci_dev *hdmi_device; | |
94580299 BS |
167 | }; |
168 | ||
ebb945a9 BS |
169 | static inline struct nouveau_drm * |
170 | nouveau_drm(struct drm_device *dev) | |
171 | { | |
77145f1c BS |
172 | return dev->dev_private; |
173 | } | |
174 | ||
2d8b9ccb DA |
175 | int nouveau_pmops_suspend(struct device *); |
176 | int nouveau_pmops_resume(struct device *); | |
94580299 | 177 | |
8ba9ff11 AC |
178 | #define nouveau_platform_device_create(p, u) \ |
179 | nouveau_platform_device_create_(p, sizeof(**u), (void **)u) | |
180 | struct drm_device * | |
181 | nouveau_platform_device_create_(struct platform_device *pdev, | |
182 | int size, void **pobject); | |
183 | void nouveau_drm_device_remove(struct drm_device *dev); | |
184 | ||
fa2bade9 BS |
185 | #define NV_PRINTK(l,c,f,a...) do { \ |
186 | struct nouveau_cli *_cli = (c); \ | |
0ad72863 | 187 | nv_##l(_cli->base.base.priv, f, ##a); \ |
fa2bade9 BS |
188 | } while(0) |
189 | #define NV_FATAL(drm,f,a...) NV_PRINTK(fatal, &(drm)->client, f, ##a) | |
190 | #define NV_ERROR(drm,f,a...) NV_PRINTK(error, &(drm)->client, f, ##a) | |
191 | #define NV_WARN(drm,f,a...) NV_PRINTK(warn, &(drm)->client, f, ##a) | |
192 | #define NV_INFO(drm,f,a...) NV_PRINTK(info, &(drm)->client, f, ##a) | |
193 | #define NV_DEBUG(drm,f,a...) NV_PRINTK(debug, &(drm)->client, f, ##a) | |
94580299 | 194 | |
9430738d BS |
195 | extern int nouveau_modeset; |
196 | ||
94580299 | 197 | #endif |