Test fix using correct gpu when multiple gpus are connected
This commit is contained in:
parent
e158cb2a8b
commit
f38ed36271
2
build.sh
2
build.sh
@ -16,7 +16,7 @@ build_gsr_kms_server() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
build_gsr() {
|
build_gsr() {
|
||||||
dependencies="libavcodec libavformat libavutil x11 xcomposite xrandr xfixes libpulse libswresample libavfilter libva libcap"
|
dependencies="libavcodec libavformat libavutil x11 xcomposite xrandr xfixes libpulse libswresample libavfilter libva libcap libdrm"
|
||||||
includes="$(pkg-config --cflags $dependencies)"
|
includes="$(pkg-config --cflags $dependencies)"
|
||||||
libs="$(pkg-config --libs $dependencies) -ldl -pthread -lm"
|
libs="$(pkg-config --libs $dependencies) -ldl -pthread -lm"
|
||||||
$CC -c src/capture/capture.c $opts $includes
|
$CC -c src/capture/capture.c $opts $includes
|
||||||
|
@ -19,4 +19,5 @@ libswresample = ">=3"
|
|||||||
libavfilter = ">=5"
|
libavfilter = ">=5"
|
||||||
libva = ">=1"
|
libva = ">=1"
|
||||||
libcap = ">=2"
|
libcap = ">=2"
|
||||||
xfixes = ">=2"
|
xfixes = ">=2"
|
||||||
|
libdrm = ">=2"
|
16
src/utils.c
16
src/utils.c
@ -4,6 +4,8 @@
|
|||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
|
#include <xf86drmMode.h>
|
||||||
|
#include <fcntl.h>
|
||||||
|
|
||||||
double clock_get_monotonic_seconds(void) {
|
double clock_get_monotonic_seconds(void) {
|
||||||
struct timespec ts;
|
struct timespec ts;
|
||||||
@ -109,7 +111,19 @@ bool gl_get_gpu_info(Display *dpy, gsr_gpu_info *info) {
|
|||||||
bool gsr_get_valid_card_path(char *output) {
|
bool gsr_get_valid_card_path(char *output) {
|
||||||
for(int i = 0; i < 10; ++i) {
|
for(int i = 0; i < 10; ++i) {
|
||||||
sprintf(output, "/dev/dri/card%d", i);
|
sprintf(output, "/dev/dri/card%d", i);
|
||||||
if(access(output, F_OK) == 0)
|
int fd = open(output, O_RDONLY);
|
||||||
|
if(fd == -1)
|
||||||
|
continue;
|
||||||
|
|
||||||
|
bool is_display_card = false;
|
||||||
|
drmModeResPtr resources = drmModeGetResources(fd);
|
||||||
|
if(resources) {
|
||||||
|
is_display_card = true;
|
||||||
|
drmModeFreeResources(resources);
|
||||||
|
}
|
||||||
|
close(fd);
|
||||||
|
|
||||||
|
if(is_display_card)
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
|
Loading…
Reference in New Issue
Block a user