sdltrs: display of typed characters lags keyboard, sometimes permanently by one character
-
@mitu Thanks for testing and adding
sdl2trs
to RetroPie! :-)My temporary workaround that I found was to force
trs_sdl_flush
to redraw, by ignoring thedrawnRectCount
check (which seems to work also, but obviously not correct) and my next step was to investigate why the check fails - in some cases - with KMSDRM.That was also my first try, but the emulator screen was not redrawn after leaving the TextGUI. It will also burn some CPU cycles ... ;-)
Sometimes the screen is not updated in
Wayland
after resizing, but for now the patch is committed: https://gitlab.com/jengun/sdltrs/-/commit/a817f5e817db7166a4654fa735a4abb848534a45 -
@JenGun Thanks very much for showing up with a fix. This is excellent.
It does raise a question, however: does the change actually qualify as a fix to a bug in sdl2trs, or is this a workaround to a bug that is elsewhere?
I think it's at least somewhat important. If you read my comments above, you'll see that a similar issue occurs with respect to the hatari gui. This suggests that the real bug is downstream of sdl2trs. It might be in SDL itself, or it might even be downstream of that. No idea. As long as the fix here is benign then it's all good, but if there's any way to use this to discover where the real bug is, it might be worth pursuing.
Thanks again for the fix, it's greatly appreciated!
-
It does raise a question, however: does the change actually qualify as a fix to a bug in sdl2trs, or is this a workaround to a bug that is elsewhere?
Good question ... I would cautiously refer to it as a "workaround": the error only seems to occur on a few systems and why
RenderClear
fixes it is not entirely clear to me ... maybe this will flush the render command queue ...Something similar happens here on another machine: the SDL window turns completely white after a few seconds. An old version (SDL 2.0.9) fixes the problem ... with newer versions a superfluous
SDL_RenderDrawPoint
is needed afterSDL_UpdateTexture
...In
hatari
theRenderClear
command is also "missing", so the fix might also apply:diff --git a/src/screen.c b/src/screen.c index 32765a48..a609ca34 100644 --- a/src/screen.c +++ b/src/screen.c @@ -115,6 +115,7 @@ void SDL_UpdateRects(SDL_Surface *screen, int numrects, SDL_Rect *rects) if (bUseSdlRenderer) { SDL_UpdateTexture(sdlTexture, NULL, screen->pixels, screen->pitch); + SDL_RenderClear(sdlRenderer); SDL_RenderCopy(sdlRenderer, sdlTexture, NULL, NULL); SDL_RenderPresent(sdlRenderer); }
-
@JenGun this does seem to improve things, at least for the Hatari menu. For the record, RetroPie includes libSDL2 2.0.10.
-
@mitu It makes the SDL GUI work in
Wayland
. ReplacingSDL_RenderClear
withSDL_RenderDrawPoint
also seems to fix the issue ... -
The issue in
hatari
is also fixed upstream:
https://github.com/hatari/hatari/commit/191a35fe24b340be143e9a368698123cdf0280b7 -
@JenGun Thank you for submitting the patch. We may have to include it locally before a new Hatari release.
-
@mitu the last release was some time ago (2019 afair) so I was going to maybe try out git HEAD version. But maybe a new release will be out soon also and we can just do a patch.
-
@mitu Sorry, the URL was malformed. They use
SDL_RenderClear
only for hardware accelerated cards to avoid the problem. If the Renderer falls back to SW rendering (for whatever reason), it will break again ... -
But maybe a new release will be out soon also and we can just do a patch.
Seems they are preparing to release version 2.3 ...
Contributions to the project are always appreciated, so if you would like to support us with a donation you can do so here.
Hosting provided by Mythic-Beasts. See the Hosting Information page for more information.