Skip to content

Further discussion about threading and overlays #32

Description

@vanfanel

Hi there,

I am opening this to discuss the use of this as a workaround for the several seconds stalls in DL2:

SDL_CondWaitTimeout(g_yuv_surface->pending_update_cond, g_yuv_surface->mutex, 100);

Original PR:

#24

Original analysis by @lmerckx is copied here for convenience:

Some games (bega, astron, ...) freezes during some seconds and restart after a timeout message VLDP error! Timed out waiting for internal thread to accept command!:
This problems seems due to the "lock" system between methods vid_blit and vid_update_yuv_overlay.
Indeed, these methods use SDL_CondWait and SDL_CondSignal to avoid conflict when changing same texture.
But for these games, vid_update_yuv_overlay is called twice (setting vid_update_yuv_overlay to true) without any call to vid_blit.
It leads in a blocking call to vid_update_yuv_overlay, which also blocks the command handler; and avoid processing other command.
Only the timeout, after about 7 seconds, unblocks the emulator.
So, I replace SDL_CondWait by SDL_CondWaitTimeout (with a timeout of 100 ms) to solve the problem.

The blocking should not happen to start with. This seems like a workaround and not a true solution. Any ideas?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions