sde: Change the secure buffer alignment requirement

Change the secure buffer alignment requirement to accomodate
both new system secure heap and old MM CMA heap between master
side and slave side CP architectures.

Change-Id: If1f8e2d67a9658d02faebfdfb12c7e6b68527589
diff --git a/displayengine/libs/hwc/Android.mk b/displayengine/libs/hwc/Android.mk
index d31c71e..7660911 100644
--- a/displayengine/libs/hwc/Android.mk
+++ b/displayengine/libs/hwc/Android.mk
@@ -11,6 +11,12 @@
 LOCAL_CFLAGS                  := -Wno-missing-field-initializers -Wno-unused-parameter \
                                  -Wconversion -Wall -Werror \
                                  -DLOG_TAG=\"SDE\"
+
+# TODO: Move this to the common makefile
+ifeq ($(call is-board-platform-in-list, $(MASTER_SIDE_CP_TARGET_LIST)), true)
+    LOCAL_CFLAGS += -DMASTER_SIDE_CP
+endif
+
 LOCAL_SHARED_LIBRARIES        := libsde libqservice libbinder libhardware libhardware_legacy \
                                  libutils libcutils libsync libmemalloc libqdutils
 LOCAL_SRC_FILES               := hwc_session.cpp \
diff --git a/displayengine/libs/hwc/hwc_buffer_allocator.cpp b/displayengine/libs/hwc/hwc_buffer_allocator.cpp
index 61d9913..0958b43 100644
--- a/displayengine/libs/hwc/hwc_buffer_allocator.cpp
+++ b/displayengine/libs/hwc/hwc_buffer_allocator.cpp
@@ -66,7 +66,7 @@
   if (buffer_config.secure) {
     alloc_flags = GRALLOC_USAGE_PRIVATE_MM_HEAP;
     alloc_flags |= GRALLOC_USAGE_PROTECTED;
-    data.align = kSecureBufferAlignment;
+    data.align = SECURE_ALIGN;
   } else {
     data.align = getpagesize();
   }
diff --git a/displayengine/libs/hwc/hwc_buffer_allocator.h b/displayengine/libs/hwc/hwc_buffer_allocator.h
index eb3d1fd..14a8da3 100644
--- a/displayengine/libs/hwc/hwc_buffer_allocator.h
+++ b/displayengine/libs/hwc/hwc_buffer_allocator.h
@@ -50,8 +50,6 @@
   DisplayError FreeBuffer(BufferInfo *buffer_info);
 
  private:
-  static const size_t kSecureBufferAlignment = 0x00100000;
-
   struct MetaBufferInfo {
     int alloc_type;              //!< Specifies allocation type set by the buffer allocator.
     void *base_addr;             //!< Specifies the base address of the allocated output buffer.
diff --git a/libgralloc/alloc_controller.h b/libgralloc/alloc_controller.h
index f0b8ed9..919e572 100644
--- a/libgralloc/alloc_controller.h
+++ b/libgralloc/alloc_controller.h
@@ -29,6 +29,17 @@
 #ifndef GRALLOC_ALLOCCONTROLLER_H
 #define GRALLOC_ALLOCCONTROLLER_H
 
+#define SZ_2M 0x200000
+#define SZ_1M 0x100000
+#define SZ_4K 0x1000
+
+/* TODO: Move this to the common makefile */
+#ifdef MASTER_SIDE_CP
+#define SECURE_ALIGN SZ_4K
+#else
+#define SECURE_ALIGN SZ_1M
+#endif
+
 namespace gralloc {
 
 struct alloc_data;
diff --git a/libgralloc/gpu.cpp b/libgralloc/gpu.cpp
index 0fd6e3b..11d8f1f 100644
--- a/libgralloc/gpu.cpp
+++ b/libgralloc/gpu.cpp
@@ -30,16 +30,6 @@
 
 using namespace gralloc;
 
-#define SZ_2M 0x200000
-#define SZ_1M 0x100000
-#define SZ_4K 0x1000
-
-#ifdef MASTER_SIDE_CP
-#define SECURE_ALIGN SZ_4K
-#else
-#define SECURE_ALIGN SZ_1M
-#endif
-
 gpu_context_t::gpu_context_t(const private_module_t* module,
                              IAllocController* alloc_ctrl ) :
     mAllocCtrl(alloc_ctrl)