From a62c4a178fb154a3b810870502cb4c63a6b4cf28 Mon Sep 17 00:00:00 2001 From: Marc-André Lureau Date: Wed, 16 Feb 2022 19:33:37 +0400 Subject: 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 Acked-by: Gerd Hoffmann --- ui/sdl2.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'ui/sdl2.c') diff --git a/ui/sdl2.c b/ui/sdl2.c index 46a252d7d9..d3741f9b75 100644 --- a/ui/sdl2.c +++ b/ui/sdl2.c @@ -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, -- cgit v1.2.3-55-g7522