[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH 02/21] ui/egl: fix make_context_current() callback return value
From: |
marcandre . lureau |
Subject: |
[PATCH 02/21] ui/egl: fix make_context_current() callback return value |
Date: |
Tue, 6 Jun 2023 15:56:39 +0400 |
From: Marc-André Lureau <marcandre.lureau@redhat.com>
eglMakeCurrent() returns 1/EGL_TRUE on success. This is not what the
callback expects, where 0 indicates success.
While at it, print the EGL error to ease debugging.
As with virgl_renderer_callbacks, the return value is now checked since
version >= 4:
https://gitlab.freedesktop.org/virgl/virglrenderer/-/commit/7f09e6bf0c6ceea6727bd0049781256a28cab0e5
Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
---
ui/egl-context.c | 10 ++++++++--
ui/gtk-egl.c | 9 +++++++--
2 files changed, 15 insertions(+), 4 deletions(-)
diff --git a/ui/egl-context.c b/ui/egl-context.c
index eb5f520fc4..9e0df466f3 100644
--- a/ui/egl-context.c
+++ b/ui/egl-context.c
@@ -1,4 +1,5 @@
#include "qemu/osdep.h"
+#include "qemu/error-report.h"
#include "ui/egl-context.h"
QEMUGLContext qemu_egl_create_context(DisplayGLCtx *dgc,
@@ -32,6 +33,11 @@ void qemu_egl_destroy_context(DisplayGLCtx *dgc,
QEMUGLContext ctx)
int qemu_egl_make_context_current(DisplayGLCtx *dgc,
QEMUGLContext ctx)
{
- return eglMakeCurrent(qemu_egl_display,
- EGL_NO_SURFACE, EGL_NO_SURFACE, ctx);
+ if (!eglMakeCurrent(qemu_egl_display,
+ EGL_NO_SURFACE, EGL_NO_SURFACE, ctx)) {
+ error_report("egl: eglMakeCurrent failed: %s",
qemu_egl_get_error_string());
+ return -1;
+ }
+
+ return 0;
}
diff --git a/ui/gtk-egl.c b/ui/gtk-egl.c
index 19130041bc..f8b5901ce9 100644
--- a/ui/gtk-egl.c
+++ b/ui/gtk-egl.c
@@ -368,6 +368,11 @@ int gd_egl_make_current(DisplayGLCtx *dgc,
{
VirtualConsole *vc = container_of(dgc, VirtualConsole, gfx.dgc);
- return eglMakeCurrent(qemu_egl_display, vc->gfx.esurface,
- vc->gfx.esurface, ctx);
+ if (!eglMakeCurrent(qemu_egl_display, vc->gfx.esurface,
+ vc->gfx.esurface, ctx)) {
+ error_report("egl: eglMakeCurrent failed: %s",
qemu_egl_get_error_string());
+ return -1;
+ }
+
+ return 0;
}
--
2.40.1
- [PATCH 00/21] -display dbus: add win32 support, marcandre . lureau, 2023/06/06
- [PATCH 01/21] ui/egl: export qemu_egl_get_error_string(), marcandre . lureau, 2023/06/06
- [PATCH 02/21] ui/egl: fix make_context_current() callback return value,
marcandre . lureau <=
- [PATCH 03/21] ui/dbus: compile without gio/gunixfdlist.h, marcandre . lureau, 2023/06/06
- [PATCH 04/21] scripts: add a XML preprocessor script, marcandre . lureau, 2023/06/06
- [PATCH 05/21] ui/dbus: win32 support, marcandre . lureau, 2023/06/06
- [PATCH 06/21] qtest: add qtest_pid(), marcandre . lureau, 2023/06/06
- [PATCH 07/21] tests: make dbus-display-test work on win32, marcandre . lureau, 2023/06/06
- [PATCH 08/21] ui/dbus: introduce "Interfaces" properties, marcandre . lureau, 2023/06/06
- [PATCH 10/21] virtio-gpu/win32: allocate shareable 2d resources/images, marcandre . lureau, 2023/06/06
- [PATCH 11/21] ui/dbus: use shared memory when possible on win32, marcandre . lureau, 2023/06/06