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