liboverlay: Add support for MDSS Bandwidth Compression

- This adds support for Bandwidth Compression.
- If MDSS supports BWC, then we set BWC flags
  to both Rotator(encode) and overlay(decode)

Change-Id: I6f7800716a2ce2ab855f4c0b1a53cd96f7d06d74
This commit is contained in:
Sushil Chauhan
2013-01-30 17:44:15 -08:00
parent d092e660ad
commit bab187a53e
6 changed files with 40 additions and 1 deletions

View File

@@ -628,6 +628,12 @@ void setMdpFlags(hwc_layer_1_t *layer,
if(transform & HWC_TRANSFORM_ROT_90) { if(transform & HWC_TRANSFORM_ROT_90) {
ovutils::setMdpFlags(mdpFlags, ovutils::setMdpFlags(mdpFlags,
ovutils::OV_MDP_SOURCE_ROTATED_90); ovutils::OV_MDP_SOURCE_ROTATED_90);
// enable bandwidth compression only if src width < 2048
if(qdutils::MDPVersion::getInstance().supportsBWC() &&
hnd->width < qdutils::MAX_DISPLAY_DIM) {
ovutils::setMdpFlags(mdpFlags,
ovutils::OV_MDSS_MDP_BWC_EN);
}
} }
} }

View File

@@ -20,6 +20,8 @@
#include "overlayUtils.h" #include "overlayUtils.h"
#include "overlayRotator.h" #include "overlayRotator.h"
#define DEBUG_MDSS_ROT 0
#ifdef VENUS_COLOR_FORMAT #ifdef VENUS_COLOR_FORMAT
#include <media/msm_media_info.h> #include <media/msm_media_info.h>
#else #else
@@ -252,7 +254,11 @@ uint32_t MdssRot::calcOutputBufSize() {
ovutils::Whf destWhf(mRotInfo.dst_rect.w, mRotInfo.dst_rect.h, ovutils::Whf destWhf(mRotInfo.dst_rect.w, mRotInfo.dst_rect.h,
mRotInfo.src.format); //mdss src and dst formats are same. mRotInfo.src.format); //mdss src and dst formats are same.
opBufSize = Rotator::calcOutputBufSize(destWhf); if (mRotInfo.flags & ovutils::OV_MDSS_MDP_BWC_EN) {
opBufSize = calcCompressedBufSize();
} else {
opBufSize = Rotator::calcOutputBufSize(destWhf);
}
if (mRotInfo.flags & utils::OV_MDP_SECURE_OVERLAY_SESSION) if (mRotInfo.flags & utils::OV_MDP_SECURE_OVERLAY_SESSION)
opBufSize = utils::align(opBufSize, SIZE_1M); opBufSize = utils::align(opBufSize, SIZE_1M);
@@ -265,4 +271,23 @@ void MdssRot::getDump(char *buf, size_t len) const {
ovutils::getDump(buf, len, "MdssRotData", mRotData); ovutils::getDump(buf, len, "MdssRotData", mRotData);
} }
// Calculate the compressed o/p buffer size for BWC
uint32_t MdssRot::calcCompressedBufSize() {
uint32_t bufSize = 0;
int aWidth = ovutils::align(mRotInfo.src_rect.w, 64);
int aHeight = ovutils::align(mRotInfo.src_rect.h, 4);
int rau_cnt = aWidth/64;
int stride0 = (64 * 4 * rau_cnt) + rau_cnt/8;
int stride1 = (64 * 2 * rau_cnt) + rau_cnt/8;
int stride0_off = (aHeight/4);
int stride1_off = (aHeight/2);
//New o/p size for BWC
bufSize = (stride0 * stride0_off + stride1 * stride1_off) +
(rau_cnt * 2 * (stride0_off + stride1_off));
ALOGD_IF(DEBUG_MDSS_ROT, "%s: width = %d, height = %d raucount = %d"
"opBufSize = %d ", __FUNCTION__, aWidth, aHeight, rau_cnt, bufSize);
return bufSize;
}
} // namespace overlay } // namespace overlay

View File

@@ -198,6 +198,8 @@ private:
/* Calculates the rotator's o/p buffer size post the transform calcs and /* Calculates the rotator's o/p buffer size post the transform calcs and
* knowing the o/p format depending on whether fastYuv is enabled or not */ * knowing the o/p format depending on whether fastYuv is enabled or not */
uint32_t calcOutputBufSize(); uint32_t calcOutputBufSize();
// Calculate the compressed o/p buffer size for BWC
uint32_t calcCompressedBufSize();
/* MdssRot info structure */ /* MdssRot info structure */
mdp_overlay mRotInfo; mdp_overlay mRotInfo;

View File

@@ -262,6 +262,7 @@ enum eMdpFlags {
OV_MDP_FLIP_V = MDP_FLIP_UD, OV_MDP_FLIP_V = MDP_FLIP_UD,
OV_MDSS_MDP_RIGHT_MIXER = MDSS_MDP_RIGHT_MIXER, OV_MDSS_MDP_RIGHT_MIXER = MDSS_MDP_RIGHT_MIXER,
OV_MDP_PP_EN = MDP_OVERLAY_PP_CFG_EN, OV_MDP_PP_EN = MDP_OVERLAY_PP_CFG_EN,
OV_MDSS_MDP_BWC_EN = MDP_BWC_EN,
}; };
enum eZorder { enum eZorder {

View File

@@ -117,5 +117,9 @@ uint32_t MDPVersion::getMaxMDPDownscale() {
return mMDPDownscale; return mMDPDownscale;
} }
bool MDPVersion::supportsBWC() {
// BWC - Bandwidth Compression
return (mFeatures & MDP_BWC_EN);
}
}; //namespace qdutils }; //namespace qdutils

View File

@@ -82,6 +82,7 @@ public:
uint8_t getDMAPipes() { return mDMAPipes; } uint8_t getDMAPipes() { return mDMAPipes; }
bool supportsDecimation(); bool supportsDecimation();
uint32_t getMaxMDPDownscale(); uint32_t getMaxMDPDownscale();
bool supportsBWC();
private: private:
int mMDPVersion; int mMDPVersion;
char mPanelType; char mPanelType;