Commit | Line | Data |
---|---|---|
9274f4a9 BS |
1 | #ifndef __NOUVEAU_CLIENT_H__ |
2 | #define __NOUVEAU_CLIENT_H__ | |
3 | ||
4 | #include <core/namedb.h> | |
5 | ||
6 | struct nouveau_client { | |
7 | struct nouveau_namedb base; | |
8 | struct nouveau_handle *root; | |
9 | struct nouveau_object *device; | |
a2896ced | 10 | char name[32]; |
9274f4a9 BS |
11 | u32 debug; |
12 | struct nouveau_vm *vm; | |
8ec2a6ec BS |
13 | bool super; |
14 | void *data; | |
15 | ||
16 | int (*ntfy)(const void *, u32, const void *, u32); | |
7caa63c0 | 17 | struct nvkm_client_notify *notify[16]; |
9274f4a9 BS |
18 | }; |
19 | ||
20 | static inline struct nouveau_client * | |
21 | nv_client(void *obj) | |
22 | { | |
23 | #if CONFIG_NOUVEAU_DEBUG >= NV_DBG_PARANOIA | |
24 | if (unlikely(!nv_iclass(obj, NV_CLIENT_CLASS))) | |
25 | nv_assert("BAD CAST -> NvClient, %08x", nv_hclass(obj)); | |
26 | #endif | |
27 | return obj; | |
28 | } | |
29 | ||
30 | static inline struct nouveau_client * | |
31 | nouveau_client(void *obj) | |
32 | { | |
33 | struct nouveau_object *client = nv_object(obj); | |
34 | while (client && !(nv_iclass(client, NV_CLIENT_CLASS))) | |
35 | client = client->parent; | |
36 | return (void *)client; | |
37 | } | |
38 | ||
39 | #define nouveau_client_create(n,c,oc,od,d) \ | |
40 | nouveau_client_create_((n), (c), (oc), (od), sizeof(**d), (void **)d) | |
41 | ||
fa6df8c1 | 42 | int nouveau_client_create_(const char *name, u64 device, const char *cfg, |
9274f4a9 | 43 | const char *dbg, int, void **); |
dd5700ea MS |
44 | #define nouveau_client_destroy(p) \ |
45 | nouveau_namedb_destroy(&(p)->base) | |
46 | ||
9274f4a9 BS |
47 | int nouveau_client_init(struct nouveau_client *); |
48 | int nouveau_client_fini(struct nouveau_client *, bool suspend); | |
a2896ced | 49 | const char *nouveau_client_name(void *obj); |
9274f4a9 | 50 | |
996f5a08 | 51 | int nvkm_client_notify_new(struct nouveau_object *, struct nvkm_event *, |
8ec2a6ec BS |
52 | void *data, u32 size); |
53 | int nvkm_client_notify_del(struct nouveau_client *, int index); | |
54 | int nvkm_client_notify_get(struct nouveau_client *, int index); | |
55 | int nvkm_client_notify_put(struct nouveau_client *, int index); | |
56 | ||
9274f4a9 | 57 | #endif |