| 1 | /* |
| 2 | * Copyright (c) 2011-2021, 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_g12_1.cpp |
| 24 | //! \brief implementation of Gen12 DG1 hardware functions |
| 25 | //! \details Render functions |
| 26 | //! |
| 27 | |
| 28 | #include "renderhal_legacy.h" |
| 29 | #include "renderhal_g12_1.h" |
| 30 | #include "mhw_render.h" |
| 31 | #include "mhw_render_g12_X.h" |
| 32 | |
| 33 | //! |
| 34 | //! \brief Enables L3 cacheing flag and sets related registers/values |
| 35 | //! \param PRENDERHAL_INTERFACE pRenderHal |
| 36 | //! [in] Pointer to Hardware Interface |
| 37 | //! \param pCacheSettings |
| 38 | //! [in] L3 Cache Configurations |
| 39 | //! \return MOS_STATUS |
| 40 | //! MOS_STATUS_SUCCESS if success, else fail reason |
| 41 | //! |
| 42 | MOS_STATUS XRenderHal_Interface_G12_1::EnableL3Caching( |
| 43 | PRENDERHAL_INTERFACE pRenderHal, |
| 44 | PRENDERHAL_L3_CACHE_SETTINGS pCacheSettings) |
| 45 | { |
| 46 | MOS_STATUS eStatus; |
| 47 | MHW_RENDER_ENGINE_L3_CACHE_SETTINGS_G12 mHwL3CacheConfig = {}; |
| 48 | PMHW_RENDER_ENGINE_L3_CACHE_SETTINGS pCacheConfig; |
| 49 | MhwRenderInterface *pMhwRender; |
| 50 | PRENDERHAL_INTERFACE_LEGACY pRenderHalLegacy = (PRENDERHAL_INTERFACE_LEGACY)pRenderHal; |
| 51 | |
| 52 | MHW_RENDERHAL_CHK_NULL(pRenderHalLegacy); |
| 53 | pMhwRender = pRenderHalLegacy->pMhwRenderInterface; |
| 54 | MHW_RENDERHAL_CHK_NULL(pMhwRender); |
| 55 | |
| 56 | if (nullptr == pCacheSettings) |
| 57 | { |
| 58 | MHW_RENDERHAL_CHK_STATUS(pMhwRender->EnableL3Caching(nullptr)); |
| 59 | goto finish; |
| 60 | } |
| 61 | |
| 62 | // customize the cache config for renderhal and let mhw_render overwrite it |
| 63 | pCacheConfig = &mHwL3CacheConfig; |
| 64 | |
| 65 | pCacheConfig->dwCntlReg = RENDERHAL_L3_CACHE_CONFIG_CNTLREG_VALUE_G12LP_DG1_RENDERHAL; |
| 66 | |
| 67 | // Override L3 cache configuration |
| 68 | if (pCacheSettings->bOverride) |
| 69 | { |
| 70 | if (pCacheSettings->bCntlRegOverride) |
| 71 | { |
| 72 | pCacheConfig->dwCntlReg = pCacheSettings->dwCntlReg; |
| 73 | } |
| 74 | } |
| 75 | MHW_RENDERHAL_CHK_STATUS(pMhwRender->EnableL3Caching(pCacheConfig)); |
| 76 | |
| 77 | finish: |
| 78 | return eStatus; |
| 79 | } |
| 80 | |
| 81 | //! \brief Set L3 cache override config parameters |
| 82 | //! \param [in] pRenderHal |
| 83 | //! Pointer to RenderHal Interface Structure |
| 84 | //! \param [in,out] pCacheSettings |
| 85 | //! Pointer to pCacheSettings |
| 86 | //! \param [in] bEnableSLM |
| 87 | //! Flag to enable SLM |
| 88 | //! \return MOS_STATUS |
| 89 | //! MOS_STATUS_SUCCESS if success. Error code otherwise |
| 90 | //! |
| 91 | MOS_STATUS XRenderHal_Interface_G12_1::SetCacheOverrideParams( |
| 92 | PRENDERHAL_INTERFACE pRenderHal, |
| 93 | PRENDERHAL_L3_CACHE_SETTINGS pCacheSettings, |
| 94 | bool bEnableSLM) |
| 95 | { |
| 96 | MOS_STATUS eStatus = MOS_STATUS_SUCCESS; |
| 97 | |
| 98 | MHW_RENDERHAL_CHK_NULL(pCacheSettings); |
| 99 | MHW_RENDERHAL_CHK_NULL(pRenderHal); |
| 100 | |
| 101 | pCacheSettings->dwCntlReg = RENDERHAL_L3_CACHE_CONFIG_CNTLREG_VALUE_G12LP_DG1_RENDERHAL; |
| 102 | pCacheSettings->bCntlRegOverride = true; |
| 103 | |
| 104 | finish: |
| 105 | return eStatus; |
| 106 | } |