From nobody Sat May 18 01:27:49 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; 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=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1647342781; cv=none; d=zohomail.com; s=zohoarc; b=AcO1TWswCQflYZnWZj8mpQai1Z2FOKMzPRpkGd+u2B/uk72gqzd4+NBo1krMNifHI79yXtrm2wJAoT14Tr46wWv8ChDgA9I7ZRe2E6AwOJ/7cQrEmAakeA5h5GDKkEdEDewYDcN2DiXWH95USlXIHbrGI2Dnmf04YDrn8oXU61E= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1647342781; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=C2YIpCtdcHjni3WzUJsX14EQ+6PQzw597u7Usputo7M=; b=HYnetyUUlShULUjoB7ZUUVdThIo9al9VnFcJXInYzAk2R9r/fxXtHSEkNoFKxO29PdA/lIKTyh8h+bUZuKMxb4XvNVng+f4VXVBO14x6fBiU15EoADXoLbSiGQ1IPL8wMN6uFDukGPKpiSFEISAFKKTdmzQ+kkO6WDll/Ann8rs= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; 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=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1647342781554653.6069717767588; Tue, 15 Mar 2022 04:13:01 -0700 (PDT) Received: from localhost ([::1]:36426 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nU56q-0003OY-Sf for importer@patchew.org; Tue, 15 Mar 2022 07:13:00 -0400 Received: from eggs.gnu.org ([209.51.188.92]:36210) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nU51r-000334-Ie for qemu-devel@nongnu.org; Tue, 15 Mar 2022 07:07:51 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]:53268) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nU51q-0005bv-1U for qemu-devel@nongnu.org; Tue, 15 Mar 2022 07:07:51 -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-563-pXIZ6iqsMX-cV_lbxOhLKw-1; Tue, 15 Mar 2022 07:07:48 -0400 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.rdu2.redhat.com [10.11.54.7]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id C8A2682A6C2; Tue, 15 Mar 2022 11:07:47 +0000 (UTC) Received: from localhost (unknown [10.39.208.19]) by smtp.corp.redhat.com (Postfix) with ESMTP id 990A11410F3B; Tue, 15 Mar 2022 11:07:46 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1647342469; 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=eLLYxt2ldv5Ci7gLqocVE2JFq7RTWkLPqVbTfft273BjIRab5jeiXtTLsW/kh/q4nA1QdS /77j9cXnu9Bm95PFdQGBfE9nZv5W3k2YhgfcriRp8FSCWM29vqhQsA5xxm8YzEdj8/JhMw n5IcjJiMjlc0lIsOHuZhEUsfFg0wiUE= X-MC-Unique: pXIZ6iqsMX-cV_lbxOhLKw-1 From: marcandre.lureau@redhat.com To: qemu-devel@nongnu.org Subject: [PULL v2 01/12] ui/console: move check for compatible GL context Date: Tue, 15 Mar 2022 15:07:28 +0400 Message-Id: <20220315110739.2095676-2-marcandre.lureau@redhat.com> In-Reply-To: <20220315110739.2095676-1-marcandre.lureau@redhat.com> References: <20220315110739.2095676-1-marcandre.lureau@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.85 on 10.11.54.7 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, RCVD_IN_MSPIKE_H4=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: pass (identity @redhat.com) X-ZM-MESSAGEID: 1647342784648100001 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 Sat May 18 01:27:49 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; 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=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1647343009; cv=none; d=zohomail.com; s=zohoarc; b=NSnS8jBcyU8C6ci1gOmchYaA0PexYnmfR7Mz64AzthcXy41LWQhG5mID3xAdcPJhFEiI+9RM/7hnob7UD3VRIztuvlUiud8PDFqHbLqxMCqRX471aA4XJIHOtCQLIx6BwHJW6MOtgb5D4EgiYVqpvO/zbGC0CZREkhEhgFEaGps= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1647343009; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=U9wVa6sw0CubaKXc7NftByFtVH8+n30+depllMFwWyM=; b=lKFWEUNQ7NNlHGqLPqUsN40clxrBc42iOl1rMsUrhKZ4/jXtMWrsHUbsVCCmkqZ6R22fqoq8hoqtm35UQpFihv5wN3Sp6rlb/+uwzZQoiLr0g9s3XDZ8jcqplYAWV2PeAHN6udtsHnlT6jt80yR0DybGNbYxlQqM77DOD/NsdrM= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; 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=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1647343009270482.3545644785918; Tue, 15 Mar 2022 04:16:49 -0700 (PDT) Received: from localhost ([::1]:45084 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nU5AW-0000rL-IA for importer@patchew.org; Tue, 15 Mar 2022 07:16:48 -0400 Received: from eggs.gnu.org ([209.51.188.92]:36364) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nU52L-0004GA-Ie for qemu-devel@nongnu.org; Tue, 15 Mar 2022 07:08:21 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]:33225) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nU52I-0005gf-4f for qemu-devel@nongnu.org; Tue, 15 Mar 2022 07:08:19 -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-599-ge3OmneTOKCWDCyXJ-G_Sw-1; Tue, 15 Mar 2022 07:08:15 -0400 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.rdu2.redhat.com [10.11.54.5]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 29AD51C05B12; Tue, 15 Mar 2022 11:08:15 +0000 (UTC) Received: from localhost (unknown [10.39.208.19]) by smtp.corp.redhat.com (Postfix) with ESMTP id 4BD8B30BB9; Tue, 15 Mar 2022 11:07:51 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1647342497; 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=fmElyCma7zaf9X+tbs+TWUZid/rzzTlY8Hcqud4uPAQhoGQYxMJ1azB3fz37dM1Q+hSd/H GDlD+t0m4o+KbgM0YVGzjKGyGVIkjXWckprjEJ/Ax8PbkS/1ebH46H8Qh50lM43OSqE4p5 BTCbknNZTDW1hIJ3KI7OpeM7qOnvl2k= X-MC-Unique: ge3OmneTOKCWDCyXJ-G_Sw-1 From: marcandre.lureau@redhat.com To: qemu-devel@nongnu.org Subject: [PULL v2 02/12] ui/console: move dcl compatiblity check to a callback Date: Tue, 15 Mar 2022 15:07:29 +0400 Message-Id: <20220315110739.2095676-3-marcandre.lureau@redhat.com> In-Reply-To: <20220315110739.2095676-1-marcandre.lureau@redhat.com> References: <20220315110739.2095676-1-marcandre.lureau@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.11.54.5 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, RCVD_IN_MSPIKE_H4=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: pass (identity @redhat.com) X-ZM-MESSAGEID: 1647343010406100001 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 Sat May 18 01:27:49 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; 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=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1647343190; cv=none; d=zohomail.com; s=zohoarc; b=k0xOPX+H6dtI7Hv0lnNSIUicgwjU6X1BFnE5sy+zQySAmIZJvVi8Z/Xpoj+8g2vseqSYSzpbp4zaySjyDrjfjsaV10Tx+McHU7Jv+8Vg7bJ9mpOLKErdE8amsjXNOdyxcOL89tEv+T/EKQDlv++gM+lMIfQ/z7Enp+Mfac6r6Rs= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1647343190; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=AbbUg//qRoFA4XnRL+atwQNCbvmj6ejSuiXPrARpYxE=; b=mEyWnDLOOEuOXtU8FCK5sVvCV/AtPg+1d7UR5kO/QdH+RXRBfylwj4ktePlWRZXooxZrx4l8jcpbfM9E46PGvVFRbFM2U+obXiZE6aWULFVAZKANQgtt4K42tL+zW46pghK8KHri6Wh9XqOn50dpUBW9FcBvHvYKjuwbWJtPj0c= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; 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=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1647343190265286.8759809141111; Tue, 15 Mar 2022 04:19:50 -0700 (PDT) Received: from localhost ([::1]:53472 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nU5DR-0006Vv-HG for importer@patchew.org; Tue, 15 Mar 2022 07:19:49 -0400 Received: from eggs.gnu.org ([209.51.188.92]:36382) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nU52Q-0004Xr-SN for qemu-devel@nongnu.org; Tue, 15 Mar 2022 07:08:30 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]:33500) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nU52P-0005iW-Aq for qemu-devel@nongnu.org; Tue, 15 Mar 2022 07:08:26 -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-433-B8QurfghNgmowbhEeb_1Jw-1; Tue, 15 Mar 2022 07:08:21 -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 9701D1C01E87; Tue, 15 Mar 2022 11:08:21 +0000 (UTC) Received: from localhost (unknown [10.39.208.19]) by smtp.corp.redhat.com (Postfix) with ESMTP id 52A414010A01; Tue, 15 Mar 2022 11:08:20 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1647342504; 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=B+IdURglmZJRlkPxMnRE7aNzJ7NWX8gijmQtnjpOBGdFb9gvqa1jY3G9AKdiATa7qUNbFE XcWx3vdCWpXeE6vW9lHwxWQbjiaNVRCry7DJTxw8e6Rne+jDukAOYG1uFhu/Y7KkqjGpUp pw2ypdde1fESzDXBn5fUF+7Gz4Wzvcw= X-MC-Unique: B8QurfghNgmowbhEeb_1Jw-1 From: marcandre.lureau@redhat.com To: qemu-devel@nongnu.org Subject: [PULL v2 03/12] ui/console: egl-headless is compatible with non-gl listeners Date: Tue, 15 Mar 2022 15:07:30 +0400 Message-Id: <20220315110739.2095676-4-marcandre.lureau@redhat.com> In-Reply-To: <20220315110739.2095676-1-marcandre.lureau@redhat.com> References: <20220315110739.2095676-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, RCVD_IN_MSPIKE_H4=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: pass (identity @redhat.com) X-ZM-MESSAGEID: 1647343192267100001 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 Sat May 18 01:27:49 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; 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=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1647342875; cv=none; d=zohomail.com; s=zohoarc; b=Uw8WdyE1jlhHRicrdsXKuq+9RZbleZrTWacssTq4yiWPtEEijEtRShxjPZvCLtxFhElYHxyik/QUDNejKIwmhoW+5BZydmlgqBvAoQ2Dv8g/EGF+7PSdyxIlE5ajPSL83Mv7RA2PohPpDL20C9HTNMzzWSaZKsJezzt4ig7gCK4= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1647342875; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=VTLNQ2w+rMItS2fOJeJOBwWN+fp7niRU59e/o1Jngm4=; b=PKP+NjHsEkkcBwLkEa71KqJIM4lt4+BDGBCEoHe/m4zc0elXSSkma5DTfpNPMc2m1FZGxB2ch/pwe6xLLGEzLkKgFB0yUtqs8kgC+fhVDp/6RW1fOMwKEZaKUu2yGs70qdjqybTXzgLRdJoQg3FvBDDA4yEz5sa2eMWvotnPy5s= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; 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=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1647342875355146.38197785960472; Tue, 15 Mar 2022 04:14:35 -0700 (PDT) Received: from localhost ([::1]:39504 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nU58M-0005Vf-JK for importer@patchew.org; Tue, 15 Mar 2022 07:14:34 -0400 Received: from eggs.gnu.org ([209.51.188.92]:36422) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nU52X-0004c1-Pe for qemu-devel@nongnu.org; Tue, 15 Mar 2022 07:08:33 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]:41406) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nU52V-0005jp-Uz for qemu-devel@nongnu.org; Tue, 15 Mar 2022 07:08:33 -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-228--hegAM3DO-mFdkz6N_gtpQ-1; Tue, 15 Mar 2022 07:08:28 -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 D27423800503; Tue, 15 Mar 2022 11:08:27 +0000 (UTC) Received: from localhost (unknown [10.39.208.19]) by smtp.corp.redhat.com (Postfix) with ESMTP id 4C606400F3A; Tue, 15 Mar 2022 11:08:25 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1647342511; 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=Xp9k0YL1Ke33a2e3Z8L5HZ2EZymR6owCZ6fvRUGzW2rgXv5BQHeHMt6ZsHA56zyzt6D1CF 9jjSIlbIPTd6/fGfy+l9i0tG+YByab2mhbgX1BSuYMoBB0288E5lril405LCuE2zVZ+91M 8HIcRQlzDx5iqQ6xErXOJwuWNGT96uk= X-MC-Unique: -hegAM3DO-mFdkz6N_gtpQ-1 From: marcandre.lureau@redhat.com To: qemu-devel@nongnu.org Subject: [PULL v2 04/12] ui/dbus: associate the DBusDisplayConsole listener with the given console Date: Tue, 15 Mar 2022 15:07:31 +0400 Message-Id: <20220315110739.2095676-5-marcandre.lureau@redhat.com> In-Reply-To: <20220315110739.2095676-1-marcandre.lureau@redhat.com> References: <20220315110739.2095676-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: pass (identity @redhat.com) X-ZM-MESSAGEID: 1647342877405100003 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 Sat May 18 01:27:49 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; 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=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1647343335; cv=none; d=zohomail.com; s=zohoarc; b=g3L58LK1StPxT3pJb47W+V77CVF4M/llZ5K8+2DWhliZaXKE3N1N9W9DzTouwhqVb5tA0jHLuRDdPa6io1sDL/iy4avrpmVUNqC3rvJEwq1ib1Hf+hTSziC4bLzsXkosDicfQrslD9/Kv7T6LMOgM76I61qARF358/xApndYF8g= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1647343335; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=QR1CwZ64IIIxQL/lJwTdtyD/ZBJy8+qjCBYnTNCFmZo=; b=Dc2qOQcjoz4DfxaoxnqUntzZZGkQ80TgwpjmA/V12w7GvioaVudmek1HcPQDoOByGqKOKsE7fOlOrHP1YdIaYi5dIJky02T+UQSDMIedLDZHGC2mZnxm05OSQ6ub61hxO530/aIATPmqO87YhE1nnl6Mr3GDiutKVnDtgS4sYtg= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; 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=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1647343335748308.22519132185926; Tue, 15 Mar 2022 04:22:15 -0700 (PDT) Received: from localhost ([::1]:59712 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nU5Fl-0002Mb-IF for importer@patchew.org; Tue, 15 Mar 2022 07:22:13 -0400 Received: from eggs.gnu.org ([209.51.188.92]:36476) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nU52d-0004hx-8q for qemu-devel@nongnu.org; Tue, 15 Mar 2022 07:08:39 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]:40251) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nU52b-0005lK-KI for qemu-devel@nongnu.org; Tue, 15 Mar 2022 07:08:39 -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-207-kYslmTR-ND-uMGEegS5wEw-1; Tue, 15 Mar 2022 07:08:33 -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 DC8EB1C01E82; Tue, 15 Mar 2022 11:08:32 +0000 (UTC) Received: from localhost (unknown [10.39.208.19]) by smtp.corp.redhat.com (Postfix) with ESMTP id 24C024B8D42; Tue, 15 Mar 2022 11:08:31 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1647342516; 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=RPWu1pR27NiB0ZJLgRfFZ3UmG6CLZuXKqnAAFySfjbqbJdj5iIHiEXA6aX0qtkOmSew6JK 6bGdDeHftK3YfgnzzkODMkbWfSVMLzQvTAPGp9/nmOLGPzKOu0HiQzJhoHGYYi7No3CKE8 aIHxXsFktctQ+S3asATW7iTisuOfWxc= X-MC-Unique: kYslmTR-ND-uMGEegS5wEw-1 From: marcandre.lureau@redhat.com To: qemu-devel@nongnu.org Subject: [PULL v2 05/12] ui/console: move console compatibility check to dcl_display_console() Date: Tue, 15 Mar 2022 15:07:32 +0400 Message-Id: <20220315110739.2095676-6-marcandre.lureau@redhat.com> In-Reply-To: <20220315110739.2095676-1-marcandre.lureau@redhat.com> References: <20220315110739.2095676-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, RCVD_IN_MSPIKE_H4=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: pass (identity @redhat.com) X-ZM-MESSAGEID: 1647343338442100001 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 Sat May 18 01:27:49 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; 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=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1647342679; cv=none; d=zohomail.com; s=zohoarc; b=iJ1msxYTQ5YAj0GXX0QqAmyd9cKiS7ijxps93SN1WHahTriKjg33dXb7uc+sBde/jVIZ4J/0o7NekwhyWN60zKDTAqPVTxCA21uxSft8b6LEMSeKjWu1gB+uAMPoSNUDYdu46bzo6Ru4eoxgK9fjKYFAs7cyGGhUnZ+mSlwDRhU= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1647342679; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=Ow2T12UgMkr9jPaFKMWSsZHcAQuUHyxTS6a7PG+DSSE=; b=BjX8jviZajozyztMX0hIh6+6/U/54CBXLGGecrYGGdPnuum5dESQe/ljI4GT33+ajFNpk42f7aLglQ0TGISHVh7+SI+2GP1D2zNOU8/4aGsK2Gn/T94QPeacd4elycSYhFQaEBP9kKiAS1uacUa4rQYIX+EGIG2ShaPQQQsoO+0= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; 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=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1647342679827368.99330329657425; Tue, 15 Mar 2022 04:11:19 -0700 (PDT) Received: from localhost ([::1]:59144 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nU55C-0007cj-GJ for importer@patchew.org; Tue, 15 Mar 2022 07:11:18 -0400 Received: from eggs.gnu.org ([209.51.188.92]:36500) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nU52g-0004lm-Si for qemu-devel@nongnu.org; Tue, 15 Mar 2022 07:08:43 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]:33777) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nU52f-0005lu-GG for qemu-devel@nongnu.org; Tue, 15 Mar 2022 07:08:42 -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-333-qtFJtKYAMPCrPsy0ASBfmw-1; Tue, 15 Mar 2022 07:08:37 -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 77AEF811E76; Tue, 15 Mar 2022 11:08:37 +0000 (UTC) Received: from localhost (unknown [10.39.208.19]) by smtp.corp.redhat.com (Postfix) with ESMTP id 546D94B8D42; Tue, 15 Mar 2022 11:08:36 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1647342520; 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=aHrJz7fLtjanxdd0tUM7UcOE0LWEQdryr+KJp5EUtzsH86s3aZQB8vB82xXsg5QK/uzi/1 7Im1uDZWNPvT3EW4qOVrBNwtoP81nB3agONyq+Z+XXoAe0eni416EdNxWQ3JrXBUPPk9cg oF9+r/ysHnxsgz20GAD9i+1BOBECsLQ= X-MC-Unique: qtFJtKYAMPCrPsy0ASBfmw-1 From: marcandre.lureau@redhat.com To: qemu-devel@nongnu.org Subject: [PULL v2 06/12] ui/shader: fix potential leak of shader on error Date: Tue, 15 Mar 2022 15:07:33 +0400 Message-Id: <20220315110739.2095676-7-marcandre.lureau@redhat.com> In-Reply-To: <20220315110739.2095676-1-marcandre.lureau@redhat.com> References: <20220315110739.2095676-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, RCVD_IN_MSPIKE_H4=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: pass (identity @redhat.com) X-ZM-MESSAGEID: 1647342681637100002 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 Sat May 18 01:27:49 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; 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=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1647342874; cv=none; d=zohomail.com; s=zohoarc; b=ZJT3b46Z+AEnZs+NYc8RWcfng57Xvr6OGIHYtSYui4GJyOZwbc40w9Az1+w9aI7520bH2Uf0WxLWhHIJdHc/jVTr2tZUiImmrFxEh5GIdKFIaRk36H6VYm85mJkWGNiAHDBMRQpbYQuk6zZQfmHfBDJX6k874Xfk/rYn/ooMFU0= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1647342874; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=on+QivKNbw7lTPMy4nZ7fYb5ygJ0+hgyP/MxoKhQfG8=; b=ehN1FxQjGJyEg/Od1DrvvL9lIUTRo3WxNu6ioHYitPlPYEKXBc2Np5KpdfytuypgL44RPXak8PN9VJhAiN5g/EAb/7uUMyLi2ZbS2DvzIThTVwZ9ar4mlG1JA31lndcXIGQBh/VlNlPmnMlpEVdIeS5lyUdPuyM299B+v8vWNtc= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; 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=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 164734287495890.04729826660014; Tue, 15 Mar 2022 04:14:34 -0700 (PDT) Received: from localhost ([::1]:39468 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nU58M-0005UJ-1Q for importer@patchew.org; Tue, 15 Mar 2022 07:14:34 -0400 Received: from eggs.gnu.org ([209.51.188.92]:36538) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nU52m-00050x-FO for qemu-devel@nongnu.org; Tue, 15 Mar 2022 07:08:48 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]:59481) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nU52k-0005mD-UH for qemu-devel@nongnu.org; Tue, 15 Mar 2022 07:08:48 -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-593-8jjA1_AINiaDRdbOAH4_jQ-1; Tue, 15 Mar 2022 07:08:43 -0400 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.rdu2.redhat.com [10.11.54.1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 3A53F811E83; Tue, 15 Mar 2022 11:08:43 +0000 (UTC) Received: from localhost (unknown [10.39.208.19]) by smtp.corp.redhat.com (Postfix) with ESMTP id F1D4541136E2; Tue, 15 Mar 2022 11:08:41 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1647342526; 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=dw6ZgSb+PWkymzD4YL6j60Qq/Ta+ZRc7zJOQCrlEQ7st5rMx5WWBaH+OtfWowgRUPvKyXO 7v8f/75WamfPnV1qrtGmCREPolzSfFXSuTiXMw1AAcQeX9HplrTdjSkk1jFn63D5gf2fhR hxwJuru+1vhPNXA1uaCIKBFGiIdG79M= X-MC-Unique: 8jjA1_AINiaDRdbOAH4_jQ-1 From: marcandre.lureau@redhat.com To: qemu-devel@nongnu.org Subject: [PULL v2 07/12] ui/shader: free associated programs Date: Tue, 15 Mar 2022 15:07:34 +0400 Message-Id: <20220315110739.2095676-8-marcandre.lureau@redhat.com> In-Reply-To: <20220315110739.2095676-1-marcandre.lureau@redhat.com> References: <20220315110739.2095676-1-marcandre.lureau@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.11.54.1 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, RCVD_IN_MSPIKE_H4=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: pass (identity @redhat.com) X-ZM-MESSAGEID: 1647342877338100001 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 Sat May 18 01:27:49 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; 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=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1647343073; cv=none; d=zohomail.com; s=zohoarc; b=BSFyv7zZfPeqVXeBU14PVtKdlSkKttnURrecbU2nnnY4SkAnNnSdptWox2CWo7XxnoPWUpkiC5O6mN4Rbfza9J7C+LWt7Ar+FH2yj+6h1mI4LdfhW74K2N0f+pCKKtJLvRHJVYRaP/5nJeIYIKRjzFpdELXNCzsSz5zNwZUHZtE= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1647343073; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=v099OcPbOtt9k+lcjiDiAouQgYElAzCtF1EUPr0juPk=; b=PXq4NUgikZ7Yn60M8FFJ3RivVH7oR8nhIHK8tIL5lJBqQbsSXSSNae2Xtx3onNxGcd6muTtCzSSWz5HrIGd76J13EfqlcxBYTT5fh/O9jT2Z+7MMJOsuAqhSG/qM1/C1lrxo6dy8NdF6hu5U28J2aVSh+geySNdn9srTTcO6Z30= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; 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=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1647343073457219.9825771521921; Tue, 15 Mar 2022 04:17:53 -0700 (PDT) Received: from localhost ([::1]:48106 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nU5BY-0002vx-Hx for importer@patchew.org; Tue, 15 Mar 2022 07:17:52 -0400 Received: from eggs.gnu.org ([209.51.188.92]:36572) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nU52r-0005Iz-GC for qemu-devel@nongnu.org; Tue, 15 Mar 2022 07:08:53 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]:60837) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nU52p-0005mt-Rg for qemu-devel@nongnu.org; Tue, 15 Mar 2022 07:08:53 -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-401-KrfuY_fCPOubIwIsx_YVPA-1; Tue, 15 Mar 2022 07:08:48 -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 EB14F899EC1; Tue, 15 Mar 2022 11:08:47 +0000 (UTC) Received: from localhost (unknown [10.39.208.19]) by smtp.corp.redhat.com (Postfix) with ESMTP id 17E5F4B8D42; Tue, 15 Mar 2022 11:08:46 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1647342531; 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=PPoCdJGVSP2N/n1ATERGSw1eL4JtPiNkujhF81zqxQLjCLORD1SKqyuQOACkM/brDfbEhg kCSgsrdMgksUbBQTtUAy8ABKvYnpTfHruzTY9XzlC0xWj8dbOySI58xh1GMi6Lgn6KsLoQ ERySaH8RQxZPTTqRbypEG9KysBW1GsY= X-MC-Unique: KrfuY_fCPOubIwIsx_YVPA-1 From: marcandre.lureau@redhat.com To: qemu-devel@nongnu.org Subject: [PULL v2 08/12] ui/console: add a dpy_gfx_switch callback helper Date: Tue, 15 Mar 2022 15:07:35 +0400 Message-Id: <20220315110739.2095676-9-marcandre.lureau@redhat.com> In-Reply-To: <20220315110739.2095676-1-marcandre.lureau@redhat.com> References: <20220315110739.2095676-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, RCVD_IN_MSPIKE_H4=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: pass (identity @redhat.com) X-ZM-MESSAGEID: 1647343075268100001 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 Sat May 18 01:27:49 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; 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=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1647342754; cv=none; d=zohomail.com; s=zohoarc; b=ULznS92Zxv4C1tHnB1M//HomO8dfKoQsDHJvscvFalSAmTEkDJUtKkBK0Z/mtuGPI8pJvhuaiAGjp9tB7Y0Dsq7+zZgqAELpzR/6t1gbpsUTInj3f0Njsrn9mVa+yJYLKYD1Gdphh1sx4MICE9avWKiFcEh3fU6y7hXYaM0pGEQ= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1647342754; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=iAVXlPNa+jsMgCn8+FeHE/cMBbWsepJZw/rNFvwgHHQ=; b=nExoiGWkCDQzTb5Wxz9zG7v3UAEHhfDuxeFCP3gvtAtMfVI2r3Tl+O/F7hM85HfDsfJSNb4pk9exB8+4IfsL4P2ZoHExc47oDLOsh7u+1XQamb667AEdBMCTqwrHLnTVuVtHnP5RSKuy0qwlnuUmkU2Es9tJMOSZdI1Oqzi303I= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; 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=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1647342754329978.1721350616443; Tue, 15 Mar 2022 04:12:34 -0700 (PDT) Received: from localhost ([::1]:35852 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nU56P-000318-F9 for importer@patchew.org; Tue, 15 Mar 2022 07:12:33 -0400 Received: from eggs.gnu.org ([209.51.188.92]:36704) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nU53B-0006Ll-OQ for qemu-devel@nongnu.org; Tue, 15 Mar 2022 07:09:13 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]:25335) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nU539-0005qf-N4 for qemu-devel@nongnu.org; Tue, 15 Mar 2022 07:09:13 -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-25--MMvoXoSMJCo5bXcK1aUaw-1; Tue, 15 Mar 2022 07:09:07 -0400 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.rdu2.redhat.com [10.11.54.3]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 479BC3800500; Tue, 15 Mar 2022 11:09:07 +0000 (UTC) Received: from localhost (unknown [10.39.208.19]) by smtp.corp.redhat.com (Postfix) with ESMTP id 53A18111CD4C; Tue, 15 Mar 2022 11:08:51 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1647342551; 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=Ve+bVX284vus0/6gWpFU95IS/PIerPBZ3nOglt/bbulJP4Hq0y4lImjkmC2+tzUPutXXBO 7V36mwBvUxffCJn4BUk9H58zGWAl7oK5tBML/tUhfPYI1SEibP0Jo4tSmpRhf1nRrVDKvh 8oBeHoGjmPEp3/IiupIa1gWtHCjLrag= X-MC-Unique: -MMvoXoSMJCo5bXcK1aUaw-1 From: marcandre.lureau@redhat.com To: qemu-devel@nongnu.org Subject: [PULL v2 09/12] ui/console: optionally update after gfx switch Date: Tue, 15 Mar 2022 15:07:36 +0400 Message-Id: <20220315110739.2095676-10-marcandre.lureau@redhat.com> In-Reply-To: <20220315110739.2095676-1-marcandre.lureau@redhat.com> References: <20220315110739.2095676-1-marcandre.lureau@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.78 on 10.11.54.3 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, RCVD_IN_MSPIKE_H4=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: pass (identity @redhat.com) X-ZM-MESSAGEID: 1647342756699100001 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 Sat May 18 01:27:49 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; 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=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1647343249; cv=none; d=zohomail.com; s=zohoarc; b=InsmbVpKVMrIrSE9jiAHLQ9TL6pJR1CGq9HspP+zZqddHc+qBrbsgDhJ5SIo6KZ1DCgdFTwUPql6greuQVYT9FIi4OygNzXkiFH0vietl/EqpD295ggkUlv5FsUzuzcpvuaq4Ubxf4RC0r51+sg/Bu33XOUHPhd1YVlP+Ql8ju8= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1647343249; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=fTGj5EVCzAsDkVMAFh/FnxSpDnoVM9cdBQqpGU0EkzY=; b=XxJolHYPZV1vDI+YR8ixR8CAoYnM+70xMmCEEpO0Zzj76DwG5rm46VZQrJa7ZFLQShzhsGy6PeSHK5oW0hnXLeJlHf8UlZY1DTyzueBFaVNF/W/48pCGfw8zke1OEBm1GCPM3HlapkchT3K7WB0ezjUlxS7BAZHo+Wf05skbx2s= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; 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=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1647343249548984.7151612578912; Tue, 15 Mar 2022 04:20:49 -0700 (PDT) Received: from localhost ([::1]:55772 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nU5EO-00082o-97 for importer@patchew.org; Tue, 15 Mar 2022 07:20:48 -0400 Received: from eggs.gnu.org ([209.51.188.92]:36762) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nU53J-0006Ro-BI for qemu-devel@nongnu.org; Tue, 15 Mar 2022 07:09:24 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]:52853) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nU53G-0005tp-Fv for qemu-devel@nongnu.org; Tue, 15 Mar 2022 07:09:20 -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-197-yVjnorhYPFWI3ghmqSzQGA-1; Tue, 15 Mar 2022 07:09:13 -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 1D9691C0514D; Tue, 15 Mar 2022 11:09:13 +0000 (UTC) Received: from localhost (unknown [10.39.208.19]) by smtp.corp.redhat.com (Postfix) with ESMTP id 8E499C53741; Tue, 15 Mar 2022 11:09:11 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1647342556; 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=fTGj5EVCzAsDkVMAFh/FnxSpDnoVM9cdBQqpGU0EkzY=; b=Hm0oA+Jv8jRbf3pOFBk/Qxp2e4Ht3UsgEfszW7V8qmMJk9q1LBTzBOfxttzI9vArX3PinP LWcahlSWH13aJ7tHfKMvx5cvhu8B9ExXRKrFBh13Y9zIfSxyzElkZY42WLMOwu30/4A6f3 JfPsdhOI2tghkkKKUmTcmM29CMZdT6I= X-MC-Unique: yVjnorhYPFWI3ghmqSzQGA-1 From: marcandre.lureau@redhat.com To: qemu-devel@nongnu.org Subject: [PULL v2 10/12] ui/dbus: fix texture sharing Date: Tue, 15 Mar 2022 15:07:37 +0400 Message-Id: <20220315110739.2095676-11-marcandre.lureau@redhat.com> In-Reply-To: <20220315110739.2095676-1-marcandre.lureau@redhat.com> References: <20220315110739.2095676-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.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, RCVD_IN_MSPIKE_H4=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: pass (identity @redhat.com) X-ZM-MESSAGEID: 1647343251166100001 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 | 28 ++++++++++++++++++++++++++++ ui/dbus-listener.c | 11 ----------- ui/dbus.c | 26 ++++++++++++++++++++++++++ 4 files changed, 64 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..3b5664535625 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, @@ -1086,6 +1107,9 @@ static void displaychangelistener_display_console(Dis= playChangeListener *dcl, if (!dummy) { dummy =3D qemu_create_placeholder_surface(640, 480, nodev); } + if (con) { + dpy_gfx_create_texture(con, dummy); + } displaychangelistener_gfx_switch(dcl, dummy, TRUE); return; } @@ -1105,6 +1129,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 +1662,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 +1707,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 Sat May 18 01:27:49 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; 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=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1647343567; cv=none; d=zohomail.com; s=zohoarc; b=LL9pEd0tqRKALtxvZ7ouEcbc+UHzzAH3TpKE6lQrZW2f6sSHnCoAQgNXVS1qNcpZyGHwh/YHT9KCFEnoDp9cqnzKPaKt4ALgSMODfsvrHaUSafgnlsw69OdQ75rK+Lphr4EXbwKLsmmXEvtaSdQMlj1xTNeWRrtgOh5odC81OZY= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1647343567; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=PhJu/fGjs6woppUiaVUm0HazUAIcaTnSY8JXdBoNP7M=; b=JE0FINSmrrQB4448IFfoMCZmikGAJ+D6JKFn7FVrZvtwhbXlIftb+uDhrPdBhhZHzBiudBlL6t/l5g86P1KnN0dvJsmK2wOcNzGJn8f4iG+1rfFNauTQhk4+GXRmWZzsoIy8ZIVpVZ5oU7Af6xudCbX3KSZVvHscdejc4xrWl6o= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; 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=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1647343567657138.38719512794125; Tue, 15 Mar 2022 04:26:07 -0700 (PDT) Received: from localhost ([::1]:40218 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nU5JW-0008CE-1P for importer@patchew.org; Tue, 15 Mar 2022 07:26:06 -0400 Received: from eggs.gnu.org ([209.51.188.92]:36818) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nU53S-0006Tf-Kh for qemu-devel@nongnu.org; Tue, 15 Mar 2022 07:09:35 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]:55146) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nU53J-0005uo-JB for qemu-devel@nongnu.org; Tue, 15 Mar 2022 07:09: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-103-KDqxUU6TO4i9WLIwGGRkIQ-1; Tue, 15 Mar 2022 07:09:18 -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 80BB2811E7A; Tue, 15 Mar 2022 11:09:17 +0000 (UTC) Received: from localhost (unknown [10.39.208.19]) by smtp.corp.redhat.com (Postfix) with ESMTP id 473E540C1257; Tue, 15 Mar 2022 11:09:15 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1647342561; 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=Vdyan4670YqEMLXVS+YzOb+IcERUXUExj9LKhP+/wNMqx79s5hyEB4x8fx5L5rrJVCCVWk amdib82t1BxLvDXje7Vx7q1Tn929T26k5f5MMsM0UeOy7g6j7yV+5QJRc+y0gJT97wFIV+ tUULbPGvHJF08gP1YgmXzQSvSPRlTGU= X-MC-Unique: KDqxUU6TO4i9WLIwGGRkIQ-1 From: marcandre.lureau@redhat.com To: qemu-devel@nongnu.org Subject: [PULL v2 11/12] ui/dbus: do not send 2d scanout until gfx_update Date: Tue, 15 Mar 2022 15:07:38 +0400 Message-Id: <20220315110739.2095676-12-marcandre.lureau@redhat.com> In-Reply-To: <20220315110739.2095676-1-marcandre.lureau@redhat.com> References: <20220315110739.2095676-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, RCVD_IN_MSPIKE_H4=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: pass (identity @redhat.com) X-ZM-MESSAGEID: 1647343571612100001 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 Sat May 18 01:27:49 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; 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=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1647343903; cv=none; d=zohomail.com; s=zohoarc; b=DTzMPndaYofB8sEFN7R9GioZkJAO/q8f6vQSCZmoTJ6H30mmVt8lALtQ6b4QS9gf1ichDzQJFt6BeOb587Uyfm+C3tUZT0SpFYrJ6YCvBps+RFWERj4yDzj0bozqnLSutslLhy8NdAvn1jRd53+QlX6E8h+P6MwqQIwgBra59ro= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1647343903; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=BoA6tJMIW8LIVPDF3JpGU+IYeGHULFuVDGVSk3XtsRA=; b=O602LSn7eKHjiUUlh4hWcsXFXH7A1FLSMPQjWZMCJxBKjCxvVYKN54lUPc/ms9x7KQzixNH8VmCFE1t/GW1mGPuaHlgRxNCTsxPEWqvMPtamtpiMjvtBXHVxwoGJMi4qKm9+/W4lp4uhs9m9Z2//+mo7fwZffFvl6FdsRmPSxTE= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; 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=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1647343903901376.6610954211402; Tue, 15 Mar 2022 04:31:43 -0700 (PDT) Received: from localhost ([::1]:48468 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nU5NJ-0005QN-Eo for importer@patchew.org; Tue, 15 Mar 2022 07:30:01 -0400 Received: from eggs.gnu.org ([209.51.188.92]:36824) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nU53U-0006U2-HC for qemu-devel@nongnu.org; Tue, 15 Mar 2022 07:09:35 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]:48206) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nU53P-0005v3-Ug for qemu-devel@nongnu.org; Tue, 15 Mar 2022 07:09:31 -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-665-1P2WlcnhN4uNJufBz05wVA-1; Tue, 15 Mar 2022 07:09:22 -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 9F92B18E52D8; Tue, 15 Mar 2022 11:09:22 +0000 (UTC) Received: from localhost (unknown [10.39.208.19]) by smtp.corp.redhat.com (Postfix) with ESMTP id 8094EC53741; Tue, 15 Mar 2022 11:09:21 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1647342566; 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=BoA6tJMIW8LIVPDF3JpGU+IYeGHULFuVDGVSk3XtsRA=; b=A+3WtIih9toP/v0BLKpFOHkISeipj8PULw1UwD+sqHb11fgDcOW6cGKj7acI1dVn2bQuFH KnNOgjMEuTQUtR9kSVLPhh0v36qwIFdeIDueulflADqQbw4+1lygqqizIkCkAbZyN/f/qG 5IirqV6BJiHw9OSRgAGFyd7yKG+cdMw= X-MC-Unique: 1P2WlcnhN4uNJufBz05wVA-1 From: marcandre.lureau@redhat.com To: qemu-devel@nongnu.org Subject: [PULL v2 12/12] ui/console: call gfx_switch() even if the current scanout is GL Date: Tue, 15 Mar 2022 15:07:39 +0400 Message-Id: <20220315110739.2095676-13-marcandre.lureau@redhat.com> In-Reply-To: <20220315110739.2095676-1-marcandre.lureau@redhat.com> References: <20220315110739.2095676-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.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, RCVD_IN_MSPIKE_H4=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: pass (identity @redhat.com) X-ZM-MESSAGEID: 1647343905561100001 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 3b5664535625..da434ce1b2f7 100644 --- a/ui/console.c +++ b/ui/console.c @@ -1114,6 +1114,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); @@ -1128,9 +1132,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