Find /dev/dri/card path that exists (the first one)

This commit is contained in:
dec05eba
2023-04-16 22:48:22 +02:00
committed by dec05eba
parent d953d0bb36
commit c0ebae365d
7 changed files with 42 additions and 15 deletions

View File

@@ -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;
}