nouveau_drm.h revision fdb751ef2bbc78314d1e01d3425cfacfb19b9f86
1#ifndef __NOUVEAU_DRMCLI_H__ 2#define __NOUVEAU_DRMCLI_H__ 3 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 13#define DRIVER_PATCHLEVEL 2 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). 24 * 1.1.2: 25 * - fixes multiple bugs in flip completion events and timestamping 26 */ 27 28#include <nvif/client.h> 29#include <nvif/device.h> 30 31#include <core/class.h> 32 33#include <drmP.h> 34#include <drm/nouveau_drm.h> 35 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> 42 43struct nouveau_channel; 44struct platform_device; 45 46#define DRM_FILE_PAGE_OFFSET (0x100000000ULL >> PAGE_SHIFT) 47 48#include "nouveau_fence.h" 49#include "nouveau_bios.h" 50 51struct nouveau_drm_tile { 52 struct nouveau_fence *fence; 53 bool used; 54}; 55 56enum nouveau_drm_object_route { 57 NVDRM_OBJECT_NVIF = 0, 58 NVDRM_OBJECT_USIF, 59 NVDRM_OBJECT_ABI16, 60}; 61 62enum nouveau_drm_notify_route { 63 NVDRM_NOTIFY_NVIF = 0, 64 NVDRM_NOTIFY_USIF 65}; 66 67enum nouveau_drm_handle { 68 NVDRM_CLIENT = 0xffffffff, 69 NVDRM_DEVICE = 0xdddddddd, 70 NVDRM_CONTROL = 0xdddddddc, 71 NVDRM_DISPLAY = 0xd1500000, 72 NVDRM_PUSH = 0xbbbb0000, /* |= client chid */ 73 NVDRM_CHAN = 0xcccc0000, /* |= client chid */ 74 NVDRM_NVSW = 0x55550000, 75}; 76 77struct nouveau_cli { 78 struct nvif_client base; 79 struct nouveau_vm *vm; /*XXX*/ 80 struct list_head head; 81 struct mutex mutex; 82 void *abi16; 83}; 84 85static inline struct nouveau_cli * 86nouveau_cli(struct drm_file *fpriv) 87{ 88 return fpriv ? fpriv->driver_priv : NULL; 89} 90 91#include <nvif/object.h> 92#include <nvif/device.h> 93 94extern int nouveau_runtime_pm; 95 96struct nouveau_drm { 97 struct nouveau_cli client; 98 struct drm_device *dev; 99 100 struct nvif_device device; 101 struct list_head clients; 102 103 struct { 104 enum { 105 UNKNOWN = 0, 106 DISABLE = 1, 107 ENABLED = 2 108 } stat; 109 u32 base; 110 u32 size; 111 } agp; 112 113 /* TTM interface support */ 114 struct { 115 struct drm_global_reference mem_global_ref; 116 struct ttm_bo_global_ref bo_global_ref; 117 struct ttm_bo_device bdev; 118 atomic_t validate_sequence; 119 int (*move)(struct nouveau_channel *, 120 struct ttm_buffer_object *, 121 struct ttm_mem_reg *, struct ttm_mem_reg *); 122 struct nouveau_channel *chan; 123 struct nvif_object copy; 124 int mtrr; 125 } ttm; 126 127 /* GEM interface support */ 128 struct { 129 u64 vram_available; 130 u64 gart_available; 131 } gem; 132 133 /* synchronisation */ 134 void *fence; 135 136 /* context for accelerated drm-internal operations */ 137 struct nouveau_channel *cechan; 138 struct nouveau_channel *channel; 139 struct nouveau_gpuobj *notify; 140 struct nouveau_fbdev *fbcon; 141 struct nvif_object nvsw; 142 struct nvif_object ntfy; 143 144 /* nv10-nv40 tiling regions */ 145 struct { 146 struct nouveau_drm_tile reg[15]; 147 spinlock_t lock; 148 } tile; 149 150 /* modesetting */ 151 struct nvbios vbios; 152 struct nouveau_display *display; 153 struct backlight_device *backlight; 154 155 /* power management */ 156 struct nouveau_hwmon *hwmon; 157 struct nouveau_sysfs *sysfs; 158 159 /* display power reference */ 160 bool have_disp_power_ref; 161 162 struct dev_pm_domain vga_pm_domain; 163 struct pci_dev *hdmi_device; 164}; 165 166static inline struct nouveau_drm * 167nouveau_drm(struct drm_device *dev) 168{ 169 return dev->dev_private; 170} 171 172int nouveau_pmops_suspend(struct device *); 173int nouveau_pmops_resume(struct device *); 174 175#define nouveau_platform_device_create(p, u) \ 176 nouveau_platform_device_create_(p, sizeof(**u), (void **)u) 177struct drm_device * 178nouveau_platform_device_create_(struct platform_device *pdev, 179 int size, void **pobject); 180void nouveau_drm_device_remove(struct drm_device *dev); 181 182#define NV_PRINTK(l,c,f,a...) do { \ 183 struct nouveau_cli *_cli = (c); \ 184 nv_##l(_cli->base.base.priv, f, ##a); \ 185} while(0) 186#define NV_FATAL(drm,f,a...) NV_PRINTK(fatal, &(drm)->client, f, ##a) 187#define NV_ERROR(drm,f,a...) NV_PRINTK(error, &(drm)->client, f, ##a) 188#define NV_WARN(drm,f,a...) NV_PRINTK(warn, &(drm)->client, f, ##a) 189#define NV_INFO(drm,f,a...) NV_PRINTK(info, &(drm)->client, f, ##a) 190#define NV_DEBUG(drm,f,a...) NV_PRINTK(debug, &(drm)->client, f, ##a) 191 192extern int nouveau_modeset; 193 194#endif 195