mirror of
https://repo.dec05eba.com/gpu-screen-recorder
synced 2026-05-05 06:20:43 +09:00
Find /dev/dri/card path that exists (the first one)
This commit is contained in:
10
src/utils.c
10
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;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user