1 /*
2 * Copyright (c) 2024, 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_av1_pipeline_adapter_xe2_hpm.cpp
24 //! \brief Defines the interface to adapt to av1 decode pipeline
25 //!
26
27 #include "decode_av1_pipeline_adapter_xe2_hpm.h"
28 #include "decode_utils.h"
29
DecodeAv1PipelineAdapterXe2_Hpm(CodechalHwInterfaceNext * hwInterface,CodechalDebugInterface * debugInterface)30 DecodeAv1PipelineAdapterXe2_Hpm::DecodeAv1PipelineAdapterXe2_Hpm(
31 CodechalHwInterfaceNext * hwInterface,
32 CodechalDebugInterface *debugInterface)
33 : DecodePipelineAdapter(hwInterface, debugInterface)
34 {
35 DECODE_FUNC_CALL()
36 DECODE_CHK_NULL_NO_STATUS_RETURN(m_osInterface);
37 m_osInterface->pfnVirtualEngineSupported(m_osInterface, true, true);
38 Mos_SetVirtualEngineSupported(m_osInterface, true);
39 }
40
BeginFrame()41 MOS_STATUS DecodeAv1PipelineAdapterXe2_Hpm::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 DecodeAv1PipelineAdapterXe2_Hpm::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 DecodeAv1PipelineAdapterXe2_Hpm::Allocate(CodechalSetting *codecHalSettings)
60 {
61 DECODE_FUNC_CALL()
62 m_decoder = std::make_shared<decode::Av1PipelineXe2_Hpm>(m_hwInterface, m_debugInterface);
63 DECODE_CHK_NULL(m_decoder);
64 return m_decoder->Init(codecHalSettings);
65 }
66
Execute(void * params)67 MOS_STATUS DecodeAv1PipelineAdapterXe2_Hpm::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 DecodeAv1PipelineAdapterXe2_Hpm::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 DecodeAv1PipelineAdapterXe2_Hpm::IsIncompletePicture()
86 {
87 DECODE_FUNC_CALL()
88 return (!m_decoder->IsCompleteBitstream());
89 }
90
91 #ifdef _DECODE_PROCESSING_SUPPORTED
IsDownSamplingSupported()92 bool DecodeAv1PipelineAdapterXe2_Hpm::IsDownSamplingSupported()
93 {
94 DECODE_FUNC_CALL()
95 return m_decoder->IsDownSamplingSupported();
96 }
97 #endif
98
GetDummyReference()99 MOS_SURFACE *DecodeAv1PipelineAdapterXe2_Hpm::GetDummyReference()
100 {
101 DECODE_FUNC_CALL()
102 return m_decoder->GetDummyReference();
103 }
104
GetDummyReferenceStatus()105 CODECHAL_DUMMY_REFERENCE_STATUS DecodeAv1PipelineAdapterXe2_Hpm::GetDummyReferenceStatus()
106 {
107 DECODE_FUNC_CALL()
108 return m_decoder->GetDummyReferenceStatus();
109 }
110
SetDummyReferenceStatus(CODECHAL_DUMMY_REFERENCE_STATUS status)111 void DecodeAv1PipelineAdapterXe2_Hpm::SetDummyReferenceStatus(CODECHAL_DUMMY_REFERENCE_STATUS status)
112 {
113 DECODE_FUNC_CALL()
114 m_decoder->SetDummyReferenceStatus(status);
115 }
116
GetCompletedReport()117 uint32_t DecodeAv1PipelineAdapterXe2_Hpm::GetCompletedReport()
118 {
119 DECODE_FUNC_CALL()
120 return m_decoder->GetCompletedReport();
121 }
122
Destroy()123 void DecodeAv1PipelineAdapterXe2_Hpm::Destroy()
124 {
125 DECODE_FUNC_CALL()
126 m_decoder->Destroy();
127 }
128
GetDecodeContext()129 MOS_GPU_CONTEXT DecodeAv1PipelineAdapterXe2_Hpm::GetDecodeContext()
130 {
131 DECODE_FUNC_CALL()
132 return m_decoder->GetDecodeContext();
133 }
134
GetDecodeContextHandle()135 GPU_CONTEXT_HANDLE DecodeAv1PipelineAdapterXe2_Hpm::GetDecodeContextHandle()
136 {
137 DECODE_FUNC_CALL();
138
139 return m_decoder->GetDecodeContextHandle();
140 }