summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohn Stultz <john.stultz@linaro.org>2018-01-04 14:03:55 -0800
committerYongqin Liu <yongqin.liu@linaro.org>2019-08-03 00:35:08 +0800
commit98d129b83489f0823bf3eae238b9e77cc261a0fe (patch)
tree35c2256521e8093068f021cc59bc2d5405cf8931
parentf729e624cec054b5ea1361a61932ac30f05843b4 (diff)
downloadhikey-98d129b83489f0823bf3eae238b9e77cc261a0fe.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 076cb5ce..bbe06db1 100644
--- a/gralloc/alloc_device.cpp
+++ b/gralloc/alloc_device.cpp
@@ -438,6 +438,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.
@@ -489,7 +490,6 @@ static int alloc_device_alloc(alloc_device_t *dev, int w, int h, int format, int
}
else
{
- int bpp = 0;
switch (format)
{
@@ -590,7 +590,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