hwc: 8992/8994: Disable BWC when HDMI is connected

8994/8992 don't support BWC with video mode panels in system.
Disable BWC when HDMI is connected.

Change-Id: I43616cc90bb2a518bae360af996889a75cc8c633
diff --git a/libhwcomposer/hwc_uevents.cpp b/libhwcomposer/hwc_uevents.cpp
index d1c68a5..d53fd8f 100644
--- a/libhwcomposer/hwc_uevents.cpp
+++ b/libhwcomposer/hwc_uevents.cpp
@@ -125,6 +125,16 @@
                         "event", __FUNCTION__);
                 ctx->proc->hotplug(ctx->proc, dpy, EXTERNAL_OFFLINE);
             }
+
+            //On 8994, 8992 due to hardware limitations, we disable bwc
+            //when HDMI intf is active
+            if((qdutils::MDPVersion::getInstance().is8994() or
+                qdutils::MDPVersion::getInstance().is8092()) and
+                    qdutils::MDPVersion::getInstance().supportsBWC()) {
+                Locker::Autolock _l(ctx->mDrawLock);
+                ctx->mBWCEnabled = true;
+            }
+
             break;
         }
     case EXTERNAL_ONLINE:
@@ -136,6 +146,15 @@
                 break;
             }
 
+            //On 8994, 8992 due to hardware limitations, we disable bwc
+            //when HDMI intf is active
+            if((qdutils::MDPVersion::getInstance().is8994() or
+                qdutils::MDPVersion::getInstance().is8092()) and
+                    qdutils::MDPVersion::getInstance().supportsBWC()) {
+                Locker::Autolock _l(ctx->mDrawLock);
+                ctx->mBWCEnabled = false;
+            }
+
             if (ctx->mHDMIDisplay->isHDMIPrimaryDisplay()) {
                 ctx->mDrawLock.lock();
                 handle_online(ctx, dpy);
diff --git a/libhwcomposer/hwc_utils.cpp b/libhwcomposer/hwc_utils.cpp
index 8139013..4baab5b 100644
--- a/libhwcomposer/hwc_utils.cpp
+++ b/libhwcomposer/hwc_utils.cpp
@@ -2725,12 +2725,6 @@
 // Handles online events when HDMI is the primary display. In particular,
 // online events for hdmi connected before AND after boot up and HWC init.
 void handle_online(hwc_context_t* ctx, int dpy) {
-    //On 8994 due to hardware limitations, we disable bwc completely when HDMI
-    //intf is active
-    if(qdutils::MDPVersion::getInstance().is8994() and
-            qdutils::MDPVersion::getInstance().supportsBWC()) {
-        ctx->mBWCEnabled = false;
-    }
     // Close the current fd if it was opened earlier on when HWC
     // was initialized.
     if (ctx->dpyAttr[dpy].fd >= 0) {
@@ -2761,12 +2755,6 @@
     resetDisplayInfo(ctx, dpy);
     ctx->dpyAttr[dpy].connected = false;
     ctx->dpyAttr[dpy].isActive = false;
-    //On 8994 due to hardware limitations, we enable bwc only when HDMI
-    //intf is inactive
-    if(qdutils::MDPVersion::getInstance().is8994() and
-            qdutils::MDPVersion::getInstance().supportsBWC()) {
-        ctx->mBWCEnabled = true;
-    }
 }
 
 };//namespace qhwc