adventuregamestudio / ags

AGS editor and engine source code
Other
697 stars 159 forks source link

Allow the OpenGL display driver to be used on Linux. #510

Closed toojays closed 5 years ago

toojays commented 6 years ago

Discussion moved from http://www.adventuregamestudio.co.uk/forums/index.php?topic=46152.msg636595128#msg636595128

I wrote:

I'm new to AGS. Just bought Lamplight City which uses it last week. I was disappointed with the performance running fullscreen; it sounds like I've run into what you guys call the "scaling problem"?

Anyway, this inspired me to try and get AGS' OpenGL renderer working on Linux. I don't have previous OpenGL experience but was able to crib from enough tutorials to get it working in windowed mode.

Code is at https://github.com/toojays/ags/tree/ags3+linux-opengl , see the commit message at https://github.com/toojays/ags/commit/4ae20e7317241fe3b1435ccd0652956dfca38c88 for more detail.

I've only tested it with one game (Lamplight City) on one system (Ubuntu 18.04, Intel graphics) so far. Fullscreen mode isn't working yet. Somewhere in AGS the system tries to resolve the game's 640x400 against my PC's 1920x1080 and comes up with 1728x1080 (game res * 2.7). I fail to set this as a fullscreen mode and AGS falls back to windowed mode. I guess the driver is supposed to realize the system won't do 1728x1080 and ask the windowing system for 1920x1080? Does anyone know?

Then Crimson Wizard replied with:

Hello, toojays. It's really nice to see someone tried doing this. I kept hoping to look into this myself but never found a moment to research the OpenGL working on Linux (also, there was ongoing Nick Sonneveld's SDL port attempt, but it seems to get delayed again).

Can't answer to the fullscreen problem right away, this is something to investigate. I may mention one thing though (and also the main reason that was stopping me). Since OpenGL does not support "dedicated fullscreen mode" on Windows I had to emulate fullscreen mode (probably this is how everyone do this) by switching desktop resolution. This is not done in ali3dogl.cpp itself, but in the "platform driver" class. You may find calls to "platform->EnterFullscreenMode", "platform->AdjustWindowStyleForFullscreen" and "platform->ExitFullscreenMode" in OpenGL renderer. The implementation for Windows is located in acplwin.cpp. But I honestly do not know if we should follow same procedure for Linux or not (also don't know X11 very well, I wrote literally couple of functions using it before).

Am I right that you are using "glew" library, that helps to bind function pointers to dynamically loaded OpenGL object? OpenGL renderer was originally written in such a way that on Windows we manually getting function addresses, and that would be actually a nice thing to get glew used on Windows eventually too (not sure why I never tried, maybe was worried to break something that was already working).

I have a proposal, since this forum thread is too long already and contains all kinds of various discussions, could we continue on github instead, by opening an issue ticket in our repository? I believe that would be more convenient especially since you already have account and some code in progress there.

toojays commented 6 years ago

This could potentially address #235, although that's not my personal use case.

toojays commented 6 years ago

With toojays@94051c7 I now have fullscreen rendering working. Switching between windowed & fullscreen is still broken.

Also, there is frequently a visual artifact consisting of a vertical black line following on-screen movement. E.g. when a character walks around, it seems like a flickering vertical black line follows them. When the character stops, the line doesn't flicker, it stays either visible or invisible. If I switch from the "linear" filter to the default "StdScale" one, the line appears less frequently, but contains white as well as black. Weird.

morganwillcock commented 6 years ago

Are you using a display compositor which yields to anything running fullscreen?

toojays commented 6 years ago

Are you using a display compositor which yields to anything running fullscreen?

I don't know what that means. I'm running MATE. I tried disabling compositing via gsettings set org.mate.Marco.general compositing-manager false and this didn't make a difference to either the vertical line artifact nor the fullscreen-to-windowed behaviour.

ghost commented 6 years ago

Also, there is frequently a visual artifact consisting of a vertical black line following on-screen movement. E.g. when a character walks around, it seems like a flickering vertical black line follows them.

Don't know if related but Iirc in the past I've seen this behavior when the sprite's texture was not aligned correctly. Although I thought that will work identically regardless of the platform. I will be able to check this more closely on the weekend.

toojays commented 6 years ago

Also, there is frequently a visual artifact consisting of a vertical black line following on-screen movement. E.g. when a character walks around, it seems like a flickering vertical black line follows them.

An update on this: it only happens if the configuration has render_at_screenres=1. If I have render_at_screenres=0, this artifact does not occur. However, render_at_screenres=0 gives a generally more pleasing image - somehow it has better anti-aliasing?

At present I have best results with the following configuration:

[graphics]
windowed=0
driver=OGL
filter=linear
vsync=1
render_at_screenres=0
morganwillcock commented 6 years ago

@toojays, yes that would be the compositor I mean. So if you've tried with it disabled, then that answers the question.

From fiddling with Unity, I've encountered the problem where DirectX 9 required adding 0.5 to texture co-ordinates to display correctly. Are the code paths for full screen rendering completely separate for OpenGL, or could it be getting an offset applied in both cases?

ghost commented 6 years ago

From fiddling with Unity, I've encountered the problem where DirectX 9 required adding 0.5 to texture co-ordinates to display correctly.

Yes, we have something similar in AGS for Direct3D renderer: https://github.com/adventuregamestudio/ags/blob/ags3/Engine/platform/windows/gfx/ali3dd3d.cpp#L775

When making OpenGL work on Windows I experimented but in the end did not find it necessary to replicate same adjustment (or at least I can't remember if I did...).

Are the code paths for full screen rendering completely separate for OpenGL, or could it be getting an offset applied in both cases?

Fullscreen mode in OpenGL has very little difference since it's also a windowed mode in practice and rendering function does not branch anywhere depending on window mode, size etc, but there is distinct difference in operations between two render_at_screenres modes. "Render at screen resolution" option determines whether textures are drawn and scaled directly to backbuffer (which may be of higher resolution than game) or first to game-sized texture and then draw that texture to backbuffer. https://github.com/adventuregamestudio/ags/blob/ags3/Engine/gfx/ali3dogl.cpp#L1209

When render_at_screenres = 1, it means that when character is scaled it may fill fractions of "game pixels" which makes it look more hi-res than the background (some people like that, but others hate so we made a setting).

I wonder if this has something to do with an imperfect scaling of a texture.

morganwillcock commented 6 years ago

Maybe it is graphics driver / game specific, as I've tried a couple of games (one high resolution one that wouldn't need scaling for fullscreen, and one low resolution one that would) and both settings for render_at_screenres work without any flicker or distortion, or at least I didn't perceive anything as wrong.

I'm using the built-in AMD 'radeon' driver and when the engine starts it prints:

Running OpenGL: 3.0 Mesa 13.0.6

I've also tried switching between a stretched display and max round multiplier, but both seemed fine.

morganwillcock commented 6 years ago

Tried on an older Intel graphics chip too, and I guess I'd be missing some features like tinting, or it has silently dropped back to software rendering, but nothing terrible happened game-wise:

Running OpenGL: 2.1 Mesa 13.0.6
ERROR: OpenGL: Tinting program's fragment shader failed to compile:
----------------------------------------
0:1(10): error: GLSL 1.30 is not supported. Supported versions are: 1.10, 1.20, and 1.00 ES

----------------------------------------
ERROR: OpenGL: Lighting program's fragment shader failed to compile:
----------------------------------------
0:1(10): error: GLSL 1.30 is not supported. Supported versions are: 1.10, 1.20, and 1.00 ES

----------------------------------------

i.e. after this, the game started and I could play it, and based on the CPU load I think it was still using OpenGL.

I can probably test a more modern Intel chip and an nVidia chip tomorrow, but so far it has worked pretty well for me.

morganwillcock commented 6 years ago

I didn't have any problems with a newer Intel chip, or an nVidia one with the nouveau driver, with render_at_screenres = 1. So other than switching between fullscreen and windowed (which I've had work and not work) this seems pretty functional and I've not managed to get any sort of flicker or distortion.

ghost commented 6 years ago

I have to ask, how am I supposed to build this? I have a virtual machine with Ubuntu, installed libglew-dev package, and compiler reports that glxewInit is not declared. Inside glxew.h glxewInit is defined as a macro under "#ifdef GLEW_MX", but apparently not seen for some reason.

toojays commented 6 years ago

@ivan-mogilko, what version of Ubuntu do you have? What version of libglew-dev? (run dpkg -l libglew-dev to find out)

Perhaps I need some extra hackery to build on older versions of Ubuntu.

toojays commented 6 years ago

I didn't have any problems with a newer Intel chip, or an nVidia one with the nouveau driver, with render_at_screenres = 1. So other than switching between fullscreen and windowed (which I've had work and not work) this seems pretty functional and I've not managed to get any sort of flicker or distortion.

@morganwillcock Thanks for trying this out. Could you tell me one of the games you tried (cheap is good, free is better), so I could compare results on my system? So far I've only tried the one game (Lamplight City), I don't have any others.

I'm still struggling to get the fullscreen<->windowed transition working. Looking at the Allegro source, it does look like the intent is to be able to switch from fullscreen to window-managed: https://github.com/liballeg/allegro5/blob/c12b6be726f8959404734e52c36edfdd6edf2461/src/x/xwin.c#L405-L420 but in practice it's not as simple as just calling set_gfx_mode() again. I found that if I don't recreate the GL context the image looks okay on resize:

--- a/Engine/gfx/ali3dogl.cpp
+++ b/Engine/gfx/ali3dogl.cpp
@@ -459,10 +459,7 @@ bool OGLGraphicsDriver::InitGlScreen(const DisplayMode &mode)
     mode.Windowed ? GFX_AUTODETECT_WINDOWED : GFX_AUTODETECT_FULLSCREEN;
   set_gfx_mode(allegro_driver, mode.Width, mode.Height, 0, 0);

