]> git.karo-electronics.de Git - karo-tx-linux.git/blob - drivers/gpu/drm/nouveau/nouveau_drm.h
TTY: ircomm: fix DTR being raised on hang up
[karo-tx-linux.git] / drivers / gpu / drm / nouveau / nouveau_drm.h
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       0
14
15 #include <core/client.h>
16 #include <core/event.h>
17
18 #include <subdev/vm.h>
19
20 #include <drmP.h>
21 #include <drm/nouveau_drm.h>
22
23 #include <drm/ttm/ttm_bo_api.h>
24 #include <drm/ttm/ttm_bo_driver.h>
25 #include <drm/ttm/ttm_placement.h>
26 #include <drm/ttm/ttm_memory.h>
27 #include <drm/ttm/ttm_module.h>
28 #include <drm/ttm/ttm_page_alloc.h>
29
30 struct nouveau_channel;
31
32 #define DRM_FILE_PAGE_OFFSET (0x100000000ULL >> PAGE_SHIFT)
33
34 #include "nouveau_fence.h"
35 #include "nouveau_bios.h"
36
37 struct nouveau_drm_tile {
38         struct nouveau_fence *fence;
39         bool used;
40 };
41
42 enum nouveau_drm_handle {
43         NVDRM_CLIENT = 0xffffffff,
44         NVDRM_DEVICE = 0xdddddddd,
45         NVDRM_PUSH   = 0xbbbb0000, /* |= client chid */
46         NVDRM_CHAN   = 0xcccc0000, /* |= client chid */
47 };
48
49 struct nouveau_cli {
50         struct nouveau_client base;
51         struct list_head head;
52         struct mutex mutex;
53         void *abi16;
54 };
55
56 static inline struct nouveau_cli *
57 nouveau_cli(struct drm_file *fpriv)
58 {
59         return fpriv ? fpriv->driver_priv : NULL;
60 }
61
62 struct nouveau_drm {
63         struct nouveau_cli client;
64         struct drm_device *dev;
65
66         struct nouveau_object *device;
67         struct list_head clients;
68
69         struct {
70                 enum {
71                         UNKNOWN = 0,
72                         DISABLE = 1,
73                         ENABLED = 2
74                 } stat;
75                 u32 base;
76                 u32 size;
77         } agp;
78
79         /* TTM interface support */
80         struct {
81                 struct drm_global_reference mem_global_ref;
82                 struct ttm_bo_global_ref bo_global_ref;
83                 struct ttm_bo_device bdev;
84                 atomic_t validate_sequence;
85                 int (*move)(struct nouveau_channel *,
86                             struct ttm_buffer_object *,
87                             struct ttm_mem_reg *, struct ttm_mem_reg *);
88                 int mtrr;
89         } ttm;
90
91         /* GEM interface support */
92         struct {
93                 u64 vram_available;
94                 u64 gart_available;
95         } gem;
96
97         /* synchronisation */
98         void *fence;
99
100         /* context for accelerated drm-internal operations */
101         struct nouveau_channel *cechan;
102         struct nouveau_channel *channel;
103         struct nouveau_gpuobj *notify;
104         struct nouveau_fbdev *fbcon;
105
106         /* nv10-nv40 tiling regions */
107         struct {
108                 struct nouveau_drm_tile reg[15];
109                 spinlock_t lock;
110         } tile;
111
112         /* modesetting */
113         struct nvbios vbios;
114         struct nouveau_display *display;
115         struct backlight_device *backlight;
116         struct nouveau_eventh vblank;
117
118         /* power management */
119         struct nouveau_pm *pm;
120 };
121
122 static inline struct nouveau_drm *
123 nouveau_drm(struct drm_device *dev)
124 {
125         return dev->dev_private;
126 }
127
128 static inline struct nouveau_device *
129 nouveau_dev(struct drm_device *dev)
130 {
131         return nv_device(nouveau_drm(dev)->device);
132 }
133
134 int nouveau_pmops_suspend(struct device *);
135 int nouveau_pmops_resume(struct device *);
136
137 #define NV_FATAL(cli, fmt, args...) nv_fatal((cli), fmt, ##args)
138 #define NV_ERROR(cli, fmt, args...) nv_error((cli), fmt, ##args)
139 #define NV_WARN(cli, fmt, args...) nv_warn((cli), fmt, ##args)
140 #define NV_INFO(cli, fmt, args...) nv_info((cli), fmt, ##args)
141 #define NV_DEBUG(cli, fmt, args...) do {                                       \
142         if (drm_debug & DRM_UT_DRIVER)                                         \
143                 nv_info((cli), fmt, ##args);                                   \
144 } while (0)
145
146 extern int nouveau_modeset;
147
148 #endif