dri-devel.lists.freedesktop.org archive mirror
 help / color / mirror / Atom feed
From: Thomas Zimmermann <tzimmermann@suse.de>
To: Daniel Vetter <daniel.vetter@ffwll.ch>,
	Intel Graphics Development <intel-gfx@lists.freedesktop.org>
Cc: David Airlie <airlied@linux.ie>,
	DRI Development <dri-devel@lists.freedesktop.org>,
	Daniel Vetter <daniel.vetter@intel.com>
Subject: Re: [PATCH v2 3/4] drm/shmem-helper: Align to page size in dumb_create
Date: Thu, 3 Jun 2021 20:59:39 +0200	[thread overview]
Message-ID: <180c7e54-6c34-f788-d84e-775d52766fb2@suse.de> (raw)
In-Reply-To: <20210603150326.1326658-4-daniel.vetter@ffwll.ch>


[-- Attachment #1.1: Type: text/plain, Size: 1875 bytes --]



Am 03.06.21 um 17:03 schrieb Daniel Vetter:
> shmem helpers seem a bit sloppy here by automatically rounding up when
> actually creating the buffer, which results in under-reporting of what
> we actually have. Caught by igt/vgem_basic tests.
> 
> Acked-by: Thomas Zimmermann <tzimmermann@suse.de>
> Signed-off-by: Daniel Vetter <daniel.vetter@intel.com>
> Cc: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
> Cc: Maxime Ripard <mripard@kernel.org>
> Cc: Thomas Zimmermann <tzimmermann@suse.de>
> Cc: David Airlie <airlied@linux.ie>
> Cc: Daniel Vetter <daniel@ffwll.ch>

Acked-by: Thomas Zimmermann <tzimmermann@suse.de>

> ---
>   drivers/gpu/drm/drm_gem_shmem_helper.c | 4 ++--
>   1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/gpu/drm/drm_gem_shmem_helper.c b/drivers/gpu/drm/drm_gem_shmem_helper.c
> index 32f1d7601ec6..2985744b4300 100644
> --- a/drivers/gpu/drm/drm_gem_shmem_helper.c
> +++ b/drivers/gpu/drm/drm_gem_shmem_helper.c
> @@ -506,13 +506,13 @@ int drm_gem_shmem_dumb_create(struct drm_file *file, struct drm_device *dev,
>   
>   	if (!args->pitch || !args->size) {
>   		args->pitch = min_pitch;
> -		args->size = args->pitch * args->height;
> +		args->size = PAGE_ALIGN(args->pitch * args->height);
>   	} else {
>   		/* ensure sane minimum values */
>   		if (args->pitch < min_pitch)
>   			args->pitch = min_pitch;
>   		if (args->size < args->pitch * args->height)
> -			args->size = args->pitch * args->height;
> +			args->size = PAGE_ALIGN(args->pitch * args->height);
>   	}
>   
>   	shmem = drm_gem_shmem_create_with_handle(file, dev, args->size, &args->handle);
> 

-- 
Thomas Zimmermann
Graphics Driver Developer
SUSE Software Solutions Germany GmbH
Maxfeldstr. 5, 90409 Nürnberg, Germany
(HRB 36809, AG Nürnberg)
Geschäftsführer: Felix Imendörffer


[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 840 bytes --]

  reply	other threads:[~2021-06-03 18:59 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-06-03 15:03 [PATCH v2 0/4] shmem helpers for igt Daniel Vetter
2021-06-03 15:03 ` [PATCH v2 1/4] drm/gem-shmem-helper: Export drm_gem_shmem_funcs Daniel Vetter
2021-06-03 15:54   ` Thomas Zimmermann
2021-06-03 15:03 ` [PATCH v2 2/4] drm/shmem-helper: Switch to vmf_insert_pfn Daniel Vetter
2021-06-03 20:42   ` [Intel-gfx] " kernel test robot
2021-06-03 15:03 ` [PATCH v2 3/4] drm/shmem-helper: Align to page size in dumb_create Daniel Vetter
2021-06-03 18:59   ` Thomas Zimmermann [this message]
2021-06-03 15:03 ` [PATCH v2 4/4] drm/vgem: use shmem helpers Daniel Vetter
2021-06-03 18:42   ` [Intel-gfx] " Andi Shyti
2021-06-03 18:54     ` Daniel Vetter

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=180c7e54-6c34-f788-d84e-775d52766fb2@suse.de \
    --to=tzimmermann@suse.de \
    --cc=airlied@linux.ie \
    --cc=daniel.vetter@ffwll.ch \
    --cc=daniel.vetter@intel.com \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=intel-gfx@lists.freedesktop.org \
    /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;
as well as URLs for NNTP newsgroup(s).