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
diff --git a/libqdutils/display_config.cpp b/libqdutils/display_config.cpp
index 7ff106f..b5912ae 100644
--- a/libqdutils/display_config.cpp
+++ b/libqdutils/display_config.cpp
@@ -134,4 +134,22 @@
return err;
}
+int setSecondaryDisplayStatus(int dpy, uint32_t status) {
+ status_t err = (status_t) FAILED_TRANSACTION;
+ sp<IQService> binder = getBinder();
+ Parcel inParcel, outParcel;
+ inParcel.writeInt32(dpy);
+ inParcel.writeInt32(status);
+
+ if(binder != NULL) {
+ err = binder->dispatch(IQService::SET_SECONDARY_DISPLAY_STATUS,
+ &inParcel, &outParcel);
+ }
+ if(err)
+ ALOGE("%s: Failed for dpy %d status = %d err=%d", __FUNCTION__, dpy,
+ status, err);
+
+ return err;
+}
+
}; //namespace
diff --git a/libqdutils/display_config.h b/libqdutils/display_config.h
index a69265b..9b6ab56 100644
--- a/libqdutils/display_config.h
+++ b/libqdutils/display_config.h
@@ -43,6 +43,16 @@
enum {
DISPLAY_PRIMARY = 0,
DISPLAY_EXTERNAL,
+ DISPLAY_VIRTUAL,
+};
+
+// External Display states - used in setSecondaryDisplayStatus()
+// To be consistent with the same defined in hwc_utils.h
+enum {
+ EXTERNAL_OFFLINE = 0,
+ EXTERNAL_ONLINE,
+ EXTERNAL_PAUSE,
+ EXTERNAL_RESUME,
};
// Display Attributes that are available to clients of this library
@@ -76,4 +86,7 @@
// set the view frame information in hwc context from surfaceflinger
int setViewFrame(int dpy, int l, int t, int r, int b);
+
+// Set the secondary display status(pause/resume/offline etc.,)
+int setSecondaryDisplayStatus(int dpy, uint32_t status);
}; //namespace
diff --git a/libqservice/IQService.h b/libqservice/IQService.h
index 3be20f1..87d51fc 100644
--- a/libqservice/IQService.h
+++ b/libqservice/IQService.h
@@ -49,8 +49,8 @@
GET_DISPLAY_ATTRIBUTES, // Get display attributes
SET_HSIC_DATA, // Set HSIC on dspp
GET_DISPLAY_VISIBLE_REGION, // Get the visibleRegion for dpy
- PAUSE_WFD, // Pause/Resume WFD
- SET_WFD_STATUS, // Set if wfd connection is on/off
+ SET_SECONDARY_DISPLAY_STATUS, // Sets secondary display status
+ UNUSED_SLOT, // XXX: Unsed - New one can go here
SET_VIEW_FRAME, // Set view frame of display
DYNAMIC_DEBUG, // Enable more logging on the fly
SET_IDLE_TIMEOUT, // Set idle timeout for GPU fallback
diff --git a/libqservice/QServiceUtils.h b/libqservice/QServiceUtils.h
index 08cab31..f53d140 100644
--- a/libqservice/QServiceUtils.h
+++ b/libqservice/QServiceUtils.h
@@ -83,11 +83,4 @@
return sendSingleParam(qService::IQService::BUFFER_MIRRORMODE, enable);
}
-inline android::status_t pauseWFD(uint32_t pause) {
- return sendSingleParam(qService::IQService::PAUSE_WFD, pause);
-}
-
-inline android::status_t setWfdStatus(uint32_t wfdStatus) {
- return sendSingleParam(qService::IQService::SET_WFD_STATUS, wfdStatus);
-}
#endif /* end of include guard: QSERVICEUTILS_H */