Merge "hwc: Configure MDP with updated crop and whf for PTOR layers"
diff --git a/libgralloc/gpu.cpp b/libgralloc/gpu.cpp
index 8739f34..4067050 100644
--- a/libgralloc/gpu.cpp
+++ b/libgralloc/gpu.cpp
@@ -44,9 +44,6 @@
     common.module  = const_cast<hw_module_t*>(&module->base.common);
     common.close   = gralloc_close;
     alloc          = gralloc_alloc;
-#ifdef QCOM_BSP
-    allocSize      = gralloc_alloc_size;
-#endif
     free           = gralloc_free;
 
 }
diff --git a/libgralloc/mapper.cpp b/libgralloc/mapper.cpp
index 0ee69c8..2f2ddc1 100644
--- a/libgralloc/mapper.cpp
+++ b/libgralloc/mapper.cpp
@@ -332,23 +332,6 @@
                 break;
 
             }
-#ifdef QCOM_BSP
-        case GRALLOC_MODULE_PERFORM_UPDATE_BUFFER_GEOMETRY:
-            {
-                int width = va_arg(args, int);
-                int height = va_arg(args, int);
-                int format = va_arg(args, int);
-                private_handle_t* hnd =  va_arg(args, private_handle_t*);
-                if (private_handle_t::validate(hnd)) {
-                    return res;
-                }
-                hnd->width = width;
-                hnd->height = height;
-                hnd->format = format;
-                res = 0;
-            }
-            break;
-#endif
         case GRALLOC_MODULE_PERFORM_GET_STRIDE:
             {
                 int width   = va_arg(args, int);
diff --git a/libhwcomposer/hwc_copybit.cpp b/libhwcomposer/hwc_copybit.cpp
index d6e5e8a..24fd771 100644
--- a/libhwcomposer/hwc_copybit.cpp
+++ b/libhwcomposer/hwc_copybit.cpp
@@ -273,6 +273,13 @@
         // No copybit device found - cannot use copybit
         return false;
     }
+
+    if(ctx->mThermalBurstMode) {
+        ALOGD_IF (DEBUG_COPYBIT, "%s:Copybit failed,"
+                "Running in Thermal Burst mode",__FUNCTION__);
+        return false;
+    }
+
     int compositionType = qdutils::QCCompositionType::
                                     getInstance().getCompositionType();
 
diff --git a/libhwcomposer/hwc_utils.h b/libhwcomposer/hwc_utils.h
index 528c5c0..66fdc65 100644
--- a/libhwcomposer/hwc_utils.h
+++ b/libhwcomposer/hwc_utils.h
@@ -593,6 +593,8 @@
     bool enableABC;
     // PTOR Info
     qhwc::PtorInfo mPtorInfo;
+    //Running in Thermal burst mode
+    bool mThermalBurstMode;
 };
 
 namespace qhwc {
diff --git a/libhwcomposer/hwc_vsync.cpp b/libhwcomposer/hwc_vsync.cpp
index 47f2229..6c6ba63 100644
--- a/libhwcomposer/hwc_vsync.cpp
+++ b/libhwcomposer/hwc_vsync.cpp
@@ -39,6 +39,7 @@
 #define MAX_SYSFS_FILE_PATH             255
 #define PANEL_ON_STR "panel_power_on ="
 #define ARRAY_LENGTH(array) (sizeof((array))/sizeof((array)[0]))
+#define MAX_THERMAL_LEVEL 3
 const int MAX_DATA = 64;
 
 int hwc_vsync_control(hwc_context_t* ctx, int dpy, int enable)
@@ -76,6 +77,20 @@
     }
 }
 
+static void handle_thermal_event(hwc_context_t* ctx, int dpy, char *data)
+{
+    // extract thermal level
+    uint64_t thermalLevel = 0;
+    if (!strncmp(data, "thermal_level=", strlen("thermal_level="))) {
+        thermalLevel = strtoull(data + strlen("thermal_level="), NULL, 0);
+    }
+
+    if (thermalLevel >= MAX_THERMAL_LEVEL)
+        ctx->mThermalBurstMode = true;
+    else
+        ctx->mThermalBurstMode = false;
+}
+
 struct event {
     const char* name;
     void (*callback)(hwc_context_t* ctx, int dpy, char *data);
@@ -84,6 +99,7 @@
 struct event event_list[] =  {
     { "vsync_event", handle_vsync_event },
     { "show_blank_event", handle_blank_event },
+    { "msm_fb_thermal_level", handle_thermal_event },
 };
 
 #define num_events ARRAY_LENGTH(event_list)