summary refs log tree commit diff stats
path: root/ui/egl-headless.c
diff options
context:
space:
mode:
authorMarc-André Lureau <marcandre.lureau@redhat.com>2023-02-14 16:11:24 +0400
committerMarc-André Lureau <marcandre.lureau@redhat.com>2023-03-13 23:48:45 +0400
commit0e1be59ed9b3b50aa7e66669e94aabdf0c3d80d2 (patch)
treed06d249e05ae7315fdb4bc1935bcfcd4d8d3ab91 /ui/egl-headless.c
parentda3f7a3ab9ea0091955b58f8909dfcee01f4043e (diff)
downloadfocaccia-qemu-0e1be59ed9b3b50aa7e66669e94aabdf0c3d80d2.tar.gz
focaccia-qemu-0e1be59ed9b3b50aa7e66669e94aabdf0c3d80d2.zip
ui: introduce egl_init()
Future patches will introduce EGL support on win32 (too late for 8.0
though). Having a common place for EGL initialization and error handling
will make it simpler.

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
Diffstat (limited to 'ui/egl-headless.c')
-rw-r--r--ui/egl-headless.c16
1 files changed, 8 insertions, 8 deletions
diff --git a/ui/egl-headless.c b/ui/egl-headless.c
index ae07e91302..ef70e6a18e 100644
--- a/ui/egl-headless.c
+++ b/ui/egl-headless.c
@@ -1,7 +1,7 @@
 #include "qemu/osdep.h"
 #include "qemu/error-report.h"
 #include "qemu/module.h"
-#include "sysemu/sysemu.h"
+#include "qapi/error.h"
 #include "ui/console.h"
 #include "ui/egl-helpers.h"
 #include "ui/egl-context.h"
@@ -191,21 +191,21 @@ static const DisplayGLCtxOps eglctx_ops = {
 
 static void early_egl_headless_init(DisplayOptions *opts)
 {
-    display_opengl = 1;
+    DisplayGLMode mode = DISPLAYGL_MODE_ON;
+
+    if (opts->has_gl) {
+        mode = opts->gl;
+    }
+
+    egl_init(opts->u.egl_headless.rendernode, mode, &error_fatal);
 }
 
 static void egl_headless_init(DisplayState *ds, DisplayOptions *opts)
 {
-    DisplayGLMode mode = opts->has_gl ? opts->gl : DISPLAYGL_MODE_ON;
     QemuConsole *con;
     egl_dpy *edpy;
     int idx;
 
-    if (egl_rendernode_init(opts->u.egl_headless.rendernode, mode) < 0) {
-        error_report("egl: render node init failed");
-        exit(1);
-    }
-
     for (idx = 0;; idx++) {
         DisplayGLCtx *ctx;