Limit #ROT-SESSIONS to 4 in LayerRotMap and RotMgr

* Limit the number of rotator sessions to 4 both in
LayerRotMap and RotMgr structures

* Make use of MDPVersion getter fuctions to check
for maxMixerWidth and maxDownScale supported by MDP

Change-Id: I27dac877807fbb4ed6fcb3500a3a318a2ef5d8b2
This commit is contained in:
Raj Kamal
2014-08-04 14:43:24 +05:30
committed by Praveena Pachipulusu
parent 1c47cede92
commit 389d6e33d3
8 changed files with 32 additions and 29 deletions

View File

@@ -45,7 +45,7 @@ bool MDPComp::sEnabled = false;
bool MDPComp::sEnableMixedMode = true;
int MDPComp::sSimulationFlags = 0;
int MDPComp::sMaxPipesPerMixer = MAX_PIPES_PER_MIXER;
bool MDPComp::sEnable4k2kYUVSplit = false;
bool MDPComp::sEnableYUVsplit = false;
bool MDPComp::sSrcSplitEnabled = false;
MDPComp* MDPComp::getObject(hwc_context_t *ctx, const int& dpy) {
if(qdutils::MDPVersion::getInstance().isSrcSplit()) {
@@ -159,7 +159,7 @@ bool MDPComp::init(hwc_context_t *ctx) {
property_get("persist.mdpcomp.4k2kSplit", property, "0") > 0 &&
(!strncmp(property, "1", PROPERTY_VALUE_MAX) ||
!strncasecmp(property,"true", PROPERTY_VALUE_MAX))) {
sEnable4k2kYUVSplit = true;
sEnableYUVsplit = true;
}
if ((property_get("persist.hwc.ptor.enable", property, NULL) > 0) &&
@@ -773,7 +773,7 @@ bool MDPComp::fullMDPComp(hwc_context_t *ctx, hwc_display_contents_1_t* list) {
mCurrentFrame.mdpCount = mCurrentFrame.layerCount - mCurrentFrame.fbCount -
mCurrentFrame.dropCount;
if(sEnable4k2kYUVSplit){
if(sEnableYUVsplit){
adjustForSourceSplit(ctx, list);
}
@@ -1055,7 +1055,7 @@ bool MDPComp::cacheBasedComp(hwc_context_t *ctx,
int mdpCount = mCurrentFrame.mdpCount;
if(sEnable4k2kYUVSplit){
if(sEnableYUVsplit){
adjustForSourceSplit(ctx, list);
}
@@ -1221,7 +1221,7 @@ bool MDPComp::videoOnlyComp(hwc_context_t *ctx,
if(mCurrentFrame.fbCount)
mCurrentFrame.fbZ = mCurrentFrame.mdpCount;
if(sEnable4k2kYUVSplit){
if(sEnableYUVsplit){
adjustForSourceSplit(ctx, list);
}
@@ -1549,7 +1549,7 @@ bool MDPComp::postHeuristicsHandling(hwc_context_t *ctx,
cur_pipe->zOrder = mdpNextZOrder++;
private_handle_t *hnd = (private_handle_t *)layer->handle;
if(is4kx2kYuvBuffer(hnd) && sEnable4k2kYUVSplit){
if(isYUVSplitNeeded(hnd) && sEnableYUVsplit){
if(configure4k2kYuv(ctx, layer,
mCurrentFrame.mdpToLayer[mdpIndex])
!= 0 ){
@@ -1799,7 +1799,7 @@ void MDPCompNonSplit::adjustForSourceSplit(hwc_context_t *ctx,
mdpNextZOrder++;
hwc_layer_1_t* layer = &list->hwLayers[index];
private_handle_t *hnd = (private_handle_t *)layer->handle;
if(is4kx2kYuvBuffer(hnd)) {
if(isYUVSplitNeeded(hnd)) {
if(mdpNextZOrder <= mCurrentFrame.fbZ)
mCurrentFrame.fbZ += 1;
mdpNextZOrder++;
@@ -1839,7 +1839,7 @@ bool MDPCompNonSplit::allocLayerPipes(hwc_context_t *ctx,
hwc_layer_1_t* layer = &list->hwLayers[index];
private_handle_t *hnd = (private_handle_t *)layer->handle;
if(is4kx2kYuvBuffer(hnd) && sEnable4k2kYUVSplit){
if(isYUVSplitNeeded(hnd) && sEnableYUVsplit){
if(allocSplitVGPipesfor4k2k(ctx, index)){
continue;
}
@@ -1919,7 +1919,7 @@ bool MDPCompNonSplit::draw(hwc_context_t *ctx, hwc_display_contents_1_t* list) {
int mdpIndex = mCurrentFrame.layerToMDP[i];
if(is4kx2kYuvBuffer(hnd) && sEnable4k2kYUVSplit)
if(isYUVSplitNeeded(hnd) && sEnableYUVsplit)
{
MdpYUVPipeInfo& pipe_info =
*(MdpYUVPipeInfo*)mCurrentFrame.mdpToLayer[mdpIndex].pipeInfo;
@@ -2018,7 +2018,7 @@ void MDPCompSplit::adjustForSourceSplit(hwc_context_t *ctx,
mdpNextZOrder++;
hwc_layer_1_t* layer = &list->hwLayers[index];
private_handle_t *hnd = (private_handle_t *)layer->handle;
if(is4kx2kYuvBuffer(hnd)) {
if(isYUVSplitNeeded(hnd)) {
hwc_rect_t dst = layer->displayFrame;
if((dst.left > lSplit) || (dst.right < lSplit)) {
mCurrentFrame.mdpCount += 1;
@@ -2079,7 +2079,7 @@ bool MDPCompSplit::allocLayerPipes(hwc_context_t *ctx,
private_handle_t *hnd = (private_handle_t *)layer->handle;
hwc_rect_t dst = layer->displayFrame;
const int lSplit = getLeftSplit(ctx, mDpy);
if(is4kx2kYuvBuffer(hnd) && sEnable4k2kYUVSplit){
if(isYUVSplitNeeded(hnd) && sEnableYUVsplit){
if((dst.left > lSplit)||(dst.right < lSplit)){
if(allocSplitVGPipesfor4k2k(ctx, index)){
continue;
@@ -2175,7 +2175,7 @@ bool MDPCompSplit::draw(hwc_context_t *ctx, hwc_display_contents_1_t* list) {
int mdpIndex = mCurrentFrame.layerToMDP[i];
if(is4kx2kYuvBuffer(hnd) && sEnable4k2kYUVSplit)
if(isYUVSplitNeeded(hnd) && sEnableYUVsplit)
{
MdpYUVPipeInfo& pipe_info =
*(MdpYUVPipeInfo*)mCurrentFrame.mdpToLayer[mdpIndex].pipeInfo;

View File

@@ -248,7 +248,7 @@ protected:
struct FrameInfo mCurrentFrame;
struct LayerCache mCachedFrame;
//Enable 4kx2k yuv layer split
static bool sEnable4k2kYUVSplit;
static bool sEnableYUVsplit;
bool mModeOn; // if prepare happened
bool allocSplitVGPipesfor4k2k(hwc_context_t *ctx, int index);
};

View File

@@ -879,7 +879,7 @@ void setListStats(hwc_context_t *ctx,
ctx->listStats[dpy].yuvIndices[yuvCount] = (int)i;
yuvCount++;
if(UNLIKELY(is4kx2kYuvBuffer(hnd))){
if(UNLIKELY(isYUVSplitNeeded(hnd))){
int& yuv4k2kCount = ctx->listStats[dpy].yuv4k2kCount;
ctx->listStats[dpy].yuv4k2kIndices[yuv4k2kCount] = (int)i;
yuv4k2kCount++;
@@ -2211,14 +2211,14 @@ void BwcPM::setBwc(const hwc_rect_t& crop,
}
void LayerRotMap::add(hwc_layer_1_t* layer, Rotator *rot) {
if(mCount >= MAX_SESS) return;
if(mCount >= RotMgr::MAX_ROT_SESS) return;
mLayer[mCount] = layer;
mRot[mCount] = rot;
mCount++;
}
void LayerRotMap::reset() {
for (int i = 0; i < MAX_SESS; i++) {
for (int i = 0; i < RotMgr::MAX_ROT_SESS; i++) {
mLayer[i] = 0;
mRot[i] = 0;
}

View File

@@ -29,7 +29,9 @@
#include <gralloc_priv.h>
#include <utils/String8.h>
#include "qdMetaData.h"
#include "mdp_version.h"
#include <overlayUtils.h>
#include <overlayRotator.h>
#include <EGL/egl.h>
@@ -190,7 +192,6 @@ enum {
class LayerRotMap {
public:
LayerRotMap() { reset(); }
enum { MAX_SESS = 3 };
void add(hwc_layer_1_t* layer, overlay::Rotator *rot);
//Resets the mapping of layer to rotator
void reset();
@@ -202,8 +203,8 @@ public:
overlay::Rotator* getRot(uint32_t index) const;
void setReleaseFd(const int& fence);
private:
hwc_layer_1_t* mLayer[MAX_SESS];
overlay::Rotator* mRot[MAX_SESS];
hwc_layer_1_t* mLayer[overlay::RotMgr::MAX_ROT_SESS];
overlay::Rotator* mRot[overlay::RotMgr::MAX_ROT_SESS];
uint32_t mCount;
};
@@ -406,10 +407,11 @@ static inline bool isYuvBuffer(const private_handle_t* hnd) {
return (hnd && (hnd->bufferType == BUFFER_TYPE_VIDEO));
}
// Returns true if the buffer is yuv
static inline bool is4kx2kYuvBuffer(const private_handle_t* hnd) {
// Returns true if the buffer is yuv and exceeds the mixer width
static inline bool isYUVSplitNeeded(const private_handle_t* hnd) {
int maxMixerWidth = qdutils::MDPVersion::getInstance().getMaxMixerWidth();
return (hnd && (hnd->bufferType == BUFFER_TYPE_VIDEO) &&
(hnd->width > 2048));
(hnd->width > maxMixerWidth));
}
// Returns true if the buffer is secure

View File

@@ -20,6 +20,7 @@
#include "overlayRotator.h"
#include "overlayUtils.h"
#include "mdp_version.h"
#include "sync/sync.h"
#include "gr.h"
namespace ovutils = overlay::utils;

View File

@@ -35,7 +35,6 @@
#include "mdpWrapper.h"
#include "overlayUtils.h"
#include "overlayMem.h"
#include "sync/sync.h"
namespace overlay {

View File

@@ -285,15 +285,16 @@ void getDecimationFactor(const int& src_w, const int& src_h,
vertDeci = 0;
float horDscale = ceilf((float)src_w / (float)dst_w);
float verDscale = ceilf((float)src_h / (float)dst_h);
qdutils::MDPVersion& mdpHw = qdutils::MDPVersion::getInstance();
//Next power of 2, if not already
horDscale = powf(2.0f, ceilf(log2f(horDscale)));
verDscale = powf(2.0f, ceilf(log2f(verDscale)));
//Since MDP can do 1/4 dscale and has better quality, split the task
//Since MDP can do downscale and has better quality, split the task
//between decimator and MDP downscale
horDscale /= 4.0f;
verDscale /= 4.0f;
horDscale /= (float)mdpHw.getMaxMDPDownscale();
verDscale /= (float)mdpHw.getMaxMDPDownscale();
if((int)horDscale)
horzDeci = (uint8_t)log2f(horDscale);
@@ -301,7 +302,7 @@ void getDecimationFactor(const int& src_w, const int& src_h,
if((int)verDscale)
vertDeci = (uint8_t)log2f(verDscale);
if(src_w > 2048) {
if(src_w > mdpHw.getMaxMixerWidth()) {
//If the client sends us something > what a layer mixer supports
//then it means it doesn't want to use split-pipe but wants us to
//decimate. A minimum decimation of 2 will ensure that the width is

View File

@@ -88,8 +88,8 @@ MDPVersion::MDPVersion()
mVGPipes = 0;
mDMAPipes = 0;
mFeatures = 0;
mMDPUpscale = 0;
mMDPDownscale = 0;
mMDPUpscale = 1;
mMDPDownscale = 1;
mMacroTileEnabled = false;
mLowBw = 0;
mHighBw = 0;