mirror of
https://github.com/libretro/RetroArch.git
synced 2026-11-09 17:29:21 -10:00
video: take a deferred view count shrink before releasing its frame
The threaded wrapper applied a deferred shrink after video_thread_ring_complete(), so a main thread leaving video_thread_wait_idle() could use the driver while the video thread was still freeing its view chains. Apply it while the frame's slot is still held; the harness now checks the slot was held when the shrink arrived.
This commit is contained in:
1 parent
56952c9a25
commit
164ad4688b
2 files changed
+12
-2
No files matched your search
@@ -3289,9 +3289,11 @@ static void video_thread_loop(void *data)
|
||||
thr->frame.mem_busy |= 1u << frame_mem;
|
||||
retro_atomic_store_release_int(&thr->frame.mem[frame_mem].busy, 1);
|
||||
}
|
||||
video_thread_ring_complete(thr);
|
||||
/* Before the slot goes: whoever waited for an idle ring may
|
||||
* use the driver the moment it sees one */
|
||||
if (thr->views_shrink_left && !--thr->views_shrink_left)
|
||||
video_thread_views_apply(thr, thr->views_shrink_to);
|
||||
video_thread_ring_complete(thr);
|
||||
|
||||
if (tex_retire)
|
||||
{
|
||||
|
||||
@@ -5894,7 +5894,9 @@ static void vshrink_set_view_count(void *data, unsigned count)
|
||||
vshrink_wait_cmd();
|
||||
}
|
||||
vshrink_count = count;
|
||||
vshrink_note('S', count, 0);
|
||||
/* Whether a frame's slot was still held when it reached the driver */
|
||||
vshrink_note('S', count, VIDEO_THREAD_RING_BUSY_OF(
|
||||
retro_atomic_load_acquire_int(&vshrink_thr->frame.state)));
|
||||
}
|
||||
|
||||
static void vshrink_get_poke(void *data, const video_poke_interface_t **iface)
|
||||
@@ -6008,8 +6010,14 @@ static void vshrink_case(const char *name, video_frame_info_t *info,
|
||||
CHECK(s >= 0 && s < f, "%s: the grow to %u reached the driver at "
|
||||
"%d, after the frame queued ahead of it (%d)", name, to, s, f);
|
||||
else
|
||||
{
|
||||
CHECK(s > f, "%s: the shrink to %u reached the driver at %d, "
|
||||
"before the frame queued ahead of it (%d)", name, to, s, f);
|
||||
CHECK(s >= 0 && vshrink_log[s].views,
|
||||
"%s: the shrink to %u reached the driver after its frame's "
|
||||
"slot was released, with the ring already reading idle",
|
||||
name, to);
|
||||
}
|
||||
f = vshrink_find('F', last + 1);
|
||||
CHECK(f >= 0 && vshrink_log[f].count == to,
|
||||
"%s: the frame after the count change drew at count %u, wanted %u",
|
||||
|
||||
Reference in new issue
Block a user