Bug 2037565

Summary: tucnak: broken video and coredumps
Product: [Fedora] Fedora Reporter: Jaroslav Škarvada <jskarvad>
Component: sdl12-compatAssignee: Neal Gompa <ngompa13>
Status: CLOSED ERRATA QA Contact:
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 35CC: icculus, ngompa13, sezeroz
Target Milestone: ---   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: sdl12-compat-1.2.60-1.fc36 sdl12-compat-1.2.60-1.fc35 sdl12-compat-1.2.60-1.fc37 Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2022-11-04 10:45:12 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Jaroslav Škarvada 2022-01-05 22:51:49 UTC
Description of problem:
tucnak is unusable with the sdl12-compat (tested with X server not with the Wayland).

Version-Release number of selected component (if applicable):
sdl12-compat-0.0.1~git.20211125.4e4527a-1.fc35.x86_64

How reproducible:
Always

Steps to Reproduce:
1. dnf install tucnak
2. tucnak
3.

Actual results:
Broken video and often coredumps

Expected results:
Video OK and no coredumps

Additional info:
The video is badly broken that the screen is unreadable.

Comment 1 Jaroslav Škarvada 2022-01-05 23:23:05 UTC
By removing sdl12-compat, compiling sdl12 f34 branch for the f35 and installing it, tucnak works as expected.

Comment 2 Neal Gompa 2022-01-05 23:41:47 UTC
While this probably does expose a bug in sdl12-compat (which is worth forwarding upstream), I see that libzia supports GTK3 and SDL2, can you try switching to that first?

Comment 3 Jaroslav Škarvada 2022-01-06 01:13:37 UTC
It seems it works with SDL2, I will try switching in f35+.

Comment 4 Ryan C. Gordon 2022-09-01 16:40:37 UTC
Heads up, we've worked around this in sdl12-compat, so it should work out of the box now without switching libzia to the SDL2 target (but your eventual goal _should be_ to switch to the SDL2 target!).

The sdl12-compat bug report where the details are is located here:

https://github.com/libsdl-org/sdl12-compat/issues/182

The fix is already in our revision control, and we're about to finalize an official 1.2.54 release of sdl12-compat, so once that makes it into the world and the package gets updated, very soon, this bug should be resolved, too.

Sorry for the trouble!

--ryan.

Comment 5 Jaroslav Škarvada 2022-09-05 08:11:27 UTC
(In reply to Ryan C. Gordon from comment #4)
> Heads up, we've worked around this in sdl12-compat, so it should work out of
> the box now without switching libzia to the SDL2 target (but your eventual
> goal _should be_ to switch to the SDL2 target!).
> 
> The sdl12-compat bug report where the details are is located here:
> 
> https://github.com/libsdl-org/sdl12-compat/issues/182
> 
> The fix is already in our revision control, and we're about to finalize an
> official 1.2.54 release of sdl12-compat, so once that makes it into the
> world and the package gets updated, very soon, this bug should be resolved,
> too.
> 
> Sorry for the trouble!
> 
> --ryan.

Great, thanks for info. We now have libzia on SDL2, but this fix could help other projects.

Comment 6 Ozkan Sezer 2022-09-19 15:09:38 UTC
As noted in https://github.com/libsdl-org/sdl12-compat/issues/182
applying the following patch to libzia v4.35 or 4.36 fixes 24 bit
rendering when tucnak is run against sdl12-compat-1.2.56 which is
what fedora recently adopted.

diff -up  a/src/zsdl.c b/src/zsdl.c
--- a/src/zsdl.c
+++ a/src/zsdl.c
@@ -319,7 +319,7 @@ void z_putpixel24(SDL_Surface *surface, 
     Uint8  *p8;
 
     if (z_clip_pixel(&surface->clip_rect, x, y)) return;
-    p16 = (Uint16 *) surface->pixels + y*surface->pitch/3 + x;
+    p16 = (Uint16 *) ((Uint8 *)surface->pixels + y*surface->pitch + x*3);
     p8  = (Uint8 *)  (p16+1); 
     *p16 = color;     /* TODO Big endian? */
     *p8  = color>>16; 
@@ -354,7 +354,7 @@ void z_putpixel24inv(SDL_Surface *surfac
     Uint8  *p8;
 
     if (z_clip_pixel(&surface->clip_rect, x, y)) return;
-    p16 = (Uint16 *) surface->pixels + y*surface->pitch/3 + x;
+    p16 = (Uint16 *) ((Uint8 *)surface->pixels + y*surface->pitch + x*3);
     p8  = (Uint8 *)  (p16+1); 
     *p16 = ~color;     /* TODO Big endian? */
     *p8  = ~(color>>16);

Comment 7 Jaroslav Škarvada 2022-09-26 17:44:20 UTC
(In reply to Ozkan Sezer from comment #6)

Thanks, I forwarded the patch to tucnak upstream.

Comment 8 Fedora Update System 2022-10-30 22:48:40 UTC
FEDORA-2022-e4559c8ed0 has been submitted as an update to Fedora 37. https://bodhi.fedoraproject.org/updates/FEDORA-2022-e4559c8ed0

Comment 9 Fedora Update System 2022-10-30 22:48:41 UTC
FEDORA-2022-9400b16a0a has been submitted as an update to Fedora 35. https://bodhi.fedoraproject.org/updates/FEDORA-2022-9400b16a0a

Comment 10 Fedora Update System 2022-10-30 22:48:41 UTC
FEDORA-2022-4b844fbebe has been submitted as an update to Fedora 36. https://bodhi.fedoraproject.org/updates/FEDORA-2022-4b844fbebe

Comment 11 Fedora Update System 2022-10-31 08:06:20 UTC
FEDORA-2022-e4559c8ed0 has been pushed to the Fedora 37 testing repository.
Soon you'll be able to install the update with the following command:
`sudo dnf upgrade --enablerepo=updates-testing --refresh --advisory=FEDORA-2022-e4559c8ed0`
You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-2022-e4559c8ed0

See also https://fedoraproject.org/wiki/QA:Updates_Testing for more information on how to test updates.

Comment 12 Fedora Update System 2022-10-31 10:28:30 UTC
FEDORA-2022-4b844fbebe has been pushed to the Fedora 36 testing repository.
Soon you'll be able to install the update with the following command:
`sudo dnf upgrade --enablerepo=updates-testing --refresh --advisory=FEDORA-2022-4b844fbebe`
You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-2022-4b844fbebe

See also https://fedoraproject.org/wiki/QA:Updates_Testing for more information on how to test updates.

Comment 13 Fedora Update System 2022-10-31 10:30:16 UTC
FEDORA-2022-9400b16a0a has been pushed to the Fedora 35 testing repository.
Soon you'll be able to install the update with the following command:
`sudo dnf upgrade --enablerepo=updates-testing --refresh --advisory=FEDORA-2022-9400b16a0a`
You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-2022-9400b16a0a

See also https://fedoraproject.org/wiki/QA:Updates_Testing for more information on how to test updates.

Comment 14 Fedora Update System 2022-11-04 10:45:12 UTC
FEDORA-2022-4b844fbebe has been pushed to the Fedora 36 stable repository.
If problem still persists, please make note of it in this bug report.

Comment 15 Fedora Update System 2022-11-07 22:00:14 UTC
FEDORA-2022-9400b16a0a has been pushed to the Fedora 35 stable repository.
If problem still persists, please make note of it in this bug report.

Comment 16 Fedora Update System 2022-11-10 22:28:41 UTC
FEDORA-2022-e4559c8ed0 has been pushed to the Fedora 37 stable repository.
If problem still persists, please make note of it in this bug report.