Merge "hwc: Add BWC policy manager"

This commit is contained in:
Linux Build Service Account
2013-06-01 06:06:56 -07:00
committed by Gerrit - the friendly Code Review server
5 changed files with 74 additions and 18 deletions

View File

@@ -733,12 +733,6 @@ void setMdpFlags(hwc_layer_1_t *layer,
if(transform & HWC_TRANSFORM_ROT_90) {
ovutils::setMdpFlags(mdpFlags,
ovutils::OV_MDP_SOURCE_ROTATED_90);
// enable bandwidth compression only if src width < 2048
if(qdutils::MDPVersion::getInstance().supportsBWC() &&
hnd->width < qdutils::MAX_DISPLAY_DIM) {
ovutils::setMdpFlags(mdpFlags,
ovutils::OV_MDSS_MDP_BWC_EN);
}
}
}
@@ -920,6 +914,7 @@ int configureLowRes(hwc_context_t *ctx, hwc_layer_1_t *layer,
((transform & HWC_TRANSFORM_ROT_90) || downscale)) {
*rot = ctx->mRotMgr->getNext();
if(*rot == NULL) return -1;
BwcPM::setBwc(ctx, crop, dst, transform, mdpFlags);
//Configure rotator for pre-rotation
if(configRotator(*rot, whf, crop, mdpFlags, orient, downscale) < 0) {
ALOGE("%s: configRotator failed!", __FUNCTION__);
@@ -1087,4 +1082,43 @@ bool canUseRotator(hwc_context_t *ctx) {
return true;
}
void BwcPM::setBwc(hwc_context_t *ctx, const hwc_rect_t& crop,
const hwc_rect_t& dst, const int& transform,
ovutils::eMdpFlags& mdpFlags) {
//Target doesnt support Bwc
if(!qdutils::MDPVersion::getInstance().supportsBWC()) {
return;
}
//src width > MAX mixer supported dim
if((crop.right - crop.left) > qdutils::MAX_DISPLAY_DIM) {
return;
}
//External connected
if(ctx->mExtDisplay->isExternalConnected()) {
return;
}
//Decimation necessary, cannot use BWC. H/W requirement.
if(qdutils::MDPVersion::getInstance().supportsDecimation()) {
int src_w = crop.right - crop.left;
int src_h = crop.bottom - crop.top;
int dst_w = dst.right - dst.left;
int dst_h = dst.bottom - dst.top;
if(transform & HAL_TRANSFORM_ROT_90) {
swap(src_w, src_h);
}
float horDscale = 0.0f;
float verDscale = 0.0f;
ovutils::getDecimationFactor(src_w, src_h, dst_w, dst_h, horDscale,
verDscale);
if(horDscale || verDscale) return;
}
//Property
char value[PROPERTY_VALUE_MAX];
property_get("debug.disable.bwc", value, "0");
if(atoi(value)) return;
ovutils::setMdpFlags(mdpFlags, ovutils::OV_MDSS_MDP_BWC_EN);
}
};//namespace qhwc