1 /* 2 * Copyright (c) 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 memory_policy_manager.h 24 //! \brief Defines interfaces for media memory policy manager. 25 26 27 #ifndef __MEMORY_POLICY_MANAGER_H__ 28 #define __MEMORY_POLICY_MANAGER_H__ 29 30 #include "mos_os.h" 31 32 //! \param [in] skuTable 33 //! The pointer to MEDIA_FEATURE_TABLE 34 //! \param [in] waTable 35 //! The pointer to MEDIA_WA_TABLE 36 //! \param [in, out] resInfo 37 //! The pointer to GMM_RESOURCE_INFO, resource description which gets updated 38 //! \param [in] resName 39 //! The pointer to resource name 40 //! \param [in] uiType 41 //! The pointer to resource type 42 //! \param [in] preferredMemType 43 //! Prefer which type of memory is allocated (device memory, system memory or default setting). 44 struct MemoryPolicyParameter 45 { 46 MEDIA_FEATURE_TABLE *skuTable; 47 MEDIA_WA_TABLE *waTable; 48 GMM_RESOURCE_INFO *resInfo; 49 const char* resName; 50 uint32_t uiType; 51 int preferredMemType; 52 bool isServer; 53 }; 54 55 class MemoryPolicyManager 56 { 57 58 public: 59 60 //! \brief Updates resource memory policy 61 //! 62 //! \details Update memory policy to decide which type of memory is allocated (device memory, system memory or default setting). 63 //! \param [in] memPolicyPar 64 //! The pointer to MemoryPolicyParameter 65 //! 66 //! \return new memory policy 67 static int UpdateMemoryPolicy(MemoryPolicyParameter* memPolicyPar); 68 69 private: 70 71 //! \brief Updates resource memory policy with WA 72 //! 73 //! \details Update memory policy to decide which type of memory is allocated (device memory, system memory or default setting). 74 //! \param [in] memPolicyPar 75 //! The pointer to MemoryPolicyParameter 76 //! 77 //! \param [in/out] mem_type 78 //! The pointer to mem_type 79 80 //! \return new memory policy 81 static int UpdateMemoryPolicyWithWA(MemoryPolicyParameter* memPolicyPar, int& mem_type); 82 83 MEDIA_CLASS_DEFINE_END(MemoryPolicyManager) 84 }; 85 86 87 #endif //__MEMORY_POLICY_MANAGER_H__ 88