drm_gralloc: rockchip: Allocate bigger buffers for raw video frames
It is a workaround needed for video decoder hardware that requires extra
data at the end of the frame.
Change-Id: I6af8f8ae81a56bbbe3721b0cc3b333f09f6fb965
diff --git a/gralloc_drm_rockchip.c b/gralloc_drm_rockchip.c
index de1874e..f9dcb0e 100644
--- a/gralloc_drm_rockchip.c
+++ b/gralloc_drm_rockchip.c
@@ -64,6 +64,18 @@
pitch = ALIGN(aligned_width * cpp, 64);
size = aligned_height * pitch;
+ if (handle->format == HAL_PIXEL_FORMAT_YCbCr_420_888) {
+ /*
+ * WAR for H264 decoder requiring additional space
+ * at the end of destination buffers.
+ */
+ uint32_t w_mbs, h_mbs;
+
+ w_mbs = ALIGN(handle->width, 16) / 16;
+ h_mbs = ALIGN(handle->height, 16) / 16;
+ size += 64 * w_mbs * h_mbs;
+ }
+
if (handle->prime_fd >= 0) {
ret = drmPrimeFDToHandle(info->fd, handle->prime_fd,
&gem_handle);