liboverlay: Fix stride alignment issue for s/w decoded video.
1. Due to alignment requirements on HAL_PIXEL_FORMAT_YV12 format,
rotator buffer size calculation needs to be performed based on
rotated width and height because buffer size can be different when
width & height are swapped due to 90 degree rotation.
2. Input and output color formats are same for MDSS Rotator.
Change-Id: I0a06ef9bb7bdceb951e7ab5160dac3e92a28bcda
CRs-Fixed: 451871
diff --git a/liboverlay/overlayMdssRot.cpp b/liboverlay/overlayMdssRot.cpp
index c00e732..cb329ad 100644
--- a/liboverlay/overlayMdssRot.cpp
+++ b/liboverlay/overlayMdssRot.cpp
@@ -261,10 +261,22 @@
}
void MdssRot::setBufSize(int format) {
- if (format == MDP_Y_CBCR_H2V2_VENUS) {
- mBufSize = VENUS_BUFFER_SIZE(COLOR_FMT_NV12, mRotInfo.dst_rect.w,
- mRotInfo.dst_rect.h);
+
+ switch (format) {
+ case MDP_Y_CBCR_H2V2_VENUS:
+ mBufSize = VENUS_BUFFER_SIZE(COLOR_FMT_NV12, mRotInfo.dst_rect.w,
+ mRotInfo.dst_rect.h);
+ break;
+
+ case MDP_Y_CR_CB_GH2V2:
+ int alignedw = utils::align(mRotInfo.dst_rect.w, 16);
+ int alignedh = mRotInfo.dst_rect.h;
+ mBufSize = (alignedw*alignedh) +
+ (utils::align(alignedw/2, 16) * (alignedh/2))*2;
+ mBufSize = utils::align(mBufSize, 4096);
+ break;
}
+
if (mRotInfo.flags & utils::OV_MDP_SECURE_OVERLAY_SESSION)
mBufSize = utils::align(mBufSize, SIZE_1M);
}
diff --git a/liboverlay/overlayUtils.cpp b/liboverlay/overlayUtils.cpp
index 49a1eaf..9bffff0 100644
--- a/liboverlay/overlayUtils.cpp
+++ b/liboverlay/overlayUtils.cpp
@@ -330,6 +330,11 @@
return fmt3D;
}
+bool isMdssRotator() {
+ int mdpVersion = qdutils::MDPVersion::getInstance().getMDPVersion();
+ return (mdpVersion >= qdutils::MDSS_V5);
+}
+
} // utils
} // overlay
diff --git a/liboverlay/overlayUtils.h b/liboverlay/overlayUtils.h
index 6f06b0d..76d930b 100644
--- a/liboverlay/overlayUtils.h
+++ b/liboverlay/overlayUtils.h
@@ -178,6 +178,7 @@
bool send3DInfoPacket (uint32_t fmt);
bool enableBarrier (uint32_t orientation);
uint32_t getS3DFormat(uint32_t fmt);
+bool isMdssRotator();
template <int CHAN>
bool getPositionS3D(const Whf& whf, Dim& out);
@@ -609,6 +610,10 @@
}
inline int getRotOutFmt(uint32_t format) {
+
+ if (isMdssRotator())
+ return format;
+
switch (format) {
case MDP_Y_CRCB_H2V2_TILE:
return MDP_Y_CRCB_H2V2;