1 /* 2 * Copyright (c) 2018-2022, 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 //! 24 //! \file media_mem_compression.h 25 //! \brief Defines the common interface for mmc 26 //! \details 27 //! 28 29 #ifndef __MEDIA_MEM_COMPRESSION_H__ 30 #define __MEDIA_MEM_COMPRESSION_H__ 31 32 #include "mos_os.h" 33 #include "mos_os_specific.h" 34 35 class MediaMemComp 36 { 37 public: 38 //! 39 //! \brief Construct 40 //! 41 MediaMemComp(PMOS_INTERFACE osInterface); 42 43 //! 44 //! \brief Deconstructor 45 //! ~MediaMemComp()46 virtual ~MediaMemComp() 47 { 48 } 49 50 //! 51 //! \brief SendPrologCmd 52 //! SendPrologCmd(PMOS_COMMAND_BUFFER cmdBuffer,bool bRcsIsUsed)53 virtual MOS_STATUS SendPrologCmd( 54 PMOS_COMMAND_BUFFER cmdBuffer, 55 bool bRcsIsUsed) 56 { 57 return MOS_STATUS_SUCCESS; 58 }; 59 60 //! 61 //! \brief SetSurfaceMmcState 62 //! 63 virtual MOS_STATUS SetSurfaceMmcState( 64 PMOS_SURFACE surface); 65 66 //! 67 //! \brief SetSurfaceMmcMode 68 //! 69 virtual MOS_STATUS SetSurfaceMmcMode( 70 PMOS_SURFACE surface); 71 72 //! 73 //! \brief SetSurfaceMmcFormat 74 //! 75 virtual MOS_STATUS SetSurfaceMmcFormat( 76 PMOS_SURFACE surface); 77 78 //! 79 //! \brief GetSurfaceMmcState 80 //! 81 virtual MOS_STATUS GetSurfaceMmcState( 82 PMOS_SURFACE surface, 83 MOS_MEMCOMP_STATE *mmcMode); 84 85 virtual MOS_STATUS GetSurfaceMmcFormat( 86 PMOS_SURFACE surface, 87 uint32_t * mmcFormat); 88 89 //! 90 //! \brief GetResourceMmcState 91 //! 92 virtual MOS_STATUS GetResourceMmcState( 93 PMOS_RESOURCE resource, 94 MOS_MEMCOMP_STATE &mmcMode); 95 96 //! 97 //! \brief GetResourceMmcFormat 98 //! 99 virtual MOS_STATUS GetResourceMmcFormat( 100 PMOS_RESOURCE resource, 101 uint32_t &mmcFormat); 102 103 //! 104 //! \brief IsMmcEnabled 105 //! 106 virtual bool IsMmcEnabled(); 107 108 //! 109 //! \brief DisableMmc 110 //! 111 void DisableMmc(); 112 113 //! 114 //! \brief InitMmcEnabled 115 //! 116 MOS_STATUS InitMmcEnabled(); 117 118 //! 119 //! \brief Decompress Resources 120 //! 121 MOS_STATUS DecompressResource(PMOS_RESOURCE resource); 122 123 //! 124 //! \brief IsCompressibleSurfaceAllocable 125 //! 126 bool IsCompressibelSurfaceSupported(); 127 128 protected: 129 //! 130 //! \brief UpdateMmcInUseFeature 131 //! 132 virtual MOS_STATUS UpdateMmcInUseFeature(); 133 134 private: 135 //! 136 //! \brief IsMmcFeatureEnabled 137 //! 138 bool IsMmcFeatureEnabled(); 139 140 protected: 141 PMOS_INTERFACE m_osInterface = nullptr; 142 bool m_mmcEnabled = false; 143 bool m_isCompSurfAllocable = false; 144 bool m_bComponentMmcEnabled = false; 145 std::string m_mmcEnabledKey; 146 std::string m_mmcInUseKey; 147 MediaUserSettingSharedPtr m_userSettingPtr = nullptr; 148 MEDIA_CLASS_DEFINE_END(MediaMemComp) 149 }; 150 151 #endif //__MEDIA_MEM_COMPRESSION_H__