This rewrites the queue. It replaces it with a new MPMC queue.
https://github.com/yuzu-emu/yuzu/pull/6868#issuecomment-898693448
> Tbh due to bad use the SPSCQueue is no longer SPSC (Single Producer Single Consumer) nor lockfree.
The new queue tolerates non-SPSC use. It is also lockfree on push if no thread is waiting and on pop if there are available items or waiting is not requested.
> best is to replace its instances for std::deque or srd::queue.
I had to write my own queue because of thread safety concerns in the standard library.
I have not noticed any crashes or performance decreases. I ***hope*** it stays that way. If anything breaks, please 100% blame @FernandoS27 and @bunnei for making me work on this hard task.
This fixes a lost wakeup in SPSCQueue. If the reader is in just the right position, the writer's notification will be lost and this will be a problem if the writer then does something to wait on the reader.
This was discovered to affect my upcoming stacktrace PR. I don't think any performance decrease will be noticeable because an uncontended mutex is smart enough to skip the syscall. This PR might also resolve some rare deadlocks but I don't know of any examples.
According to https://stackoverflow.com/questions/469508, we run into a
MSVC bug (since VS 2005) when using diamond inheritance for
RangedSetting.
This explicitly implements those functions in RangedSetting. GetValue is
implemented as just calling the inherited version. The explicit
converson operator is reimplemented. I opted for this over ignoring the
warning with a pragma since this specifies the inherited behavior, and I
have now less faith in MSVC to pick the right one.
In addition, we mark destructors as virtual to silence what I believe is
a fair MSVC compilation error.
This was mainly used to keep track of mapped buffers for later unmapping. Since unmap is no longer implemented, this no longer seves a valuable purpose.
With reference frames refreshes fix, we no longer need to buffer two frames in advance.
We can also remove other unused or otherwise unneeded variables.
Skip unmapping nvdec buffers to avoid breaking the continuity of the VP9 reference frame addresses, and the risk of invalidating data before the async GPU thread is done with it.