1 /*
2 * Copyright (c) 2017-2019, 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     vphal_render_composite_g12.h
24 //! \brief    Common interface and structure used in Composite
25 //! \details  Common interface and structure used in Composite
26 //!
27 #ifndef __VPHAL_RENDER_COMPOSITE_G12_H__
28 #define __VPHAL_RENDER_COMPOSITE_G12_H__
29 
30 #include "vphal_render_composite.h"
31 #include "hal_kerneldll.h"
32 #include "renderhal_platform_interface.h"
33 
34 //!
35 //! \brief Class to VPHAL Composite G12 render
36 //!
37 class CompositeStateG12 : virtual public CompositeState
38 {
39 public:
40     //!
41     //! \brief    Composite Constructor
42     //! \details  Construct Composite render and allocate member data structure
43     //! \param    [in] pOsInterface
44     //!           Pointer to MOS interface structure
45     //! \param    [in] pRenderHal
46     //!           Pointer to RenderHal interface structure
47     //! \param    [in] pPerfData
48     //!           Pointer to performance data structure
49     //! \param    [in] compositeCacheCntl
50     //!           Composite Cache Control Data
51     //! \param    [in,out] peStatus
52     //!           Pointer to MOS status
53     //!
CompositeStateG12(PMOS_INTERFACE pOsInterface,PRENDERHAL_INTERFACE pRenderHal,PVPHAL_RNDR_PERF_DATA pPerfData,const VPHAL_COMPOSITE_CACHE_CNTL & compositeCacheCntl,MOS_STATUS * peStatus)54     CompositeStateG12(
55         PMOS_INTERFACE                      pOsInterface,
56         PRENDERHAL_INTERFACE                pRenderHal,
57         PVPHAL_RNDR_PERF_DATA               pPerfData,
58         const VPHAL_COMPOSITE_CACHE_CNTL    &compositeCacheCntl,
59         MOS_STATUS                          *peStatus) :
60         CompositeState(pOsInterface, pRenderHal, pPerfData, compositeCacheCntl, peStatus)
61     {
62         m_bSamplerSupportRotation       = true;     // On Gen9+, Rotation is done in sampler.
63         m_bFallbackIefPatch             = true;
64         m_bKernelSupportDualOutput      = true;
65         m_bKernelSupportHdcDW           = false;
66         m_bAvsTableCoeffExtraEnabled    = true;
67         m_bAvsTableBalancedFilter       = true;
68         m_bApplyTwoLayersCompOptimize   = false;
69         m_bYV12iAvsScaling              = true;     // On Gen9+, iAVS scaling can support YV12 input format
70         m_bEnableSamplerLumakey         = true;
71 
72         if (!peStatus)
73         {
74             VPHAL_PUBLIC_ASSERTMESSAGE("Got null peStatus!");
75             return;
76         }
77 
78         if (*peStatus != MOS_STATUS_SUCCESS)
79         {
80             // super class constructor failed, return directly
81             return;
82         }
83         m_AvsCoeffsCache.Init(POLYPHASE_Y_COEFFICIENT_TABLE_SIZE_G10, POLYPHASE_UV_COEFFICIENT_TABLE_SIZE_G10);
84         *peStatus = VpHal_RndrCommonInitAVSParams(&m_AvsParameters,
85                                                   POLYPHASE_Y_COEFFICIENT_TABLE_SIZE_G10,
86                                                   POLYPHASE_UV_COEFFICIENT_TABLE_SIZE_G10);
87     }
88 
89     //!
90     //! \brief    Composite render Destructor
91     //! \details  Destroy Composite render and release all related RenderState resources
92     //!
~CompositeStateG12()93     virtual ~CompositeStateG12()
94     {
95     }
96 
97 protected:
98     //!
99     //! \brief    Override Static Data
100     //! \details  Override Static Data
101     //! \param    [in] pRenderingData
102     //!           Pointer to REnder Data
103     //! \param    [in] pTarget
104     //!           Pointer to Target Surface
105     //! \param    [in,out] pStatic
106     //!           Pointer to Static Data
107     //! \return   VOID
108     //!
109     virtual void SubmitStatesFillGenSpecificStaticData(
110         PVPHAL_RENDERING_DATA_COMPOSITE     pRenderingData,
111         PVPHAL_SURFACE                      pTarget,
112         MEDIA_OBJECT_KA2_STATIC_DATA        *pStatic);
113 
114     //!
115     //! \brief    Judge whether Bob Di should be enabled
116     //! \details  Judge whether Bob Di should be enabled according to the parameter
117     //!           of pDeinterlaceParams and the height of the input surface
118     //! \param    [in] pSrc
119     //!           Pointer to Source Surface
120     //! \return   bool
121     //!           Return true if Bob DI should be enabled, otherwise false
122     //!
123     virtual bool IsBobDiEnabled(PVPHAL_SURFACE pSrc);
124 
125     //!
126     //! \brief    Initialize Composite render
127     //! \param    [in] pSettings
128     //!           Pointer to VPHAL Settings
129     //! \param    [in] pKernelDllState
130     //!           Pointer to KernelDLL State
131     //! \return   MOS_STATUS
132     //!           Return MOS_STATUS_SUCCESS if successful
133     //!
Initialize(const VphalSettings * pSettings,Kdll_State * pKernelDllState)134     virtual MOS_STATUS Initialize(
135         const VphalSettings    *pSettings,
136         Kdll_State             *pKernelDllState)
137     {
138         // Set CMFC extension Kdll function pointers
139         KernelDll_SetupFunctionPointers_Ext(pKernelDllState);
140 
141         return CompositeState::Initialize(pSettings, pKernelDllState);
142     }
143 
144     virtual bool IsDisableAVSSampler(
145         int32_t         iSources,
146         bool            isTargetY);
147 };
148 
149 #endif // __VPHAL_RENDER_COMPOSITE_G12_H__
150