1 /*
2 * Copyright (c) 2022, 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 #ifndef __VP_PIPELINE_ADAPTER_LEGACY_H__
23 #define __VP_PIPELINE_ADAPTER_LEGACY_H__
24 
25 #include "vp_pipeline.h"
26 #include "vp_pipeline_common.h"
27 #include "vphal.h"
28 
29 class VpPipelineAdapterLegacy
30 {
31 public:
32     VpPipelineAdapterLegacy(
33         vp::VpPlatformInterface &vpPlatformInterface,
34         MOS_STATUS              &eStatus);
35 
36     //!
37     //! \brief    VpPipelineAdapter Destuctor
38     //! \details  Destroys VpPipelineG12Adapter and all internal states and objects
39     //! \return   void
40     //!
41     virtual ~VpPipelineAdapterLegacy();
42 
43     //!
44     //! \brief    Performs VP Rendering
45     //! \details  Performs VP Rendering
46     //!           - call default render of video
47     //! \param    [in] pcRenderParams
48     //!           Pointer to Render Params
49     //! \return   MOS_STATUS
50     //!           Return MOS_STATUS_SUCCESS if successful, otherwise failed
51     //!
52     virtual MOS_STATUS Render(
53         PCVPHAL_RENDER_PARAMS   pcRenderParams) = 0;
54 
55     //!
56     //! \brief    Allocate VP Resources
57     //! \details  Allocate VP Resources
58     //!           - Allocate and initialize HW states
59     //!           - Allocate and initialize renderer states
60     //! \param    [in] pVpHalSettings
61     //!           Pointer to VPHAL Settings
62     //! \return   MOS_STATUS
63     //!           Return MOS_STATUS_SUCCESS if successful, otherwise failed
64     //!
65     virtual MOS_STATUS Allocate(
66       const VphalSettings     *pVpHalSettings) = 0;
67 
68     //!
69     //! \brief    Get Status Report
70     //! \details  Get Status Report, will return back to app indicating if related frame id is done by gpu
71     //! \param    [out] pQueryReport
72     //!           Pointer to pQueryReport, the status query report array.
73     //! \param    [in] wStatusNum
74     //!           The size of array pQueryReport.
75     //! \return   MOS_STATUS
76     //!           Return MOS_STATUS_SUCCESS if successful, otherwise failed
77     virtual MOS_STATUS GetStatusReport(
78         PQUERY_STATUS_REPORT_APP  pQueryReport,
79         uint16_t                  numStatus) = 0;
80 
81     //!
82     //! \brief    Get feature reporting
83     //! \details  Get feature reporting
84     //! \return   VphalFeatureReport*
85     //!           Pointer to VPHAL_FEATURE_REPOR: rendering features reported
86     //!
87     virtual VphalFeatureReport*       GetRenderFeatureReport() = 0;
88 
89     //!
90     //! \brief  Finish the execution for each frame
91     //! \details Finish the execution for each frame
92     //! \param  [in] params
93     //!         Pointer to PVP_PIPELINE_PARAMS
94     //! \return MOS_STATUS
95     //!         MOS_STATUS_SUCCESS if success, else fail reason
96     //!
97     virtual MOS_STATUS Execute(PVP_PIPELINE_PARAMS params) = 0;
98 
99     virtual void Destroy();
100 
101 protected:
102     //!
103     //! \brief    Allocate VP Resources
104     //! \details  Allocate VP Resources
105     //!           - Allocate and initialize HW states
106     //!           - Allocate and initialize renderer states
107     //! \param    [in] pVpHalSettings
108     //!           Pointer to VPHAL Settings
109     //! \return   MOS_STATUS
110     //!           Return MOS_STATUS_SUCCESS if successful, otherwise failed
111     //!
112     virtual MOS_STATUS Init(
113       const VphalSettings *pVpHalSettings, VP_MHWINTERFACE vpMhwinterface);
114 
115     //!
116     //! \brief  Finish the execution for each frame
117     //! \details Finish the execution for each frame
118     //! \param  [in] params
119     //!         Pointer to PVP_PIPELINE_PARAMS
120     //! \return MOS_STATUS
121     //!         MOS_STATUS_SUCCESS if success, else fail reason
122     //!
123     virtual MOS_STATUS Execute(PVP_PIPELINE_PARAMS params, PRENDERHAL_INTERFACE renderHal);
124 
125     std::shared_ptr<vp::VpPipeline>    m_vpPipeline = {};
126 
127     VP_PIPELINE_PARAMS                 m_vpPipelineParams = {};   //!< vp Pipeline params
128     bool                               m_bApgEnabled = false;    //!< VP APG path enabled
129     vp::VpPlatformInterface            &m_vpPlatformInterface;
130     std::shared_ptr<mhw::vebox::Itf>   m_veboxItf = nullptr;
131 
132 MEDIA_CLASS_DEFINE_END(VpPipelineAdapterLegacy)
133 };
134 #endif // !__VP_PIPELINE_ADAPTER_LEGACY_H__
135 
136