[PATCH libdrm] modetest: Try and open device using drmOpenDevice first

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



This way, it is possible to use modetest -D to specify a card in /dev/dri/cardN
which is esp. useful on systems which have multiple cards, with identical modules
and where it is otherwise impossible to discern the different cards via drmOpen().
One such example is i.MX8M Plus, which has three such cards, one for DSI, one for
LVDS, and one for HDMI.

Signed-off-by: Marek Vasut <marex@xxxxxxx>
---
 tests/util/kms.c | 11 +++++++++++
 1 file changed, 11 insertions(+)

diff --git a/tests/util/kms.c b/tests/util/kms.c
index 34a84180..31087522 100644
--- a/tests/util/kms.c
+++ b/tests/util/kms.c
@@ -38,6 +38,7 @@
  */
 
 #include <errno.h>
+#include <fcntl.h>
 #include <stdint.h>
 #include <stdio.h>
 #include <stdlib.h>
@@ -142,6 +143,16 @@ int util_open(const char *device, const char *module)
 	} else {
 		unsigned int i;
 
+		printf("trying to open device '%s'...", device);
+
+		fd = open(device, O_RDWR | O_CLOEXEC);
+		if (fd < 0) {
+			printf("failed\n");
+		} else {
+			printf("done\n");
+			return fd;
+		}
+
 		for (i = 0; i < ARRAY_SIZE(modules); i++) {
 			printf("trying to open device '%s'...", modules[i]);
 
-- 
2.39.2




[Index of Archives]     [Linux DRI Users]     [Linux Intel Graphics]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [XFree86]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [XFree86]
  Powered by Linux