| 1 |
/* |
| 2 |
* Copyright (c) 2017-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 mos_context.h |
| 24 |
//! \brief Container for parameters shared across different GPU contexts of the same device instance |
| 25 |
//! |
| 26 |
|
| 27 |
#ifndef __MOS_CONTEXT_H__ |
| 28 |
#define __MOS_CONTEXT_H__ |
| 29 |
|
| 30 |
#include "mos_os.h" |
| 31 |
|
| 32 |
class OsContext |
| 33 |
{ |
| 34 |
public: |
| 35 |
enum MOS_S3D_CHANNEL |
| 36 |
{ |
| 37 |
MOS_S3D_NONE, //!< Not in 3D mode |
| 38 |
MOS_S3D_LEFT, //!< Left eye channel |
| 39 |
MOS_S3D_RIGHT //!< Right eye channel |
| 40 |
}; |
| 41 |
|
| 42 |
struct MOS_PLANE_OFFSET |
| 43 |
{ |
| 44 |
int iSurfaceOffset; //!< Plane surface offset |
| 45 |
int iXOffset; //!< Tile X offset |
| 46 |
int iYOffset; //!< Tile Y offset |
| 47 |
int iLockSurfaceOffset; //!< Offset in Locked Surface |
| 48 |
}; |
| 49 |
|
| 50 |
protected: |
| 51 |
//! |
| 52 |
//! \brief Constructor for the OsContext |
| 53 |
//! |
| 54 |
OsContext(){}; |
| 55 |
|
| 56 |
public: |
| 57 |
//! |
| 58 |
//! \brief Destructor for the OsContext |
| 59 |
//! |
| 60 |
virtual ~OsContext(){}; |
| 61 |
|
| 62 |
//! |
| 63 |
//! \brief Initialzie the OS Context Object |
| 64 |
//! \return MOS_STATUS_SUCCESS on success case, MOS error status on fail cases |
| 65 |
//! |
| 66 |
virtual MOS_STATUS Init(MOS_CONTEXT* osDriverContext) = 0; |
| 67 |
|
| 68 |
private: |
| 69 |
//! |
| 70 |
//! \brief Destory the OS Context Object, internal function, called by cleanup |
| 71 |
//! |
| 72 |
virtual void Destroy() = 0; |
| 73 |
|
| 74 |
public: |
| 75 |
//! |
| 76 |
//! \brief Static entrypoint, get the OS Context Object |
| 77 |
//! \return the os specific object for OS context |
| 78 |
//! |
| 79 |
static class OsContext* GetOsContextObject(); |
| 80 |
|
| 81 |
//! |
| 82 |
//! \brief Clean up the smartptr |
| 83 |
//! |
| 84 |
void CleanUp(); |
| 85 |
|
| 86 |
//! |
| 87 |
//! \brief Get the adapter info |
| 88 |
//! \return value of m_adapterInfo |
| 89 |
//! |
| 90 |
ADAPTER_INFO *GetAdapterInfo() { return m_pAdapterInfo; }; |
| 91 |
|
| 92 |
//! |
| 93 |
//! \brief Get the skuTable |
| 94 |
//! \return The active SKU Table |
| 95 |
//! |
| 96 |
MEDIA_FEATURE_TABLE *GetSkuTable() { return &m_skuTable; }; |
| 97 |
|
| 98 |
//! |
| 99 |
//! \brief Get the waTable |
| 100 |
//! \return The active WA table |
| 101 |
//! |
| 102 |
MEDIA_WA_TABLE *GetWaTable() { return &m_waTable; }; |
| 103 |
|
| 104 |
//! |
| 105 |
//! \brief Get the platform information string |
| 106 |
//! \return value of m_platformInfo |
| 107 |
//! |
| 108 |
PLATFORM GetPlatformInfo() { return m_platformInfo; }; |
| 109 |
|
| 110 |
//! |
| 111 |
//! \brief Get the gtSystemInfo string |
| 112 |
//! \return value of m_gtSystemInfo |
| 113 |
//! |
| 114 |
MEDIA_SYSTEM_INFO *GetGtSysInfo() { return &m_gtSystemInfo; }; |
| 115 |
|
| 116 |
//! |
| 117 |
//! \brief Get MemDecompState |
| 118 |
//! \return pointer to m_mediaMemDecompState |
| 119 |
//! |
| 120 |
void* GetMemDecompState() { return m_mediaMemDecompState; }; |
| 121 |
|
| 122 |
//! |
| 123 |
//! \brief Check the platform is Atom or not |
| 124 |
//! \return true on Atom platform, false on none Atom platform |
| 125 |
//! |
| 126 |
bool IsAtomSoc() { return m_isAtomSOC; }; |
| 127 |
|
| 128 |
//! |
| 129 |
//! \brief Set the OS Context valid flag |
| 130 |
//! \param [in] isOsContextValid |
| 131 |
//! Flag to indicate if the os context is valid. |
| 132 |
//! |
| 133 |
void SetOsContextValid(bool isOsContextValid) { m_osContextValid = isOsContextValid; }; |
| 134 |
|
| 135 |
//! |
| 136 |
//! \brief Return the OS Context valid flag |
| 137 |
//! \return true if the OS context is valid, false if not valid |
| 138 |
//! |
| 139 |
bool GetOsContextValid() { return m_osContextValid; }; |
| 140 |
|
| 141 |
//! |
| 142 |
//! \brief Set slice count to shared memory and KMD |
| 143 |
//! \param [in,out] pSliceCount |
| 144 |
//! pointer to the slice count. Input the slice count for current |
| 145 |
//! context, output the ruling slice count shared by all contexts. |
| 146 |
//! |
| 147 |
virtual void SetSliceCount(uint32_t *pSliceCount) { MOS_UNUSED(pSliceCount); }; |
| 148 |
|
| 149 |
//! \brief Flag to indicate if implicit tile setting is needed |
| 150 |
bool m_mediaTile64 = false; |
| 151 |
|
| 152 |
//! \brief Flag to indicate if NoGfxMemory needed |
| 153 |
bool m_noGfxMemoryNeeded = false; |
| 154 |
|
| 155 |
protected: |
| 156 |
//! \brief Platform string including product family, chipset family, etc |
| 157 |
PLATFORM m_platformInfo = {}; |
| 158 |
|
| 159 |
//! \brief adapter info |
| 160 |
PADAPTER_INFO m_pAdapterInfo = nullptr; |
| 161 |
|
| 162 |
//! \brief sku table |
| 163 |
MEDIA_FEATURE_TABLE m_skuTable = {}; |
| 164 |
|
| 165 |
//! \brief wa table |
| 166 |
MEDIA_WA_TABLE m_waTable = {}; |
| 167 |
|
| 168 |
//! \brief GT system information, like EU counter, thread count, etc. |
| 169 |
MEDIA_SYSTEM_INFO m_gtSystemInfo = {}; |
| 170 |
|
| 171 |
//! \brief Whether the processor is Atom |
| 172 |
bool m_isAtomSOC = false; |
| 173 |
|
| 174 |
//! \brief Internal media state for memory decompression |
| 175 |
void* m_mediaMemDecompState = nullptr; |
| 176 |
|
| 177 |
//! \brief Flag to mark whether the os context is valid |
| 178 |
bool m_osContextValid = false; |
| 179 |
|
| 180 |
//! \brief Whether or not need deallocation on exit |
| 181 |
bool m_deallocateOnExit = false; |
| 182 |
|
| 183 |
//! \brief need KMD to track the media frame or not |
| 184 |
bool m_enableKmdMediaFrameTracking = false; |
| 185 |
|
| 186 |
//! \brief need KMD to assist the command buffer parsing |
| 187 |
bool m_noParsingAssistanceInKmd = false; |
| 188 |
|
| 189 |
//! \brief how many bytes of the Nal Unit need be included |
| 190 |
uint32_t m_numNalUnitBytesIncluded = 0; |
| 191 |
|
| 192 |
//! \brief For GPU Reset Statistics, rest counter |
| 193 |
uint32_t m_gpuResetCount = 0; |
| 194 |
|
| 195 |
//! \brief For GPU Reset Statistics, the active batch |
| 196 |
uint32_t m_gpuActiveBatch = 0; |
| 197 |
|
| 198 |
//! \brief For GPU Reset Statistics, the pending batch |
| 199 |
uint32_t m_gpuPendingBatch = 0; |
| 200 |
|
| 201 |
//! \brief For Resource addressing, whether patch list mode is active |
| 202 |
bool m_usesPatchList = false; |
| 203 |
|
| 204 |
//! \brief For Resource addressing, whether GPU address mode is active |
| 205 |
bool m_usesGfxAddress = false; |
| 206 |
|
| 207 |
//! \brief For limited GPU VA resource can not be mapped during creation |
| 208 |
bool m_mapOnCreate = false; |
| 209 |
|
| 210 |
//! \brief check whether use inline codec status update or seperate BB |
| 211 |
bool m_inlineCodecStatusUpdate = false; |
| 212 |
|
| 213 |
//! \brief Component info |
| 214 |
MOS_COMPONENT m_component = COMPONENT_UNKNOWN; |
| 215 |
}; |
| 216 |
#endif // #ifndef __MOS_CONTEXT_H__ |