-  if (_glxContext)
-    DeleteGlContext();
-
-  if (!CreateGlContext(mode))
+  if (!_glxContext && !CreateGlContext(mode))
     return false;

   CreateDesktopScreen(mode.Width, mode.Height, mode.ColorDepth);

That makes me wonder if there's some device dependent bitmaps that rely on the GL context or something. But there are still other problems, like going from fullscreen to windowed does shrink the size of the displayed image, but doesn't return to the window-managed window, i.e. no other windows are visible & there is no window border.

I'll keep working at it, but it may take some time. I might see if I have any joy with a small standalone allegro program. If I can't get that to work I'll fall back to the "emulated" fullscreen mode suggested by Crimson Wizard (who I assume is one of you guys?) initially.

toojays commented 6 years ago

@ivan-mogilko, what version of Ubuntu do you have? What version of libglew-dev? (run dpkg -l libglew-dev to find out)

Perhaps I need some extra hackery to build on older versions of Ubuntu.

Hmm, I downloaded the package for libglew-dev-1.13.0-2 as used in Ubuntu 16.04. glxew.h has:

#ifdef GLEW_MX

typedef struct GLXEWContextStruct GLXEWContext;
GLEWAPI GLenum GLEWAPIENTRY glxewContextInit (GLXEWContext *ctx);
GLEWAPI GLboolean GLEWAPIENTRY glxewContextIsSupported (const GLXEWContext *ctx, const char *name);

#define glxewInit() glxewContextInit(glxewGetContext())
#define glxewIsSupported(x) glxewContextIsSupported(glxewGetContext(), x)

#define GLXEW_GET_VAR(x) (*(const GLboolean*)&(glxewGetContext()->x))
#define GLXEW_GET_FUN(x) x

#else /* GLEW_MX */

GLEWAPI GLenum GLEWAPIENTRY glxewInit ();
GLEWAPI GLboolean GLEWAPIENTRY glxewIsSupported (const char *name);

#define GLXEW_GET_VAR(x) (*(const GLboolean*)&x)
#define GLXEW_GET_FUN(x) x

#endif /* GLEW_MX */

If this is what you have, you should be taking the #else path and getting the regular definition of glxewInit().

If you can confirm your OS version I'll try and reproduce your problem in a container or VM when I get a chance.

ghost commented 6 years ago

I found that if I don't recreate the GL context the image looks okay on resize: That makes me wonder if there's some device dependent bitmaps that rely on the GL context or something.

Yes, there are DDBs, and the engine is supposed to take that into account. When the mode is changed at runtime (currently supports only switching from windowed to fullscreen, but we had plans to allow more tuning by script commands) the engine tests if the transition would require some additional reinitialization. IIRC this is only required if color depth is changed: https://github.com/adventuregamestudio/ags/blob/ags3/Engine/main/engine_setup.cpp#L442

Now, I have to admit that my memories of whole procedure there have become rusty (hacking that code into AGS took several attempts) and will need to be refreshed to tell for certain whether all DDBs have to be recreated and how is this performed in practice. But there was a lot of tuning done in code to make sure engine could potentially switch display mode and even graphics renderer at any time by command. This is also the reason I'd prefer the sequence of actions and conditions for them would remain same on Linux if possible i.e. it would not do something on Linux (like deleting GL context) when it does not do same on Windows and so on. It may be bit complicated to follow because OpenGL renderer is messy with every platform having pieces of special code there, something that probably would benefit from refactoring (like separating OpenGL and platform-specific commands and leaving only basic algorithm).

morganwillcock commented 6 years ago

@toojays I was testing with these two: http://www.adventuregamestudio.co.uk/site/games/game/1956/ (low resolution, plus video playback) http://www.adventuregamestudio.co.uk/site/games/game/2257/ (high resolution)

rofl0r commented 6 years ago

might be interesting to try the hitchhikers guide to the galaxy. it cointains some shader-like effects, iirc.

toojays commented 6 years ago

Commit 9740c582 gets fullscreen<->windowed transition working. No change to the OpenGL context is required, although we also never change the desktop resolution or colour depth.

The approach taken depends on a window manager that supports setting _NET_WM_STATE_FULLSCREEN in a window's _NET_WM_STATE property. This property was first specified in Version 1.2 of the Extended Window Manager Hints (EWMH) spec, which was published in 2002. I assume it should be supported everywhere, but have only tested with one system (MATE on Ubuntu 18.04) so far.

This still needs more testing and possibly some refactoring before it's ready to merge, but I'm going to put it to one side for a few days to actually play a game! :)

@ivan-mogilko Did you manage to compile this in the end? If not I'll give it a try on Ubuntu 16.04 (I assume that's what you have, please correct otherwise) next.

ghost commented 6 years ago

@toojays sorry, I did not have much free time lately. I found out that I am using Ubuntu 14.04.4 LTS which support seem to have ended in 2016 (according to their website). The latest available glew package for me was 1.10. I will do system upgrade and try again.

morganwillcock commented 6 years ago

This is working for me. The only issue I had was having to disable 'mouse control' with:

[mouse]
control=never

