HWC: Support for thermal mitigation on 8909

Avoid MDP composition while system running in thermal burst mode
by reading node msm_fb_thermal_level which is being updated by
thermal daemon.

Change-Id: I3a1a85f1af35b787310ac205dbed3bb2ae86deb7
diff --git a/libhwcomposer/hwc_vsync.cpp b/libhwcomposer/hwc_vsync.cpp
index ca93ad2..9dfd125 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;
 bool logvsync = false;
 
@@ -77,6 +78,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);
@@ -85,6 +100,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)