| 1 |
/* |
| 2 |
* Copyright (c) 2009-2023, 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_os_specific.h |
| 24 |
//! \brief Common interface and structure used in MOS LINUX OS |
| 25 |
//! |
| 26 |
|
| 27 |
#ifndef __MOS_OS_SPECIFIC_H__ |
| 28 |
#define __MOS_OS_SPECIFIC_H__ |
| 29 |
#include "mos_defs.h" |
| 30 |
#include "media_fourcc.h" |
| 31 |
#include "media_skuwa_specific.h" |
| 32 |
#include "GmmLib.h" |
| 33 |
#include "mos_resource_defs.h" |
| 34 |
#include "mos_os_hw.h" |
| 35 |
#include "mos_utilities.h" |
| 36 |
#ifdef ANDROID |
| 37 |
#include <utils/Log.h> |
| 38 |
#endif |
| 39 |
#include "mos_bufmgr.h" |
| 40 |
#include <vector> |
| 41 |
|
| 42 |
typedef unsigned int MOS_OS_FORMAT; |
| 43 |
|
| 44 |
class GraphicsResource; |
| 45 |
class GraphicsResourceNext; |
| 46 |
class AuxTableMgr; |
| 47 |
class MosOcaInterface; |
| 48 |
class GraphicsResourceNext; |
| 49 |
|
| 50 |
//////////////////////////////////////////////////////////////////// |
| 51 |
extern PerfUtility *g_perfutility; |
| 52 |
|
| 53 |
#define PERF_DECODE "DECODE" |
| 54 |
#define PERF_ENCODE "ENCODE" |
| 55 |
#define PERF_VP "VP" |
| 56 |
#define PERF_CP "CP" |
| 57 |
#define PERF_MOS "MOS" |
| 58 |
|
| 59 |
#define PERF_LEVEL_DDI "DDI" |
| 60 |
#define PERF_LEVEL_HAL "HAL" |
| 61 |
|
| 62 |
#define DECODE_DDI (1) |
| 63 |
#define DECODE_HAL (1 << 1) |
| 64 |
#define ENCODE_DDI (1 << 4) |
| 65 |
#define ENCODE_HAL (1 << 5) |
| 66 |
#define VP_DDI (1 << 8) |
| 67 |
#define VP_HAL (1 << 9) |
| 68 |
#define CP_DDI (1 << 12) |
| 69 |
#define CP_HAL (1 << 13) |
| 70 |
#define MOS_DDI (1 << 16) |
| 71 |
#define MOS_HAL (1 << 17) |
| 72 |
|
| 73 |
#define PERFUTILITY_IS_ENABLED(sCOMP,sLEVEL) \ |
| 74 |
(((sCOMP == "DECODE" && sLEVEL == "DDI") && (g_perfutility->dwPerfUtilityIsEnabled & DECODE_DDI)) || \ |
| 75 |
((sCOMP == "DECODE" && sLEVEL == "HAL") && (g_perfutility->dwPerfUtilityIsEnabled & DECODE_HAL)) || \ |
| 76 |
((sCOMP == "ENCODE" && sLEVEL == "DDI") && (g_perfutility->dwPerfUtilityIsEnabled & ENCODE_DDI)) || \ |
| 77 |
((sCOMP == "ENCODE" && sLEVEL == "HAL") && (g_perfutility->dwPerfUtilityIsEnabled & ENCODE_HAL)) || \ |
| 78 |
((sCOMP == "VP" && sLEVEL == "DDI") && (g_perfutility->dwPerfUtilityIsEnabled & VP_DDI)) || \ |
| 79 |
((sCOMP == "VP" && sLEVEL == "HAL") && (g_perfutility->dwPerfUtilityIsEnabled & VP_HAL)) || \ |
| 80 |
((sCOMP == "CP" && sLEVEL == "DDI") && (g_perfutility->dwPerfUtilityIsEnabled & CP_DDI)) || \ |
| 81 |
((sCOMP == "CP" && sLEVEL == "HAL") && (g_perfutility->dwPerfUtilityIsEnabled & CP_HAL)) || \ |
| 82 |
((sCOMP == "MOS" && sLEVEL == "DDI") && (g_perfutility->dwPerfUtilityIsEnabled & MOS_DDI)) || \ |
| 83 |
((sCOMP == "MOS" && sLEVEL == "HAL") && (g_perfutility->dwPerfUtilityIsEnabled & MOS_HAL))) |
| 84 |
|
| 85 |
#define PERF_UTILITY_START(TAG,COMP,LEVEL) \ |
| 86 |
do \ |
| 87 |
{ \ |
| 88 |
if (PERFUTILITY_IS_ENABLED((std::string)COMP,(std::string)LEVEL)) \ |
| 89 |
{ \ |
| 90 |
g_perfutility->startTick(TAG); \ |
| 91 |
} \ |
| 92 |
} while(0) |
| 93 |
|
| 94 |
#define PERF_UTILITY_STOP(TAG, COMP, LEVEL) \ |
| 95 |
do \ |
| 96 |
{ \ |
| 97 |
if (PERFUTILITY_IS_ENABLED((std::string)COMP,(std::string)LEVEL)) \ |
| 98 |
{ \ |
| 99 |
g_perfutility->stopTick(TAG); \ |
| 100 |
} \ |
| 101 |
} while (0) |
| 102 |
|
| 103 |
static int perf_count_start = 0; |
| 104 |
static int perf_count_stop = 0; |
| 105 |
|
| 106 |
#define PERF_UTILITY_START_ONCE(TAG, COMP,LEVEL) \ |
| 107 |
do \ |
| 108 |
{ \ |
| 109 |
if (perf_count_start == 0 \ |
| 110 |
&& PERFUTILITY_IS_ENABLED((std::string)COMP,(std::string)LEVEL)) \ |
| 111 |
{ \ |
| 112 |
g_perfutility->startTick(TAG); \ |
| 113 |
} \ |
| 114 |
perf_count_start++; \ |
| 115 |
} while(0) |
| 116 |
|
| 117 |
#define PERF_UTILITY_STOP_ONCE(TAG, COMP, LEVEL) \ |
| 118 |
do \ |
| 119 |
{ \ |
| 120 |
if (perf_count_stop == 0 \ |
| 121 |
&& PERFUTILITY_IS_ENABLED((std::string)COMP,(std::string)LEVEL)) \ |
| 122 |
{ \ |
| 123 |
g_perfutility->stopTick(TAG); \ |
| 124 |
} \ |
| 125 |
perf_count_stop++; \ |
| 126 |
} while (0) |
| 127 |
|
| 128 |
#define PERF_UTILITY_AUTO(TAG,COMP,LEVEL) AutoPerfUtility apu(TAG,COMP,LEVEL) |
| 129 |
|
| 130 |
#define PERF_UTILITY_PRINT \ |
| 131 |
do \ |
| 132 |
{ \ |
| 133 |
if (g_perfutility->dwPerfUtilityIsEnabled && MosUtilities::MosIsProfilerDumpEnabled()) \ |
| 134 |
{ \ |
| 135 |
g_perfutility->savePerfData(); \ |
| 136 |
} \ |
| 137 |
} while(0) |
| 138 |
|
| 139 |
class AutoPerfUtility |
| 140 |
{ |
| 141 |
public: |
| 142 |
AutoPerfUtility(std::string tag, std::string comp, std::string level) |
| 143 |
{ |
| 144 |
if (PERFUTILITY_IS_ENABLED(comp, level)) |
| 145 |
{ |
| 146 |
g_perfutility->startTick(tag); |
| 147 |
autotag = tag; |
| 148 |
bEnable = true; |
| 149 |
} |
| 150 |
} |
| 151 |
~AutoPerfUtility() |
| 152 |
{ |
| 153 |
if (bEnable) |
| 154 |
{ |
| 155 |
g_perfutility->stopTick(autotag); |
| 156 |
} |
| 157 |
} |
| 158 |
|
| 159 |
private: |
| 160 |
bool bEnable = false; |
| 161 |
std::string autotag ="intialized"; |
| 162 |
}; |
| 163 |
|
| 164 |
//////////////////////////////////////////////////////////////////// |
| 165 |
|
| 166 |
typedef void* HINSTANCE; |
| 167 |
|
| 168 |
#define Mos_InitInterface(osInterface, osDriverContext, component) \ |
| 169 |
Mos_InitOsInterface(osInterface, osDriverContext, component) |
| 170 |
|
| 171 |
#define Mos_ResourceIsNull(resource) MosInterface::MosResourceIsNull(resource) |
| 172 |
|
| 173 |
#define GMM_LIBVA_LINUX 3 |
| 174 |
|
| 175 |
enum DdiSurfaceFormat |
| 176 |
{ |
| 177 |
DDI_FORMAT_UNKNOWN = 0, |
| 178 |
DDI_FORMAT_A8B8G8R8 = 32, |
| 179 |
DDI_FORMAT_X8B8G8R8 = 33, |
| 180 |
DDI_FORMAT_A8R8G8B8 = 21, |
| 181 |
DDI_FORMAT_X8R8G8B8 = 22, |
| 182 |
DDI_FORMAT_R5G6B5 = 23, |
| 183 |
DDI_FORMAT_YUY2 = MAKEFOURCC('Y', 'U', 'Y', '2'), |
| 184 |
DDI_FORMAT_P8 = 41, |
| 185 |
DDI_FORMAT_A8P8 = 40, |
| 186 |
DDI_FORMAT_A8 = 28, |
| 187 |
DDI_FORMAT_L8 = 50, |
| 188 |
DDI_FORMAT_L16 = 81, |
| 189 |
DDI_FORMAT_A4L4 = 52, |
| 190 |
DDI_FORMAT_A8L8 = 51, |
| 191 |
DDI_FORMAT_R32F = 114, |
| 192 |
DDI_FORMAT_V8U8 = 60, |
| 193 |
DDI_FORMAT_UYVY = MAKEFOURCC('U', 'Y', 'V', 'Y'), |
| 194 |
DDI_FORMAT_NV12 = MAKEFOURCC('N', 'V', '1', '2'), |
| 195 |
DDI_FORMAT_A16B16G16R16 = 36, |
| 196 |
DDI_FORMAT_R32G32B32A32F = 115, |
| 197 |
}; |
| 198 |
|
| 199 |
#define INDIRECT_HEAP_SIZE_UNITS (1024) |
| 200 |
|
| 201 |
/* copy from intcver.h */ |
| 202 |
#ifndef BUILD_NUMBER |
| 203 |
#define BUILD_NUMBER 9034 |
| 204 |
#endif |
| 205 |
|
| 206 |
#define COMMAND_BUFFER_RESERVED_SPACE 0x80 |
| 207 |
|
| 208 |
#define RtlEqualMemory(Destination,Source,Length) (!memcmp((Destination),(Source),(Length))) |
| 209 |
|
| 210 |
//////////////////////////////////////////////////////////////////// |
| 211 |
|
| 212 |
//! |
| 213 |
//! \brief Definitions specific to Linux |
| 214 |
//! |
| 215 |
#define COMMAND_BUFFER_SIZE 32768 |
| 216 |
|
| 217 |
#define MAX_CMD_BUF_NUM 30 |
| 218 |
|
| 219 |
#define MOS_LOCKFLAG_WRITEONLY OSKM_LOCKFLAG_WRITEONLY |
| 220 |
#define MOS_LOCKFLAG_READONLY OSKM_LOCKFLAG_READONLY |
| 221 |
#define MOS_LOCKFLAG_NOOVERWRITE OSKM_LOCKFLAG_NOOVERWRITE |
| 222 |
#define MOS_LOCKFLAG_NO_SWIZZLE OSKM_LOCKFLAG_NO_SWIZZLE |
| 223 |
|
| 224 |
#define MOS_DIR_SEPERATOR '/' |
| 225 |
|
| 226 |
#define MOS_INVALID_ALLOC_INDEX -1 |
| 227 |
#define MOS_MAX_REGS 128 //32 |
| 228 |
#ifdef ANDROID |
| 229 |
#define MOS_STATUS_REPORT_DEFAULT 0 |
| 230 |
#else |
| 231 |
#define MOS_STATUS_REPORT_DEFAULT 1 |
| 232 |
#endif |
| 233 |
|
| 234 |
#define OSKM_LOCKFLAG_WRITEONLY 0x00000001 |
| 235 |
#define OSKM_LOCKFLAG_READONLY 0x00000002 |
| 236 |
#define OSKM_LOCKFLAG_NOOVERWRITE 0x00000004 |
| 237 |
#define OSKM_LOCKFLAG_NO_SWIZZLE 0x00000008 |
| 238 |
|
| 239 |
// should be defined in libdrm, this is a temporary solution to pass QuickBuild |
| 240 |
#define I915_EXEC_VEBOX (4<<0) |
| 241 |
#define I915_EXEC_VCS2 (6<<0) |
| 242 |
|
| 243 |
// I915_EXEC_BSD_* -- Attempt to provide backwards and forwards |
| 244 |
// compatibility with versions of include/drm/i915_drm.h that do not |
| 245 |
// have these definitions or that have them with the same values but |
| 246 |
// different textual representations. This will help avoid compiler |
| 247 |
// warnings about macro redefinitions. |
| 248 |
|
| 249 |
#if !defined I915_EXEC_BSD_MASK |
| 250 |
#define I915_EXEC_BSD_MASK (3<<13) |
| 251 |
#endif |
| 252 |
#if !defined I915_EXEC_BSD_DEFAULT |
| 253 |
#define I915_EXEC_BSD_DEFAULT (0<<13) /* default ping-pong mode */ |
| 254 |
#endif |
| 255 |
#if !defined I915_EXEC_BSD_RING1 |
| 256 |
#define I915_EXEC_BSD_RING1 (1<<13) |
| 257 |
#endif |
| 258 |
#if !defined I915_EXEC_BSD_RING2 |
| 259 |
#define I915_EXEC_BSD_RING2 (2<<13) |
| 260 |
#endif |
| 261 |
|
| 262 |
#define I915_PARAM_HAS_BSD2 31 |
| 263 |
#define I915_EXEC_ENABLE_WATCHDOG_LINUX (1<<18) |
| 264 |
|
| 265 |
//! |
| 266 |
//! \brief Forward declarations |
| 267 |
//! |
| 268 |
typedef struct _MOS_SPECIFIC_RESOURCE MOS_RESOURCE, *PMOS_RESOURCE; |
| 269 |
typedef struct _MOS_INTERFACE *PMOS_INTERFACE; |
| 270 |
typedef struct _MOS_COMMAND_BUFFER *PMOS_COMMAND_BUFFER; |
| 271 |
typedef struct _MOS_LOCK_PARAMS *PMOS_LOCK_PARAMS; |
| 272 |
|
| 273 |
typedef void *MEDIAUMD_RESOURCE; |
| 274 |
|
| 275 |
//! |
| 276 |
//! \brief enum to video device operations |
| 277 |
//! |
| 278 |
typedef enum _MOS_MEDIA_OPERATION |
| 279 |
{ |
| 280 |
MOS_MEDIA_OPERATION_NONE = 0, |
| 281 |
MOS_MEDIA_OPERATION_DECODE, |
| 282 |
MOS_MEDIA_OPERATION_ENCODE, |
| 283 |
MOS_MEDIA_OPERATION_MAX |
| 284 |
} MOS_MEDIA_OPERATION, *PMOS_MEDIA_OPERATION; |
| 285 |
|
| 286 |
//! |
| 287 |
//! \brief ENum to GPU nodes |
| 288 |
//! |
| 289 |
typedef enum _MOS_GPU_NODE |
| 290 |
{ |
| 291 |
MOS_GPU_NODE_3D = DRM_EXEC_RENDER, |
| 292 |
MOS_GPU_NODE_COMPUTE = DRM_EXEC_COMPUTE, |
| 293 |
MOS_GPU_NODE_VE = DRM_EXEC_VEBOX, |
| 294 |
MOS_GPU_NODE_VIDEO = DRM_EXEC_BSD, |
| 295 |
MOS_GPU_NODE_VIDEO2 = DRM_EXEC_VCS2, |
| 296 |
MOS_GPU_NODE_BLT = DRM_EXEC_BLT, |
| 297 |
MOS_GPU_NODE_MAX = 7//GFX_MAX(DRM_EXEC_RENDER, DRM_EXEC_COMPUTE, DRM_EXEC_VEBOX, DRM_EXEC_BSD, DRM_EXEC_VCS2, DRM_EXEC_BLT) + 1 |
| 298 |
} MOS_GPU_NODE, *PMOS_GPU_NODE; |
| 299 |
|
| 300 |
//! |
| 301 |
//! \brief Inline function to get GPU node |
| 302 |
//! |
| 303 |
static inline MOS_GPU_NODE OSKMGetGpuNode(MOS_GPU_CONTEXT uiGpuContext) |
| 304 |
{ |
| 305 |
switch (uiGpuContext) |
| 306 |
{ |
| 307 |
case MOS_GPU_CONTEXT_RENDER: |
| 308 |
case MOS_GPU_CONTEXT_RENDER2: |
| 309 |
case MOS_GPU_CONTEXT_RENDER3: |
| 310 |
case MOS_GPU_CONTEXT_RENDER4: |
| 311 |
case MOS_GPU_CONTEXT_COMPUTE: //change this context mapping to Compute Node instead of 3D node after the node name is defined in linux. |
| 312 |
return MOS_GPU_NODE_3D; |
| 313 |
break; |
| 314 |
case MOS_GPU_CONTEXT_VEBOX: |
| 315 |
return MOS_GPU_NODE_VE; |
| 316 |
break; |
| 317 |
case MOS_GPU_CONTEXT_VIDEO: |
| 318 |
case MOS_GPU_CONTEXT_VIDEO2: |
| 319 |
case MOS_GPU_CONTEXT_VIDEO3: |
| 320 |
case MOS_GPU_CONTEXT_VIDEO4: |
| 321 |
case MOS_GPU_CONTEXT_VIDEO5: |
| 322 |
case MOS_GPU_CONTEXT_VIDEO6: |
| 323 |
case MOS_GPU_CONTEXT_VIDEO7: |
| 324 |
return MOS_GPU_NODE_VIDEO; |
| 325 |
break; |
| 326 |
case MOS_GPU_CONTEXT_VDBOX2_VIDEO: |
| 327 |
case MOS_GPU_CONTEXT_VDBOX2_VIDEO2: |
| 328 |
case MOS_GPU_CONTEXT_VDBOX2_VIDEO3: |
| 329 |
return MOS_GPU_NODE_VIDEO2; |
| 330 |
break; |
| 331 |
case MOS_GPU_CONTEXT_BLT: |
| 332 |
return MOS_GPU_NODE_BLT; |
| 333 |
break; |
| 334 |
default: |
| 335 |
return MOS_GPU_NODE_MAX ; |
| 336 |
break; |
| 337 |
} |
| 338 |
} |
| 339 |
|
| 340 |
//! |
| 341 |
//! \brief enum to Intel bo map operations |
| 342 |
//! |
| 343 |
typedef enum _MOS_MMAP_OPERATION |
| 344 |
{ |
| 345 |
MOS_MMAP_OPERATION_NONE = 0, |
| 346 |
MOS_MMAP_OPERATION_MMAP, |
| 347 |
MOS_MMAP_OPERATION_MMAP_GTT, |
| 348 |
MOS_MMAP_OPERATION_MMAP_WC |
| 349 |
} MOS_MMAP_OPERATION, *PMOS_MMAP_OPERATION; |
| 350 |
|
| 351 |
//! |
| 352 |
//! \brief Structure to Linux resource |
| 353 |
//! |
| 354 |
struct _MOS_SPECIFIC_RESOURCE |
| 355 |
{ |
| 356 |
int32_t iWidth; |
| 357 |
int32_t iHeight; |
| 358 |
int32_t iSize; |
| 359 |
int32_t iPitch; |
| 360 |
int32_t iDepth; //!< for 3D surface |
| 361 |
MOS_FORMAT Format; |
| 362 |
int32_t iCount; |
| 363 |
int32_t iAllocationIndex[MOS_GPU_CONTEXT_MAX]; |
| 364 |
uint64_t dwGfxAddress; |
| 365 |
uint8_t *pData; |
| 366 |
const char *bufname; |
| 367 |
uint32_t isTiled; |
| 368 |
MOS_TILE_TYPE TileType; |
| 369 |
uint32_t bMapped; |
| 370 |
MOS_LINUX_BO *bo; |
| 371 |
uint32_t name; |
| 372 |
GMM_RESOURCE_INFO *pGmmResInfo; //!< GMM resource descriptor |
| 373 |
MOS_MMAP_OPERATION MmapOperation; |
| 374 |
uint8_t *pSystemShadow; |
| 375 |
MOS_PLANE_OFFSET YPlaneOffset; //!< Y surface plane offset |
| 376 |
MOS_PLANE_OFFSET UPlaneOffset; //!< U surface plane offset |
| 377 |
MOS_PLANE_OFFSET VPlaneOffset; //!< V surface plane offset |
| 378 |
uint32_t dwOffsetForMono; // This filed is used for mono surface only. DO NOT USE IT FOR OTHER USAGE. |
| 379 |
|
| 380 |
//!< to sync render target for multi-threading decoding mode |
| 381 |
struct |
| 382 |
{ |
| 383 |
int32_t bSemInitialized; |
| 384 |
PMOS_SEMAPHORE *ppCurrentFrameSemaphore; //!< Semaphore queue for hybrid decoding multi-threading case |
| 385 |
PMOS_SEMAPHORE *ppReferenceFrameSemaphore; //!< Semaphore queue for hybrid decoding multi-threading case; post when a surface is not used as reference frame |
| 386 |
}; |
| 387 |
|
| 388 |
#if MOS_MEDIASOLO_SUPPORTED |
| 389 |
//!< these fields are only used while MediaSolo is enabled(bSoloInUse of OS_Interface is true). |
| 390 |
uint32_t dwOffset; |
| 391 |
FILE* pFile; |
| 392 |
char *pcFilePath; |
| 393 |
int32_t bManualSwizzlingInUse; |
| 394 |
// used for AubCapture mode |
| 395 |
int32_t bAubGttUpdate; |
| 396 |
int32_t bAubMemUpdate; |
| 397 |
int32_t bInterestedRes; |
| 398 |
int32_t bPermaLocked; |
| 399 |
#endif // MOS_MEDIASOLO_SUPPORTED |
| 400 |
|
| 401 |
// This is used by MDF when a wrapper/virtual MOS Resource is used to set surface state for a given VA, not necessary from start, in an actual MOS resource |
| 402 |
uint64_t user_provided_va; |
| 403 |
// for MODS Wrapper |
| 404 |
GraphicsResource* pGfxResource; |
| 405 |
GraphicsResourceNext* pGfxResourceNext; |
| 406 |
bool bConvertedFromDDIResource; |
| 407 |
uint32_t dwResourceOffset; |
| 408 |
bool bExternalSurface; //!< indicate the surface not allocated by media |
| 409 |
|
| 410 |
// Tile switch |
| 411 |
MOS_TILE_MODE_GMM TileModeGMM; |
| 412 |
bool bGMMTileEnabled; |
| 413 |
|
| 414 |
// Compression track |
| 415 |
bool bUncompressedWriteNeeded; //!< set uncompressed write flag to trace media uncomrpessedwrite request |
| 416 |
|
| 417 |
MEMORY_OBJECT_CONTROL_STATE memObjCtrlState; |
| 418 |
MOS_HW_RESOURCE_DEF mocsMosResUsageType; |
| 419 |
}; |
| 420 |
|
| 421 |
//! |
| 422 |
//! \brief Structure to MOS_SURFACE |
| 423 |
//! |
| 424 |
struct MOS_SURFACE |
| 425 |
{ |
| 426 |
MOS_RESOURCE OsResource; //Surface Resource |
| 427 |
|
| 428 |
uint32_t dwArraySlice; //!< [in] |
| 429 |
uint32_t dwMipSlice; //!< [in] |
| 430 |
MOS_S3D_CHANNEL S3dChannel; //!< [in] |
| 431 |
|
| 432 |
MOS_GFXRES_TYPE Type; //!< [out] Basic resource geometry |
| 433 |
int32_t bOverlay; |
| 434 |
int32_t bFlipChain; |
| 435 |
|
| 436 |
uint32_t dwWidth; //!< [out] Type == 2D || VOLUME, width in pixels. |
| 437 |
uint32_t dwHeight; //!< [out] Type == 2D || VOLUME, height in rows. Type == BUFFER, n/a |
| 438 |
uint32_t dwSize; //!< [out] Type == 2D || VOLUME, the size of surface |
| 439 |
uint32_t dwDepth; //!< [out] 0: Implies 2D resource. >=1: volume resource |
| 440 |
uint32_t dwArraySize; //!< [out] 0,1: 1 element. >1: N elements |
| 441 |
uint32_t dwLockPitch; //!< [out] pitch in bytes used for locking |
| 442 |
uint32_t dwPitch; //!< [out] < RenderPitch > pitch in bytes used for programming HW |
| 443 |
uint32_t dwSlicePitch; //!< [out] Type == VOLUME, byte offset to next slice. Type != VOLUME, n/a |
| 444 |
uint32_t dwQPitch; //!< [out] QPitch - distance in rows between R-Planes used for programming HW |
| 445 |
MOS_TILE_TYPE TileType; //!< [out] Defines the layout of a physical page. Optimal choice depends on usage model. |
| 446 |
MOS_FORMAT Format; //!< [out] Pixel format |
| 447 |
int32_t bArraySpacing; //!< [out] Array spacing |
| 448 |
int32_t bCompressible; //!< [out] Memory compression |
| 449 |
|
| 450 |
uint32_t dwOffset; // Surface Offset (Y/Base) |
| 451 |
MOS_PLANE_OFFSET YPlaneOffset; // Y surface plane offset |
| 452 |
MOS_PLANE_OFFSET UPlaneOffset; // U surface plane offset |
| 453 |
MOS_PLANE_OFFSET VPlaneOffset; // V surface plane offset |
| 454 |
uint32_t dwYPitch; // Y surface plane pitch |
| 455 |
uint32_t dwUPitch; // U surface plane pitch |
| 456 |
uint32_t dwVPitch; // V surface plane pitch |
| 457 |
|
| 458 |
union |
| 459 |
{ |
| 460 |
struct |
| 461 |
{ |
| 462 |
MOS_RESOURCE_OFFSETS Y; |
| 463 |
MOS_RESOURCE_OFFSETS U; |
| 464 |
MOS_RESOURCE_OFFSETS V; |
| 465 |
} YUV; //!< [out] Valid for YUV & planar RGB formats. Invalid for RGB formats. |
| 466 |
|
| 467 |
MOS_RESOURCE_OFFSETS RGB; //!< [out] Valid non planar RGB formats. Invalid for YUV and planar RGB formats. |
| 468 |
} RenderOffset; //!< [out] Offsets request by input parameters. Used to program HW. |
| 469 |
|
| 470 |
union |
| 471 |
{ |
| 472 |
struct |
| 473 |
{ |
| 474 |
uint32_t Y; |
| 475 |
uint32_t U; |
| 476 |
uint32_t V; |
| 477 |
} YUV; //!< [out] Valid for YUV & planar RGB formats. Invalid for RGB formats. |
| 478 |
|
| 479 |
uint32_t RGB; //!< [out] Valid non planar RGB formats. Invalid for YUV and planar RGB formats. |
| 480 |
} LockOffset; //!< [out] Offset in bytes used for locking |
| 481 |
|
| 482 |
// Surface compression mode, enable flags |
| 483 |
int32_t bIsCompressed; //!< [out] Memory compression flag |
| 484 |
MOS_RESOURCE_MMC_MODE CompressionMode; //!< [out] Memory compression mode |
| 485 |
uint32_t CompressionFormat; //!< [out] Memory compression format |
| 486 |
// deprecated: not to use MmcState |
| 487 |
MOS_MEMCOMP_STATE MmcState; // Memory compression state |
| 488 |
// Tile Switch |
| 489 |
MOS_TILE_MODE_GMM TileModeGMM; //!< [out] Transparent GMM Tiletype specifying in hwcmd finally |
| 490 |
bool bGMMTileEnabled; //!< [out] GMM defined tile mode flag |
| 491 |
uint32_t YoffsetForUplane; //!< [out] Y offset from U plane to Y plane. |
| 492 |
uint32_t YoffsetForVplane; //!< [out] Y offset from V plane to Y plane. |
| 493 |
// Surface cache Usage |
| 494 |
uint32_t CacheSetting; |
| 495 |
#if (_DEBUG || _RELEASE_INTERNAL) |
| 496 |
uint32_t oldCacheSetting; |
| 497 |
#endif |
| 498 |
|
| 499 |
//Mip Tail related info |
| 500 |
uint32_t MipTailStartLOD; |
| 501 |
}; |
| 502 |
typedef MOS_SURFACE *PMOS_SURFACE; |
| 503 |
|
| 504 |
//! |
| 505 |
//! \brief Structure to MOS_BUFFER |
| 506 |
//! |
| 507 |
struct MOS_BUFFER |
| 508 |
{ |
| 509 |
MOS_RESOURCE OsResource; //!< Buffer resource |
| 510 |
uint32_t size; //!< Buffer size |
| 511 |
const char* name; //!< Buffer name |
| 512 |
bool initOnAllocate; //!< Flag to indicate whether initialize when allocate |
| 513 |
uint8_t initValue; //!< Initialize value when initOnAllocate is set |
| 514 |
bool bPersistent; //!< Persistent flag |
| 515 |
}; |
| 516 |
typedef MOS_BUFFER *PMOS_BUFFER; |
| 517 |
|
| 518 |
//! |
| 519 |
//! \brief Structure to patch location list |
| 520 |
//! |
| 521 |
typedef struct _PATCHLOCATIONLIST |
| 522 |
{ |
| 523 |
uint32_t AllocationIndex; |
| 524 |
uint32_t AllocationOffset; |
| 525 |
uint32_t PatchOffset; |
| 526 |
uint32_t cpCmdProps; |
| 527 |
int32_t uiRelocFlag; |
| 528 |
uint32_t uiWriteOperation; |
| 529 |
MOS_LINUX_BO *cmdBo; |
| 530 |
} PATCHLOCATIONLIST, *PPATCHLOCATIONLIST; |
| 531 |
|
| 532 |
//#define PATCHLOCATIONLIST_SIZE 25 |
| 533 |
#define CODECHAL_MAX_REGS 256 |
| 534 |
#define PATCHLOCATIONLIST_SIZE CODECHAL_MAX_REGS |
| 535 |
|
| 536 |
//! |
| 537 |
//! \brief Structure to Allocation List |
| 538 |
//! |
| 539 |
typedef struct _ALLOCATION_LIST |
| 540 |
{ |
| 541 |
HANDLE hAllocation; |
| 542 |
uint32_t WriteOperation; |
| 543 |
} ALLOCATION_LIST, *PALLOCATION_LIST; |
| 544 |
|
| 545 |
//#define ALLOCATIONLIST_SIZE MOS_MAX_REGS |
| 546 |
#define ALLOCATIONLIST_SIZE CODECHAL_MAX_REGS //!< use the large value |
| 547 |
|
| 548 |
//! |
| 549 |
//! \brief Structure to command buffer |
| 550 |
//! |
| 551 |
typedef struct _COMMAND_BUFFER |
| 552 |
{ |
| 553 |
// Double linked list |
| 554 |
struct _COMMAND_BUFFER *pNext; |
| 555 |
struct _COMMAND_BUFFER *pPrev; |
| 556 |
|
| 557 |
int64_t *pSyncTag; |
| 558 |
int64_t qSyncTag; |
| 559 |
|
| 560 |
// Status |
| 561 |
int32_t bActive; //!< Active / Inactive flag |
| 562 |
int32_t bRunning; //!< CB is running in Gfx Device |
| 563 |
LARGE_INTEGER TimeStart; //!< Start timestamp |
| 564 |
LARGE_INTEGER TimeEnd; //!< End timestamp |
| 565 |
|
| 566 |
// Buffer information |
| 567 |
uint8_t *pCmdBase; //!< Pointer to buffer data |
| 568 |
uint8_t *pCmdCurrent; //!< Current pointer |
| 569 |
int32_t iSize; //!< Buffer Size |
| 570 |
int32_t iCurrent; //!< Current offset |
| 571 |
int32_t iRemaining; //!< Remaining |
| 572 |
} COMMAND_BUFFER, *PCOMMAND_BUFFER; |
| 573 |
|
| 574 |
typedef struct _MOS_GPU_STATUS_DATA |
| 575 |
{ |
| 576 |
uint32_t GPUTag; |
| 577 |
uint32_t ReservedForGPUTag; //!< Reserved for gpu tag uint64_t write back by gpu but we only use the low uint32_t above. |
| 578 |
uint32_t Reserved[6]; //!< Padding to 32 byte-aligned for future use. |
| 579 |
} MOS_GPU_STATUS_DATA; |
| 580 |
|
| 581 |
//! |
| 582 |
//! \brief Structure to Gpu context |
| 583 |
//! |
| 584 |
typedef struct _CODECHAL_OS_GPU_CONTEXT |
| 585 |
{ |
| 586 |
volatile int32_t bCBFlushed; //!< if CB not flushed, re-use |
| 587 |
PMOS_COMMAND_BUFFER pCB; |
| 588 |
uint32_t uiCommandBufferSize; |
| 589 |
|
| 590 |
// Allcoation List |
| 591 |
ALLOCATION_LIST *pAllocationList; |
| 592 |
uint32_t uiNumAllocations; |
| 593 |
uint32_t uiMaxPatchLocationsize; |
| 594 |
|
| 595 |
// Patch List |
| 596 |
PATCHLOCATIONLIST *pPatchLocationList; |
| 597 |
uint32_t uiCurrentNumPatchLocations; |
| 598 |
uint32_t uiMaxNumAllocations; |
| 599 |
|
| 600 |
// OS command buffer |
| 601 |
PCOMMAND_BUFFER pStartCB; |
| 602 |
PCOMMAND_BUFFER pCurrentCB; |
| 603 |
|
| 604 |
// Resource registrations |
| 605 |
uint32_t uiResCount; //!< # of resources registered |
| 606 |
int32_t iResIndex[CODECHAL_MAX_REGS]; //!< Resource indices |
| 607 |
PMOS_RESOURCE pResources; //!< Pointer to resources list |
| 608 |
int32_t *pbWriteMode; //!< Write mode |
| 609 |
|
| 610 |
// GPU Status |
| 611 |
uint32_t uiGPUStatusTag; |
| 612 |
} MOS_OS_GPU_CONTEXT, *PMOS_OS_GPU_CONTEXT; |
| 613 |
|
| 614 |
//! |
| 615 |
//! \brief Structure to buffer pool |
| 616 |
//! |
| 617 |
typedef struct _CMD_BUFFER_BO_POOL |
| 618 |
{ |
| 619 |
int32_t iFetch; |
| 620 |
MOS_LINUX_BO *pCmd_bo[MAX_CMD_BUF_NUM]; |
| 621 |
}CMD_BUFFER_BO_POOL; |
| 622 |
|
| 623 |
struct MOS_CONTEXT_OFFSET |
| 624 |
{ |
| 625 |
MOS_LINUX_CONTEXT *intel_context; |
| 626 |
MOS_LINUX_BO *target_bo; |
| 627 |
uint64_t offset64; |
| 628 |
}; |
| 629 |
|
| 630 |
// APO related |
| 631 |
#define FUTURE_PLATFORM_MOS_APO 1234 |
| 632 |
bool SetupApoMosSwitch(int32_t fd, MediaUserSettingSharedPtr userSettingPtr); |
| 633 |
bool SetupApoDdiSwitch(int32_t fd, MediaUserSettingSharedPtr userSettingPtr); |
| 634 |
bool SetupMediaSoloSwitch(); |
| 635 |
|
| 636 |
enum OS_SPECIFIC_RESOURCE_TYPE |
| 637 |
{ |
| 638 |
OS_SPECIFIC_RESOURCE_INVALID = 0, |
| 639 |
OS_SPECIFIC_RESOURCE_SURFACE = 1, |
| 640 |
OS_SPECIFIC_RESOURCE_BUFFER = 2, |
| 641 |
OS_SPECIFIC_RESOURCE_MAX |
| 642 |
}; |
| 643 |
|
| 644 |
class OsContextNext; |
| 645 |
typedef OsContextNext OsDeviceContext; |
| 646 |
typedef OsDeviceContext *MOS_DEVICE_HANDLE; |
| 647 |
|
| 648 |
typedef struct _MOS_OS_CONTEXT MOS_CONTEXT, *PMOS_CONTEXT, MOS_OS_CONTEXT, *PMOS_OS_CONTEXT, MOS_DRIVER_CONTEXT,*PMOS_DRIVER_CONTEXT; |
| 649 |
//! |
| 650 |
//! \brief Structure to OS context |
| 651 |
//! |
| 652 |
struct _MOS_OS_CONTEXT |
| 653 |
{ |
| 654 |
// Context must be freed by os emul layer |
| 655 |
int32_t bFreeContext = 0; |
| 656 |
|
| 657 |
uint32_t uIndirectStateSize = 0; |
| 658 |
|
| 659 |
MOS_OS_GPU_CONTEXT OsGpuContext[MOS_GPU_CONTEXT_MAX] = {}; |
| 660 |
|
| 661 |
// Buffer rendering |
| 662 |
LARGE_INTEGER Frequency = {}; //!< Frequency |
| 663 |
LARGE_INTEGER LastCB = {}; //!< End time for last CB |
| 664 |
|
| 665 |
CMD_BUFFER_BO_POOL CmdBufferPool = {}; |
| 666 |
|
| 667 |
// Emulated platform, sku, wa tables |
| 668 |
PLATFORM m_platform = {}; |
| 669 |
MEDIA_FEATURE_TABLE m_skuTable = {}; |
| 670 |
MEDIA_WA_TABLE m_waTable = {}; |
| 671 |
MEDIA_SYSTEM_INFO m_gtSystemInfo = {}; |
| 672 |
|
| 673 |
// Controlled OS resources (for analysis) |
| 674 |
MOS_BUFMGR *bufmgr = nullptr; |
| 675 |
MOS_LINUX_CONTEXT *intel_context = nullptr; |
| 676 |
int32_t submit_fence = 0; |
| 677 |
uint32_t uEnablePerfTag = 0; //!< 0: Do not pass PerfTag to KMD, perf data collection disabled; |
| 678 |
//!< 1: Pass PerfTag to MVP driver, perf data collection enabled; |
| 679 |
//!< 2: Pass PerfTag to DAPC driver, perf data collection enabled; |
| 680 |
int32_t bDisableKmdWatchdog = 0; //!< 0: Do not disable kmd watchdog, that is to say, pass I915_EXEC_ENABLE_WATCHDOG flag to KMD; |
| 681 |
//!< 1: Disable kmd watchdog, that is to say, DO NOT pass I915_EXEC_ENABLE_WATCHDOG flag to KMD; |
| 682 |
PERF_DATA *pPerfData = nullptr; //!< Add Perf Data for KMD to capture perf tag |
| 683 |
|
| 684 |
int32_t bHybridDecoderRunningFlag = 0; //!< Flag to indicate if hybrid decoder is running |
| 685 |
|
| 686 |
int iDeviceId = 0; |
| 687 |
int wRevision = 0; |
| 688 |
int32_t bIsAtomSOC = 0; |
| 689 |
int fd = 0; //!< handle for /dev/dri/card0 |
| 690 |
|
| 691 |
int32_t bUse64BitRelocs = 0; |
| 692 |
bool bUseSwSwizzling = false; |
| 693 |
bool bTileYFlag = false; |
| 694 |
|
| 695 |
void **ppMediaMemDecompState = nullptr; //!<Media memory decompression data structure |
| 696 |
void **ppMediaCopyState = nullptr; //!<Media memory copy data structure |
| 697 |
|
| 698 |
// For modulized GPU context |
| 699 |
void* m_gpuContextMgr = nullptr; |
| 700 |
void* m_cmdBufMgr = nullptr; |
| 701 |
MOS_DEVICE_HANDLE m_osDeviceContext = nullptr; |
| 702 |
|
| 703 |
//For 2VD box |
| 704 |
int32_t bKMDHasVCS2 = 0; |
| 705 |
bool bPerCmdBufferBalancing = false; |
| 706 |
int32_t semid = 0; |
| 707 |
int32_t shmid = 0; |
| 708 |
void *pShm = nullptr; |
| 709 |
|
| 710 |
uint32_t *pTranscryptedKernels = nullptr; //!< The cached version for current set of transcrypted and authenticated kernels |
| 711 |
uint32_t uiTranscryptedKernelsSize = 0; //!< Size in bytes of the cached version of transcrypted and authenticated kernels |
| 712 |
void *pLibdrmHandle = nullptr; |
| 713 |
|
| 714 |
GMM_CLIENT_CONTEXT *pGmmClientContext = nullptr; //UMD specific ClientContext object in GMM |
| 715 |
AuxTableMgr *m_auxTableMgr = nullptr; |
| 716 |
|
| 717 |
// GPU Status Buffer |
| 718 |
PMOS_RESOURCE pGPUStatusBuffer = nullptr; |
| 719 |
|
| 720 |
std::vector<struct MOS_CONTEXT_OFFSET> contextOffsetList = {}; |
| 721 |
|
| 722 |
bool bSimIsActive = false; //!< To indicate if simulation environment |
| 723 |
bool m_apoMosEnabled = false; //!< apo mos or not |
| 724 |
bool m_protectedGEMContext = false; //!< Indicates to create protected GEM content |
| 725 |
|
| 726 |
MediaUserSettingSharedPtr m_userSettingPtr = nullptr; // used to save user setting instance |
| 727 |
|
| 728 |
// Media memory decompression function |
| 729 |
void (* pfnMemoryDecompress)( |
| 730 |
PMOS_CONTEXT pOsContext, |
| 731 |
PMOS_RESOURCE pOsResource) = nullptr; |
| 732 |
|
| 733 |
//! |
| 734 |
//! \brief the function ptr for surface copy function |
| 735 |
//! |
| 736 |
void (* pfnMediaMemoryCopy )( |
| 737 |
PMOS_CONTEXT pOsContext, |
| 738 |
PMOS_RESOURCE pInputResource, |
| 739 |
PMOS_RESOURCE pOutputResource, |
| 740 |
bool bOutputCompressed) = nullptr; |
| 741 |
|
| 742 |
//! |
| 743 |
//! \brief the function ptr for Media Memory 2D copy function |
| 744 |
//! |
| 745 |
void (* pfnMediaMemoryCopy2D)( |
| 746 |
PMOS_CONTEXT pOsContext, |
| 747 |
PMOS_RESOURCE pInputResource, |
| 748 |
PMOS_RESOURCE pOutputResource, |
| 749 |
uint32_t copyWidth, |
| 750 |
uint32_t copyHeight, |
| 751 |
uint32_t copyInputOffset, |
| 752 |
uint32_t copyOutputOffset, |
| 753 |
uint32_t bpp, |
| 754 |
bool bOutputCompressed) = nullptr; |
| 755 |
|
| 756 |
//! |
| 757 |
//! \brief the function ptr for Media copy function |
| 758 |
//! |
| 759 |
|
| 760 |
// Os Context interface functions |
| 761 |
void (* pfnDestroy)( |
| 762 |
struct _MOS_OS_CONTEXT *pOsContext, |
| 763 |
int32_t MODSEnabled, |
| 764 |
int32_t MODSForGpuContext) = nullptr; |
| 765 |
|
| 766 |
int32_t (* pfnRefresh)( |
| 767 |
struct _MOS_OS_CONTEXT *pOsContext) = nullptr; |
| 768 |
|
| 769 |
int32_t (* pfnGetCommandBuffer)( |
| 770 |
struct _MOS_OS_CONTEXT *pOsContext, |
| 771 |
PMOS_COMMAND_BUFFER pCmdBuffer, |
| 772 |
int32_t iSize) = nullptr; |
| 773 |
|
| 774 |
void (* pfnReturnCommandBuffer)( |
| 775 |
struct _MOS_OS_CONTEXT *pOsContext, |
| 776 |
MOS_GPU_CONTEXT GpuContext, |
| 777 |
PMOS_COMMAND_BUFFER pCmdBuffer) = nullptr; |
| 778 |
|
| 779 |
int32_t (* pfnFlushCommandBuffer)( |
| 780 |
struct _MOS_OS_CONTEXT *pOsContext, |
| 781 |
MOS_GPU_CONTEXT GpuContext) = nullptr; |
| 782 |
|
| 783 |
MOS_STATUS (* pfnInsertCmdBufferToPool)( |
| 784 |
struct _MOS_OS_CONTEXT *pOsContext, |
| 785 |
PMOS_COMMAND_BUFFER pCmdBuffer) = nullptr; |
| 786 |
|
| 787 |
MOS_STATUS (* pfnWaitAndReleaseCmdBuffer)( |
| 788 |
struct _MOS_OS_CONTEXT *pOsContext, |
| 789 |
int32_t index) = nullptr; |
| 790 |
|
| 791 |
uint32_t (* GetDmaBufID ) ( |
| 792 |
struct _MOS_OS_CONTEXT *pOsContext) = nullptr; |
| 793 |
|
| 794 |
void (* SetDmaBufID ) ( |
| 795 |
struct _MOS_OS_CONTEXT *pOsContext, |
| 796 |
uint32_t dwDmaBufID) = nullptr; |
| 797 |
|
| 798 |
void (* SetPerfHybridKernelID ) ( |
| 799 |
struct _MOS_OS_CONTEXT *pOsContext, |
| 800 |
uint32_t KernelID) = nullptr; |
| 801 |
|
| 802 |
uint32_t (* pfnGetGpuCtxBufferTag)( |
| 803 |
PMOS_CONTEXT pOsContext, |
| 804 |
MOS_GPU_CONTEXT GpuContext) = nullptr; |
| 805 |
|
| 806 |
void (* pfnIncGpuCtxBufferTag)( |
| 807 |
PMOS_CONTEXT pOsContext, |
| 808 |
MOS_GPU_CONTEXT GpuContext) = nullptr; |
| 809 |
|
| 810 |
uint32_t (* GetGPUTag)( |
| 811 |
PMOS_INTERFACE pOsInterface, |
| 812 |
MOS_GPU_CONTEXT GpuContext) = nullptr; |
| 813 |
|
| 814 |
GMM_CLIENT_CONTEXT* (* GetGmmClientContext)( |
| 815 |
PMOS_CONTEXT pOsContext) = nullptr; |
| 816 |
|
| 817 |
}; |
| 818 |
|
| 819 |
//! |
| 820 |
//! \brief Structure to VDBOX Workload Type |
| 821 |
//! |
| 822 |
typedef struct _VDBOX_WORKLOAD |
| 823 |
{ |
| 824 |
uint32_t uiVDBoxCount[2]; // VDBox workloads |
| 825 |
uint32_t uiRingIndex; // ping-pong when vdbox1 count equals vdbox2 count |
| 826 |
}VDBOX_WORKLOAD, *PVDBOX_WORKLOAD; |
| 827 |
|
| 828 |
//! |
| 829 |
//! \brief Structure to Android Resource Type |
| 830 |
//! |
| 831 |
|
| 832 |
//! |
| 833 |
//! \brief Structure to Android Resource structure |
| 834 |
//! |
| 835 |
typedef struct _MOS_OS_ALLOCATION |
| 836 |
{ |
| 837 |
PMOS_RESOURCE pOsResource; //!< Resource Info |
| 838 |
int32_t bWriteMode; //!< Read/Write Mode |
| 839 |
} MOS_OS_ALLOCATION, *PMOS_OS_ALLOCATION; |
| 840 |
|
| 841 |
//! |
| 842 |
//! \brief Structure to Buffer structure |
| 843 |
//! |
| 844 |
typedef struct _MOS_SPECIFIC_BUFFER |
| 845 |
{ |
| 846 |
uint32_t dwHandle; //!< Buffer Handle |
| 847 |
int32_t iAllocationIndex; //!< Allocation Index |
| 848 |
} MOS_SPECIFIC_BUFFER_ANDROID, *PMOS_SPECIFIC_BUFFER; |
| 849 |
|
| 850 |
#ifdef __cplusplus |
| 851 |
extern "C" { |
| 852 |
#endif |
| 853 |
|
| 854 |
//! |
| 855 |
//! \brief Get Buffer Type |
| 856 |
//! \details Returns the type of buffer, 1D, 2D or volume |
| 857 |
//! \param PMOS_RESOURCE pOsResource |
| 858 |
//! [in] Pointer to OS Resource |
| 859 |
//! \return GFX resource Type |
| 860 |
//! |
| 861 |
MOS_GFXRES_TYPE GetResType( |
| 862 |
PMOS_RESOURCE pOsResource); |
| 863 |
|
| 864 |
//! |
| 865 |
//! \brief Convert to MOS tile type |
| 866 |
//! \details Convert from Linux to MOS tile type |
| 867 |
//! \param uint32_t type |
| 868 |
//! [in] tile type |
| 869 |
//! \return MOS_TILE_TYPE |
| 870 |
//! Return MOS tile type |
| 871 |
//! |
| 872 |
MOS_TILE_TYPE LinuxToMosTileType( |
| 873 |
uint32_t type); |
| 874 |
|
| 875 |
//! |
| 876 |
//! \brief Linux OS initilization |
| 877 |
//! \details Linux OS initilization |
| 878 |
//! \param PMOS_INTERFACE pOsInterface |
| 879 |
//! [in] Pointer to OS Interface |
| 880 |
//! \param PMOS_CONTEXT pOsDriverContext |
| 881 |
//! [in] Pointer to OS Driver context |
| 882 |
//! \return MOS_STATUS |
| 883 |
//! Return MOS_STATUS_SUCCESS if successful, otherwise failed |
| 884 |
//! |
| 885 |
MOS_STATUS Mos_Specific_InitInterface( |
| 886 |
PMOS_INTERFACE pOsInterface, |
| 887 |
PMOS_CONTEXT pOsDriverContext); |
| 888 |
|
| 889 |
//! |
| 890 |
//! \brief Lock resource |
| 891 |
//! \details Lock allocated resource |
| 892 |
//! \param PMOS_INTERFACE pOsInterface |
| 893 |
//! [in] Pointer to OS interface structure |
| 894 |
//! \param PMOS_RESOURCE pOsResource |
| 895 |
//! [in] Pointer to input OS resource |
| 896 |
//! \param PMOS_LOCK_PARAMS pLockFlags |
| 897 |
//! [in] Lock Flags - MOS_LOCKFLAG_* flags |
| 898 |
//! \return void * |
| 899 |
//! |
| 900 |
void *Mos_Specific_LockResource( |
| 901 |
PMOS_INTERFACE pOsInterface, |
| 902 |
PMOS_RESOURCE pOsResource, |
| 903 |
PMOS_LOCK_PARAMS pLockFlags); |
| 904 |
|
| 905 |
//! |
| 906 |
//! \brief Destroys OS specific allocations |
| 907 |
//! \details Destroys OS specific allocations including destroying OS context |
| 908 |
//! \param PMOS_INTERFACE pOsInterface |
| 909 |
//! [in] Pointer to OS Interface |
| 910 |
//! \param int32_t bDestroyVscVppDeviceTag |
| 911 |
//! [in] Destroy VscVppDeviceTagId Flag, no use in Linux |
| 912 |
//! \return void |
| 913 |
//! |
| 914 |
void Mos_Specific_Destroy( |
| 915 |
PMOS_INTERFACE pOsInterface, |
| 916 |
int32_t bDestroyVscVppDeviceTag); |
| 917 |
|
| 918 |
//! |
| 919 |
//! \brief Resets OS States |
| 920 |
//! \details Resets OS States for linux |
| 921 |
//! \param PMOS_INTERFACE pOsInterface |
| 922 |
//! [in] Pointer to OS Interface |
| 923 |
//! \return void |
| 924 |
//! |
| 925 |
void Mos_Specific_ResetOsStates( |
| 926 |
PMOS_INTERFACE pOsInterface); |
| 927 |
|
| 928 |
//! |
| 929 |
//! \brief Resizes the buffer to be used for rendering GPU commands |
| 930 |
//! \details Resizes the buffer to be used for rendering GPU commands |
| 931 |
//! \param PMOS_INTERFACE pOsInterface |
| 932 |
//! [in] OS Interface |
| 933 |
//! \param uint32_t dwRequestedCommandBufferSize |
| 934 |
//! [in] Requested command buffer size |
| 935 |
//! \param uint32_t dwRequestedPatchListSize |
| 936 |
//! [in] Requested patch list size |
| 937 |
//! \return MOS_STATUS |
| 938 |
//! MOS_STATUS_SUCCESS if succeeded, otherwise error code |
| 939 |
//! |
| 940 |
MOS_STATUS Mos_Specific_ResizeCommandBufferAndPatchList( |
| 941 |
PMOS_INTERFACE pOsInterface, |
| 942 |
uint32_t dwRequestedCommandBufferSize, |
| 943 |
uint32_t dwRequestedPatchListSize, |
| 944 |
uint32_t dwFlags); |
| 945 |
|
| 946 |
//! |
| 947 |
//! \brief Unlock resource |
| 948 |
//! \details Unlock the locked resource |
| 949 |
//! \param PMOS_INTERFACE pOsInterface |
| 950 |
//! [in] Pointer to OS interface structure |
| 951 |
//! \param PMOS_RESOURCE pOsResource |
| 952 |
//! [in] Pointer to input OS resource |
| 953 |
//! \return MOS_STATUS |
| 954 |
//! Return MOS_STATUS_SUCCESS if successful, otherwise failed |
| 955 |
//! |
| 956 |
MOS_STATUS Mos_Specific_UnlockResource( |
| 957 |
PMOS_INTERFACE pOsInterface, |
| 958 |
PMOS_RESOURCE pOsResource); |
| 959 |
|
| 960 |
//! |
| 961 |
//! \brief Get Resource Information |
| 962 |
//! \details Linux get resource info |
| 963 |
//! \param PMOS_INTERFACE pOsInterface |
| 964 |
//! [in] Pointer to OS interface structure |
| 965 |
//! \param PMOS_RESOURCE pOsResource |
| 966 |
//! [in] Pointer to input OS resource |
| 967 |
//! \param PMOS_SURFACE pResDetails |
| 968 |
//! [out] Pointer to output resource information details |
| 969 |
//! \return MOS_STATUS |
| 970 |
//! Return MOS_STATUS_SUCCESS if successful, otherwise failed |
| 971 |
//! |
| 972 |
MOS_STATUS Mos_Specific_GetResourceInfo( |
| 973 |
PMOS_INTERFACE pOsInterface, |
| 974 |
PMOS_RESOURCE pOsResource, |
| 975 |
PMOS_SURFACE pResDetails); |
| 976 |
|
| 977 |
//! |
| 978 |
//! \brief Get resource index |
| 979 |
//! \details Get resource index of MOS_RESOURCE |
| 980 |
//! \param PMOS_RESOURCE osResource |
| 981 |
//! [in] Pointer to OS resource |
| 982 |
//! \return uint32_t |
| 983 |
//! Resource index |
| 984 |
//! |
| 985 |
uint32_t Mos_Specific_GetResourceIndex( |
| 986 |
PMOS_RESOURCE osResource); |
| 987 |
|
| 988 |
uint32_t Mos_Specific_GetResourcePitch( |
| 989 |
PMOS_RESOURCE pOsResource); |
| 990 |
|
| 991 |
void Mos_Specific_SetResourceWidth( |
| 992 |
PMOS_RESOURCE pOsResource, |
| 993 |
uint32_t dwWidth); |
| 994 |
|
| 995 |
void Mos_Specific_SetResourceFormat( |
| 996 |
PMOS_RESOURCE pOsResource, |
| 997 |
MOS_FORMAT mosFormat); |
| 998 |
|
| 999 |
//! |
| 1000 |
//! \brief Get SetMarker enabled flag |
| 1001 |
//! \details Get SetMarker enabled flag from OsInterface |
| 1002 |
//! \param PMOS_INTERFACE pOsInterface |
| 1003 |
//! [in] OS Interface |
| 1004 |
//! \return bool |
| 1005 |
//! SetMarker enabled flag |
| 1006 |
//! |
| 1007 |
bool Mos_Specific_IsSetMarkerEnabled( |
| 1008 |
PMOS_INTERFACE pOsInterface); |
| 1009 |
|
| 1010 |
//! |
| 1011 |
//! \brief Get SetMarker resource address |
| 1012 |
//! \details Get SetMarker resource address from OsInterface |
| 1013 |
//! \param PMOS_INTERFACE pOsInterface |
| 1014 |
//! [in] OS Interface |
| 1015 |
//! \return PMOS_RESOURCE |
| 1016 |
//! SetMarker resource address |
| 1017 |
//! |
| 1018 |
PMOS_RESOURCE Mos_Specific_GetMarkerResource( |
| 1019 |
PMOS_INTERFACE pOsInterface); |
| 1020 |
|
| 1021 |
//! |
| 1022 |
//! \brief Get TimeStamp frequency base |
| 1023 |
//! \details Get TimeStamp frequency base from OsInterface |
| 1024 |
//! \param PMOS_INTERFACE pOsInterface |
| 1025 |
//! [in] OS Interface |
| 1026 |
//! \return uint32_t |
| 1027 |
//! time stamp frequency base |
| 1028 |
//! |
| 1029 |
uint32_t Mos_Specific_GetTsFrequency( |
| 1030 |
PMOS_INTERFACE pOsInterface); |
| 1031 |
|
| 1032 |
//! |
| 1033 |
//! \brief Checks whether the requested resource is releasable |
| 1034 |
//! \param PMOS_INTERFACE pOsInterface |
| 1035 |
//! [in] OS Interface |
| 1036 |
//! \param PMOS_RESOURCE pOsResource |
| 1037 |
//! [in] Pointer to OS Resource |
| 1038 |
//! \return MOS_STATUS |
| 1039 |
//! MOS_STATUS_SUCCESS if requested can be released, otherwise MOS_STATUS_UNKNOWN |
| 1040 |
//! |
| 1041 |
MOS_STATUS Mos_Specific_IsResourceReleasable( |
| 1042 |
PMOS_INTERFACE pOsInterface, |
| 1043 |
PMOS_RESOURCE pOsResource); |
| 1044 |
|
| 1045 |
struct _MOS_SPECIFIC_VE_HINT_PARAMS; |
| 1046 |
typedef struct _MOS_SPECIFIC_VE_HINT_PARAMS *PMOS_VIRTUALENGINE_HINT_PARAMS; |
| 1047 |
struct _MOS_VIRTUALENGINE_INIT_PARAMS; |
| 1048 |
typedef struct _MOS_VIRTUALENGINE_INIT_PARAMS MOS_VIRTUALENGINE_INIT_PARAMS, *PMOS_VIRTUALENGINE_INIT_PARAMS; |
| 1049 |
|
| 1050 |
//! |
| 1051 |
//! \brief Virtual Engine Init for media Scalability |
| 1052 |
//! \details |
| 1053 |
//! \param PMOS_INTERFACE pOsInterface |
| 1054 |
//! [in] Pointer to OS interface structure |
| 1055 |
//! \param MOS_VE_HANDLE pVeState |
| 1056 |
//! [out] Virtual Engine State |
| 1057 |
//! \param PMOS_VIRTUALENGINE_HINT_PARAMS veHitParams |
| 1058 |
//! [out] Pointer to Virtual Engine hint parameters |
| 1059 |
//! \param PMOS_VIRTUALENGINE_INTERFACE veInterface |
| 1060 |
//! [out] Pointer to Virtual Engine Interface |
| 1061 |
//! \return MOS_STATUS |
| 1062 |
//! MOS_STATUS_SUCCESS if succeeded, otherwise error code |
| 1063 |
//! |
| 1064 |
MOS_STATUS Mos_Specific_Virtual_Engine_Init( |
| 1065 |
PMOS_INTERFACE pOsInterface, |
| 1066 |
PMOS_VIRTUALENGINE_HINT_PARAMS* veHitParams, |
| 1067 |
MOS_VIRTUALENGINE_INIT_PARAMS& veInParams); |
| 1068 |
|
| 1069 |
struct _MOS_VIRTUALENGINE_SET_PARAMS; |
| 1070 |
typedef struct _MOS_VIRTUALENGINE_SET_PARAMS MOS_VIRTUALENGINE_SET_PARAMS, *PMOS_VIRTUALENGINE_SET_PARAMS; |
| 1071 |
|
| 1072 |
//! |
| 1073 |
//! \brief Set hint parameters |
| 1074 |
//! \details |
| 1075 |
//! \param PMOS_INTERFACE pOsInterface |
| 1076 |
//! [in] Pointer to OS interface structure |
| 1077 |
//! \param MOS_VIRTUALENGINE_SET_PARAMS veParams |
| 1078 |
//! [out] VIRTUALENGINE SET PARAMS |
| 1079 |
//! \return MOS_STATUS |
| 1080 |
//! MOS_STATUS_SUCCESS if succeeded, otherwise error code |
| 1081 |
//! |
| 1082 |
MOS_STATUS Mos_Specific_SetHintParams( |
| 1083 |
PMOS_INTERFACE pOsInterface, |
| 1084 |
PMOS_VIRTUALENGINE_SET_PARAMS veParams); |
| 1085 |
|
| 1086 |
typedef struct _MOS_VIRTUALENGINE_INTERFACE *PMOS_VIRTUALENGINE_INTERFACE; |
| 1087 |
|
| 1088 |
//! |
| 1089 |
//! \brief Destroy veInterface |
| 1090 |
//! \details |
| 1091 |
//! \param PMOS_VIRTUALENGINE_INTERFACE *veInterface |
| 1092 |
//! [in] Pointer to PMOS_VIRTUALENGINE_INTERFACE |
| 1093 |
//! \return MOS_STATUS |
| 1094 |
//! MOS_STATUS_SUCCESS if succeeded, otherwise error code |
| 1095 |
//! |
| 1096 |
MOS_STATUS Mos_Specific_DestroyVeInterface( |
| 1097 |
PMOS_VIRTUALENGINE_INTERFACE *veInterface); |
| 1098 |
|
| 1099 |
#if (_DEBUG || _RELEASE_INTERNAL) |
| 1100 |
MOS_LINUX_BO * Mos_GetNopCommandBuffer_Linux( |
| 1101 |
PMOS_INTERFACE pOsInterface); |
| 1102 |
|
| 1103 |
MOS_LINUX_BO * Mos_GetBadCommandBuffer_Linux( |
| 1104 |
PMOS_INTERFACE pOsInterface); |
| 1105 |
|
| 1106 |
//! |
| 1107 |
//! \brief gpuCtxCreateOption Init for media Scalability |
| 1108 |
//! \details |
| 1109 |
//! \param PMOS_INTERFACE pOsInterface |
| 1110 |
//! [in] Pointer to OS interface structure |
| 1111 |
//! \param uint8_t id |
| 1112 |
//! [out] EngineLogicId |
| 1113 |
//! \return MOS_STATUS |
| 1114 |
//! MOS_STATUS_SUCCESS if succeeded, otherwise error code |
| 1115 |
//! |
| 1116 |
MOS_STATUS Mos_Specific_GetEngineLogicId( |
| 1117 |
PMOS_INTERFACE pOsInterface, |
| 1118 |
uint8_t& id); |
| 1119 |
#endif |
| 1120 |
|
| 1121 |
#ifdef __cplusplus |
| 1122 |
} |
| 1123 |
#endif |
| 1124 |
|
| 1125 |
#endif // __MOS_OS_SPECIFIC_H__ |