Skip to content
Snippets Groups Projects
Commit d31aba13 authored by huans's avatar huans Committed by Lingfeng Yang
Browse files

Using fixed value to count gralloc buffer offset

Gralloc module may be used by CameraHal(32bit) and Apk(64bit).
Counting offset with int_ptr results in different values.

Bug: 73485161

Test: run cts -m CtsCameraTestCases
Change-Id: I7d8d3f20652107df1fd7812d30c01e4546ac4a22
parent 794b494f
Branches
No related tags found
No related merge requests found
......@@ -52,6 +52,8 @@
#define DBG_FUNC DBG("%s\n", __FUNCTION__)
#define GOLDFISH_OFFSET_UNIT 8
#ifdef GOLDFISH_HIDL_GRALLOC
static bool isHidlGralloc = true;
#else
......@@ -64,8 +66,8 @@ int32_t* getOpenCountPtr(cb_handle_t* cb) {
uint32_t getAshmemColorOffset(cb_handle_t* cb) {
uint32_t res = 0;
if (cb->canBePosted()) res = sizeof(intptr_t);
if (isHidlGralloc) res = sizeof(intptr_t) * 2;
if (cb->canBePosted()) res = GOLDFISH_OFFSET_UNIT;
if (isHidlGralloc) res = GOLDFISH_OFFSET_UNIT * 2;
return res;
}
......@@ -633,12 +635,12 @@ static int gralloc_alloc(alloc_device_t* dev,
if (needHostCb || (usage & GRALLOC_USAGE_HW_FB)) {
// keep space for postCounter
// AND openCounter for all host cb
ashmem_size += sizeof(uint32_t) * 2;
ashmem_size += GOLDFISH_OFFSET_UNIT * 2;
}
} else {
if (usage & GRALLOC_USAGE_HW_FB) {
// keep space for postCounter
ashmem_size += sizeof(uint32_t) * 1;
ashmem_size += GOLDFISH_OFFSET_UNIT * 1;
}
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment