summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohn Stultz <john.stultz@linaro.org>2018-01-04 14:03:55 -0800
committerJohn Stultz <john.stultz@linaro.org>2018-07-11 15:59:32 -0700
commit30941517aac192a55dc358479e27dc6a6b3bc04e (patch)
treecbc93cb492ccb96289b71252b92a983aa048831d
parent25d6129aed2ffa8a7d502c3703f82500ecc3a2ad (diff)
downloadhikey-30941517aac192a55dc358479e27dc6a6b3bc04e.tar.gz
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>
-rw-r--r--gralloc/alloc_device.cpp4
-rw-r--r--gralloc/gralloc_priv.h7
2 files changed, 7 insertions, 4 deletions
diff --git a/gralloc/alloc_device.cpp b/gralloc/alloc_device.cpp
index fe3f14f0..397f95e4 100644
--- a/gralloc/alloc_device.cpp
+++ b/gralloc/alloc_device.cpp
@@ -437,6 +437,7 @@ static int alloc_device_alloc(alloc_device_t *dev, int w, int h, int format, int
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 @@ static int alloc_device_alloc(alloc_device_t *dev, int w, int h, int format, int
}
else
{
- int bpp = 0;
switch (format)
{
@@ -589,7 +589,7 @@ static int alloc_device_alloc(alloc_device_t *dev, int w, int h, int format, int
hnd->height = h;
hnd->format = format;
hnd->stride = stride;
-
+ hnd->byte_stride = GRALLOC_ALIGN(w*bpp,64);
*pStride = stride;
return 0;
}
diff --git a/gralloc/gralloc_priv.h b/gralloc/gralloc_priv.h
index 40ca94fd..a5f8c8b0 100644
--- a/gralloc/gralloc_priv.h
+++ b/gralloc/gralloc_priv.h
@@ -166,7 +166,10 @@ struct private_handle_t
int size;
int width;
int height;
- int format;
+ union {
+ int format;
+ int req_format; /* same name as gralloc960 */
+ };
int stride;
union
{
@@ -193,10 +196,10 @@ struct private_handle_t
void *fb_paddr;
uint64_t fb_paddr_padding;
};
+ int byte_stride;
#if GRALLOC_ARM_DMA_BUF_MODULE
ion_user_handle_t ion_hnd;
#endif
-
#if GRALLOC_ARM_DMA_BUF_MODULE
#define GRALLOC_ARM_NUM_FDS 1
#else