fix: Metal kIOGPUCommandBufferCallbackErrorSubmissionsIgnored error
This commit is contained in:
1 parent
e619d31622
commit
56729469bf
1 file changed
+14
@@ -724,8 +724,19 @@ CFStringRef __currentColorSpace;
|
|||||||
dispatch_semaphore_signal(block_semaphore);
|
dispatch_semaphore_signal(block_semaphore);
|
||||||
|
|
||||||
if (cb.error) {
|
if (cb.error) {
|
||||||
|
Log(LOG_E, @"Command buffer error: %@", cb.error);
|
||||||
// Request IDR frame to recover from rendering error
|
// Request IDR frame to recover from rendering error
|
||||||
LiRequestIdrFrame();
|
LiRequestIdrFrame();
|
||||||
|
|
||||||
|
// Clear the command queue to reset GPU state
|
||||||
|
if (cb.status == MTLCommandBufferStatusError) {
|
||||||
|
NSError *error = cb.error;
|
||||||
|
if (error.code == 2 || error.code == 4) { // GPU timeout or submissions ignored
|
||||||
|
Log(LOG_W, @"GPU timeout detected, flushing command queue");
|
||||||
|
// Force texture cache flush
|
||||||
|
CVMetalTextureCacheFlush(self->_textureCache, 0);
|
||||||
|
}
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
const CFTimeInterval GPUTime = cb.GPUEndTime - cb.GPUStartTime;
|
const CFTimeInterval GPUTime = cb.GPUEndTime - cb.GPUStartTime;
|
||||||
const double alpha = 0.25f;
|
const double alpha = 0.25f;
|
||||||
@@ -759,6 +770,9 @@ CFStringRef __currentColorSpace;
|
|||||||
if (result != 0) {
|
if (result != 0) {
|
||||||
Log(LOG_W, @"MetalVideoRenderer semaphore timeout - requesting IDR frame");
|
Log(LOG_W, @"MetalVideoRenderer semaphore timeout - requesting IDR frame");
|
||||||
LiRequestIdrFrame(); // Request recovery
|
LiRequestIdrFrame(); // Request recovery
|
||||||
|
|
||||||
|
// Force flush the texture cache when we timeout
|
||||||
|
CVMetalTextureCacheFlush(_textureCache, 0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in new issue
Block a user