Ben Skeggs | c39f472 | 2015-01-13 22:13:14 +1000 | [diff] [blame^] | 1 | #ifndef __NVIF_CLIENT_H__ |
| 2 | #define __NVIF_CLIENT_H__ |
| 3 | |
| 4 | #include <nvif/object.h> |
| 5 | |
| 6 | struct 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 | |
| 13 | static inline struct nvif_client * |
| 14 | nvif_client(struct nvif_object *object) |
| 15 | { |
| 16 | while (object && object->parent != object) |
| 17 | object = object->parent; |
| 18 | return (void *)object; |
| 19 | } |
| 20 | |
| 21 | int nvif_client_init(void (*dtor)(struct nvif_client *), const char *, |
| 22 | const char *, u64, const char *, const char *, |
| 23 | struct nvif_client *); |
| 24 | void nvif_client_fini(struct nvif_client *); |
| 25 | int nvif_client_new(const char *, const char *, u64, const char *, |
| 26 | const char *, struct nvif_client **); |
| 27 | void nvif_client_ref(struct nvif_client *, struct nvif_client **); |
| 28 | int nvif_client_ioctl(struct nvif_client *, void *, u32); |
| 29 | int nvif_client_suspend(struct nvif_client *); |
| 30 | int 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 |