hwc: Rename libexternal to serve HDMI as primary or external

This change will make is easier to build new functionality
applicable to both HDMI scenarios.

Change-Id: I417184568cb65a49c2ccb4199aff313ae2ee9b24
diff --git a/libhwcomposer/Android.mk b/libhwcomposer/Android.mk
index 8e3fc8e..df3e464 100644
--- a/libhwcomposer/Android.mk
+++ b/libhwcomposer/Android.mk
@@ -9,7 +9,7 @@
                                  $(TOP)/external/skia/include/core \
                                  $(TOP)/external/skia/include/images
 LOCAL_SHARED_LIBRARIES        := $(common_libs) libEGL liboverlay \
-                                 libexternal libqdutils libhardware_legacy \
+                                 libhdmi libqdutils libhardware_legacy \
                                  libdl libmemalloc libqservice libsync \
                                  libbinder libmedia
 
diff --git a/libhwcomposer/hwc.cpp b/libhwcomposer/hwc.cpp
index ae1389d..288b2e0 100644
--- a/libhwcomposer/hwc.cpp
+++ b/libhwcomposer/hwc.cpp
@@ -34,7 +34,7 @@
 #include "hwc_fbupdate.h"
 #include "hwc_mdpcomp.h"
 #include "hwc_dump_layers.h"
-#include "external.h"
+#include "hdmi.h"
 #include "hwc_copybit.h"
 #include "hwc_ad.h"
 #include "profiler.h"
@@ -442,7 +442,7 @@
         if(mode == HWC_POWER_MODE_NORMAL) {
             // Enable HPD here, as during bootup POWER_MODE_NORMAL is set
             // when SF is completely initialized
-            ctx->mExtDisplay->setHPD(1);
+            ctx->mHDMIDisplay->setHPD(1);
         }
 
         ctx->dpyAttr[dpy].isActive = not(mode == HWC_POWER_MODE_OFF);
diff --git a/libhwcomposer/hwc_ad.cpp b/libhwcomposer/hwc_ad.cpp
index 679e6d6..7e96d97 100644
--- a/libhwcomposer/hwc_ad.cpp
+++ b/libhwcomposer/hwc_ad.cpp
@@ -34,7 +34,6 @@
 #include <mdp_version.h>
 #include "hwc_ad.h"
 #include "hwc_utils.h"
-#include "external.h"
 
 #define DEBUG 0
 using namespace overlay;
diff --git a/libhwcomposer/hwc_fbupdate.cpp b/libhwcomposer/hwc_fbupdate.cpp
index 7839139..30ae03d 100644
--- a/libhwcomposer/hwc_fbupdate.cpp
+++ b/libhwcomposer/hwc_fbupdate.cpp
@@ -25,7 +25,6 @@
 #include <overlayRotator.h>
 #include "hwc_fbupdate.h"
 #include "mdp_version.h"
-#include "external.h"
 
 using namespace qdutils;
 using namespace overlay;
diff --git a/libhwcomposer/hwc_mdpcomp.cpp b/libhwcomposer/hwc_mdpcomp.cpp
index 072eda3..d52955d 100644
--- a/libhwcomposer/hwc_mdpcomp.cpp
+++ b/libhwcomposer/hwc_mdpcomp.cpp
@@ -19,7 +19,7 @@
 #include <math.h>
 #include "hwc_mdpcomp.h"
 #include <sys/ioctl.h>
-#include "external.h"
+#include "hdmi.h"
 #include "qdMetaData.h"
 #include "mdp_version.h"
 #include "hwc_fbupdate.h"
diff --git a/libhwcomposer/hwc_uevents.cpp b/libhwcomposer/hwc_uevents.cpp
index 821bfa9..65e041b 100644
--- a/libhwcomposer/hwc_uevents.cpp
+++ b/libhwcomposer/hwc_uevents.cpp
@@ -30,7 +30,7 @@
 #include "hwc_mdpcomp.h"
 #include "hwc_copybit.h"
 #include "comptype.h"
-#include "external.h"
+#include "hdmi.h"
 #include "hwc_virtual.h"
 #include "mdp_version.h"
 using namespace overlay;
@@ -109,7 +109,7 @@
 
             Locker::Autolock _l(ctx->mDrawLock);
             destroyCompositionResources(ctx, dpy);
