Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Linux] Glide SDL2 segfault #2126

Open
rderooy opened this issue Dec 27, 2020 · 24 comments
Open

[Linux] Glide SDL2 segfault #2126

rderooy opened this issue Dec 27, 2020 · 24 comments

Comments

@rderooy
Copy link
Contributor

rderooy commented Dec 27, 2020

Describe the bug
When running Screamer Rally or GTA with the SDL1 binary (nightly build) on Linux 64bit, it runs fine in 3dfx Glide pass-through mode. But when using the SDL2 binary, I get a segfault when starting the game.

The last messages in the log:

LOG: DOSBox-X has switched to max cycles, because of the setting: cycles=auto.
If the game runs too fast, try a fixed cycles amount in DOSBox-X's options.
LOG:   95552551 ERROR BIOS:INT15:Unknown call ax=BF01
LOG: Glide:Activated
Segmentation fault (core dumped)
@Wengier
Copy link
Collaborator

Wengier commented Dec 28, 2020

I tried Screamer Rally and could launch the game in both SDL1 and SDL2 versions on Windows (although there seems to be missing fonts), whereas I could reproduce the segfault on the Linux SDL2 build. I think the segfault is likely a bug of the OpenGlide library used in Linux. Perhaps OpenGlide (such as its grSstWinOpen function) is not quite compatible with the SDL2 calls or build.

@rderooy rderooy changed the title Glide SDL2 segfault [Linux] Glide SDL2 segfault Dec 28, 2020
@grapeli
Copy link

grapeli commented Dec 28, 2020

That's right openglide has a wrapper only for SDL1x.
The truncated version of GLIDE2X.OVL bundled with dosbox-x is rather a problem.

For me it works with SDL2, apart from the lack of 2D textures (important thing).
Video.

edit: I also ran Screamer Rally under dosbox-ece (linux) with glide and all textures on 2D objects are displayed correctly. Of course, the game also doesn't work with dosbox-x's version of GLIDE2X.OVL.

@Wengier Wengier mentioned this issue Dec 28, 2020
@Wengier
Copy link
Collaborator

Wengier commented Dec 28, 2020

@grapeli Yes, I think 2D texture is an important bug too, which is likely fixed in #2129.

@grapeli
Copy link

grapeli commented Dec 28, 2020

@Wengier
With the new fixes, SDL1.x works fine with DOSBox-X glide2x.ovl. 2D textures display correctly (Screamer Rally).

With SDL2, nothing has changed (Screamer Rally).
No textures with glide2x.ovl from the game. A core dump follows with glide2x.ovl attached to dosbox-x. As I understand it, the reason is the lack of a proper sdl2 wrapper in openglide.

@Wengier
Copy link
Collaborator

Wengier commented Dec 28, 2020

@grapeli Yes, I agree that the issue with Linux SDL2 is a limitation of OpenGlide. On the other hand, I tried it in Windows 32-bit SDL2 build with nGlide, and the 2D texture shows the same way as Windows 32-bit SDL1 build.

@grapeli
Copy link

grapeli commented Dec 29, 2020

@Wengier
I built OpenGlide without sdl (./configure --disable-sdl). DOSBox-X practically does not work with Glide support with this OpenGlide library. A separate window is initialized in which not much is displayed (nothing correctly).

edit: It works with the Screamer Rally version of glide2x.ovl. No 2D textures. Confusing.

@grapeli
Copy link

grapeli commented Dec 29, 2020

@Wengier
Gdb showed this information when I ran openglide with dosbox-x-sdl2.

LOG: Glide:Activated

Thread 1 "dosbox-x" received signal SIGSEGV, Segmentation fault.
0x00007fffec1714bc in SDL_ListModes () from /usr/lib/libSDL-1.2.so.0
(gdb) bt full
#0  0x00007fffec1714bc in SDL_ListModes () from /usr/lib/libSDL-1.2.so.0
No symbol table info available.
#1  0x00007fffec17159d in SDL_VideoModeOK () from /usr/lib/libSDL-1.2.so.0
No symbol table info available.
#2  0x00007fffec172dc0 in SDL_SetVideoMode () from /usr/lib/libSDL-1.2.so.0
No symbol table info available.
#3  0x00007fffec21aa10 in InitialiseOpenGLWindow (wnd=<optimized out>, x=x@entry=0, y=y@entry=0, width=640, height=<optimized out>) at window.cpp:101
        FullScreen = <optimized out>