...since in a window everything was fine, but when running fullscreen (even without any switching involved) the cursor motion became erratic (this seemed to be a positioning issue rather than slowdown, as I couldn't recreate the same type of issue with the software renderer).

Fundamentally though, given the benefit of this vs the problems with the software renderer, I'd vote to just commit this as-is and get more people actively using it. The lower CPU usage alone also removes the audio stutter I'd normally get. If you specify the Software render in the settings, you still get it, so people can also opt not to use it.

ghost commented 6 years ago

@toojays , alright, I updated to Ubuntu-16.04 LTS and now was able to build your branch. I did not do much functionality tests yet, but OpenGL renderer is at least initializing.

@morganwillcock

...since in a window everything was fine, but when running fullscreen (even without any switching involved) the cursor motion became erratic (this seemed to be a positioning issue rather than slowdown, as I couldn't recreate the same type of issue with the software renderer).

This may be if some data was not initialized as expected and mouse code uses incorrect coordinate transformation. I haven't had a chance to properly examine all the new code, but from the general looks have got a feeling that some of the window initialization is not placed where it should be and its initialization may conflict with the rest of engine logic. I realize why you would like to have this asap, but then we need to keep this in mind and try to refactor out later before the final 3.5.0 release.

toojays commented 6 years ago

@morganwillcock for some reason I never noticed the erratic mouse movement with Lamplight City, but it's immediately obvious with Jacqueline White.

I just pushed a3f012f9c which fixes it for me. Can you confirm? If you still have a problem please let me know what game to test with.

morganwillcock commented 6 years ago

@toojays this seems to have fixed it for me.

i30817 commented 5 years ago

Newer generation window managers will start to depend on wayland which doesn't allow application resolution changes (or true native fullscreen for that matter).

I think the idea they're chasing is to downscale or upscale on the GPU any 'non-desktop' resolution a application asks.

But as is typical this wasn't done yet so i can't even tell if it will work on wine, much less native ports that expect to change res.

(though it was not unusual to be 'forced' to use xrender cmd line tool to change res on a script prior to running a game, these tools no longer on on wayland for obvious reasons).

I actually quite like wayland but i wish this issue was taken more seriously by the devs. XWayland is not a solution obviously.

vga-256 commented 5 years ago

First off, thanks so much @toojays for the fantastic work on this branch. I've got it compiled, and I'm testing it out with a commercial AGS game that will be released in late January. I'm testing on Ubuntu 18.x on my Mac OS X machines (2011 iMac - Radeon HD 6970M, 2013 Macbook Air - Intel HD Graphics 5000). Windowed mode runs incredibly well, and I get excellent framerates without any issues that I noticed.

However, in fullscreen mode the background music begins stuttering and the screen remains black. If I alt-tab to another open window (so that the game screen is in the background), the game begins to update the screen at full framerates. I've tested it on both of my Macs (both running the same Ubuntu release), and the issue recurs on both machines.

Any ideas on what the issue might be?

toojays commented 5 years ago

Hi @256colour.

I'm glad this work is of use to you.

I'm not sure what your issue could be. The closest thing I've seen to what you describe was actually when playing Lamplight City in windowed mode. If I moved the cursor outside the window and then moved it back in, there was a short period of time where the audio was garbled (slow? fast? I forget). That game must run in "single-tasking" mode though, as it paused (and audio stopped) when I moved the mouse out of the window. I take it yours runs in "multitasking" mode, otherwise it wouldn't run when in the background.

Are you running Ubuntu directly on your Macs (bare metal), or via a virtual machine?

It might be worth trying with a different window manager to see if the issue is induced by that somehow. I use "marco", which is part of the MATE desktop. It would be interesting to know if you see the problem when running with that. You may just be able to "apt install marco" and then run "marco --replace" in a terminal to use marco as your WM for the remainder of your session.

I haven't played any AGS games since October, but am planning to try Gemini Rue over my Christmas break and work toward getting this merged. If you can provide instructions that would let me reproduce your problem I may take a look.

ericoporto commented 5 years ago

@toojays I will give you the most non useful report that I built the code by typing make on the Engine folder on Ubuntu 16.04 (Unity) and when I tried to run it, I get a black screen when running fullscreen, but it's working on windowed.

vga-256 commented 5 years ago

@toojays Thanks for the reply. Sorry it took me a few days to reply - I wanted to boot Ubuntu directly on hardware instead of in a VM, to be sure this wasn't a VM-related issue. Turns out the issue happens both in a VM and on bare metal.

I took a screencap of the bug for your reference. The video did not record the audio for some reason, but when the video freezes, the audio also locks up and repeats the same fragment of sound endlessly.

Interestingly - when the game launches it shows a disclaimer GUI which runs at full framerates. It's only when the intro video/audio starts playing that the stuttering/freezing occurs.

I'll give installing a window manager a shot this week.

So to reproduce:

morganwillcock commented 5 years ago

Have you got HiDPI scaling turned on? I tested on 3 physical computers (one of these was Ubuntu 18.04) and didn't see these problems, but I don't have anything with a resolution that high.

vga-256 commented 5 years ago

@morganwillcock I ran the game on my second monitor (19" @ 1280x1024) and it produced the same results, so I think we can rule out the resolution as the source of the problem.

@toojays I tried installing marco, but I didn't have much luck in running it.

I suspect my problem may actually be the hardware itself. This Radeon 6970M is a Mac-specific GPU that differs from the stock Radeon 6870 desktop card it was based on. Apple released specific drivers to support it in Windows and Mac, and there are no reference drivers for it in linux - so Linux is defaulting to whatever support the card has in mesa. I'm going to test the binary on some other machines I have, and see if I can repeat the behaviour.

It's great to hear that it's running fullscreen on other machines without problems though!

toojays commented 5 years ago

@256colour I made the following assumption earlier. Was it correct?

That game must run in "single-tasking" mode though, as it paused (and audio stopped) when I moved the mouse out of the window. I take it yours runs in "multitasking" mode, otherwise it wouldn't run when in the background.

After watching your video, I'm thinking maybe your game really runs in "single-tasking" mode, and the issue is that AGS is confused about whether the window is selected or not. I.e. initially it thinks the window is inactive, and freezes the game. Then when you shift to another window, it thinks the game is active, and lets the game run.

I doubt I'll have time to look at the code for another couple of days, but according to the options documentation there's a "multitasking" override you can enable to stop the game being paused when the window is inactive. Could you try your game with that enabled and report back?

vga-256 commented 5 years ago

@toojays Interesting guesswork! I tried it, and got some slightly different behaviour (with the same problem in the end). When set to single-tasking mode (0), it had exactly the same behaviour as previously described. When set to multitasking mode (1), the behaviour was the same except that I didn't have to drag around an alt-tabbed window to 'set focus' so the game (in the background) would start running again. In the end, the game still locked up/froze video and audio when in fullscreen in multitasked mode.

toojays commented 5 years ago

@256colour I'm still not able to reproduce this. Could you get me a stacktrace?

Since we need the AGS window to have input focus when you take the stacktrace, I suggest you run something like sleep 10 && gdb -p $(pgrep ags) --batch -ex "thread apply all bt" in a terminal. This gives you 10 seconds to switch the focus back to your game (assuming the process is called "ags") before it snaps a backtrace. By default Ubuntu will not let you attach gdb to a non-child process. The quickest way to get around this is to run sudo bash -c 'echo 0 > /proc/sys/kernel/yama/ptrace_scope'.

I'm still suspicious of the pause-when-window-loses-focus behaviour of AGS with respect to what you are seeing. There's a function called display_switch_out_suspend() that increments & decrements a variable called switching_away_from_game while it pauses audio. The audio playback in update_mp3_thread() will spin waiting for this variable to change, blocking the main thread. It's tempting to imagine the switching_away_from_game variable somehow having the wrong polarity, but I can't see how that could happen. Although it's bogus by modern standards to use volatile to ensure one thread sees an update by another, in practice I don't see any breakage here - display_switch_out_suspend() is ultimately called under a lock in Allegro, so only one thread will ever be modifying this variable at any one time.

vga-256 commented 5 years ago

... post-holiday break...

I finally got around to getting some output from gdb:

[New LWP 4638]
[New LWP 4639]
[New LWP 4641]
[New LWP 4642]
[New LWP 4643]
[New LWP 4644]

warning: Could not load shared library symbols for 2 libraries, e.g. libagsteam.so.
Use the "info sharedlibrary" command to see the complete listing.
Do you need "set solib-search-path" or "set sysroot"?
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1".
syscall () at ../sysdeps/unix/sysv/linux/x86_64/syscall.S:38
38  ../sysdeps/unix/sysv/linux/x86_64/syscall.S: No such file or directory.

Thread 7 (Thread 0x7fda87fff700 (LWP 4644)):
#0  0x00007fdacca3f9f3 in futex_wait_cancelable (private=<optimized out>, expected=0, futex_word=0x558fcda3a878) at ../sysdeps/unix/sysv/linux/futex-internal.h:88
#1  __pthread_cond_wait_common (abstime=0x0, mutex=0x558fcda3a828, cond=0x558fcda3a850) at pthread_cond_wait.c:502
#2  __pthread_cond_wait (cond=0x558fcda3a850, mutex=0x558fcda3a828) at pthread_cond_wait.c:655
#3  0x00007fda9175f46b in ?? () from /usr/lib/x86_64-linux-gnu/dri/r600_dri.so
#4  0x00007fda9175f197 in ?? () from /usr/lib/x86_64-linux-gnu/dri/r600_dri.so
#5  0x00007fdacca396db in start_thread (arg=0x7fda87fff700) at pthread_create.c:463
#6  0x00007fdacc76288f in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:95

Thread 6 (Thread 0x7fda8c8d2700 (LWP 4643)):
#0  0x00007fdacca3f9f3 in futex_wait_cancelable (private=<optimized out>, expected=0, futex_word=0x558fcecd6d54) at ../sysdeps/unix/sysv/linux/futex-internal.h:88
#1  __pthread_cond_wait_common (abstime=0x0, mutex=0x558fcecd6d00, cond=0x558fcecd6d28) at pthread_cond_wait.c:502
#2  __pthread_cond_wait (cond=0x558fcecd6d28, mutex=0x558fcecd6d00) at pthread_cond_wait.c:655
#3  0x00007fda9175f46b in ?? () from /usr/lib/x86_64-linux-gnu/dri/r600_dri.so
#4  0x00007fda9175f197 in ?? () from /usr/lib/x86_64-linux-gnu/dri/r600_dri.so
#5  0x00007fdacca396db in start_thread (arg=0x7fda8c8d2700) at pthread_create.c:463
#6  0x00007fdacc76288f in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:95

Thread 5 (Thread 0x7fdabad18700 (LWP 4642)):
#0  0x00007fdacc755bf9 in __GI___poll (fds=0x7fda9c001b30, nfds=3, timeout=-1) at ../sysdeps/unix/sysv/linux/poll.c:29
#1  0x00007fdac587c451 in ?? () from /usr/lib/x86_64-linux-gnu/libpulse.so.0
#2  0x00007fdac586de10 in pa_mainloop_poll () from /usr/lib/x86_64-linux-gnu/libpulse.so.0
#3  0x00007fdac586e4a0 in pa_mainloop_iterate () from /usr/lib/x86_64-linux-gnu/libpulse.so.0
#4  0x00007fdac586e530 in pa_mainloop_run () from /usr/lib/x86_64-linux-gnu/libpulse.so.0
#5  0x00007fdac587c399 in ?? () from /usr/lib/x86_64-linux-gnu/libpulse.so.0
#6  0x00007fdac561e2a8 in ?? () from /usr/lib/x86_64-linux-gnu/pulseaudio/libpulsecommon-11.1.so
#7  0x00007fdacca396db in start_thread (arg=0x7fdabad18700) at pthread_create.c:463
#8  0x00007fdacc76288f in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:95

Thread 4 (Thread 0x7fdabb71f700 (LWP 4641)):
#0  0x00007fdacc755bf9 in __GI___poll (fds=0x7fdab40045d0, nfds=3, timeout=129) at ../sysdeps/unix/sysv/linux/poll.c:29
#1  0x00007fdac587c451 in ?? () from /usr/lib/x86_64-linux-gnu/libpulse.so.0
#2  0x00007fdac586de10 in pa_mainloop_poll () from /usr/lib/x86_64-linux-gnu/libpulse.so.0
#3  0x00007fdac586e4a0 in pa_mainloop_iterate () from /usr/lib/x86_64-linux-gnu/libpulse.so.0
#4  0x00007fdac586e530 in pa_mainloop_run () from /usr/lib/x86_64-linux-gnu/libpulse.so.0
#5  0x00007fdac587c399 in ?? () from /usr/lib/x86_64-linux-gnu/libpulse.so.0
#6  0x00007fdac561e2a8 in ?? () from /usr/lib/x86_64-linux-gnu/pulseaudio/libpulsecommon-11.1.so
#7  0x00007fdacca396db in start_thread (arg=0x7fdabb71f700) at pthread_create.c:463
#8  0x00007fdacc76288f in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:95

Thread 3 (Thread 0x7fdac649c700 (LWP 4639)):
#0  0x00007fdacc75803f in __GI___select (nfds=0, readfds=0x0, writefds=0x0, exceptfds=0x0, timeout=0x7fdac649bc40) at ../sysdeps/unix/sysv/linux/select.c:41
#1  0x00007fdace2a6c82 in ?? () from /usr/lib/x86_64-linux-gnu/liballeg.so.4.4
#2  0x00007fdacca396db in start_thread (arg=0x7fdac649c700) at pthread_create.c:463
#3  0x00007fdacc76288f in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:95

Thread 2 (Thread 0x7fdac74df700 (LWP 4638)):
#0  0x00007fdacc75803f in __GI___select (nfds=0, readfds=0x0, writefds=0x0, exceptfds=0x0, timeout=0x7fdac74dec70) at ../sysdeps/unix/sysv/linux/select.c:41
#1  0x00007fdace2a7d3a in ?? () from /usr/lib/x86_64-linux-gnu/liballeg.so.4.4
#2  0x00007fdacca396db in start_thread (arg=0x7fdac74df700) at pthread_create.c:463
#3  0x00007fdacc76288f in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:95

Thread 1 (Thread 0x7fdaced90900 (LWP 4637)):
#0  syscall () at ../sysdeps/unix/sysv/linux/x86_64/syscall.S:38
#1  0x00007fda92f59bda in xshmfence_await () from /usr/lib/x86_64-linux-gnu/libxshmfence.so.1
#2  0x00007fda937b935b in ?? () from /usr/lib/x86_64-linux-gnu/libGLX_mesa.so.0
#3  0x00007fda937ba06e in ?? () from /usr/lib/x86_64-linux-gnu/libGLX_mesa.so.0
#4  0x00007fda91807143 in ?? () from /usr/lib/x86_64-linux-gnu/dri/r600_dri.so
#5  0x00007fda9180298c in ?? () from /usr/lib/x86_64-linux-gnu/dri/r600_dri.so
#6  0x00007fda9169e639 in ?? () from /usr/lib/x86_64-linux-gnu/dri/r600_dri.so
#7  0x00007fda9169ff5b in ?? () from /usr/lib/x86_64-linux-gnu/dri/r600_dri.so
#8  0x00007fda9165e2a8 in ?? () from /usr/lib/x86_64-linux-gnu/dri/r600_dri.so
#9  0x00007fda91666404 in ?? () from /usr/lib/x86_64-linux-gnu/dri/r600_dri.so
#10 0x0000558fcb22d734 in AGS::Engine::OGL::OGLGraphicsDriver::_render(AGS::Engine::GlobalFlipType, bool) ()
#11 0x0000558fcb2135bc in render_to_screen(AGS::Common::Bitmap*, int, int) ()
#12 0x0000558fcb2139ed in ?? ()
#13 0x0000558fcb23c997 in ?? ()
#14 0x0000558fcb23e316 in UpdateGameOnce(bool, AGS::Engine::IDriverDependantBitmap*, int, int) ()
#15 0x0000558fcb23e36e in GameTick() ()
#16 0x0000558fcb23e448 in RunGameUntilAborted() ()
#17 0x0000558fcb23e775 in initialize_start_and_play_game(int, char const*) ()
#18 0x0000558fcb2384f5 in initialize_engine(int, char**) ()
#19 0x0000558fcb14ea6f in main ()

Nothing is standing out to me... I took the shot during the fullscreen freeze. Interestingly, during the split second when gdb is taking a backtrace, the game unfreezes for 0.2s and freezes again. It's like having other processes running allows the game thread to unfreeze. Strange!

vga-256 commented 5 years ago

I hate to bomb this thread again, but here's a screenshot from a Linux tester.

This seems to be a repeat of the "black line" problem reported by @toojays earlier in this thread.

This was in full-screen mode and sent to me by a tester. If you look to the left side of D'arc, you can see a vertical, light bluish line where his sprite bounding box edge is. I've seen this before with the Open GL driver on some systems running the Windows version. Most times, it's around character sprites and room object sprites. It doesn't seem to happen on all systems, though. It's a minor thing, but annoying nonetheless. Any ideas if these sprite-edge artifacts are known about by the other AGS devs? And whether there's anything that can be done to eliminate them? (Either in AGS or via tweaking certain system or video card settings)?

This is a possible culprit for the faint line problem. but I don't know where to apply the glDisable(GL_DITHER) command in the engine source.

And FWIW, yes, we are running the game with render_at_screenres=1

ericoporto commented 5 years ago

@vga256 , if the player character is drawn at the same resolution as the game, does the lines in his back appear? If they don't, you can use that setting as a workaround :O

ghost commented 5 years ago

I hate to bomb this thread again, but here's a screenshot from a Linux tester. This seems to be a repeat of the "black line" problem reported by @toojays earlier in this thread.

I think I have an unfinished copy of this game on my computer (provided by developer), is it possible to get more info about the location (room number etc) so that I could test that out too? I am very curious to see whether this issue is same between platforms and what circumstances it appears in.

This is a possible culprit for the faint line problem. but I don't know where to apply the glDisable(GL_DITHER) command in the engine source.

If this is a global modifier you need to be present all time regardless of the mode, there is a bunch of settings applied here: https://github.com/adventuregamestudio/ags/blob/ags3/Engine/gfx/ali3dogl.cpp#L444 If it's per-sprite, then probably in here: https://github.com/adventuregamestudio/ags/blob/ags3/Engine/gfx/ali3dogl.cpp#L1082

toojays commented 5 years ago

@256colour

... post-holiday break...

I finally got around to getting some output from gdb: ...

Thread 1 (Thread 0x7fdaced90900 (LWP 4637)):
#0  syscall () at ../sysdeps/unix/sysv/linux/x86_64/syscall.S:38
#1  0x00007fda92f59bda in xshmfence_await () from /usr/lib/x86_64-linux-gnu/libxshmfence.so.1
#2  0x00007fda937b935b in ?? () from /usr/lib/x86_64-linux-gnu/libGLX_mesa.so.0
#3  0x00007fda937ba06e in ?? () from /usr/lib/x86_64-linux-gnu/libGLX_mesa.so.0
#4  0x00007fda91807143 in ?? () from /usr/lib/x86_64-linux-gnu/dri/r600_dri.so
#5  0x00007fda9180298c in ?? () from /usr/lib/x86_64-linux-gnu/dri/r600_dri.so
#6  0x00007fda9169e639 in ?? () from /usr/lib/x86_64-linux-gnu/dri/r600_dri.so
#7  0x00007fda9169ff5b in ?? () from /usr/lib/x86_64-linux-gnu/dri/r600_dri.so
#8  0x00007fda9165e2a8 in ?? () from /usr/lib/x86_64-linux-gnu/dri/r600_dri.so
#9  0x00007fda91666404 in ?? () from /usr/lib/x86_64-linux-gnu/dri/r600_dri.so
#10 0x0000558fcb22d734 in AGS::Engine::OGL::OGLGraphicsDriver::_render(AGS::Engine::GlobalFlipType, bool) ()
#11 0x0000558fcb2135bc in render_to_screen(AGS::Common::Bitmap*, int, int) ()
#12 0x0000558fcb2139ed in ?? ()
#13 0x0000558fcb23c997 in ?? ()
#14 0x0000558fcb23e316 in UpdateGameOnce(bool, AGS::Engine::IDriverDependantBitmap*, int, int) ()
#15 0x0000558fcb23e36e in GameTick() ()
#16 0x0000558fcb23e448 in RunGameUntilAborted() ()
#17 0x0000558fcb23e775 in initialize_start_and_play_game(int, char const*) ()
#18 0x0000558fcb2384f5 in initialize_engine(int, char**) ()
#19 0x0000558fcb14ea6f in main ()

Nothing is standing out to me... I took the shot during the fullscreen freeze. Interestingly, during the split second when gdb is taking a backtrace, the game unfreezes for 0.2s and freezes again. It's like having other processes running allows the game thread to unfreeze. Strange!

I agree, this doesn't seem to be what we're looking for. Attaching a debugger will often cause system calls to return early with EINTR. If the engine doesn't always retry such calls, and it was stuck in such a call, this may explain why attaching GDB momentarily unfroze the game.

You may still be able to get a useful stacktrace, but you'll need a bigger hammer: generate a core file using a signal AGS doesn't catch, so AGS does not have a chance to react.

1) Disable Ubuntu's core processing subsystem, otherwise it will swallow the core: sudo service apport stop.

2) Remove the limit on core dump size in the shell you run the game from: ulimit -c unlimited.

3) Check that step 1 worked, and the kernel will create core files rather than sending them to apport:

