hikey: gralloc: Add union alias and additional fields to improve interop w/ hikey960 gralloc
Since we use the gralloc_priv.h for hikey960 and hikey, try to
align the variable names a bit using a union. This allows
drm_hwcomposer importer to need less conditionally built code.
Also add logic to provide a byte_stride value, which the
hikey960 gralloc and drm_hwcomposer uses.
Change-Id: I9a26cd244b1790afbf74138504bb0eedd44d94d4
Signed-off-by: John Stultz <john.stultz@linaro.org>
diff --git a/gralloc/alloc_device.cpp b/gralloc/alloc_device.cpp
index fe3f14f..397f95e 100644
--- a/gralloc/alloc_device.cpp
+++ b/gralloc/alloc_device.cpp
@@ -437,6 +437,7 @@
size_t size;
size_t stride;
+ int bpp = 1;
if (format == HAL_PIXEL_FORMAT_YCrCb_420_SP || format == HAL_PIXEL_FORMAT_YV12
/* HAL_PIXEL_FORMAT_YCbCr_420_SP, HAL_PIXEL_FORMAT_YCbCr_420_P, HAL_PIXEL_FORMAT_YCbCr_422_I are not defined in Android.
@@ -488,7 +489,6 @@
}
else
{
- int bpp = 0;
switch (format)
{
@@ -589,7 +589,7 @@
hnd->height = h;
hnd->format = format;
hnd->stride = stride;
-
+ hnd->byte_stride = GRALLOC_ALIGN(w*bpp,64);
*pStride = stride;
return 0;
}