aboutsummaryrefslogtreecommitdiff
path: root/ui/egl-helpers.c
diff options
context:
space:
mode:
authorMarc-André Lureau <marcandre.lureau@redhat.com>2017-02-12 15:21:18 +0400
committerGerd Hoffmann <kraxel@redhat.com>2017-02-20 12:44:32 +0100
commit7b5255083b7965b427052b5a0b911e51556139ca (patch)
treeb7eee183e7441a168caeb2612cc2c18133da2118 /ui/egl-helpers.c
parentad584d37f2a86b392c25f3f00cc1f1532676c2d1 (diff)
spice: allow to specify drm rendernode
When multiple GPU are available, picking the first one isn't always the best choice. Learn to specify a device rendernode. Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com> Message-id: 20170212112118.16044-1-marcandre.lureau@redhat.com Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Diffstat (limited to 'ui/egl-helpers.c')
-rw-r--r--ui/egl-helpers.c10
1 files changed, 7 insertions, 3 deletions
diff --git a/ui/egl-helpers.c b/ui/egl-helpers.c
index cd24568a5e..417462b76d 100644
--- a/ui/egl-helpers.c
+++ b/ui/egl-helpers.c
@@ -44,13 +44,17 @@ int qemu_egl_rn_fd;
struct gbm_device *qemu_egl_rn_gbm_dev;
EGLContext qemu_egl_rn_ctx;
-int qemu_egl_rendernode_open(void)
+static int qemu_egl_rendernode_open(const char *rendernode)
{
DIR *dir;
struct dirent *e;
int r, fd;
char *p;
+ if (rendernode) {
+ return open(rendernode, O_RDWR | O_CLOEXEC | O_NOCTTY | O_NONBLOCK);
+ }
+
dir = opendir("/dev/dri");
if (!dir) {
return -1;
@@ -85,11 +89,11 @@ int qemu_egl_rendernode_open(void)
return fd;
}
-int egl_rendernode_init(void)
+int egl_rendernode_init(const char *rendernode)
{
qemu_egl_rn_fd = -1;
- qemu_egl_rn_fd = qemu_egl_rendernode_open();
+ qemu_egl_rn_fd = qemu_egl_rendernode_open(rendernode);
if (qemu_egl_rn_fd == -1) {
error_report("egl: no drm render node available");
goto err;