[igt-dev] [PATCH 1/7] tests/panfrost: Make sure we open a DUMB capable node for prime tests
Boris Brezillon
boris.brezillon at collabora.com
Mon Jun 21 12:57:18 UTC 2021
Signed-off-by: Boris Brezillon <boris.brezillon at collabora.com>
---
tests/panfrost_prime.c | 26 +++++++++++++++++++++++++-
1 file changed, 25 insertions(+), 1 deletion(-)
diff --git a/tests/panfrost_prime.c b/tests/panfrost_prime.c
index 351d46f2f7e6..f9818108a662 100644
--- a/tests/panfrost_prime.c
+++ b/tests/panfrost_prime.c
@@ -35,12 +35,36 @@
#include <sys/ioctl.h>
#include "panfrost_drm.h"
+static int igt_panfrost_open_kms_driver(void)
+{
+ for (unsigned i = 0; i < 2; i++) {
+ uint64_t cap_dumb_buf = 0, cap_prime = 0;
+ char path[32];
+ int fd;
+
+ snprintf(path, sizeof(path), "/dev/dri/card%d", i);
+
+ fd = open(path, O_RDWR);
+ if (fd < 0)
+ continue;
+
+ drmGetCap(fd, DRM_CAP_DUMB_BUFFER, &cap_dumb_buf);
+ drmGetCap(fd, DRM_CAP_PRIME, &cap_prime);
+ if (cap_dumb_buf && (cap_prime & DRM_PRIME_CAP_EXPORT))
+ return fd;
+
+ close(fd);
+ }
+
+ return -1;
+}
+
igt_main
{
int fd, kms_fd;
igt_fixture {
- kms_fd = drm_open_driver_master(DRIVER_ANY);
+ kms_fd = igt_panfrost_open_kms_driver();
fd = drm_open_driver(DRIVER_PANFROST);
}
--
2.31.1
More information about the igt-dev
mailing list