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