summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKévin PETIT <kevin.petit@arm.com>2014-03-13 17:09:58 +0000
committerAmit Pundir <amit.pundir@linaro.org>2014-06-13 19:23:38 +0530
commitd3080813c4284cd9a700bdc86bf3ee7807b8ceb4 (patch)
treee215f4709e57ec563bc470161e4c30dd5bf2011e
parent6f91ded57bf133fbf572cde2f5623bb8289f7eaa (diff)
downloadlibhardware-linaro-armv8-20140613.tar.gz
Don't use memset to clear the framebuffer on arm64linaro-armv8-20140613
Change-Id: Id0ad67505c206b6bfe0ea7b13a4860369b307e70 Signed-off-by: Kévin PETIT <kevin.petit@arm.com>
-rw-r--r--modules/gralloc/framebuffer.cpp23
1 files changed, 22 insertions, 1 deletions
diff --git a/modules/gralloc/framebuffer.cpp b/modules/gralloc/framebuffer.cpp
index 9d8513a2..ffbe2230 100644
--- a/modules/gralloc/framebuffer.cpp
+++ b/modules/gralloc/framebuffer.cpp
@@ -132,6 +132,27 @@ static int fb_post(struct framebuffer_device_t* dev, buffer_handle_t buffer)
/*****************************************************************************/
+void clearFrameBuffer(void* vaddr, size_t fbSize)
+{
+#ifdef __aarch64__
+ /*
+ * The optimised memset for arm64 cannot operate on device memory.
+ * The zeroing has to be done differently. This is a copy of bionic's
+ * generic memset.
+ */
+ char* q = (char*)vaddr;
+ char* end = q + fbSize;
+ for (;;) {
+ if (q >= end) break; *q++ = 0;
+ if (q >= end) break; *q++ = 0;
+ if (q >= end) break; *q++ = 0;
+ if (q >= end) break; *q++ = 0;
+ }
+#else
+ memset(vaddr, 0, fbSize);
+#endif
+}
+
int mapFrameBufferLocked(struct private_module_t* module)
{
// already initialized...
@@ -284,7 +305,7 @@ int mapFrameBufferLocked(struct private_module_t* module)
return -errno;
}
module->framebuffer->base = intptr_t(vaddr);
- memset(vaddr, 0, fbSize);
+ clearFrameBuffer(vaddr, fbSize);
return 0;
}