Received: by 10.223.176.5 with SMTP id f5csp4410868wra; Tue, 30 Jan 2018 06:59:08 -0800 (PST) X-Google-Smtp-Source: AH8x225+Asqgr6xPErL5wBTkfm3mNe2SWHyvtTX1oqKJ35aP76ddR1f1yKMQ4tMprre50BYSEJql X-Received: by 10.99.190.15 with SMTP id l15mr24221013pgf.197.1517324347869; Tue, 30 Jan 2018 06:59:07 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1517324347; cv=none; d=google.com; s=arc-20160816; b=pi9zY5/ZCYsdIHaXNU5c+V+1XN9bCgpizeWhBLun/5kEPvyswC/hrgF7gjp91SRKSz bsernO6vBO9JWQcH760CI2dVhTTNe4BCpJJgQQiRjFXsrsuRPy5L3ltdVfluSiyuVV9w 4+KJtqikkUfBs2q1RxW8cRdnDZMxDuIgoljhgwe0CNaOIPYP6xiAiHAWa6ZTP0pjLAMA 8FScKsjkioJyANPEusegXp+6OS76Y/V2D7agwVh6hzaRxgyDboGY2sK2ovRf5exHpEPI WDdrG5ITIqgh2EPvB1V7p+BXvyhYaCwTohQr6/b81VLaol3E0eqX/YQPHjvDuI7Zmg9K tb+A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:organization:message-id:date:subject:cc:to :from:dkim-signature:arc-authentication-results; bh=44cx3sB8hgcXhV1oTsxhGBy1effHHmSTbla3BiTVfhg=; b=YNN7A6jHCO+jQA5qaFGkriXz5rRNmosyXYOUh3CTB94OS/n8vQUZte04XrBCgssWfB l3RLOhwyCLsLMPiI6gcC2QY23OYKXMi3LVNvVvxJgomVzGUoTMflJtn/l38GjrEZXScX wfy976fGfA/p1w1Xq5oJOxuyOr5srHF0nnlM2Wc1ZUjs6IolclGSbftPKg/lOVkUo2IC HlKBhogPlPFyqpFhkLJpAXzx0lYuVnAfcZWQhVcbEuxGPjtRu091GK+48ezAkvj9jjls GElCtydeuPuf85OdTi7hvBLa1nRla740Kqn3/toe7cytoMIl/c0JU+3xL1xAShKWplQA ax0A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass (test mode) header.i=@ideasonboard.com header.s=mail header.b=JUyGX6Hm; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id i1-v6si1178624pld.42.2018.01.30.06.58.53; Tue, 30 Jan 2018 06:59:07 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass (test mode) header.i=@ideasonboard.com header.s=mail header.b=JUyGX6Hm; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752855AbeA3O5x (ORCPT + 99 others); Tue, 30 Jan 2018 09:57:53 -0500 Received: from galahad.ideasonboard.com ([185.26.127.97]:45492 "EHLO galahad.ideasonboard.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752786AbeA3O5w (ORCPT ); Tue, 30 Jan 2018 09:57:52 -0500 Received: from avalon.localnet (unknown [IPv6:2a02:a03f:52fb:2b00:ac86:2f77:64c9:83c0]) by galahad.ideasonboard.com (Postfix) with ESMTPSA id 2CE592014A; Tue, 30 Jan 2018 15:56:40 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1517324200; bh=vaS+SnzVhc7bui4+X7lLl0uGqz/INoTqKumd5Xl5s4I=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=JUyGX6Hmc6WYaMed7R0ciC2/lhL7zNGx1VfhZsoZk8lnDTy4uUUV65XaKFBcLKrpz 0pC5PMTf5rX+YPvhxNIrFuNuMSKlChsiShOvD9ZqVZDvzz/uGTOEYME93AU+6BcVKr PatlhK9vclYGbINAWxgw9b7v3LdOAJJLoMG/mmPM= From: Laurent Pinchart To: Philippe Cornu Cc: Yannick Fertre , Benjamin Gaignard , Vincent Abriou , David Airlie , dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org, Archit Taneja , Andrzej Hajda , Fabien Dessenne , Mickael Reulier , Ludovic Barre , Alexandre Torgue , Maxime Coquelin Subject: Re: [PATCH v2] drm/stm: drv: Improve data transfers Date: Tue, 30 Jan 2018 16:58:07 +0200 Message-ID: <3365044.AohtTD8A6l@avalon> Organization: Ideas on Board Oy In-Reply-To: <20180130104200.21602-1-philippe.cornu@st.com> References: <20180130104200.21602-1-philippe.cornu@st.com> MIME-Version: 1.0 Content-Transfer-Encoding: 7Bit Content-Type: text/plain; charset="us-ascii" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Philippe, Thank you for the patch. On Tuesday, 30 January 2018 12:42:00 EET Philippe Cornu wrote: > To optimize data transfers, align pitch on 128 bytes & height > on 4 bytes. This optimization is not applicable on hw without MMU. > > Signed-off-by: Yannick Fertre > Signed-off-by: Vincent Abriou > Signed-off-by: Philippe Cornu > --- > Changes in v2: Rename stm_dumb_create() to stm_gem_cma_dumb_create() and > move CONFIG_MMU inside the function following comments from Benjamin > Gaignard. > > drivers/gpu/drm/stm/drv.c | 20 +++++++++++++++++++- > 1 file changed, 19 insertions(+), 1 deletion(-) > > diff --git a/drivers/gpu/drm/stm/drv.c b/drivers/gpu/drm/stm/drv.c > index 8fe954c27fba..8bc7e8418b8d 100644 > --- a/drivers/gpu/drm/stm/drv.c > +++ b/drivers/gpu/drm/stm/drv.c > @@ -31,6 +31,24 @@ static const struct drm_mode_config_funcs > drv_mode_config_funcs = { .atomic_commit = drm_atomic_helper_commit, > }; > > +static int stm_gem_cma_dumb_create(struct drm_file *file, > + struct drm_device *dev, > + struct drm_mode_create_dumb *args) > +{ > +#ifdef CONFIG_MMU > + unsigned int min_pitch = DIV_ROUND_UP(args->width * args->bpp, 8); > + > + /* > + * in order to optimize data transfer, pitch is aligned on > + * 128 bytes, height is aligned on 4 bytes > + */ > + args->pitch = roundup(min_pitch, 128); > + args->height = roundup(args->height, 4); > +#endif > + > + return drm_gem_cma_dumb_create_internal(file, dev, args); In the !CONFIG_MMU case you now bypass the pitch and size calculations performed by drm_gem_cma_dumb_create(), allowing userspace to allocate arbitrarily large buffers. Is that intentional ? > +} > + > DEFINE_DRM_GEM_CMA_FOPS(drv_driver_fops); > > static struct drm_driver drv_driver = { > @@ -44,7 +62,7 @@ static struct drm_driver drv_driver = { > .minor = 0, > .patchlevel = 0, > .fops = &drv_driver_fops, > - .dumb_create = drm_gem_cma_dumb_create, > + .dumb_create = stm_gem_cma_dumb_create, > .prime_handle_to_fd = drm_gem_prime_handle_to_fd, > .prime_fd_to_handle = drm_gem_prime_fd_to_handle, > .gem_free_object_unlocked = drm_gem_cma_free_object, -- Regards, Laurent Pinchart