From nobody Sat Nov 15 20:34:36 2025 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass 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=pass(p=none dis=none) header.from=intel.com ARC-Seal: i=1; a=rsa-sha256; t=1748495829; cv=none; d=zohomail.com; s=zohoarc; b=VDTIHcrXzpIHf/nLAOrsslhuWln6nQXkmXWBpqHrgify0FEZiny+rWBTieGmKuP7NAWH3C85zugpVADUvqZkm88a/A2M/ALqWfVjFPBvO6g1yCY9MIJ24tR0vmuX5LUYlgpyE9mVsXO5RNcAMLiS/cdxu3GTJ89QmpDfsOteoEA= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1748495829; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=Gj9AzNANB5mc70yH+VANlmLvdt4Xr/8WAr5Z2QrpiFs=; b=gqGyem3SbLyL+pN58kPRRx5wd0Ce2DgZg9pbnVI/9hfZ80657XLYxLf7XP6i5rOMUkV13HnKHex04kU/tAhRjH4AjHapWA7+/biqegxWen9zP7E0uP+kBqIUnK8maf0zIcxChTYnutDu26eZH/eAd2GhzNpufOFOjbG4SZHWfMk= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass 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=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 1748495829851491.37193507459904; Wed, 28 May 2025 22:17:09 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1uKVca-0007w4-JE; Thu, 29 May 2025 01:16:04 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1uKVcY-0007vr-SE for qemu-devel@nongnu.org; Thu, 29 May 2025 01:16:02 -0400 Received: from mgamail.intel.com ([198.175.65.20]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1uKVcV-0008Dw-4a for qemu-devel@nongnu.org; Thu, 29 May 2025 01:16:01 -0400 Received: from orviesa002.jf.intel.com ([10.64.159.142]) by orvoesa112.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 28 May 2025 22:15:26 -0700 Received: from vkasired-desk2.fm.intel.com ([10.105.128.132]) by orviesa002-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 28 May 2025 22:15:26 -0700 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1748495759; x=1780031759; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=Yc17k8wpWISIogACctnSyw91kp14hKgKC9OUBV5WR2c=; b=eTFk40SWex2UR7GiyGn8FTyC6KR+i2HO6/uwDcemE0OQE0rC1q/KqAIj FXzA44oNX3QFuO2CzyoCM5qiCDeHr3IUFj1B9CfUA+7EmzW8qyVUpCaWh In6S4d8ydX1p3rI/Wbm0bI4ef+UGNZImZPILyX1hwW2NnNglQ5vLSZufn WjOCed0RqYEywBu28mKJK9kYSdS+xbI3z+e+Z+niWx5HZQw4ZF/D1gL7i OvesehMhjqma0lv3Ka+DFTx65bRq2AwDqst175mJrHkJ7Yt2K2nyWrnWJ 15PedcYvor9geh+fHQHQ3fMbA6EuD7/vx6ze63UB1MImr09BWiZHRMX4U g==; X-CSE-ConnectionGUID: RkNQ1a+ySzSeJTlET5mExg== X-CSE-MsgGUID: l3B4MD63TEuDoxueYouOlg== X-IronPort-AV: E=McAfee;i="6700,10204,11447"; a="50241883" X-IronPort-AV: E=Sophos;i="6.15,323,1739865600"; d="scan'208";a="50241883" X-CSE-ConnectionGUID: xKV80PK/Q6WqCD5NfZBdLg== X-CSE-MsgGUID: 64KBo6hqSOKbyEkG1YOJbA== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.15,323,1739865600"; d="scan'208";a="174455333" From: Vivek Kasireddy To: qemu-devel@nongnu.org Cc: Vivek Kasireddy , Gerd Hoffmann , =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , Dmitry Osipenko , Frediano Ziglio , Dongwon Kim , Michael Scherle Subject: [PATCH v5 1/7] ui/egl-helpers: Error check the fds in egl_dmabuf_export_texture() Date: Wed, 28 May 2025 22:11:12 -0700 Message-ID: <20250529051352.1409904-2-vivek.kasireddy@intel.com> X-Mailer: git-send-email 2.49.0 In-Reply-To: <20250529051352.1409904-1-vivek.kasireddy@intel.com> References: <20250529051352.1409904-1-vivek.kasireddy@intel.com> 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=198.175.65.20; envelope-from=vivek.kasireddy@intel.com; helo=mgamail.intel.com X-Spam_score_int: -72 X-Spam_score: -7.3 X-Spam_bar: ------- X-Spam_report: (-7.3 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-2.904, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_MED=-2.3, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, RCVD_IN_VALIDITY_SAFE_BLOCKED=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 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: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @intel.com) X-ZM-MESSAGEID: 1748495831836116600 While trying to export and obtain fds associated with a texture, it is possible that the fds returned after eglExportDMABUFImageMESA() call have error values. Therefore, we need to evaluate the value of all fds and return false if any of them are negative. Cc: Gerd Hoffmann Cc: Marc-Andr=C3=A9 Lureau Cc: Dmitry Osipenko Cc: Frediano Ziglio Cc: Dongwon Kim Cc: Michael Scherle Signed-off-by: Vivek Kasireddy --- ui/egl-helpers.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/ui/egl-helpers.c b/ui/egl-helpers.c index 5503a795e4..e3f2872cc1 100644 --- a/ui/egl-helpers.c +++ b/ui/egl-helpers.c @@ -295,6 +295,7 @@ bool egl_dmabuf_export_texture(uint32_t tex_id, int *fd= , EGLint *offset, { EGLImageKHR image; EGLuint64KHR modifiers[DMABUF_MAX_PLANES]; + int i; =20 image =3D eglCreateImageKHR(qemu_egl_display, eglGetCurrentContext(), EGL_GL_TEXTURE_2D_KHR, @@ -314,6 +315,11 @@ bool egl_dmabuf_export_texture(uint32_t tex_id, int *f= d, EGLint *offset, *modifier =3D modifiers[0]; } =20 + for (i =3D 0; i < *num_planes; i++) { + if (fd[i] < 0) { + return false; + } + } return true; } =20 --=20 2.49.0