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);
}