summaryrefslogtreecommitdiff
path: root/nvkm/include/core/client.h
diff options
context:
space:
mode:
authorBen Skeggs <bskeggs@redhat.com>2012-05-22 10:59:14 +1000
committerBen Skeggs <bskeggs@redhat.com>2013-01-09 14:32:47 +1000
commit827ac5471ac6b03d7a74e8fe0805787b0b3c8364 (patch)
treec493524ff33dedb9f6aa54b51832b4947921f75b /nvkm/include/core/client.h
downloadnouveau-827ac5471ac6b03d7a74e8fe0805787b0b3c8364.tar.gz
initial import of nouveau kernel module core, some simple tools, and drm
Ignore (or, if you're really keen, fix) any of the horrors that are part of the emulate-linux-on-libpciaccess (lib/) layer. When I started down this path I was only aiming to prototype the reworked driver core, and never actually intended on going quite this far with things, but it turns out that being able to develop and test the nouveau core from userspace is *very* useful. This tree is based on the code available as of Linux 3.8-rc2. Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
Diffstat (limited to 'nvkm/include/core/client.h')
-rw-r--r--nvkm/include/core/client.h42
1 files changed, 42 insertions, 0 deletions
diff --git a/nvkm/include/core/client.h b/nvkm/include/core/client.h
new file mode 100644
index 000000000..0193532ce
--- /dev/null
+++ b/nvkm/include/core/client.h
@@ -0,0 +1,42 @@
+#ifndef __NOUVEAU_CLIENT_H__
+#define __NOUVEAU_CLIENT_H__
+
+#include <core/namedb.h>
+
+struct nouveau_client {
+ struct nouveau_namedb base;
+ struct nouveau_handle *root;
+ struct nouveau_object *device;
+ char name[16];
+ u32 debug;
+ struct nouveau_vm *vm;
+};
+
+static inline struct nouveau_client *
+nv_client(void *obj)
+{
+#if CONFIG_NOUVEAU_DEBUG >= NV_DBG_PARANOIA
+ if (unlikely(!nv_iclass(obj, NV_CLIENT_CLASS)))
+ nv_assert("BAD CAST -> NvClient, %08x", nv_hclass(obj));
+#endif
+ return obj;
+}
+
+static inline struct nouveau_client *
+nouveau_client(void *obj)
+{
+ struct nouveau_object *client = nv_object(obj);
+ while (client && !(nv_iclass(client, NV_CLIENT_CLASS)))
+ client = client->parent;
+ return (void *)client;
+}
+
+#define nouveau_client_create(n,c,oc,od,d) \
+ nouveau_client_create_((n), (c), (oc), (od), sizeof(**d), (void **)d)
+
+int nouveau_client_create_(const char *name, u64 device, const char *cfg,
+ const char *dbg, int, void **);
+int nouveau_client_init(struct nouveau_client *);
+int nouveau_client_fini(struct nouveau_client *, bool suspend);
+
+#endif