1 /*
2 * Copyright (c) 2020-2021, 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 #include "vp_pipeline_adapter_xe_hpm.h"
23 #include "vp_platform_interface.h"
24 
VpPipelineAdapterXe_Hpm(PMOS_INTERFACE pOsInterface,PMOS_CONTEXT pOsDriverContext,vp::VpPlatformInterface & vpPlatformInterface,MOS_STATUS & eStatus)25 VpPipelineAdapterXe_Hpm::VpPipelineAdapterXe_Hpm(
26     PMOS_INTERFACE              pOsInterface,
27     PMOS_CONTEXT                pOsDriverContext,
28     vp::VpPlatformInterface     &vpPlatformInterface,
29     MOS_STATUS                  &eStatus) :
30     VphalStateXe_Hpm( pOsInterface, pOsDriverContext, &eStatus),
31     VpPipelineAdapter(vpPlatformInterface, eStatus)
32 {
33     if (MOS_FAILED(eStatus))
34     {
35         MOS_OS_ASSERTMESSAGE("VpPipelineAdapterXe_Hpm construct failed due to base class returned failure: eStatus = %d.", eStatus);
36         MT_ERR1(MT_VP_HAL_PIPELINE, MT_ERROR_CODE, eStatus);
37         return;
38     }
39 }
40 
~VpPipelineAdapterXe_Hpm()41 VpPipelineAdapterXe_Hpm::~VpPipelineAdapterXe_Hpm()
42 {
43 }
44 
Render(PCVPHAL_RENDER_PARAMS pcRenderParams)45 MOS_STATUS VpPipelineAdapterXe_Hpm::Render(PCVPHAL_RENDER_PARAMS pcRenderParams)
46 {
47     VP_FUNC_CALL();
48 
49     MOS_STATUS eStatus = VpPipelineAdapter::Render(pcRenderParams);
50 
51     if (eStatus == MOS_STATUS_SUCCESS)
52     {
53         return eStatus;
54     }
55     else
56     {
57         return VphalStateXe_Hpm::Render(pcRenderParams);
58     }
59 }
60 
Allocate(const VphalSettings * pVpHalSettings)61 MOS_STATUS VpPipelineAdapterXe_Hpm::Allocate(
62     const VphalSettings     *pVpHalSettings)
63 {
64     VP_FUNC_CALL();
65 
66     MOS_STATUS status = VphalStateXe_Hpm::Allocate(pVpHalSettings);
67     if (MOS_FAILED(status))
68     {
69         MT_ERR1(MT_VP_HAL_PIPELINE, MT_ERROR_CODE, status);
70         return status;
71     }
72 
73     VP_MHWINTERFACE vpMhwinterface = {};  //!< vp Mhw Interface
74     status                         = VphalStateXe_Hpm::GetVpMhwInterface(vpMhwinterface);
75     if (MOS_FAILED(status))
76     {
77         MT_ERR1(MT_VP_HAL_PIPELINE, MT_ERROR_CODE, status);
78         return status;
79     }
80     return Init(pVpHalSettings, vpMhwinterface);
81 }
82 
GetStatusReport(PQUERY_STATUS_REPORT_APP pQueryReport,uint16_t numStatus)83 MOS_STATUS VpPipelineAdapterXe_Hpm::GetStatusReport(
84     PQUERY_STATUS_REPORT_APP  pQueryReport,
85     uint16_t                  numStatus)
86 {
87     VP_FUNC_CALL();
88 
89     return VphalStateXe_Hpm::GetStatusReport(pQueryReport, numStatus);
90 }
91 
GetRenderFeatureReport()92 VphalFeatureReport* VpPipelineAdapterXe_Hpm::GetRenderFeatureReport()
93 {
94     VP_FUNC_CALL();
95 
96     if (m_bApgEnabled)
97     {
98         return m_vpPipeline == nullptr ? nullptr : m_vpPipeline->GetFeatureReport();
99     }
100     else
101     {
102         return VphalStateXe_Hpm::GetRenderFeatureReport();
103     }
104 }
105 
Execute(PVP_PIPELINE_PARAMS params)106 MOS_STATUS VpPipelineAdapterXe_Hpm::Execute(PVP_PIPELINE_PARAMS params)
107 {
108     VP_FUNC_CALL();
109 
110     return VpPipelineAdapter::Execute(params, this->m_renderHal);
111 }
112