gralloc: Remove PAGE_SIZE 4096 usage
Android V will support page size agnostic targets. The bionic macro
PAGE_SIZE won't be defined for the agnostic targets. The PAGE_SIZE
macro will be replaced by getpagesize(), which provide the real
page size, in gralloc.
Bug: 296578499
Test: source build/envsetup.sh
lunch aosp_cf_arm64_phone_pgagnostic
Change-Id: I963468712a7d65160201b720de0efe009921ad53
diff --git a/modules/gralloc/gr.h b/modules/gralloc/gr.h
index 14fe6a0..fe66c9b 100644
--- a/modules/gralloc/gr.h
+++ b/modules/gralloc/gr.h
@@ -24,6 +24,7 @@
#include <hardware/gralloc.h>
#include <pthread.h>
#include <errno.h>
+#include <unistd.h>
#include <cutils/native_handle.h>
@@ -32,8 +33,10 @@
struct private_module_t;
struct private_handle_t;
+static const size_t kPageSize = getpagesize();
+
inline size_t roundUpToPageSize(size_t x) {
- return (x + (PAGE_SIZE-1)) & ~(PAGE_SIZE-1);
+ return (x + (kPageSize-1)) & ~(kPageSize-1);
}
int mapFrameBufferLocked(struct private_module_t* module, int format);