gralloc: Use getpagesize() in place of PAGE_SIZE.

- Use getpagesize() function from unistd.h to get page size
  in place of PAGE_SIZE macro.
- Make isDisableUBWCForEncoder declaration pure virtual.

Change-Id: I89405e999e4683874f4daa32188181e688a19812
CRs-Fixed: 1069351
diff --git a/libgralloc/alloc_controller.h b/libgralloc/alloc_controller.h
index 8216b0c..45977e2 100644
--- a/libgralloc/alloc_controller.h
+++ b/libgralloc/alloc_controller.h
@@ -56,7 +56,7 @@
 
     virtual IMemAlloc* getAllocator(int flags) = 0;
 
-    virtual bool isDisableUBWCForEncoder();
+    virtual bool isDisableUBWCForEncoder() = 0;
 
     virtual ~IAllocController() {};
 
diff --git a/libgralloc/gr.h b/libgralloc/gr.h
index 578240a..5ab576a 100644
--- a/libgralloc/gr.h
+++ b/libgralloc/gr.h
@@ -24,6 +24,7 @@
 #include <hardware/gralloc.h>
 #include <pthread.h>
 #include <errno.h>
+#include <unistd.h>
 
 #include <cutils/native_handle.h>
 #include <utils/Singleton.h>
@@ -35,7 +36,7 @@
 struct private_handle_t;
 
 inline unsigned int roundUpToPageSize(unsigned int x) {
-    return (x + (PAGE_SIZE-1)) & ~(PAGE_SIZE-1);
+    return (x + (getpagesize()-1)) & ~(getpagesize()-1);
 }
 
 template <class Type>
diff --git a/libgralloc/gralloc_priv.h b/libgralloc/gralloc_priv.h
index 0c02355..732367d 100644
--- a/libgralloc/gralloc_priv.h
+++ b/libgralloc/gralloc_priv.h
@@ -30,8 +30,8 @@
 
 #include <cutils/log.h>
 
-#define ROUND_UP_PAGESIZE(x) ( (((unsigned long)(x)) + PAGE_SIZE-1)  & \
-                               (~(PAGE_SIZE-1)) )
+#define ROUND_UP_PAGESIZE(x) (unsigned int)( ((x) + getpagesize()-1)  & \
+                                             (~(getpagesize()-1)) )
 
 /* Gralloc usage bits indicating the type of allocation that should be used */
 /* SYSTEM heap comes from kernel vmalloc (ION_SYSTEM_HEAP_ID)
diff --git a/libgralloc1/gralloc_priv.h b/libgralloc1/gralloc_priv.h
index af7e173..f282070 100644
--- a/libgralloc1/gralloc_priv.h
+++ b/libgralloc1/gralloc_priv.h
@@ -20,9 +20,13 @@
 #ifndef __GRALLOC_PRIV_H__
 #define __GRALLOC_PRIV_H__
 
+#include <unistd.h>
 #include "gr_priv_handle.h"
 
-#define ROUND_UP_PAGESIZE(x) ((((unsigned int)(x)) + PAGE_SIZE - 1) & (~(PAGE_SIZE - 1)))
+#define ROUND_UP_PAGESIZE(x) roundUpToPageSize(x)
+inline unsigned int roundUpToPageSize(unsigned int x) {
+    return (x + (getpagesize()-1)) & ~(getpagesize()-1);
+}
 
 /* Gralloc usage bits indicating the type of allocation that should be used */
 /* Refer gralloc1_producer_usage_t & gralloc1_consumer_usage-t in gralloc1.h */