MCPcopy Create free account
hub / github.com/GameTechDev/PresentMon / RegisterHwQueueContext

Method RegisterHwQueueContext

PresentData/GpuTrace.cpp:141–178  ·  view source on GitHub ↗

HwQueue's are similar to Contexts, but are used with HWS nodes and use the following pattern: Context_Start hContext=C hDevice=D NodeOrdinal=N HwQueue_Start hContext=C hHwQueue=0x0 ParentDxgHwQueue=Q1 HwQueue_Start hContext=C hHwQueue=H1 ParentDxgHwQueue=Q2 HwQueue_Start hContext=C hHwQueue=H2 ParentDxgHwQueue=Q3 ... DxgKrnl_QueuePacket_Start hContext=Q2 SubmitSequence=S ... ... DxgKrnl_QueuePac

Source from the content-addressed store, hash-verified

139// HwQueue_Stop hContext=C hHwQueue=0x0 ParentDxgHwQueue=Q1
140// Context_Stop hContext=C
141void GpuTrace::RegisterHwQueueContext(uint64_t hContext, uint64_t parentDxgHwQueue)
142{
143 DebugAssert(mContexts.find(hContext) != mContexts.end());
144 DebugAssert(mContexts.find(parentDxgHwQueue) == mContexts.end());
145
146 // Look up the context C, which we're calling the parent context. We
147 // should already have seen a Context_Start event.
148 auto ii = mContexts.find(hContext);
149 if (ii == mContexts.end()) {
150 return;
151 }
152 auto parentContext = &ii->second;
153
154 DebugAssert(parentContext->mParentContext == 0);
155 DebugAssert(parentContext->mIsHwQueue == false);
156 parentContext->mIsParentContext = true;
157
158 // Create a new context for the HWQueue. Even though they map the same
159 // device engine, HWQueues need their own context so that tracked sequence
160 // IDs are ordered.
161 //
162 // If there are two HwQueues that map to the same engine, it's not clear
163 // whether or not queue packets running at the same time are really running
164 // simultaneous, but since we're counting any duration where at least one
165 // node is running it doesn't matter.
166
167 Node* node = new Node();
168 node->mQueueIndex = 0;
169 node->mQueueCount = 0;
170 node->mIsVideo = parentContext->mNode->mIsVideo;
171
172 auto hwQueueContext = &mContexts.emplace(parentDxgHwQueue, Context()).first->second;
173 hwQueueContext->mPacketTrace = parentContext->mPacketTrace;
174 hwQueueContext->mNode = node;
175 hwQueueContext->mParentContext = hContext;
176 hwQueueContext->mIsParentContext = false;
177 hwQueueContext->mIsHwQueue = true;
178}
179
180void GpuTrace::UnregisterContext(uint64_t hContext)
181{

Callers 1

HandleDXGKEventMethod · 0.80

Calls 2

ContextClass · 0.70
endMethod · 0.45

Tested by

no test coverage detected