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