From 9e1e7fe7265444ee0c23314b7316f8e05bde952c Mon Sep 17 00:00:00 2001 From: Shilin Victor Date: Tue, 12 Feb 2019 20:31:12 +0300 Subject: exynos4: gralloc: allow skipping bufferMask change on free an addition of Gralloc HIDL caused Exynos4 gralloc to use only one framebuffer slot of the available two. This happens because the buffer is freed by HIDL immediately after it's allocated, thus making gralloc HAL think that first buffer is free and allocate a second one at the same vaddr (effectively using just one buffer). By skipping bufferMask change on the buffer free, we will make use of two framebuffer slots and fix Vsync issue. Change-Id: I0c3e7f517a67ad9d554111f91ef2f5190c6522c8 --- exynos4/hal/libgralloc_ump/Android.mk | 4 ++++ exynos4/hal/libgralloc_ump/alloc_device.cpp | 3 ++- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/exynos4/hal/libgralloc_ump/Android.mk b/exynos4/hal/libgralloc_ump/Android.mk index 0cd5ecb..bc15ec0 100644 --- a/exynos4/hal/libgralloc_ump/Android.mk +++ b/exynos4/hal/libgralloc_ump/Android.mk @@ -68,4 +68,8 @@ ifeq ($(TARGET_USES_GRALLOC1), true) LOCAL_CFLAGS += -DADVERTISE_GRALLOC1 endif +ifeq ($(TARGET_USES_GRALLOC_HIDL), true) +LOCAL_CFLAGS += -DUSE_GRALLOC_HIDL +endif + include $(BUILD_SHARED_LIBRARY) diff --git a/exynos4/hal/libgralloc_ump/alloc_device.cpp b/exynos4/hal/libgralloc_ump/alloc_device.cpp index 1b64dfa..61be7c5 100644 --- a/exynos4/hal/libgralloc_ump/alloc_device.cpp +++ b/exynos4/hal/libgralloc_ump/alloc_device.cpp @@ -689,8 +689,9 @@ static int alloc_device_free(alloc_device_t* dev, buffer_handle_t handle) /* free this buffer */ const size_t bufferSize = m->finfo.line_length * m->info.yres; int index = (hnd->base - m->framebuffer->base) / bufferSize; - +#ifndef USE_GRALLOC_HIDL m->bufferMask &= ~(1<fd); } else if (hnd->flags & private_handle_t::PRIV_FLAGS_USES_UMP) { -- cgit v1.2.3