hwc: Clean up ExternalDisplay class
1. Remove hwc_context_t from libexternal since this is a construct
that should only be used in libhwcomposer.
2. Clean up redundant code by creating utility functions to
a. open a sysfs node in a given mode
b. improving EDID mode storage/manipulation
c. creating/destroying composition objects
3. Add utility functions to
a. get the connected state of the external display
b. determine which interface the external display is connected to
(primary or external)
c. activate the hdmi interface by setting the resolution via an
ioctl
d. update/reset external display information when a device
connected/disconnected
Change-Id: Iba34c9e43b39ccb9c9436deb726587bd1b26b779
diff --git a/libhwcomposer/hwc_virtual.cpp b/libhwcomposer/hwc_virtual.cpp
index 146d671..415a5e7 100644
--- a/libhwcomposer/hwc_virtual.cpp
+++ b/libhwcomposer/hwc_virtual.cpp
@@ -41,9 +41,7 @@
void HWCVirtualVDS::init(hwc_context_t *ctx) {
const int dpy = HWC_DISPLAY_VIRTUAL;
mScalingWidth = 0, mScalingHeight = 0;
- ctx->mFBUpdate[dpy] =
- IFBUpdate::getObject(ctx, dpy);
- ctx->mMDPComp[dpy] = MDPComp::getObject(ctx, dpy);
+ initCompositionResources(ctx, dpy);
if(ctx->mFBUpdate[dpy])
ctx->mFBUpdate[dpy]->reset();
@@ -60,14 +58,8 @@
ctx->dpyAttr[dpy].connected = false;
ctx->dpyAttr[dpy].isPause = false;
- if(ctx->mFBUpdate[dpy]) {
- delete ctx->mFBUpdate[dpy];
- ctx->mFBUpdate[dpy] = NULL;
- }
- if(ctx->mMDPComp[dpy]) {
- delete ctx->mMDPComp[dpy];
- ctx->mMDPComp[dpy] = NULL;
- }
+ destroyCompositionResources(ctx, dpy);
+
// signal synclock to indicate successful wfd teardown
ctx->mWfdSyncLock.lock();
ctx->mWfdSyncLock.signal();