summaryrefslogtreecommitdiff
path: root/gralloc/gr_utils.cpp
diff options
context:
space:
mode:
authorqctecmdr <qctecmdr@localhost>2020-08-25 23:15:45 -0700
committerGerrit - the friendly Code Review server <code-review@localhost>2020-08-25 23:15:45 -0700
commit310364e783b38739350d84b8855c2b37caa130f4 (patch)
tree7e6d56c072a333e63cdaf8050ca2497b368edefe /gralloc/gr_utils.cpp
parenta838b8ecc8aec3ecc0cbfc33499daf32746d5f35 (diff)
parent5eb8c8b96d2a4ff5c0d193f27413b0b29ef31deb (diff)
Merge "gralloc: Update buffer size calc for NV12 color formats"
Diffstat (limited to 'gralloc/gr_utils.cpp')
-rw-r--r--gralloc/gr_utils.cpp15
1 files changed, 15 insertions, 0 deletions
diff --git a/gralloc/gr_utils.cpp b/gralloc/gr_utils.cpp
index bfbd0402..21e504a3 100644
--- a/gralloc/gr_utils.cpp
+++ b/gralloc/gr_utils.cpp
@@ -759,6 +759,9 @@ void GetYuvUBwcWidthAndHeight(int width, int height, int format, unsigned int *a
switch (format) {
case HAL_PIXEL_FORMAT_NV12_ENCODEABLE:
case HAL_PIXEL_FORMAT_YCbCr_420_SP_VENUS:
+ *aligned_w = VENUS_Y_STRIDE(COLOR_FMT_NV12, width);
+ *aligned_h = VENUS_Y_SCANLINES(COLOR_FMT_NV12, height);
+ break;
case HAL_PIXEL_FORMAT_YCbCr_420_SP_VENUS_UBWC:
*aligned_w = VENUS_Y_STRIDE(COLOR_FMT_NV12_UBWC, width);
*aligned_h = VENUS_Y_SCANLINES(COLOR_FMT_NV12_UBWC, height);
@@ -842,8 +845,20 @@ unsigned int GetUBwcSize(int width, int height, int format, unsigned int aligned
size = alignedw * alignedh * bpp;
size += GetRgbUBwcMetaBufferSize(width, height, bpp);
break;
+ /*
+ * 1. The CtsMediaV2TestCases#CodecEncoderSurfaceTest is a transcode use case and shares
+ * same surface between encoder and decoder.
+ * 2. Configures encoder with Opaque color format thus encoder sets ubwc usage bits and
+ * is configured with NV12_UBWC format.
+ * 3. Configures decoder as 'flexible', thus configuring decoder with NV12 format.
+ * 4. Decoder should produce output to surface that will be fed back to encoder as input.
+ * 5. Though UBWC is enabled, we need to compute the actual buffer size (including aligned
+ * width and height) based on pixel format that is set.
+ */
case HAL_PIXEL_FORMAT_NV12_ENCODEABLE:
case HAL_PIXEL_FORMAT_YCbCr_420_SP_VENUS:
+ size = VENUS_BUFFER_SIZE(COLOR_FMT_NV12, width, height);
+ break;
case HAL_PIXEL_FORMAT_YCbCr_420_SP_VENUS_UBWC:
size = VENUS_BUFFER_SIZE(COLOR_FMT_NV12_UBWC, width, height);
break;