1 /* 2 * Copyright (c) 2017-2018, 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 mediamemdecomp.h 24 //! \brief Defines data structures and interfaces for media memory decompression. 25 //! \details 26 27 #ifndef __MEDIAMEMORYDECOMP_H__ 28 #define __MEDIAMEMORYDECOMP_H__ 29 30 #include "mos_os.h" 31 32 33 class MediaMemDecompBaseState 34 { 35 public: 36 //! 37 //! \brief Constructor 38 //! MediaMemDecompBaseState()39 MediaMemDecompBaseState() 40 { 41 } 42 43 //! 44 //! \brief Deconstructor 45 //! ~MediaMemDecompBaseState()46 virtual ~MediaMemDecompBaseState() 47 { 48 } 49 50 //! 51 //! \brief Set auxiliary resource 52 //! \details Set auxiliary resource to sync with decompression 53 //! \param [in] resource 54 //! The resource will be used to sync 55 //! 56 //! \return void 57 //! SetDecompSyncRes(MOS_RESOURCE_HANDLE syncResource)58 void SetDecompSyncRes( 59 MOS_RESOURCE_HANDLE syncResource) 60 { 61 m_syncResource = syncResource; 62 } 63 64 //! 65 //! \brief Media memory decompression 66 //! \details Entry point to decompress media memory 67 //! \param targetResource 68 //! [in] The surface will be decompressed 69 //! 70 //! \return MOS_STATUS 71 //! MOS_STATUS_SUCCESS if success, else fail reason 72 //! 73 virtual MOS_STATUS MemoryDecompress( 74 PMOS_RESOURCE targetResource) = 0; 75 76 //! 77 //! \brief Media memory decompression 78 //! \details Entry point to decompress media memory and copy 79 //! \param [in] inputSurface 80 //! The source surface resource 81 //! \param [out] outputSurface 82 //! The target surface resource will be copied to 83 //! \param [in] bOutputCompressed 84 //! true means apply compression on output surface, else output uncompressed surface 85 //! 86 //! \return MOS_STATUS_SUCCESS if succeeded, else error code. 87 //! MediaMemoryCopy(PMOS_RESOURCE inputResource,PMOS_RESOURCE outputResource,bool bOutputCompressed)88 virtual MOS_STATUS MediaMemoryCopy( 89 PMOS_RESOURCE inputResource, 90 PMOS_RESOURCE outputResource, 91 bool bOutputCompressed) 92 { 93 return MOS_STATUS_SUCCESS; 94 } 95 96 //! 97 //! \brief Media memory copy 2D 98 //! \details Entry point to decompress media memory and copy with byte in unit 99 //! \param [in] inputSurface 100 //! The source surface resource 101 //! \param [out] outputSurface 102 //! The target surface resource will be copied to 103 //! \param [in] copyPitch 104 //! The 2D surface pitch 105 //! \param [in] copyHeight 106 //! The 2D surface height 107 //! \param [in] copyInputOffset 108 //! The offset of copied surface from 109 //! \param [in] copyOutputOffset 110 //! The offset of copied to 111 //! \param [in] bpp 112 //! bit per pixel for copied surfaces 113 //! \param [in] bOutputCompressed 114 //! true means apply compression on output surface, else output uncompressed surface 115 //! 116 //! \return MOS_STATUS_SUCCESS if succeeded, else error code. 117 //! MediaMemoryCopy2D(PMOS_RESOURCE inputResource,PMOS_RESOURCE outputResource,uint32_t copyPitch,uint32_t copyHeight,uint32_t copyInputOffset,uint32_t copyOutputOffset,uint32_t bpp,bool bOutputCompressed)118 virtual MOS_STATUS MediaMemoryCopy2D( 119 PMOS_RESOURCE inputResource, 120 PMOS_RESOURCE outputResource, 121 uint32_t copyPitch, 122 uint32_t copyHeight, 123 uint32_t copyInputOffset, 124 uint32_t copyOutputOffset, 125 uint32_t bpp, 126 bool bOutputCompressed) 127 { 128 return MOS_STATUS_SUCCESS; 129 } 130 131 //! 132 //! \brief Media memory tile convert 133 //! \details Convert media between Tile/Linear with decompression 134 //! \param [in] inputSurface 135 //! The source surface resource 136 //! \param [out] outputSurface 137 //! The target surface resource will be copied to 138 //! \param [in] copyWidth 139 //! The 2D surface Width 140 //! \param [in] copyHeight 141 //! The 2D surface height 142 //! \param [in] copyInputOffset 143 //! The offset of copied surface from 144 //! \param [in] copyOutputOffset 145 //! The offset of copied to 146 //! \param [in] isTileToLinear 147 //! Convertion direction, true: tile->linear, false: linear->tile 148 //! \param [in] outputCompressed 149 //! true means apply compression on output surface, else output uncompressed surface 150 //! 151 //! \return MOS_STATUS_SUCCESS if succeeded, else error code. 152 //! MediaMemoryTileConvert(PMOS_RESOURCE inputResource,PMOS_RESOURCE outputResource,uint32_t copyWidth,uint32_t copyHeight,uint32_t copyInputOffset,uint32_t copyOutputOffset,bool isTileToLinear,bool outputCompressed)153 virtual MOS_STATUS MediaMemoryTileConvert( 154 PMOS_RESOURCE inputResource, 155 PMOS_RESOURCE outputResource, 156 uint32_t copyWidth, 157 uint32_t copyHeight, 158 uint32_t copyInputOffset, 159 uint32_t copyOutputOffset, 160 bool isTileToLinear, 161 bool outputCompressed) 162 { 163 return MOS_STATUS_UNIMPLEMENTED; 164 } 165 166 //! 167 //! \brief GetDecompState's mosinterface 168 //! \details get the mosinterface 169 //! \return mosinterface 170 //! 171 virtual PMOS_INTERFACE GetDecompStateMosInterface() = 0; 172 173 MOS_RESOURCE_HANDLE m_syncResource = nullptr; //!> Auxiliary resource to sync with decompression 174 175 MEDIA_CLASS_DEFINE_END(MediaMemDecompBaseState) 176 }; 177 178 #endif // __MEDIAMEMORYDECOMP_H__ 179