display: Add setSecondaryDisplayStatus API
- Clients(SecureUI/WFD FW) will use this API to set status of the
Secondary display
- Status can be offline/pause/resume
- Secondary display will be hdmi/wfd, HWC will free up pipes for
these displays
Change-Id: I25d5e070b60c38daeb102349bed14bb6de0a5684
diff --git a/libhwcomposer/hwc_qclient.cpp b/libhwcomposer/hwc_qclient.cpp
index 6bde3d2..fd0a36c 100644
--- a/libhwcomposer/hwc_qclient.cpp
+++ b/libhwcomposer/hwc_qclient.cpp
@@ -165,35 +165,27 @@
}
}
-static void pauseWFD(hwc_context_t *ctx, uint32_t pause) {
- /* TODO: Will remove pauseWFD once all the clients start using
- * setWfdStatus to indicate the status of WFD display
- */
- int dpy = HWC_DISPLAY_VIRTUAL;
- if(pause) {
- //WFD Pause
- handle_pause(ctx, dpy);
+// USed for setting the secondary(hdmi/wfd) status
+static void setSecondaryDisplayStatus(hwc_context_t *ctx,
+ const Parcel* inParcel) {
+ uint32_t dpy = inParcel->readInt32();
+ uint32_t status = inParcel->readInt32();
+ ALOGD_IF(QCLIENT_DEBUG, "%s: dpy = %d status = %s", __FUNCTION__,
+ dpy, getExternalDisplayState(status));
+
+ if(dpy > HWC_DISPLAY_PRIMARY && dpy <= HWC_DISPLAY_VIRTUAL) {
+ if(dpy == HWC_DISPLAY_VIRTUAL && status == EXTERNAL_OFFLINE) {
+ ctx->mWfdSyncLock.lock();
+ ctx->mWfdSyncLock.signal();
+ ctx->mWfdSyncLock.unlock();
+ } else if(status == EXTERNAL_PAUSE) {
+ handle_pause(ctx, dpy);
+ } else if(status == EXTERNAL_RESUME) {
+ handle_resume(ctx, dpy);
+ }
} else {
- //WFD Resume
- handle_resume(ctx, dpy);
- }
-}
-
-static void setWfdStatus(hwc_context_t *ctx, uint32_t wfdStatus) {
-
- ALOGD_IF(HWC_WFDDISPSYNC_LOG,
- "%s: Received a binder call that WFD state is %s",
- __FUNCTION__,getExternalDisplayState(wfdStatus));
- int dpy = HWC_DISPLAY_VIRTUAL;
-
- if(wfdStatus == EXTERNAL_OFFLINE) {
- ctx->mWfdSyncLock.lock();
- ctx->mWfdSyncLock.signal();
- ctx->mWfdSyncLock.unlock();
- } else if(wfdStatus == EXTERNAL_PAUSE) {
- handle_pause(ctx, dpy);
- } else if(wfdStatus == EXTERNAL_RESUME) {
- handle_resume(ctx, dpy);
+ ALOGE("%s: Invalid dpy", __FUNCTION__, dpy);
+ return;
}
}
@@ -285,11 +277,8 @@
case IQService::SET_HSIC_DATA:
setHSIC(inParcel);
break;
- case IQService::PAUSE_WFD:
- pauseWFD(mHwcContext, inParcel->readInt32());
- break;
- case IQService::SET_WFD_STATUS:
- setWfdStatus(mHwcContext,inParcel->readInt32());
+ case IQService::SET_SECONDARY_DISPLAY_STATUS:
+ setSecondaryDisplayStatus(mHwcContext, inParcel);
break;
case IQService::SET_VIEW_FRAME:
setViewFrame(mHwcContext, inParcel);
diff --git a/libhwcomposer/hwc_utils.cpp b/libhwcomposer/hwc_utils.cpp
index e541dcd..3eec011 100644
--- a/libhwcomposer/hwc_utils.cpp
+++ b/libhwcomposer/hwc_utils.cpp
@@ -2635,15 +2635,46 @@
}
void handle_pause(hwc_context_t* ctx, int dpy) {
- if(ctx->mHWCVirtual) {
- ctx->mHWCVirtual->pause(ctx, dpy);
+ if(ctx->dpyAttr[dpy].connected) {
+ ctx->mDrawLock.lock();
+ ctx->dpyAttr[dpy].isActive = true;
+ ctx->dpyAttr[dpy].isPause = true;
+ ctx->mDrawLock.unlock();
+ ctx->proc->invalidate(ctx->proc);
+
+ usleep(ctx->dpyAttr[HWC_DISPLAY_PRIMARY].vsync_period
+ * 2 / 1000);
+
+ // At this point all the pipes used by External have been
+ // marked as UNSET.
+ ctx->mDrawLock.lock();
+ // Perform commit to unstage the pipes.
+ if (!Overlay::displayCommit(ctx->dpyAttr[dpy].fd)) {
+ ALOGE("%s: display commit fail! for %d dpy",
+ __FUNCTION__, dpy);
+ }
+ ctx->mDrawLock.unlock();
+ ctx->proc->invalidate(ctx->proc);
}
return;
}
void handle_resume(hwc_context_t* ctx, int dpy) {
- if(ctx->mHWCVirtual) {
- ctx->mHWCVirtual->resume(ctx, dpy);
+ if(ctx->dpyAttr[dpy].connected) {
+ ctx->mDrawLock.lock();
+ ctx->dpyAttr[dpy].isConfiguring = true;
+ ctx->dpyAttr[dpy].isActive = true;
+ ctx->mDrawLock.unlock();
+ ctx->proc->invalidate(ctx->proc);
+
+ usleep(ctx->dpyAttr[HWC_DISPLAY_PRIMARY].vsync_period
+ * 2 / 1000);
+
+ //At this point external has all the pipes it would need.
+ ctx->mDrawLock.lock();
+ ctx->dpyAttr[dpy].isPause = false;
+ ctx->mDrawLock.unlock();
+ ctx->proc->invalidate(ctx->proc);
}
return;
}
diff --git a/libhwcomposer/hwc_virtual.cpp b/libhwcomposer/hwc_virtual.cpp
index d33a827..61e88c8 100644
--- a/libhwcomposer/hwc_virtual.cpp
+++ b/libhwcomposer/hwc_virtual.cpp
@@ -217,47 +217,6 @@
return ret;
}
-void HWCVirtualVDS::pause(hwc_context_t* ctx, int dpy) {
- {
- Locker::Autolock _l(ctx->mDrawLock);
- ctx->dpyAttr[dpy].isActive = true;
- ctx->dpyAttr[dpy].isPause = true;
- ctx->proc->invalidate(ctx->proc);
- }
- usleep(ctx->dpyAttr[HWC_DISPLAY_PRIMARY].vsync_period
- * 2 / 1000);
- // At this point all the pipes used by External have been
- // marked as UNSET.
- {
- Locker::Autolock _l(ctx->mDrawLock);
- // Perform commit to unstage the pipes.
- if (!Overlay::displayCommit(ctx->dpyAttr[dpy].fd)) {
- ALOGE("%s: display commit fail! for %d dpy",
- __FUNCTION__, dpy);
- }
- ctx->proc->invalidate(ctx->proc);
- }
- return;
-}
-
-void HWCVirtualVDS::resume(hwc_context_t* ctx, int dpy) {
- {
- Locker::Autolock _l(ctx->mDrawLock);
- ctx->dpyAttr[dpy].isConfiguring = true;
- ctx->dpyAttr[dpy].isActive = true;
- ctx->proc->invalidate(ctx->proc);
- }
- usleep(ctx->dpyAttr[HWC_DISPLAY_PRIMARY].vsync_period
- * 2 / 1000);
- //At this point external has all the pipes it would need.
- {
- Locker::Autolock _l(ctx->mDrawLock);
- ctx->dpyAttr[dpy].isPause = false;
- ctx->proc->invalidate(ctx->proc);
- }
- return;
-}
-
/* We set scaling mode on the VD if the output handle width and height
differs from the virtual frame buffer width and height. */
void HWCVirtualVDS::setMDPScalingMode(hwc_context_t* ctx,
diff --git a/libhwcomposer/hwc_virtual.h b/libhwcomposer/hwc_virtual.h
index 525ae2a..bd1833c 100644
--- a/libhwcomposer/hwc_virtual.h
+++ b/libhwcomposer/hwc_virtual.h
@@ -43,8 +43,6 @@
// during virtual display disconnect.
void destroy(hwc_context_t *ctx, size_t numDisplays,
hwc_display_contents_1_t** displays);
- void pause(hwc_context_t* ctx, int dpy);
- void resume(hwc_context_t* ctx, int dpy);
int getScalingHeight() const { return mScalingHeight; };
int getScalingWidth() const { return mScalingWidth; };
// We can dump the frame buffer and WB