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
This commit is contained in:
@@ -176,6 +176,8 @@ bool FBUpdateNonSplit::configure(hwc_context_t *ctx, hwc_display_contents_1 *lis
|
||||
}
|
||||
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,
|
||||
|
||||
@@ -140,8 +140,34 @@ static void setBufferMirrorMode(hwc_context_t *ctx, uint32_t enable) {
|
||||
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 @@ status_t QClient::notifyCallback(uint32_t command, const Parcel* inParcel,
|
||||
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 @@ status_t QClient::notifyCallback(uint32_t command, const Parcel* inParcel,
|
||||
setHSIC(mHwcContext, inParcel);
|
||||
break;
|
||||
default:
|
||||
return NO_ERROR;
|
||||
ret = NO_ERROR;
|
||||
}
|
||||
return NO_ERROR;
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -87,6 +87,8 @@ struct DisplayAttributes {
|
||||
bool isConfiguring;
|
||||
// External Display is in MDP Downscale mode indicator
|
||||
bool mDownScaleMode;
|
||||
// Ext dst Rect
|
||||
hwc_rect_t mDstRect;
|
||||
};
|
||||
|
||||
struct ListStats {
|
||||
|
||||
@@ -91,4 +91,26 @@ int setHSIC(int dpy, const HSICData_t& hsic_data) {
|
||||
ALOGE("%s: Failed to get external status err=%d", __FUNCTION__, err);
|
||||
return err;
|
||||
}
|
||||
|
||||
int getDisplayVisibleRegion(int dpy, hwc_rect_t &rect) {
|
||||
status_t err = FAILED_TRANSACTION;
|
||||
sp<IQService> binder = getBinder();
|
||||
Parcel inParcel, outParcel;
|
||||
inParcel.writeInt32(dpy);
|
||||
if(binder != NULL) {
|
||||
err = binder->dispatch(IQService::GET_DISPLAY_VISIBLE_REGION,
|
||||
&inParcel, &outParcel);
|
||||
}
|
||||
if(!err) {
|
||||
rect.left = outParcel.readInt32();
|
||||
rect.top = outParcel.readInt32();
|
||||
rect.right = outParcel.readInt32();
|
||||
rect.bottom = outParcel.readInt32();
|
||||
} else {
|
||||
ALOGE("%s: Failed to getVisibleRegion for dpy =%d: err = %d",
|
||||
__FUNCTION__, dpy, err);
|
||||
}
|
||||
return err;
|
||||
}
|
||||
|
||||
}; //namespace
|
||||
|
||||
@@ -29,6 +29,7 @@
|
||||
#include <gralloc_priv.h>
|
||||
#include <qdMetaData.h>
|
||||
#include <mdp_version.h>
|
||||
#include <hardware/hwcomposer.h>
|
||||
|
||||
// This header is for clients to use to set/get global display configuration
|
||||
// The functions in this header run in the client process and wherever necessary
|
||||
@@ -69,4 +70,7 @@ int getDisplayAttributes(int dpy, DisplayAttributes_t& dpyattr);
|
||||
// Returns 0 on success, negative values on errors
|
||||
int setHSIC(int dpy, const HSICData_t& hsic_data);
|
||||
|
||||
// get the active visible region for the display
|
||||
// Returns 0 on success, negative values on errors
|
||||
int getDisplayVisibleRegion(int dpy, hwc_rect_t &rect);
|
||||
}; //namespace
|
||||
|
||||
@@ -48,6 +48,7 @@ public:
|
||||
CHECK_EXTERNAL_STATUS, // Check status of external display
|
||||
GET_DISPLAY_ATTRIBUTES, // Get display attributes
|
||||
SET_HSIC_DATA, // Set HSIC on dspp
|
||||
GET_DISPLAY_VISIBLE_REGION, // Get the visibleRegion for dpy
|
||||
VPU_COMMAND_LIST_START = 100, //Reserved block for VPU commands
|
||||
VPU_COMMAND_LIST_END = 200,
|
||||
COMMAND_LIST_END = 400,
|
||||
|
||||
Reference in New Issue
Block a user