]> git.ipfire.org Git - thirdparty/qemu.git/commit
ui/gtk-egl: Check EGLSurface before doing scanout
authorAntonio Caggiano <quic_acaggian@quicinc.com>
Mon, 16 Oct 2023 12:32:15 +0000 (14:32 +0200)
committerMichael Tokarev <mjt@tls.msk.ru>
Wed, 20 Dec 2023 16:11:10 +0000 (19:11 +0300)
commit7b15f81d637103ace40c0ff4dcbbf485d1ca7bd2
tree70a0afd392c81577f7c906bfe7ab3b7de2cff830
parent62b7c9015234bf472442031d38c1bf0e2f22a1e4
ui/gtk-egl: Check EGLSurface before doing scanout

The first time gd_egl_scanout_texture() is called, there's a possibility
that the GTK drawing area might not be realized yet, in which case its
associated GdkWindow is NULL. This means gd_egl_init() was also skipped
and the EGLContext and EGLSurface stored in the VirtualGfxConsole are
not valid yet.

Continuing with the scanout in this conditions would result in hitting
an assert in libepoxy: "Couldn't find current GLX or EGL context".

A possible workaround is to just ignore the scanout request, giving the
the GTK drawing area some time to finish its realization. At that point,
the gd_egl_init() will succeed and the EGLContext and EGLSurface stored
in the VirtualGfxConsole will be valid.

Signed-off-by: Antonio Caggiano <quic_acaggian@quicinc.com>
Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Message-Id: <20231016123215.2699269-1-quic_acaggian@quicinc.com>
(cherry picked from commit 6f189a08c1b0085808af1bfbf4567f0da193ecc1)
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
ui/gtk-egl.c