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"
|
#include "profiler.h"
|
||||||
|
|
||||||
using namespace qhwc;
|
using namespace qhwc;
|
||||||
|
using namespace overlay;
|
||||||
|
|
||||||
#define VSYNC_DEBUG 0
|
#define VSYNC_DEBUG 0
|
||||||
#define BLANK_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->mOverlay->configBegin();
|
||||||
ctx->mRotMgr->configBegin();
|
ctx->mRotMgr->configBegin();
|
||||||
ctx->mNeedsRotator = false;
|
Overlay::setDMAMode(Overlay::DMA_LINE_MODE);
|
||||||
|
|
||||||
for (int32_t i = numDisplays; i >= 0; i--) {
|
for (int32_t i = numDisplays; i >= 0; i--) {
|
||||||
hwc_display_contents_1_t *list = displays[i];
|
hwc_display_contents_1_t *list = displays[i];
|
||||||
|
|||||||
@@ -23,7 +23,7 @@
|
|||||||
#include "mdp_version.h"
|
#include "mdp_version.h"
|
||||||
#include <overlayRotator.h>
|
#include <overlayRotator.h>
|
||||||
|
|
||||||
using overlay::Rotator;
|
using namespace overlay;
|
||||||
using namespace overlay::utils;
|
using namespace overlay::utils;
|
||||||
namespace ovutils = overlay::utils;
|
namespace ovutils = overlay::utils;
|
||||||
|
|
||||||
@@ -103,9 +103,10 @@ bool MDPComp::init(hwc_context_t *ctx) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
sMaxPipesPerMixer = MAX_PIPES_PER_MIXER;
|
sMaxPipesPerMixer = MAX_PIPES_PER_MIXER;
|
||||||
if(property_get("debug.mdpcomp.maxpermixer", property, NULL) > 0) {
|
if(property_get("debug.mdpcomp.maxpermixer", property, "-1") > 0) {
|
||||||
if(atoi(property) != 0)
|
int val = atoi(property);
|
||||||
sMaxPipesPerMixer = true;
|
if(val >= 0)
|
||||||
|
sMaxPipesPerMixer = min(val, MAX_PIPES_PER_MIXER);
|
||||||
}
|
}
|
||||||
|
|
||||||
unsigned long idle_timeout = DEFAULT_IDLE_TIME;
|
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:
|
case MDPCOMP_OV_DMA:
|
||||||
mdp_pipe = ov.nextPipe(ovutils::OV_MDP_PIPE_DMA, mDpy);
|
mdp_pipe = ov.nextPipe(ovutils::OV_MDP_PIPE_DMA, mDpy);
|
||||||
if(mdp_pipe != ovutils::OV_INVALID) {
|
if(mdp_pipe != ovutils::OV_INVALID) {
|
||||||
ctx->mDMAInUse = true;
|
|
||||||
return mdp_pipe;
|
return mdp_pipe;
|
||||||
}
|
}
|
||||||
case MDPCOMP_OV_ANY:
|
case MDPCOMP_OV_ANY:
|
||||||
@@ -350,7 +350,7 @@ bool MDPComp::isFullFrameDoable(hwc_context_t *ctx,
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(mdpCount > (sMaxPipesPerMixer-fbNeeded)) {
|
if(mdpCount > (sMaxPipesPerMixer - fbNeeded)) {
|
||||||
ALOGD_IF(isDebug(), "%s: Exceeds MAX_PIPES_PER_MIXER",__FUNCTION__);
|
ALOGD_IF(isDebug(), "%s: Exceeds MAX_PIPES_PER_MIXER",__FUNCTION__);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@@ -400,11 +400,6 @@ bool MDPComp::isYUVDoable(hwc_context_t* ctx, hwc_layer_1_t* layer) {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(ctx->mNeedsRotator && ctx->mDMAInUse) {
|
|
||||||
ALOGE("%s: No DMA for Rotator",__FUNCTION__);
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
if(isSecuring(ctx, layer)) {
|
if(isSecuring(ctx, layer)) {
|
||||||
ALOGD_IF(isDebug(), "%s: MDP securing is active", __FUNCTION__);
|
ALOGD_IF(isDebug(), "%s: MDP securing is active", __FUNCTION__);
|
||||||
return false;
|
return false;
|
||||||
@@ -468,6 +463,7 @@ void MDPComp::batchLayers() {
|
|||||||
ALOGD_IF(isDebug(),"%s: cached count: %d",__FUNCTION__,
|
ALOGD_IF(isDebug(),"%s: cached count: %d",__FUNCTION__,
|
||||||
mCurrentFrame.fbCount);
|
mCurrentFrame.fbCount);
|
||||||
}
|
}
|
||||||
|
|
||||||
void MDPComp::updateLayerCache(hwc_context_t* ctx,
|
void MDPComp::updateLayerCache(hwc_context_t* ctx,
|
||||||
hwc_display_contents_1_t* list) {
|
hwc_display_contents_1_t* list) {
|
||||||
|
|
||||||
@@ -501,7 +497,7 @@ int MDPComp::getAvailablePipes(hwc_context_t* ctx) {
|
|||||||
int numAvailable = ov.availablePipes(mDpy);
|
int numAvailable = ov.availablePipes(mDpy);
|
||||||
|
|
||||||
//Reserve DMA for rotator
|
//Reserve DMA for rotator
|
||||||
if(ctx->mNeedsRotator)
|
if(Overlay::getDMAMode() == Overlay::DMA_BLOCK_MODE)
|
||||||
numAvailable -= numDMAPipes;
|
numAvailable -= numDMAPipes;
|
||||||
|
|
||||||
//Reserve pipe(s)for FB
|
//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 MDPComp::programMDP(hwc_context_t *ctx, hwc_display_contents_1_t* list) {
|
||||||
int fbZOrder = -1;
|
int fbZOrder = -1;
|
||||||
ctx->mDMAInUse = false;
|
|
||||||
|
|
||||||
if(!allocLayerPipes(ctx, list)) {
|
if(!allocLayerPipes(ctx, list)) {
|
||||||
ALOGD_IF(isDebug(), "%s: Unable to allocate MDP pipes", __FUNCTION__);
|
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;
|
ePipeType type = MDPCOMP_OV_ANY;
|
||||||
|
|
||||||
if(!qhwc::needsScaling(layer) && !ctx->mNeedsRotator
|
if(!qhwc::needsScaling(layer)
|
||||||
&& ctx->mMDP.version >= qdutils::MDSS_V5) {
|
&& Overlay::getDMAMode() != Overlay::DMA_BLOCK_MODE
|
||||||
|
&& ctx->mMDP.version >= qdutils::MDSS_V5) {
|
||||||
type = MDPCOMP_OV_DMA;
|
type = MDPCOMP_OV_DMA;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -889,8 +885,9 @@ bool MDPCompHighRes::allocLayerPipes(hwc_context_t *ctx,
|
|||||||
|
|
||||||
ePipeType type = MDPCOMP_OV_ANY;
|
ePipeType type = MDPCOMP_OV_ANY;
|
||||||
|
|
||||||
if(!qhwc::needsScaling(layer) && !ctx->mNeedsRotator
|
if(!qhwc::needsScaling(layer)
|
||||||
&& ctx->mMDP.version >= qdutils::MDSS_V5)
|
&& Overlay::getDMAMode() != Overlay::DMA_BLOCK_MODE
|
||||||
|
&& ctx->mMDP.version >= qdutils::MDSS_V5)
|
||||||
type = MDPCOMP_OV_DMA;
|
type = MDPCOMP_OV_DMA;
|
||||||
|
|
||||||
if(!acquireMDPPipes(ctx, layer, pipe_info, type)) {
|
if(!acquireMDPPipes(ctx, layer, pipe_info, type)) {
|
||||||
|
|||||||
@@ -332,8 +332,9 @@ void setListStats(hwc_context_t *ctx,
|
|||||||
ctx->listStats[dpy].yuvIndices[yuvCount] = i;
|
ctx->listStats[dpy].yuvIndices[yuvCount] = i;
|
||||||
yuvCount++;
|
yuvCount++;
|
||||||
|
|
||||||
if(layer->transform & HWC_TRANSFORM_ROT_90)
|
if(layer->transform & HWC_TRANSFORM_ROT_90) {
|
||||||
ctx->mNeedsRotator = true;
|
Overlay::setDMAMode(Overlay::DMA_BLOCK_MODE);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if(layer->blending == HWC_BLENDING_PREMULT)
|
if(layer->blending == HWC_BLENDING_PREMULT)
|
||||||
ctx->listStats[dpy].preMultipliedAlpha = true;
|
ctx->listStats[dpy].preMultipliedAlpha = true;
|
||||||
|
|||||||
@@ -274,10 +274,6 @@ struct hwc_context_t {
|
|||||||
mutable Locker mExtSetLock;
|
mutable Locker mExtSetLock;
|
||||||
//Vsync
|
//Vsync
|
||||||
struct vsync_state vstate;
|
struct vsync_state vstate;
|
||||||
//DMA used for rotator
|
|
||||||
bool mDMAInUse;
|
|
||||||
//MDP rotater needed
|
|
||||||
bool mNeedsRotator;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
namespace qhwc {
|
namespace qhwc {
|
||||||
|
|||||||
@@ -92,6 +92,11 @@ eDest Overlay::nextPipe(eMdpPipeType type, int dpy) {
|
|||||||
if((mPipeBook[i].mDisplay == PipeBook::DPY_UNUSED ||
|
if((mPipeBook[i].mDisplay == PipeBook::DPY_UNUSED ||
|
||||||
mPipeBook[i].mDisplay == dpy) &&
|
mPipeBook[i].mDisplay == dpy) &&
|
||||||
PipeBook::isNotAllocated(i)) {
|
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;
|
dest = (eDest)i;
|
||||||
PipeBook::setAllocation(i);
|
PipeBook::setAllocation(i);
|
||||||
break;
|
break;
|
||||||
@@ -311,6 +316,7 @@ void Overlay::PipeBook::destroy() {
|
|||||||
|
|
||||||
Overlay* Overlay::sInstance = 0;
|
Overlay* Overlay::sInstance = 0;
|
||||||
int Overlay::sExtFbIndex = 1;
|
int Overlay::sExtFbIndex = 1;
|
||||||
|
int Overlay::sDMAMode = DMA_LINE_MODE;
|
||||||
int Overlay::PipeBook::NUM_PIPES = 0;
|
int Overlay::PipeBook::NUM_PIPES = 0;
|
||||||
int Overlay::PipeBook::sPipeUsageBitmap = 0;
|
int Overlay::PipeBook::sPipeUsageBitmap = 0;
|
||||||
int Overlay::PipeBook::sLastUsageBitmap = 0;
|
int Overlay::PipeBook::sLastUsageBitmap = 0;
|
||||||
|
|||||||
@@ -40,6 +40,8 @@ class GenericPipe;
|
|||||||
|
|
||||||
class Overlay : utils::NoCopy {
|
class Overlay : utils::NoCopy {
|
||||||
public:
|
public:
|
||||||
|
enum { DMA_BLOCK_MODE, DMA_LINE_MODE };
|
||||||
|
|
||||||
/* dtor close */
|
/* dtor close */
|
||||||
~Overlay();
|
~Overlay();
|
||||||
|
|
||||||
@@ -84,6 +86,8 @@ public:
|
|||||||
* to populate.
|
* to populate.
|
||||||
*/
|
*/
|
||||||
void getDump(char *buf, size_t len);
|
void getDump(char *buf, size_t len);
|
||||||
|
static void setDMAMode(const int& mode);
|
||||||
|
static int getDMAMode();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
/* Ctor setup */
|
/* Ctor setup */
|
||||||
@@ -148,6 +152,7 @@ private:
|
|||||||
/* Singleton Instance*/
|
/* Singleton Instance*/
|
||||||
static Overlay *sInstance;
|
static Overlay *sInstance;
|
||||||
static int sExtFbIndex;
|
static int sExtFbIndex;
|
||||||
|
static int sDMAMode;
|
||||||
};
|
};
|
||||||
|
|
||||||
inline void Overlay::validate(int index) {
|
inline void Overlay::validate(int index) {
|
||||||
@@ -176,6 +181,15 @@ inline int Overlay::getExtFbNum() {
|
|||||||
return sExtFbIndex;
|
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() {
|
inline bool Overlay::PipeBook::valid() {
|
||||||
return (mPipe != NULL);
|
return (mPipe != NULL);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user