diff options
author | Owen Lin <owenlin@google.com> | 2015-08-27 16:48:16 +0800 |
---|---|---|
committer | Owen Lin <owenlin@google.com> | 2015-08-27 17:01:01 +0800 |
commit | 7a7fbe88978c992cc601604c54dc5a5596a03033 (patch) | |
tree | 5a9d186986ebccab010684e82596e59689a67155 | |
parent | cd2a04a3e41a93e621f7e2c3c90eda68c3954f2d (diff) | |
download | drm_gralloc-7a7fbe88978c992cc601604c54dc5a5596a03033.tar.gz |
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
-rw-r--r-- | gralloc_drm_rockchip.c | 10 |
1 files 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, |