Merge "display: Add BufferMirrorMode support for External"
This commit is contained in:
committed by
Gerrit - the friendly Code Review server
commit
e81a2b11b4
@@ -116,6 +116,10 @@ bool FBUpdateLowRes::configure(hwc_context_t *ctx, hwc_display_contents_1 *list,
|
|||||||
|
|
||||||
ovutils::eTransform orient =
|
ovutils::eTransform orient =
|
||||||
static_cast<ovutils::eTransform>(transform);
|
static_cast<ovutils::eTransform>(transform);
|
||||||
|
// use ext orientation if any
|
||||||
|
int extOrient = ctx->mExtOrientation;
|
||||||
|
if(ctx->mBufferMirrorMode)
|
||||||
|
extOrient = getMirrorModeOrientation(ctx);
|
||||||
|
|
||||||
// Do not use getNonWormholeRegion() function to calculate the
|
// Do not use getNonWormholeRegion() function to calculate the
|
||||||
// sourceCrop during animation on external display and
|
// sourceCrop during animation on external display and
|
||||||
@@ -125,7 +129,7 @@ bool FBUpdateLowRes::configure(hwc_context_t *ctx, hwc_display_contents_1 *list,
|
|||||||
sourceCrop = layer->displayFrame;
|
sourceCrop = layer->displayFrame;
|
||||||
displayFrame = sourceCrop;
|
displayFrame = sourceCrop;
|
||||||
} else if((!mDpy ||
|
} else if((!mDpy ||
|
||||||
(mDpy && !ctx->mExtOrientation
|
(mDpy && !extOrient
|
||||||
&& !ctx->dpyAttr[mDpy].mDownScaleMode))
|
&& !ctx->dpyAttr[mDpy].mDownScaleMode))
|
||||||
&& (extOnlyLayerIndex == -1)) {
|
&& (extOnlyLayerIndex == -1)) {
|
||||||
if(!qdutils::MDPVersion::getInstance().is8x26()) {
|
if(!qdutils::MDPVersion::getInstance().is8x26()) {
|
||||||
@@ -134,13 +138,12 @@ bool FBUpdateLowRes::configure(hwc_context_t *ctx, hwc_display_contents_1 *list,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
if(mDpy && !qdutils::MDPVersion::getInstance().is8x26()) {
|
if(mDpy && !qdutils::MDPVersion::getInstance().is8x26()) {
|
||||||
if(ctx->mExtOrientation || ctx->dpyAttr[mDpy].mDownScaleMode) {
|
if(extOrient || ctx->dpyAttr[mDpy].mDownScaleMode) {
|
||||||
calcExtDisplayPosition(ctx, mDpy, sourceCrop, displayFrame);
|
calcExtDisplayPosition(ctx, mDpy, sourceCrop, displayFrame);
|
||||||
// If there is a external orientation set, use that
|
// If there is a external orientation set, use that
|
||||||
if(ctx->mExtOrientation) {
|
if(extOrient) {
|
||||||
transform = ctx->mExtOrientation;
|
transform = extOrient;
|
||||||
orient =
|
orient = static_cast<ovutils::eTransform >(extOrient);
|
||||||
static_cast<ovutils::eTransform >(ctx->mExtOrientation);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// Calculate the actionsafe dimensions for External(dpy = 1 or 2)
|
// Calculate the actionsafe dimensions for External(dpy = 1 or 2)
|
||||||
@@ -148,7 +151,7 @@ bool FBUpdateLowRes::configure(hwc_context_t *ctx, hwc_display_contents_1 *list,
|
|||||||
}
|
}
|
||||||
setMdpFlags(layer, mdpFlags, 0, transform);
|
setMdpFlags(layer, mdpFlags, 0, transform);
|
||||||
// For External use rotator if there is a rotation value set
|
// For External use rotator if there is a rotation value set
|
||||||
if(mDpy && (ctx->mExtOrientation & HWC_TRANSFORM_ROT_90)) {
|
if(mDpy && (extOrient & HWC_TRANSFORM_ROT_90)) {
|
||||||
mRot = ctx->mRotMgr->getNext();
|
mRot = ctx->mRotMgr->getNext();
|
||||||
if(mRot == NULL) return -1;
|
if(mRot == NULL) return -1;
|
||||||
//Configure rotator for pre-rotation
|
//Configure rotator for pre-rotation
|
||||||
|
|||||||
@@ -64,6 +64,9 @@ status_t QClient::notifyCallback(uint32_t msg, uint32_t value) {
|
|||||||
case IQService::EXTERNAL_ORIENTATION:
|
case IQService::EXTERNAL_ORIENTATION:
|
||||||
setExtOrientation(value);
|
setExtOrientation(value);
|
||||||
break;
|
break;
|
||||||
|
case IQService::BUFFER_MIRRORMODE:
|
||||||
|
setBufferMirrorMode(value);
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
return NO_ERROR;
|
return NO_ERROR;
|
||||||
}
|
}
|
||||||
@@ -118,4 +121,8 @@ void QClient::setExtOrientation(uint32_t orientation) {
|
|||||||
mHwcContext->mExtOrientation = orientation;
|
mHwcContext->mExtOrientation = orientation;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void QClient::setBufferMirrorMode(uint32_t enable) {
|
||||||
|
mHwcContext->mBufferMirrorMode = enable;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -61,6 +61,7 @@ private:
|
|||||||
void unsecuring(uint32_t startEnd);
|
void unsecuring(uint32_t startEnd);
|
||||||
android::status_t screenRefresh();
|
android::status_t screenRefresh();
|
||||||
void setExtOrientation(uint32_t orientation);
|
void setExtOrientation(uint32_t orientation);
|
||||||
|
void setBufferMirrorMode(uint32_t enable);
|
||||||
|
|
||||||
hwc_context_t *mHwcContext;
|
hwc_context_t *mHwcContext;
|
||||||
const android::sp<android::IMediaDeathNotifier> mMPDeathNotifier;
|
const android::sp<android::IMediaDeathNotifier> mMPDeathNotifier;
|
||||||
|
|||||||
@@ -196,6 +196,8 @@ void initContext(hwc_context_t *ctx)
|
|||||||
ctx->mPrevDestVideo.right = ctx->mPrevDestVideo.bottom = 0;
|
ctx->mPrevDestVideo.right = ctx->mPrevDestVideo.bottom = 0;
|
||||||
ctx->mPrevTransformVideo = 0;
|
ctx->mPrevTransformVideo = 0;
|
||||||
|
|
||||||
|
ctx->mBufferMirrorMode = false;
|
||||||
|
|
||||||
ALOGI("Initializing Qualcomm Hardware Composer");
|
ALOGI("Initializing Qualcomm Hardware Composer");
|
||||||
ALOGI("MDP version: %d", ctx->mMDP.version);
|
ALOGI("MDP version: %d", ctx->mMDP.version);
|
||||||
}
|
}
|
||||||
@@ -297,7 +299,11 @@ void getActionSafePosition(hwc_context_t *ctx, int dpy, hwc_rect_t& rect) {
|
|||||||
float fbHeight = ctx->dpyAttr[dpy].yres;
|
float fbHeight = ctx->dpyAttr[dpy].yres;
|
||||||
|
|
||||||
// Since external is rotated 90, need to swap width/height
|
// Since external is rotated 90, need to swap width/height
|
||||||
if(ctx->mExtOrientation & HWC_TRANSFORM_ROT_90)
|
int extOrient = ctx->mExtOrientation;
|
||||||
|
if(ctx->mBufferMirrorMode)
|
||||||
|
extOrient = getMirrorModeOrientation(ctx);
|
||||||
|
|
||||||
|
if(extOrient & HWC_TRANSFORM_ROT_90)
|
||||||
swap(fbWidth, fbHeight);
|
swap(fbWidth, fbHeight);
|
||||||
|
|
||||||
float asX = 0;
|
float asX = 0;
|
||||||
@@ -496,7 +502,10 @@ void calcExtDisplayPosition(hwc_context_t *ctx, int dpy,
|
|||||||
hwc_rect_t& sourceCrop,
|
hwc_rect_t& sourceCrop,
|
||||||
hwc_rect_t& displayFrame) {
|
hwc_rect_t& displayFrame) {
|
||||||
// Swap width and height when there is a 90deg transform
|
// Swap width and height when there is a 90deg transform
|
||||||
if(ctx->mExtOrientation & HWC_TRANSFORM_ROT_90) {
|
int extOrient = ctx->mExtOrientation;
|
||||||
|
if(ctx->mBufferMirrorMode)
|
||||||
|
extOrient = getMirrorModeOrientation(ctx);
|
||||||
|
if(extOrient & HWC_TRANSFORM_ROT_90) {
|
||||||
int dstWidth = ctx->dpyAttr[dpy].xres;
|
int dstWidth = ctx->dpyAttr[dpy].xres;
|
||||||
int dstHeight = ctx->dpyAttr[dpy].yres;;
|
int dstHeight = ctx->dpyAttr[dpy].yres;;
|
||||||
int srcWidth = ctx->dpyAttr[HWC_DISPLAY_PRIMARY].xres;
|
int srcWidth = ctx->dpyAttr[HWC_DISPLAY_PRIMARY].xres;
|
||||||
@@ -538,7 +547,26 @@ void calcExtDisplayPosition(hwc_context_t *ctx, int dpy,
|
|||||||
displayFrame.right *= wRatio;
|
displayFrame.right *= wRatio;
|
||||||
displayFrame.bottom *= hRatio;
|
displayFrame.bottom *= hRatio;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Returns the orientation which needs to be set on External for
|
||||||
|
* SideSync/Buffer Mirrormode
|
||||||
|
*/
|
||||||
|
int getMirrorModeOrientation(hwc_context_t *ctx) {
|
||||||
|
int extOrientation = 0;
|
||||||
|
int deviceOrientation = ctx->deviceOrientation;
|
||||||
|
if(!isPrimaryPortrait(ctx))
|
||||||
|
deviceOrientation = (deviceOrientation + 1) % 4;
|
||||||
|
if (deviceOrientation == 0)
|
||||||
|
extOrientation = HWC_TRANSFORM_ROT_270;
|
||||||
|
else if (deviceOrientation == 1)//90
|
||||||
|
extOrientation = 0;
|
||||||
|
else if (deviceOrientation == 2)//180
|
||||||
|
extOrientation = HWC_TRANSFORM_ROT_90;
|
||||||
|
else if (deviceOrientation == 3)//270
|
||||||
|
extOrientation = HWC_TRANSFORM_FLIP_V | HWC_TRANSFORM_FLIP_H;
|
||||||
|
|
||||||
|
return extOrientation;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool needsScaling(hwc_context_t* ctx, hwc_layer_1_t const* layer,
|
bool needsScaling(hwc_context_t* ctx, hwc_layer_1_t const* layer,
|
||||||
@@ -663,9 +691,10 @@ void setListStats(hwc_context_t *ctx,
|
|||||||
ctx->mExtOrientation = atoi(value); */
|
ctx->mExtOrientation = atoi(value); */
|
||||||
// Assuming the orientation value is in terms of HAL_TRANSFORM,
|
// Assuming the orientation value is in terms of HAL_TRANSFORM,
|
||||||
// This needs mapping to HAL, if its in different convention
|
// This needs mapping to HAL, if its in different convention
|
||||||
if(ctx->mExtOrientation) {
|
if(ctx->mExtOrientation || ctx->mBufferMirrorMode) {
|
||||||
ALOGD_IF(HWC_UTILS_DEBUG, "%s: ext orientation = %d",
|
ALOGD_IF(HWC_UTILS_DEBUG, "%s: ext orientation = %d"
|
||||||
__FUNCTION__, ctx->mExtOrientation);
|
"BufferMirrorMode = %d", __FUNCTION__,
|
||||||
|
ctx->mExtOrientation, ctx->mBufferMirrorMode);
|
||||||
if(ctx->mOverlay->isPipeTypeAttached(OV_MDP_PIPE_DMA)) {
|
if(ctx->mOverlay->isPipeTypeAttached(OV_MDP_PIPE_DMA)) {
|
||||||
ctx->isPaddingRound = true;
|
ctx->isPaddingRound = true;
|
||||||
}
|
}
|
||||||
@@ -1165,12 +1194,15 @@ int configureLowRes(hwc_context_t *ctx, hwc_layer_1_t *layer,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
if(dpy) {
|
if(dpy) {
|
||||||
|
int extOrient = ctx->mExtOrientation;
|
||||||
|
if(ctx->mBufferMirrorMode)
|
||||||
|
extOrient = getMirrorModeOrientation(ctx);
|
||||||
// Just need to set the position to portrait as the transformation
|
// Just need to set the position to portrait as the transformation
|
||||||
// will already be set to required orientation on TV
|
// will already be set to required orientation on TV
|
||||||
if(ctx->mExtOrientation || ctx->dpyAttr[dpy].mDownScaleMode) {
|
if(extOrient || ctx->dpyAttr[dpy].mDownScaleMode) {
|
||||||
getAspectRatioPosition(ctx, dpy, ctx->mExtOrientation, dst, dst);
|
getAspectRatioPosition(ctx, dpy, extOrient, dst, dst);
|
||||||
if(ctx->mExtOrientation) {
|
if(extOrient) {
|
||||||
transform = ctx->mExtOrientation;
|
transform = extOrient;
|
||||||
orient = static_cast<eTransform>(transform);
|
orient = static_cast<eTransform>(transform);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -193,6 +193,9 @@ void calcExtDisplayPosition(hwc_context_t *ctx,
|
|||||||
int dpy,
|
int dpy,
|
||||||
hwc_rect_t& sourceCrop,
|
hwc_rect_t& sourceCrop,
|
||||||
hwc_rect_t& displayFrame);
|
hwc_rect_t& displayFrame);
|
||||||
|
// Returns the orientation that needs to be set on external for
|
||||||
|
// BufferMirrirMode(Sidesync)
|
||||||
|
int getMirrorModeOrientation(hwc_context_t *ctx);
|
||||||
|
|
||||||
//Close acquireFenceFds of all layers of incoming list
|
//Close acquireFenceFds of all layers of incoming list
|
||||||
void closeAcquireFds(hwc_display_contents_1_t* list);
|
void closeAcquireFds(hwc_display_contents_1_t* list);
|
||||||
@@ -371,6 +374,11 @@ struct hwc_context_t {
|
|||||||
int mExtOrientation;
|
int mExtOrientation;
|
||||||
//Flags the transition of a video session
|
//Flags the transition of a video session
|
||||||
bool mVideoTransFlag;
|
bool mVideoTransFlag;
|
||||||
|
|
||||||
|
//Used for SideSync feature
|
||||||
|
//which overrides the mExtOrientation
|
||||||
|
bool mBufferMirrorMode;
|
||||||
|
|
||||||
qhwc::LayerRotMap *mLayerRotMap[HWC_NUM_DISPLAY_TYPES];
|
qhwc::LayerRotMap *mLayerRotMap[HWC_NUM_DISPLAY_TYPES];
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -78,6 +78,13 @@ public:
|
|||||||
data.writeInt32(orientation);
|
data.writeInt32(orientation);
|
||||||
remote()->transact(EXTERNAL_ORIENTATION, data, &reply);
|
remote()->transact(EXTERNAL_ORIENTATION, data, &reply);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
virtual void setBufferMirrorMode(uint32_t enable) {
|
||||||
|
Parcel data, reply;
|
||||||
|
data.writeInterfaceToken(IQService::getInterfaceDescriptor());
|
||||||
|
data.writeInt32(enable);
|
||||||
|
remote()->transact(BUFFER_MIRRORMODE, data, &reply);
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
IMPLEMENT_META_INTERFACE(QService, "android.display.IQService");
|
IMPLEMENT_META_INTERFACE(QService, "android.display.IQService");
|
||||||
@@ -160,6 +167,18 @@ status_t BnQService::onTransact(
|
|||||||
setExtOrientation(orientation);
|
setExtOrientation(orientation);
|
||||||
return NO_ERROR;
|
return NO_ERROR;
|
||||||
} break;
|
} break;
|
||||||
|
case BUFFER_MIRRORMODE: {
|
||||||
|
CHECK_INTERFACE(IQService, data, reply);
|
||||||
|
if(callerUid != AID_SYSTEM) {
|
||||||
|
ALOGE("display.qservice BUFFER_MIRRORMODE access denied: \
|
||||||
|
pid=%d uid=%d process=%s",callerPid,
|
||||||
|
callerUid, callingProcName);
|
||||||
|
return PERMISSION_DENIED;
|
||||||
|
}
|
||||||
|
uint32_t enable = data.readInt32();
|
||||||
|
setBufferMirrorMode(enable);
|
||||||
|
return NO_ERROR;
|
||||||
|
} break;
|
||||||
default:
|
default:
|
||||||
return BBinder::onTransact(code, data, reply, flags);
|
return BBinder::onTransact(code, data, reply, flags);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -42,6 +42,7 @@ public:
|
|||||||
CONNECT,
|
CONNECT,
|
||||||
SCREEN_REFRESH,
|
SCREEN_REFRESH,
|
||||||
EXTERNAL_ORIENTATION,
|
EXTERNAL_ORIENTATION,
|
||||||
|
BUFFER_MIRRORMODE,
|
||||||
};
|
};
|
||||||
enum {
|
enum {
|
||||||
END = 0,
|
END = 0,
|
||||||
@@ -52,6 +53,7 @@ public:
|
|||||||
virtual void connect(const android::sp<qClient::IQClient>& client) = 0;
|
virtual void connect(const android::sp<qClient::IQClient>& client) = 0;
|
||||||
virtual android::status_t screenRefresh() = 0;
|
virtual android::status_t screenRefresh() = 0;
|
||||||
virtual void setExtOrientation(uint32_t orientation) = 0;
|
virtual void setExtOrientation(uint32_t orientation) = 0;
|
||||||
|
virtual void setBufferMirrorMode(uint32_t enable) = 0;
|
||||||
};
|
};
|
||||||
|
|
||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
|
|||||||
@@ -77,6 +77,12 @@ void QService::setExtOrientation(uint32_t orientation) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void QService::setBufferMirrorMode(uint32_t enable) {
|
||||||
|
if(mClient.get()) {
|
||||||
|
mClient->notifyCallback(BUFFER_MIRRORMODE, enable);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void QService::init()
|
void QService::init()
|
||||||
{
|
{
|
||||||
if(!sQService) {
|
if(!sQService) {
|
||||||
|
|||||||
@@ -50,6 +50,7 @@ public:
|
|||||||
virtual void connect(const android::sp<qClient::IQClient>& client);
|
virtual void connect(const android::sp<qClient::IQClient>& client);
|
||||||
virtual android::status_t screenRefresh();
|
virtual android::status_t screenRefresh();
|
||||||
virtual void setExtOrientation(uint32_t orientation);
|
virtual void setExtOrientation(uint32_t orientation);
|
||||||
|
virtual void setBufferMirrorMode(uint32_t enable);
|
||||||
static void init();
|
static void init();
|
||||||
private:
|
private:
|
||||||
QService();
|
QService();
|
||||||
|
|||||||
Reference in New Issue
Block a user