hwc: Add binder interface to get the visibleRegion
- This binder interface can be used by clients to know the
active visible region for a display(pri/ext/virt)
- When external orientation is used, return the destFrame of
the FrameBuffer layer, as its the viewFrame
Change-Id: I7cfd149c76c16b9a3031103c89b1932d44bcbecd
diff --git a/libhwcomposer/hwc_fbupdate.cpp b/libhwcomposer/hwc_fbupdate.cpp
index 0ca5ad9..d601f8f 100644
--- a/libhwcomposer/hwc_fbupdate.cpp
+++ b/libhwcomposer/hwc_fbupdate.cpp
@@ -176,6 +176,8 @@
}
calcExtDisplayPosition(ctx, NULL, mDpy, sourceCrop, displayFrame,
transform, orient);
+ //Store the displayFrame, will be used in getDisplayViewFrame
+ ctx->dpyAttr[mDpy].mDstRect = displayFrame;
setMdpFlags(layer, mdpFlags, 0, transform);
// For External use rotator if there is a rotation value set
ret = preRotateExtDisplay(ctx, layer, info,
diff --git a/libhwcomposer/hwc_qclient.cpp b/libhwcomposer/hwc_qclient.cpp
index a3f6b5b..50e94c9 100644
--- a/libhwcomposer/hwc_qclient.cpp
+++ b/libhwcomposer/hwc_qclient.cpp
@@ -140,8 +140,34 @@
ctx->mBufferMirrorMode = enable;
}
+static status_t getDisplayVisibleRegion(hwc_context_t* ctx, int dpy,
+ Parcel* outParcel) {
+ // Get the info only if the dpy is valid
+ if(dpy >= HWC_DISPLAY_PRIMARY && dpy <= HWC_DISPLAY_VIRTUAL) {
+ Locker::Autolock _sl(ctx->mDrawLock);
+ if(dpy && (ctx->mExtOrientation || ctx->mBufferMirrorMode)) {
+ // Return the destRect on external, if external orienation
+ // is enabled
+ outParcel->writeInt32(ctx->dpyAttr[dpy].mDstRect.left);
+ outParcel->writeInt32(ctx->dpyAttr[dpy].mDstRect.top);
+ outParcel->writeInt32(ctx->dpyAttr[dpy].mDstRect.right);
+ outParcel->writeInt32(ctx->dpyAttr[dpy].mDstRect.bottom);
+ } else {
+ outParcel->writeInt32(ctx->mViewFrame[dpy].left);
+ outParcel->writeInt32(ctx->mViewFrame[dpy].top);
+ outParcel->writeInt32(ctx->mViewFrame[dpy].right);
+ outParcel->writeInt32(ctx->mViewFrame[dpy].bottom);
+ }
+ return NO_ERROR;
+ } else {
+ ALOGE("In %s: invalid dpy index %d", __FUNCTION__, dpy);
+ return BAD_VALUE;
+ }
+}
+
status_t QClient::notifyCallback(uint32_t command, const Parcel* inParcel,
Parcel* outParcel) {
+ status_t ret = NO_ERROR;
if (command > IQService::VPU_COMMAND_LIST_START &&
command < IQService::VPU_COMMAND_LIST_END) {
@@ -164,6 +190,10 @@
case IQService::BUFFER_MIRRORMODE:
setBufferMirrorMode(mHwcContext, inParcel->readInt32());
break;
+ case IQService::GET_DISPLAY_VISIBLE_REGION:
+ ret = getDisplayVisibleRegion(mHwcContext, inParcel->readInt32(),
+ outParcel);
+ break;
case IQService::CHECK_EXTERNAL_STATUS:
isExternalConnected(mHwcContext, outParcel);
break;
@@ -174,9 +204,9 @@
setHSIC(mHwcContext, inParcel);
break;
default:
- return NO_ERROR;
+ ret = NO_ERROR;
}
- return NO_ERROR;
+ return ret;
}
diff --git a/libhwcomposer/hwc_utils.h b/libhwcomposer/hwc_utils.h
index 872b306..cd84f73 100644
--- a/libhwcomposer/hwc_utils.h
+++ b/libhwcomposer/hwc_utils.h
@@ -87,6 +87,8 @@
bool isConfiguring;
// External Display is in MDP Downscale mode indicator
bool mDownScaleMode;
+ // Ext dst Rect
+ hwc_rect_t mDstRect;
};
struct ListStats {