From nobody Fri Oct 31 09:45:22 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) client-ip=192.237.175.120; envelope-from=xen-devel-bounces@lists.xenproject.org; helo=lists.xenproject.org; Authentication-Results: mx.zohomail.com; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=fail(p=none dis=none) header.from=suse.de Return-Path: Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) by mx.zohomail.com with SMTPS id 1749805902757307.7120107893919; Fri, 13 Jun 2025 02:11:42 -0700 (PDT) Received: from list by lists.xenproject.org with outflank-mailman.1014014.1392275 (Exim 4.92) (envelope-from ) id 1uQ0Rf-0002VX-Rd; Fri, 13 Jun 2025 09:11:31 +0000 Received: by outflank-mailman (output) from mailman id 1014014.1392275; Fri, 13 Jun 2025 09:11:31 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1uQ0Rf-0002VO-Oa; Fri, 13 Jun 2025 09:11:31 +0000 Received: by outflank-mailman (input) for mailman id 1014014; Fri, 13 Jun 2025 09:11:30 +0000 Received: from se1-gles-sth1-in.inumbo.com ([159.253.27.254] helo=se1-gles-sth1.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1uQ0LL-0002BZ-Dd for xen-devel@lists.xenproject.org; Fri, 13 Jun 2025 09:04:59 +0000 Received: from smtp-out1.suse.de (smtp-out1.suse.de [2a07:de40:b251:101:10:150:64:1]) by se1-gles-sth1.inumbo.com (Halon) with ESMTPS id 7b2848a5-4835-11f0-a309-13f23c93f187; Fri, 13 Jun 2025 11:04:59 +0200 (CEST) Received: from imap1.dmz-prg2.suse.org (imap1.dmz-prg2.suse.org [IPv6:2a07:de40:b281:104:10:150:64:97]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by smtp-out1.suse.de (Postfix) with ESMTPS id 1D02A2127F; Fri, 13 Jun 2025 09:04:50 +0000 (UTC) Received: from imap1.dmz-prg2.suse.org (localhost [127.0.0.1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by imap1.dmz-prg2.suse.org (Postfix) with ESMTPS id 20C8F137FE; Fri, 13 Jun 2025 09:04:49 +0000 (UTC) Received: from dovecot-director2.suse.de ([2a07:de40:b281:106:10:150:64:167]) by imap1.dmz-prg2.suse.org with ESMTPSA id OJSgBrHpS2inNAAAD6G6ig (envelope-from ); Fri, 13 Jun 2025 09:04:49 +0000 X-Outflank-Mailman: Message body and most headers restored to incoming version X-BeenThere: xen-devel@lists.xenproject.org List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xenproject.org Precedence: list Sender: "Xen-devel" X-Inumbo-ID: 7b2848a5-4835-11f0-a309-13f23c93f187 Authentication-Results: smtp-out1.suse.de; none From: Thomas Zimmermann To: simona@ffwll.ch, airlied@gmail.com, mripard@kernel.org, maarten.lankhorst@linux.intel.com, geert@linux-m68k.org, tomi.valkeinen@ideasonboard.com Cc: dri-devel@lists.freedesktop.org, linux-mediatek@lists.infradead.org, freedreno@lists.freedesktop.org, linux-arm-msm@vger.kernel.org, imx@lists.linux.dev, linux-samsung-soc@vger.kernel.org, nouveau@lists.freedesktop.org, virtualization@lists.linux.dev, spice-devel@lists.freedesktop.org, linux-renesas-soc@vger.kernel.org, linux-rockchip@lists.infradead.org, linux-tegra@vger.kernel.org, intel-xe@lists.freedesktop.org, xen-devel@lists.xenproject.org, Thomas Zimmermann , Thierry Reding , Thierry Reding , Mikko Perttunen Subject: [PATCH v5 20/25] drm/tegra: Compute dumb-buffer sizes with drm_mode_size_dumb() Date: Fri, 13 Jun 2025 11:00:39 +0200 Message-ID: <20250613090431.127087-21-tzimmermann@suse.de> X-Mailer: git-send-email 2.49.0 In-Reply-To: <20250613090431.127087-1-tzimmermann@suse.de> References: <20250613090431.127087-1-tzimmermann@suse.de> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Rspamd-Pre-Result: action=no action; module=replies; Message is reply to one we originated X-Spamd-Result: default: False [-4.00 / 50.00]; REPLY(-4.00)[]; TAGGED_RCPT(0.00)[] X-Rspamd-Queue-Id: 1D02A2127F X-Rspamd-Pre-Result: action=no action; module=replies; Message is reply to one we originated X-Rspamd-Action: no action X-Spam-Level: X-Spam-Flag: NO X-Rspamd-Server: rspamd1.dmz-prg2.suse.org X-Spam-Score: -4.00 X-ZM-MESSAGEID: 1749805904994124100 Content-Type: text/plain; charset="utf-8" Call drm_mode_size_dumb() to compute dumb-buffer scanline pitch and buffer size. Align the pitch according to hardware requirements. Signed-off-by: Thomas Zimmermann Acked-by: Thierry Reding Cc: Thierry Reding Cc: Mikko Perttunen --- drivers/gpu/drm/tegra/gem.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/drivers/gpu/drm/tegra/gem.c b/drivers/gpu/drm/tegra/gem.c index dbc1394f96b8..9b9dabbc8ec9 100644 --- a/drivers/gpu/drm/tegra/gem.c +++ b/drivers/gpu/drm/tegra/gem.c @@ -16,6 +16,7 @@ #include =20 #include +#include #include =20 #include "drm.h" @@ -542,12 +543,13 @@ void tegra_bo_free_object(struct drm_gem_object *gem) int tegra_bo_dumb_create(struct drm_file *file, struct drm_device *drm, struct drm_mode_create_dumb *args) { - unsigned int min_pitch =3D DIV_ROUND_UP(args->width * args->bpp, 8); struct tegra_drm *tegra =3D drm->dev_private; struct tegra_bo *bo; + int ret; =20 - args->pitch =3D round_up(min_pitch, tegra->pitch_align); - args->size =3D args->pitch * args->height; + ret =3D drm_mode_size_dumb(drm, args, tegra->pitch_align, 0); + if (ret) + return ret; =20 bo =3D tegra_bo_create_with_handle(file, drm, args->size, 0, &args->handle); --=20 2.49.0