]> git.proxmox.com Git - mirror_ubuntu-bionic-kernel.git/blame - drivers/gpu/drm/nouveau/include/nvkm/core/client.h
drm/nouveau/core: remove the remainder of the previous style
[mirror_ubuntu-bionic-kernel.git] / drivers / gpu / drm / nouveau / include / nvkm / core / client.h
CommitLineData
5025407b
BS
1#ifndef __NVKM_CLIENT_H__
2#define __NVKM_CLIENT_H__
24bd0930 3#include <core/object.h>
9274f4a9 4
5025407b 5struct nvkm_client {
24bd0930 6 struct nvkm_object object;
a2896ced 7 char name[32];
24bd0930 8 u64 device;
9274f4a9 9 u32 debug;
24bd0930
BS
10
11 struct nvkm_client_notify *notify[16];
12 struct rb_root objroot;
0710cc31 13 struct rb_root dmaroot;
24bd0930
BS
14
15 struct nvkm_handle *root;
16
8ec2a6ec
BS
17 bool super;
18 void *data;
8ec2a6ec 19 int (*ntfy)(const void *, u32, const void *, u32);
bf81df9b 20
24bd0930 21 struct nvkm_vm *vm;
9274f4a9
BS
22};
23
bf81df9b
BS
24bool nvkm_client_insert(struct nvkm_client *, struct nvkm_handle *);
25void nvkm_client_remove(struct nvkm_client *, struct nvkm_handle *);
26struct nvkm_handle *nvkm_client_search(struct nvkm_client *, u64 handle);
27
76ecea5b
BS
28int nvkm_client_new(const char *name, u64 device, const char *cfg,
29 const char *dbg, struct nvkm_client **);
30void nvkm_client_del(struct nvkm_client **);
5025407b
BS
31int nvkm_client_init(struct nvkm_client *);
32int nvkm_client_fini(struct nvkm_client *, bool suspend);
9274f4a9 33
24bd0930
BS
34static inline struct nvkm_client *
35nvkm_client(struct nvkm_object *object)
36{
37 while (object && object->parent)
38 object = object->parent;
39 return container_of(object, struct nvkm_client, object);
40}
41
5025407b 42int nvkm_client_notify_new(struct nvkm_object *, struct nvkm_event *,
8ec2a6ec 43 void *data, u32 size);
5025407b
BS
44int nvkm_client_notify_del(struct nvkm_client *, int index);
45int nvkm_client_notify_get(struct nvkm_client *, int index);
46int nvkm_client_notify_put(struct nvkm_client *, int index);
6594363b
BS
47
48/* logging for client-facing objects */
49#define nvif_printk(o,l,p,f,a...) do { \
50 struct nvkm_object *_object = (o); \
51 struct nvkm_client *_client = nvkm_client(_object); \
52 if (_client->debug >= NV_DBG_##l) \
53 printk(KERN_##p "nouveau: %s: "f, _client->name, ##a); \
54} while(0)
55#define nvif_error(o,f,a...) nvif_printk((o), ERROR, ERR, f, ##a)
56#define nvif_debug(o,f,a...) nvif_printk((o), DEBUG, INFO, f, ##a)
57#define nvif_trace(o,f,a...) nvif_printk((o), TRACE, INFO, f, ##a)
58#define nvif_ioctl(o,f,a...) nvif_trace((o), "ioctl: "f, ##a)
9274f4a9 59#endif