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
This commit is contained in:
@@ -38,6 +38,8 @@
|
||||
#include "profiler.h"
|
||||
|
||||
using namespace qhwc;
|
||||
using namespace overlay;
|
||||
|
||||
#define VSYNC_DEBUG 0
|
||||
#define BLANK_DEBUG 0
|
||||
|
||||
@@ -200,7 +202,7 @@ static int hwc_prepare(hwc_composer_device_1 *dev, size_t numDisplays,
|
||||
|
||||
ctx->mOverlay->configBegin();
|
||||
ctx->mRotMgr->configBegin();
|
||||
ctx->mNeedsRotator = false;
|
||||
Overlay::setDMAMode(Overlay::DMA_LINE_MODE);
|
||||
|
||||
for (int32_t i = numDisplays; i >= 0; i--) {
|
||||
hwc_display_contents_1_t *list = displays[i];
|
||||
|
||||
@@ -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 @@ bool MDPComp::init(hwc_context_t *ctx) {
|
||||
}
|
||||
|
||||
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 @@ ovutils::eDest MDPComp::getMdpPipe(hwc_context_t *ctx, ePipeType type) {
|
||||
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 @@ bool MDPComp::isFullFrameDoable(hwc_context_t *ctx,
|
||||
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 @@ bool MDPComp::isYUVDoable(hwc_context_t* ctx, hwc_layer_1_t* layer) {
|
||||
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 @@ void MDPComp::batchLayers() {
|
||||
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 MDPComp::getAvailablePipes(hwc_context_t* ctx) {
|
||||
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 @@ void MDPComp::updateYUV(hwc_context_t* ctx, hwc_display_contents_1_t* list) {
|
||||
|
||||
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 @@ bool MDPCompLowRes::allocLayerPipes(hwc_context_t *ctx,
|
||||
|
||||
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 @@ bool MDPCompHighRes::allocLayerPipes(hwc_context_t *ctx,
|
||||
|
||||
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)) {
|
||||
|
||||
@@ -332,8 +332,9 @@ void setListStats(hwc_context_t *ctx,
|
||||
ctx->listStats[dpy].yuvIndices[yuvCount] = i;
|
||||
yuvCount++;
|
||||
|
||||
if(layer->transform & HWC_TRANSFORM_ROT_90)
|
||||
ctx->mNeedsRotator = true;
|
||||
if(layer->transform & HWC_TRANSFORM_ROT_90) {
|
||||
Overlay::setDMAMode(Overlay::DMA_BLOCK_MODE);
|
||||
}
|
||||
}
|
||||
if(layer->blending == HWC_BLENDING_PREMULT)
|
||||
ctx->listStats[dpy].preMultipliedAlpha = true;
|
||||
|
||||
@@ -274,10 +274,6 @@ struct hwc_context_t {
|
||||
mutable Locker mExtSetLock;
|
||||
//Vsync
|
||||
struct vsync_state vstate;
|
||||
//DMA used for rotator
|
||||
bool mDMAInUse;
|
||||
//MDP rotater needed
|
||||
bool mNeedsRotator;
|
||||
};
|
||||
|
||||
namespace qhwc {
|
||||
|
||||
@@ -92,6 +92,11 @@ eDest Overlay::nextPipe(eMdpPipeType type, int dpy) {
|
||||
if((mPipeBook[i].mDisplay == PipeBook::DPY_UNUSED ||
|
||||
mPipeBook[i].mDisplay == dpy) &&
|
||||
PipeBook::isNotAllocated(i)) {
|
||||
//In block mode we don't allow line operations
|
||||
if(sDMAMode == DMA_BLOCK_MODE &&
|
||||
PipeBook::getPipeType((eDest)i) == OV_MDP_PIPE_DMA)
|
||||
continue;
|
||||
|
||||
dest = (eDest)i;
|
||||
PipeBook::setAllocation(i);
|
||||
break;
|
||||
@@ -311,6 +316,7 @@ void Overlay::PipeBook::destroy() {
|
||||
|
||||
Overlay* Overlay::sInstance = 0;
|
||||
int Overlay::sExtFbIndex = 1;
|
||||
int Overlay::sDMAMode = DMA_LINE_MODE;
|
||||
int Overlay::PipeBook::NUM_PIPES = 0;
|
||||
int Overlay::PipeBook::sPipeUsageBitmap = 0;
|
||||
int Overlay::PipeBook::sLastUsageBitmap = 0;
|
||||
|
||||
@@ -40,6 +40,8 @@ class GenericPipe;
|
||||
|
||||
class Overlay : utils::NoCopy {
|
||||
public:
|
||||
enum { DMA_BLOCK_MODE, DMA_LINE_MODE };
|
||||
|
||||
/* dtor close */
|
||||
~Overlay();
|
||||
|
||||
@@ -84,6 +86,8 @@ public:
|
||||
* to populate.
|
||||
*/
|
||||
void getDump(char *buf, size_t len);
|
||||
static void setDMAMode(const int& mode);
|
||||
static int getDMAMode();
|
||||
|
||||
private:
|
||||
/* Ctor setup */
|
||||
@@ -148,6 +152,7 @@ private:
|
||||
/* Singleton Instance*/
|
||||
static Overlay *sInstance;
|
||||
static int sExtFbIndex;
|
||||
static int sDMAMode;
|
||||
};
|
||||
|
||||
inline void Overlay::validate(int index) {
|
||||
@@ -176,6 +181,15 @@ inline int Overlay::getExtFbNum() {
|
||||
return sExtFbIndex;
|
||||
}
|
||||
|
||||
inline void Overlay::setDMAMode(const int& mode) {
|
||||
if(mode == DMA_LINE_MODE || mode == DMA_BLOCK_MODE)
|
||||
sDMAMode = mode;
|
||||
}
|
||||
|
||||
inline int Overlay::getDMAMode() {
|
||||
return sDMAMode;
|
||||
}
|
||||
|
||||
inline bool Overlay::PipeBook::valid() {
|
||||
return (mPipe != NULL);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user