From nobody Sat Jun 1 09:12:26 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail header.i=@intel.com; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=intel.com Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1646627943963863.1486662452094; Sun, 6 Mar 2022 20:39:03 -0800 (PST) Received: from localhost ([::1]:56798 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nR59C-0007bn-17 for importer@patchew.org; Sun, 06 Mar 2022 23:39:02 -0500 Received: from eggs.gnu.org ([209.51.188.92]:59650) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nR589-0006sN-SV for qemu-devel@nongnu.org; Sun, 06 Mar 2022 23:37:58 -0500 Received: from mga12.intel.com ([192.55.52.136]:8316) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nR587-0002ib-CV for qemu-devel@nongnu.org; Sun, 06 Mar 2022 23:37:57 -0500 Received: from orsmga003.jf.intel.com ([10.7.209.27]) by fmsmga106.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 06 Mar 2022 20:37:50 -0800 Received: from vkasired-desk2.fm.intel.com ([10.105.128.127]) by orsmga003-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 06 Mar 2022 20:37:49 -0800 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1646627875; x=1678163875; h=from:to:cc:subject:date:message-id:mime-version: content-transfer-encoding; bh=GEPWLTv/7bTPoAhnBTjOhiR8oMOKa5y54hoO/ZFmG24=; b=QDr7DxLRDmcaBihl5m6smksNklMKxzIK3kedVNiC7IZGbnmqB/8GW113 VegT4N3bKxew7nR5A7ZRmV2PrONXU8QWDbkblA/qbtF3GEqonz2ek3ql0 MgMULdrdSB7Fzf3mk0vKvP43W+biQnt4gDOyT0PCEM9OMCkjm1SfZEgho 5cUDfljftLvzvgZOC58dq1Vrjisgj6QIgsyDSpthhUxdfsXdiodj6sh5t aH0qRnlsCEbqWtKhpIjZe1mjUb/muZcV4UrgvkZtqmoQLZKxY6ic1w3PI jjpGbP6QuB1+RIBQ5uqbAawVkIrPhy8rgN19u7qLndiqQzsANJ6CgC2mr w==; X-IronPort-AV: E=McAfee;i="6200,9189,10278"; a="234251360" X-IronPort-AV: E=Sophos;i="5.90,160,1643702400"; d="scan'208";a="234251360" X-IronPort-AV: E=Sophos;i="5.90,160,1643702400"; d="scan'208";a="494919983" From: Vivek Kasireddy To: qemu-devel@nongnu.org Subject: [PATCH v1] ui/gtk-egl: Check for a valid context before making EGL calls Date: Sun, 6 Mar 2022 20:21:08 -0800 Message-Id: <20220307042108.296428-1-vivek.kasireddy@intel.com> X-Mailer: git-send-email 2.35.1 MIME-Version: 1.0 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=192.55.52.136; envelope-from=vivek.kasireddy@intel.com; helo=mga12.intel.com X-Spam_score_int: -44 X-Spam_score: -4.5 X-Spam_bar: ---- X-Spam_report: (-4.5 / 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_MED=-2.3, SPF_HELO_PASS=-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: =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , Dongwon Kim , Vivek Kasireddy , Gerd Hoffmann Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZM-MESSAGEID: 1646627946501100001 Since not all listeners (i.e VirtualConsoles) of GL events have a valid EGL context, make sure that there is a valid context before making EGL calls. This fixes the following crash seen while launching the VM with "-device virtio-gpu-pci,max_outputs=3D1,blob=3Dtrue -display gtk,gl=3Don" No provider of eglCreateImageKHR found. Requires one of: EGL_KHR_image EGL_KHR_image_base Fixes: 7cc712e9862ff ("ui: dispatch GL events to all listeners") Cc: Marc-Andr=C3=A9 Lureau Cc: Gerd Hoffmann Cc: Dongwon Kim Signed-off-by: Vivek Kasireddy --- ui/gtk-egl.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/ui/gtk-egl.c b/ui/gtk-egl.c index e3bd4bc274..31175827d0 100644 --- a/ui/gtk-egl.c +++ b/ui/gtk-egl.c @@ -244,6 +244,10 @@ void gd_egl_scanout_dmabuf(DisplayChangeListener *dcl, #ifdef CONFIG_GBM VirtualConsole *vc =3D container_of(dcl, VirtualConsole, gfx.dcl); =20 + if (!vc->gfx.ectx || !vc->gfx.esurface) { + return; + } + eglMakeCurrent(qemu_egl_display, vc->gfx.esurface, vc->gfx.esurface, vc->gfx.ectx); =20 @@ -269,6 +273,10 @@ void gd_egl_cursor_dmabuf(DisplayChangeListener *dcl, #ifdef CONFIG_GBM VirtualConsole *vc =3D container_of(dcl, VirtualConsole, gfx.dcl); =20 + if (!vc->gfx.ectx || !vc->gfx.esurface) { + return; + } + if (dmabuf) { egl_dmabuf_import_texture(dmabuf); if (!dmabuf->texture) { --=20 2.35.1