[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH v1] ui/gtk-egl: Check for a valid context before making EGL calls
|
From: |
Vivek Kasireddy |
|
Subject: |
[PATCH v1] ui/gtk-egl: Check for a valid context before making EGL calls |
|
Date: |
Sun, 6 Mar 2022 20:21:08 -0800 |
Since not all listeners (i.e VirtualConsoles) of GL events have
a valid EGL context, make sure that there is a valid context
before making EGL calls.
This fixes the following crash seen while launching the VM with
"-device virtio-gpu-pci,max_outputs=1,blob=true -display gtk,gl=on"
No provider of eglCreateImageKHR found. Requires one of:
EGL_KHR_image
EGL_KHR_image_base
Fixes: 7cc712e9862ff ("ui: dispatch GL events to all listeners")
Cc: Marc-André Lureau <marcandre.lureau@redhat.com>
Cc: Gerd Hoffmann <kraxel@redhat.com>
Cc: Dongwon Kim <dongwon.kim@intel.com>
Signed-off-by: Vivek Kasireddy <vivek.kasireddy@intel.com>
---
ui/gtk-egl.c | 8 ++++++++
1 file changed, 8 insertions(+)
diff --git a/ui/gtk-egl.c b/ui/gtk-egl.c
index e3bd4bc274..31175827d0 100644
--- a/ui/gtk-egl.c
+++ b/ui/gtk-egl.c
@@ -244,6 +244,10 @@ void gd_egl_scanout_dmabuf(DisplayChangeListener *dcl,
#ifdef CONFIG_GBM
VirtualConsole *vc = container_of(dcl, VirtualConsole, gfx.dcl);
+ if (!vc->gfx.ectx || !vc->gfx.esurface) {
+ return;
+ }
+
eglMakeCurrent(qemu_egl_display, vc->gfx.esurface,
vc->gfx.esurface, vc->gfx.ectx);
@@ -269,6 +273,10 @@ void gd_egl_cursor_dmabuf(DisplayChangeListener *dcl,
#ifdef CONFIG_GBM
VirtualConsole *vc = container_of(dcl, VirtualConsole, gfx.dcl);
+ if (!vc->gfx.ectx || !vc->gfx.esurface) {
+ return;
+ }
+
if (dmabuf) {
egl_dmabuf_import_texture(dmabuf);
if (!dmabuf->texture) {
--
2.35.1
- [PATCH v1] ui/gtk-egl: Check for a valid context before making EGL calls,
Vivek Kasireddy <=