Commit | Line | Data |
---|---|---|
94580299 BS |
1 | #ifndef __NOUVEAU_DRMCLI_H__ |
2 | #define __NOUVEAU_DRMCLI_H__ | |
3 | ||
4 | #include <core/client.h> | |
5 | ||
ebb945a9 BS |
6 | #include <subdev/vm.h> |
7 | ||
94580299 BS |
8 | #include <drmP.h> |
9 | #include <drm/nouveau_drm.h> | |
10 | ||
ebb945a9 BS |
11 | #include "ttm/ttm_bo_api.h" |
12 | #include "ttm/ttm_bo_driver.h" | |
13 | #include "ttm/ttm_placement.h" | |
14 | #include "ttm/ttm_memory.h" | |
15 | #include "ttm/ttm_module.h" | |
16 | #include "ttm/ttm_page_alloc.h" | |
17 | ||
18 | struct nouveau_channel; | |
19 | ||
20 | #define DRM_FILE_PAGE_OFFSET (0x100000000ULL >> PAGE_SHIFT) | |
21 | ||
22 | #include "nouveau_revcompat.h" | |
23 | #include "nouveau_fence.h" | |
24 | ||
25 | struct nouveau_drm_tile { | |
26 | struct nouveau_fence *fence; | |
27 | bool used; | |
28 | }; | |
29 | ||
94580299 BS |
30 | enum nouveau_drm_handle { |
31 | NVDRM_CLIENT = 0xffffffff, | |
32 | NVDRM_DEVICE = 0xdddddddd, | |
ebb945a9 BS |
33 | NVDRM_PUSH = 0xbbbb0000, /* |= client chid */ |
34 | NVDRM_CHAN = 0xcccc0000, /* |= client chid */ | |
94580299 BS |
35 | }; |
36 | ||
37 | struct nouveau_cli { | |
38 | struct nouveau_client base; | |
39 | struct list_head head; | |
40 | struct mutex mutex; | |
ebb945a9 | 41 | void *abi16; |
94580299 BS |
42 | }; |
43 | ||
ebb945a9 BS |
44 | static inline struct nouveau_cli * |
45 | nouveau_cli(struct drm_file *fpriv) | |
46 | { | |
47 | return fpriv ? fpriv->driver_priv : NULL; | |
48 | } | |
49 | ||
94580299 BS |
50 | struct nouveau_drm { |
51 | struct nouveau_cli client; | |
52 | struct drm_device *dev; | |
53 | ||
54 | struct nouveau_object *device; | |
55 | struct list_head clients; | |
cb75d97e BS |
56 | |
57 | struct { | |
58 | enum { | |
59 | UNKNOWN = 0, | |
60 | DISABLE = 1, | |
61 | ENABLED = 2 | |
62 | } stat; | |
63 | u32 base; | |
64 | u32 size; | |
65 | } agp; | |
ebb945a9 BS |
66 | |
67 | /* TTM interface support */ | |
68 | struct { | |
69 | struct drm_global_reference mem_global_ref; | |
70 | struct ttm_bo_global_ref bo_global_ref; | |
71 | struct ttm_bo_device bdev; | |
72 | atomic_t validate_sequence; | |
73 | int (*move)(struct nouveau_channel *, | |
74 | struct ttm_buffer_object *, | |
75 | struct ttm_mem_reg *, struct ttm_mem_reg *); | |
76 | int mtrr; | |
77 | } ttm; | |
78 | ||
79 | /* GEM interface support */ | |
80 | struct { | |
81 | u64 vram_available; | |
82 | u64 gart_available; | |
83 | } gem; | |
84 | ||
85 | /* synchronisation */ | |
86 | void *fence; | |
87 | ||
88 | /* context for accelerated drm-internal operations */ | |
89 | struct nouveau_channel *channel; | |
90 | struct nouveau_gpuobj *notify; | |
91 | struct nouveau_fbdev *fbcon; | |
92 | ||
93 | /* nv10-nv40 tiling regions */ | |
94 | struct { | |
95 | struct nouveau_drm_tile reg[15]; | |
96 | spinlock_t lock; | |
97 | } tile; | |
94580299 BS |
98 | }; |
99 | ||
ebb945a9 BS |
100 | static inline struct nouveau_drm * |
101 | nouveau_drm(struct drm_device *dev) | |
102 | { | |
103 | return nouveau_newpriv(dev); | |
104 | } | |
105 | ||
94580299 BS |
106 | int nouveau_drm_suspend(struct pci_dev *, pm_message_t); |
107 | int nouveau_drm_resume(struct pci_dev *); | |
108 | ||
109 | #define NV_PRINTK(level, code, drm, fmt, args...) \ | |
110 | printk(level "nouveau " code "[ DRM][%s] " fmt, \ | |
111 | pci_name((drm)->dev->pdev), ##args) | |
112 | #define NV_FATAL(drm, fmt, args...) \ | |
113 | NV_PRINTK(KERN_CRIT, "!", (drm), fmt, ##args) | |
114 | #define NV_ERROR(drm, fmt, args...) \ | |
115 | NV_PRINTK(KERN_ERR, "E", (drm), fmt, ##args) | |
116 | #define NV_WARN(drm, fmt, args...) \ | |
117 | NV_PRINTK(KERN_WARNING, "W", (drm), fmt, ##args) | |
118 | #define NV_INFO(drm, fmt, args...) \ | |
119 | NV_PRINTK(KERN_INFO, " ", (drm), fmt, ##args) | |
120 | #define NV_DEBUG(drm, fmt, args...) do { \ | |
121 | if (drm_debug & DRM_UT_DRIVER) \ | |
122 | NV_PRINTK(KERN_DEBUG, "D", drm, fmt, ##args); \ | |
123 | } while (0) | |
124 | ||
125 | #endif |