From nobody Mon Feb 9 17:25:16 2026 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=1711064730; cv=none; d=zohomail.com; s=zohoarc; b=IgbKvEjtbbym9Yo9FqORevpIkF8qBhikwiiqQyd6B6hg+Iicc2qwAAUCQ4LaZSoYE1B7iXG7WD0ZhQ3SyJryWY7DCdaKNbdz+nXTe25GYgPpdm0LAcKipUn1tsPw2GEaRf29aSTnxEhfnCDdLGjBIRbO82PIzscMJfeVRR7hB+k= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1711064730; 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=5AlOMIYMS6LsihoSX826fhcOmgLrZ8AL9iSjcqKoo3I=; b=jZoNfOoS60WT4hsrJgoHCRSzaWoK6VAaGWHxyqOaqp8JUQH8dXu5RfYV9wtZV3urv2rkM217ft029/PWwGd7B+E3EEWh3YFD6fa8Uzw7CJmd6ZoVWs+3Fkx/kpM9j2xjJu4kvjtPLIrsLXBg7NPLLaxnq5I2w6kSKXgroslgkT8= 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 1711064730332513.8785365240095; Thu, 21 Mar 2024 16:45:30 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rnS5B-0007OI-G3; Thu, 21 Mar 2024 19:44:25 -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 1rnS59-0007Nh-F9 for qemu-devel@nongnu.org; Thu, 21 Mar 2024 19:44:23 -0400 Received: from mgamail.intel.com ([198.175.65.16]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1rnS57-0007kU-UO for qemu-devel@nongnu.org; Thu, 21 Mar 2024 19:44:23 -0400 Received: from fmviesa006.fm.intel.com ([10.60.135.146]) by orvoesa108.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 21 Mar 2024 16:44:15 -0700 Received: from dongwonk-z390-aorus-ultra.fm.intel.com ([10.105.129.124]) by fmviesa006.fm.intel.com with ESMTP; 21 Mar 2024 16:44:13 -0700 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1711064663; x=1742600663; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=sI7svSTFRCL8NwyeTl20Ot0CS4c3XsqEdwHOLT2cXZo=; b=ggkzUKDv5ASRGCeR02zXh2BtVpH13rt8FoXCIQ5FP8DafUZcJeIlJApc 8fTDnFafqCwZY5zOu+l8IKo5stSnjYLUxNW45Qx5DupPdBpYy7Gpf3F3/ /9Jq3eDDOWhCIS4hoQpsywFFF9aTXDuDUWDaMr1F0K/oqvkdkTWIMvrto ah+I7TJ43Q7JZ6PkuIM7T6724H3Bw7sQHlLSxvnbVrHgqbg5S1x7gtywJ 0ocHUWBs/DabvezcFbL44kQgI6dVkBs/S+uh77qimy65u3UpksA93ouhn LLYfnFGU09rKgab1rIV8qzYUYCs3Hg7fDyJibvVzP0jO+iHnjyYUTr9eR g==; X-IronPort-AV: E=McAfee;i="6600,9927,11020"; a="6217228" X-IronPort-AV: E=Sophos;i="6.07,144,1708416000"; d="scan'208";a="6217228" X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.07,144,1708416000"; d="scan'208";a="14743275" From: dongwon.kim@intel.com To: qemu-devel@nongnu.org Cc: philmd@linaro.org, marcandre.lureau@redhat.com Subject: [PATCH v4 2/3] ui/console: Introduce dpy_gl_dmabuf_get_fd() helper Date: Thu, 21 Mar 2024 16:42:35 -0700 Message-Id: <20240321234236.3476163-3-dongwon.kim@intel.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240321234236.3476163-1-dongwon.kim@intel.com> References: <20240321234236.3476163-1-dongwon.kim@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.16; envelope-from=dongwon.kim@intel.com; helo=mgamail.intel.com X-Spam_score_int: -24 X-Spam_score: -2.5 X-Spam_bar: -- X-Spam_report: (-2.5 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.372, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 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: 1711064732055100006 From: Dongwon Kim dpy_gl_dmabuf_get_fd() is a helper for retrieving FD of the dmabuf from QemuDmaBuf struct. Cc: Philippe Mathieu-Daud=C3=A9 Cc: Marc-Andr=C3=A9 Lureau Cc: Vivek Kasireddy Signed-off-by: Dongwon Kim --- include/ui/console.h | 1 + hw/vfio/display.c | 8 +++++++- ui/console.c | 9 +++++++++ 3 files changed, 17 insertions(+), 1 deletion(-) diff --git a/include/ui/console.h b/include/ui/console.h index 6064487fc4..d5334a806c 100644 --- a/include/ui/console.h +++ b/include/ui/console.h @@ -360,6 +360,7 @@ void dpy_gl_cursor_position(QemuConsole *con, uint32_t pos_x, uint32_t pos_y); uint32_t dpy_gl_dmabuf_get_width(QemuDmaBuf *dmabuf); uint32_t dpy_gl_dmabuf_get_height(QemuDmaBuf *dmabuf); +int32_t dpy_gl_dmabuf_get_fd(QemuDmaBuf *dmabuf); void dpy_gl_release_dmabuf(QemuConsole *con, QemuDmaBuf *dmabuf); void dpy_gl_update(QemuConsole *con, diff --git a/hw/vfio/display.c b/hw/vfio/display.c index c962e5f88f..676b2fc5f3 100644 --- a/hw/vfio/display.c +++ b/hw/vfio/display.c @@ -259,9 +259,15 @@ static VFIODMABuf *vfio_display_get_dmabuf(VFIOPCIDevi= ce *vdev, =20 static void vfio_display_free_one_dmabuf(VFIODisplay *dpy, VFIODMABuf *dma= buf) { + int fd; + QTAILQ_REMOVE(&dpy->dmabuf.bufs, dmabuf, next); + fd =3D dpy_gl_dmabuf_get_fd(&dmabuf->buf); + if (fd > -1) { + close(fd); + } + dpy_gl_release_dmabuf(dpy->con, &dmabuf->buf); - close(dmabuf->buf.fd); g_free(dmabuf); } =20 diff --git a/ui/console.c b/ui/console.c index 1d0513a733..69560aac7e 100644 --- a/ui/console.c +++ b/ui/console.c @@ -1504,6 +1504,15 @@ int qemu_console_get_height(QemuConsole *con, int fa= llback) } } =20 +int32_t dpy_gl_dmabuf_get_fd(QemuDmaBuf *dmabuf) +{ + if (dmabuf) { + return dmabuf->fd; + } + + return -1; +} + int qemu_invalidate_text_consoles(void) { QemuConsole *s; --=20 2.34.1