]> git.proxmox.com Git - mirror_ubuntu-jammy-kernel.git/blame - drivers/gpu/drm/nouveau/include/nvkm/core/client.h
drm/nouveau/nvif: use negative oclass identifier for internal classes
[mirror_ubuntu-jammy-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;
4e7e62d6 8 u64 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];
bf81df9b
BS
17
18 struct rb_root objroot;
9274f4a9
BS
19};
20
bf81df9b
BS
21bool nvkm_client_insert(struct nvkm_client *, struct nvkm_handle *);
22void nvkm_client_remove(struct nvkm_client *, struct nvkm_handle *);
23struct nvkm_handle *nvkm_client_search(struct nvkm_client *, u64 handle);
24
5025407b
BS
25static inline struct nvkm_client *
26nvkm_client(void *obj)
9274f4a9 27{
5025407b 28 struct nvkm_object *client = nv_object(obj);
315a8b2e 29 while (client && client->parent)
9274f4a9
BS
30 client = client->parent;
31 return (void *)client;
32}
33
76ecea5b
BS
34int nvkm_client_new(const char *name, u64 device, const char *cfg,
35 const char *dbg, struct nvkm_client **);
36void nvkm_client_del(struct nvkm_client **);
5025407b
BS
37int nvkm_client_init(struct nvkm_client *);
38int nvkm_client_fini(struct nvkm_client *, bool suspend);
39const char *nvkm_client_name(void *obj);
9274f4a9 40
5025407b 41int nvkm_client_notify_new(struct nvkm_object *, struct nvkm_event *,
8ec2a6ec 42 void *data, u32 size);
5025407b
BS
43int nvkm_client_notify_del(struct nvkm_client *, int index);
44int nvkm_client_notify_get(struct nvkm_client *, int index);
45int nvkm_client_notify_put(struct nvkm_client *, int index);
6594363b
BS
46
47/* logging for client-facing objects */
48#define nvif_printk(o,l,p,f,a...) do { \
49 struct nvkm_object *_object = (o); \
50 struct nvkm_client *_client = nvkm_client(_object); \
51 if (_client->debug >= NV_DBG_##l) \
52 printk(KERN_##p "nouveau: %s: "f, _client->name, ##a); \
53} while(0)
54#define nvif_error(o,f,a...) nvif_printk((o), ERROR, ERR, f, ##a)
55#define nvif_debug(o,f,a...) nvif_printk((o), DEBUG, INFO, f, ##a)
56#define nvif_trace(o,f,a...) nvif_printk((o), TRACE, INFO, f, ##a)
57#define nvif_ioctl(o,f,a...) nvif_trace((o), "ioctl: "f, ##a)
9274f4a9 58#endif