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_copybit.cpp b/libhwcomposer/hwc_copybit.cpp
index 2799d51..c3044a6 100644
--- a/libhwcomposer/hwc_copybit.cpp
+++ b/libhwcomposer/hwc_copybit.cpp
@@ -276,6 +276,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 d2d1846..f7352cb 100644
--- a/libhwcomposer/hwc_utils.h
+++ b/libhwcomposer/hwc_utils.h
@@ -595,6 +595,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 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)