summaryrefslogtreecommitdiff
path: root/Source/Core/VideoCommon/Fifo.cpp
diff options
context:
space:
mode:
authorskidau <skidau@gmail.com>2015-04-27 19:47:00 +1000
committerskidau <skidau@gmail.com>2015-04-27 19:47:00 +1000
commit4bf4778cd7ab24df6db1122df997158d214ba4f3 (patch)
treef7c0d8bb16cc321f9c309861917e4bb124a71335 /Source/Core/VideoCommon/Fifo.cpp
parentb8eecff5c99dd29e1b1db401e48df4d71d2bd44e (diff)
parent06dd0ba3b467487a697d0bcb66d929e2a1516620 (diff)
Merge pull request #2312 from comex/shutdown-race-condition
Exit ReadDataFromFifoOnCPU, PushFifoAuxBuffer early if shutting down (GpuRunningState=false)
Diffstat (limited to 'Source/Core/VideoCommon/Fifo.cpp')
-rw-r--r--Source/Core/VideoCommon/Fifo.cpp13
1 files changed, 12 insertions, 1 deletions
diff --git a/Source/Core/VideoCommon/Fifo.cpp b/Source/Core/VideoCommon/Fifo.cpp
index c5e49fb583..0b29f2da0a 100644
--- a/Source/Core/VideoCommon/Fifo.cpp
+++ b/Source/Core/VideoCommon/Fifo.cpp
@@ -145,7 +145,7 @@ void EmulatorState(bool running)
void SyncGPU(SyncGPUReason reason, bool may_move_read_ptr)
{
- if (g_use_deterministic_gpu_thread && GpuRunningState)
+ if (g_use_deterministic_gpu_thread)
{
std::unique_lock<std::mutex> lk(s_video_buffer_lock);
u8* write_ptr = s_video_buffer_write_ptr;
@@ -185,6 +185,11 @@ void PushFifoAuxBuffer(void* ptr, size_t size)
if (size > (size_t) (s_fifo_aux_data + FIFO_SIZE - s_fifo_aux_write_ptr))
{
SyncGPU(SYNC_GPU_AUX_SPACE, /* may_move_read_ptr */ false);
+ if (!GpuRunningState)
+ {
+ // GPU is shutting down
+ return;
+ }
if (size > (size_t) (s_fifo_aux_data + FIFO_SIZE - s_fifo_aux_write_ptr))
{
// That will sync us up to the last 32 bytes, so this short region
@@ -235,6 +240,12 @@ static void ReadDataFromFifoOnCPU(u32 readPtr)
// We can't wrap around while the GPU is working on the data.
// This should be very rare due to the reset in SyncGPU.
SyncGPU(SYNC_GPU_WRAPAROUND);
+ if (!GpuRunningState)
+ {
+ // GPU is shutting down
+ return;
+ }
+
if (s_video_buffer_pp_read_ptr != s_video_buffer_read_ptr)
{
PanicAlert("desynced read pointers");