X-Git-Url: https://notaz.gp2x.de/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=plugins%2Fgpulib%2Fgpulib_thread_if.c;h=c18a6f606d69687e7c9e057efc3b195f507590a5;hb=f99193c2c2ec0ab56636773949fae34d847d91b0;hp=c95f5295ef37a28c72882c9d36236db573f2f019;hpb=54b375e0d7031d0fae9deb0f7ba815793ae4115e;p=pcsx_rearmed.git diff --git a/plugins/gpulib/gpulib_thread_if.c b/plugins/gpulib/gpulib_thread_if.c index c95f5295..c18a6f60 100644 --- a/plugins/gpulib/gpulib_thread_if.c +++ b/plugins/gpulib/gpulib_thread_if.c @@ -60,6 +60,7 @@ static video_thread_queue queues[2]; static int thread_rendering; static BOOL hold_cmds; static BOOL needs_display; +static BOOL flushed; extern const unsigned char cmd_lengths[]; @@ -132,7 +133,6 @@ static void cmd_queue_swap() { tmp = thread.queue; thread.queue = thread.bg_queue; thread.bg_queue = tmp; - needs_display = TRUE; pthread_cond_signal(&thread.cond_msg_avail); } pthread_mutex_unlock(&thread.queue_lock); @@ -168,6 +168,13 @@ void renderer_sync(void) { return; } + if (thread.bg_queue->used) { + /* When we flush the background queue, the vblank handler can't + * know that we had a frame pending, and we delay rendering too + * long. Force it. */ + flushed = TRUE; + } + /* Flush both queues. This is necessary because gpulib could be * trying to process a DMA write that a command in the queue should * run beforehand. For example, Xenogears sprites write a black @@ -378,9 +385,9 @@ void renderer_sync_ecmds(uint32_t * ecmds) { } } -void renderer_update_caches(int x, int y, int w, int h) { +void renderer_update_caches(int x, int y, int w, int h, int state_changed) { renderer_sync(); - real_renderer_update_caches(x, y, w, h); + real_renderer_update_caches(x, y, w, h, state_changed); } void renderer_flush_queues(void) { @@ -433,7 +440,7 @@ void renderer_notify_update_lace(int updated) { } pthread_mutex_lock(&thread.queue_lock); - if (thread.bg_queue->used) { + if (thread.bg_queue->used || flushed) { /* We have commands for a future frame to run. Force a wait until * the current frame is finished, and start processing the next * frame after it's drawn (see the `updated` clause above). */ @@ -444,6 +451,7 @@ void renderer_notify_update_lace(int updated) { /* We are no longer holding commands back, so the next frame may * get mixed into the following frame. This is usually fine, but can * result in frameskip-like effects for 60fps games. */ + flushed = FALSE; hold_cmds = FALSE; needs_display = TRUE; gpu.state.fb_dirty = TRUE;