-            ctx->mExtDisplay->teardown();
+            ctx->mHDMIDisplay->teardown();
             resetDisplayInfo(ctx, dpy);
 
             /* We need to send hotplug to SF only when we are disconnecting
@@ -163,8 +163,8 @@
                         "uevent thread", __FUNCTION__);
                 ctx->mWfdSyncLock.unlock();
             }
-            ctx->mExtDisplay->configure();
-            ctx->mExtDisplay->activateDisplay();
+            ctx->mHDMIDisplay->configure();
+            ctx->mHDMIDisplay->activateDisplay();
 
             Locker::Autolock _l(ctx->mDrawLock);
             updateDisplayInfo(ctx, dpy);
diff --git a/libhwcomposer/hwc_utils.cpp b/libhwcomposer/hwc_utils.cpp
index 44725de..d67a7a1 100644
--- a/libhwcomposer/hwc_utils.cpp
+++ b/libhwcomposer/hwc_utils.cpp
@@ -37,7 +37,7 @@
 #include "mdp_version.h"
 #include "hwc_copybit.h"
 #include "hwc_dump_layers.h"
-#include "external.h"
+#include "hdmi.h"
 #include "hwc_qclient.h"
 #include "QService.h"
 #include "comptype.h"
@@ -112,21 +112,21 @@
     }
 }
 
-// Initialize external display attributes based on
-// external display class state
+// Initialize hdmi display attributes based on
+// hdmi display class state
 void updateDisplayInfo(hwc_context_t* ctx, int dpy) {
-    ctx->dpyAttr[dpy].fd = ctx->mExtDisplay->getFd();
-    ctx->dpyAttr[dpy].xres = ctx->mExtDisplay->getWidth();
-    ctx->dpyAttr[dpy].yres = ctx->mExtDisplay->getHeight();
-    ctx->dpyAttr[dpy].mMDPScalingMode = ctx->mExtDisplay->getMDPScalingMode();
-    ctx->dpyAttr[dpy].vsync_period = ctx->mExtDisplay->getVsyncPeriod();
+    ctx->dpyAttr[dpy].fd = ctx->mHDMIDisplay->getFd();
+    ctx->dpyAttr[dpy].xres = ctx->mHDMIDisplay->getWidth();
+    ctx->dpyAttr[dpy].yres = ctx->mHDMIDisplay->getHeight();
+    ctx->dpyAttr[dpy].mMDPScalingMode = ctx->mHDMIDisplay->getMDPScalingMode();
+    ctx->dpyAttr[dpy].vsync_period = ctx->mHDMIDisplay->getVsyncPeriod();
     ctx->mViewFrame[dpy].left = 0;
     ctx->mViewFrame[dpy].top = 0;
     ctx->mViewFrame[dpy].right = ctx->dpyAttr[dpy].xres;
     ctx->mViewFrame[dpy].bottom = ctx->dpyAttr[dpy].yres;
 }
 
-// Reset external display attributes and list stats structures
+// Reset hdmi display attributes and list stats structures
 void resetDisplayInfo(hwc_context_t* ctx, int dpy) {
     memset(&(ctx->dpyAttr[dpy]), 0, sizeof(ctx->dpyAttr[dpy]));
     memset(&(ctx->listStats[dpy]), 0, sizeof(ctx->listStats[dpy]));
@@ -260,12 +260,12 @@
                                                          HWC_DISPLAY_PRIMARY);
     }
 
-    ctx->mExtDisplay = new ExternalDisplay();
-    // Send the primary resolution to the external display class
+    ctx->mHDMIDisplay = new HDMIDisplay();
+    // Send the primary resolution to the hdmi display class
     // to be used for MDP scaling functionality
     uint32_t priW = ctx->dpyAttr[HWC_DISPLAY_PRIMARY].xres;
     uint32_t priH = ctx->dpyAttr[HWC_DISPLAY_PRIMARY].yres;
-    ctx->mExtDisplay->setPrimaryAttributes(priW, priH);
+    ctx->mHDMIDisplay->setPrimaryAttributes(priW, priH);
     ctx->mHWCVirtual = new HWCVirtualVDS();
     ctx->dpyAttr[HWC_DISPLAY_EXTERNAL].isActive = false;
     ctx->dpyAttr[HWC_DISPLAY_EXTERNAL].connected = false;
@@ -366,9 +366,9 @@
         ctx->dpyAttr[HWC_DISPLAY_PRIMARY].fd = -1;
     }
 
-    if(ctx->mExtDisplay) {
-        delete ctx->mExtDisplay;
-        ctx->mExtDisplay = NULL;
+    if(ctx->mHDMIDisplay) {
+        delete ctx->mHDMIDisplay;
+        ctx->mHDMIDisplay = NULL;
     }
 
     for(int i = 0; i < HWC_NUM_DISPLAY_TYPES; i++) {
@@ -478,7 +478,7 @@
     if(ctx->dpyAttr[dpy].mMDPScalingMode) {
         // if MDP scaling mode is enabled for external, need to query
         // the actual width and height, as that is the physical w & h
-         ctx->mExtDisplay->getAttributes(fbWidth, fbHeight);
+         ctx->mHDMIDisplay->getAttributes(fbWidth, fbHeight);
     }
 
 
@@ -610,7 +610,7 @@
     if(ctx->dpyAttr[dpy].mMDPScalingMode) {
         uint32_t extW = 0, extH = 0;
         if(dpy == HWC_DISPLAY_EXTERNAL) {
-            ctx->mExtDisplay->getAttributes(extW, extH);
+            ctx->mHDMIDisplay->getAttributes(extW, extH);
         } else if(dpy == HWC_DISPLAY_VIRTUAL) {
             extW = ctx->mHWCVirtual->getScalingWidth();
             extH = ctx->mHWCVirtual->getScalingHeight();
@@ -696,7 +696,7 @@
                 float fbHeight = (float)ctx->dpyAttr[dpy].yres;
                 // query MDP configured attributes
                 if(dpy == HWC_DISPLAY_EXTERNAL) {
-                    ctx->mExtDisplay->getAttributes(extW, extH);
+                    ctx->mHDMIDisplay->getAttributes(extW, extH);
                 } else if(dpy == HWC_DISPLAY_VIRTUAL) {
                     extW = ctx->mHWCVirtual->getScalingWidth();
                     extH = ctx->mHWCVirtual->getScalingHeight();
@@ -1114,7 +1114,7 @@
     // Disable Actionsafe for non HDMI displays.
     if(!(dpy == HWC_DISPLAY_EXTERNAL) ||
         qdutils::MDPVersion::getInstance().is8x74v2() ||
-        ctx->mExtDisplay->isCEUnderscanSupported()) {
+        ctx->mHDMIDisplay->isCEUnderscanSupported()) {
         return false;
     }
 
diff --git a/libhwcomposer/hwc_utils.h b/libhwcomposer/hwc_utils.h
index 041ca74..cae22f1 100644
--- a/libhwcomposer/hwc_utils.h
+++ b/libhwcomposer/hwc_utils.h
@@ -62,7 +62,7 @@
 namespace qhwc {
 //fwrd decl
 class QueuedBufferStore;
-class ExternalDisplay;
+class HDMIDisplay;
 class VirtualDisplay;
 class IFBUpdate;
 class IVideoOverlay;
@@ -545,8 +545,9 @@
 
     //Primary and external FB updater
     qhwc::IFBUpdate *mFBUpdate[HWC_NUM_DISPLAY_TYPES];
-    // External display related information
-    qhwc::ExternalDisplay *mExtDisplay;
+    // HDMI display related object. Used to configure/teardown
+    // HDMI when it is connected as primary or external.
+    qhwc::HDMIDisplay *mHDMIDisplay;
     qhwc::MDPInfo mMDP;
     qhwc::VsyncState vstate;
     qhwc::DisplayAttributes dpyAttr[HWC_NUM_DISPLAY_TYPES];
diff --git a/libhwcomposer/hwc_vsync.cpp b/libhwcomposer/hwc_vsync.cpp
index 66988f7..07d1e4e 100644
--- a/libhwcomposer/hwc_vsync.cpp
+++ b/libhwcomposer/hwc_vsync.cpp
@@ -29,7 +29,6 @@
 #include "hwc_utils.h"
 #include "qd_utils.h"
 #include "string.h"
-#include "external.h"
 #include "overlay.h"
 #define __STDC_FORMAT_MACROS 1
 #include <inttypes.h>