1 /*
2 * Copyright (c) 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_vp9_pipeline_adapter_g12.cpp
24 //! \brief Defines the interface to adapt to vp9 decode pipeline
25 //!
26
27 #include "decode_vp9_pipeline_adapter_m12.h"
28 #include "decode_utils.h"
29
DecodeVp9PipelineAdapterG12(CodechalHwInterface * hwInterface,CodechalDebugInterface * debugInterface)30 DecodeVp9PipelineAdapterG12::DecodeVp9PipelineAdapterG12(
31 CodechalHwInterface * hwInterface,
32 CodechalDebugInterface *debugInterface)
33 : DecodePipelineAdapter(*hwInterface, debugInterface)
34 {
35 DECODE_CHK_NULL_NO_STATUS_RETURN(m_osInterface);
36 m_osInterface->pfnVirtualEngineSupported(m_osInterface, true, true);
37 Mos_SetVirtualEngineSupported(m_osInterface, true);
38 m_hwInterface = hwInterface;
39 }
40
BeginFrame()41 MOS_STATUS DecodeVp9PipelineAdapterG12::BeginFrame()
42 {
43 DECODE_FUNC_CALL();
44 decode::DecodePipelineParams decodeParams;
45 decodeParams.m_pipeMode = decode::decodePipeModeBegin;
46 DECODE_CHK_STATUS(m_decoder->Prepare(&decodeParams));
47 return m_decoder->Execute();
48 }
49
EndFrame()50 MOS_STATUS DecodeVp9PipelineAdapterG12::EndFrame()
51 {
52 DECODE_FUNC_CALL();
53 decode::DecodePipelineParams decodeParams;
54 decodeParams.m_pipeMode = decode::decodePipeModeEnd;
55 DECODE_CHK_STATUS(m_decoder->Prepare(&decodeParams));
56 return m_decoder->Execute();
57 }
58
Allocate(CodechalSetting * codecHalSettings)59 MOS_STATUS DecodeVp9PipelineAdapterG12::Allocate(CodechalSetting *codecHalSettings)
60 {
61 DECODE_FUNC_CALL();
62 m_decoder = std::make_shared<decode::Vp9PipelineG12>(m_hwInterface, m_debugInterface);
63 DECODE_CHK_NULL(m_decoder);
64 return m_decoder->Init(codecHalSettings);
65 }
66
Execute(void * params)67 MOS_STATUS DecodeVp9PipelineAdapterG12::Execute(void *params)
68 {
69 DECODE_FUNC_CALL();
70 decode::DecodePipelineParams decodeParams;
71 decodeParams.m_params = (CodechalDecodeParams*)params;
72 decodeParams.m_pipeMode = decode::decodePipeModeProcess;
73 DECODE_CHK_STATUS(m_decoder->Prepare(&decodeParams));
74 return m_decoder->Execute();
75 }
76
GetStatusReport(void * status,uint16_t numStatus)77 MOS_STATUS DecodeVp9PipelineAdapterG12::GetStatusReport(
78 void *status,
79 uint16_t numStatus)
80 {
81 DECODE_FUNC_CALL();
82 return m_decoder->GetStatusReport(status, numStatus);
83 }
84
IsIncompletePicture()85 bool DecodeVp9PipelineAdapterG12::IsIncompletePicture()
86 {
87 return (!m_decoder->IsCompleteBitstream());
88 }
89
GetDummyReference()90 MOS_SURFACE *DecodeVp9PipelineAdapterG12::GetDummyReference()
91 {
92 DECODE_FUNC_CALL();
93 return m_decoder->GetDummyReference();
94 }
95
GetDummyReferenceStatus()96 CODECHAL_DUMMY_REFERENCE_STATUS DecodeVp9PipelineAdapterG12::GetDummyReferenceStatus()
97 {
98 DECODE_FUNC_CALL();
99 return m_decoder->GetDummyReferenceStatus();
100 }
101
SetDummyReferenceStatus(CODECHAL_DUMMY_REFERENCE_STATUS status)102 void DecodeVp9PipelineAdapterG12::SetDummyReferenceStatus(CODECHAL_DUMMY_REFERENCE_STATUS status)
103 {
104 DECODE_FUNC_CALL();
105 m_decoder->SetDummyReferenceStatus(status);
106 }
107
GetCompletedReport()108 uint32_t DecodeVp9PipelineAdapterG12::GetCompletedReport()
109 {
110 DECODE_FUNC_CALL();
111 return m_decoder->GetCompletedReport();
112 }
113
Destroy()114 void DecodeVp9PipelineAdapterG12::Destroy()
115 {
116 DECODE_FUNC_CALL();
117
118 m_decoder->Destroy();
119 }
120
GetDecodeContext()121 MOS_GPU_CONTEXT DecodeVp9PipelineAdapterG12::GetDecodeContext()
122 {
123 DECODE_FUNC_CALL();
124
125 return m_decoder->GetDecodeContext();
126 }
127
GetDecodeContextHandle()128 GPU_CONTEXT_HANDLE DecodeVp9PipelineAdapterG12::GetDecodeContextHandle()
129 {
130 DECODE_FUNC_CALL();
131
132 return m_decoder->GetDecodeContextHandle();
133 }
134
135 #ifdef _DECODE_PROCESSING_SUPPORTED
IsDownSamplingSupported()136 bool DecodeVp9PipelineAdapterG12::IsDownSamplingSupported()
137 {
138 return m_decoder->IsDownSamplingSupported();
139 }
140 #endif
141