summaryrefslogtreecommitdiff
path: root/bin/nv_rdfunc.h
diff options
context:
space:
mode:
authorBen Skeggs <bskeggs@redhat.com>2014-08-10 04:10:21 +1000
committerBen Skeggs <bskeggs@redhat.com>2014-08-10 04:43:28 +1000
commitb7c81f0355379b9d0fcdf624a8df1b7119f28efc (patch)
tree21c37810cbdc088158e06ee75ee303a4af99d0f2 /bin/nv_rdfunc.h
parentc0368d5441d90c6a2ac0583d7d2144c6d6baab8c (diff)
downloadnouveau-b7c81f0355379b9d0fcdf624a8df1b7119f28efc.tar.gz
nvif: import library functions for the ioctl/event interfaces
This is a wrapper around the interfaces defined in an earlier commit, and is also used by various userspace (either by a libdrm backend, or libpciaccess) tools/tests. In the future this will be extended to handle channels, replacing some long-unloved code we currently use, and allow fifo/display/mpeg (hi Ilia ;)) engines to all be exposed in the same way. Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
Diffstat (limited to 'bin/nv_rdfunc.h')
-rw-r--r--bin/nv_rdfunc.h27
1 files changed, 19 insertions, 8 deletions
diff --git a/bin/nv_rdfunc.h b/bin/nv_rdfunc.h
index d840ddd3e..fef29de7a 100644
--- a/bin/nv_rdfunc.h
+++ b/bin/nv_rdfunc.h
@@ -2,8 +2,9 @@
#include <limits.h>
#include <unistd.h>
-#include <core/os.h>
-#include <core/object.h>
+#include <nvif/client.h>
+#include <nvif/device.h>
+#include <nvif/class.h>
#include <core/class.h>
#ifndef ENABLE
@@ -16,8 +17,12 @@
int
main(int argc, char **argv)
{
- struct nouveau_object *client;
- struct nouveau_object *device;
+ const char *drv = NULL;
+ const char *cfg = NULL;
+ const char *dbg = "fatal";
+ u64 dev = ~0ULL;
+ struct nvif_client *client;
+ struct nvif_device *device;
struct nv_device_class args;
char *rstr = NULL;
enum {
@@ -34,8 +39,12 @@ main(int argc, char **argv)
int ndata = 0;
int ret, c;
- while ((c = getopt(argc, argv, "-qrw")) != -1) {
+ while ((c = getopt(argc, argv, "-a:b:c:d:qrw")) != -1) {
switch (c) {
+ case 'a': dev = strtoull(optarg, NULL, 0); break;
+ case 'b': drv = optarg; break;
+ case 'c': cfg = optarg; break;
+ case 'd': dbg = optarg; break;
case 'q': mode = QUIET; break;
case 'r': mode = RATES; break;
case 'w': mode = WATCH; break;
@@ -47,7 +56,7 @@ main(int argc, char **argv)
}
}
- ret = os_client_new(NULL, "fatal", argc, argv, &client);
+ ret = nvif_client_new(drv, argv[0], dev, cfg, dbg, &client);
if (ret)
return ret;
@@ -55,8 +64,9 @@ main(int argc, char **argv)
args.disable = ~ENABLE;
args.debug0 = ~DEBUG0;
- ret = nouveau_object_new(client, ~0, 0, 0x0080, &args, sizeof(args),
- &device);
+ ret = nvif_device_new(nvif_object(client), 0x00000000, NV_DEVICE_CLASS,
+ &args, sizeof(args), &device);
+ nvif_client_ref(NULL, &client);
if (ret)
return ret;
@@ -140,5 +150,6 @@ main(int argc, char **argv)
}
free(data);
+ nvif_device_ref(NULL, &device);
return 0;
}