[Intel-gfx] [PATCH] [RFC] drm/vgem: Fix the pitch to be 64 byte aligned for Intel platforms

Vidya Srinivas vidya.srinivas at intel.com
Tue Jun 1 14:28:14 UTC 2021


User space like igt/kms_prime use vgem_gem_dumb_create
before reaching i915_gem_dumb_create (which has 64 byte alignment done).
For panel resolutions like 1366x768, the pitch calculated by vgem
is not 64 byte aligned. This results in frame buffer not being
created by intel_framebuffer_init.

Test: igt/kms_prime with panel resolution 1366x768

Change-Id: If68914421b1a9432a73af96c8b426045772629eb
Signed-off-by: Vidya Srinivas <vidya.srinivas at intel.com>
---
 drivers/gpu/drm/vgem/vgem_drv.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/vgem/vgem_drv.c b/drivers/gpu/drm/vgem/vgem_drv.c
index fa54a6d1403d..48535c88aa27 100644
--- a/drivers/gpu/drm/vgem/vgem_drv.c
+++ b/drivers/gpu/drm/vgem/vgem_drv.c
@@ -215,7 +215,7 @@ static int vgem_gem_dumb_create(struct drm_file *file, struct drm_device *dev,
 	struct drm_gem_object *gem_object;
 	u64 pitch, size;
 
-	pitch = args->width * DIV_ROUND_UP(args->bpp, 8);
+	pitch = ALIGN(args->width * DIV_ROUND_UP(args->bpp, 8), 64);
 	size = args->height * pitch;
 	if (size == 0)
 		return -EINVAL;
-- 
2.7.4



More information about the Intel-gfx mailing list