From nobody Tue Feb 10 11:34:33 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1647263057898512.5885770421992; Mon, 14 Mar 2022 06:04:17 -0700 (PDT) Received: from localhost ([::1]:60362 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nTkMy-0000hY-RR for importer@patchew.org; Mon, 14 Mar 2022 09:04:16 -0400 Received: from eggs.gnu.org ([209.51.188.92]:33398) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nTkIr-0003zv-8Y for qemu-devel@nongnu.org; Mon, 14 Mar 2022 09:00:01 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]:30300) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nTkIp-0002hV-Bw for qemu-devel@nongnu.org; Mon, 14 Mar 2022 09:00:00 -0400 Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-639-o0BBnAqiObi8pzulIaN6eA-1; Mon, 14 Mar 2022 08:59:57 -0400 Received: from smtp.corp.redhat.com (int-mx10.intmail.prod.int.rdu2.redhat.com [10.11.54.10]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 987FF811E90; Mon, 14 Mar 2022 12:59:56 +0000 (UTC) Received: from localhost (unknown [10.39.208.23]) by smtp.corp.redhat.com (Postfix) with ESMTP id 30C23463E09; Mon, 14 Mar 2022 12:59:54 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1647262798; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=U9wVa6sw0CubaKXc7NftByFtVH8+n30+depllMFwWyM=; b=GBKLueiKsPS+gwHdt2YFR1N11tYc9tjEH+4WFP4sdEb08ql/TdPfeLVql/8qYx8T8lK9fq vryvztBt96YabBu0P5FnoSPEXEKXK3P0VCL9HU6eMVs4qlfonO0CoyP+OmOtBYboIWZVgO UM1BxqitYhIkl604GYtsflGSHafgVtI= X-MC-Unique: o0BBnAqiObi8pzulIaN6eA-1 From: marcandre.lureau@redhat.com To: qemu-devel@nongnu.org Subject: [PULL 02/12] ui/console: move dcl compatiblity check to a callback Date: Mon, 14 Mar 2022 16:59:30 +0400 Message-Id: <20220314125940.1866728-3-marcandre.lureau@redhat.com> In-Reply-To: <20220314125940.1866728-1-marcandre.lureau@redhat.com> References: <20220314125940.1866728-1-marcandre.lureau@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.85 on 10.11.54.10 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=marcandre.lureau@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=170.10.129.124; envelope-from=marcandre.lureau@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -21 X-Spam_score: -2.2 X-Spam_bar: -- X-Spam_report: (-2.2 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.082, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: peter.maydell@linaro.org, kraxel@redhat.com, =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZM-MESSAGEID: 1647263059602100001 From: Marc-Andr=C3=A9 Lureau 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=C3=A9 Lureau Acked-by: Gerd Hoffmann --- include/ui/console.h | 9 ++------- ui/console.c | 3 ++- ui/dbus.c | 9 ++++++++- ui/egl-headless.c | 9 ++++++++- ui/gtk.c | 18 ++++++++++++++++-- ui/sdl2.c | 9 ++++++++- ui/spice-display.c | 9 ++++++++- 7 files changed, 52 insertions(+), 14 deletions(-) diff --git a/include/ui/console.h b/include/ui/console.h index f590819880b5..18a10c0b7db0 100644 --- a/include/ui/console.h +++ b/include/ui/console.h @@ -282,13 +282,8 @@ struct DisplayChangeListener { }; =20 typedef struct DisplayGLCtxOps { - /* - * We only check if the GLCtx is compatible with a DCL via ops. A natu= ral - * evolution of this would be a callback to check some runtime require= ments - * and allow various DCL kinds. - */ - const DisplayChangeListenerOps *compatible_dcl; - + bool (*dpy_gl_ctx_is_compatible_dcl)(DisplayGLCtx *dgc, + DisplayChangeListener *dcl); QEMUGLContext (*dpy_gl_ctx_create)(DisplayGLCtx *dgc, QEMUGLParams *params); void (*dpy_gl_ctx_destroy)(DisplayGLCtx *dgc, diff --git a/ui/console.c b/ui/console.c index 57e431d9e609..c9318552871b 100644 --- a/ui/console.c +++ b/ui/console.c @@ -1482,7 +1482,8 @@ static bool dpy_compatible_with(QemuConsole *con, =20 flags =3D con->hw_ops->get_flags ? con->hw_ops->get_flags(con->hw) : 0; =20 - if (console_has_gl(con) && con->gl->ops->compatible_dcl !=3D 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; diff --git a/ui/dbus.c b/ui/dbus.c index 0074424c1fed..f00a44421cf7 100644 --- a/ui/dbus.c +++ b/ui/dbus.c @@ -48,8 +48,15 @@ static QEMUGLContext dbus_create_context(DisplayGLCtx *d= gc, return qemu_egl_create_context(dgc, params); } =20 +static bool +dbus_is_compatible_dcl(DisplayGLCtx *dgc, + DisplayChangeListener *dcl) +{ + return dcl->ops =3D=3D &dbus_gl_dcl_ops; +} + static const DisplayGLCtxOps dbus_gl_ops =3D { - .compatible_dcl =3D &dbus_gl_dcl_ops, + .dpy_gl_ctx_is_compatible_dcl =3D dbus_is_compatible_dcl, .dpy_gl_ctx_create =3D dbus_create_context, .dpy_gl_ctx_destroy =3D qemu_egl_destroy_context, .dpy_gl_ctx_make_current =3D qemu_egl_make_context_current, diff --git a/ui/egl-headless.c b/ui/egl-headless.c index 94082a9da951..9aff115280bc 100644 --- a/ui/egl-headless.c +++ b/ui/egl-headless.c @@ -166,8 +166,15 @@ static const DisplayChangeListenerOps egl_ops =3D { .dpy_gl_update =3D egl_scanout_flush, }; =20 +static bool +egl_is_compatible_dcl(DisplayGLCtx *dgc, + DisplayChangeListener *dcl) +{ + return dcl->ops =3D=3D &egl_ops; +} + static const DisplayGLCtxOps eglctx_ops =3D { - .compatible_dcl =3D &egl_ops, + .dpy_gl_ctx_is_compatible_dcl =3D egl_is_compatible_dcl, .dpy_gl_ctx_create =3D egl_create_context, .dpy_gl_ctx_destroy =3D qemu_egl_destroy_context, .dpy_gl_ctx_make_current =3D qemu_egl_make_context_current, diff --git a/ui/gtk.c b/ui/gtk.c index a8567b9ddc8f..1b24a67d7964 100644 --- a/ui/gtk.c +++ b/ui/gtk.c @@ -614,8 +614,15 @@ static const DisplayChangeListenerOps dcl_gl_area_ops = =3D { .dpy_has_dmabuf =3D gd_has_dmabuf, }; =20 +static bool +gd_gl_area_is_compatible_dcl(DisplayGLCtx *dgc, + DisplayChangeListener *dcl) +{ + return dcl->ops =3D=3D &dcl_gl_area_ops; +} + static const DisplayGLCtxOps gl_area_ctx_ops =3D { - .compatible_dcl =3D &dcl_gl_area_ops, + .dpy_gl_ctx_is_compatible_dcl =3D gd_gl_area_is_compatible_dcl, .dpy_gl_ctx_create =3D gd_gl_area_create_context, .dpy_gl_ctx_destroy =3D gd_gl_area_destroy_context, .dpy_gl_ctx_make_current =3D gd_gl_area_make_current, @@ -641,8 +648,15 @@ static const DisplayChangeListenerOps dcl_egl_ops =3D { .dpy_has_dmabuf =3D gd_has_dmabuf, }; =20 +static bool +gd_egl_is_compatible_dcl(DisplayGLCtx *dgc, + DisplayChangeListener *dcl) +{ + return dcl->ops =3D=3D &dcl_egl_ops; +} + static const DisplayGLCtxOps egl_ctx_ops =3D { - .compatible_dcl =3D &dcl_egl_ops, + .dpy_gl_ctx_is_compatible_dcl =3D gd_egl_is_compatible_dcl, .dpy_gl_ctx_create =3D gd_egl_create_context, .dpy_gl_ctx_destroy =3D qemu_egl_destroy_context, .dpy_gl_ctx_make_current =3D gd_egl_make_current, diff --git a/ui/sdl2.c b/ui/sdl2.c index 46a252d7d9d7..d3741f9b754d 100644 --- a/ui/sdl2.c +++ b/ui/sdl2.c @@ -788,8 +788,15 @@ static const DisplayChangeListenerOps dcl_gl_ops =3D { .dpy_gl_update =3D sdl2_gl_scanout_flush, }; =20 +static bool +sdl2_gl_is_compatible_dcl(DisplayGLCtx *dgc, + DisplayChangeListener *dcl) +{ + return dcl->ops =3D=3D &dcl_gl_ops; +} + static const DisplayGLCtxOps gl_ctx_ops =3D { - .compatible_dcl =3D &dcl_gl_ops, + .dpy_gl_ctx_is_compatible_dcl =3D sdl2_gl_is_compatible_dcl, .dpy_gl_ctx_create =3D sdl2_gl_create_context, .dpy_gl_ctx_destroy =3D sdl2_gl_destroy_context, .dpy_gl_ctx_make_current =3D sdl2_gl_make_context_current, diff --git a/ui/spice-display.c b/ui/spice-display.c index a3078adf91ec..494168e7fe75 100644 --- a/ui/spice-display.c +++ b/ui/spice-display.c @@ -1125,8 +1125,15 @@ static const DisplayChangeListenerOps display_listen= er_gl_ops =3D { .dpy_gl_update =3D qemu_spice_gl_update, }; =20 +static bool +qemu_spice_is_compatible_dcl(DisplayGLCtx *dgc, + DisplayChangeListener *dcl) +{ + return dcl->ops =3D=3D &display_listener_gl_ops; +} + static const DisplayGLCtxOps gl_ctx_ops =3D { - .compatible_dcl =3D &display_listener_gl_ops, + .dpy_gl_ctx_is_compatible_dcl =3D qemu_spice_is_compatible_dcl, .dpy_gl_ctx_create =3D qemu_spice_gl_create_context, .dpy_gl_ctx_destroy =3D qemu_egl_destroy_context, .dpy_gl_ctx_make_current =3D qemu_egl_make_context_current, --=20 2.35.1.273.ge6ebfd0e8cbb