1 /*
2 * Copyright (c) 2018-2020, Intel Corporation
3 *
4 * Permission is hereby granted, free of charge, to any person obtaining a
5 * copy of this software and associated documentation files (the "Software"),
6 * to deal in the Software without restriction, including without limitation
7 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
8 * and/or sell copies of the Software, and to permit persons to whom the
9 * Software is furnished to do so, subject to the following conditions:
10 *
11 * The above copyright notice and this permission notice shall be included
12 * in all copies or substantial portions of the Software.
13 *
14 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
15 * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
17 * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
18 * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
19 * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
20 * OTHER DEALINGS IN THE SOFTWARE.
21 */
22 //!
23 //! \file decode_hevc_pipeline_adapter_m12.cpp
24 //! \brief Defines the interface to adapt to hevc decode pipeline
25 //!
26
27 #include "decode_hevc_pipeline_adapter_m12.h"
28 #include "decode_utils.h"
29
DecodeHevcPipelineAdapterM12(CodechalHwInterface * hwInterface,CodechalDebugInterface * debugInterface)30 DecodeHevcPipelineAdapterM12::DecodeHevcPipelineAdapterM12(
31 CodechalHwInterface * hwInterface,
32 CodechalDebugInterface *debugInterface)
33 : DecodePipelineAdapter(*hwInterface, debugInterface)
34 {
35 DECODE_ASSERT(m_osInterface != nullptr);
36 if (m_osInterface != nullptr)
37 {
38 m_osInterface->pfnVirtualEngineSupported(m_osInterface, true, true);
39 Mos_SetVirtualEngineSupported(m_osInterface, true);
40 m_hwInterface = hwInterface;
41 }
42 }
43
BeginFrame()44 MOS_STATUS DecodeHevcPipelineAdapterM12::BeginFrame()
45 {
46 DECODE_FUNC_CALL();
47
48 decode::DecodePipelineParams decodeParams;
49 decodeParams.m_pipeMode = decode::decodePipeModeBegin;
50 DECODE_CHK_STATUS(m_decoder->Prepare(&decodeParams));
51 return m_decoder->Execute();
52 }
53
EndFrame()54 MOS_STATUS DecodeHevcPipelineAdapterM12::EndFrame()
55 {
56 DECODE_FUNC_CALL();
57
58 decode::DecodePipelineParams decodeParams;
59 decodeParams.m_pipeMode = decode::decodePipeModeEnd;
60 DECODE_CHK_STATUS(m_decoder->Prepare(&decodeParams));
61 return m_decoder->Execute();
62 }
63
Allocate(CodechalSetting * codecHalSettings)64 MOS_STATUS DecodeHevcPipelineAdapterM12::Allocate(CodechalSetting *codecHalSettings)
65 {
66 DECODE_FUNC_CALL();
67
68 m_decoder = std::make_shared<decode::HevcPipelineM12>(m_hwInterface, m_debugInterface);
69 DECODE_CHK_NULL(m_decoder);
70
71 return m_decoder->Init(codecHalSettings);
72 }
73
Execute(void * params)74 MOS_STATUS DecodeHevcPipelineAdapterM12::Execute(void *params)
75 {
76 DECODE_FUNC_CALL();
77
78 decode::DecodePipelineParams decodeParams;
79 decodeParams.m_params = (CodechalDecodeParams*)params;
80 decodeParams.m_pipeMode = decode::decodePipeModeProcess;
81 DECODE_CHK_STATUS(m_decoder->Prepare(&decodeParams));
82 return m_decoder->Execute();
83 }
84
GetStatusReport(void * status,uint16_t numStatus)85 MOS_STATUS DecodeHevcPipelineAdapterM12::GetStatusReport(
86 void *status,
87 uint16_t numStatus)
88 {
89 DECODE_FUNC_CALL();
90
91 return m_decoder->GetStatusReport(status, numStatus);
92 }
93
IsIncompletePicture()94 bool DecodeHevcPipelineAdapterM12::IsIncompletePicture()
95 {
96 return (!m_decoder->IsCompleteBitstream());
97 }
98
99 #ifdef _DECODE_PROCESSING_SUPPORTED
IsDownSamplingSupported()100 bool DecodeHevcPipelineAdapterM12::IsDownSamplingSupported()
101 {
102 return m_decoder->IsDownSamplingSupported();
103 }
104 #endif
105
GetDummyReference()106 MOS_SURFACE* DecodeHevcPipelineAdapterM12::GetDummyReference()
107 {
108 DECODE_FUNC_CALL();
109 return m_decoder->GetDummyReference();
110 }
111
GetDummyReferenceStatus()112 CODECHAL_DUMMY_REFERENCE_STATUS DecodeHevcPipelineAdapterM12::GetDummyReferenceStatus()
113 {
114 DECODE_FUNC_CALL();
115 return m_decoder->GetDummyReferenceStatus();
116 }
117
SetDummyReferenceStatus(CODECHAL_DUMMY_REFERENCE_STATUS status)118 void DecodeHevcPipelineAdapterM12::SetDummyReferenceStatus(CODECHAL_DUMMY_REFERENCE_STATUS status)
119 {
120 DECODE_FUNC_CALL();
121 m_decoder->SetDummyReferenceStatus(status);
122 }
123
GetCompletedReport()124 uint32_t DecodeHevcPipelineAdapterM12::GetCompletedReport()
125 {
126 return m_decoder->GetCompletedReport();
127 }
128
Destroy()129 void DecodeHevcPipelineAdapterM12::Destroy()
130 {
131 DECODE_FUNC_CALL();
132
133 m_decoder->Destroy();
134 }
135
GetDecodeContext()136 MOS_GPU_CONTEXT DecodeHevcPipelineAdapterM12::GetDecodeContext()
137 {
138 DECODE_FUNC_CALL();
139
140 return m_decoder->GetDecodeContext();
141 }
142
GetDecodeContextHandle()143 GPU_CONTEXT_HANDLE DecodeHevcPipelineAdapterM12::GetDecodeContextHandle()
144 {
145 DECODE_FUNC_CALL();
146
147 return m_decoder->GetDecodeContextHandle();
148 }
149