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