Received: by 10.223.176.5 with SMTP id f5csp4020661wra; Tue, 30 Jan 2018 00:32:57 -0800 (PST) X-Google-Smtp-Source: AH8x227qAMwygH/tUbebLPd/0LqAM1fIzpPv9qUPH1JfHYRXxHlj2zVleVaaoSL4MG8jzBnjNc22 X-Received: by 10.98.231.11 with SMTP id s11mr29548083pfh.174.1517301176924; Tue, 30 Jan 2018 00:32:56 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1517301176; cv=none; d=google.com; s=arc-20160816; b=i7GMch+tsx23W4/PoDcpC5BPW7sgHSFend84EEUr22WeDZjqtJ5N4xw8WE7qyt0WWQ SW/MTr++1KlWTkZJ4CLoHHo3wH2J501smrVSY0CfAfKICUvMRJ3RSICLu4AolZBJHT8L Av+Ty2zNEG+FXK8Gyp+X4mOgAuTQNU3QOGJbpmKcXNhzq/RPRxICRcbNgkUElS3BgvqG 1Kt3F6u0BcKOEXuhlaLANgcuURQvSvsXSjacQTLIG/76jXI2kpfY8Ix0Hws1Y8pAimtl cw4PTuCXGbyye4HZvUDPvQLJqbrwtEhoEqRDldtma9sxXgthcuRe1Q1NclXx0AoXrh4U q+xQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :references:in-reply-to:mime-version:dkim-signature :arc-authentication-results; bh=76VKJn5TNv7rww/0t/vPYH2Nen3meKPz5DQC5YD0pQ4=; b=OgwSIsflLqQtTG060mQRADT8zIQUj/9c5tt2YhCXYCYnsqJwqQlqoZwCwrK/qcMrk9 THQIaKUxZuiJeF0SghSueoEkWQsyk/xHt/Ot8eP4VKPlQpU0fSYHFJOlHPqUnwqL19xB B0r/wQMPm+qFTo0ZMVtLBOwWAnxyWIzsnCKIRaJwr2K0VbQQQkLILXOKlcaTXhWnRdKa 5kQ5+IN/g5J9PUjDwUrhMrhzgCFA0csM9zj9iGF2kEq2is2/PEEwRo1Txw/NbsZW7p+9 CkAK6W6yB1Q7sSDg8w8ULqtkkCDLOO5HuNSGBvUD63u0Q1CDy+zRz2ewi37BzZOCrxag YXrg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=Ld4N+3nr; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id o6si2335377pga.659.2018.01.30.00.32.42; Tue, 30 Jan 2018 00:32:56 -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 header.i=@linaro.org header.s=google header.b=Ld4N+3nr; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751889AbeA3IcR (ORCPT + 99 others); Tue, 30 Jan 2018 03:32:17 -0500 Received: from mail-qt0-f195.google.com ([209.85.216.195]:45192 "EHLO mail-qt0-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751707AbeA3IcQ (ORCPT ); Tue, 30 Jan 2018 03:32:16 -0500 Received: by mail-qt0-f195.google.com with SMTP id x27so16170219qtm.12 for ; Tue, 30 Jan 2018 00:32:16 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=76VKJn5TNv7rww/0t/vPYH2Nen3meKPz5DQC5YD0pQ4=; b=Ld4N+3nrWqTE+DOxXWC2oRxu0SrRJwxStmFruOP805L4uFQHGL+iTkKJ1vCM158ANg rY3ZeqQoMO29LO0AK8UAFev0m+zhbiDUJdUO0qMLdyB60NTIef9UTp3gZ2am42wOYTPr 2sWkRtFDW6tJnqY6Pbo0mHMs1/K6Al1mr9nDY= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=76VKJn5TNv7rww/0t/vPYH2Nen3meKPz5DQC5YD0pQ4=; b=uDmG9kcGOruFZdsPLDCumgy99P9b8nFNImN3fJbSAeFavu3B1YcAeXpZLeK+s2e1nZ h9/M9oCwRCiDluKOEXdtf80B0JjXrxUceS7FZG4RtauLZHrUfJjgfqqhcDFl0EcjBnCZ cq93m/40Y2grZLwFJN+ldopDJW7MUdJyaJVD5J8q9nMW1jwOJTv8hv7XPjCv+hHxOtJt G9PGMaub2+0ciEb2OXqcnmJZhRVZaHkBfUb2GEbRVRfn3pxWFCZfsT6UYB3iaDWMfwxd 4euH+Lekh/rs2BGuBq0MqSXCwB9nay0m7cL/z7k1ed+kjd/rlNnLlky6E/mvPt0NUUN/ kMWg== X-Gm-Message-State: AKwxytd+xof/s3xNhfkFsKKFdFaGm8N4ZQcjWI2onYud8pGsvotHaSr0 xvYiudEpwwcWJ5wQ7C6u/9c08ZIdwqEXTVq2IPSmAbSsVXw= X-Received: by 10.200.56.235 with SMTP id g40mr24084992qtc.245.1517301135813; Tue, 30 Jan 2018 00:32:15 -0800 (PST) MIME-Version: 1.0 Received: by 10.140.82.178 with HTTP; Tue, 30 Jan 2018 00:32:15 -0800 (PST) In-Reply-To: <20180122103335.12820-1-philippe.cornu@st.com> References: <20180122103335.12820-1-philippe.cornu@st.com> From: Benjamin Gaignard Date: Tue, 30 Jan 2018 09:32:15 +0100 Message-ID: Subject: Re: [PATCH] drm/stm: drv: Improve data transfers To: Philippe Cornu Cc: Yannick Fertre , Vincent Abriou , David Airlie , dri-devel@lists.freedesktop.org, Linux Kernel Mailing List , Archit Taneja , Andrzej Hajda , Laurent Pinchart , Fabien Dessenne , Mickael Reulier , Ludovic Barre , Alexandre Torgue , Maxime Coquelin Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 2018-01-22 11:33 GMT+01:00 Philippe Cornu : > To optimize data transfers, align pitch on 128 bytes & height > on 4 bytes. This optimization is not applicable without MMU. > > Signed-off-by: Yannick Fertre > Signed-off-by: Vincent Abriou > Signed-off-by: Philippe Cornu > --- > drivers/gpu/drm/stm/drv.c | 21 +++++++++++++++++++++ > 1 file changed, 21 insertions(+) > > diff --git a/drivers/gpu/drm/stm/drv.c b/drivers/gpu/drm/stm/drv.c > index 8fe954c27fba..c2bd9d882b93 100644 > --- a/drivers/gpu/drm/stm/drv.c > +++ b/drivers/gpu/drm/stm/drv.c > @@ -31,6 +31,23 @@ static const struct drm_mode_config_funcs drv_mode_config_funcs = { > .atomic_commit = drm_atomic_helper_commit, > }; > > +#ifdef CONFIG_MMU > +static int stm_dumb_create(struct drm_file *file, struct drm_device *dev, > + struct drm_mode_create_dumb *args) > +{ > + 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); > + > + return drm_gem_cma_dumb_create_internal(file, dev, args); > +} > +#endif I would prefer to always call stm_dumb_create (maybe renamed stm_gem_cma_dumb_create) and change the parameters inside if the we have MMU. > + > DEFINE_DRM_GEM_CMA_FOPS(drv_driver_fops); > > static struct drm_driver drv_driver = { > @@ -44,7 +61,11 @@ static struct drm_driver drv_driver = { > .minor = 0, > .patchlevel = 0, > .fops = &drv_driver_fops, > +#ifdef CONFIG_MMU > + .dumb_create = stm_dumb_create, > +#else > .dumb_create = drm_gem_cma_dumb_create, > +#endif > .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, > -- > 2.15.1 >