overlay: Allow to set target specific max rot session

Set the target specific max rot session with DISPLAY_FEATURE_MAX_ROT_SESSION

Bug: 24483502
Change-Id: Id4335ac154a0a3c08fc730c4d3842c6483b55ed3
Signed-off-by: Uday Kishore Pasupuleti <upasupul@codeaurora.org>
diff --git a/msm8226/common.mk b/msm8226/common.mk
index 0bcb288..1045945 100644
--- a/msm8226/common.mk
+++ b/msm8226/common.mk
@@ -45,6 +45,11 @@
 # Enable QCOM Display features
     common_flags += -DQCOM_BSP
 endif
+
+ifneq (,$(DISPLAY_FEATURE_MAX_ROT_SESSION))
+    common_flags += -DTARGET_SPECIFIC_MAX_ROT_SESSION=$(DISPLAY_FEATURE_MAX_ROT_SESSION)
+endif
+
 ifeq ($(call is-vendor-board-platform,QCOM),true)
 # This check is to pick the kernel headers from the right location.
 # If the macro above is defined, we make the assumption that we have the kernel
diff --git a/msm8226/liboverlay/overlayRotator.h b/msm8226/liboverlay/overlayRotator.h
index 64387cd..4029433 100644
--- a/msm8226/liboverlay/overlayRotator.h
+++ b/msm8226/liboverlay/overlayRotator.h
@@ -222,7 +222,11 @@
     //Virtually we can support as many rotator sessions as possible, However
     // more number of rotator sessions leads to performance issues, so
     // restricting the max rotator session to 4
+#ifdef TARGET_SPECIFIC_MAX_ROT_SESSION
+    enum { MAX_ROT_SESS = TARGET_SPECIFIC_MAX_ROT_SESSION };
+#else
     enum { MAX_ROT_SESS = 4 };
+#endif
 
     ~RotMgr();
     void configBegin();