From nobody Mon Feb 9 16:34:52 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=KeNBzq3XhmTe91geX7H+OF0HbdiQk/SwCSS1sTsQs9vifN/yTQuubykiSTFh8Iiiep6zQ1Iomz4/ErXCOaH8P2O110hWp7P3JFU2W/9THb8GpM68dbU//ScWOSUkNRMTIQRen1VUTcQBEL4f/Rh2ohgmEzFitndSyv3bCCCCo8g= 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=KXATRJp4mgAd2UIsY0nlKaepgkLgg27+8JVqFJ0YGDg=; b=JS0Vk6zGt73hnu5lY0teZUD1T2eMRxEasEwuSkz/IaJdwomNwuL4+j4gWOgJunsebIqVbRZowFESWPHahr45jXbv93g5XOOX79pfKgf6eUGUp5TaUM9S2G9kcHyA7IGN9kLsivrY9BMdvIcCgpk1C8Cjm/2bOvvpHrVbwOVo23M= 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 1711064730448934.3305268430822; 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 1rnS59-0007Ng-Eq; Thu, 21 Mar 2024 19:44:23 -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 1rnS58-0007NU-48 for qemu-devel@nongnu.org; Thu, 21 Mar 2024 19:44:22 -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 1rnS56-0007iR-A3 for qemu-devel@nongnu.org; Thu, 21 Mar 2024 19:44:21 -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:14 -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=1711064661; x=1742600661; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=HWowGrDZ5wAvedguTHijDQ0FxMS517gzwRYLO/rG7Tk=; b=fKzv+lX5JRiIgmdO0Qc/iEQUY34rDk9JFhYYDLCxyySUCHobl7K2JRIC 2K2kh0PdBUDAq6V6lnmy36yuX47kgrbTvWFKVMeGDc3aiVb73o+68/nvk n9O4qipgManTRaP6/tIeIrEK+vQQtk5QUkwBMp1F9cYX+E4YOK0DgNyJe R4w1aKmHI6hQ90GElYWIgKSLUQ3LOuuUVVWy4SGZs61oLJ17l/ixYxIeL KhGS/FTXDp07NGcoQNH3GEhN46XG3wmLVSsIVV6vnWdXJLf11UVNDB7Ym rDR9E8FRJyqIUJTVGaiul0vVsCZtgOrD1cgnWfZJYvXnidSBkb+pb39Cp w==; X-IronPort-AV: E=McAfee;i="6600,9927,11020"; a="6217225" X-IronPort-AV: E=Sophos;i="6.07,144,1708416000"; d="scan'208";a="6217225" X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.07,144,1708416000"; d="scan'208";a="14743274" From: dongwon.kim@intel.com To: qemu-devel@nongnu.org Cc: philmd@linaro.org, marcandre.lureau@redhat.com Subject: [PATCH v4 1/3] ui/console: Introduce dpy_gl_dmabuf_get_height/width() helpers Date: Thu, 21 Mar 2024 16:42:34 -0700 Message-Id: <20240321234236.3476163-2-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: 1711064732039100005 From: Dongwon Kim dpy_gl_dmabuf_get_height() and dpy_gl_dmabuf_get_width() are helpers for retrieving width and height fields 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 | 2 ++ hw/display/virtio-gpu-udmabuf.c | 7 ++++--- hw/vfio/display.c | 9 ++++++--- ui/console.c | 18 ++++++++++++++++++ 4 files changed, 30 insertions(+), 6 deletions(-) diff --git a/include/ui/console.h b/include/ui/console.h index 0bc7a00ac0..6064487fc4 100644 --- a/include/ui/console.h +++ b/include/ui/console.h @@ -358,6 +358,8 @@ void dpy_gl_cursor_dmabuf(QemuConsole *con, QemuDmaBuf = *dmabuf, bool have_hot, uint32_t hot_x, uint32_t hot_y); 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); void dpy_gl_release_dmabuf(QemuConsole *con, QemuDmaBuf *dmabuf); void dpy_gl_update(QemuConsole *con, diff --git a/hw/display/virtio-gpu-udmabuf.c b/hw/display/virtio-gpu-udmabu= f.c index d51184d658..a4ebf828ec 100644 --- a/hw/display/virtio-gpu-udmabuf.c +++ b/hw/display/virtio-gpu-udmabuf.c @@ -206,6 +206,7 @@ int virtio_gpu_update_dmabuf(VirtIOGPU *g, { struct virtio_gpu_scanout *scanout =3D &g->parent_obj.scanout[scanout_= id]; VGPUDMABuf *new_primary, *old_primary =3D NULL; + uint32_t width, height; =20 new_primary =3D virtio_gpu_create_dmabuf(g, scanout_id, res, fb, r); if (!new_primary) { @@ -216,10 +217,10 @@ int virtio_gpu_update_dmabuf(VirtIOGPU *g, old_primary =3D g->dmabuf.primary[scanout_id]; } =20 + width =3D dpy_gl_dmabuf_get_width(&new_primary->buf); + height =3D dpy_gl_dmabuf_get_height(&new_primary->buf); g->dmabuf.primary[scanout_id] =3D new_primary; - qemu_console_resize(scanout->con, - new_primary->buf.width, - new_primary->buf.height); + qemu_console_resize(scanout->con, width, height); dpy_gl_scanout_dmabuf(scanout->con, &new_primary->buf); =20 if (old_primary) { diff --git a/hw/vfio/display.c b/hw/vfio/display.c index 1aa440c663..c962e5f88f 100644 --- a/hw/vfio/display.c +++ b/hw/vfio/display.c @@ -286,6 +286,7 @@ static void vfio_display_dmabuf_update(void *opaque) VFIOPCIDevice *vdev =3D opaque; VFIODisplay *dpy =3D vdev->dpy; VFIODMABuf *primary, *cursor; + uint32_t width, height; bool free_bufs =3D false, new_cursor =3D false; =20 primary =3D vfio_display_get_dmabuf(vdev, DRM_PLANE_TYPE_PRIMARY); @@ -296,10 +297,12 @@ static void vfio_display_dmabuf_update(void *opaque) return; } =20 + width =3D dpy_gl_dmabuf_get_width(&primary->buf); + height =3D dpy_gl_dmabuf_get_height(&primary->buf); + if (dpy->dmabuf.primary !=3D primary) { dpy->dmabuf.primary =3D primary; - qemu_console_resize(dpy->con, - primary->buf.width, primary->buf.height); + qemu_console_resize(dpy->con, width, height); dpy_gl_scanout_dmabuf(dpy->con, &primary->buf); free_bufs =3D true; } @@ -328,7 +331,7 @@ static void vfio_display_dmabuf_update(void *opaque) cursor->pos_updates =3D 0; } =20 - dpy_gl_update(dpy->con, 0, 0, primary->buf.width, primary->buf.height); + dpy_gl_update(dpy->con, 0, 0, width, height); =20 if (free_bufs) { vfio_display_free_dmabufs(vdev); diff --git a/ui/console.c b/ui/console.c index 43226c5c14..1d0513a733 100644 --- a/ui/console.c +++ b/ui/console.c @@ -1132,6 +1132,24 @@ void dpy_gl_cursor_position(QemuConsole *con, } } =20 +uint32_t dpy_gl_dmabuf_get_width(QemuDmaBuf *dmabuf) +{ + if (dmabuf) { + return dmabuf->width; + } + + return 0; +} + +uint32_t dpy_gl_dmabuf_get_height(QemuDmaBuf *dmabuf) +{ + if (dmabuf) { + return dmabuf->height; + } + + return 0; +} + void dpy_gl_release_dmabuf(QemuConsole *con, QemuDmaBuf *dmabuf) { --=20 2.34.1