mirror of
https://github.com/qemu/qemu.git
synced 2026-04-05 22:00:58 +00:00
ui/egl: Don't change bound GL context when creating new context
Don't change bound GL context when creating new GL context for consistency with behavior expected by virglrenderer that assumes context-creation doesn't switch context. eglCreateContext() doesn't require GL context to be bound when it's invoked. Update qemu_egl_create_context() to spawn GL sub-contexts from a given shared GL context instead of a currently-bound context. Signed-off-by: Dmitry Osipenko <dmitry.osipenko@collabora.com> Message-ID: <20260303151422.977399-4-dmitry.osipenko@collabora.com> Message-ID: <20260304165043.1437519-6-alex.bennee@linaro.org> Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
This commit is contained in:
committed by
Alex Bennée
parent
5bb16eb707
commit
3beb637032
@@ -5,7 +5,8 @@
|
||||
#include "ui/egl-helpers.h"
|
||||
|
||||
QEMUGLContext qemu_egl_create_context(DisplayGLCtx *dgc,
|
||||
QEMUGLParams *params);
|
||||
QEMUGLParams *params,
|
||||
EGLContext share_context);
|
||||
void qemu_egl_destroy_context(DisplayGLCtx *dgc, QEMUGLContext ctx);
|
||||
int qemu_egl_make_context_current(DisplayGLCtx *dgc,
|
||||
QEMUGLContext ctx);
|
||||
|
||||
@@ -47,9 +47,7 @@ static DBusDisplay *dbus_display;
|
||||
static QEMUGLContext dbus_create_context(DisplayGLCtx *dgc,
|
||||
QEMUGLParams *params)
|
||||
{
|
||||
eglMakeCurrent(qemu_egl_display, EGL_NO_SURFACE, EGL_NO_SURFACE,
|
||||
qemu_egl_rn_ctx);
|
||||
return qemu_egl_create_context(dgc, params);
|
||||
return qemu_egl_create_context(dgc, params, qemu_egl_rn_ctx);
|
||||
}
|
||||
|
||||
static bool
|
||||
|
||||
@@ -3,7 +3,8 @@
|
||||
#include "ui/egl-context.h"
|
||||
|
||||
QEMUGLContext qemu_egl_create_context(DisplayGLCtx *dgc,
|
||||
QEMUGLParams *params)
|
||||
QEMUGLParams *params,
|
||||
EGLContext share_context)
|
||||
{
|
||||
EGLContext ctx;
|
||||
EGLint ctx_att_core[] = {
|
||||
@@ -19,8 +20,7 @@ QEMUGLContext qemu_egl_create_context(DisplayGLCtx *dgc,
|
||||
};
|
||||
bool gles = (qemu_egl_mode == DISPLAY_GL_MODE_ES);
|
||||
|
||||
ctx = eglCreateContext(qemu_egl_display, qemu_egl_config,
|
||||
eglGetCurrentContext(),
|
||||
ctx = eglCreateContext(qemu_egl_display, qemu_egl_config, share_context,
|
||||
gles ? ctx_att_gles : ctx_att_core);
|
||||
return ctx;
|
||||
}
|
||||
|
||||
@@ -42,9 +42,7 @@ static void egl_gfx_switch(DisplayChangeListener *dcl,
|
||||
static QEMUGLContext egl_create_context(DisplayGLCtx *dgc,
|
||||
QEMUGLParams *params)
|
||||
{
|
||||
eglMakeCurrent(qemu_egl_display, EGL_NO_SURFACE, EGL_NO_SURFACE,
|
||||
qemu_egl_rn_ctx);
|
||||
return qemu_egl_create_context(dgc, params);
|
||||
return qemu_egl_create_context(dgc, params, qemu_egl_rn_ctx);
|
||||
}
|
||||
|
||||
static void egl_scanout_disable(DisplayChangeListener *dcl)
|
||||
|
||||
@@ -219,9 +219,7 @@ QEMUGLContext gd_egl_create_context(DisplayGLCtx *dgc,
|
||||
{
|
||||
VirtualConsole *vc = container_of(dgc, VirtualConsole, gfx.dgc);
|
||||
|
||||
eglMakeCurrent(qemu_egl_display, vc->gfx.esurface,
|
||||
vc->gfx.esurface, vc->gfx.ectx);
|
||||
return qemu_egl_create_context(dgc, params);
|
||||
return qemu_egl_create_context(dgc, params, vc->gfx.ectx);
|
||||
}
|
||||
|
||||
void gd_egl_scanout_disable(DisplayChangeListener *dcl)
|
||||
|
||||
@@ -1033,9 +1033,7 @@ static void spice_gl_switch(DisplayChangeListener *dcl,
|
||||
static QEMUGLContext qemu_spice_gl_create_context(DisplayGLCtx *dgc,
|
||||
QEMUGLParams *params)
|
||||
{
|
||||
eglMakeCurrent(qemu_egl_display, EGL_NO_SURFACE, EGL_NO_SURFACE,
|
||||
qemu_egl_rn_ctx);
|
||||
return qemu_egl_create_context(dgc, params);
|
||||
return qemu_egl_create_context(dgc, params, qemu_egl_rn_ctx);
|
||||
}
|
||||
|
||||
static void qemu_spice_gl_scanout_disable(DisplayChangeListener *dcl)
|
||||
|
||||
Reference in New Issue
Block a user