$ cat /proc/sys/kernel/core_pattern 
core

4) Use something like the following to get your AGS process to drop a core: sleep 10 && killall --signal SIGTRAP ags The "sleep" is to give you time to switch back to your game so it hangs before we grab the core, adjust this time as necessary.

5) This will leave a file called "core" in the directory where you ran the game from. Use gdb to get the stacktraces from the core with gdb <path to ags> <path to core> --batch -ex "thread apply all bt full". (I should have included "full" previously, it just gets us more detail in the traces.)

vga-256 commented 5 years ago

I think I have an unfinished copy of this game on my computer (provided by developer), is it possible to get more info about the location (room number etc) so that I could test that out too? I am very curious to see whether this issue is same between platforms and what circumstances it appears in.

@ivan-mogilko The tester reported the bug occurring in Room 19. I spoke to the developer (Chris) and he mentioned that he's seen this behaviour in Windows before as well.

toojays commented 5 years ago

The tester reported the bug occurring in Room 19. I spoke to the developer (Chris) and he mentioned that he's seen this behaviour in Windows before as well.

IMO it's better to open a new issue about that if it applies to the OpenGL renderer regardless of platform. Leave issue 510 just for the initial Linux OpenGL hookup. That issue does look the the same thing as I see though (see below).

Here are some vertical line artifacts I see with render_at_screenres=1 in Gemini Rue (to either side of the vendor):

image

I tried the following change:

