From 054a421428143f9bf14745538cf9c43c3bfc26b1 Mon Sep 17 00:00:00 2001 From: Lina Sun Date: Fri, 14 Feb 2025 07:00:58 +0000 Subject: [PATCH] Fix vts cases failure For android 15 in InitDecoder add code to check if surface is allocated by IGBA, if not, use system memory instead of video memory to avoid some vts cases run fail. Tracked-On: OAM-130105 Signed-off-by: Lina Sun --- c2_components/src/mfx_c2_decoder_component.cpp | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/c2_components/src/mfx_c2_decoder_component.cpp b/c2_components/src/mfx_c2_decoder_component.cpp index 4760786f..bb729244 100755 --- a/c2_components/src/mfx_c2_decoder_component.cpp +++ b/c2_components/src/mfx_c2_decoder_component.cpp @@ -1254,20 +1254,22 @@ mfxStatus MfxC2DecoderComponent::InitDecoder(std::shared_ptr c2_all MfxFourCCToGralloc(m_mfxVideoParams.mfx.FrameInfo.FourCC), mem_usage, &out_block); - if (res == C2_OK) - { + if (res == C2_OK) { +// Before android 15, it's using BUFFER QUEUE for surface allocation, check if +// surface is allocated by BUFFER QUEUE with igbp_id and igbp_slot +#if PLATFORM_SDK_VERSION <= 34 uint32_t width, height, format, stride, igbp_slot, generation; uint64_t usage, igbp_id; android::_UnwrapNativeCodec2GrallocMetadata(out_block->handle(), &width, &height, &format, &usage, &stride, &generation, &igbp_id, &igbp_slot); -// For android 15, it's using IGBA instead of BQ, we can not check if -// surface is allocated by IGBA by igbp_id and igbp_slot -#if PLATFORM_SDK_VERSION <= 34 - if ((!igbp_id && !igbp_slot) || (!igbp_id && igbp_slot == 0xffffffff)) - { + if ((!igbp_id && !igbp_slot) || (!igbp_id && igbp_slot == 0xffffffff)) { // No surface & BQ m_mfxVideoParams.IOPattern = MFX_IOPATTERN_OUT_SYSTEM_MEMORY; } +#else // For android 15, it's using IGBA and Ahwb buffer for surface allocation + if(!C2AllocatorAhwb::CheckHandle(out_block->handle())) { + m_mfxVideoParams.IOPattern = MFX_IOPATTERN_OUT_SYSTEM_MEMORY; + } #endif } }