Merge "hwc: Support for windowboxing feature on external"
This commit is contained in:
committed by
Gerrit - the friendly Code Review server
commit
650ba1960a
@@ -370,6 +370,13 @@ void initContext(hwc_context_t *ctx)
|
||||
ctx->mGPUHintInfo.mCompositionState = COMPOSITION_STATE_MDP;
|
||||
ctx->mGPUHintInfo.mCurrGPUPerfMode = EGL_GPU_LEVEL_0;
|
||||
#endif
|
||||
// Read the system property to determine if windowboxing feature is enabled.
|
||||
ctx->mWindowboxFeature = false;
|
||||
if(property_get("sys.hwc.windowbox_feature", value, "false")
|
||||
&& !strcmp(value, "true")) {
|
||||
ctx->mWindowboxFeature = true;
|
||||
}
|
||||
|
||||
memset(&(ctx->mPtorInfo), 0, sizeof(ctx->mPtorInfo));
|
||||
ALOGI("Initializing Qualcomm Hardware Composer");
|
||||
ALOGI("MDP version: %d", ctx->mMDP.version);
|
||||
@@ -959,6 +966,7 @@ void setListStats(hwc_context_t *ctx,
|
||||
uint32_t refreshRate = 0;
|
||||
qdutils::MDPVersion& mdpHw = qdutils::MDPVersion::getInstance();
|
||||
|
||||
ctx->mAIVVideoMode[dpy] = false;
|
||||
resetROI(ctx, dpy);
|
||||
|
||||
trimList(ctx, list, dpy);
|
||||
@@ -968,6 +976,9 @@ void setListStats(hwc_context_t *ctx,
|
||||
private_handle_t *hnd = (private_handle_t *)layer->handle;
|
||||
|
||||
#ifdef QCOM_BSP
|
||||
if(ctx->mWindowboxFeature && dpy && isAIVVideoLayer(layer)) {
|
||||
ctx->mAIVVideoMode[dpy] = true;
|
||||
}
|
||||
if (layer->flags & HWC_SCREENSHOT_ANIMATOR_LAYER) {
|
||||
ctx->listStats[dpy].isDisplayAnimating = true;
|
||||
}
|
||||
@@ -1819,6 +1830,66 @@ int getRotDownscale(hwc_context_t *ctx, const hwc_layer_1_t *layer) {
|
||||
return downscale;
|
||||
}
|
||||
|
||||
bool isZoomModeEnabled(hwc_rect_t crop) {
|
||||
// This does not work for zooming in top left corner of the image
|
||||
return(crop.top > 0 || crop.left > 0);
|
||||
}
|
||||
|
||||
void updateCropAIVVideoMode(hwc_context_t *ctx, hwc_rect_t& crop, int dpy) {
|
||||
ALOGD_IF(HWC_UTILS_DEBUG, "dpy %d Source crop [%d %d %d %d]", dpy,
|
||||
crop.left, crop.top, crop.right, crop.bottom);
|
||||
if(isZoomModeEnabled(crop)) {
|
||||
Dim srcCrop(crop.left, crop.top,
|
||||
crop.right - crop.left,
|
||||
crop.bottom - crop.top);
|
||||
int extW = ctx->dpyAttr[dpy].xres;
|
||||
int extH = ctx->dpyAttr[dpy].yres;
|
||||
//Crop the original video in order to fit external display aspect ratio
|
||||
if(srcCrop.w * extH < extW * srcCrop.h) {
|
||||
int offset = (srcCrop.h - ((srcCrop.w * extH) / extW)) / 2;
|
||||
crop.top += offset;
|
||||
crop.bottom -= offset;
|
||||
} else {
|
||||
int offset = (srcCrop.w - ((extW * srcCrop.h) / extH)) / 2;
|
||||
crop.left += offset;
|
||||
crop.right -= offset;
|
||||
}
|
||||
ALOGD_IF(HWC_UTILS_DEBUG, "External Resolution [%d %d] dpy %d Modified"
|
||||
" source crop [%d %d %d %d]", extW, extH, dpy,
|
||||
crop.left, crop.top, crop.right, crop.bottom);
|
||||
}
|
||||
}
|
||||
|
||||
void updateDestAIVVideoMode(hwc_context_t *ctx, hwc_rect_t crop,
|
||||
hwc_rect_t& dst, int dpy) {
|
||||
ALOGD_IF(HWC_UTILS_DEBUG, "dpy %d Destination position [%d %d %d %d]", dpy,
|
||||
dst.left, dst.top, dst.right, dst.bottom);
|
||||
Dim srcCrop(crop.left, crop.top,
|
||||
crop.right - crop.left,
|
||||
crop.bottom - crop.top);
|
||||
int extW = ctx->dpyAttr[dpy].xres;
|
||||
int extH = ctx->dpyAttr[dpy].yres;
|
||||
// Set the destination coordinates of external display to full screen,
|
||||
// when zoom in mode is enabled or video aspect ratio matches with the
|
||||
// external display aspect ratio
|
||||
if((srcCrop.w * extH == extW * srcCrop.h) || (isZoomModeEnabled(crop))) {
|
||||
dst.left = 0;
|
||||
dst.top = 0;
|
||||
dst.right = extW;
|
||||
dst.bottom = extH;
|
||||
}
|
||||
ALOGD_IF(HWC_UTILS_DEBUG, "External Resolution [%d %d] dpy %d Modified"
|
||||
" Destination position [%d %d %d %d] Source crop [%d %d %d %d]",
|
||||
extW, extH, dpy, dst.left, dst.top, dst.right, dst.bottom,
|
||||
crop.left, crop.top, crop.right, crop.bottom);
|
||||
}
|
||||
|
||||
void updateExtDisplayCoordinates(hwc_context_t *ctx, hwc_rect_t& crop,
|
||||
hwc_rect_t& dst, int dpy) {
|
||||
updateCropAIVVideoMode(ctx, crop, dpy);
|
||||
updateDestAIVVideoMode(ctx, crop, dst, dpy);
|
||||
}
|
||||
|
||||
int configureNonSplit(hwc_context_t *ctx, hwc_layer_1_t *layer,
|
||||
const int& dpy, eMdpFlags& mdpFlags, eZorder& z,
|
||||
const eDest& dest, Rotator **rot) {
|
||||
@@ -1851,7 +1922,10 @@ int configureNonSplit(hwc_context_t *ctx, hwc_layer_1_t *layer,
|
||||
else if (hnd->format == HAL_PIXEL_FORMAT_RGBX_8888)
|
||||
whf.format = getMdpFormat(HAL_PIXEL_FORMAT_BGRX_8888);
|
||||
}
|
||||
|
||||
// update source crop and destination position of AIV video layer.
|
||||
if(ctx->mAIVVideoMode[dpy] && isYuvBuffer(hnd)) {
|
||||
updateExtDisplayCoordinates(ctx, crop, dst, dpy);
|
||||
}
|
||||
calcExtDisplayPosition(ctx, hnd, dpy, crop, dst, transform, orient);
|
||||
int downscale = getRotDownscale(ctx, layer);
|
||||
setMdpFlags(ctx, layer, mdpFlags, downscale, transform);
|
||||
@@ -1946,7 +2020,12 @@ int configureSplit(hwc_context_t *ctx, hwc_layer_1_t *layer,
|
||||
whf.format = getMdpFormat(HAL_PIXEL_FORMAT_BGRX_8888);
|
||||
}
|
||||
|
||||
/* Calculate the external display position based on MDP scaling mode,
|
||||
// update source crop and destination position of AIV video layer.
|
||||
if(ctx->mAIVVideoMode[dpy] && isYuvBuffer(hnd)) {
|
||||
updateExtDisplayCoordinates(ctx, crop, dst, dpy);
|
||||
}
|
||||
|
||||
/* Calculate the external display position based on MDP downscale,
|
||||
ActionSafe, and extorientation features. */
|
||||
calcExtDisplayPosition(ctx, hnd, dpy, crop, dst, transform, orient);
|
||||
int downscale = getRotDownscale(ctx, layer);
|
||||
@@ -2087,6 +2166,11 @@ int configureSourceSplit(hwc_context_t *ctx, hwc_layer_1_t *layer,
|
||||
Whf whf(getWidth(hnd), getHeight(hnd),
|
||||
getMdpFormat(hnd->format), (uint32_t)hnd->size);
|
||||
|
||||
// update source crop and destination position of AIV video layer.
|
||||
if(ctx->mAIVVideoMode[dpy] && isYuvBuffer(hnd)) {
|
||||
updateExtDisplayCoordinates(ctx, crop, dst, dpy);
|
||||
}
|
||||
|
||||
/* Calculate the external display position based on MDP downscale,
|
||||
ActionSafe, and extorientation features. */
|
||||
calcExtDisplayPosition(ctx, hnd, dpy, crop, dst, transform, orient);
|
||||
|
||||
Reference in New Issue
Block a user