1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265
|
/*
* Copyright (c) 2017, Intel Corporation
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
* to deal in the Software without restriction, including without limitation
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
* and/or sell copies of the Software, and to permit persons to whom the
* Software is furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included
* in all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
* OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
* ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
* OTHER DEALINGS IN THE SOFTWARE.
*/
//!
//! \file cm_thread_space_rt.h
//! \brief Contains CmThreadSpaceRT declarations.
//!
#ifndef MEDIADRIVER_AGNOSTIC_COMMON_CM_CMTHREADSPACERT_H_
#define MEDIADRIVER_AGNOSTIC_COMMON_CM_CMTHREADSPACERT_H_
#include "cm_thread_space.h"
#include "cm_hal.h"
#include "cm_log.h"
struct CM_THREAD_SPACE_UNIT
{
void *kernel;
uint32_t threadId;
int32_t numEdges; //For Emulation mode
CM_COORDINATE scoreboardCoordinates;
uint8_t dependencyMask;
uint8_t reset;
uint8_t scoreboardColor;
uint8_t sliceDestinationSelect;
uint8_t subSliceDestinationSelect;
};
enum CM_THREAD_SPACE_DIRTY_STATUS
{
CM_THREAD_SPACE_CLEAN = 0,
CM_THREAD_SPACE_DEPENDENCY_MASK_DIRTY = 1,
CM_THREAD_SPACE_DATA_DIRTY = 2
};
namespace CMRT_UMD
{
class CmDeviceRT;
class CmKernel;
class CmKernelRT;
class CmTaskRT;
class CmSurface2D;
class CmThreadSpaceRT;
class CmThreadSpaceEx;
class CmThreadGroupSpace;
class CmThreadSpaceRT: public CmThreadSpace
{
public:
static int32_t Create(CmDeviceRT *device,
uint32_t indexTsArray,
uint32_t width,
uint32_t height,
CmThreadSpaceRT* &threadSpace);
static int32_t Destroy(CmThreadSpaceRT* &threadSpace);
CM_RT_API int32_t AssociateThread(uint32_t x,
uint32_t y,
CmKernel *kernel,
uint32_t threadId);
CM_RT_API int32_t AssociateThreadWithMask(uint32_t x,
uint32_t y,
CmKernel *kernel,
uint32_t threadId,
uint8_t dependencyMask);
CM_RT_API int32_t SetThreadDependencyPattern(uint32_t count,
int32_t *deltaX,
int32_t *deltaY);
CM_RT_API int32_t
SelectThreadDependencyPattern(CM_DEPENDENCY_PATTERN pattern);
CM_RT_API int32_t SetThreadSpaceColorCount(uint32_t colorCount);
CM_RT_API int32_t SelectMediaWalkingPattern(CM_WALKING_PATTERN pattern);
CM_RT_API int32_t Set26ZIDispatchPattern(CM_26ZI_DISPATCH_PATTERN pattern);
CM_RT_API int32_t Set26ZIMacroBlockSize(uint32_t width, uint32_t height);
CM_RT_API int32_t SetMediaWalkerGroupSelect(CM_MW_GROUP_SELECT groupSelect);
CM_RT_API int32_t
SelectMediaWalkingParameters(CM_WALKING_PARAMETERS parameters);
CM_RT_API int32_t
SelectThreadDependencyVectors(CM_DEPENDENCY dependencyVectors);
CM_RT_API int32_t
SetThreadSpaceOrder(uint32_t threadCount,
const CM_THREAD_PARAM *threadSpaceOrder);
int32_t GetThreadSpaceSize(uint32_t &width, uint32_t &height);
int32_t GetThreadSpaceUnit(CM_THREAD_SPACE_UNIT *&threadSpaceUnit);
int32_t GetDependency(CM_HAL_DEPENDENCY *&dependency);
int32_t
GetDependencyPatternType(CM_DEPENDENCY_PATTERN &dependencyPatternType);
int32_t GetWalkingPattern(CM_WALKING_PATTERN &walkingPattern);
int32_t Get26ZIDispatchPattern(CM_26ZI_DISPATCH_PATTERN &pattern);
int32_t GetWalkingParameters(CM_WALKING_PARAMETERS &walkingParameters);
int32_t GetDependencyVectors(CM_HAL_DEPENDENCY &dependencyVectors);
bool CheckWalkingParametersSet();
bool CheckDependencyVectorsSet();
bool CheckThreadSpaceOrderSet();
int32_t GetColorCountMinusOne(uint32_t &colorCount);
int32_t GetWavefront26ZDispatchInfo(
CM_HAL_WAVEFRONT26Z_DISPATCH_INFO &dispatchInfo);
bool IntegrityCheck(CmTaskRT *task);
int32_t GetBoardOrder(uint32_t *&boardOrder);
int32_t Wavefront45Sequence();
int32_t Wavefront26Sequence();
int32_t Wavefront26ZSequence();
int32_t Wavefront26ZISeqVVHV26();
int32_t Wavefront26ZISeqVVHH26();
int32_t Wavefront26ZISeqVV26HH26();
int32_t Wavefront26ZISeqVV1x26HH1x26();
int32_t HorizentalSequence();
int32_t VerticalSequence();
int32_t WavefrontDependencyVectors();
bool IsThreadAssociated() const;
bool IsDependencySet();
uint32_t GetIndexInTsArray();
CM_THREAD_SPACE_DIRTY_STATUS GetDirtyStatus() const;
uint32_t SetDirtyStatus(CM_THREAD_SPACE_DIRTY_STATUS dirtyStatus) const;
bool GetNeedSetKernelPointer() const;
int32_t SetKernelPointer(CmKernelRT *kernel) const;
bool KernelPointerIsNULL() const;
CmKernelRT *GetKernelPointer() const;
int32_t GetMediaWalkerGroupSelect(CM_MW_GROUP_SELECT &groupSelect);
int32_t UpdateDependency();
int32_t SetDependencyArgToKernel(CmKernelRT *pKernel) const;
#if CM_LOG_ON
std::string Log();
#endif
CmThreadGroupSpace *GetThreadGroupSpace() const;
protected:
CmThreadSpaceRT(CmDeviceRT *device,
uint32_t indexTsArray,
uint32_t width,
uint32_t height);
~CmThreadSpaceRT();
int32_t Initialize();
int32_t InitSwScoreBoard();
#ifdef _DEBUG
int32_t PrintBoardOrder();
#endif
CmDeviceRT *m_device;
uint32_t m_width;
uint32_t m_height;
uint32_t m_colorCountMinusOne;
uint32_t m_26ZIBlockWidth;
uint32_t m_26ZIBlockHeight;
CM_THREAD_SPACE_UNIT *m_threadSpaceUnit;
bool m_threadAssociated;
bool m_needSetKernelPointer;
CmKernelRT **m_kernel;
CM_DEPENDENCY_PATTERN m_dependencyPatternType;
CM_DEPENDENCY_PATTERN m_currentDependencyPattern;
CM_HAL_DEPENDENCY m_dependency;
CM_26ZI_DISPATCH_PATTERN m_26ZIDispatchPattern;
CM_26ZI_DISPATCH_PATTERN m_current26ZIDispatchPattern;
uint32_t *m_boardFlag;
uint32_t *m_boardOrderList;
uint32_t m_indexInList;
uint32_t m_indexInThreadSpaceArray; // index in device's ThreadSpaceArray
CM_WALKING_PATTERN m_walkingPattern;
uint32_t m_walkingParameters[CM_NUM_DWORD_FOR_MW_PARAM];
bool m_mediaWalkerParamsSet;
CM_HAL_DEPENDENCY m_dependencyVectors;
bool m_dependencyVectorsSet;
bool m_threadSpaceOrderSet;
CmSurface2D *m_swBoardSurf; // SWSB 2D atomic
uint32_t *m_swBoard; // SWSB system memory store
bool m_swScoreBoardEnabled;
// used to emulate thread space when media walker is not available
CmThreadGroupSpace *m_threadGroupSpace;
private:
CmThreadSpaceRT(const CmThreadSpaceRT &other);
CmThreadSpaceRT &operator=(const CmThreadSpaceRT &other);
CM_THREAD_SPACE_DIRTY_STATUS *m_dirtyStatus;
CM_HAL_WAVEFRONT26Z_DISPATCH_INFO m_wavefront26ZDispatchInfo;
//Group select in media pipe, by default no group setting
CM_MW_GROUP_SELECT m_groupSelect;
};
}; //namespace
#endif // #ifndef MEDIADRIVER_AGNOSTIC_COMMON_CM_CMTHREADSPACERT_H_
|