gralloc: add support for HAL_PIXEL_FORMAT_BLOB
so that we could have CtsNativeHardwareTestCases pass
Test: manually cts with hikey
Change-Id: Ia5b3fec3f11f3c0e94e4d5208bb9d04ef872e2ad
Signed-off-by: Yongqin Liu <yongqin.liu@linaro.org>
diff --git a/gralloc/alloc_device.cpp b/gralloc/alloc_device.cpp
index ddd4194..33c3a09 100644
--- a/gralloc/alloc_device.cpp
+++ b/gralloc/alloc_device.cpp
@@ -497,13 +497,26 @@
bpp = 2;
break;
+ case HAL_PIXEL_FORMAT_BLOB:
+ if (h != 1) {
+ AERR("Height for HAL_PIXEL_FORMAT_BLOB must be 1. h=%d", h);
+ return -EINVAL;
+ }
+ break;
+
default:
+ AERR("The format is not supported yet: format=%d\n", format);
return -EINVAL;
}
- size_t bpr = GRALLOC_ALIGN(w * bpp, 64);
- size = bpr * h;
- stride = bpr / bpp;
+ if (format == HAL_PIXEL_FORMAT_BLOB) {
+ stride = 0; /* No 'rows', it's effectively a long one dimensional array */
+ size = w;
+ }else{
+ size_t bpr = GRALLOC_ALIGN(w * bpp, 64);
+ size = bpr * h;
+ stride = bpr / bpp;
+ }
}
int err;