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