diff options
Diffstat (limited to 'ui')
-rw-r--r-- | ui/egl-helpers.c | 10 | ||||
-rw-r--r-- | ui/spice-core.c | 5 |
2 files changed, 11 insertions, 4 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; diff --git a/ui/spice-core.c b/ui/spice-core.c index 1452e77fd1..39ccab7561 100644 --- a/ui/spice-core.c +++ b/ui/spice-core.c @@ -501,6 +501,9 @@ static QemuOptsList qemu_spice_opts = { },{ .name = "gl", .type = QEMU_OPT_BOOL, + },{ + .name = "rendernode", + .type = QEMU_OPT_STRING, #endif }, { /* end of list */ } @@ -833,7 +836,7 @@ void qemu_spice_init(void) "incompatible with -spice port/tls-port"); exit(1); } - if (egl_rendernode_init() != 0) { + if (egl_rendernode_init(qemu_opt_get(opts, "rendernode")) != 0) { error_report("Failed to initialize EGL render node for SPICE GL"); exit(1); } |