1 /*===================== begin_copyright_notice ================================== 2 3 # Copyright (c) 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_xe_hpm.h 26 //! \brief vphal interface clarification for Xe_HPM 27 //! \details vphal interface clarification for Xe_HPM inlcuding: 28 //! some marcro, enum, structure, function 29 //! 30 #ifndef __VPHAL_XE_HPM_H__ 31 #define __VPHAL_XE_HPM_H__ 32 33 #include "vphal.h" 34 35 //! 36 //! Class VphalStateXe_Hpm 37 //! \brief VPHAL class definition for Xe_HPM 38 //! 39 class VphalStateXe_Hpm : public VphalState 40 { 41 public: 42 //! 43 //! \brief VphalState Constructor 44 //! \details Creates instance of VphalState 45 //! - Caller must call Allocate to allocate all VPHAL states and objects. 46 //! \param [in] pOsInterface 47 //! OS interface, if provided externally - may be NULL 48 //! \param [in,out] pStatus 49 //! Pointer to the MOS_STATUS flag. 50 //! Will assign this flag to MOS_STATUS_SUCCESS if successful, otherwise failed 51 //! VphalStateXe_Hpm(PMOS_INTERFACE pOsInterface,MOS_STATUS * peStatus)52 VphalStateXe_Hpm( 53 PMOS_INTERFACE pOsInterface, 54 MOS_STATUS *peStatus) : 55 VphalState(pOsInterface, peStatus) 56 { 57 // check the peStatus returned from VphalState 58 MOS_STATUS eStatus = peStatus ? (*peStatus) : MOS_STATUS_SUCCESS; 59 60 if (MOS_FAILED(eStatus)) 61 { 62 VPHAL_PUBLIC_ASSERTMESSAGE("VphalStateXe_Hpm construct failed due to VphalState() returned failure: eStatus = %d", eStatus); 63 return; 64 } 65 66 bool bComputeContextEnabled; 67 68 // bComputeContextEnabled is true only if Gen12+. 69 // Gen12+, compute context(MOS_GPU_NODE_COMPUTE, MOS_GPU_CONTEXT_COMPUTE) can be used for render engine. 70 // Before Gen12, we only use MOS_GPU_NODE_3D and MOS_GPU_CONTEXT_RENDER. 71 bComputeContextEnabled = true; 72 73 #if (_DEBUG || _RELEASE_INTERNAL) 74 bool computeContextEnabled = false; 75 MOS_STATUS eRegKeyReadStatus = MOS_STATUS_SUCCESS; 76 eRegKeyReadStatus = ReadUserSettingForDebug( 77 m_userSettingPtr, 78 computeContextEnabled, 79 __VPHAL_ENABLE_COMPUTE_CONTEXT, 80 MediaUserSetting::Group::Sequence); 81 if (eRegKeyReadStatus == MOS_STATUS_SUCCESS) 82 { 83 bComputeContextEnabled = computeContextEnabled ? true : false; 84 } 85 #endif 86 87 if (m_skuTable && !MEDIA_IS_SKU(m_skuTable, FtrCCSNode)) 88 { 89 bComputeContextEnabled = false; 90 } 91 92 if (bComputeContextEnabled) 93 { 94 m_renderGpuContext = MOS_GPU_CONTEXT_COMPUTE; 95 m_renderGpuNode = MOS_GPU_NODE_COMPUTE; 96 } 97 } 98 99 //! 100 //! \brief VphalState Destuctor 101 //! \details Destroys VPHAL and all internal states and objects 102 //! \return VOID 103 //! ~VphalStateXe_Hpm()104 ~VphalStateXe_Hpm() 105 { 106 } 107 108 //! 109 //! \brief Allocate VPHAL Resources 110 //! \details Allocate VPHAL Resources 111 //! - Allocate and initialize HW states 112 //! - Allocate and initialize renderer states 113 //! \param [in] pVpHalSettings 114 //! Pointer to VPHAL Settings 115 //! \return MOS_STATUS 116 //! Return MOS_STATUS_SUCCESS if successful, otherwise failed 117 //! 118 virtual MOS_STATUS Allocate( 119 const VphalSettings *pVpHalSettings) override; 120 121 122 protected: 123 IsRenderContextBasedSchedulingNeeded()124 virtual bool IsRenderContextBasedSchedulingNeeded() override 125 { 126 return true; 127 } 128 129 //! 130 //! \brief Create instance of VphalRenderer 131 //! \details Create instance of VphalRenderer 132 //! \return MOS_STATUS 133 //! Return MOS_STATUS_SUCCESS if successful, otherwise failed 134 //! 135 MOS_STATUS CreateRenderer() override; 136 }; 137 138 #endif // __VPHAL_XE_HPM_H__ 139