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
diff --git a/libhwcomposer/hwc_mdpcomp.cpp b/libhwcomposer/hwc_mdpcomp.cpp
index 162ee4f..77bc0b5 100644
--- a/libhwcomposer/hwc_mdpcomp.cpp
+++ b/libhwcomposer/hwc_mdpcomp.cpp
@@ -45,7 +45,7 @@
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 @@
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 @@
mCurrentFrame.mdpCount = mCurrentFrame.layerCount - mCurrentFrame.fbCount -
mCurrentFrame.dropCount;
- if(sEnable4k2kYUVSplit){
+ if(sEnableYUVsplit){
adjustForSourceSplit(ctx, list);
}
@@ -1055,7 +1055,7 @@
int mdpCount = mCurrentFrame.mdpCount;
- if(sEnable4k2kYUVSplit){
+ if(sEnableYUVsplit){
adjustForSourceSplit(ctx, list);
}
@@ -1221,7 +1221,7 @@
if(mCurrentFrame.fbCount)
mCurrentFrame.fbZ = mCurrentFrame.mdpCount;
- if(sEnable4k2kYUVSplit){
+ if(sEnableYUVsplit){
adjustForSourceSplit(ctx, list);
}
@@ -1549,7 +1549,7 @@
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 @@
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 @@
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 @@
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 @@
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 @@
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 @@
int mdpIndex = mCurrentFrame.layerToMDP[i];
- if(is4kx2kYuvBuffer(hnd) && sEnable4k2kYUVSplit)
+ if(isYUVSplitNeeded(hnd) && sEnableYUVsplit)
{
MdpYUVPipeInfo& pipe_info =
*(MdpYUVPipeInfo*)mCurrentFrame.mdpToLayer[mdpIndex].pipeInfo;
diff --git a/libhwcomposer/hwc_mdpcomp.h b/libhwcomposer/hwc_mdpcomp.h
index 1ebe0bd..5214ac6 100644
--- a/libhwcomposer/hwc_mdpcomp.h
+++ b/libhwcomposer/hwc_mdpcomp.h
@@ -248,7 +248,7 @@
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);
};
diff --git a/libhwcomposer/hwc_utils.cpp b/libhwcomposer/hwc_utils.cpp
index 3696c05..8bed0fb 100644
--- a/libhwcomposer/hwc_utils.cpp
+++ b/libhwcomposer/hwc_utils.cpp
@@ -879,7 +879,7 @@
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 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;
}
diff --git a/libhwcomposer/hwc_utils.h b/libhwcomposer/hwc_utils.h
index 66fdc65..008de4c 100644
--- a/libhwcomposer/hwc_utils.h
+++ b/libhwcomposer/hwc_utils.h
@@ -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 @@
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 @@
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 @@
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
diff --git a/liboverlay/overlayRotator.cpp b/liboverlay/overlayRotator.cpp
index 0671b62..46d7ce1 100644
--- a/liboverlay/overlayRotator.cpp
+++ b/liboverlay/overlayRotator.cpp
@@ -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;
diff --git a/liboverlay/overlayRotator.h b/liboverlay/overlayRotator.h
index 64387cd..6be1e91 100644
--- a/liboverlay/overlayRotator.h
+++ b/liboverlay/overlayRotator.h
@@ -35,7 +35,6 @@
#include "mdpWrapper.h"
#include "overlayUtils.h"
#include "overlayMem.h"
-#include "sync/sync.h"
namespace overlay {
diff --git a/liboverlay/overlayUtils.cpp b/liboverlay/overlayUtils.cpp
index 0e063ab..1a97948 100644
--- a/liboverlay/overlayUtils.cpp
+++ b/liboverlay/overlayUtils.cpp
@@ -285,15 +285,16 @@
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 @@
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
diff --git a/libqdutils/mdp_version.cpp b/libqdutils/mdp_version.cpp
index 48f7cb7..7aa0469 100644
--- a/libqdutils/mdp_version.cpp
+++ b/libqdutils/mdp_version.cpp
@@ -88,8 +88,8 @@
mVGPipes = 0;
mDMAPipes = 0;
mFeatures = 0;
- mMDPUpscale = 0;
- mMDPDownscale = 0;
+ mMDPUpscale = 1;
+ mMDPDownscale = 1;
mMacroTileEnabled = false;
mLowBw = 0;
mHighBw = 0;