1 /* 2 * Copyright (c) 2014-2020, 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 mhw_render_g8_X.h 24 //! \brief Defines functions for constructing render engine commands on Gen8-based platforms 25 //! 26 27 #ifndef __MHW_RENDER_G8_X_H__ 28 #define __MHW_RENDER_G8_X_H__ 29 30 #include "mhw_render_generic.h" 31 #include "mhw_render_hwcmd_g8_X.h" 32 #include "mhw_state_heap_g8.h" 33 34 struct MhwRenderInterfaceG8 : public MhwRenderInterfaceGeneric<mhw_render_g8_X> 35 { MhwRenderInterfaceG8MhwRenderInterfaceG836 MhwRenderInterfaceG8( 37 MhwMiInterface *miInterface, 38 PMOS_INTERFACE osInterface, 39 MEDIA_SYSTEM_INFO *gtSystemInfo, 40 uint8_t newStateHeapManagerRequested) : 41 MhwRenderInterfaceGeneric(miInterface, osInterface, gtSystemInfo, newStateHeapManagerRequested) 42 { 43 MHW_FUNCTION_ENTER; 44 45 if (gtSystemInfo == nullptr) 46 { 47 MHW_ASSERTMESSAGE("Invalid input pointer provided"); 48 return; 49 } 50 51 if (gtSystemInfo->EUCount <= 24) 52 { 53 // 64 is the maximum number of URBs for not GT3 54 m_hwCaps.dwMaxURBEntries = 64; 55 } 56 57 // SLM URB DC RO Rest 58 // 0 256 0 0 512 (KB chunks based on GT2) 59 m_l3CacheCntlRegisterValueDefault = 0x80000040; 60 61 InitMmioRegisters(); 62 } 63 ~MhwRenderInterfaceG8MhwRenderInterfaceG864 virtual ~MhwRenderInterfaceG8() { MHW_FUNCTION_ENTER; } 65 66 MOS_STATUS AddMediaVfeCmd( 67 PMOS_COMMAND_BUFFER cmdBuffer, 68 PMHW_VFE_PARAMS params); 69 70 MOS_STATUS AddMediaObject( 71 PMOS_COMMAND_BUFFER cmdBuffer, 72 PMHW_BATCH_BUFFER batchBuffer, 73 PMHW_MEDIA_OBJECT_PARAMS params); 74 75 MOS_STATUS AddMediaObjectWalkerCmd( 76 PMOS_COMMAND_BUFFER cmdBuffer, 77 PMHW_WALKER_PARAMS params); 78 79 MOS_STATUS AddPaletteLoadCmd( 80 PMOS_COMMAND_BUFFER cmdBuffer, 81 PMHW_PALETTE_PARAMS params); 82 83 MOS_STATUS AddGpgpuCsrBaseAddrCmd( 84 PMOS_COMMAND_BUFFER cmdBuffer, 85 PMOS_RESOURCE csrResource); 86 87 MOS_STATUS EnableL3Caching( 88 PMHW_RENDER_ENGINE_L3_CACHE_SETTINGS cacheSettings); 89 90 MOS_STATUS SetL3Cache( 91 PMOS_COMMAND_BUFFER cmdBuffer ); 92 GetL3CacheConfigMhwRenderInterfaceG893 MHW_RENDER_ENGINE_L3_CACHE_CONFIG* GetL3CacheConfig() { return &m_l3CacheConfig; } 94 GetMmioRegistersMhwRenderInterfaceG895 virtual PMHW_MI_MMIOREGISTERS GetMmioRegisters() 96 { 97 return &m_mmioRegisters; 98 } 99 100 //! 101 //! \brief Get AVS sampler state Inc unit 102 //! \details Get AVS sampler state Inc unit 103 //! \return [out] uint32_t 104 //! AVS sampler unit. GetSamplerStateAVSIncUnitMhwRenderInterfaceG8105 virtual uint32_t GetSamplerStateAVSIncUnit() { return MHW_SAMPLER_STATE_AVS_INC_LEGACY; } 106 107 //! 108 //! \brief Get Conv sampler state Inc unit 109 //! \details Get Conv sampler state Inc unit 110 //! \return [out] uint32_t 111 //! Conv sampler unit. GetSamplerStateConvIncUnitMhwRenderInterfaceG8112 virtual uint32_t GetSamplerStateConvIncUnit() { return MHW_SAMPLER_STATE_CONV_INC_LEGACY; } 113 114 //! 115 //! \brief Get the sampler height and width align unit 116 //! \details NV12 format needs the width and height to be a multiple of some unit 117 //! \param [in] bool 118 //! true if AVS sampler, false otherwise 119 //! \param [in, out] uint32_t 120 //! weight align unit 121 //! \param [in, out] uint32_t 122 //! height align unit GetSamplerResolutionAlignUnitMhwRenderInterfaceG8123 virtual void GetSamplerResolutionAlignUnit(bool isAVSSampler, uint32_t &widthAlignUnit, uint32_t &heightAlignUnit) 124 { 125 // NV12 format needs the width and Height to be a multiple 126 // of 4 for both 3D sampler and 8x8 sampler; G75 needs the width 127 // of NV12 input surface to be a multiple of 4 for 3D sampler. 128 widthAlignUnit = MHW_SAMPLER_WIDTH_ALIGN_UNIT_G8; 129 heightAlignUnit = MHW_SAMPLER_HEIGHT_ALIGN_UNIT_G8; 130 } 131 132 133 private: 134 //! \brief Mmio registers address 135 MHW_MI_MMIOREGISTERS m_mmioRegisters = {}; 136 void InitMmioRegisters(); 137 }; 138 139 #endif 140