1 /*===================== begin_copyright_notice ==================================
2 
3 # Copyright (c) 2020-2021, Intel Corporation
4 
5 # Permission is hereby granted, free of charge, to any person obtaining a
6 # copy of this software and associated documentation files (the "Software"),
7 # to deal in the Software without restriction, including without limitation
8 # the rights to use, copy, modify, merge, publish, distribute, sublicense,
9 # and/or sell copies of the Software, and to permit persons to whom the
10 # Software is furnished to do so, subject to the following conditions:
11 
12 # The above copyright notice and this permission notice shall be included
13 # in all copies or substantial portions of the Software.
14 
15 # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
16 # OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
18 # THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
19 # OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
20 # ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
21 # OTHER DEALINGS IN THE SOFTWARE.
22 
23 ======================= end_copyright_notice ==================================*/
24 //!
25 //! \file     vphal_render_composite_xe_xpm.h
26 //! \brief    Common interface and structure used in Composite
27 //! \details  Common interface and structure used in Composite
28 //!
29 #ifndef __VPHAL_RENDER_COMPOSITE_XE_XPM_H__
30 #define __VPHAL_RENDER_COMPOSITE_XE_XPM_H__
31 
32 #include "vphal_render_composite.h"
33 #include "hal_kerneldll.h"
34 #include "renderhal_platform_interface.h"
35 #include "vphal_render_composite_g12.h"
36 //!
37 //! \brief Class to VPHAL Composite G12HP render
38 //!
39 class CompositeStateXe_Xpm : virtual public CompositeStateG12
40 {
41 public:
42     //!
43     //! \brief    Composite Constructor
44     //! \details  Construct Composite render and allocate member data structure
45     //! \param    [in] pOsInterface
46     //!           Pointer to MOS interface structure
47     //! \param    [in] pRenderHal
48     //!           Pointer to RenderHal interface structure
49     //! \param    [in] pPerfData
50     //!           Pointer to performance data structure
51     //! \param    [in] compositeCacheCntl
52     //!           Composite Cache Control Data
53     //! \param    [in,out] peStatus
54     //!           Pointer to MOS status
55     //!
CompositeStateXe_Xpm(PMOS_INTERFACE pOsInterface,PRENDERHAL_INTERFACE pRenderHal,PVPHAL_RNDR_PERF_DATA pPerfData,const VPHAL_COMPOSITE_CACHE_CNTL & compositeCacheCntl,MOS_STATUS * peStatus)56     CompositeStateXe_Xpm (
57         PMOS_INTERFACE                      pOsInterface,
58         PRENDERHAL_INTERFACE                pRenderHal,
59         PVPHAL_RNDR_PERF_DATA               pPerfData,
60         const VPHAL_COMPOSITE_CACHE_CNTL    &compositeCacheCntl,
61         MOS_STATUS                          *peStatus) :
62         CompositeState(pOsInterface, pRenderHal, pPerfData, compositeCacheCntl, peStatus),
63         CompositeStateG12(pOsInterface, pRenderHal, pPerfData, compositeCacheCntl, peStatus)
64     {
65         if ((pRenderHal == nullptr) && (peStatus != nullptr))
66         {
67             *peStatus = MOS_STATUS_NULL_POINTER;
68              return;
69         }
70         m_bFtrComputeWalker             = pRenderHal->pRenderHalPltInterface->IsComputeContextInUse(pRenderHal);
71 
72         if (m_bFtrComputeWalker)
73         {
74             m_need3DSampler = true;
75         }
76     }
77 
78     //!
79     //! \brief    Composite render Destructor
80     //! \details  Destroy Composite render and release all related RenderState resources
81     //!
~CompositeStateXe_Xpm()82     virtual ~CompositeStateXe_Xpm()
83     {
84     }
85 
86 protected:
87 
88     //!
89     //! \brief    Get Sampler Index associated with a surface state for composite
90     //! \param    [in] pSurface
91     //!           point to input Surface
92     //! \param    [in] pEntry
93     //!           Pointer to Surface state
94     //! \param    [out] pSamplerIndex
95     //!           Pointer to Sampler Index
96     //! \param    [out] pSamplerType
97     //!           Pointer to Sampler Type
98     //! \return   MOS_STATUS
99     //!           Return MOS_STATUS_SUCCESS if successful, otherwise MOS_STATUS_UNKNOWN
100     //!
101     virtual MOS_STATUS GetSamplerIndex(
102         PVPHAL_SURFACE                      pSurface,
103         PRENDERHAL_SURFACE_STATE_ENTRY      pEntry,
104         int32_t*                            pSamplerIndex,
105         PMHW_SAMPLER_TYPE                   pSamplerType) override;
106 
107     //!
108     //! \brief    Check whether the 3Dsampler use for Y plane
109     //! \param    [in] SamplerID
110     //!           sampler ID
111     //! \return   bool
112     //!           Return true if the 3Dsampler use for Y plane, otherwise fase
113     //!
114     virtual bool IsSamplerIDForY(
115         int32_t                            SamplerID) override;
116 
117     //!
118     //! \brief    set Sampler status
119     //! \param    [in] pSurface
120     //!           input Surface
121     //! \param    [in] Layer
122     //!           composition layer
123     //! \param    [in] pStatic
124     //!           Pointer to static data
125     //! \return   MOS_STATUS
126     //!           Return MOS_STATUS_SUCCESS if successful, otherwise MOS_STATUS_UNKNOWN
127     //!
128     virtual MOS_STATUS Set3DSamplerStatus(
129         PVPHAL_SURFACE                 pSurface,
130         uint8_t                        Layer,
131         MEDIA_OBJECT_KA2_STATIC_DATA   *pStatic) override;
132 
133     //!
134     //! \brief    update Inline Data status
135     //! \param    [in] pSurface
136     //!           input Surface
137     //! \param    [in] pStatic
138     //!           Pointer to static data
139     //! \return   MOS_STATUS
140     //!           Return MOS_STATUS_SUCCESS if successful, otherwise MOS_STATUS_UNKNOWN
141     //!
142     virtual MOS_STATUS UpdateInlineDataStatus(
143        PVPHAL_SURFACE                 pSurface,
144        MEDIA_OBJECT_KA2_STATIC_DATA   *pStatic) override;
145 
146     //!
147     //! \brief    Get intermediate surface output
148     //! \param    pOutput
149     //!           [in] Pointer to Intermediate Output Surface
150     //! \return   PVPHAL_SURFACE
151     //!           Return the chose output
152     //!
153     virtual MOS_STATUS GetIntermediateOutput(PVPHAL_SURFACE &output) override;
154 
155     //!
156     //! \brief    Decompress the Surface
157     //! \details  Decompress the interlaced Surface which is in the RC compression mode
158     //! \param    [in,out] pSource
159     //!           Pointer to Source Surface
160     //! \return   MOS_STATUS
161     //!           Return MOS_STATUS_SUCCESS if successful, otherwise failed
162     //!
163     virtual MOS_STATUS DecompressInterlacedSurf(PVPHAL_SURFACE pSource) override;
164 
165     //!
166     //! \brief    Update SamplerStateParams associated with a surface state for composite
167     //! \param    [in] pSamplerStateParams
168     //!           Pointer to SamplerStateParams
169     //! \param    [in] pEntry
170     //!           Pointer to Surface state
171     //! \param    [in] pRenderData
172     //!           Pointer to RenderData
173     //! \param    [in] uLayerNum
174     //!           Layer total number
175     //! \param    [in] SamplerFilterMode
176     //!           SamplerFilterMode to be set
177     //! \param    [out] pSamplerIndex
178     //!           Pointer to Sampler Index
179     //! \param    [out] pSurface
180     //!           point to Surface
181     //! \return   MOS_STATUS
182     //!           Return MOS_STATUS_SUCCESS if successful, otherwise MOS_STATUS_UNKNOWN
183     //!
184     virtual MOS_STATUS SetSamplerFilterMode(
185         PMHW_SAMPLER_STATE_PARAM       &pSamplerStateParams,
186         PRENDERHAL_SURFACE_STATE_ENTRY  pEntry,
187         PVPHAL_RENDERING_DATA_COMPOSITE pRenderData,
188         uint32_t                        uLayerNum,
189         MHW_SAMPLER_FILTER_MODE         SamplerFilterMode,
190         int32_t                        *pSamplerIndex,
191         PVPHAL_SURFACE                  pSource) override;
192 };
193 
194 #endif // __VPHAL_RENDER_COMPOSITE_XE_XPM_H__
195