1 #ifndef __NOUVEAU_DRMCLI_H__
2 #define __NOUVEAU_DRMCLI_H__
4 #define DRIVER_AUTHOR "Nouveau Project"
5 #define DRIVER_EMAIL "nouveau@lists.freedesktop.org"
7 #define DRIVER_NAME "nouveau"
8 #define DRIVER_DESC "nVidia Riva/TNT/GeForce/Quadro/Tesla"
9 #define DRIVER_DATE "20120801"
11 #define DRIVER_MAJOR 1
12 #define DRIVER_MINOR 2
13 #define DRIVER_PATCHLEVEL 0
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).
25 * - fixes multiple bugs in flip completion events and timestamping
27 * - object api exposed to userspace
28 * - fermi,kepler,maxwell zbc
31 #include <nvif/client.h>
32 #include <nvif/device.h>
36 #include <drm/ttm/ttm_bo_api.h>
37 #include <drm/ttm/ttm_bo_driver.h>
38 #include <drm/ttm/ttm_placement.h>
39 #include <drm/ttm/ttm_memory.h>
40 #include <drm/ttm/ttm_module.h>
41 #include <drm/ttm/ttm_page_alloc.h>
43 #include "uapi/drm/nouveau_drm.h"
45 struct nouveau_channel;
46 struct platform_device;
48 #define DRM_FILE_PAGE_OFFSET (0x100000000ULL >> PAGE_SHIFT)
50 #include "nouveau_fence.h"
51 #include "nouveau_bios.h"
53 struct nouveau_drm_tile {
54 struct nouveau_fence *fence;
58 enum nouveau_drm_object_route {
59 NVDRM_OBJECT_NVIF = 0,
64 enum nouveau_drm_notify_route {
65 NVDRM_NOTIFY_NVIF = 0,
69 enum nouveau_drm_handle {
70 NVDRM_CLIENT = 0xffffffff,
71 NVDRM_DEVICE = 0xdddddddd,
72 NVDRM_CONTROL = 0xdddddddc,
73 NVDRM_DISPLAY = 0xd1500000,
74 NVDRM_PUSH = 0xbbbb0000, /* |= client chid */
75 NVDRM_CHAN = 0xcccc0000, /* |= client chid */
76 NVDRM_NVSW = 0x55550000,
80 struct nvif_client base;
81 struct nouveau_vm *vm; /*XXX*/
82 struct list_head head;
85 struct list_head objects;
86 struct list_head notifys;
89 static inline struct nouveau_cli *
90 nouveau_cli(struct drm_file *fpriv)
92 return fpriv ? fpriv->driver_priv : NULL;
95 #include <nvif/object.h>
96 #include <nvif/device.h>
98 extern int nouveau_runtime_pm;
101 struct nouveau_cli client;
102 struct drm_device *dev;
104 struct nvif_device device;
105 struct list_head clients;
117 /* TTM interface support */
119 struct drm_global_reference mem_global_ref;
120 struct ttm_bo_global_ref bo_global_ref;
121 struct ttm_bo_device bdev;
122 atomic_t validate_sequence;
123 int (*move)(struct nouveau_channel *,
124 struct ttm_buffer_object *,
125 struct ttm_mem_reg *, struct ttm_mem_reg *);
126 struct nouveau_channel *chan;
127 struct nvif_object copy;
131 /* GEM interface support */
137 /* synchronisation */
140 /* context for accelerated drm-internal operations */
141 struct nouveau_channel *cechan;
142 struct nouveau_channel *channel;
143 struct nouveau_gpuobj *notify;
144 struct nouveau_fbdev *fbcon;
145 struct nvif_object nvsw;
146 struct nvif_object ntfy;
148 /* nv10-nv40 tiling regions */
150 struct nouveau_drm_tile reg[15];
156 struct nouveau_display *display;
157 struct backlight_device *backlight;
159 /* power management */
160 struct nouveau_hwmon *hwmon;
161 struct nouveau_sysfs *sysfs;
163 /* display power reference */
164 bool have_disp_power_ref;
166 struct dev_pm_domain vga_pm_domain;
167 struct pci_dev *hdmi_device;
170 static inline struct nouveau_drm *
171 nouveau_drm(struct drm_device *dev)
173 return dev->dev_private;
176 int nouveau_pmops_suspend(struct device *);
177 int nouveau_pmops_resume(struct device *);
179 #define nouveau_platform_device_create(p, u) \
180 nouveau_platform_device_create_(p, sizeof(**u), (void **)u)
182 nouveau_platform_device_create_(struct platform_device *pdev,
183 int size, void **pobject);
184 void nouveau_drm_device_remove(struct drm_device *dev);
186 #define NV_PRINTK(l,c,f,a...) do { \
187 struct nouveau_cli *_cli = (c); \
188 nv_##l(_cli->base.base.priv, f, ##a); \
190 #define NV_FATAL(drm,f,a...) NV_PRINTK(fatal, &(drm)->client, f, ##a)
191 #define NV_ERROR(drm,f,a...) NV_PRINTK(error, &(drm)->client, f, ##a)
192 #define NV_WARN(drm,f,a...) NV_PRINTK(warn, &(drm)->client, f, ##a)
193 #define NV_INFO(drm,f,a...) NV_PRINTK(info, &(drm)->client, f, ##a)
194 #define NV_DEBUG(drm,f,a...) NV_PRINTK(debug, &(drm)->client, f, ##a)
196 extern int nouveau_modeset;