pan/bit: Open up the device
As a start and a sanity check.
Signed-off-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4382>
diff --git a/src/panfrost/bifrost/test/bi_submit.c b/src/panfrost/bifrost/test/bi_submit.c
index fcc4459..b098f2a 100644
--- a/src/panfrost/bifrost/test/bi_submit.c
+++ b/src/panfrost/bifrost/test/bi_submit.c
@@ -37,3 +37,20 @@
pandecode_inject_mmap(bo->gpu, bo->cpu, bo->size, NULL);
return bo;
}
+
+struct panfrost_device *
+bit_initialize(void *memctx)
+{
+ int fd = drmOpenWithType("panfrost", NULL, DRM_NODE_RENDER);
+
+ if (fd < 0)
+ unreachable("No panfrost device found. Try chmod?");
+
+ struct panfrost_device *dev = rzalloc(memctx, struct panfrost_device);
+ panfrost_open_device(memctx, fd, dev);
+
+ pandecode_initialize(true);
+ printf("%X\n", dev->gpu_id);
+
+ return dev;
+}