[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH v2 4/6] ui/gtk: Disable the scanout when a detached tab is closed
From: |
Vivek Kasireddy |
Subject: |
[PATCH v2 4/6] ui/gtk: Disable the scanout when a detached tab is closed |
Date: |
Thu, 17 Nov 2022 17:44:24 -0800 |
When a detached tab window is closed, the underlying (EGL) context
is destroyed; therefore, disable the scanout which also destroys the
underlying framebuffer (id) and other objects. Also add calls to
make the context current in disable scanout and other missing places.
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 | 2 ++
ui/gtk-gl-area.c | 2 ++
ui/gtk.c | 1 +
3 files changed, 5 insertions(+)
diff --git a/ui/gtk-egl.c b/ui/gtk-egl.c
index 35f917ceb1..396cb6590a 100644
--- a/ui/gtk-egl.c
+++ b/ui/gtk-egl.c
@@ -214,6 +214,8 @@ void gd_egl_scanout_disable(DisplayChangeListener *dcl)
{
VirtualConsole *vc = container_of(dcl, VirtualConsole, gfx.dcl);
+ eglMakeCurrent(qemu_egl_display, vc->gfx.esurface,
+ vc->gfx.esurface, vc->gfx.ectx);
vc->gfx.w = 0;
vc->gfx.h = 0;
gtk_egl_set_scanout_mode(vc, false);
diff --git a/ui/gtk-gl-area.c b/ui/gtk-gl-area.c
index 6799805f8e..816f213158 100644
--- a/ui/gtk-gl-area.c
+++ b/ui/gtk-gl-area.c
@@ -275,6 +275,7 @@ void gd_gl_area_scanout_disable(DisplayChangeListener *dcl)
{
VirtualConsole *vc = container_of(dcl, VirtualConsole, gfx.dcl);
+ gtk_gl_area_make_current(GTK_GL_AREA(vc->gfx.drawing_area));
gtk_gl_area_set_scanout_mode(vc, false);
}
@@ -283,6 +284,7 @@ void gd_gl_area_scanout_flush(DisplayChangeListener *dcl,
{
VirtualConsole *vc = container_of(dcl, VirtualConsole, gfx.dcl);
+ gtk_gl_area_make_current(GTK_GL_AREA(vc->gfx.drawing_area));
if (vc->gfx.guest_fb.dmabuf) {
graphic_hw_gl_block(vc->gfx.dcl.con, true);
vc->gfx.guest_fb.dmabuf->draw_submitted = true;
diff --git a/ui/gtk.c b/ui/gtk.c
index 8ccc948813..4ac3655694 100644
--- a/ui/gtk.c
+++ b/ui/gtk.c
@@ -1367,6 +1367,7 @@ static gboolean gd_tab_window_close(GtkWidget *widget,
GdkEvent *event,
VirtualConsole *vc = opaque;
GtkDisplayState *s = vc->s;
+ dpy_gl_scanout_disable(vc->gfx.dcl.con);
gtk_widget_set_sensitive(vc->menu_item, true);
gd_widget_reparent(vc->window, s->notebook, vc->tab_item);
gtk_notebook_set_tab_label_text(GTK_NOTEBOOK(s->notebook),
--
2.37.2
- [PATCH v2 0/6] ui/gtk: Add a new parameter to assign connectors/monitors (v2), Vivek Kasireddy, 2022/11/17
- [PATCH v2 1/6] ui/gtk: Consider the scaling factor when getting the root coordinates, Vivek Kasireddy, 2022/11/17
- [PATCH v2 2/6] ui/gtk-gl-area: Don't forget to calculate the scaling factors in draw, Vivek Kasireddy, 2022/11/17
- [PATCH v2 4/6] ui/gtk: Disable the scanout when a detached tab is closed,
Vivek Kasireddy <=
- [PATCH v2 3/6] ui/gtk: Handle relative mode events correctly with Wayland compositors, Vivek Kasireddy, 2022/11/17
- [PATCH v2 5/6] ui/gtk: Factor out tab window creation into a separate function, Vivek Kasireddy, 2022/11/17
- [PATCH v2 6/6] ui/gtk: Add a new parameter to assign connectors/monitors to GFX VCs (v2), Vivek Kasireddy, 2022/11/17