aboutsummaryrefslogtreecommitdiff
path: root/src/utils.c
diff options
context:
space:
mode:
authordec05eba <dec05eba®protonmail.com>2023-04-16 22:48:22 +0200
committerdec05eba <dec05eba@protonmail.com>2023-04-16 22:50:43 +0200
commitc0ebae365d3ee20dc6ed1cf71d998bf040e93149 (patch)
treed66723be1a63cb7fb571a7115972c79fde5176f9 /src/utils.c
parentd953d0bb363799211d546035e825d248b9b3c2ed (diff)
Find /dev/dri/card path that exists (the first one)
Diffstat (limited to 'src/utils.c')
-rw-r--r--src/utils.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/src/utils.c b/src/utils.c
index 98de5f0..322d7d9 100644
--- a/src/utils.c
+++ b/src/utils.c
@@ -3,6 +3,7 @@
#include <time.h>
#include <string.h>
#include <stdio.h>
+#include <unistd.h>
double clock_get_monotonic_seconds(void) {
struct timespec ts;
@@ -103,3 +104,12 @@ bool gl_get_gpu_info(Display *dpy, gsr_gpu_info *info) {
gsr_egl_unload(&gl);
return supported;
}
+
+bool gsr_get_valid_card_path(char *output) {
+ for(int i = 0; i < 10; ++i) {
+ sprintf(output, "/dev/dri/card%d", i);
+ if(access(output, F_OK) == 0)
+ return true;
+ }
+ return false;
+}