]> git.proxmox.com Git - mirror_ubuntu-bionic-kernel.git/blame - drivers/gpu/drm/nouveau/include/nvkm/core/client.h
drm/nouveau/platform: remove subclassing of nvkm_device
[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__
9274f4a9
BS
3#include <core/namedb.h>
4
5025407b
BS
5struct nvkm_client {
6 struct nvkm_namedb namedb;
7 struct nvkm_handle *root;
8 struct nvkm_object *device;
a2896ced 9 char name[32];
9274f4a9 10 u32 debug;
5025407b 11 struct nvkm_vm *vm;
8ec2a6ec
BS
12 bool super;
13 void *data;
14
15 int (*ntfy)(const void *, u32, const void *, u32);
7caa63c0 16 struct nvkm_client_notify *notify[16];
9274f4a9
BS
17};
18
5025407b 19static inline struct nvkm_client *
9274f4a9
BS
20nv_client(void *obj)
21{
22#if CONFIG_NOUVEAU_DEBUG >= NV_DBG_PARANOIA
53003941 23 BUG_ON(!nv_iclass(obj, NV_CLIENT_CLASS));
9274f4a9
BS
24#endif
25 return obj;
26}
27
5025407b
BS
28static inline struct nvkm_client *
29nvkm_client(void *obj)
9274f4a9 30{
5025407b 31 struct nvkm_object *client = nv_object(obj);
9274f4a9
BS
32 while (client && !(nv_iclass(client, NV_CLIENT_CLASS)))
33 client = client->parent;
34 return (void *)client;
35}
36
5025407b
BS
37#define nvkm_client_create(n,c,oc,od,d) \
38 nvkm_client_create_((n), (c), (oc), (od), sizeof(**d), (void **)d)
9274f4a9 39
5025407b 40int nvkm_client_create_(const char *name, u64 device, const char *cfg,
9274f4a9 41 const char *dbg, int, void **);
5025407b
BS
42#define nvkm_client_destroy(p) \
43 nvkm_namedb_destroy(&(p)->base)
dd5700ea 44
5025407b
BS
45int nvkm_client_init(struct nvkm_client *);
46int nvkm_client_fini(struct nvkm_client *, bool suspend);
47const char *nvkm_client_name(void *obj);
9274f4a9 48
5025407b 49int nvkm_client_notify_new(struct nvkm_object *, struct nvkm_event *,
8ec2a6ec 50 void *data, u32 size);
5025407b
BS
51int nvkm_client_notify_del(struct nvkm_client *, int index);
52int nvkm_client_notify_get(struct nvkm_client *, int index);
53int nvkm_client_notify_put(struct nvkm_client *, int index);
6594363b
BS
54
55/* logging for client-facing objects */
56#define nvif_printk(o,l,p,f,a...) do { \
57 struct nvkm_object *_object = (o); \
58 struct nvkm_client *_client = nvkm_client(_object); \
59 if (_client->debug >= NV_DBG_##l) \
60 printk(KERN_##p "nouveau: %s: "f, _client->name, ##a); \
61} while(0)
62#define nvif_error(o,f,a...) nvif_printk((o), ERROR, ERR, f, ##a)
63#define nvif_debug(o,f,a...) nvif_printk((o), DEBUG, INFO, f, ##a)
64#define nvif_trace(o,f,a...) nvif_printk((o), TRACE, INFO, f, ##a)
65#define nvif_ioctl(o,f,a...) nvif_trace((o), "ioctl: "f, ##a)
9274f4a9 66#endif