hwc: Move resource checks to a common function.
Move resource checks, pipes, stages of mixer, bandwidth to a common function and use it from all strategies. Change-Id: I161fc957e2793d543b5943fbd23ae3607a4cfc87
This commit is contained in:
@@ -591,18 +591,8 @@ bool MDPComp::fullMDPComp(hwc_context_t *ctx, hwc_display_contents_1_t* list) {
|
||||
mCurrentFrame.mdpCount = mCurrentFrame.layerCount - mCurrentFrame.fbCount -
|
||||
mCurrentFrame.dropCount;
|
||||
|
||||
if(mCurrentFrame.mdpCount > sMaxPipesPerMixer) {
|
||||
ALOGD_IF(isDebug(), "%s: Exceeds MAX_PIPES_PER_MIXER",__FUNCTION__);
|
||||
return false;
|
||||
}
|
||||
|
||||
if(!arePipesAvailable(ctx, list)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
uint32_t size = calcMDPBytesRead(ctx, list);
|
||||
if(!bandwidthCheck(ctx, size)) {
|
||||
ALOGD_IF(isDebug(), "%s: Exceeds bandwidth",__FUNCTION__);
|
||||
if(!resourceCheck(ctx, list)) {
|
||||
ALOGD_IF(isDebug(), "%s: resource check failed", __FUNCTION__);
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -662,18 +652,8 @@ bool MDPComp::cacheBasedComp(hwc_context_t *ctx,
|
||||
return false;
|
||||
}
|
||||
|
||||
if(mdpCount > (sMaxPipesPerMixer - 1)) { // -1 since FB is used
|
||||
ALOGD_IF(isDebug(), "%s: Exceeds MAX_PIPES_PER_MIXER",__FUNCTION__);
|
||||
return false;
|
||||
}
|
||||
|
||||
if(!arePipesAvailable(ctx, list)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
uint32_t size = calcMDPBytesRead(ctx, list);
|
||||
if(!bandwidthCheck(ctx, size)) {
|
||||
ALOGD_IF(isDebug(), "%s: Exceeds bandwidth",__FUNCTION__);
|
||||
if(!resourceCheck(ctx, list)) {
|
||||
ALOGD_IF(isDebug(), "%s: resource check failed", __FUNCTION__);
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -733,7 +713,8 @@ bool MDPComp::loadBasedComp(hwc_context_t *ctx,
|
||||
mCurrentFrame.fbCount = batchSize;
|
||||
mCurrentFrame.mdpCount = mCurrentFrame.layerCount - batchSize;
|
||||
|
||||
if(!arePipesAvailable(ctx, list)) {
|
||||
if(!resourceCheck(ctx, list)) {
|
||||
ALOGD_IF(isDebug(), "%s: resource check failed", __FUNCTION__);
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -773,18 +754,8 @@ bool MDPComp::isOnlyVideoDoable(hwc_context_t *ctx,
|
||||
if(!mdpCount)
|
||||
return false;
|
||||
|
||||
if(mdpCount > (sMaxPipesPerMixer - fbNeeded)) {
|
||||
ALOGD_IF(isDebug(), "%s: Exceeds MAX_PIPES_PER_MIXER",__FUNCTION__);
|
||||
return false;
|
||||
}
|
||||
|
||||
if(!arePipesAvailable(ctx, list)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
uint32_t size = calcMDPBytesRead(ctx, list);
|
||||
if(!bandwidthCheck(ctx, size)) {
|
||||
ALOGD_IF(isDebug(), "%s: Exceeds bandwidth",__FUNCTION__);
|
||||
if(!resourceCheck(ctx, list)) {
|
||||
ALOGD_IF(isDebug(), "%s: resource check failed", __FUNCTION__);
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -1108,6 +1079,27 @@ bool MDPComp::programYUV(hwc_context_t *ctx, hwc_display_contents_1_t* list) {
|
||||
return true;
|
||||
}
|
||||
|
||||
bool MDPComp::resourceCheck(hwc_context_t *ctx,
|
||||
hwc_display_contents_1_t *list) {
|
||||
const bool fbUsed = mCurrentFrame.fbCount;
|
||||
if(mCurrentFrame.mdpCount > sMaxPipesPerMixer - fbUsed) {
|
||||
ALOGD_IF(isDebug(), "%s: Exceeds MAX_PIPES_PER_MIXER",__FUNCTION__);
|
||||
return false;
|
||||
}
|
||||
|
||||
if(!arePipesAvailable(ctx, list)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
uint32_t size = calcMDPBytesRead(ctx, list);
|
||||
if(!bandwidthCheck(ctx, size)) {
|
||||
ALOGD_IF(isDebug(), "%s: Exceeds bandwidth",__FUNCTION__);
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
uint32_t MDPComp::calcMDPBytesRead(hwc_context_t *ctx,
|
||||
hwc_display_contents_1_t* list) {
|
||||
uint32_t size = 0;
|
||||
|
||||
@@ -192,6 +192,7 @@ protected:
|
||||
bool programYUV(hwc_context_t *ctx, hwc_display_contents_1_t* list);
|
||||
void reset(const int& numAppLayers, hwc_display_contents_1_t* list);
|
||||
bool isSupportedForMDPComp(hwc_context_t *ctx, hwc_layer_1_t* layer);
|
||||
bool resourceCheck(hwc_context_t *ctx, hwc_display_contents_1_t *list);
|
||||
|
||||
int mDpy;
|
||||
static bool sEnabled;
|
||||
|
||||
Reference in New Issue
Block a user