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-09-11 13:35:50 +0530
commitb588c35a90c48c8d8c5619469d862a73624a4548 (patch)
treeb87fa8612754f65b7873399e331edee2f9a50e17
parent3e618a6aa10c783d1536f20edfc3347939cfa18e (diff)
downloadlibhardware-linaro-armv8-14.09.tar.gz
Don't use memset to clear the framebuffer on arm64linaro-armv8-14.09
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 486e27ab..014fbec6 100644
--- a/modules/gralloc/framebuffer.cpp
+++ b/modules/gralloc/framebuffer.cpp
@@ -139,6 +139,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...
@@ -296,7 +317,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;
}