From 7a7fbe88978c992cc601604c54dc5a5596a03033 Mon Sep 17 00:00:00 2001 From: Owen Lin Date: Thu, 27 Aug 2015 16:48:16 +0800 Subject: drm_gralloc: Don't modify handle->height for alignment. In gralloc_drm_align_geometry(), the height will be adjusted to include the UV planes. For the format HAL_PIXEL_FORMAT_YV12, the hight of a VGA image (640x360) will be adjusted to 540. We should not change the origin height in the handle. Change-Id: I57901d94ae3e4b321b692b64b553923a201d4f3f --- gralloc_drm_rockchip.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/gralloc_drm_rockchip.c b/gralloc_drm_rockchip.c index b383208..de1874e 100644 --- a/gralloc_drm_rockchip.c +++ b/gralloc_drm_rockchip.c @@ -40,7 +40,7 @@ static struct gralloc_drm_bo_t *drm_gem_rockchip_alloc( struct rockchip_info *info = (struct rockchip_info *)drv; struct rockchip_buffer *buf; struct drm_gem_close args; - int ret, cpp, pitch; + int ret, cpp, pitch, aligned_width, aligned_height; uint32_t size, gem_handle; buf = calloc(1, sizeof(*buf)); @@ -55,12 +55,14 @@ static struct gralloc_drm_bo_t *drm_gem_rockchip_alloc( return NULL; } + aligned_width = handle->width; + aligned_height = handle->height; gralloc_drm_align_geometry(handle->format, - &handle->width, &handle->height); + &aligned_width, &aligned_height); /* TODO: We need to sort out alignment */ - pitch = ALIGN(handle->width * cpp, 64); - size = handle->height * pitch; + pitch = ALIGN(aligned_width * cpp, 64); + size = aligned_height * pitch; if (handle->prime_fd >= 0) { ret = drmPrimeFDToHandle(info->fd, handle->prime_fd, -- cgit v1.2.3