#4  0x00007fffec214d11 in InitWindow (hWnd=<optimized out>) at Glide.cpp:78
No locals.
#5  0x00007fffec20e015 in grSstWinOpen (hwnd=<optimized out>, res=<optimized out>, ref=0, cformat=0, org_loc=0, num_buffers=2, num_aux_buffers=0)
    at grguSstGlide.cpp:300
No locals.
#6  0x00000000007d215d in process_msg(unsigned long) ()
No symbol table info available.

I also tried sdl12-compat.

LOG: Glide:Activated
FIXME: currently ignores SDL_WINDOWID, which we could use with SDL_CreateWindowFrom ...? (SDL_SetVideoMode, SDL12_compat.c:2728)                       
FIXME: handle SDL_ANYFORMAT (SDL_SetVideoMode, SDL12_compat.c:2746)                                                                                    
FIXME: There's an environment variable to choose a display (SDL_SetVideoMode, SDL12_compat.c:2753)                                                     
FIXME: bgr instead of rgb? (SDL_SetVideoMode, SDL12_compat.c:2774)                                                                                     
FIXME: don't do anything if the window's dimensions, etc haven't changed. (SDL_SetVideoMode, SDL12_compat.c:2780)                                      
FIXME: we need to preserve VideoSurface12 (but not its pixels), I think... (SDL_SetVideoMode, SDL12_compat.c:2781)

Thread 1 "dosbox-x" received signal SIGSEGV, Segmentation fault.
0x00007fffec600411 in SDL_SetVideoMode () from /tmp/sdl12-compat/libSDL-1.2.so.0
(gdb) bt full
#0  0x00007fffec600411 in SDL_SetVideoMode () from /tmp/sdl12-compat/libSDL-1.2.so.0
No symbol table info available.
#1  0x00007fffec21aa10 in InitialiseOpenGLWindow (wnd=<optimized out>, x=x@entry=0, y=y@entry=0, width=640, height=<optimized out>) at window.cpp:101
        FullScreen = <optimized out>
#2  0x00007fffec214d11 in InitWindow (hWnd=<optimized out>) at Glide.cpp:78
No locals.
#3  0x00007fffec20e015 in grSstWinOpen (hwnd=<optimized out>, res=<optimized out>, ref=0, cformat=0, org_loc=0, num_buffers=2, num_aux_buffers=0)
    at grguSstGlide.cpp:300
No locals.
#4  0x00000000007d215d in process_msg(unsigned long) ()
No symbol table info available.

@grapeli
Copy link

grapeli commented Jun 8, 2021

A new approach. Due to the fact that they improve a lot in sdl12-compat.

I have removed SDL-1.2 from the system. I built the Openglide with sdl12-compat.
DOSBox-X in SDL2 version, works with glide.
It's a long way to delight, but you can see the light in the tunnel.
The biggest drawback is a separate window, in order for the keyboard to function, the dosbox-x window must be focused.

A short video. Screamer Rally in Dosbox-X (SDL2) running under sway (wayland).

Edit:
Works with openglide using sdl-1.2.15 too. In general, the only drawback here is the lack of a full screen (scaling to full screen). In my case, poor performance.
video (xorg, i3)

@isopix
Copy link

isopix commented Nov 20, 2021

@grapeli: Are this patches in v0.83.19 or do I need git or special branch for SDL2+Glide?

