Merge "hwc: Disable MDPComp for external UI layers if scaling is present."

This commit is contained in:
Linux Build Service Account
2014-01-09 06:23:22 -08:00
committed by Gerrit - the friendly Code Review server
3 changed files with 44 additions and 16 deletions

View File

@@ -541,6 +541,13 @@ bool MDPComp::tryFullFrame(hwc_context_t *ctx,
return false; return false;
} }
// check for action safe flag and downscale mode which requires scaling.
if(ctx->dpyAttr[mDpy].mActionSafePresent
|| ctx->dpyAttr[mDpy].mDownScaleMode) {
ALOGD_IF(isDebug(), "%s: Scaling needed for this frame",__FUNCTION__);
return false;
}
for(int i = 0; i < numAppLayers; ++i) { for(int i = 0; i < numAppLayers; ++i) {
hwc_layer_1_t* layer = &list->hwLayers[i]; hwc_layer_1_t* layer = &list->hwLayers[i];
private_handle_t *hnd = (private_handle_t *)layer->handle; private_handle_t *hnd = (private_handle_t *)layer->handle;

View File

@@ -175,6 +175,9 @@ void initContext(hwc_context_t *ctx)
ctx->mHwcDebug[i] = new HwcDebug(i); ctx->mHwcDebug[i] = new HwcDebug(i);
ctx->mLayerRotMap[i] = new LayerRotMap(); ctx->mLayerRotMap[i] = new LayerRotMap();
ctx->mAnimationState[i] = ANIMATION_STOPPED; ctx->mAnimationState[i] = ANIMATION_STOPPED;
ctx->dpyAttr[i].mActionSafePresent = false;
ctx->dpyAttr[i].mAsWidthRatio = 0;
ctx->dpyAttr[i].mAsHeightRatio = 0;
} }
MDPComp::init(ctx); MDPComp::init(ctx);
@@ -287,22 +290,11 @@ void getActionSafePosition(hwc_context_t *ctx, int dpy, hwc_rect_t& rect) {
int w = rect.right - rect.left; int w = rect.right - rect.left;
int h = rect.bottom - rect.top; int h = rect.bottom - rect.top;
// if external supports underscan, do nothing if(!ctx->dpyAttr[dpy].mActionSafePresent)
// it will be taken care in the driver
if(ctx->mExtDisplay->isCEUnderscanSupported())
return; return;
// Read action safe properties
char value[PROPERTY_VALUE_MAX]; int asWidthRatio = ctx->dpyAttr[dpy].mAsWidthRatio;
// Read action safe properties int asHeightRatio = ctx->dpyAttr[dpy].mAsHeightRatio;
property_get("persist.sys.actionsafe.width", value, "0");
int asWidthRatio = atoi(value);
property_get("persist.sys.actionsafe.height", value, "0");
int asHeightRatio = atoi(value);
if(!asWidthRatio && !asHeightRatio) {
//No action safe ratio set, return
return;
}
float wRatio = 1.0; float wRatio = 1.0;
float hRatio = 1.0; float hRatio = 1.0;
@@ -628,7 +620,6 @@ bool isDownscaleRequired(hwc_layer_1_t const* layer) {
} }
bool needsScaling(hwc_layer_1_t const* layer) { bool needsScaling(hwc_layer_1_t const* layer) {
int dst_w, dst_h, src_w, src_h; int dst_w, dst_h, src_w, src_h;
hwc_rect_t displayFrame = layer->displayFrame; hwc_rect_t displayFrame = layer->displayFrame;
hwc_rect_t sourceCrop = integerizeSourceCrop(layer->sourceCropf); hwc_rect_t sourceCrop = integerizeSourceCrop(layer->sourceCropf);
@@ -765,6 +756,7 @@ void setListStats(hwc_context_t *ctx,
ctx->listStats[dpy].secureUI = false; ctx->listStats[dpy].secureUI = false;
ctx->listStats[dpy].yuv4k2kCount = 0; ctx->listStats[dpy].yuv4k2kCount = 0;
ctx->mViewFrame[dpy] = (hwc_rect_t){0, 0, 0, 0}; ctx->mViewFrame[dpy] = (hwc_rect_t){0, 0, 0, 0};
ctx->dpyAttr[dpy].mActionSafePresent = isActionSafePresent(ctx, dpy);
trimList(ctx, list, dpy); trimList(ctx, list, dpy);
optimizeLayerRects(ctx, list, dpy); optimizeLayerRects(ctx, list, dpy);
@@ -922,6 +914,27 @@ bool isSecureModePolicy(int mdpVersion) {
return false; return false;
} }
// returns true if Action safe dimensions are set and target supports Actionsafe
bool isActionSafePresent(hwc_context_t *ctx, int dpy) {
// if external supports underscan, do nothing
// it will be taken care in the driver
if(!dpy || ctx->mExtDisplay->isCEUnderscanSupported())
return false;
char value[PROPERTY_VALUE_MAX];
// Read action safe properties
property_get("persist.sys.actionsafe.width", value, "0");
ctx->dpyAttr[dpy].mAsWidthRatio = atoi(value);
property_get("persist.sys.actionsafe.height", value, "0");
ctx->dpyAttr[dpy].mAsHeightRatio = atoi(value);
if(!ctx->dpyAttr[dpy].mAsWidthRatio && !ctx->dpyAttr[dpy].mAsHeightRatio) {
//No action safe ratio set, return
return false;
}
return true;
}
int getBlending(int blending) { int getBlending(int blending) {
switch(blending) { switch(blending) {
case HWC_BLENDING_NONE: case HWC_BLENDING_NONE:

View File

@@ -89,6 +89,11 @@ struct DisplayAttributes {
bool mDownScaleMode; bool mDownScaleMode;
// Ext dst Rect // Ext dst Rect
hwc_rect_t mDstRect; hwc_rect_t mDstRect;
//Action safe attributes
// Flag to indicate the presence of action safe dimensions for external
bool mActionSafePresent;
int mAsWidthRatio;
int mAsHeightRatio;
}; };
struct ListStats { struct ListStats {
@@ -230,6 +235,9 @@ void optimizeLayerRects(hwc_context_t *ctx,
bool areLayersIntersecting(const hwc_layer_1_t* layer1, bool areLayersIntersecting(const hwc_layer_1_t* layer1,
const hwc_layer_1_t* layer2); const hwc_layer_1_t* layer2);
// returns true if Action safe dimensions are set and target supports Actionsafe
bool isActionSafePresent(hwc_context_t *ctx, int dpy);
/* Calculates the destination position based on the action safe rectangle */ /* Calculates the destination position based on the action safe rectangle */
void getActionSafePosition(hwc_context_t *ctx, int dpy, hwc_rect_t& dst); void getActionSafePosition(hwc_context_t *ctx, int dpy, hwc_rect_t& dst);