| 1 |
/* |
| 2 |
* Copyright (c) 2021-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 |
#ifndef __VP_RENDER_COMMON_H__ |
| 23 |
#define __VP_RENDER_COMMON_H__ |
| 24 |
|
| 25 |
#include <stdint.h> |
| 26 |
#include "surface_type.h" |
| 27 |
|
| 28 |
namespace vp |
| 29 |
{ |
| 30 |
#define CM_MAX_KERNEL_NAME_SIZE 256 |
| 31 |
#define READ_FIELD_FROM_BUF( dst, type ) \ |
| 32 |
dst = *((type *) &pBuf[bytePos]); \ |
| 33 |
bytePos += sizeof(type); |
| 34 |
|
| 35 |
#define CISA_MAGIC_NUMBER 0x41534943 //"CISA" |
| 36 |
#define GENX_TGLLP_CISAID 12 |
| 37 |
#define CM_MAX_ARGS_PER_KERNEL 255 // compiler only supports up to 255 arguments |
| 38 |
#define CM_PAYLOAD_OFFSET 32 // CM Compiler generates offset by 32 bytes. This need to be subtracted from kernel data offset. |
| 39 |
#define CM_PAYLOAD_OFFSET_LARGE 64 |
| 40 |
#define CM_MAX_THREAD_PAYLOAD_SIZE 2016 // 63 GRF |
| 41 |
#define CM_KERNEL_BINARY_PADDING_SIZE 128 // Padding after kernel binary to WA page fault issue. |
| 42 |
#define SURFACE_MASK 0x7 |
| 43 |
|
| 44 |
struct KERNEL_THREAD_SPACE |
| 45 |
{ |
| 46 |
uint32_t uWidth; |
| 47 |
uint32_t uHeight; |
| 48 |
uint32_t uDepth; |
| 49 |
uint32_t uLocalWidth; |
| 50 |
uint32_t uLocalHeight; |
| 51 |
}; |
| 52 |
|
| 53 |
// Need to consistant with compiler |
| 54 |
enum KRN_ARG_KIND |
| 55 |
{ |
| 56 |
// compiler-defined kind |
| 57 |
ARG_KIND_GENERAL = 0x0, |
| 58 |
ARG_KIND_SAMPLER = 0x1, |
| 59 |
ARG_KIND_VME_INDEX = 0x6, |
| 60 |
ARG_KIND_SURFACE = 0x8, //basic surface value |
| 61 |
// using 3 LSB to classify surface further |
| 62 |
ARG_KIND_SURFACE_2D = 0x9, |
| 63 |
ARG_KIND_SURFACE_1D = 0xa, |
| 64 |
ARG_KIND_SURFACE_SAMPLER8X8_AVS = 0xb, |
| 65 |
ARG_KIND_SURFACE_SAMPLER = 0xc, |
| 66 |
ARG_KIND_IMPLICT_LOCALSIZE = 0xe, |
| 67 |
ARG_KIND_IMPLICT_GROUPSIZE = 0xf, |
| 68 |
ARG_KIND_IMPLICIT_LOCALID = 0x10, |
| 69 |
ARG_KIND_GENERAL_DEPVEC = 0x20, |
| 70 |
ARG_KIND_SURFACE_2D_SCOREBOARD = 0x2A, |
| 71 |
ARG_KIND_GENERAL_DEPCNT = 0x30, |
| 72 |
|
| 73 |
//For OCL used only |
| 74 |
ARG_KIND_INLINE = 0xa00 |
| 75 |
}; |
| 76 |
|
| 77 |
enum KRN_ARG_ADDRESSMODE |
| 78 |
{ |
| 79 |
AddressingModeStateful = 0, //this stateful specifically means bindful stateful surfaces. Not bindless statefull surfaces. |
| 80 |
AddressingModeStateless, |
| 81 |
AddressingModeBindless, |
| 82 |
AddressIngModeMax |
| 83 |
}; |
| 84 |
|
| 85 |
enum IMPLICIT_ARG_TYPE |
| 86 |
{ |
| 87 |
ValueType = 0, |
| 88 |
IndirectDataPtr, |
| 89 |
ScratchPtr |
| 90 |
}; |
| 91 |
|
| 92 |
struct KRN_ARG |
| 93 |
{ |
| 94 |
uint32_t uIndex; |
| 95 |
uint32_t uOffsetInPayload; // offset relative to R0 in payload |
| 96 |
void* pData; |
| 97 |
uint32_t uSize; // size of arg in byte |
| 98 |
KRN_ARG_KIND eArgKind; |
| 99 |
bool isOutput; |
| 100 |
KRN_ARG_ADDRESSMODE addressMode; |
| 101 |
IMPLICIT_ARG_TYPE implicitArgType; |
| 102 |
}; |
| 103 |
|
| 104 |
//for OCL use only |
| 105 |
struct KRN_BTI |
| 106 |
{ |
| 107 |
uint32_t uIndex; |
| 108 |
uint32_t uBTI; |
| 109 |
}; |
| 110 |
|
| 111 |
//for OCL use only |
| 112 |
struct KRN_EXECUTE_ENV |
| 113 |
{ |
| 114 |
uint32_t uBarrierCount; |
| 115 |
bool bDisableMidThreadPreemption; |
| 116 |
uint32_t uGrfCount; |
| 117 |
bool bHasGlobalAtomics; |
| 118 |
bool bHasNoStatelessWrite; |
| 119 |
uint32_t uInlineDataPayloadSize; |
| 120 |
uint32_t uOffsetToSkipPerThreadDataLoad; |
| 121 |
uint32_t uSimdSize; |
| 122 |
uint32_t uSubgroupIndependentForwardProgress; |
| 123 |
uint32_t uEuThreadCount; |
| 124 |
bool bHasFenceForImageAccess; |
| 125 |
bool bHasSample; |
| 126 |
bool bHas4GBBuffers; |
| 127 |
uint8_t uiWorkGroupWalkOrderDimensions[3]; |
| 128 |
uint64_t uiPrivateSize; |
| 129 |
uint32_t uiSlmSize; |
| 130 |
bool bRequireDisableEufusion; |
| 131 |
bool bHasDPAS; |
| 132 |
uint32_t uiRequiredWorkGroupSize[3]; |
| 133 |
}; |
| 134 |
|
| 135 |
struct KRN_PER_THREAD_ARG_INFO |
| 136 |
{ |
| 137 |
uint32_t packedLocalIdOffset = 0; |
| 138 |
uint32_t packedLocalIdSize = 0; |
| 139 |
uint32_t localIdOffset = 0; |
| 140 |
uint32_t localIdSize = 0; |
| 141 |
}; |
| 142 |
|
| 143 |
using SurfaceIndex = uint32_t; |
| 144 |
using SamplerIndex = uint32_t; |
| 145 |
using KernelIndex = uint32_t; // index of current kernel in KERNEL_PARAMS_LIST |
| 146 |
|
| 147 |
typedef struct MOS_ALIGNED(16) _SURFACE_PARAMS |
| 148 |
{ |
| 149 |
SurfaceType surfType; |
| 150 |
bool isOutput; |
| 151 |
bool needVerticalStirde; |
| 152 |
bool combineChannelY; |
| 153 |
uint32_t planeIndex; |
| 154 |
bool usePackedPlanar; |
| 155 |
} SURFACE_PARAMS, *PSURFACE_PARAMS; |
| 156 |
using KERNEL_ARG_INDEX_SURFACE_MAP = std::map<uint32_t, SURFACE_PARAMS>; |
| 157 |
|
| 158 |
enum KERNEL_SUBMISSION_MODE |
| 159 |
{ |
| 160 |
SINGLE_KERNEL_ONLY = 0, |
| 161 |
MULTI_KERNELS_SINGLE_MEDIA_STATE, |
| 162 |
}; |
| 163 |
|
| 164 |
typedef struct _VP_RENDER_CACHE_CNTL |
| 165 |
{ |
| 166 |
// Input |
| 167 |
bool bDnDi; |
| 168 |
bool bLace; |
| 169 |
bool bCompositing; |
| 170 |
bool bHdr; |
| 171 |
|
| 172 |
// Output |
| 173 |
VPHAL_DNDI_CACHE_CNTL DnDi; |
| 174 |
VPHAL_LACE_CACHE_CNTL Lace; |
| 175 |
VPHAL_COMPOSITE_CACHE_CNTL Composite; |
| 176 |
VPHAL_HDR_CACHE_CNTL Hdr; |
| 177 |
} VP_RENDER_CACHE_CNTL, *PVP_RENDER_CACHE_CNTL; |
| 178 |
|
| 179 |
} |
| 180 |
#endif // !__VP_SFC_COMMON_H__ |