| 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 |
#ifndef MEDIADRIVER_AGNOSTIC_COMMON_CM_CMEVENTRT_H_ |
| 28 |
#define MEDIADRIVER_AGNOSTIC_COMMON_CM_CMEVENTRT_H_ |
| 29 |
|
| 30 |
#include "cm_event.h" |
| 31 |
#include "cm_csync.h" |
| 32 |
#include "cm_hal.h" |
| 33 |
#include "cm_log.h" |
| 34 |
|
| 35 |
namespace CMRT_UMD |
| 36 |
{ |
| 37 |
class CmDeviceRT; |
| 38 |
class CmEventRT; |
| 39 |
class CmQueueRT; |
| 40 |
class CmTaskRT; |
| 41 |
class CmTaskInternal; |
| 42 |
class CmThreadGroupSpace; |
| 43 |
class CmThreadSpaceRT; |
| 44 |
}; |
| 45 |
|
| 46 |
#define CM_CALLBACK __cdecl |
| 47 |
typedef void (CM_CALLBACK *EventCallBackFunction)(CMRT_UMD::CmEventRT*, void*); |
| 48 |
|
| 49 |
namespace CMRT_UMD |
| 50 |
{ |
| 51 |
class CmEventRT: public CmEvent |
| 52 |
{ |
| 53 |
public: |
| 54 |
static int32_t Create(uint32_t index, |
| 55 |
CmQueueRT *queue, |
| 56 |
CmTaskInternal *task, |
| 57 |
int32_t taskDriverId, |
| 58 |
CmDeviceRT *device, |
| 59 |
bool isVisible, |
| 60 |
CmEventRT *&event); |
| 61 |
|
| 62 |
static int32_t Destroy(CmEventRT *&event); |
| 63 |
|
| 64 |
CM_RT_API int32_t GetStatus(CM_STATUS &status); |
| 65 |
|
| 66 |
CM_RT_API int32_t GetExecutionTime(uint64_t &time); |
| 67 |
|
| 68 |
CM_RT_API int32_t |
| 69 |
WaitForTaskFinished(uint32_t timeOutMs = CM_MAX_TIMEOUT_MS); |
| 70 |
|
| 71 |
CM_RT_API int32_t GetSurfaceDetails(uint32_t kernIndex, |
| 72 |
uint32_t surfBTI, |
| 73 |
CM_SURFACE_DETAILS &outDetails); |
| 74 |
|
| 75 |
CM_RT_API int32_t GetProfilingInfo(CM_EVENT_PROFILING_INFO infoType, |
| 76 |
size_t paramSize, |
| 77 |
void *inputValue, |
| 78 |
void *value); |
| 79 |
|
| 80 |
CM_RT_API int32_t GetExecutionTickTime(uint64_t &ticks); |
| 81 |
|
| 82 |
int32_t GetIndex(uint32_t &index); |
| 83 |
|
| 84 |
int32_t SetTaskDriverId(int32_t id); |
| 85 |
|
| 86 |
int32_t GetTaskDriverId(int32_t &id); |
| 87 |
|
| 88 |
int32_t SetTaskOsData(void *data); |
| 89 |
|
| 90 |
int32_t SetSurfaceDetails(CM_HAL_SURFACE_ENTRY_INFO_ARRAYS surfaceInfo); |
| 91 |
|
| 92 |
int32_t Acquire(void); |
| 93 |
|
| 94 |
int32_t SafeRelease(void); |
| 95 |
|
| 96 |
int32_t SetKernelNames(CmTaskRT *task, |
| 97 |
CmThreadSpaceRT *threadSpace, |
| 98 |
CmThreadGroupSpace *threadGroupSpace); |
| 99 |
|
| 100 |
int32_t SetEnqueueTime(LARGE_INTEGER time); |
| 101 |
|
| 102 |
int32_t SetCompleteTime(LARGE_INTEGER time); |
| 103 |
|
| 104 |
int32_t GetSubmitTime(LARGE_INTEGER *time); |
| 105 |
|
| 106 |
int32_t GetHWStartTime(LARGE_INTEGER *time); |
| 107 |
|
| 108 |
int32_t GetHWEndTime(LARGE_INTEGER *time); |
| 109 |
|
| 110 |
int32_t GetCompleteTime(LARGE_INTEGER *time); |
| 111 |
|
| 112 |
uint32_t GetKernelCount(); |
| 113 |
|
| 114 |
int32_t GetEnqueueTime(LARGE_INTEGER *time); |
| 115 |
|
| 116 |
int32_t SetCallBack(EventCallBackFunction function, void *userData); |
| 117 |
|
| 118 |
int32_t GetStatusNoFlush(CM_STATUS &status); |
| 119 |
|
| 120 |
int32_t ModifyStatus(CM_STATUS status, uint64_t elapsedTime); |
| 121 |
|
| 122 |
int32_t GetQueue(CmQueueRT *&queue); |
| 123 |
|
| 124 |
int32_t Query(); |
| 125 |
|
| 126 |
CM_STATUS GetStatusWithoutFlush(); |
| 127 |
|
| 128 |
#if CM_LOG_ON |
| 129 |
std::string Log(const char *callerFuncName); |
| 130 |
|
| 131 |
CM_HAL_STATE* GetHalState(); |
| 132 |
#endif |
| 133 |
|
| 134 |
protected: |
| 135 |
CmEventRT(uint32_t index, |
| 136 |
CmQueueRT *queue, |
| 137 |
CmTaskInternal *task, |
| 138 |
int32_t taskDriverId, |
| 139 |
CmDeviceRT *device, |
| 140 |
bool isVisible); |
| 141 |
|
| 142 |
~CmEventRT(); |
| 143 |
|
| 144 |
int32_t Initialize(); |
| 145 |
|
| 146 |
void UnreferenceIfNeeded(void *pdata); |
| 147 |
|
| 148 |
uint32_t m_index; |
| 149 |
int32_t m_taskDriverId; |
| 150 |
void *m_osData; |
| 151 |
|
| 152 |
CM_STATUS m_status; |
| 153 |
uint64_t m_time; |
| 154 |
uint64_t m_ticks; |
| 155 |
uint64_t m_hwStartTimeStampInTicks; |
| 156 |
uint64_t m_hwEndTimeStampInTicks; |
| 157 |
|
| 158 |
LARGE_INTEGER m_globalSubmitTimeCpu; |
| 159 |
LARGE_INTEGER m_submitTimeGpu; |
| 160 |
LARGE_INTEGER m_hwStartTimeStamp; |
| 161 |
LARGE_INTEGER m_hwEndTimeStamp; |
| 162 |
LARGE_INTEGER m_completeTime; |
| 163 |
LARGE_INTEGER m_enqueueTime; |
| 164 |
|
| 165 |
|
| 166 |
char **m_kernelNames; |
| 167 |
uint32_t *m_threadSpace; |
| 168 |
uint32_t m_kernelCount; |
| 169 |
|
| 170 |
CmDeviceRT* m_device; |
| 171 |
CmQueueRT *m_queue; |
| 172 |
|
| 173 |
int32_t m_refCount; |
| 174 |
|
| 175 |
bool m_isVisible; |
| 176 |
|
| 177 |
CM_HAL_SURFACE_ENTRY_INFO_ARRAYS m_surEntryInfoArrays; |
| 178 |
CmTaskInternal *m_task; |
| 179 |
|
| 180 |
CSync m_criticalSectionQuery; |
| 181 |
|
| 182 |
|
| 183 |
EventCallBackFunction m_callbackFunction; |
| 184 |
void *m_callbackUserData; |
| 185 |
|
| 186 |
private: |
| 187 |
bool m_osSignalTriggered; |
| 188 |
|
| 189 |
CmEventRT(const CmEventRT& other); |
| 190 |
CmEventRT& operator=(const CmEventRT& other); |
| 191 |
}; |
| 192 |
} |
| 193 |
|
| 194 |
#endif |