mirror of
https://github.com/UniXNU/NativeMetal.git
synced 2026-11-21 02:41:29 +03:00
fix(diagnostics): send each distinct refusal to the GPU trace
With sheng-gpu-trace=1 a refusal text reaches the kernel ring as event 65 in up to two 88-character parts.
This commit is contained in:
@@ -514,6 +514,15 @@ static void noteProblem(NSString *what) {
|
||||
if(native_bridge_metal_problem_hook)native_bridge_metal_problem_hook(gFirstProblem);
|
||||
}
|
||||
}
|
||||
// With sheng-gpu-trace=1 each distinct refusal text reaches the kernel GPU ring (event 65, 88 characters a part), for the processes
|
||||
// whose crash follows a nil Metal object (iconservicesagent in untagged-102cb4a069).
|
||||
if(gpuTraceOn() && gFrameTransport) {
|
||||
const char *text=what.UTF8String?:"?";const size_t length=strlen(text);
|
||||
for(uint64_t part=0;part<2 && part*88<length;++part) {
|
||||
NativeGpuTraceRecord rec{};rec.event=GpuTraceProblem;rec.value[0]=part;
|
||||
strncpy((char *)&rec.value[1],text+part*88,88);(void)gFrameTransport(NativeGpuTraceMethod,&rec,sizeof(rec));
|
||||
}
|
||||
}
|
||||
memcpy(gLastProblems[1],gLastProblems[0],sizeof gLastProblems[0]);
|
||||
strlcpy(gLastProblems[0],what.UTF8String?:"?",sizeof gLastProblems[0]);
|
||||
}
|
||||
|
||||
+3
-2
@@ -9,10 +9,11 @@ static inline bool native_gpu_latency_stage(uint32_t stage) {
|
||||
return (stage >= 1 && stage <= 16) || (stage >= 40 && stage <= 57);
|
||||
}
|
||||
/* The kernel ring keeps GPU submission and retirement, display arrival, fence
|
||||
* and latch, build identity and the render threads the CPU sampler follows. */
|
||||
* and latch, build identity, the render threads the CPU sampler follows and
|
||||
* each process's Metal refusals (event 65, the text of what failed). */
|
||||
static inline bool native_gpu_latency_event(uint32_t event,const uint64_t *,uint32_t) {
|
||||
switch(event) {
|
||||
case 1:case 3:case 10:case 11:case 20:case 21:case 22:case 23:case 63:return true;
|
||||
case 1:case 3:case 10:case 11:case 20:case 21:case 22:case 23:case 63:case 65:return true;
|
||||
default:return false;
|
||||
}
|
||||
}
|
||||
|
||||
+1
-1
@@ -12,7 +12,7 @@ enum {
|
||||
GpuTraceConfig=1, GpuTraceBuild=3,
|
||||
GpuTraceSubmit=10, GpuTraceRetire=11,
|
||||
GpuTraceDisplay=20, GpuTraceDisplaySurface=21, GpuTraceDisplayFence=22,
|
||||
GpuTraceDisplayLatch=23, GpuTraceThread=63
|
||||
GpuTraceDisplayLatch=23, GpuTraceThread=63, GpuTraceProblem=65
|
||||
};
|
||||
struct NativeGpuTraceRecord {
|
||||
uint64_t sequence,us;
|
||||
|
||||
Reference in New Issue
Block a user