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 <tzimmerm...@suse.de>
Signed-off-by: Daniel Vetter <daniel.vet...@intel.com>
Cc: Maarten Lankhorst <maarten.lankho...@linux.intel.com>
Cc: Maxime Ripard <mrip...@kernel.org>
Cc: Thomas Zimmermann <tzimmerm...@suse.de>
Cc: David Airlie <airl...@linux.ie>
Cc: Daniel Vetter <dan...@ffwll.ch>
---
 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 11edd54f0580..296ab1b7c07f 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);
-- 
2.31.0

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

Reply via email to