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       renderhal_xe_hp_base.h
26 //! \brief      header file of Xe_XPM+ hardware functions
27 //! \details    Xe_XPM+ hardware functions declare
28 //!
29 #ifndef __RENDERHAL_XE_HP_BASE_H__
30 #define __RENDERHAL_XE_HP_BASE_H__
31 
32 #include <stdint.h>
33 #include "media_class_trace.h"
34 #include "mhw_render.h"
35 #include "mos_defs.h"
36 #include "mos_os_specific.h"
37 #include "renderhal.h"
38 #include "renderhal_g12_base.h"
39 
40 //! \brief      for XeXPM+ VP and MDF
41 //!              SLM     URB     DC      RO      Rest/L3 Client Pool
42 //!               0    96(fixed) 0       0       320 (KB chunks based on GT2)
43 #define RENDERHAL_L3_CACHE_CONFIG_CNTLREG_VALUE_G12HP_RENDERHAL (0x00000200)
44 
45 class XRenderHal_Interface_Xe_Hp_Base : public XRenderHal_Interface_G12_Base
46 {
47 public:
XRenderHal_Interface_Xe_Hp_Base()48     XRenderHal_Interface_Xe_Hp_Base() : XRenderHal_Interface_G12_Base()
49     {
50 
51     }
52 
~XRenderHal_Interface_Xe_Hp_Base()53     virtual ~XRenderHal_Interface_Xe_Hp_Base() {}
54 
55     //!
56     //! \brief    Setup Surface State
57     //! \details  Setup Surface States for Xe_XPM+
58     //! \param    PRENDERHAL_INTERFACE pRenderHal
59     //!           [in] Pointer to Hardware Interface Structure
60     //! \param    PRENDERHAL_SURFACE pRenderHalSurface
61     //!           [in] Pointer to Render Hal Surface
62     //! \param    PRENDERHAL_SURFACE_STATE_PARAMS pParams
63     //!           [in] Pointer to Surface State Params
64     //! \param    int32_t *piNumEntries
65     //!           [out] Pointer to Number of Surface State Entries (Num Planes)
66     //! \param    PRENDERHAL_SURFACE_STATE_ENTRY * ppSurfaceEntries
67     //!           [out] Array of Surface State Entries
68     //! \param    PRENDERHAL_OFFSET_OVERRIDE pOffsetOverride
69     //!           [in] If not nullptr, provides adjustments to Y, UV plane offsets,
70     //!           used for kernel WA in a few cases. nullptr is the most common usage.
71     //! \return   MOS_STATUS
72     //!
73     virtual MOS_STATUS SetupSurfaceState(
74         PRENDERHAL_INTERFACE            pRenderHal,
75         PRENDERHAL_SURFACE              pRenderHalSurface,
76         PRENDERHAL_SURFACE_STATE_PARAMS pParams,
77         int32_t                         *piNumEntries,
78         PRENDERHAL_SURFACE_STATE_ENTRY  *ppSurfaceEntries,
79         PRENDERHAL_OFFSET_OVERRIDE      pOffsetOverride);
80 
81     //!
82     //! \brief      Checks how per thread scratch space size bits in VFE state are interpreted by HW.
83     //! \details    On XeHP, per thread scratch space size can be 2^n (n >= 6) bytes.
84     //! \param      PRENDERHAL_INTERFACE pRenderHal
85     //!             [in]    Pointer to RenderHal interface
86     //! \return     true on XeHP.
87     //!
PerThreadScratchSpaceStart64Byte(RENDERHAL_INTERFACE * renderHal)88     virtual bool PerThreadScratchSpaceStart64Byte(
89         RENDERHAL_INTERFACE *renderHal)
90     {
91         return true;
92     }
93 
94     //! \brief    Check if compute context in use
95     //! \param    PRENDERHAL_INTERFACE    pRenderHal
96     //!           [in]  Pointer to Hardware Interface
97     //! \return   true of false
IsComputeContextInUse(PRENDERHAL_INTERFACE pRenderHal)98     virtual bool IsComputeContextInUse(PRENDERHAL_INTERFACE pRenderHal)
99     {
100         return true;
101     }
102 
103     //!
104     //! \brief    Get Render Engine MMC Enable/Disable Flag
105     //! \param    [in] pRenderHal
106     //!           Pointer to Hardware Interface
107     //! \return   MOS_STATUS
108     //!           MOS_STATUS_SUCCESS if success, else fail reason
109     //!
110     virtual MOS_STATUS IsRenderHalMMCEnabled(
111         PRENDERHAL_INTERFACE         pRenderHal);
112 
113     //!
114     //! \brief    Enables L3 cacheing flag and sets related registers/values
115     //! \param    PRENDERHAL_INTERFACE    pRenderHal
116     //!           [in]  Pointer to Hardware Interface
117     //! \param    pCacheSettings
118     //!           [in] L3 Cache Configurations
119     //! \return   MOS_STATUS
120     //!           MOS_STATUS_SUCCESS if success, else fail reason
121     //!
122     virtual MOS_STATUS EnableL3Caching(
123         PRENDERHAL_INTERFACE         pRenderHal,
124         PRENDERHAL_L3_CACHE_SETTINGS pCacheSettings);
125 
126     //! \brief      Set L3 cache override config parameters
127     //! \param      [in] pRenderHal
128     //!             Pointer to RenderHal Interface Structure
129     //! \param      [in,out] pCacheSettings
130     //!             Pointer to pCacheSettings
131     //! \param      [in] bEnableSLM
132     //!             Flag to enable SLM
133     //! \return     MOS_STATUS
134     //!             MOS_STATUS_SUCCESS if success. Error code otherwise
135     //!
136     virtual MOS_STATUS SetCacheOverrideParams(
137         PRENDERHAL_INTERFACE            pRenderHal,
138         PRENDERHAL_L3_CACHE_SETTINGS    pCacheSettings,
139         bool                            bEnableSLM);
140     //! \brief    Allocates scratch space buffer.
141     //! \details  A single scratch space buffer is allocated and used for all threads since XeHP.
142     virtual MOS_STATUS AllocateScratchSpaceBuffer(
143         uint32_t perThreadScratchSpace,
144         RENDERHAL_INTERFACE *renderHal);
145 
146     //! \brief    Send Compute Walker
147     //! \details  Send Compute Walker
148     //! \param    PRENDERHAL_INTERFACE pRenderHal
149     //!           [in] Pointer to Hardware Interface Structure
150     //! \param    PMOS_COMMAND_BUFFER pCmdBuffer
151     //!           [in] Pointer to Command Buffer
152     //! \param    PRENDERHAL_GPGPU_WALKER_PARAMS pGpGpuWalkerParams
153     //!           [in]    Pointer to GPGPU walker parameters
154     //! \return   MOS_STATUS
155     virtual MOS_STATUS SendComputeWalker(
156         PRENDERHAL_INTERFACE        pRenderHal,
157         PMOS_COMMAND_BUFFER         pCmdBuffer,
158         PMHW_GPGPU_WALKER_PARAMS    pGpGpuWalkerParams);
159 
160     //! \brief    Send To 3DState Binding Table Pool Alloc
161     //! \details  Send To 3DState Binding Table Pool Alloc
162     //! \param    PRENDERHAL_INTERFACE pRenderHal
163     //!           [in] Pointer to RenderHal Interface Structure
164     //! \param    PMOS_COMMAND_BUFFER pCmdBuffer
165     //!           [in] Pointer to Command Buffer
166     //! \return   MOS_STATUS
167     virtual MOS_STATUS SendTo3DStateBindingTablePoolAlloc(
168         PRENDERHAL_INTERFACE        pRenderHal,
169         PMOS_COMMAND_BUFFER         pCmdBuffer);
170 MEDIA_CLASS_DEFINE_END(XRenderHal_Interface_Xe_Hp_Base)
171 };
172 
173 #endif // __RENDERHAL_XE_HP_BASE_H__
174