--- a/Engine/gfx/ali3dogl.cpp
+++ b/Engine/gfx/ali3dogl.cpp
@@ -556,6 +556,7 @@ bool OGLGraphicsDriver::InitGlScreen(const DisplayMode &mode)

 void OGLGraphicsDriver::InitGlParams(const DisplayMode &mode)
 {
+  glDisable(GL_DITHER);
   glDisable(GL_CULL_FACE);
   glDisable(GL_DEPTH_TEST);
   glDisable(GL_LIGHTING);

But it doesn't look any different to me:

image

For completeness, with render_at_screenres=0, it looks like: image

ghost commented 5 years ago

IMO it's better to open a new issue about that if it applies to the OpenGL renderer regardless of platform. Leave issue 510 just for the initial Linux OpenGL hookup.

I agree. At first glance this seems like a texture scaling issue to me.

vga-256 commented 5 years ago

@toojays Thanks for the recommendations. I tried your approach, and could not get killall to dump a core. The command ran successfully, but did not dump a core anywhere that I could find one. I tried generating a core dump via another route: sleep 5 && gcore <ags64-opengl PID> Which output:

[New LWP 19544]
[New LWP 19545]
[New LWP 19547]
[New LWP 19548]
[New LWP 19549]
[New LWP 19550]
warning: Could not load shared library symbols for 3 libraries, e.g. libGLEW.so.2.0.
Use the "info sharedlibrary" command to see the complete listing.
Do you need "set solib-search-path" or "set sysroot"?
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1".
syscall () at ../sysdeps/unix/sysv/linux/x86_64/syscall.S:38
38  ../sysdeps/unix/sysv/linux/x86_64/syscall.S: No such file or directory.
warning: target file /proc/19543/cmdline contained unexpected null characters
Saved corefile core.19543

This did generate a core dump, which I processed via: gdb <path to ags64-opengl> core.10261 --batch -ex "thread apply all bt full"

I did two dumps for completeness.

Here is the output when the game is frozen at the title screen (e.g. Start game selection menu):

[New LWP 18003]
[New LWP 18004]
[New LWP 18005]
[New LWP 18007]
[New LWP 18008]
[New LWP 18009]
[New LWP 18010]

warning: Could not load shared library symbols for 3 libraries, e.g. libGLEW.so.2.0.
Use the "info sharedlibrary" command to see the complete listing.
Do you need "set solib-search-path" or "set sysroot"?
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1".
Core was generated by `/home/chris/.local/share/Steam/steamapps/common/Mages Initiation/ags64-opengl'.
#0  syscall () at ../sysdeps/unix/sysv/linux/x86_64/syscall.S:38
38  ../sysdeps/unix/sysv/linux/x86_64/syscall.S: No such file or directory.
[Current thread is 1 (Thread 0x7fb05dbcf240 (LWP 18003))]

Thread 7 (Thread 0x7fb01be7d700 (LWP 18010)):
#0  0x00007fb05bac89f3 in futex_wait_cancelable (private=<optimized out>, expected=0, futex_word=0x561edbb08d88) at ../sysdeps/unix/sysv/linux/futex-internal.h:88
        __ret = -512
        oldtype = 0
        err = <optimized out>
        oldtype = <optimized out>
        err = <optimized out>
        __ret = <optimized out>
        resultvar = <optimized out>
        __arg4 = <optimized out>
        __arg3 = <optimized out>
        __arg2 = <optimized out>
        __arg1 = <optimized out>
        _a4 = <optimized out>
        _a3 = <optimized out>
        _a2 = <optimized out>
        _a1 = <optimized out>
#1  __pthread_cond_wait_common (abstime=0x0, mutex=0x561edbb08d38, cond=0x561edbb08d60) at pthread_cond_wait.c:502
        spin = 0
        buffer = {__routine = 0x7fb05bac8690 <__condvar_cleanup_waiting>, __arg = 0x7fb01be7cc80, __canceltype = 1, __prev = 0x0}
        cbuffer = {wseq = 0, cond = 0x561edbb08d60, mutex = 0x561edbb08d38, private = 0}
        rt = <optimized out>
        err = <optimized out>
        g = 0
        flags = <optimized out>
        g1_start = <optimized out>
        signals = <optimized out>
        result = 0
        wseq = <optimized out>
        seq = 0
        private = <optimized out>
        maxspin = <optimized out>
        err = <optimized out>
        result = <optimized out>
        wseq = <optimized out>
        g = <optimized out>
        seq = <optimized out>
        flags = <optimized out>
        private = <optimized out>
        signals = <optimized out>
        g1_start = <optimized out>
        spin = <optimized out>
        buffer = <optimized out>
        cbuffer = <optimized out>
        rt = <optimized out>
        s = <optimized out>
#2  __pthread_cond_wait (cond=0x561edbb08d60, mutex=0x561edbb08d38) at pthread_cond_wait.c:655
No locals.
#3  0x00007fb02150b46b in ?? () from /usr/lib/x86_64-linux-gnu/dri/r600_dri.so
No symbol table info available.
#4  0x00007fb02150b197 in ?? () from /usr/lib/x86_64-linux-gnu/dri/r600_dri.so
No symbol table info available.
#5  0x00007fb05bac26db in start_thread (arg=0x7fb01be7d700) at pthread_create.c:463
        pd = 0x7fb01be7d700
        now = <optimized out>
        unwind_buf = {cancel_jmp_buf = {{jmp_buf = {140394359150336, -3149886248292964011, 140394359148096, 0, 94690534789792, 140728704268384, 3110136773252753749, 3110277039607261525}, mask_was_saved = 0}}, priv = {pad = {0x0, 0x0, 0x0, 0x0}, data = {prev = 0x0, cleanup = 0x0, canceltype = 0}}}
        not_first_call = <optimized out>
#6  0x00007fb05b7eb88f in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:95
No locals.

Thread 6 (Thread 0x7fb01c67e700 (LWP 18009)):
#0  0x00007fb05bac89f3 in futex_wait_cancelable (private=<optimized out>, expected=0, futex_word=0x561edbb08740) at ../sysdeps/unix/sysv/linux/futex-internal.h:88
        __ret = -512
        oldtype = 0
        err = <optimized out>
        oldtype = <optimized out>
        err = <optimized out>
        __ret = <optimized out>
        resultvar = <optimized out>
        __arg4 = <optimized out>
        __arg3 = <optimized out>
        __arg2 = <optimized out>
        __arg1 = <optimized out>
        _a4 = <optimized out>
        _a3 = <optimized out>
        _a2 = <optimized out>
        _a1 = <optimized out>
#1  __pthread_cond_wait_common (abstime=0x0, mutex=0x561edbb086f0, cond=0x561edbb08718) at pthread_cond_wait.c:502
        spin = 0
        buffer = {__routine = 0x7fb05bac8690 <__condvar_cleanup_waiting>, __arg = 0x7fb01c67dc80, __canceltype = -532342912, __prev = 0x0}
        cbuffer = {wseq = 9532, cond = 0x561edbb08718, mutex = 0x561edbb086f0, private = 0}
        rt = <optimized out>
        err = <optimized out>
        g = 0
        flags = <optimized out>
        g1_start = <optimized out>
        signals = <optimized out>
        result = 0
        wseq = <optimized out>
        seq = 4766
        private = <optimized out>
        maxspin = <optimized out>
        err = <optimized out>
        result = <optimized out>
        wseq = <optimized out>
        g = <optimized out>
        seq = <optimized out>
        flags = <optimized out>
        private = <optimized out>
        signals = <optimized out>
        g1_start = <optimized out>
        spin = <optimized out>
        buffer = <optimized out>
        cbuffer = <optimized out>
        rt = <optimized out>
        s = <optimized out>
#2  __pthread_cond_wait (cond=0x561edbb08718, mutex=0x561edbb086f0) at pthread_cond_wait.c:655
No locals.
#3  0x00007fb02150b46b in ?? () from /usr/lib/x86_64-linux-gnu/dri/r600_dri.so
No symbol table info available.
#4  0x00007fb02150b197 in ?? () from /usr/lib/x86_64-linux-gnu/dri/r600_dri.so
No symbol table info available.
#5  0x00007fb05bac26db in start_thread (arg=0x7fb01c67e700) at pthread_create.c:463
        pd = 0x7fb01c67e700
        now = <optimized out>
        unwind_buf = {cancel_jmp_buf = {{jmp_buf = {140394367543040, -3149886248292964011, 140394367540800, 0, 94690534722640, 140728704269616, 3110126878184974677, 3110277039607261525}, mask_was_saved = 0}}, priv = {pad = {0x0, 0x0, 0x0, 0x0}, data = {prev = 0x0, cleanup = 0x0, canceltype = 0}}}
        not_first_call = <optimized out>
#6  0x00007fb05b7eb88f in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:95
No locals.

Thread 5 (Thread 0x7fb04a771700 (LWP 18008)):
#0  0x00007fb05b7debf9 in __GI___poll (fds=0x7fb02c001b30, nfds=3, timeout=-1) at ../sysdeps/unix/sysv/linux/poll.c:29
        resultvar = 18446744073709551100
        sc_cancel_oldtype = 0
        sc_ret = <optimized out>
#1  0x00007fb055238451 in ?? () from /usr/lib/x86_64-linux-gnu/libpulse.so.0
No symbol table info available.
#2  0x00007fb055229e10 in pa_mainloop_poll () from /usr/lib/x86_64-linux-gnu/libpulse.so.0
No symbol table info available.
#3  0x00007fb05522a4a0 in pa_mainloop_iterate () from /usr/lib/x86_64-linux-gnu/libpulse.so.0
No symbol table info available.
#4  0x00007fb05522a530 in pa_mainloop_run () from /usr/lib/x86_64-linux-gnu/libpulse.so.0
No symbol table info available.
#5  0x00007fb055238399 in ?? () from /usr/lib/x86_64-linux-gnu/libpulse.so.0
No symbol table info available.
#6  0x00007fb054fda2a8 in ?? () from /usr/lib/x86_64-linux-gnu/pulseaudio/libpulsecommon-11.1.so
No symbol table info available.
#7  0x00007fb05bac26db in start_thread (arg=0x7fb04a771700) at pthread_create.c:463
        pd = 0x7fb04a771700
        now = <optimized out>
        unwind_buf = {cancel_jmp_buf = {{jmp_buf = {140395140290304, -3149886248292964011, 140395140288064, 0, 94690491304480, 140728704264224, 3110245489612433749, 3110277039607261525}, mask_was_saved = 0}}, priv = {pad = {0x0, 0x0, 0x0, 0x0}, data = {prev = 0x0, cleanup = 0x0, canceltype = 0}}}
        not_first_call = <optimized out>
#8  0x00007fb05b7eb88f in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:95
No locals.

Thread 4 (Thread 0x7fb04b178700 (LWP 18007)):
#0  0x00007fb05b7debf9 in __GI___poll (fds=0x7fb0440045d0, nfds=3, timeout=955) at ../sysdeps/unix/sysv/linux/poll.c:29
        resultvar = 18446744073709551100
        sc_cancel_oldtype = 0
        sc_ret = <optimized out>
#1  0x00007fb055238451 in ?? () from /usr/lib/x86_64-linux-gnu/libpulse.so.0
No symbol table info available.
#2  0x00007fb055229e10 in pa_mainloop_poll () from /usr/lib/x86_64-linux-gnu/libpulse.so.0
No symbol table info available.
#3  0x00007fb05522a4a0 in pa_mainloop_iterate () from /usr/lib/x86_64-linux-gnu/libpulse.so.0
No symbol table info available.
#4  0x00007fb05522a530 in pa_mainloop_run () from /usr/lib/x86_64-linux-gnu/libpulse.so.0
No symbol table info available.
#5  0x00007fb055238399 in ?? () from /usr/lib/x86_64-linux-gnu/libpulse.so.0
No symbol table info available.
#6  0x00007fb054fda2a8 in ?? () from /usr/lib/x86_64-linux-gnu/pulseaudio/libpulsecommon-11.1.so
No symbol table info available.
#7  0x00007fb05bac26db in start_thread (arg=0x7fb04b178700) at pthread_create.c:463
        pd = 0x7fb04b178700
        now = <optimized out>
        unwind_buf = {cancel_jmp_buf = {{jmp_buf = {140395150804736, -3149886248292964011, 140395150802496, 0, 94690491266064, 140728704264192, 3110242467566070101, 3110277039607261525}, mask_was_saved = 0}}, priv = {pad = {0x0, 0x0, 0x0, 0x0}, data = {prev = 0x0, cleanup = 0x0, canceltype = 0}}}
        not_first_call = <optimized out>
#8  0x00007fb05b7eb88f in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:95
No locals.

Thread 3 (Thread 0x7fb055e58700 (LWP 18005)):
#0  0x00007fb05b7e103f in __GI___select (nfds=0, readfds=0x0, writefds=0x0, exceptfds=0x0, timeout=0x7fb055e57c80) at ../sysdeps/unix/sysv/linux/select.c:41
        resultvar = 18446744073709551102
        sc_cancel_oldtype = 0
        sc_ret = <optimized out>
#1  0x00007fb05d3317a2 in ?? () from /home/chris/.local/share/Steam/steamapps/common/Mages Initiation/lib64/liballeg.so.4.4
No symbol table info available.
#2  0x00007fb05bac26db in start_thread (arg=0x7fb055e58700) at pthread_create.c:463
        pd = 0x7fb055e58700
        now = <optimized out>
        unwind_buf = {cancel_jmp_buf = {{jmp_buf = {140395332077312, -3149886248292964011, 140395332075072, 0, 0, 140728704273648, 3110281929725585749, 3110277039607261525}, mask_was_saved = 0}}, priv = {pad = {0x0, 0x0, 0x0, 0x0}, data = {prev = 0x0, cleanup = 0x0, canceltype = 0}}}
        not_first_call = <optimized out>
#3  0x00007fb05b7eb88f in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:95
No locals.

Thread 2 (Thread 0x7fb05786a700 (LWP 18004)):
#0  0x00007fb05b7e103f in __GI___select (nfds=0, readfds=0x0, writefds=0x0, exceptfds=0x0, timeout=0x7fb057869cb0) at ../sysdeps/unix/sysv/linux/select.c:41
        resultvar = 18446744073709551102
        sc_cancel_oldtype = 0
        sc_ret = <optimized out>
#1  0x00007fb05d33285a in ?? () from /home/chris/.local/share/Steam/steamapps/common/Mages Initiation/lib64/liballeg.so.4.4
No symbol table info available.
#2  0x00007fb05bac26db in start_thread (arg=0x7fb05786a700) at pthread_create.c:463
        pd = 0x7fb05786a700
        now = <optimized out>
        unwind_buf = {cancel_jmp_buf = {{jmp_buf = {140395359414016, -3149886248292964011, 140395359411776, 0, 0, 140728704273168, 3110285471999863125, 3110277039607261525}, mask_was_saved = 0}}, priv = {pad = {0x0, 0x0, 0x0, 0x0}, data = {prev = 0x0, cleanup = 0x0, canceltype = 0}}}
        not_first_call = <optimized out>
#3  0x00007fb05b7eb88f in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:95
No locals.

Thread 1 (Thread 0x7fb05dbcf240 (LWP 18003)):
#0  syscall () at ../sysdeps/unix/sysv/linux/x86_64/syscall.S:38
No locals.
#1  0x00007fb055456bda in xshmfence_await () from /usr/lib/x86_64-linux-gnu/libxshmfence.so.1
No symbol table info available.
#2  0x00007fb048c9a35b in ?? () from /usr/lib/x86_64-linux-gnu/libGLX_mesa.so.0
No symbol table info available.
#3  0x00007fb048c9b06e in ?? () from /usr/lib/x86_64-linux-gnu/libGLX_mesa.so.0
No symbol table info available.
#4  0x00007fb0215b3143 in ?? () from /usr/lib/x86_64-linux-gnu/dri/r600_dri.so
No symbol table info available.
#5  0x00007fb0215ae98c in ?? () from /usr/lib/x86_64-linux-gnu/dri/r600_dri.so
No symbol table info available.
#6  0x00007fb02144a639 in ?? () from /usr/lib/x86_64-linux-gnu/dri/r600_dri.so
No symbol table info available.
#7  0x00007fb02144bf5b in ?? () from /usr/lib/x86_64-linux-gnu/dri/r600_dri.so
No symbol table info available.
#8  0x00007fb02140a2a8 in ?? () from /usr/lib/x86_64-linux-gnu/dri/r600_dri.so
No symbol table info available.
#9  0x00007fb021412404 in ?? () from /usr/lib/x86_64-linux-gnu/dri/r600_dri.so
No symbol table info available.
#10 0x0000561ed7f88734 in AGS::Engine::OGL::OGLGraphicsDriver::_render(AGS::Engine::GlobalFlipType, bool) ()
No symbol table info available.
#11 0x0000561ed7f6e5bc in render_to_screen(AGS::Common::Bitmap*, int, int) ()
No symbol table info available.
#12 0x0000561ed7f6e9ed in ?? ()
No symbol table info available.
#13 0x0000561ed7f97997 in ?? ()
No symbol table info available.
#14 0x0000561ed7f99316 in UpdateGameOnce(bool, AGS::Engine::IDriverDependantBitmap*, int, int) ()
No symbol table info available.
#15 0x0000561ed7f9936e in GameTick() ()
No symbol table info available.
#16 0x0000561ed7f99448 in RunGameUntilAborted() ()
No symbol table info available.
#17 0x0000561ed7f99775 in initialize_start_and_play_game(int, char const*) ()
No symbol table info available.
#18 0x0000561ed7f934f5 in initialize_engine(int, char**) ()
No symbol table info available.
#19 0x0000561ed7ea9a6f in main ()
No symbol table info available.

And here is an analysis of the game frozen during video playback (e.g. during the intro):

[New LWP 19543]
[New LWP 19544]
[New LWP 19545]
[New LWP 19547]
[New LWP 19548]
[New LWP 19549]
[New LWP 19550]

warning: Could not load shared library symbols for 3 libraries, e.g. libGLEW.so.2.0.
Use the "info sharedlibrary" command to see the complete listing.
Do you need "set solib-search-path" or "set sysroot"?
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1".
Core was generated by `/home/chris/.local/share/Steam/steamapps/common/Mages Initiation/ags64-opengl'.
#0  syscall () at ../sysdeps/unix/sysv/linux/x86_64/syscall.S:38
38  ../sysdeps/unix/sysv/linux/x86_64/syscall.S: No such file or directory.
[Current thread is 1 (Thread 0x7fb2a7ad2240 (LWP 19543))]

Thread 7 (Thread 0x7fb2659c9700 (LWP 19550)):
#0  0x00007fb2a59cb9f3 in futex_wait_cancelable (private=<optimized out>, expected=0, futex_word=0x5604e315c078) at ../sysdeps/unix/sysv/linux/futex-internal.h:88
        __ret = -512
        oldtype = 0
        err = <optimized out>
        oldtype = <optimized out>
        err = <optimized out>
        __ret = <optimized out>
        resultvar = <optimized out>
        __arg4 = <optimized out>
        __arg3 = <optimized out>
        __arg2 = <optimized out>
        __arg1 = <optimized out>
        _a4 = <optimized out>
        _a3 = <optimized out>
        _a2 = <optimized out>
        _a1 = <optimized out>
#1  __pthread_cond_wait_common (abstime=0x0, mutex=0x5604e315c028, cond=0x5604e315c050) at pthread_cond_wait.c:502
        spin = 0
        buffer = {__routine = 0x7fb2a59cb690 <__condvar_cleanup_waiting>, __arg = 0x7fb2659c8c80, __canceltype = 1, __prev = 0x0}
        cbuffer = {wseq = 0, cond = 0x5604e315c050, mutex = 0x5604e315c028, private = 0}
        rt = <optimized out>
        err = <optimized out>
        g = 0
        flags = <optimized out>
        g1_start = <optimized out>
        signals = <optimized out>
        result = 0
        wseq = <optimized out>
        seq = 0
        private = <optimized out>
        maxspin = <optimized out>
        err = <optimized out>
        result = <optimized out>
        wseq = <optimized out>
        g = <optimized out>
        seq = <optimized out>
        flags = <optimized out>
        private = <optimized out>
        signals = <optimized out>
        g1_start = <optimized out>
        spin = <optimized out>
        buffer = <optimized out>
        cbuffer = <optimized out>
        rt = <optimized out>
        s = <optimized out>
#2  __pthread_cond_wait (cond=0x5604e315c050, mutex=0x5604e315c028) at pthread_cond_wait.c:655
No locals.
#3  0x00007fb26b05746b in ?? () from /usr/lib/x86_64-linux-gnu/dri/r600_dri.so
No symbol table info available.
#4  0x00007fb26b057197 in ?? () from /usr/lib/x86_64-linux-gnu/dri/r600_dri.so
No symbol table info available.
#5  0x00007fb2a59c56db in start_thread (arg=0x7fb2659c9700) at pthread_create.c:463
        pd = 0x7fb2659c9700
        now = <optimized out>
        unwind_buf = {cancel_jmp_buf = {{jmp_buf = {140404185667328, 8525113613170561183, 140404185665088, 0, 94578989781632, 140723008326112, -8562606707805466465, -8563028917892099937}, mask_was_saved = 0}}, priv = {pad = {0x0, 0x0, 0x0, 0x0}, data = {prev = 0x0, cleanup = 0x0, canceltype = 0}}}
        not_first_call = <optimized out>
#6  0x00007fb2a56ee88f in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:95
No locals.

Thread 6 (Thread 0x7fb2661ca700 (LWP 19549)):
#0  0x00007fb2a59cb9f3 in futex_wait_cancelable (private=<optimized out>, expected=0, futex_word=0x5604e316c710) at ../sysdeps/unix/sysv/linux/futex-internal.h:88
        __ret = -512
        oldtype = 0
        err = <optimized out>
        oldtype = <optimized out>
        err = <optimized out>
        __ret = <optimized out>
        resultvar = <optimized out>
        __arg4 = <optimized out>
        __arg3 = <optimized out>
        __arg2 = <optimized out>
        __arg1 = <optimized out>
        _a4 = <optimized out>
        _a3 = <optimized out>
        _a2 = <optimized out>
        _a1 = <optimized out>
#1  __pthread_cond_wait_common (abstime=0x0, mutex=0x5604e316c6c0, cond=0x5604e316c6e8) at pthread_cond_wait.c:502
        spin = 0
        buffer = {__routine = 0x7fb2a59cb690 <__condvar_cleanup_waiting>, __arg = 0x7fb2661c9c80, __canceltype = 46, __prev = 0x0}
        cbuffer = {wseq = 3412, cond = 0x5604e316c6e8, mutex = 0x5604e316c6c0, private = 0}
        rt = <optimized out>
        err = <optimized out>
        g = 0
        flags = <optimized out>
        g1_start = <optimized out>
        signals = <optimized out>
        result = 0
        wseq = <optimized out>
        seq = 1706
        private = <optimized out>
        maxspin = <optimized out>
        err = <optimized out>
        result = <optimized out>
        wseq = <optimized out>
        g = <optimized out>
        seq = <optimized out>
        flags = <optimized out>
        private = <optimized out>
        signals = <optimized out>
        g1_start = <optimized out>
        spin = <optimized out>
        buffer = <optimized out>
        cbuffer = <optimized out>
        rt = <optimized out>
        s = <optimized out>
#2  __pthread_cond_wait (cond=0x5604e316c6e8, mutex=0x5604e316c6c0) at pthread_cond_wait.c:655
No locals.
#3  0x00007fb26b05746b in ?? () from /usr/lib/x86_64-linux-gnu/dri/r600_dri.so
No symbol table info available.
#4  0x00007fb26b057197 in ?? () from /usr/lib/x86_64-linux-gnu/dri/r600_dri.so
No symbol table info available.
#5  0x00007fb2a59c56db in start_thread (arg=0x7fb2661ca700) at pthread_create.c:463
        pd = 0x7fb2661ca700
        now = <optimized out>
        unwind_buf = {cancel_jmp_buf = {{jmp_buf = {140404194060032, 8525113613170561183, 140404194057792, 0, 94578989703664, 140723008327344, -8562603408733712225, -8563028917892099937}, mask_was_saved = 0}}, priv = {pad = {0x0, 0x0, 0x0, 0x0}, data = {prev = 0x0, cleanup = 0x0, canceltype = 0}}}
        not_first_call = <optimized out>
#6  0x00007fb2a56ee88f in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:95
No locals.

Thread 5 (Thread 0x7fb27ffff700 (LWP 19548)):
#0  0x00007fb2a56e1bf9 in __GI___poll (fds=0x7fb278001b30, nfds=3, timeout=-1) at ../sysdeps/unix/sysv/linux/poll.c:29
        resultvar = 18446744073709551100
        sc_cancel_oldtype = 0
        sc_ret = <optimized out>
#1  0x00007fb2a030b451 in ?? () from /usr/lib/x86_64-linux-gnu/libpulse.so.0
No symbol table info available.
#2  0x00007fb2a02fce10 in pa_mainloop_poll () from /usr/lib/x86_64-linux-gnu/libpulse.so.0
No symbol table info available.
#3  0x00007fb2a02fd4a0 in pa_mainloop_iterate () from /usr/lib/x86_64-linux-gnu/libpulse.so.0
No symbol table info available.
#4  0x00007fb2a02fd530 in pa_mainloop_run () from /usr/lib/x86_64-linux-gnu/libpulse.so.0
No symbol table info available.
#5  0x00007fb2a030b399 in ?? () from /usr/lib/x86_64-linux-gnu/libpulse.so.0
No symbol table info available.
#6  0x00007fb2a00ad2a8 in ?? () from /usr/lib/x86_64-linux-gnu/pulseaudio/libpulsecommon-11.1.so
No symbol table info available.
#7  0x00007fb2a59c56db in start_thread (arg=0x7fb27ffff700) at pthread_create.c:463
        pd = 0x7fb27ffff700
        now = <optimized out>
        unwind_buf = {cancel_jmp_buf = {{jmp_buf = {140404628387584, 8525113613170561183, 140404628385344, 0, 94578946296048, 140723008321952, -8562549785530150753, -8563028917892099937}, mask_was_saved = 0}}, priv = {pad = {0x0, 0x0, 0x0, 0x0}, data = {prev = 0x0, cleanup = 0x0, canceltype = 0}}}
        not_first_call = <optimized out>
#8  0x00007fb2a56ee88f in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:95
No locals.

Thread 4 (Thread 0x7fb295021700 (LWP 19547)):
#0  0x00007fb2a56e1bf9 in __GI___poll (fds=0x7fb2900045d0, nfds=3, timeout=1330) at ../sysdeps/unix/sysv/linux/poll.c:29
        resultvar = 18446744073709551100
        sc_cancel_oldtype = 0
        sc_ret = <optimized out>
#1  0x00007fb2a030b451 in ?? () from /usr/lib/x86_64-linux-gnu/libpulse.so.0
No symbol table info available.
#2  0x00007fb2a02fce10 in pa_mainloop_poll () from /usr/lib/x86_64-linux-gnu/libpulse.so.0
No symbol table info available.
#3  0x00007fb2a02fd4a0 in pa_mainloop_iterate () from /usr/lib/x86_64-linux-gnu/libpulse.so.0
No symbol table info available.
#4  0x00007fb2a02fd530 in pa_mainloop_run () from /usr/lib/x86_64-linux-gnu/libpulse.so.0
No symbol table info available.
#5  0x00007fb2a030b399 in ?? () from /usr/lib/x86_64-linux-gnu/libpulse.so.0
No symbol table info available.
#6  0x00007fb2a00ad2a8 in ?? () from /usr/lib/x86_64-linux-gnu/pulseaudio/libpulsecommon-11.1.so
No symbol table info available.
#7  0x00007fb2a59c56db in start_thread (arg=0x7fb295021700) at pthread_create.c:463
        pd = 0x7fb295021700
        now = <optimized out>
        unwind_buf = {cancel_jmp_buf = {{jmp_buf = {140404980848384, 8525113613170561183, 140404980846144, 0, 94578946258016, 140723008321920, -8562922143088586593, -8563028917892099937}, mask_was_saved = 0}}, priv = {pad = {0x0, 0x0, 0x0, 0x0}, data = {prev = 0x0, cleanup = 0x0, canceltype = 0}}}
        not_first_call = <optimized out>
#8  0x00007fb2a56ee88f in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:95
No locals.

Thread 3 (Thread 0x7fb29b630700 (LWP 19545)):
#0  0x00007fb2a56e403f in __GI___select (nfds=0, readfds=0x0, writefds=0x0, exceptfds=0x0, timeout=0x7fb29b62fc80) at ../sysdeps/unix/sysv/linux/select.c:41
        resultvar = 18446744073709551102
        sc_cancel_oldtype = 0
        sc_ret = <optimized out>
#1  0x00007fb2a72347a2 in ?? () from /home/chris/.local/share/Steam/steamapps/common/Mages Initiation/lib64/liballeg.so.4.4
No symbol table info available.
#2  0x00007fb2a59c56db in start_thread (arg=0x7fb29b630700) at pthread_create.c:463
        pd = 0x7fb29b630700
        now = <optimized out>
        unwind_buf = {cancel_jmp_buf = {{jmp_buf = {140405087864576, 8525113613170561183, 140405087862336, 0, 0, 140723008331376, -8562891638620237665, -8563028917892099937}, mask_was_saved = 0}}, priv = {pad = {0x0, 0x0, 0x0, 0x0}, data = {prev = 0x0, cleanup = 0x0, canceltype = 0}}}
        not_first_call = <optimized out>
#3  0x00007fb2a56ee88f in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:95
No locals.

Thread 2 (Thread 0x7fb2a176d700 (LWP 19544)):
#0  0x00007fb2a56e403f in __GI___select (nfds=0, readfds=0x0, writefds=0x0, exceptfds=0x0, timeout=0x7fb2a176ccb0) at ../sysdeps/unix/sysv/linux/select.c:41
        resultvar = 18446744073709551102
        sc_cancel_oldtype = 0
        sc_ret = <optimized out>
#1  0x00007fb2a723585a in ?? () from /home/chris/.local/share/Steam/steamapps/common/Mages Initiation/lib64/liballeg.so.4.4
No symbol table info available.
#2  0x00007fb2a59c56db in start_thread (arg=0x7fb2a176d700) at pthread_create.c:463
        pd = 0x7fb2a176d700
        now = <optimized out>
        unwind_buf = {cancel_jmp_buf = {{jmp_buf = {140405189826304, 8525113613170561183, 140405189824064, 0, 0, 140723008330896, -8563019353230880609, -8563028917892099937}, mask_was_saved = 0}}, priv = {pad = {0x0, 0x0, 0x0, 0x0}, data = {prev = 0x0, cleanup = 0x0, canceltype = 0}}}
        not_first_call = <optimized out>
#3  0x00007fb2a56ee88f in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:95
No locals.

Thread 1 (Thread 0x7fb2a7ad2240 (LWP 19543)):
#0  syscall () at ../sysdeps/unix/sysv/linux/x86_64/syscall.S:38
No locals.
#1  0x00007fb2a0529bda in xshmfence_await () from /usr/lib/x86_64-linux-gnu/libxshmfence.so.1
No symbol table info available.
#2  0x00007fb27d06435b in ?? () from /usr/lib/x86_64-linux-gnu/libGLX_mesa.so.0
No symbol table info available.
#3  0x00007fb27d06506e in ?? () from /usr/lib/x86_64-linux-gnu/libGLX_mesa.so.0
No symbol table info available.
#4  0x00007fb26b0ff143 in ?? () from /usr/lib/x86_64-linux-gnu/dri/r600_dri.so
No symbol table info available.
#5  0x00007fb26b0fa98c in ?? () from /usr/lib/x86_64-linux-gnu/dri/r600_dri.so
No symbol table info available.
#6  0x00007fb26af96639 in ?? () from /usr/lib/x86_64-linux-gnu/dri/r600_dri.so
No symbol table info available.
#7  0x00007fb26af97f5b in ?? () from /usr/lib/x86_64-linux-gnu/dri/r600_dri.so
No symbol table info available.
#8  0x00007fb26af562a8 in ?? () from /usr/lib/x86_64-linux-gnu/dri/r600_dri.so
No symbol table info available.
#9  0x00007fb26af5e404 in ?? () from /usr/lib/x86_64-linux-gnu/dri/r600_dri.so
No symbol table info available.
#10 0x00005604de692734 in AGS::Engine::OGL::OGLGraphicsDriver::_render(AGS::Engine::GlobalFlipType, bool) ()
No symbol table info available.
#11 0x00005604de6785bc in render_to_screen(AGS::Common::Bitmap*, int, int) ()
No symbol table info available.
#12 0x00005604de6afedd in theora_playing_callback(BITMAP*) ()
No symbol table info available.
#13 0x00005604de5d5f32 in ?? ()
No symbol table info available.
#14 0x00005604de5d6f9c in apeg_play_apeg_stream ()
No symbol table info available.
#15 0x00005604de6b068c in play_theora_video(char const*, int, int) ()
No symbol table info available.
#16 0x00005604de663fc0 in pause_sound_if_necessary_and_play_video(char const*, int, int) ()
No symbol table info available.
#17 0x00005604de619740 in Sc_scrPlayVideo(RuntimeScriptValue const*, int) ()
No symbol table info available.
#18 0x00005604de6be698 in ccInstance::Run(int) ()
No symbol table info available.
#19 0x00005604de6bedd8 in ccInstance::CallScriptFunction(char const*, int, RuntimeScriptValue const*) ()
No symbol table info available.
#20 0x00005604de6bf149 in ccInstance::RunScriptFunctionIfExists(char const*, int, RuntimeScriptValue const*) ()
No symbol table info available.
#21 0x00005604de6bf2a1 in ccInstance::RunTextScript(char const*) ()
No symbol table info available.
#22 0x00005604de6b64a9 in run_interaction_script(AGS::Common::InteractionScripts*, int, int, int) ()
No symbol table info available.
#23 0x00005604de66b8dd in process_event(EventHappened*) ()
No symbol table info available.
#24 0x00005604de66c159 in processallevents(int, EventHappened*) ()
No symbol table info available.
#25 0x00005604de66c196 in update_events() ()
No symbol table info available.
#26 0x00005604de6a2a43 in game_loop_update_events() ()
No symbol table info available.
#27 0x00005604de6a3223 in UpdateGameOnce(bool, AGS::Engine::IDriverDependantBitmap*, int, int) ()
No symbol table info available.
#28 0x00005604de6a336e in GameTick() ()
No symbol table info available.
#29 0x00005604de6a3448 in RunGameUntilAborted() ()
No symbol table info available.
#30 0x00005604de6a3775 in initialize_start_and_play_game(int, char const*) ()
No symbol table info available.
#31 0x00005604de69d4f5 in initialize_engine(int, char**) ()
No symbol table info available.
#32 0x00005604de5b3a6f in main ()
No symbol table info available.
toojays commented 5 years ago

@toojays Thanks for the recommendations. I tried your approach, and could not get killall to dump a core. The command ran successfully, but did not dump a core anywhere that I could find one. I tried generating a core dump via another route: sleep 5 && gcore <ags64-opengl PID>

Thanks @256colour. Running gcore has the same impact as the first approach I suggested to use to gather traces - it can perturb the process. But I'm now thinking that doesn't actually invalidate the traces you collected - it only changes the state of the program after gdb detaches.

In all three cases we appear to be stuck in the graphics driver waiting for a signal from another process (presumably the X server). It might be interesting to get a trace which included debuginfo for the r600_dri.so and libGLX_mesa.so.0 bits.

What you're seeing sounds like a match to Mesa bug 107290. The bug it got duped into says disabling DRI3 works around it. Looking at the list of Mesa environment variables, you can disable DRI3 by doing export LIBGL_DRI3_DISABLE=true in the shell you are running AGS from. (I assume this can be done per-process.) Worth a quick test I think. Easier than figuring out how to get the debug symbols for the graphics drivers.

Why don't I see this in my testing? I'm running with Mesa 18.2.2 (from the Ubuntu X PPA), but the fix is only in 18.3. Hmm . . . it looks like Ubuntu has DRI3 disabled for Intel graphics, which is what I've been testing with.

It would be interesting to know driver versions and DRI2/3 status from people who have tested this code so far, and whether they have or have not hit the same stalls as 256color. The driver-bug hypothesis is plausible, but I don't have much supporting evidence for it yet.

vga-256 commented 5 years ago

@toojays Oh man, great detective work! Disabling DRI3 worked like a charm. I'm running an old Radeon 6970M, which must have had it enabled by default.

I can only assume that my system won't be the only one affected by this, so I'll apply the same export to the game startup script.

ericoporto commented 5 years ago

@vga256, could you upload here or somewhere your game startup script?

vga-256 commented 5 years ago

@ericoporto You bet!


#!/bin/sh
SCRIPTPATH="$(dirname "$(readlink -f "$0")")"

if test "x$@" = "x-h" -o "x$@" = "x--help"
  then
    echo "Usage:" "$(basename "$(readlink -f $0)")" "[<ags options>]"
    echo ""
fi

chmod +x "$SCRIPTPATH/ags64" "$SCRIPTPATH/ags32"

if test $(uname -m) = x86_64
  then
    export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:"$SCRIPTPATH/lib64"
    export LIBGL_DRI3_DISABLE=true
    ALLEGRO_MODULES="$SCRIPTPATH/lib64" "$SCRIPTPATH/ags64-opengl" "$@" > "$SCRIPTPATH/log.txt" 2>&1
  else
    export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:"$SCRIPTPATH/lib32"
    export LIBGL_DRI3_DISABLE=true
    ALLEGRO_MODULES="$SCRIPTPATH/lib32" "$SCRIPTPATH/ags32-opengl" "$@" > "$SCRIPTPATH/log.txt" 2>&1
fi
toojays commented 5 years ago

I haven't played any AGS games since October, but am planning to try Gemini Rue over my Christmas break and work toward getting this merged.

I did not make as much progress as I would have liked on this. I'm happy that the code on my branch works, but I wanted to review it with a view towards adding documentation & refactoring before putting up a pull request. I don't know when this will happen now.

I reckon I'm probably halfway through Gemini Rue though. ;)

ghost commented 5 years ago

@toojays could you also look at my findings in #574 regarding vertical texture lines you experienced? I am interested to know if the suggested fix works. (Still not 100% sure that what I fixed is the same thing though because I only reproduced the glitch with linear scaling filter but not StdScale one)

ghost commented 5 years ago

What is the status of the renderer? I am currently preparing an unscheduled patch for 3.4.1 and was wondering if I could include OpenGL for Linux in there.

E: Hmm, on the other hand, I may release patch without it and then we could do 3.4.2 update exclusively for renderer (since new renderer is a feature) if there's a demand for 3.4.1 with OpenGL support on Linux (and they can't use 3.5.0),