diff options
author | Priyanka Gujjula <pgujjula@codeaurora.org> | 2020-07-16 00:51:40 +0530 |
---|---|---|
committer | Gerrit - the friendly Code Review server <code-review@localhost> | 2020-08-19 03:27:55 -0700 |
commit | 5eb8c8b96d2a4ff5c0d193f27413b0b29ef31deb (patch) | |
tree | ee31fff4ed3cd63586cf794f68dd68f329341d5b | |
parent | 3b1c8dc4013ae3d9c47933dd27a02b72ecfe3814 (diff) |
gralloc: Update buffer size calc for NV12 color formats
Compute the actual buffer size (including aligned width
and height) based on pixel format that is set. In this
case, calculate NV12 color format buffer sizes as per
nv12_512 alignment even when the ubwc surface is set.
Change-Id: Ic3ea1f03e9bfe0b62b3917e43d95da1f7e28bde8
-rw-r--r-- | gralloc/gr_utils.cpp | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/gralloc/gr_utils.cpp b/gralloc/gr_utils.cpp index 312058ed..0cd2276f 100644 --- a/gralloc/gr_utils.cpp +++ b/gralloc/gr_utils.cpp @@ -756,6 +756,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); @@ -839,8 +842,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; |