Merge "gralloc: Remove PAGE_SIZE 4096 usage" into main am: 677aa4b1cb am: 3a0f90c88f am: 312fdb4999 am: 56499e2e8a
Original change: https://android-review.googlesource.com/c/platform/hardware/libhardware/+/2717653
Change-Id: Ic9d167ebc7950d39cb25f1744ba6d7d5a27b9379
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
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);