mirror of
https://github.com/mii443/qemu.git
synced 2025-08-22 23:25:48 +00:00
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>
This commit is contained in:
@ -19,6 +19,8 @@
|
||||
#include "qemu/error-report.h"
|
||||
#include "ui/console.h"
|
||||
#include "ui/egl-helpers.h"
|
||||
#include "sysemu/sysemu.h"
|
||||
#include "qapi/error.h"
|
||||
|
||||
EGLDisplay *qemu_egl_display;
|
||||
EGLConfig qemu_egl_config;
|
||||
@ -569,3 +571,25 @@ EGLContext qemu_egl_init_ctx(void)
|
||||
|
||||
return ectx;
|
||||
}
|
||||
|
||||
bool egl_init(const char *rendernode, DisplayGLMode mode, Error **errp)
|
||||
{
|
||||
ERRP_GUARD();
|
||||
|
||||
if (mode == DISPLAYGL_MODE_OFF) {
|
||||
error_setg(errp, "egl: turning off GL doesn't make sense");
|
||||
return false;
|
||||
}
|
||||
|
||||
#ifdef CONFIG_GBM
|
||||
if (egl_rendernode_init(rendernode, mode) < 0) {
|
||||
error_setg(errp, "egl: render node init failed");
|
||||
return false;
|
||||
}
|
||||
display_opengl = 1;
|
||||
return true;
|
||||
#else
|
||||
error_setg(errp, "egl: not available on this platform");
|
||||
return false;
|
||||
#endif
|
||||
}
|
||||
|
Reference in New Issue
Block a user