Ben Skeggs | 9458029 | 2012-07-06 12:14:00 +1000 | [diff] [blame] | 1 | #ifndef __NOUVEAU_DRMCLI_H__ |
| 2 | #define __NOUVEAU_DRMCLI_H__ |
| 3 | |
Ben Skeggs | 77145f1 | 2012-07-31 16:16:21 +1000 | [diff] [blame] | 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 |
Mario Kleiner | 7820e5e | 2014-08-06 06:09:44 +0200 | [diff] [blame^] | 13 | #define DRIVER_PATCHLEVEL 2 |
Christoph Bumiller | 142c21b | 2013-03-27 22:25:52 +0100 | [diff] [blame] | 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). |
Mario Kleiner | 7820e5e | 2014-08-06 06:09:44 +0200 | [diff] [blame^] | 24 | * 1.1.2: |
| 25 | * - fixes multiple bugs in flip completion events and timestamping |
Christoph Bumiller | 142c21b | 2013-03-27 22:25:52 +0100 | [diff] [blame] | 26 | */ |
Ben Skeggs | 77145f1 | 2012-07-31 16:16:21 +1000 | [diff] [blame] | 27 | |
Ben Skeggs | 9458029 | 2012-07-06 12:14:00 +1000 | [diff] [blame] | 28 | #include <core/client.h> |
Ben Skeggs | 1d7c71a | 2013-01-31 09:23:34 +1000 | [diff] [blame] | 29 | #include <core/event.h> |
Ben Skeggs | 9458029 | 2012-07-06 12:14:00 +1000 | [diff] [blame] | 30 | |
Ben Skeggs | ebb945a | 2012-07-20 08:17:34 +1000 | [diff] [blame] | 31 | #include <subdev/vm.h> |
| 32 | |
Ben Skeggs | 9458029 | 2012-07-06 12:14:00 +1000 | [diff] [blame] | 33 | #include <drmP.h> |
| 34 | #include <drm/nouveau_drm.h> |
| 35 | |
Linus Torvalds | 612a9aa | 2012-10-03 23:29:23 -0700 | [diff] [blame] | 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> |
Ben Skeggs | ebb945a | 2012-07-20 08:17:34 +1000 | [diff] [blame] | 42 | |
| 43 | struct nouveau_channel; |
Alexandre Courbot | 8ba9ff1 | 2014-06-26 14:33:32 +0900 | [diff] [blame] | 44 | struct platform_device; |
Ben Skeggs | ebb945a | 2012-07-20 08:17:34 +1000 | [diff] [blame] | 45 | |
| 46 | #define DRM_FILE_PAGE_OFFSET (0x100000000ULL >> PAGE_SHIFT) |
| 47 | |
Ben Skeggs | ebb945a | 2012-07-20 08:17:34 +1000 | [diff] [blame] | 48 | #include "nouveau_fence.h" |
Ben Skeggs | 77145f1 | 2012-07-31 16:16:21 +1000 | [diff] [blame] | 49 | #include "nouveau_bios.h" |
Ben Skeggs | ebb945a | 2012-07-20 08:17:34 +1000 | [diff] [blame] | 50 | |
| 51 | struct nouveau_drm_tile { |
| 52 | struct nouveau_fence *fence; |
| 53 | bool used; |
| 54 | }; |
| 55 | |
Ben Skeggs | 9458029 | 2012-07-06 12:14:00 +1000 | [diff] [blame] | 56 | enum nouveau_drm_handle { |
Ben Skeggs | 26fdd78 | 2013-10-15 11:52:56 +1000 | [diff] [blame] | 57 | NVDRM_CLIENT = 0xffffffff, |
| 58 | NVDRM_DEVICE = 0xdddddddd, |
| 59 | NVDRM_CONTROL = 0xdddddddc, |
Ben Skeggs | 2332b31 | 2014-01-22 12:58:12 +1000 | [diff] [blame] | 60 | NVDRM_DISPLAY = 0xd1500000, |
Ben Skeggs | 26fdd78 | 2013-10-15 11:52:56 +1000 | [diff] [blame] | 61 | NVDRM_PUSH = 0xbbbb0000, /* |= client chid */ |
| 62 | NVDRM_CHAN = 0xcccc0000, /* |= client chid */ |
Ben Skeggs | 69a6146 | 2013-11-13 10:58:51 +1000 | [diff] [blame] | 63 | NVDRM_NVSW = 0x55550000, |
Ben Skeggs | 9458029 | 2012-07-06 12:14:00 +1000 | [diff] [blame] | 64 | }; |
| 65 | |
| 66 | struct nouveau_cli { |
| 67 | struct nouveau_client base; |
| 68 | struct list_head head; |
| 69 | struct mutex mutex; |
Ben Skeggs | ebb945a | 2012-07-20 08:17:34 +1000 | [diff] [blame] | 70 | void *abi16; |
Ben Skeggs | 9458029 | 2012-07-06 12:14:00 +1000 | [diff] [blame] | 71 | }; |
| 72 | |
Ben Skeggs | ebb945a | 2012-07-20 08:17:34 +1000 | [diff] [blame] | 73 | static inline struct nouveau_cli * |
| 74 | nouveau_cli(struct drm_file *fpriv) |
| 75 | { |
| 76 | return fpriv ? fpriv->driver_priv : NULL; |
| 77 | } |
| 78 | |
Dave Airlie | 5addcf0 | 2012-09-10 14:20:51 +1000 | [diff] [blame] | 79 | extern int nouveau_runtime_pm; |
| 80 | |
Ben Skeggs | 9458029 | 2012-07-06 12:14:00 +1000 | [diff] [blame] | 81 | struct nouveau_drm { |
| 82 | struct nouveau_cli client; |
| 83 | struct drm_device *dev; |
| 84 | |
| 85 | struct nouveau_object *device; |
| 86 | struct list_head clients; |
Ben Skeggs | cb75d97 | 2012-07-11 10:44:20 +1000 | [diff] [blame] | 87 | |
| 88 | struct { |
| 89 | enum { |
| 90 | UNKNOWN = 0, |
| 91 | DISABLE = 1, |
| 92 | ENABLED = 2 |
| 93 | } stat; |
| 94 | u32 base; |
| 95 | u32 size; |
| 96 | } agp; |
Ben Skeggs | ebb945a | 2012-07-20 08:17:34 +1000 | [diff] [blame] | 97 | |
| 98 | /* TTM interface support */ |
| 99 | struct { |
| 100 | struct drm_global_reference mem_global_ref; |
| 101 | struct ttm_bo_global_ref bo_global_ref; |
| 102 | struct ttm_bo_device bdev; |
| 103 | atomic_t validate_sequence; |
| 104 | int (*move)(struct nouveau_channel *, |
| 105 | struct ttm_buffer_object *, |
| 106 | struct ttm_mem_reg *, struct ttm_mem_reg *); |
Ben Skeggs | 1bb3f6a | 2013-07-08 10:40:35 +1000 | [diff] [blame] | 107 | struct nouveau_channel *chan; |
Ben Skeggs | ebb945a | 2012-07-20 08:17:34 +1000 | [diff] [blame] | 108 | int mtrr; |
| 109 | } ttm; |
| 110 | |
| 111 | /* GEM interface support */ |
| 112 | struct { |
| 113 | u64 vram_available; |
| 114 | u64 gart_available; |
| 115 | } gem; |
| 116 | |
| 117 | /* synchronisation */ |
| 118 | void *fence; |
| 119 | |
| 120 | /* context for accelerated drm-internal operations */ |
Ben Skeggs | 4998104 | 2012-08-06 19:38:25 +1000 | [diff] [blame] | 121 | struct nouveau_channel *cechan; |
Ben Skeggs | ebb945a | 2012-07-20 08:17:34 +1000 | [diff] [blame] | 122 | struct nouveau_channel *channel; |
| 123 | struct nouveau_gpuobj *notify; |
| 124 | struct nouveau_fbdev *fbcon; |
| 125 | |
| 126 | /* nv10-nv40 tiling regions */ |
| 127 | struct { |
| 128 | struct nouveau_drm_tile reg[15]; |
| 129 | spinlock_t lock; |
| 130 | } tile; |
Ben Skeggs | 51a3d34 | 2012-07-26 09:12:47 +1000 | [diff] [blame] | 131 | |
Ben Skeggs | 77145f1 | 2012-07-31 16:16:21 +1000 | [diff] [blame] | 132 | /* modesetting */ |
| 133 | struct nvbios vbios; |
| 134 | struct nouveau_display *display; |
Ben Skeggs | 51a3d34 | 2012-07-26 09:12:47 +1000 | [diff] [blame] | 135 | struct backlight_device *backlight; |
Ben Skeggs | 77145f1 | 2012-07-31 16:16:21 +1000 | [diff] [blame] | 136 | |
| 137 | /* power management */ |
Ben Skeggs | b9ed919 | 2013-10-15 09:44:02 +1000 | [diff] [blame] | 138 | struct nouveau_hwmon *hwmon; |
Ben Skeggs | 26fdd78 | 2013-10-15 11:52:56 +1000 | [diff] [blame] | 139 | struct nouveau_sysfs *sysfs; |
Dave Airlie | 5addcf0 | 2012-09-10 14:20:51 +1000 | [diff] [blame] | 140 | |
| 141 | /* display power reference */ |
| 142 | bool have_disp_power_ref; |
| 143 | |
| 144 | struct dev_pm_domain vga_pm_domain; |
| 145 | struct pci_dev *hdmi_device; |
Ben Skeggs | 9458029 | 2012-07-06 12:14:00 +1000 | [diff] [blame] | 146 | }; |
| 147 | |
Ben Skeggs | ebb945a | 2012-07-20 08:17:34 +1000 | [diff] [blame] | 148 | static inline struct nouveau_drm * |
| 149 | nouveau_drm(struct drm_device *dev) |
| 150 | { |
Ben Skeggs | 77145f1 | 2012-07-31 16:16:21 +1000 | [diff] [blame] | 151 | return dev->dev_private; |
| 152 | } |
| 153 | |
| 154 | static inline struct nouveau_device * |
| 155 | nouveau_dev(struct drm_device *dev) |
| 156 | { |
| 157 | return nv_device(nouveau_drm(dev)->device); |
Ben Skeggs | ebb945a | 2012-07-20 08:17:34 +1000 | [diff] [blame] | 158 | } |
| 159 | |
Dave Airlie | 2d8b9cc | 2012-11-02 11:04:28 +1000 | [diff] [blame] | 160 | int nouveau_pmops_suspend(struct device *); |
| 161 | int nouveau_pmops_resume(struct device *); |
Ben Skeggs | 9458029 | 2012-07-06 12:14:00 +1000 | [diff] [blame] | 162 | |
Alexandre Courbot | 8ba9ff1 | 2014-06-26 14:33:32 +0900 | [diff] [blame] | 163 | #define nouveau_platform_device_create(p, u) \ |
| 164 | nouveau_platform_device_create_(p, sizeof(**u), (void **)u) |
| 165 | struct drm_device * |
| 166 | nouveau_platform_device_create_(struct platform_device *pdev, |
| 167 | int size, void **pobject); |
| 168 | void nouveau_drm_device_remove(struct drm_device *dev); |
| 169 | |
Ben Skeggs | aa74c37 | 2012-09-12 13:38:13 +1000 | [diff] [blame] | 170 | #define NV_FATAL(cli, fmt, args...) nv_fatal((cli), fmt, ##args) |
| 171 | #define NV_ERROR(cli, fmt, args...) nv_error((cli), fmt, ##args) |
| 172 | #define NV_WARN(cli, fmt, args...) nv_warn((cli), fmt, ##args) |
| 173 | #define NV_INFO(cli, fmt, args...) nv_info((cli), fmt, ##args) |
Ilia Mirkin | c33e05a | 2014-02-13 21:35:14 -0500 | [diff] [blame] | 174 | #define NV_DEBUG(cli, fmt, args...) nv_debug((cli), fmt, ##args) |
Ben Skeggs | 9458029 | 2012-07-06 12:14:00 +1000 | [diff] [blame] | 175 | |
Ben Skeggs | 9430738 | 2012-10-31 12:11:15 +1000 | [diff] [blame] | 176 | extern int nouveau_modeset; |
| 177 | |
Ben Skeggs | 9458029 | 2012-07-06 12:14:00 +1000 | [diff] [blame] | 178 | #endif |