blob: 8b0048426ee5ef42e1f097e83932a2a6c81759f8 [file] [log] [blame]
Ben Skeggsc39f4722015-01-13 22:13:14 +10001#ifndef __NVIF_CLIENT_H__
2#define __NVIF_CLIENT_H__
3
4#include <nvif/object.h>
5
6struct nvif_client {
7 struct nvif_object base;
8 struct nvif_object *object; /*XXX: hack for nvif_object() */
9 const struct nvif_driver *driver;
10 bool super;
11};
12
13static inline struct nvif_client *
14nvif_client(struct nvif_object *object)
15{
16 while (object && object->parent != object)
17 object = object->parent;
18 return (void *)object;
19}
20
21int nvif_client_init(void (*dtor)(struct nvif_client *), const char *,
22 const char *, u64, const char *, const char *,
23 struct nvif_client *);
24void nvif_client_fini(struct nvif_client *);
25int nvif_client_new(const char *, const char *, u64, const char *,
26 const char *, struct nvif_client **);
27void nvif_client_ref(struct nvif_client *, struct nvif_client **);
28int nvif_client_ioctl(struct nvif_client *, void *, u32);
29int nvif_client_suspend(struct nvif_client *);
30int nvif_client_resume(struct nvif_client *);
31
32/*XXX*/
33#include <core/client.h>
34#define nvkm_client(a) ({ \
35 struct nvif_client *_client = nvif_client(nvif_object(a)); \
36 nouveau_client(_client->base.priv); \
37})
38
39#endif