xref: /aosp_15_r20/external/intel-media-driver/media_driver/agnostic/common/renderhal/renderhal_legacy.h (revision ba62d9d3abf0e404f2022b4cd7a85e107f48596f)
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 //!
23 //! \file      renderhal_legacy.h
24 //! \brief
25 //!
26 //!
27 //! \file     renderhal_legacy.h
28 //! \brief    Render Engine Interfaces shared across platforms
29 //! \details  Platform Independent Hardware Interfaces
30 //!
31 #ifndef __RENDERHAL_LEGACY_H__
32 #define __RENDERHAL_LEGACY_H__
33 
34 #include "renderhal.h"
35 #include "mhw_render_legacy.h"
36 #include "renderhal_dsh.h"
37 #include "cm_hal_hashtable.h"
38 #include "media_perf_profiler.h"
39 
40 // Forward declarations
41 typedef struct _RENDERHAL_INTERFACE_LEGACY  RENDERHAL_INTERFACE_LEGACY, *PRENDERHAL_INTERFACE_LEGACY;
42 
43 //!
44 //! Structure RENDERHAL_SETTINGS_LEGACY
45 //! \brief RenderHal Settings - creation parameters for RenderHal
46 //!
47 typedef struct _RENDERHAL_SETTINGS_LEGACY : _RENDERHAL_SETTINGS
48 {
49     PRENDERHAL_DYN_HEAP_SETTINGS pDynSettings = nullptr; // Dynamic State Heap Settings
50 } RENDERHAL_SETTINGS_LEGACY, *PRENDERHAL_SETTINGS_LEGACY;
51 
52 typedef struct _RENDERHAL_MEDIA_STATE_LEGACY *PRENDERHAL_MEDIA_STATE_LEGACY;
53 
54 typedef struct _RENDERHAL_DYNAMIC_STATE *PRENDERHAL_DYNAMIC_STATE;
55 
56 typedef struct _RENDERHAL_MEDIA_STATE_LEGACY : _RENDERHAL_MEDIA_STATE
57 {
58     PRENDERHAL_DYNAMIC_STATE    pDynamicState = nullptr;                     // Dynamic states (nullptr if DSH not in use)
59 } RENDERHAL_MEDIA_STATE_LEGACY, *PRENDERHAL_MEDIA_STATE_LEGACY;
60 
61 typedef struct _RENDERHAL_STATE_HEAP_LEGACY : _RENDERHAL_STATE_HEAP
62 {
63     CmHashTable                 kernelHashTable;                             // Kernel hash table for faster kernel search
64 } RENDERHAL_STATE_HEAP_LEGACY, *PRENDERHAL_STATE_HEAP_LEGACY;
65 
66 //!
67 // \brief   Hardware dependent render engine interface
68 //!
69 typedef struct _RENDERHAL_INTERFACE_LEGACY : _RENDERHAL_INTERFACE
70 {
71     // MOS/MHW Interfaces
72     MhwRenderInterface            *pMhwRenderInterface = nullptr;
73     RENDERHAL_DYN_HEAP_SETTINGS   DynamicHeapSettings;                       //!< Dynamic State Heap Settings
74 
75     //---------------------------
76     // ISA ASM Debug support functions
77     //---------------------------
78     int32_t (* pfnLoadDebugKernel)(
79             PRENDERHAL_INTERFACE  pRenderHal,
80             PMHW_KERNEL_PARAM     pKernel);
81 
82     MOS_STATUS (* pfnLoadSipKernel) (
83             PRENDERHAL_INTERFACE  pRenderHal,
84             void                  *pSipKernel,
85             uint32_t              dwSipSize);
86 
87     MOS_STATUS (* pfnSendSipStateCmd) (
88             PRENDERHAL_INTERFACE  pRenderHal,
89             PMOS_COMMAND_BUFFER   pCmdBuffer);
90 
91     void (* pfnSetupPrologParams) (
92         PRENDERHAL_INTERFACE             renderHal,
93         RENDERHAL_GENERIC_PROLOG_PARAMS  *prologParams,
94         PMOS_RESOURCE                    osResource,
95         uint32_t                         offset,
96         uint32_t                         tag);
97 
98 } RENDERHAL_INTERFACE_LEGACY, *PRENDERHAL_INTERFACE_LEGACY;
99 
100 //!
101 //! \brief    Create Interface
102 //! \details  Create RenderHal Interface structure, responsible for HW
103 //!           abstraction of HW Rendering Engine for CM(MDF) and VP.
104 //! \param    PRENDERHAL_INTERFACE renderHal
105 //!           [in/out] Pointer to Hardware Interface Structure
106 //! \param    MhwCpInterface* cpInterface
107 //!           [out] Pointer of pointer to MHW CP Interface Structure, which
108 //!           is created during renderhal initialization
109 //! \param    PMOS_INTERFACE osInterface
110 //!           [in] Pointer to OS Interface Structure
111 //! \param    PRENDERHAL_SETTINGS_LEGACY renderHalSettings
112 //!           [in] Pointer to RenderHal Settings
113 //!
114 MOS_STATUS Create_RenderHal_Interface_Legacy(
115     PRENDERHAL_INTERFACE &renderHal,
116     MhwCpInterface       **cpInterface,
117     PMOS_INTERFACE       osInterface,
118     PRENDERHAL_SETTINGS_LEGACY renderHalSettings);
119 
120 //!
121 //! \brief    Destroy Interface
122 //! \details  Create RenderHal Interface structure, responsible for HW
123 //!           abstraction of HW Rendering Engine for CM(MDF) and VP.
124 //! \param    PRENDERHAL_INTERFACE_LEGACY renderHal
125 //!           [in] Pointer to Hardware Interface Structure
126 //!
127 MOS_STATUS Destroy_RenderHal_Interface_Legacy(
128     PRENDERHAL_INTERFACE_LEGACY renderHal);
129 
130 //!
131 //! \brief    Init Interface
132 //! \details  Initializes Render Hal Interface structure, responsible for HW
133 //!           abstraction of Render Engine for MDF/VP
134 //! \param    PRENDERHAL_INTERFACE_LEGACY pRenderHal
135 //!           [in] Pointer to Hardware Interface Structure
136 //! \param    MhwCpInterface** ppCpInterface
137 //!           [in/out] Pointer of pointer to MHW CP Interface Structure, which
138 //!           is created during renderhal initialization
139 //! \param    PMOS_INTERFACE pOsInterface
140 //!           [in] Pointer to OS Interface Structure
141 //! \return   MOS_STATUS
142 //!           MOS_STATUS_UNKNOWN : Invalid parameters
143 //!
144 MOS_STATUS RenderHal_InitInterface_Legacy(
145     PRENDERHAL_INTERFACE_LEGACY pRenderHal,
146     MhwCpInterface              **ppCpInterface,
147     PMOS_INTERFACE              pOsInterface);
148 
149 //!
150 //! \brief    Init Interface using Dynamic State Heap
151 //! \details  Initializes RenderHal Interface structure, responsible for HW
152 //!           abstraction of HW Rendering Engine for CM(MDF) and VP.
153 //! \param    PRENDERHAL_INTERFACE_LEGACY pRenderHal
154 //!           [in] Pointer to RenderHal Interface Structure
155 //! \param    MhwCpInterface** ppCpInterface
156 //!           [in/out] Pointer of pointer to MHW CP Interface Structure, which
157 //!           is created during renderhal initialization
158 //! \param    PMOS_INTERFACE pOsInterface
159 //!           [in] Pointer to OS Interface Structure
160 //! \return   MOS_STATUS
161 //!           MOS_STATUS_UNKNOWN : Invalid parameters
162 //!
163 MOS_STATUS RenderHal_InitInterface_Dynamic(
164     PRENDERHAL_INTERFACE_LEGACY pRenderHal,
165     MhwCpInterface              **ppCpInterface,
166     PMOS_INTERFACE              pOsInterface);
167 
168 //!
169 //! \brief    Init Special Interface
170 //! \details  Initializes RenderHal Interface structure, responsible for HW
171 //!           abstraction of HW Rendering Engine for CM(MDF) and VP.
172 //! \param    PRENDERHAL_INTERFACE pRenderHal
173 //!           [in] Pointer to RenderHal Interface Structure
174 //!
175 void RenderHal_InitInterfaceEx_Legacy(
176     PRENDERHAL_INTERFACE_LEGACY    pRenderHal);
177 
178 int32_t RenderHal_LoadDebugKernel(
179     PRENDERHAL_INTERFACE    pRenderHal,
180     PMHW_KERNEL_PARAM       pSipKernel);
181 
182 MOS_STATUS RenderHal_LoadSipKernel(
183     PRENDERHAL_INTERFACE    pRenderHal,
184     void                    *pSipKernel,
185     uint32_t                dwSipSize);
186 
187 MOS_STATUS RenderHal_SendSipStateCmd(
188     PRENDERHAL_INTERFACE    pRenderHal,
189     PMOS_COMMAND_BUFFER     pCmdBuffer);
190 
191 void RenderHal_SetupPrologParams(
192     PRENDERHAL_INTERFACE              renderHal,
193     RENDERHAL_GENERIC_PROLOG_PARAMS  *prologParams,
194     PMOS_RESOURCE                     osResource,
195     uint32_t                          offset,
196     uint32_t                          tag);
197 
198 #endif // __RENDERHAL_LEGACY_H__
199