Fix potential nvdrv submission race

The syncpoint maximum value represents the maximum possible syncpt value at a given time, however due to PBs being submitted before max was incremented, for a brief moment of time this is not the case which could lead to crashes or other such behaviour if a game waits on the fence at the right moment.
This commit is contained in:
Billy Laws 2022-06-01 17:12:23 +01:00
parent 37453ed7fa
commit 91b2c47991

View File

@ -108,13 +108,13 @@ namespace skyline::service::nvdrv::device::nvhost {
}
}
channelCtx->gpfifo.Push(gpEntries.subspan(0, numEntries));
fence.id = channelSyncpoint;
u32 increment{(flags.fenceIncrement ? 2 : 0) + (flags.incrementWithValue ? fence.threshold : 0)};
fence.threshold = core.syncpointManager.IncrementSyncpointMaxExt(channelSyncpoint, increment);
channelCtx->gpfifo.Push(gpEntries.subspan(0, numEntries));
if (flags.fenceIncrement) {
// Wraparound
if (pushBufferMemoryOffset + SyncpointIncrCmdMaxLen >= pushBufferMemory.size())