summaryrefslogtreecommitdiffstats
path: root/exynos4
diff options
context:
space:
mode:
authorDominggoes Isakh <drjisakh@gmail.com>2019-02-15 23:00:07 +0100
committerShilin Victor <chrono.monochrome@gmail.com>2019-02-24 01:25:19 +0300
commit4c999c3fa70a1577db92e6832e4e69d3ed1c14df (patch)
tree13dda1a08eef3aa176ba2db9a4778fadd281740a /exynos4
parent24803c68afd3f8a003f7641062c6185deb38a838 (diff)
downloadhardware_samsung-4c999c3fa70a1577db92e6832e4e69d3ed1c14df.tar.gz
hardware_samsung-4c999c3fa70a1577db92e6832e4e69d3ed1c14df.tar.bz2
hardware_samsung-4c999c3fa70a1577db92e6832e4e69d3ed1c14df.zip
gralloc: Update freed buffermask at alloc
This fixes screen tearing because of the change of HIDL behavior. The buffer is freed before the next allocation causing the bufferslots always be unused at allocation. Only the first buffer in the framebuffer /dev/graphics/fb0 was used. Thanks to @Chronomonochrome for pointing out the issue in gralloc. Change-Id: If1f6eb667506743cca828fbf87a45e7c2ee849a9
Diffstat (limited to 'exynos4')
-rw-r--r--exynos4/hal/include/gralloc_priv.h2
-rw-r--r--exynos4/hal/libgralloc_ump/alloc_device.cpp11
2 files changed, 12 insertions, 1 deletions
diff --git a/exynos4/hal/include/gralloc_priv.h b/exynos4/hal/include/gralloc_priv.h
index a230d03..98fdac0 100644
--- a/exynos4/hal/include/gralloc_priv.h
+++ b/exynos4/hal/include/gralloc_priv.h
@@ -61,6 +61,8 @@ struct private_module_t {
uint32_t flags;
uint32_t numBuffers;
uint32_t bufferMask;
+ uint32_t bufferFreedMask;
+
pthread_mutex_t lock;
buffer_handle_t currentBuffer;
int ion_client;
diff --git a/exynos4/hal/libgralloc_ump/alloc_device.cpp b/exynos4/hal/libgralloc_ump/alloc_device.cpp
index 1b64dfa..adbc527 100644
--- a/exynos4/hal/libgralloc_ump/alloc_device.cpp
+++ b/exynos4/hal/libgralloc_ump/alloc_device.cpp
@@ -460,14 +460,21 @@ static int gralloc_alloc_framebuffer_locked(alloc_device_t* dev, size_t size, in
ALOGD_IF(debug_level > 0, "%s current=0x%x vaddr=0x%x l_paddr=0x%x before", __func__, current, vaddr, l_paddr);
/* find a free slot */
+ uint32_t freeSlot = numBuffers -1;
for (uint32_t i = 0; i < numBuffers; i++) {
if ((bufferMask & (1LU<<i)) == 0) {
m->bufferMask |= (1LU<<i);
+ freeSlot = i;
break;
}
current += bufferSize;
l_paddr = vaddr + current;
}
+ ALOGE("%d: Using bufferslot:%d", __func__, freeSlot);
+
+ /* Update buffermask with freed slots */
+ m->bufferMask ^= m->bufferFreedMask;
+ m->bufferFreedMask &= m->bufferMask;
ALOGD_IF(debug_level > 0, "%s current=0x%x vaddr=0x%x l_paddr=0x%x after", __func__, current, vaddr, l_paddr);
@@ -690,7 +697,9 @@ static int alloc_device_free(alloc_device_t* dev, buffer_handle_t handle)
const size_t bufferSize = m->finfo.line_length * m->info.yres;
int index = (hnd->base - m->framebuffer->base) / bufferSize;
- m->bufferMask &= ~(1<<index);
+ /* Mark slot as freed */
+ m->bufferFreedMask |= (1LU<<index);
+
close(hnd->fd);
} else if (hnd->flags & private_handle_t::PRIV_FLAGS_USES_UMP) {