hwc: add qdcm service to be loaded in HWC and perform service

 1. Add one binder command to display.qservice to serve the
    binder requests received from SDK.
 2. Each subcommand will be corresponding to one command
    handler. Command handler will pass the requests to
    qdcm library.
 3. Dynamically load qdcm library, where all apis are
    implemented.
 4. apply default mode function will be invoked once
    bootanimation event is detected

Change-Id: I28fdf5f2561fcaffbfd3b7a1e9b136a4c372300e
diff --git a/libhwcomposer/hwc_utils.cpp b/libhwcomposer/hwc_utils.cpp
index a3cb196..db982db 100644
--- a/libhwcomposer/hwc_utils.cpp
+++ b/libhwcomposer/hwc_utils.cpp
@@ -43,6 +43,7 @@
 #include "comptype.h"
 #include "hwc_virtual.h"
 #include "qd_utils.h"
+#include "hwc_qdcm.h"
 #include <sys/sysinfo.h>
 #include <dlfcn.h>
 #include <video/msm_hdmi_modes.h>
@@ -52,6 +53,7 @@
 using namespace android;
 using namespace overlay;
 using namespace overlay::utils;
+using namespace qQdcm;
 namespace ovutils = overlay::utils;
 
 #ifdef QCOM_BSP
@@ -477,6 +479,10 @@
 
     memset(&(ctx->mPtorInfo), 0, sizeof(ctx->mPtorInfo));
     ctx->mHPDEnabled = false;
+
+    //init qdcm service related context.
+    qdcmInitContext(ctx);
+
     ALOGI("Initializing Qualcomm Hardware Composer");
     ALOGI("MDP version: %d", ctx->mMDP.version);
 
@@ -490,6 +496,9 @@
 
 void closeContext(hwc_context_t *ctx)
 {
+    //close qdcm service related context.
+    qdcmCloseContext(ctx);
+
     if(ctx->mOverlay) {
         delete ctx->mOverlay;
         ctx->mOverlay = NULL;
@@ -2701,29 +2710,16 @@
 void processBootAnimCompleted(hwc_context_t *ctx) {
     char value[PROPERTY_VALUE_MAX];
     int ret = -1;
-    int (*applyMode)(int) = NULL;
-    void *modeHandle = NULL;
 
     // Applying default mode after bootanimation is finished
     property_get("init.svc.bootanim", value, "running");
 
     if (!strncmp(value,"stopped",strlen("stopped"))) {
-        modeHandle = dlopen("libmm-qdcm.so", RTLD_NOW);
-        if (modeHandle) {
-            *(void **)&applyMode = dlsym(modeHandle, "applyDefaults");
-            if (applyMode) {
-                ret = applyMode(HWC_DISPLAY_PRIMARY);
-                if (ret)
-                    ALOGD("%s: Not able to apply default mode", __FUNCTION__);
-            } else {
-                ALOGE("%s: No symbol applyDefaults found", __FUNCTION__);
-            }
-            dlclose(modeHandle);
-        } else {
-            ALOGE("%s: Not able to load libmm-qdcm.so", __FUNCTION__);
-        }
-
         ctx->mBootAnimCompleted = true;
+
+        //one-shot action check if bootanimation completed then apply
+        //default display mode.
+        qdcmApplyDefaultAfterBootAnimationDone(ctx);
     }
 }