All of lore.kernel.org
 help / color / mirror / Atom feed
From: Thomas Zimmermann <tzimmermann@suse.de>
To: Daniel Vetter <daniel.vetter@ffwll.ch>,
	DRI Development <dri-devel@lists.freedesktop.org>
Cc: Daniel Vetter <daniel.vetter@intel.com>,
	Intel Graphics Development <intel-gfx@lists.freedesktop.org>
Subject: Re: [PATCH 3/3] drm/shmem-helper: Align to page size in dumb_create
Date: Tue, 13 Apr 2021 12:47:57 +0200	[thread overview]
Message-ID: <af920f32-4fc1-a96e-64e6-8352fb5da523@suse.de> (raw)
In-Reply-To: <20210413094937.3736541-3-daniel.vetter@ffwll.ch>


[-- Attachment #1.1.1: Type: text/plain, Size: 1751 bytes --]

Hi

Am 13.04.21 um 11:49 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.
> 
> Signed-off-by: Daniel Vetter <daniel.vetter@intel.com>

Drivers get it more wrong than right. I always felt that we should have 
all this in generic code with a few parameters somewhere.

But makes sense.

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 6d625cee7a6a..d5e6d4568f99 100644
> --- a/drivers/gpu/drm/drm_gem_shmem_helper.c
> +++ b/drivers/gpu/drm/drm_gem_shmem_helper.c
> @@ -505,13 +505,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 #1.2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 840 bytes --]

[-- Attachment #2: Type: text/plain, Size: 160 bytes --]

_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

WARNING: multiple messages have this Message-ID (diff)
From: Thomas Zimmermann <tzimmermann@suse.de>
To: Daniel Vetter <daniel.vetter@ffwll.ch>,
	DRI Development <dri-devel@lists.freedesktop.org>
Cc: Daniel Vetter <daniel.vetter@intel.com>,
	Intel Graphics Development <intel-gfx@lists.freedesktop.org>
Subject: Re: [Intel-gfx] [PATCH 3/3] drm/shmem-helper: Align to page size in dumb_create
Date: Tue, 13 Apr 2021 12:47:57 +0200	[thread overview]
Message-ID: <af920f32-4fc1-a96e-64e6-8352fb5da523@suse.de> (raw)
In-Reply-To: <20210413094937.3736541-3-daniel.vetter@ffwll.ch>


[-- Attachment #1.1.1: Type: text/plain, Size: 1751 bytes --]

Hi

Am 13.04.21 um 11:49 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.
> 
> Signed-off-by: Daniel Vetter <daniel.vetter@intel.com>

Drivers get it more wrong than right. I always felt that we should have 
all this in generic code with a few parameters somewhere.

But makes sense.

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 6d625cee7a6a..d5e6d4568f99 100644
> --- a/drivers/gpu/drm/drm_gem_shmem_helper.c
> +++ b/drivers/gpu/drm/drm_gem_shmem_helper.c
> @@ -505,13 +505,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 #1.2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 840 bytes --]

[-- Attachment #2: Type: text/plain, Size: 160 bytes --]

_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

  reply	other threads:[~2021-04-13 10:48 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-04-13  9:49 [PATCH 1/3] dma-buf: Require VM_PFNMAP vma for mmap Daniel Vetter
2021-04-13  9:49 ` [Intel-gfx] " Daniel Vetter
2021-04-13  9:49 ` Daniel Vetter
2021-04-13  9:49 ` [PATCH 2/3] drm/vgem: use shmem helpers Daniel Vetter
2021-04-13  9:49   ` [Intel-gfx] " Daniel Vetter
2021-04-13  9:49 ` [PATCH 3/3] drm/shmem-helper: Align to page size in dumb_create Daniel Vetter
2021-04-13  9:49   ` [Intel-gfx] " Daniel Vetter
2021-04-13 10:47   ` Thomas Zimmermann [this message]
2021-04-13 10:47     ` Thomas Zimmermann
2021-04-13 12:43 ` [Intel-gfx] ✗ Fi.CI.CHECKPATCH: warning for series starting with [1/3] dma-buf: Require VM_PFNMAP vma for mmap Patchwork
2021-04-13 12:47 ` [Intel-gfx] ✗ Fi.CI.DOCS: " Patchwork
2021-04-13 13:09 ` [Intel-gfx] ✗ Fi.CI.BAT: failure " Patchwork
2021-05-26 14:47 [PATCH 1/3] " Daniel Vetter
2021-05-26 14:47 ` [PATCH 3/3] drm/shmem-helper: Align to page size in dumb_create 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=af920f32-4fc1-a96e-64e6-8352fb5da523@suse.de \
    --to=tzimmermann@suse.de \
    --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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.