mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
To: Philippe Cornu <philippe.cornu@st.com>
Cc: Yannick Fertre <yannick.fertre@st.com>,
	Benjamin Gaignard <benjamin.gaignard@linaro.org>,
	Vincent Abriou <vincent.abriou@st.com>,
	David Airlie <airlied@linux.ie>,
	dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org,
	Archit Taneja <architt@codeaurora.org>,
	Andrzej Hajda <a.hajda@samsung.com>,
	Fabien Dessenne <fabien.dessenne@st.com>,
	Mickael Reulier <mickael.reulier@st.com>,
	Ludovic Barre <ludovic.barre@st.com>,
	Alexandre Torgue <alexandre.torgue@st.com>,
	Maxime Coquelin <mcoquelin.stm32@gmail.com>
Subject: Re: [PATCH v2] drm/stm: drv: Improve data transfers
Date: Tue, 30 Jan 2018 16:58:07 +0200	[thread overview]
Message-ID: <3365044.AohtTD8A6l@avalon> (raw)
In-Reply-To: <20180130104200.21602-1-philippe.cornu@st.com>

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 <yannick.fertre@st.com>
> Signed-off-by: Vincent Abriou <vincent.abriou@st.com>
> Signed-off-by: Philippe Cornu <philippe.cornu@st.com>
> ---
> 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

  parent reply	other threads:[~2018-01-30 14:57 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-01-30 10:42 Philippe Cornu
2018-01-30 10:51 ` Benjamin Gaignard
2018-01-30 15:01   ` Laurent Pinchart
2018-01-30 15:28     ` Jani Nikula
2018-01-30 14:58 ` Laurent Pinchart [this message]
2018-01-30 15:08   ` Benjamin Gaignard
2018-01-30 15:10     ` Laurent Pinchart

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=3365044.AohtTD8A6l@avalon \
    --to=laurent.pinchart@ideasonboard.com \
    --cc=a.hajda@samsung.com \
    --cc=airlied@linux.ie \
    --cc=alexandre.torgue@st.com \
    --cc=architt@codeaurora.org \
    --cc=benjamin.gaignard@linaro.org \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=fabien.dessenne@st.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=ludovic.barre@st.com \
    --cc=mcoquelin.stm32@gmail.com \
    --cc=mickael.reulier@st.com \
    --cc=philippe.cornu@st.com \
    --cc=vincent.abriou@st.com \
    --cc=yannick.fertre@st.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

Powered by JetHome