I generally got very bad performance with SDL2/SDL1 and sdl12-compat under wayland in games (not DOSBox, but tardew Valley[sdl2], supertux[sdl1 and supertux2[sdl2]), until I enable native SDL2 wayland backend , by setting env var (SDL_VIDEODRIVER=wayland).
It has it's own problems (under Plasma wayland SDL2 games works only in fullscreen for now, not sure why), but it's performane is really awesome.
Latest SDL2 (2.0.16) still default to X11 backend under wayland, so utis using xwayland then, which is slow as hell on old intel hardware!

I'm not talkign about DosBOX(researching which version to build), but Stardew Valley(sdl2), supertux(sdl1) and supertux2(sdl2), but it should apply to it too.

@grapeli
Copy link

grapeli commented Nov 20, 2021

@isopix
I do not recommend using glide. More problems than benefits.

The main problems with glide=true are:
-no full screen (on FullHD, 4K - 640x480 window is the size of a postage stamp)
-problems with textures, lack of other graphic elements
-not compatible with games with the static version of the 3dfx library

Configuring glide=false and voodoo_card=opengl provides much better compatibility (for Linux). The performance is comparable to the glide (perfectly adequate).
#2741 (comment)

@rderooy
Copy link
Contributor Author

rderooy commented Feb 4, 2022

This could be of interest going forward: https://www.phoronix.com/scan.php?page=news_item&px=2022-Mesa-Grover

Possibility of GLIDE support in Mesa on Linux.

@grapeli
Copy link

grapeli commented Feb 4, 2022

@rderooy
Instead of posting news, please refer to the bug you reported two years ago. Close it or confirm it. Because I am currently unable to reproduce it.

edit:
For clarity, I use sdl12-compat with openglide.
It also works fine under x11 without using sdl12-compat. I am not seeing a dosbox-x crash by any means.
Every time I find confirmation in the dosbox-x logs. - Glide:Activated.

@grapeli
Copy link

grapeli commented Feb 4, 2022

sdl12-comat is only needed if we intend to use videodriver=wayland . Under Xwayland it is absolutely not needed.

@rderooy
Copy link
Contributor Author

rderooy commented Feb 4, 2022

sdl12-comat is only needed if we intend to use videodriver=wayland . Under Xwayland it is absolutely not needed.

Correct in principle. But since DOSBox-X uses a modified in-tree SDL1, I suspect you may have problems with sdl12-compat.

@grapeli
Copy link

grapeli commented Feb 4, 2022

@rderooy
Please read the subject title of your submission carefully.
Close this report because it is inconsistent with the reality.

I will not recommend SDL1 to anyone in 2022.

@Jookia
Copy link
Contributor

Jookia commented May 28, 2022

Just as a report it's basically impossible to build with SDL1 on Arch Linux now, SDL2 will be used at runtime and cause a crash with OpenGlide. The qemu-extra glide for seems to work with SDL2 though.

@grapeli
Copy link

grapeli commented May 28, 2022

I tested with this version of openglide with dosbox-x under archlinux. It works. Equally with SDL1 and SDL2 version. Far from perfect. For example, in Carmageddon, additional graphics are not displayed.

They prefer the built-in 3DFx emulation. It works a bit better for me. Works for games with a static glide library (such as Battle Arena Toshinden).

Dosbox-x has been built for a long time with the included version of the sdl1 library. The basic build script takes you to the appropriate sdl directory.
If you would like to build with the system SDL1 you have to make some adjustments to the dosbox-x code (quite trivial). I assure you that it works and the system SDL1.

@Jookia
Copy link
Contributor

Jookia commented May 28, 2022 via email

@grapeli
Copy link

grapeli commented May 28, 2022

I have installed Archlinux for a long time. I decided not to replace sdl 1.2 with sdl12-compat. It is too early for such an experiment. I still have the last version of sdl1 installed.

It works for me.

Qemu-extra? You have in mind https://github.com/kjliew/qemu-xtra.
About this "fork" openglide. I don't know where the first commit came from. Where did this code come from? Who changed it? It's not exactly the same code.
cvs -z3 -d:pserver:anonymous@openglide.cvs.sourceforge.net:/cvsroot/openglide co -P openglide

@Jookia
Copy link
Contributor

Jookia commented Oct 11, 2022 via email

@grapeli
Copy link

grapeli commented Oct 11, 2022

I will explain to you again, because I can see that the previous posts did not work.

DOSBox-X has been and is built for a very long time based solely on the slightly modified included SDL-1.x library.
If someone tries to build against SDL-1.x from the system repository or another, the compilation will fail. You need to modify the dosbox-x source code. It is not complicated. As a non-developer, I did it without any problems.

I won't be posting another video showing Openglide running smoothly with dosbox-x. It works for me.

SDL1.x is not currently available in the archlinux repository. You can install the last archived version. You can build yourself with abs. You can compile yourself. The possibilities are across the spectrum.

@Jookia
Copy link
Contributor

Jookia commented Oct 11, 2022

Yeah I did most of that afterwards. In the end Glide support is just too flaky on my system to the point I'm not bothering trying to run it in DOSBox-X.

@grapeli
Copy link

grapeli commented Oct 11, 2022

I agree. The built-in version of dosbox-x of 3DFX is much better. So much better.

Openglide was created in the early 2000s. It has not changed almost since then. The full screen mode is completely archaic. In order not to use xrandr in 2022. Embarrassment.

@Jookia
Copy link
Contributor

Jookia commented Oct 11, 2022 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants