hwc: Implement dump function

Does a basic implementation of the dump function
called by SurfaceFlinger in dumpsys.
Further logs in different areas can be added later on
using the dumpsys_log utility.

Change-Id: I2194b4ed7f10947272b7b824ef802ce2ee3c8a48
diff --git a/libhwcomposer/hwc.cpp b/libhwcomposer/hwc.cpp
index 20ac9a5..91d632f 100644
--- a/libhwcomposer/hwc.cpp
+++ b/libhwcomposer/hwc.cpp
@@ -451,6 +451,18 @@
     return 0;
 }
 
+void hwc_dump(struct hwc_composer_device_1* dev, char *buff, int buff_len)
+{
+    hwc_context_t* ctx = (hwc_context_t*)(dev);
+    android::String8 buf("");
+    dumpsys_log(buf, "Qualcomm HWC state:\n");
+    dumpsys_log(buf, "  MDPVersion=%d\n", ctx->mMDP.version);
+    dumpsys_log(buf, "  DisplayPanel=%c\n", ctx->mMDP.panel);
+    MDPComp::dump(buf);
+    //XXX: Call Other dump functions
+    strlcpy(buff, buf.string(), buff_len);
+}
+
 static int hwc_device_close(struct hw_device_t *dev)
 {
     if(!dev) {
@@ -487,7 +499,7 @@
         dev->device.blank               = hwc_blank;
         dev->device.query               = hwc_query;
         dev->device.registerProcs       = hwc_registerProcs;
-        dev->device.dump                = NULL;
+        dev->device.dump                = hwc_dump;
         dev->device.getDisplayConfigs   = hwc_getDisplayConfigs;
         dev->device.getDisplayAttributes = hwc_getDisplayAttributes;
         *device = &dev->device.common;