diff options
author | Marc-André Lureau <marcandre.lureau@redhat.com> | 2022-02-16 19:33:37 +0400 |
---|---|---|
committer | Marc-André Lureau <marcandre.lureau@redhat.com> | 2022-03-14 15:16:01 +0400 |
commit | a62c4a178fb154a3b810870502cb4c63a6b4cf28 (patch) | |
tree | c548b0ce1df3ec573a03a2335e8d17fd04289084 /ui | |
parent | 398d1c91ed58fb7fe3dd3e9596519678c816bb69 (diff) |
ui/console: move dcl compatiblity check to a callback
As expected from the "compatible_dcl" comment, a simple comparison of
ops isn't enough. The following patch will fix a regression introduced
by this limited check by extending the compatibility callback for
egl-headless.
For now, this patch simply replaces the the "compatible_dcl" ops pointer
with a "dpy_gl_ctx_is_compatible_ctx" callback.
Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Acked-by: Gerd Hoffmann <kraxel@redhat.com>
Diffstat (limited to 'ui')
-rw-r--r-- | ui/console.c | 3 | ||||
-rw-r--r-- | ui/dbus.c | 9 | ||||
-rw-r--r-- | ui/egl-headless.c | 9 | ||||
-rw-r--r-- | ui/gtk.c | 18 | ||||
-rw-r--r-- | ui/sdl2.c | 9 | ||||
-rw-r--r-- | ui/spice-display.c | 9 |
6 files changed, 50 insertions, 7 deletions
diff --git a/ui/console.c b/ui/console.c index 57e431d9e6..c931855287 100644 --- a/ui/console.c +++ b/ui/console.c @@ -1482,7 +1482,8 @@ static bool dpy_compatible_with(QemuConsole *con, flags = con->hw_ops->get_flags ? con->hw_ops->get_flags(con->hw) : 0; - if (console_has_gl(con) && con->gl->ops->compatible_dcl != dcl->ops) { + if (console_has_gl(con) && + !con->gl->ops->dpy_gl_ctx_is_compatible_dcl(con->gl, dcl)) { error_setg(errp, "Display %s is incompatible with the GL context", dcl->ops->dpy_name); return false; @@ -48,8 +48,15 @@ static QEMUGLContext dbus_create_context(DisplayGLCtx *dgc, return qemu_egl_create_context(dgc, params); } +static bool +dbus_is_compatible_dcl(DisplayGLCtx *dgc, + DisplayChangeListener *dcl) +{ + return dcl->ops == &dbus_gl_dcl_ops; +} + static const DisplayGLCtxOps dbus_gl_ops = { - .compatible_dcl = &dbus_gl_dcl_ops, + .dpy_gl_ctx_is_compatible_dcl = dbus_is_compatible_dcl, .dpy_gl_ctx_create = dbus_create_context, .dpy_gl_ctx_destroy = qemu_egl_destroy_context, .dpy_gl_ctx_make_current = qemu_egl_make_context_current, diff --git a/ui/egl-headless.c b/ui/egl-headless.c index 94082a9da9..9aff115280 100644 --- a/ui/egl-headless.c +++ b/ui/egl-headless.c @@ -166,8 +166,15 @@ static const DisplayChangeListenerOps egl_ops = { .dpy_gl_update = egl_scanout_flush, }; +static bool +egl_is_compatible_dcl(DisplayGLCtx *dgc, + DisplayChangeListener *dcl) +{ + return dcl->ops == &egl_ops; +} + static const DisplayGLCtxOps eglctx_ops = { - .compatible_dcl = &egl_ops, + .dpy_gl_ctx_is_compatible_dcl = egl_is_compatible_dcl, .dpy_gl_ctx_create = egl_create_context, .dpy_gl_ctx_destroy = qemu_egl_destroy_context, .dpy_gl_ctx_make_current = qemu_egl_make_context_current, @@ -614,8 +614,15 @@ static const DisplayChangeListenerOps dcl_gl_area_ops = { .dpy_has_dmabuf = gd_has_dmabuf, }; +static bool +gd_gl_area_is_compatible_dcl(DisplayGLCtx *dgc, + DisplayChangeListener *dcl) +{ + return dcl->ops == &dcl_gl_area_ops; +} + static const DisplayGLCtxOps gl_area_ctx_ops = { - .compatible_dcl = &dcl_gl_area_ops, + .dpy_gl_ctx_is_compatible_dcl = gd_gl_area_is_compatible_dcl, .dpy_gl_ctx_create = gd_gl_area_create_context, .dpy_gl_ctx_destroy = gd_gl_area_destroy_context, .dpy_gl_ctx_make_current = gd_gl_area_make_current, @@ -641,8 +648,15 @@ static const DisplayChangeListenerOps dcl_egl_ops = { .dpy_has_dmabuf = gd_has_dmabuf, }; +static bool +gd_egl_is_compatible_dcl(DisplayGLCtx *dgc, + DisplayChangeListener *dcl) +{ + return dcl->ops == &dcl_egl_ops; +} + static const DisplayGLCtxOps egl_ctx_ops = { - .compatible_dcl = &dcl_egl_ops, + .dpy_gl_ctx_is_compatible_dcl = gd_egl_is_compatible_dcl, .dpy_gl_ctx_create = gd_egl_create_context, .dpy_gl_ctx_destroy = qemu_egl_destroy_context, .dpy_gl_ctx_make_current = gd_egl_make_current, @@ -788,8 +788,15 @@ static const DisplayChangeListenerOps dcl_gl_ops = { .dpy_gl_update = sdl2_gl_scanout_flush, }; +static bool +sdl2_gl_is_compatible_dcl(DisplayGLCtx *dgc, + DisplayChangeListener *dcl) +{ + return dcl->ops == &dcl_gl_ops; +} + static const DisplayGLCtxOps gl_ctx_ops = { - .compatible_dcl = &dcl_gl_ops, + .dpy_gl_ctx_is_compatible_dcl = sdl2_gl_is_compatible_dcl, .dpy_gl_ctx_create = sdl2_gl_create_context, .dpy_gl_ctx_destroy = sdl2_gl_destroy_context, .dpy_gl_ctx_make_current = sdl2_gl_make_context_current, diff --git a/ui/spice-display.c b/ui/spice-display.c index a3078adf91..494168e7fe 100644 --- a/ui/spice-display.c +++ b/ui/spice-display.c @@ -1125,8 +1125,15 @@ static const DisplayChangeListenerOps display_listener_gl_ops = { .dpy_gl_update = qemu_spice_gl_update, }; +static bool +qemu_spice_is_compatible_dcl(DisplayGLCtx *dgc, + DisplayChangeListener *dcl) +{ + return dcl->ops == &display_listener_gl_ops; +} + static const DisplayGLCtxOps gl_ctx_ops = { - .compatible_dcl = &display_listener_gl_ops, + .dpy_gl_ctx_is_compatible_dcl = qemu_spice_is_compatible_dcl, .dpy_gl_ctx_create = qemu_spice_gl_create_context, .dpy_gl_ctx_destroy = qemu_egl_destroy_context, .dpy_gl_ctx_make_current = qemu_egl_make_context_current, |