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 media_render_common.h 24 //! \brief Unified media shared rendering definitions 25 //! 26 //! 27 //! \file media_render_common.h 28 //! \brief The header file of common struct/macro definitions shared by low level renderers 29 //! \details eu kernel related funcitons and structs. 30 //! 31 #ifndef __MEDIA_RENDER_COMMON_H__ 32 #define __MEDIA_RENDER_COMMON_H__ 33 34 #include "renderhal.h" 35 36 //! 37 //! \brief VPHAL SS/EU setting 38 //! 39 struct euSetting 40 { 41 uint8_t numSlices; 42 uint8_t numSubSlices; 43 uint8_t numEUs; 44 uint8_t reserved; // Place holder for frequency setting 45 }; 46 const euSetting defaultSSEUTable[8] = 47 {// Slice Sub-Slice EU Rsvd(freq) 48 {2, 3, 8, 0}, 49 }; 50 51 //! 52 //! \class MediaRenderCommon 53 //! \brief Media Render Common Interface 54 //! 55 class MediaRenderCommon 56 { 57 public: 58 59 //! 60 //! \brief Set 2D Surface for HW Access 61 //! \details Common Function for setting up buffer surface state, need to use this function 62 //! if render would use CP HM 63 //! \param [in] pRenderHal 64 //! Pointer to RenderHal Interface Structure 65 //! \param [in] pSurface 66 //! Pointer to Surface 67 //! \param [in] pRenderSurface 68 //! Pointer to Render Surface 69 //! \param [in] pSurfaceParams 70 //! Pointer to RenderHal Surface Params 71 //! \param [in] iBindingTable 72 //! Binding Table to bind surface 73 //! \param [in] iBTEntry 74 //! Binding Table Entry index 75 //! \param [in] bWrite 76 //! Write mode flag 77 //! \return MOS_STATUS 78 //! MOS_STATUS_SUCCESS if success. Error code otherwise 79 //! 80 static MOS_STATUS Set2DSurfaceForHwAccess( 81 PRENDERHAL_INTERFACE pRenderHal, 82 PMOS_SURFACE pSurface, 83 PRENDERHAL_SURFACE pRenderSurface, 84 PRENDERHAL_SURFACE_STATE_PARAMS pSurfaceParams, 85 int32_t iBindingTable, 86 int32_t iBTEntry, 87 bool bWrite); 88 89 //! 90 //! \brief Set the numbers of Slice, Sub-slice, EUs for power mode 91 //! \details Set the numbers of Slice, Sub-slice, EUs recommended for 92 //! the given kernel type for power mode 93 //! \param [in] pRenderHal 94 //! Pointer to RenderHal Interface Structure 95 //! \param [in] KernelID 96 //! render Kernel ID 97 //! \return MOS_STATUS 98 //! MOS_STATUS_SUCCESS if success. Error code otherwise 99 //! 100 static MOS_STATUS SetPowerMode( 101 PRENDERHAL_INTERFACE pRenderHal, 102 uint32_t KernelID); 103 104 //! 105 //! \brief Set 1D Surface for HW Access 106 //! \details Common Function for setting up buffer surface state, need to use this function 107 //! \param [in] pRenderHal 108 //! Pointer to RenderHal Interface Structure 109 //! \param [in] pSurface 110 //! Pointer to Surface 111 //! \param [in] pRenderSurface 112 //! Pointer to Render Surface 113 //! \param [in,out] pSurfaceParams 114 //! Pointer to RenderHal Surface Params 115 //! \param [in] iBindingTable 116 //! Binding Table to Bind Surface 117 //! \param [in] iBTEntry 118 //! Binding Table Entry index 119 //! \param [in] bWrite 120 //! Write mode flag 121 //! \return MOS_STATUS 122 //! MOS_STATUS_SUCCESS if success. Error code otherwise 123 //! 124 static MOS_STATUS Set1DSurfaceForHwAccess( 125 PRENDERHAL_INTERFACE pRenderHal, 126 PMOS_SURFACE pSurface, 127 PRENDERHAL_SURFACE pRenderSurface, 128 PRENDERHAL_SURFACE_STATE_PARAMS pSurfaceParams, 129 int32_t iBindingTable, 130 int32_t iBTEntry, 131 bool bWrite); 132 133 //! 134 //! \brief Submit commands for rendering 135 //! \details Submit commands for rendering. The KMD related fields in pGenericPrologParam might be modified by this 136 //! function in order to maintain the synchronization mechanism for resource. 137 //! \param [in] pRenderHal 138 //! Pointer to RenderHal Interface Structure 139 //! \param [in] pBatchBuffer 140 //! Pointer to batch buffer 141 //! \param [in] bNullRendering 142 //! Indicate whether is Null rendering 143 //! \param [in] pWalkerParams 144 //! Pointer to walker parameters 145 //! \param [in] pGpGpuWalkerParams 146 //! Pointer to GPGPU walker parameters 147 //! \param [in] KernelID 148 //! VP Kernel ID 149 //! \param [in] bLastSubmission 150 //! Is last submission 151 //! \return MOS_STATUS 152 //! 153 static MOS_STATUS EukernelSubmitCommands( 154 PRENDERHAL_INTERFACE pRenderHal, 155 PMHW_BATCH_BUFFER pBatchBuffer, 156 bool bNullRendering, 157 PMHW_WALKER_PARAMS pWalkerParams, 158 PMHW_GPGPU_WALKER_PARAMS pGpGpuWalkerParams, 159 uint32_t KernelID, 160 bool bLastSubmission); 161 162 MEDIA_CLASS_DEFINE_END(MediaRenderCommon) 163 }; 164 165 #endif // __MEDIA_RENDER_COMMON_H__ 166