From nobody Mon Feb 9 14:24:15 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 1647263177765543.935592912007; Mon, 14 Mar 2022 06:06:17 -0700 (PDT) Received: from localhost ([::1]:36930 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nTkOu-0004Mu-Ev for importer@patchew.org; Mon, 14 Mar 2022 09:06:16 -0400 Received: from eggs.gnu.org ([209.51.188.92]:33348) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nTkIn-0003rb-7H for qemu-devel@nongnu.org; Mon, 14 Mar 2022 08:59:57 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]:52821) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nTkIj-0002gU-LU for qemu-devel@nongnu.org; Mon, 14 Mar 2022 08:59:55 -0400 Received: from mimecast-mx02.redhat.com (mx3-rdu2.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-275-zW-18vqVPbGkFskrvigyMA-1; Mon, 14 Mar 2022 08:59:51 -0400 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.rdu2.redhat.com [10.11.54.2]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 4C45D1C05AA9; Mon, 14 Mar 2022 12:59:51 +0000 (UTC) Received: from localhost (unknown [10.39.208.23]) by smtp.corp.redhat.com (Postfix) with ESMTP id 084CE407EE62; Mon, 14 Mar 2022 12:59:49 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1647262792; 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=C2YIpCtdcHjni3WzUJsX14EQ+6PQzw597u7Usputo7M=; b=gujvLz8GEaDjCa9GHdbTuh4LobjJpdJhoc4dts26R8+dAlUIPj7rH4gv05msjFrs+u0b1X V343MQvNycWGBnYt5eto9ow2+lhtzw3lPvZaRlTbpHXMahtN/WjDvIhEaqNGYMvuHlYdS/ ohy5l0bdOYXLqkB7F2aie1gbfZNstWo= X-MC-Unique: zW-18vqVPbGkFskrvigyMA-1 From: marcandre.lureau@redhat.com To: qemu-devel@nongnu.org Subject: [PULL 01/12] ui/console: move check for compatible GL context Date: Mon, 14 Mar 2022 16:59:29 +0400 Message-Id: <20220314125940.1866728-2-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.84 on 10.11.54.2 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: 1647263179398100001 From: Marc-Andr=C3=A9 Lureau Move GL context compatibility check in dpy_compatible_with(), and use recommended error reporting. Signed-off-by: Marc-Andr=C3=A9 Lureau Acked-by: Gerd Hoffmann --- ui/console.c | 21 ++++++--------------- 1 file changed, 6 insertions(+), 15 deletions(-) diff --git a/ui/console.c b/ui/console.c index 365a2c14b809..57e431d9e609 100644 --- a/ui/console.c +++ b/ui/console.c @@ -1482,6 +1482,12 @@ 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)= { + error_setg(errp, "Display %s is incompatible with the GL context", + dcl->ops->dpy_name); + return false; + } + if (flags & GRAPHIC_FLAGS_GL && !console_has_gl(con)) { error_setg(errp, "The console requires a GL context."); @@ -1509,27 +1515,12 @@ void qemu_console_set_display_gl_ctx(QemuConsole *c= on, DisplayGLCtx *gl) con->gl =3D gl; } =20 -static bool dpy_gl_compatible_with(QemuConsole *con, DisplayChangeListener= *dcl) -{ - if (!con->gl) { - return true; - } - - return con->gl->ops->compatible_dcl =3D=3D dcl->ops; -} - void register_displaychangelistener(DisplayChangeListener *dcl) { QemuConsole *con; =20 assert(!dcl->ds); =20 - if (dcl->con && !dpy_gl_compatible_with(dcl->con, dcl)) { - error_report("Display %s is incompatible with the GL context", - dcl->ops->dpy_name); - exit(1); - } - if (dcl->con) { dpy_compatible_with(dcl->con, dcl, &error_fatal); } --=20 2.35.1.273.ge6ebfd0e8cbb From nobody Mon Feb 9 14:24:15 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 From nobody Mon Feb 9 14:24:15 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 1647263261624240.1098260331422; Mon, 14 Mar 2022 06:07:41 -0700 (PDT) Received: from localhost ([::1]:40366 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nTkQH-0006oX-Rv for importer@patchew.org; Mon, 14 Mar 2022 09:07:41 -0400 Received: from eggs.gnu.org ([209.51.188.92]:33450) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nTkIx-0004BJ-TN for qemu-devel@nongnu.org; Mon, 14 Mar 2022 09:00:07 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]:30674) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nTkIw-0002uq-3c for qemu-devel@nongnu.org; Mon, 14 Mar 2022 09:00:07 -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-540--SPSFMBjNbWZWntzB8znnA-1; Mon, 14 Mar 2022 09:00:04 -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 9694F899ED8; Mon, 14 Mar 2022 13:00:03 +0000 (UTC) Received: from localhost (unknown [10.39.208.23]) by smtp.corp.redhat.com (Postfix) with ESMTP id EC189463E06; Mon, 14 Mar 2022 13:00:01 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1647262805; 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=AbbUg//qRoFA4XnRL+atwQNCbvmj6ejSuiXPrARpYxE=; b=UCFP5dXnlvR/tWsou2uxsBlcm0HdNHzFLt+2mLJ33e00rRShyFC157EpeqWA4GDEcQ9ARX XHwMZibL3++jrJHXT+afr/YIbGru2gQoQc2CKa8VPmM2eVp8cw5A/iL8NIiKGE99RM+S/n oEjgR0ZP98BlSWxuTdUWVMQA+jRvPq8= X-MC-Unique: -SPSFMBjNbWZWntzB8znnA-1 From: marcandre.lureau@redhat.com To: qemu-devel@nongnu.org Subject: [PULL 03/12] ui/console: egl-headless is compatible with non-gl listeners Date: Mon, 14 Mar 2022 16:59:31 +0400 Message-Id: <20220314125940.1866728-4-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.133.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, RCVD_IN_MSPIKE_H5=0.001, RCVD_IN_MSPIKE_WL=0.001, 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: 1647263281973100001 From: Marc-Andr=C3=A9 Lureau Fix a regression introduced by commit 5e79d516e ("ui: split the GL context in a different object"). Reported-by: Akihiko Odaki Signed-off-by: Marc-Andr=C3=A9 Lureau Acked-by: Gerd Hoffmann --- ui/egl-headless.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/ui/egl-headless.c b/ui/egl-headless.c index 9aff115280bc..7a30fd977765 100644 --- a/ui/egl-headless.c +++ b/ui/egl-headless.c @@ -170,6 +170,14 @@ static bool egl_is_compatible_dcl(DisplayGLCtx *dgc, DisplayChangeListener *dcl) { + if (!dcl->ops->dpy_gl_update) { + /* + * egl-headless is compatible with all 2d listeners, as it blits t= he GL + * updates on the 2d console surface. + */ + return true; + } + return dcl->ops =3D=3D &egl_ops; } =20 --=20 2.35.1.273.ge6ebfd0e8cbb From nobody Mon Feb 9 14:24:15 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 1647263380637912.9463004567646; Mon, 14 Mar 2022 06:09:40 -0700 (PDT) Received: from localhost ([::1]:47582 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nTkSC-0002tl-PO for importer@patchew.org; Mon, 14 Mar 2022 09:09:40 -0400 Received: from eggs.gnu.org ([209.51.188.92]:33508) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nTkJ5-0004J5-Il for qemu-devel@nongnu.org; Mon, 14 Mar 2022 09:00:16 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]:31688) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nTkJ3-0002vy-M8 for qemu-devel@nongnu.org; Mon, 14 Mar 2022 09:00:15 -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-557-hnf9Dvj_Mxq8MBwBVZiUBQ-1; Mon, 14 Mar 2022 09:00:09 -0400 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.rdu2.redhat.com [10.11.54.2]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id ADFB818A6585; Mon, 14 Mar 2022 13:00:08 +0000 (UTC) Received: from localhost (unknown [10.39.208.23]) by smtp.corp.redhat.com (Postfix) with ESMTP id 8B677407EE73; Mon, 14 Mar 2022 13:00:07 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1647262812; 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=VTLNQ2w+rMItS2fOJeJOBwWN+fp7niRU59e/o1Jngm4=; b=CqLuH7NHhBc4xR28Tc06ojMzKyHgWvmkHr1QSd7A2py/CKbryhOHtFVaIp1hOuqGHu2g5R 1w/vTscyvH370UsDQTXf4pZWSjPlbF3JX4znXO8ty9HCkpcy/MTVizaMFJZY47Lx07cTj7 yOR0ZfrqftdMJ6+LLemWMttyqcnKHa8= X-MC-Unique: hnf9Dvj_Mxq8MBwBVZiUBQ-1 From: marcandre.lureau@redhat.com To: qemu-devel@nongnu.org Subject: [PULL 04/12] ui/dbus: associate the DBusDisplayConsole listener with the given console Date: Mon, 14 Mar 2022 16:59:32 +0400 Message-Id: <20220314125940.1866728-5-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.84 on 10.11.54.2 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: 1647263403274100001 From: Marc-Andr=C3=A9 Lureau DBusDisplayConsole is specific to a given QemuConsole. Fixes: commit 142ca628 ("ui: add a D-Bus display backend") Reported-by: Akihiko Odaki Signed-off-by: Marc-Andr=C3=A9 Lureau Acked-by: Gerd Hoffmann --- ui/dbus.h | 3 +++ ui/dbus-console.c | 27 +++++++++++++-------------- ui/dbus.c | 2 +- 3 files changed, 17 insertions(+), 15 deletions(-) diff --git a/ui/dbus.h b/ui/dbus.h index 64c77cab4441..5f5c1f759c9b 100644 --- a/ui/dbus.h +++ b/ui/dbus.h @@ -79,6 +79,9 @@ dbus_display_console_new(DBusDisplay *display, QemuConsol= e *con); int dbus_display_console_get_index(DBusDisplayConsole *ddc); =20 + +extern const DisplayChangeListenerOps dbus_console_dcl_ops; + #define DBUS_DISPLAY_TYPE_LISTENER dbus_display_listener_get_type() G_DECLARE_FINAL_TYPE(DBusDisplayListener, dbus_display_listener, diff --git a/ui/dbus-console.c b/ui/dbus-console.c index e062f721d761..898a4ac8a5ba 100644 --- a/ui/dbus-console.c +++ b/ui/dbus-console.c @@ -36,7 +36,6 @@ struct _DBusDisplayConsole { DisplayChangeListener dcl; =20 DBusDisplay *display; - QemuConsole *con; GHashTable *listeners; QemuDBusDisplay1Console *iface; =20 @@ -118,7 +117,7 @@ dbus_gl_scanout_update(DisplayChangeListener *dcl, { } =20 -static const DisplayChangeListenerOps dbus_console_dcl_ops =3D { +const DisplayChangeListenerOps dbus_console_dcl_ops =3D { .dpy_name =3D "dbus-console", .dpy_gfx_switch =3D dbus_gfx_switch, .dpy_gfx_update =3D dbus_gfx_update, @@ -191,7 +190,7 @@ dbus_console_set_ui_info(DBusDisplayConsole *ddc, .height =3D arg_height, }; =20 - if (!dpy_ui_info_supported(ddc->con)) { + if (!dpy_ui_info_supported(ddc->dcl.con)) { g_dbus_method_invocation_return_error(invocation, DBUS_DISPLAY_ERROR, DBUS_DISPLAY_ERROR_UNSUPPORT= ED, @@ -199,7 +198,7 @@ dbus_console_set_ui_info(DBusDisplayConsole *ddc, return DBUS_METHOD_INVOCATION_HANDLED; } =20 - dpy_set_ui_info(ddc->con, &info, false); + dpy_set_ui_info(ddc->dcl.con, &info, false); qemu_dbus_display1_console_complete_set_uiinfo(ddc->iface, invocation); return DBUS_METHOD_INVOCATION_HANDLED; } @@ -335,8 +334,8 @@ dbus_mouse_rel_motion(DBusDisplayConsole *ddc, return DBUS_METHOD_INVOCATION_HANDLED; } =20 - qemu_input_queue_rel(ddc->con, INPUT_AXIS_X, dx); - qemu_input_queue_rel(ddc->con, INPUT_AXIS_Y, dy); + qemu_input_queue_rel(ddc->dcl.con, INPUT_AXIS_X, dx); + qemu_input_queue_rel(ddc->dcl.con, INPUT_AXIS_Y, dy); qemu_input_event_sync(); =20 qemu_dbus_display1_mouse_complete_rel_motion(ddc->iface_mouse, @@ -362,8 +361,8 @@ dbus_mouse_set_pos(DBusDisplayConsole *ddc, return DBUS_METHOD_INVOCATION_HANDLED; } =20 - width =3D qemu_console_get_width(ddc->con, 0); - height =3D qemu_console_get_height(ddc->con, 0); + width =3D qemu_console_get_width(ddc->dcl.con, 0); + height =3D qemu_console_get_height(ddc->dcl.con, 0); if (x >=3D width || y >=3D height) { g_dbus_method_invocation_return_error( invocation, DBUS_DISPLAY_ERROR, @@ -371,8 +370,8 @@ dbus_mouse_set_pos(DBusDisplayConsole *ddc, "Invalid mouse position"); return DBUS_METHOD_INVOCATION_HANDLED; } - qemu_input_queue_abs(ddc->con, INPUT_AXIS_X, x, 0, width); - qemu_input_queue_abs(ddc->con, INPUT_AXIS_Y, y, 0, height); + qemu_input_queue_abs(ddc->dcl.con, INPUT_AXIS_X, x, 0, width); + qemu_input_queue_abs(ddc->dcl.con, INPUT_AXIS_Y, y, 0, height); qemu_input_event_sync(); =20 qemu_dbus_display1_mouse_complete_set_abs_position(ddc->iface_mouse, @@ -388,7 +387,7 @@ dbus_mouse_press(DBusDisplayConsole *ddc, { trace_dbus_mouse_press(button); =20 - qemu_input_queue_btn(ddc->con, button, true); + qemu_input_queue_btn(ddc->dcl.con, button, true); qemu_input_event_sync(); =20 qemu_dbus_display1_mouse_complete_press(ddc->iface_mouse, invocation); @@ -403,7 +402,7 @@ dbus_mouse_release(DBusDisplayConsole *ddc, { trace_dbus_mouse_release(button); =20 - qemu_input_queue_btn(ddc->con, button, false); + qemu_input_queue_btn(ddc->dcl.con, button, false); qemu_input_event_sync(); =20 qemu_dbus_display1_mouse_complete_release(ddc->iface_mouse, invocation= ); @@ -424,7 +423,7 @@ dbus_mouse_mode_change(Notifier *notify, void *data) =20 int dbus_display_console_get_index(DBusDisplayConsole *ddc) { - return qemu_console_get_index(ddc->con); + return qemu_console_get_index(ddc->dcl.con); } =20 DBusDisplayConsole * @@ -446,7 +445,7 @@ dbus_display_console_new(DBusDisplay *display, QemuCons= ole *con) "g-object-path", path, NULL); ddc->display =3D display; - ddc->con =3D con; + ddc->dcl.con =3D con; /* handle errors, and skip non graphics? */ qemu_console_fill_device_address( con, device_addr, sizeof(device_addr), NULL); diff --git a/ui/dbus.c b/ui/dbus.c index f00a44421cf7..22c82d2f323a 100644 --- a/ui/dbus.c +++ b/ui/dbus.c @@ -52,7 +52,7 @@ static bool dbus_is_compatible_dcl(DisplayGLCtx *dgc, DisplayChangeListener *dcl) { - return dcl->ops =3D=3D &dbus_gl_dcl_ops; + return dcl->ops =3D=3D &dbus_gl_dcl_ops || dcl->ops =3D=3D &dbus_conso= le_dcl_ops; } =20 static const DisplayGLCtxOps dbus_gl_ops =3D { --=20 2.35.1.273.ge6ebfd0e8cbb From nobody Mon Feb 9 14:24:15 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 1647263009322578.1612335061599; Mon, 14 Mar 2022 06:03:29 -0700 (PDT) Received: from localhost ([::1]:58154 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nTkMB-0007Xi-Vo for importer@patchew.org; Mon, 14 Mar 2022 09:03:28 -0400 Received: from eggs.gnu.org ([209.51.188.92]:33536) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nTkJ7-0004Ja-89 for qemu-devel@nongnu.org; Mon, 14 Mar 2022 09:00:21 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]:22434) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nTkJ5-0002xk-EB for qemu-devel@nongnu.org; Mon, 14 Mar 2022 09:00:16 -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-380-vCIaZXn6MaKozqjfIjtTKA-1; Mon, 14 Mar 2022 09:00:13 -0400 Received: from smtp.corp.redhat.com (int-mx09.intmail.prod.int.rdu2.redhat.com [10.11.54.9]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 68139802319; Mon, 14 Mar 2022 13:00:13 +0000 (UTC) Received: from localhost (unknown [10.39.208.23]) by smtp.corp.redhat.com (Postfix) with ESMTP id 2C039674C68; Mon, 14 Mar 2022 13:00:11 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1647262814; 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=QR1CwZ64IIIxQL/lJwTdtyD/ZBJy8+qjCBYnTNCFmZo=; b=dc1BLGbNmtXc1nhB0prWMcqXaguh5DYumWOjlfcPOAJVXGG6dZWUOBs0VLpigQjUK8Xh1A 5NOiVbX9OXjErhWMzHLoT/enuoPcT6F+1D8z26pRcWgqZCJ1/m3wen8Y8KFTBrJucX97Tv B/iVKhI+eCdEvmehEU+hdGsWM9Blabk= X-MC-Unique: vCIaZXn6MaKozqjfIjtTKA-1 From: marcandre.lureau@redhat.com To: qemu-devel@nongnu.org Subject: [PULL 05/12] ui/console: move console compatibility check to dcl_display_console() Date: Mon, 14 Mar 2022 16:59:33 +0400 Message-Id: <20220314125940.1866728-6-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.9 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.133.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, RCVD_IN_MSPIKE_H5=0.001, RCVD_IN_MSPIKE_WL=0.001, 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: 1647263011502100001 From: Marc-Andr=C3=A9 Lureau The current checks are done at registration time only. However, if a DCL has no specific console specified, it may be switched dynamically with console_select() later on. Let's move the checks when displaychangelistener_display_console() is called, which includes registration time and remains fatal if the specified console is incompatible. Note: we may want to display the compatibility error to the DCL, this is left for a future improvement. Signed-off-by: Marc-Andr=C3=A9 Lureau Acked-by: Gerd Hoffmann --- ui/console.c | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) diff --git a/ui/console.c b/ui/console.c index c9318552871b..d3ecbb215736 100644 --- a/ui/console.c +++ b/ui/console.c @@ -148,6 +148,8 @@ static DisplayState *get_alloc_displaystate(void); static void text_console_update_cursor_timer(void); static void text_console_update_cursor(void *opaque); static bool displaychangelistener_has_dmabuf(DisplayChangeListener *dcl); +static bool console_compatible_with(QemuConsole *con, + DisplayChangeListener *dcl, Error **er= rp); =20 static void gui_update(void *opaque) { @@ -1057,13 +1059,14 @@ static void console_putchar(QemuConsole *s, int ch) } =20 static void displaychangelistener_display_console(DisplayChangeListener *d= cl, - QemuConsole *con) + QemuConsole *con, + Error **errp) { static const char nodev[] =3D "This VM has no graphic display device."; static DisplaySurface *dummy; =20 - if (!con) { + if (!con || !console_compatible_with(con, dcl, errp)) { if (!dcl->ops->dpy_gfx_switch) { return; } @@ -1114,7 +1117,7 @@ void console_select(unsigned int index) if (dcl->con !=3D NULL) { continue; } - displaychangelistener_display_console(dcl, s); + displaychangelistener_display_console(dcl, s, NULL); } } if (ds->have_text) { @@ -1475,8 +1478,8 @@ static bool displaychangelistener_has_dmabuf(DisplayC= hangeListener *dcl) return false; } =20 -static bool dpy_compatible_with(QemuConsole *con, - DisplayChangeListener *dcl, Error **errp) +static bool console_compatible_with(QemuConsole *con, + DisplayChangeListener *dcl, Error **er= rp) { int flags; =20 @@ -1522,10 +1525,6 @@ void register_displaychangelistener(DisplayChangeLis= tener *dcl) =20 assert(!dcl->ds); =20 - if (dcl->con) { - dpy_compatible_with(dcl->con, dcl, &error_fatal); - } - trace_displaychangelistener_register(dcl, dcl->ops->dpy_name); dcl->ds =3D get_alloc_displaystate(); QLIST_INSERT_HEAD(&dcl->ds->listeners, dcl, next); @@ -1536,7 +1535,7 @@ void register_displaychangelistener(DisplayChangeList= ener *dcl) } else { con =3D active_console; } - displaychangelistener_display_console(dcl, con); + displaychangelistener_display_console(dcl, con, dcl->con ? &error_fata= l : NULL); text_console_update_cursor(NULL); } =20 --=20 2.35.1.273.ge6ebfd0e8cbb From nobody Mon Feb 9 14:24:15 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 1647263200500607.7803045465865; Mon, 14 Mar 2022 06:06:40 -0700 (PDT) Received: from localhost ([::1]:38288 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nTkPH-0005OC-DO for importer@patchew.org; Mon, 14 Mar 2022 09:06:39 -0400 Received: from eggs.gnu.org ([209.51.188.92]:33590) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nTkJE-0004Kr-Vj for qemu-devel@nongnu.org; Mon, 14 Mar 2022 09:00:25 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]:22653) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nTkJD-00031a-DJ for qemu-devel@nongnu.org; Mon, 14 Mar 2022 09:00:24 -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-574-3Q-Oc8UcOcm1TszVoBKS7A-1; Mon, 14 Mar 2022 09:00:19 -0400 Received: from smtp.corp.redhat.com (int-mx09.intmail.prod.int.rdu2.redhat.com [10.11.54.9]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 591F9802E5B; Mon, 14 Mar 2022 13:00:19 +0000 (UTC) Received: from localhost (unknown [10.39.208.23]) by smtp.corp.redhat.com (Postfix) with ESMTP id 35F16674C63; Mon, 14 Mar 2022 13:00:17 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1647262822; 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=Ow2T12UgMkr9jPaFKMWSsZHcAQuUHyxTS6a7PG+DSSE=; b=BYkXlerFJ0uLxLUnE0cq26zpvHESWxUquP7VE4LLPTnjgLxbfrUfKgzIQM8mknK24Zt+4P qWl+PN4xRKUgbmmf5GBcHJjsT5g/Buzcr8Q5YEk2jxI0/uj4yeerEVxSljIrQzlwdD4hbo KDEIxtks/VS7CfnDt1W+NfisEnvcu5Q= X-MC-Unique: 3Q-Oc8UcOcm1TszVoBKS7A-1 From: marcandre.lureau@redhat.com To: qemu-devel@nongnu.org Subject: [PULL 06/12] ui/shader: fix potential leak of shader on error Date: Mon, 14 Mar 2022 16:59:34 +0400 Message-Id: <20220314125940.1866728-7-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.9 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.133.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, RCVD_IN_MSPIKE_H5=0.001, RCVD_IN_MSPIKE_WL=0.001, 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: 1647263201675100001 From: Marc-Andr=C3=A9 Lureau Value of 0 for program and shaders are silently ignored and indicate error. Signed-off-by: Marc-Andr=C3=A9 Lureau Acked-by: Gerd Hoffmann --- ui/shader.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/ui/shader.c b/ui/shader.c index e8b8d321b7c7..4c80fc831f68 100644 --- a/ui/shader.c +++ b/ui/shader.c @@ -130,15 +130,17 @@ static GLuint qemu_gl_create_link_program(GLuint vert= , GLuint frag) static GLuint qemu_gl_create_compile_link_program(const GLchar *vert_src, const GLchar *frag_src) { - GLuint vert_shader, frag_shader, program; + GLuint vert_shader, frag_shader, program =3D 0; =20 vert_shader =3D qemu_gl_create_compile_shader(GL_VERTEX_SHADER, vert_s= rc); frag_shader =3D qemu_gl_create_compile_shader(GL_FRAGMENT_SHADER, frag= _src); if (!vert_shader || !frag_shader) { - return 0; + goto end; } =20 program =3D qemu_gl_create_link_program(vert_shader, frag_shader); + +end: glDeleteShader(vert_shader); glDeleteShader(frag_shader); =20 --=20 2.35.1.273.ge6ebfd0e8cbb From nobody Mon Feb 9 14:24:15 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 1647265007014223.75064770520555; Mon, 14 Mar 2022 06:36:47 -0700 (PDT) Received: from localhost ([::1]:34090 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nTksQ-0004Xv-2J for importer@patchew.org; Mon, 14 Mar 2022 09:36:46 -0400 Received: from eggs.gnu.org ([209.51.188.92]:33646) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nTkJQ-0004cu-Ky for qemu-devel@nongnu.org; Mon, 14 Mar 2022 09:00:40 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]:25707) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nTkJL-00035g-7C for qemu-devel@nongnu.org; Mon, 14 Mar 2022 09:00:36 -0400 Received: from mimecast-mx02.redhat.com (mx3-rdu2.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-594-jiYfGSIuPdqenLjircVpqQ-1; Mon, 14 Mar 2022 09:00:26 -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 34C532A59551; Mon, 14 Mar 2022 13:00:24 +0000 (UTC) Received: from localhost (unknown [10.39.208.23]) by smtp.corp.redhat.com (Postfix) with ESMTP id 0737A463E09; Mon, 14 Mar 2022 13:00:22 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1647262830; 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=on+QivKNbw7lTPMy4nZ7fYb5ygJ0+hgyP/MxoKhQfG8=; b=cD8XtZbFEDNPFLt1oUgZrDE37I6wLlAhlYdzG+pt/gK6fPx8WFxf2vNsDk4XOxdft9L5Jt NX3bn4nRptYmRTrD6loV8GldCV5/N2IZxXUoSuMUNcLi1MqUL/5TBNJ0GeTdmuAUREbYVB 49kd6gHVgx6rO1Dlyf4sCV893wXNw1k= X-MC-Unique: jiYfGSIuPdqenLjircVpqQ-1 From: marcandre.lureau@redhat.com To: qemu-devel@nongnu.org Subject: [PULL 07/12] ui/shader: free associated programs Date: Mon, 14 Mar 2022 16:59:35 +0400 Message-Id: <20220314125940.1866728-8-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.133.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, RCVD_IN_MSPIKE_H5=0.001, RCVD_IN_MSPIKE_WL=0.001, 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: 1647265007425100001 From: Marc-Andr=C3=A9 Lureau Signed-off-by: Marc-Andr=C3=A9 Lureau Acked-by: Gerd Hoffmann --- ui/shader.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/ui/shader.c b/ui/shader.c index 4c80fc831f68..ab448c41d4c6 100644 --- a/ui/shader.c +++ b/ui/shader.c @@ -172,5 +172,8 @@ void qemu_gl_fini_shader(QemuGLShader *gls) if (!gls) { return; } + glDeleteProgram(gls->texture_blit_prog); + glDeleteProgram(gls->texture_blit_flip_prog); + glDeleteProgram(gls->texture_blit_vao); g_free(gls); } --=20 2.35.1.273.ge6ebfd0e8cbb From nobody Mon Feb 9 14:24:15 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 1647263548231967.5267372701081; Mon, 14 Mar 2022 06:12:28 -0700 (PDT) Received: from localhost ([::1]:53742 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nTkUu-0006nJ-9d for importer@patchew.org; Mon, 14 Mar 2022 09:12:28 -0400 Received: from eggs.gnu.org ([209.51.188.92]:33618) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nTkJO-0004ao-Gu for qemu-devel@nongnu.org; Mon, 14 Mar 2022 09:00:35 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]:41603) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nTkJM-00035k-KO for qemu-devel@nongnu.org; Mon, 14 Mar 2022 09:00:34 -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-53-AHJx6glLNhGMP0brwlT4nA-1; Mon, 14 Mar 2022 09:00:30 -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 939AC8041AF; Mon, 14 Mar 2022 13:00:29 +0000 (UTC) Received: from localhost (unknown [10.39.208.23]) by smtp.corp.redhat.com (Postfix) with ESMTP id 79DAF4644ED; Mon, 14 Mar 2022 13:00:28 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1647262832; 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=v099OcPbOtt9k+lcjiDiAouQgYElAzCtF1EUPr0juPk=; b=iO7Gw4iyyBiC2G6aIDkCl51Uuy5mr+hs0sdat13iEz5WuMncgtkgmB6tXWpXD0MFuyWA1g VTmf45LORSyyDIp2uiD1xcZw5fT8Af75MTScG6qQ3tHI3t8ZNjvzdfGTaYn+Cc3sgGlACJ D7NfMYMC2umB1S1TvJii2cmrtpMC5g8= X-MC-Unique: AHJx6glLNhGMP0brwlT4nA-1 From: marcandre.lureau@redhat.com To: qemu-devel@nongnu.org Subject: [PULL 08/12] ui/console: add a dpy_gfx_switch callback helper Date: Mon, 14 Mar 2022 16:59:36 +0400 Message-Id: <20220314125940.1866728-9-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: 1647263554564100001 From: Marc-Andr=C3=A9 Lureau Slight code improvement. Signed-off-by: Marc-Andr=C3=A9 Lureau Acked-by: Gerd Hoffmann --- ui/console.c | 23 +++++++++++++---------- 1 file changed, 13 insertions(+), 10 deletions(-) diff --git a/ui/console.c b/ui/console.c index d3ecbb215736..102fcf0a5068 100644 --- a/ui/console.c +++ b/ui/console.c @@ -1058,6 +1058,15 @@ static void console_putchar(QemuConsole *s, int ch) } } =20 +static void displaychangelistener_gfx_switch(DisplayChangeListener *dcl, + struct DisplaySurface *new_su= rface) +{ + if (dcl->ops->dpy_gfx_switch) { + dcl->ops->dpy_gfx_switch(dcl, new_surface); + } +} + + static void displaychangelistener_display_console(DisplayChangeListener *d= cl, QemuConsole *con, Error **errp) @@ -1067,13 +1076,10 @@ static void displaychangelistener_display_console(D= isplayChangeListener *dcl, static DisplaySurface *dummy; =20 if (!con || !console_compatible_with(con, dcl, errp)) { - if (!dcl->ops->dpy_gfx_switch) { - return; - } if (!dummy) { dummy =3D qemu_create_placeholder_surface(640, 480, nodev); } - dcl->ops->dpy_gfx_switch(dcl, dummy); + displaychangelistener_gfx_switch(dcl, dummy); return; } =20 @@ -1091,9 +1097,8 @@ static void displaychangelistener_display_console(Dis= playChangeListener *dcl, con->scanout.texture.y, con->scanout.texture.width, con->scanout.texture.height); - } else if (con->scanout.kind =3D=3D SCANOUT_SURFACE && - dcl->ops->dpy_gfx_switch) { - dcl->ops->dpy_gfx_switch(dcl, con->surface); + } else if (con->scanout.kind =3D=3D SCANOUT_SURFACE) { + displaychangelistener_gfx_switch(dcl, con->surface); } =20 dcl->ops->dpy_gfx_update(dcl, 0, 0, @@ -1677,9 +1682,7 @@ void dpy_gfx_replace_surface(QemuConsole *con, if (con !=3D (dcl->con ? dcl->con : active_console)) { continue; } - if (dcl->ops->dpy_gfx_switch) { - dcl->ops->dpy_gfx_switch(dcl, surface); - } + displaychangelistener_gfx_switch(dcl, surface); } qemu_free_displaysurface(old_surface); } --=20 2.35.1.273.ge6ebfd0e8cbb From nobody Mon Feb 9 14:24:15 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 1647263053609741.3179237702728; Mon, 14 Mar 2022 06:04:13 -0700 (PDT) Received: from localhost ([::1]:59926 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nTkMu-0000OS-IS for importer@patchew.org; Mon, 14 Mar 2022 09:04:12 -0400 Received: from eggs.gnu.org ([209.51.188.92]:33678) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nTkJU-0004dg-G2 for qemu-devel@nongnu.org; Mon, 14 Mar 2022 09:00:42 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]:52659) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nTkJS-000377-W0 for qemu-devel@nongnu.org; Mon, 14 Mar 2022 09:00:40 -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-556-dRh4TEcSO1uI8zU2HXZr1Q-1; Mon, 14 Mar 2022 09:00:37 -0400 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.rdu2.redhat.com [10.11.54.8]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 69DB8183B3C5; Mon, 14 Mar 2022 13:00:34 +0000 (UTC) Received: from localhost (unknown [10.39.208.23]) by smtp.corp.redhat.com (Postfix) with ESMTP id 5B393C53214; Mon, 14 Mar 2022 13:00:32 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1647262838; 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=iAVXlPNa+jsMgCn8+FeHE/cMBbWsepJZw/rNFvwgHHQ=; b=MSf+9DGVQK5bJQfavVuYHVnSSc1KclNjONKoborTx0dW3iP6gneGsH2WF6hYxako7srRM4 elaiP0JoAROKAIwGA+dkHy6GDn3RUKgOVaHhHPusYK3S7KbkvWsJYUQzssegJEZotoAmmJ I/rKnCrF9iS0jVSah9XK6QZxDjYnMEw= X-MC-Unique: dRh4TEcSO1uI8zU2HXZr1Q-1 From: marcandre.lureau@redhat.com To: qemu-devel@nongnu.org Subject: [PULL 09/12] ui/console: optionally update after gfx switch Date: Mon, 14 Mar 2022 16:59:37 +0400 Message-Id: <20220314125940.1866728-10-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.8 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.133.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, RCVD_IN_MSPIKE_H5=0.001, RCVD_IN_MSPIKE_WL=0.001, 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: 1647263055646100001 From: Marc-Andr=C3=A9 Lureau When switching to the dummy surface, we should also call gfx_update. But when using GL, we shouldn't call it. By making it an argument to displaychangelistener_gfx_switch(), it will be explicit, and cannot be forgotten that easily. Fixes: commit ebced091 ("console: save current scanout details") Signed-off-by: Marc-Andr=C3=A9 Lureau Acked-by: Gerd Hoffmann --- ui/console.c | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/ui/console.c b/ui/console.c index 102fcf0a5068..06ba82db61c9 100644 --- a/ui/console.c +++ b/ui/console.c @@ -1059,11 +1059,18 @@ static void console_putchar(QemuConsole *s, int ch) } =20 static void displaychangelistener_gfx_switch(DisplayChangeListener *dcl, - struct DisplaySurface *new_su= rface) + struct DisplaySurface *new_su= rface, + bool update) { if (dcl->ops->dpy_gfx_switch) { dcl->ops->dpy_gfx_switch(dcl, new_surface); } + + if (update && dcl->ops->dpy_gfx_update) { + dcl->ops->dpy_gfx_update(dcl, 0, 0, + surface_width(new_surface), + surface_height(new_surface)); + } } =20 =20 @@ -1079,7 +1086,7 @@ static void displaychangelistener_display_console(Dis= playChangeListener *dcl, if (!dummy) { dummy =3D qemu_create_placeholder_surface(640, 480, nodev); } - displaychangelistener_gfx_switch(dcl, dummy); + displaychangelistener_gfx_switch(dcl, dummy, TRUE); return; } =20 @@ -1098,12 +1105,8 @@ static void displaychangelistener_display_console(Di= splayChangeListener *dcl, con->scanout.texture.width, con->scanout.texture.height); } else if (con->scanout.kind =3D=3D SCANOUT_SURFACE) { - displaychangelistener_gfx_switch(dcl, con->surface); + displaychangelistener_gfx_switch(dcl, con->surface, TRUE); } - - dcl->ops->dpy_gfx_update(dcl, 0, 0, - qemu_console_get_width(con, 0), - qemu_console_get_height(con, 0)); } =20 void console_select(unsigned int index) @@ -1682,7 +1685,7 @@ void dpy_gfx_replace_surface(QemuConsole *con, if (con !=3D (dcl->con ? dcl->con : active_console)) { continue; } - displaychangelistener_gfx_switch(dcl, surface); + displaychangelistener_gfx_switch(dcl, surface, FALSE); } qemu_free_displaysurface(old_surface); } --=20 2.35.1.273.ge6ebfd0e8cbb From nobody Mon Feb 9 14:24:15 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 1647263264781998.9630839989128; Mon, 14 Mar 2022 06:07:44 -0700 (PDT) Received: from localhost ([::1]:40548 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nTkQJ-0006wA-N5 for importer@patchew.org; Mon, 14 Mar 2022 09:07:43 -0400 Received: from eggs.gnu.org ([209.51.188.92]:33692) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nTkJa-0004fP-QX for qemu-devel@nongnu.org; Mon, 14 Mar 2022 09:00:48 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]:27826) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nTkJY-00037Z-8i for qemu-devel@nongnu.org; Mon, 14 Mar 2022 09:00:46 -0400 Received: from mimecast-mx02.redhat.com (mx3-rdu2.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-630-xplI0cWGNI2MNQMdlp0ahw-1; Mon, 14 Mar 2022 09:00:40 -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 6E0BA3C1EA52; Mon, 14 Mar 2022 13:00:39 +0000 (UTC) Received: from localhost (unknown [10.39.208.23]) by smtp.corp.redhat.com (Postfix) with ESMTP id C49D9463E09; Mon, 14 Mar 2022 13:00:37 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1647262843; 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=KkQnyUCGjkrsCbou8EryJJhDknNNAec4lt7j2S6Ur9g=; b=O/g1OKLr8YUD3wAOOeFcWGsXeJVzjQ85ynbIqe+oRFU5asRPV8bQwBC7E/SzGfc86HFWZ3 UKSYjTVJg/G3Q2FjNOXuAPMl0vTmiLddQ5LJVTLKgT+o9pt4VUxM0rcifVjr0340kNeG1B 78uSH5iC6GryBuBQA4CahQShnMLtC3k= X-MC-Unique: xplI0cWGNI2MNQMdlp0ahw-1 From: marcandre.lureau@redhat.com To: qemu-devel@nongnu.org Subject: [PULL 10/12] ui/dbus: fix texture sharing Date: Mon, 14 Mar 2022 16:59:38 +0400 Message-Id: <20220314125940.1866728-11-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.133.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, RCVD_IN_MSPIKE_H5=0.001, RCVD_IN_MSPIKE_WL=0.001, 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: 1647263266859100001 From: Marc-Andr=C3=A9 Lureau The DBus listener naively create, update and destroy textures without taking into account other listeners. The texture were shared, but texture update was unnecessarily duplicated. Teach DisplayGLCtx to do optionally shared texture handling. This is only implemented for DBus display at this point, however the same infrastructure could potentially be used for other future combinations. Reported-by: Akihiko Odaki Signed-off-by: Marc-Andr=C3=A9 Lureau Acked-by: Gerd Hoffmann --- include/ui/console.h | 10 ++++++++++ ui/console.c | 26 ++++++++++++++++++++++++++ ui/dbus-listener.c | 11 ----------- ui/dbus.c | 26 ++++++++++++++++++++++++++ 4 files changed, 62 insertions(+), 11 deletions(-) diff --git a/include/ui/console.h b/include/ui/console.h index 18a10c0b7db0..0f84861933e1 100644 --- a/include/ui/console.h +++ b/include/ui/console.h @@ -290,10 +290,20 @@ typedef struct DisplayGLCtxOps { QEMUGLContext ctx); int (*dpy_gl_ctx_make_current)(DisplayGLCtx *dgc, QEMUGLContext ctx); + void (*dpy_gl_ctx_create_texture)(DisplayGLCtx *dgc, + DisplaySurface *surface); + void (*dpy_gl_ctx_destroy_texture)(DisplayGLCtx *dgc, + DisplaySurface *surface); + void (*dpy_gl_ctx_update_texture)(DisplayGLCtx *dgc, + DisplaySurface *surface, + int x, int y, int w, int h); } DisplayGLCtxOps; =20 struct DisplayGLCtx { const DisplayGLCtxOps *ops; +#ifdef CONFIG_OPENGL + QemuGLShader *gls; /* optional shared shader */ +#endif }; =20 DisplayState *init_displaystate(void); diff --git a/ui/console.c b/ui/console.c index 06ba82db61c9..5bfecea4549e 100644 --- a/ui/console.c +++ b/ui/console.c @@ -1073,6 +1073,27 @@ static void displaychangelistener_gfx_switch(Display= ChangeListener *dcl, } } =20 +static void dpy_gfx_create_texture(QemuConsole *con, DisplaySurface *surfa= ce) +{ + if (con->gl && con->gl->ops->dpy_gl_ctx_create_texture) { + con->gl->ops->dpy_gl_ctx_create_texture(con->gl, surface); + } +} + +static void dpy_gfx_destroy_texture(QemuConsole *con, DisplaySurface *surf= ace) +{ + if (con->gl && con->gl->ops->dpy_gl_ctx_destroy_texture) { + con->gl->ops->dpy_gl_ctx_destroy_texture(con->gl, surface); + } +} + +static void dpy_gfx_update_texture(QemuConsole *con, DisplaySurface *surfa= ce, + int x, int y, int w, int h) +{ + if (con->gl && con->gl->ops->dpy_gl_ctx_update_texture) { + con->gl->ops->dpy_gl_ctx_update_texture(con->gl, surface, x, y, w,= h); + } +} =20 static void displaychangelistener_display_console(DisplayChangeListener *d= cl, QemuConsole *con, @@ -1085,6 +1106,7 @@ static void displaychangelistener_display_console(Dis= playChangeListener *dcl, if (!con || !console_compatible_with(con, dcl, errp)) { if (!dummy) { dummy =3D qemu_create_placeholder_surface(640, 480, nodev); + dpy_gfx_create_texture(con, dummy); } displaychangelistener_gfx_switch(dcl, dummy, TRUE); return; @@ -1105,6 +1127,7 @@ static void displaychangelistener_display_console(Dis= playChangeListener *dcl, con->scanout.texture.width, con->scanout.texture.height); } else if (con->scanout.kind =3D=3D SCANOUT_SURFACE) { + dpy_gfx_create_texture(con, con->surface); displaychangelistener_gfx_switch(dcl, con->surface, TRUE); } } @@ -1637,6 +1660,7 @@ void dpy_gfx_update(QemuConsole *con, int x, int y, i= nt w, int h) if (!qemu_console_is_visible(con)) { return; } + dpy_gfx_update_texture(con, con->surface, x, y, w, h); QLIST_FOREACH(dcl, &s->listeners, next) { if (con !=3D (dcl->con ? dcl->con : active_console)) { continue; @@ -1681,12 +1705,14 @@ void dpy_gfx_replace_surface(QemuConsole *con, =20 con->scanout.kind =3D SCANOUT_SURFACE; con->surface =3D surface; + dpy_gfx_create_texture(con, surface); QLIST_FOREACH(dcl, &s->listeners, next) { if (con !=3D (dcl->con ? dcl->con : active_console)) { continue; } displaychangelistener_gfx_switch(dcl, surface, FALSE); } + dpy_gfx_destroy_texture(con, old_surface); qemu_free_displaysurface(old_surface); } =20 diff --git a/ui/dbus-listener.c b/ui/dbus-listener.c index 81c119b13a2c..a287edd2fc15 100644 --- a/ui/dbus-listener.c +++ b/ui/dbus-listener.c @@ -42,7 +42,6 @@ struct _DBusDisplayListener { =20 DisplayChangeListener dcl; DisplaySurface *ds; - QemuGLShader *gls; int gl_updates; }; =20 @@ -240,10 +239,6 @@ static void dbus_gl_gfx_update(DisplayChangeListener *= dcl, { DBusDisplayListener *ddl =3D container_of(dcl, DBusDisplayListener, dc= l); =20 - if (ddl->ds) { - surface_gl_update_texture(ddl->gls, ddl->ds, x, y, w, h); - } - ddl->gl_updates++; } =20 @@ -285,15 +280,11 @@ static void dbus_gl_gfx_switch(DisplayChangeListener = *dcl, { DBusDisplayListener *ddl =3D container_of(dcl, DBusDisplayListener, dc= l); =20 - if (ddl->ds) { - surface_gl_destroy_texture(ddl->gls, ddl->ds); - } ddl->ds =3D new_surface; if (ddl->ds) { int width =3D surface_width(ddl->ds); int height =3D surface_height(ddl->ds); =20 - surface_gl_create_texture(ddl->gls, ddl->ds); /* TODO: lazy send dmabuf (there are unnecessary sent otherwise) */ dbus_scanout_texture(&ddl->dcl, ddl->ds->texture, false, width, height, 0, 0, width, height); @@ -403,7 +394,6 @@ dbus_display_listener_dispose(GObject *object) g_clear_object(&ddl->conn); g_clear_pointer(&ddl->bus_name, g_free); g_clear_object(&ddl->proxy); - g_clear_pointer(&ddl->gls, qemu_gl_fini_shader); =20 G_OBJECT_CLASS(dbus_display_listener_parent_class)->dispose(object); } @@ -414,7 +404,6 @@ dbus_display_listener_constructed(GObject *object) DBusDisplayListener *ddl =3D DBUS_DISPLAY_LISTENER(object); =20 if (display_opengl) { - ddl->gls =3D qemu_gl_init_shader(); ddl->dcl.ops =3D &dbus_gl_dcl_ops; } else { ddl->dcl.ops =3D &dbus_dcl_ops; diff --git a/ui/dbus.c b/ui/dbus.c index 22c82d2f323a..7a87612379e8 100644 --- a/ui/dbus.c +++ b/ui/dbus.c @@ -55,11 +55,33 @@ dbus_is_compatible_dcl(DisplayGLCtx *dgc, return dcl->ops =3D=3D &dbus_gl_dcl_ops || dcl->ops =3D=3D &dbus_conso= le_dcl_ops; } =20 +static void +dbus_create_texture(DisplayGLCtx *ctx, DisplaySurface *surface) +{ + surface_gl_create_texture(ctx->gls, surface); +} + +static void +dbus_destroy_texture(DisplayGLCtx *ctx, DisplaySurface *surface) +{ + surface_gl_destroy_texture(ctx->gls, surface); +} + +static void +dbus_update_texture(DisplayGLCtx *ctx, DisplaySurface *surface, + int x, int y, int w, int h) +{ + surface_gl_update_texture(ctx->gls, surface, x, y, w, h); +} + static const DisplayGLCtxOps dbus_gl_ops =3D { .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, + .dpy_gl_ctx_create_texture =3D dbus_create_texture, + .dpy_gl_ctx_destroy_texture =3D dbus_destroy_texture, + .dpy_gl_ctx_update_texture =3D dbus_update_texture, }; =20 static NotifierList dbus_display_notifiers =3D @@ -90,6 +112,9 @@ dbus_display_init(Object *o) g_autoptr(GDBusObjectSkeleton) vm =3D NULL; =20 dd->glctx.ops =3D &dbus_gl_ops; + if (display_opengl) { + dd->glctx.gls =3D qemu_gl_init_shader(); + } dd->iface =3D qemu_dbus_display1_vm_skeleton_new(); dd->consoles =3D g_ptr_array_new_with_free_func(g_object_unref); =20 @@ -126,6 +151,7 @@ dbus_display_finalize(Object *o) g_clear_object(&dd->iface); g_free(dd->dbus_addr); g_free(dd->audiodev); + g_clear_pointer(&dd->glctx.gls, qemu_gl_fini_shader); dbus_display =3D NULL; } =20 --=20 2.35.1.273.ge6ebfd0e8cbb From nobody Mon Feb 9 14:24:15 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 1647263385010159.995402241512; Mon, 14 Mar 2022 06:09:45 -0700 (PDT) Received: from localhost ([::1]:47668 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nTkSD-0002x1-Nf for importer@patchew.org; Mon, 14 Mar 2022 09:09:41 -0400 Received: from eggs.gnu.org ([209.51.188.92]:33878) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nTkK6-00051Z-NK for qemu-devel@nongnu.org; Mon, 14 Mar 2022 09:01:18 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]:34953) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nTkK4-0003D0-AR for qemu-devel@nongnu.org; Mon, 14 Mar 2022 09:01:18 -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-584-4EarbJiFNNGTEtLht3UH9A-1; Mon, 14 Mar 2022 09:01:09 -0400 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.rdu2.redhat.com [10.11.54.8]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id CB1411057EBE; Mon, 14 Mar 2022 13:00:44 +0000 (UTC) Received: from localhost (unknown [10.39.208.23]) by smtp.corp.redhat.com (Postfix) with ESMTP id 9835FC528AB; Mon, 14 Mar 2022 13:00:43 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1647262875; 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=PhJu/fGjs6woppUiaVUm0HazUAIcaTnSY8JXdBoNP7M=; b=B6mHQK/vEJETfA7sLYBjKzXUl9IZ7zuJnibzFg2W3SmzVb9spgXMoUnJAjvqiFrUuAwBRM jggxpNdN0RIm4Vm7VqwIYD+ZnsXIDPhgYp7wKzaY/SGQNqdX/F91mK64BbB5yiHZHvMZ1M Pm4Z6gHrcF+p/ft9kVNdM/6dIe86r+M= X-MC-Unique: 4EarbJiFNNGTEtLht3UH9A-1 From: marcandre.lureau@redhat.com To: qemu-devel@nongnu.org Subject: [PULL 11/12] ui/dbus: do not send 2d scanout until gfx_update Date: Mon, 14 Mar 2022 16:59:39 +0400 Message-Id: <20220314125940.1866728-12-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.8 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.133.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, RCVD_IN_MSPIKE_H5=0.001, RCVD_IN_MSPIKE_WL=0.001, 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: 1647263386285100002 From: Marc-Andr=C3=A9 Lureau gfx_switch() is called to set the new_surface, not necessarily to display it. It should be displayed after gfx_update(). Send the whole scanout only in this case. Signed-off-by: Marc-Andr=C3=A9 Lureau Acked-by: Gerd Hoffmann --- ui/dbus-listener.c | 37 ++++++++++++++++++++----------------- 1 file changed, 20 insertions(+), 17 deletions(-) diff --git a/ui/dbus-listener.c b/ui/dbus-listener.c index a287edd2fc15..f9fc8eda519a 100644 --- a/ui/dbus-listener.c +++ b/ui/dbus-listener.c @@ -255,6 +255,26 @@ static void dbus_gfx_update(DisplayChangeListener *dcl, =20 trace_dbus_update(x, y, w, h); =20 + if (x =3D=3D 0 && y =3D=3D 0 && w =3D=3D surface_width(ddl->ds) && h = =3D=3D surface_height(ddl->ds)) { + v_data =3D g_variant_new_from_data( + G_VARIANT_TYPE("ay"), + surface_data(ddl->ds), + surface_stride(ddl->ds) * surface_height(ddl->ds), + TRUE, + (GDestroyNotify)pixman_image_unref, + pixman_image_ref(ddl->ds->image)); + qemu_dbus_display1_listener_call_scanout( + ddl->proxy, + surface_width(ddl->ds), + surface_height(ddl->ds), + surface_stride(ddl->ds), + surface_format(ddl->ds), + v_data, + G_DBUS_CALL_FLAGS_NONE, + DBUS_DEFAULT_TIMEOUT, NULL, NULL, NULL); + return; + } + /* make a copy, since gvariant only handles linear data */ img =3D pixman_image_create_bits(surface_format(ddl->ds), w, h, NULL, stride); @@ -295,29 +315,12 @@ static void dbus_gfx_switch(DisplayChangeListener *dc= l, struct DisplaySurface *new_surface) { DBusDisplayListener *ddl =3D container_of(dcl, DBusDisplayListener, dc= l); - GVariant *v_data =3D NULL; =20 ddl->ds =3D new_surface; if (!ddl->ds) { /* why not call disable instead? */ return; } - - v_data =3D g_variant_new_from_data( - G_VARIANT_TYPE("ay"), - surface_data(ddl->ds), - surface_stride(ddl->ds) * surface_height(ddl->ds), - TRUE, - (GDestroyNotify)pixman_image_unref, - pixman_image_ref(ddl->ds->image)); - qemu_dbus_display1_listener_call_scanout(ddl->proxy, - surface_width(ddl->ds), - surface_height(ddl->ds), - surface_stride(ddl->ds), - surface_format(ddl->ds), - v_data, - G_DBUS_CALL_FLAGS_NONE, - DBUS_DEFAULT_TIMEOUT, NULL, NULL, NULL); } =20 static void dbus_mouse_set(DisplayChangeListener *dcl, --=20 2.35.1.273.ge6ebfd0e8cbb From nobody Mon Feb 9 14:24:15 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 1647263384632163.23982693149094; Mon, 14 Mar 2022 06:09:44 -0700 (PDT) Received: from localhost ([::1]:47860 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nTkSF-000341-JA for importer@patchew.org; Mon, 14 Mar 2022 09:09:43 -0400 Received: from eggs.gnu.org ([209.51.188.92]:33840) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nTkK2-0004sf-Cu for qemu-devel@nongnu.org; Mon, 14 Mar 2022 09:01:14 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]:41611) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nTkK0-0003BB-5K for qemu-devel@nongnu.org; Mon, 14 Mar 2022 09:01:13 -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-148-jHrrTRz4P2-IvEG2MyMbqw-1; Mon, 14 Mar 2022 09:01:09 -0400 Received: from smtp.corp.redhat.com (int-mx09.intmail.prod.int.rdu2.redhat.com [10.11.54.9]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 7357E10B9592; Mon, 14 Mar 2022 13:00:49 +0000 (UTC) Received: from localhost (unknown [10.39.208.23]) by smtp.corp.redhat.com (Postfix) with ESMTP id EA903674C63; Mon, 14 Mar 2022 13:00:47 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1647262871; 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=pVJTEmXRns0EP0JpdlQztRkyNS0tiGoJxJmRw7645kY=; b=ViGsZSM9Cu3wwoTHQY3AXbgy3QyUEnq3hN5h98TvMp0IY565Y9yPp0y8ZL1WdPdTthHbwW 6Ld/mol04F1EA0ffQzTiGODBcfianuaO9ZpU6zbDVjZZ80o2NIK1ClrZtfYTfbOjDZ0ghz CaegxQ37/jkRp+i9MG6eJVaXF+C14L0= X-MC-Unique: jHrrTRz4P2-IvEG2MyMbqw-1 From: marcandre.lureau@redhat.com To: qemu-devel@nongnu.org Subject: [PULL 12/12] ui/console: call gfx_switch() even if the current scanout is GL Date: Mon, 14 Mar 2022 16:59:40 +0400 Message-Id: <20220314125940.1866728-13-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.9 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.133.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, RCVD_IN_MSPIKE_H5=0.001, RCVD_IN_MSPIKE_WL=0.001, 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: 1647263386278100001 From: Marc-Andr=C3=A9 Lureau egl-headless depends on the backing surface to be set before texture are set and updated. Display it (update=3Dtrue) iff the current scanout kind is SURFACE. Reported-by: Akihiko Odaki Signed-off-by: Marc-Andr=C3=A9 Lureau Acked-by: Gerd Hoffmann --- ui/console.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/ui/console.c b/ui/console.c index 5bfecea4549e..16a0b0909ba2 100644 --- a/ui/console.c +++ b/ui/console.c @@ -1112,6 +1112,10 @@ static void displaychangelistener_display_console(Di= splayChangeListener *dcl, return; } =20 + dpy_gfx_create_texture(con, con->surface); + displaychangelistener_gfx_switch(dcl, con->surface, + con->scanout.kind =3D=3D SCANOUT_SURF= ACE); + if (con->scanout.kind =3D=3D SCANOUT_DMABUF && displaychangelistener_has_dmabuf(dcl)) { dcl->ops->dpy_gl_scanout_dmabuf(dcl, con->scanout.dmabuf); @@ -1126,9 +1130,6 @@ static void displaychangelistener_display_console(Dis= playChangeListener *dcl, con->scanout.texture.y, con->scanout.texture.width, con->scanout.texture.height); - } else if (con->scanout.kind =3D=3D SCANOUT_SURFACE) { - dpy_gfx_create_texture(con, con->surface); - displaychangelistener_gfx_switch(dcl, con->surface, TRUE); } } =20 --=20 2.35.1.273.ge6ebfd0e8cbb