hwc/overlay: Fix dma mode design and issues.
Add support for tracking the mode in which DMA is being used in overlay.
Remove unnecessary tracking variables, and their set,reset inconsistency.
With such varibles in hwc, it still leads to overlay giving out DMA pipes.
Make overlay as the single tracking place.
Change-Id: Ib949f3d0ef5918ef323c81cb1768b68a68c83da4
diff --git a/libhwcomposer/hwc_mdpcomp.cpp b/libhwcomposer/hwc_mdpcomp.cpp
index 30178a0..2323030 100644
--- a/libhwcomposer/hwc_mdpcomp.cpp
+++ b/libhwcomposer/hwc_mdpcomp.cpp
@@ -23,7 +23,7 @@
#include "mdp_version.h"
#include <overlayRotator.h>
-using overlay::Rotator;
+using namespace overlay;
using namespace overlay::utils;
namespace ovutils = overlay::utils;
@@ -103,9 +103,10 @@
}
sMaxPipesPerMixer = MAX_PIPES_PER_MIXER;
- if(property_get("debug.mdpcomp.maxpermixer", property, NULL) > 0) {
- if(atoi(property) != 0)
- sMaxPipesPerMixer = true;
+ if(property_get("debug.mdpcomp.maxpermixer", property, "-1") > 0) {
+ int val = atoi(property);
+ if(val >= 0)
+ sMaxPipesPerMixer = min(val, MAX_PIPES_PER_MIXER);
}
unsigned long idle_timeout = DEFAULT_IDLE_TIME;
@@ -289,7 +290,6 @@
case MDPCOMP_OV_DMA:
mdp_pipe = ov.nextPipe(ovutils::OV_MDP_PIPE_DMA, mDpy);
if(mdp_pipe != ovutils::OV_INVALID) {
- ctx->mDMAInUse = true;
return mdp_pipe;
}
case MDPCOMP_OV_ANY:
@@ -350,7 +350,7 @@
return false;
}
- if(mdpCount > (sMaxPipesPerMixer-fbNeeded)) {
+ if(mdpCount > (sMaxPipesPerMixer - fbNeeded)) {
ALOGD_IF(isDebug(), "%s: Exceeds MAX_PIPES_PER_MIXER",__FUNCTION__);
return false;
}
@@ -400,11 +400,6 @@
return false;
}
- if(ctx->mNeedsRotator && ctx->mDMAInUse) {
- ALOGE("%s: No DMA for Rotator",__FUNCTION__);
- return false;
- }
-
if(isSecuring(ctx, layer)) {
ALOGD_IF(isDebug(), "%s: MDP securing is active", __FUNCTION__);
return false;
@@ -468,6 +463,7 @@
ALOGD_IF(isDebug(),"%s: cached count: %d",__FUNCTION__,
mCurrentFrame.fbCount);
}
+
void MDPComp::updateLayerCache(hwc_context_t* ctx,
hwc_display_contents_1_t* list) {
@@ -501,7 +497,7 @@
int numAvailable = ov.availablePipes(mDpy);
//Reserve DMA for rotator
- if(ctx->mNeedsRotator)
+ if(Overlay::getDMAMode() == Overlay::DMA_BLOCK_MODE)
numAvailable -= numDMAPipes;
//Reserve pipe(s)for FB
@@ -544,7 +540,6 @@
int MDPComp::programMDP(hwc_context_t *ctx, hwc_display_contents_1_t* list) {
int fbZOrder = -1;
- ctx->mDMAInUse = false;
if(!allocLayerPipes(ctx, list)) {
ALOGD_IF(isDebug(), "%s: Unable to allocate MDP pipes", __FUNCTION__);
@@ -718,8 +713,9 @@
ePipeType type = MDPCOMP_OV_ANY;
- if(!qhwc::needsScaling(layer) && !ctx->mNeedsRotator
- && ctx->mMDP.version >= qdutils::MDSS_V5) {
+ if(!qhwc::needsScaling(layer)
+ && Overlay::getDMAMode() != Overlay::DMA_BLOCK_MODE
+ && ctx->mMDP.version >= qdutils::MDSS_V5) {
type = MDPCOMP_OV_DMA;
}
@@ -889,8 +885,9 @@
ePipeType type = MDPCOMP_OV_ANY;
- if(!qhwc::needsScaling(layer) && !ctx->mNeedsRotator
- && ctx->mMDP.version >= qdutils::MDSS_V5)
+ if(!qhwc::needsScaling(layer)
+ && Overlay::getDMAMode() != Overlay::DMA_BLOCK_MODE
+ && ctx->mMDP.version >= qdutils::MDSS_V5)
type = MDPCOMP_OV_DMA;
if(!acquireMDPPipes(ctx, layer, pipe_info, type)) {