@@ -57,7 +57,6 @@ enum VP8_LEVEL {
5757 LEVEL_VP8_Version0 = C2_PROFILE_LEVEL_VENDOR_START,
5858};
5959
60-
6160C2R MfxC2DecoderComponent::OutputSurfaceAllocatorSetter (bool mayBlock, C2P<C2PortSurfaceAllocatorTuning::output> &me) {
6261 (void )mayBlock;
6362 (void )me;
@@ -222,6 +221,13 @@ MfxC2DecoderComponent::MfxC2DecoderComponent(const C2String name, const CreateCo
222221 .withConstValue (AllocSharedString<C2PortMediaTypeSetting::output>(" video/raw" ))
223222 .build ());
224223
224+ addParameter (
225+ DefineParam (m_outputUsage, C2_PARAMKEY_OUTPUT_STREAM_USAGE)
226+ .withDefault (new C2StreamUsageTuning::output (0u , C2AndroidMemoryUsage::HW_CODEC_WRITE))
227+ .withFields ({C2F (m_outputUsage, value).any ()})
228+ .withSetter (Setter<decltype (*m_outputUsage)>::StrictValueWithNoDeps)
229+ .build ());
230+
225231 switch (m_decoderType) {
226232 case DECODER_H264: {
227233 m_uOutputDelay = /* max_dpb_size*/ 16 + /* for async depth*/ 1 + /* for msdk unref in sync part*/ 1 ;
@@ -280,7 +286,6 @@ MfxC2DecoderComponent::MfxC2DecoderComponent(const C2String name, const CreateCo
280286 }
281287 case DECODER_H265: {
282288 m_uOutputDelay = /* max_dpb_size*/ 16 + /* for async depth*/ 1 + /* for msdk unref in sync part*/ 1 ;
283-
284289 m_uInputDelay = 15 ;
285290
286291 addParameter (
@@ -1183,9 +1188,11 @@ mfxStatus MfxC2DecoderComponent::InitDecoder(std::shared_ptr<C2BlockPool> c2_all
11831188 uint64_t usage, igbp_id;
11841189 android::_UnwrapNativeCodec2GrallocMetadata (out_block->handle (), &width, &height, &format, &usage,
11851190 &stride, &generation, &igbp_id, &igbp_slot);
1186- if ((!igbp_id && !igbp_slot) || (!igbp_id && igbp_slot == 0xffffffff ))
1191+ MFX_DEBUG_TRACE_PRINTF (" m_outputUsage is C2MemoryUsage::CPU_READ? %s" , m_outputUsage->value == C2MemoryUsage::CPU_READ? " Y" : " N" );
1192+ if ((!igbp_id && !igbp_slot) || (!igbp_id && igbp_slot == 0xffffffff ) || m_outputUsage->value == C2MemoryUsage::CPU_READ)
11871193 {
11881194 // No surface & BQ
1195+ MFX_DEBUG_TRACE_PRINTF (" No surface & BQ, Force to use System memory" );
11891196 m_mfxVideoParams.IOPattern = MFX_IOPATTERN_OUT_SYSTEM_MEMORY;
11901197 m_allocator = nullptr ;
11911198 }
0 commit comments