Linux OpenGL stuttering when moving character (love attached)

Questions about the LÖVE API, installing LÖVE and other support related questions go here.
Forum rules
Before you make a thread asking for help, read this.
knuxyl
Citizen
Posts: 52
Joined: Sat Aug 13, 2016 4:40 am

Linux OpenGL stuttering when moving character (love attached)

Post by knuxyl »

This project supports all 16:9 resolutions, so there is a lot of scaling going on.

I decided to separate all layers into canvases, such as player, hud, background, etc, to minimize the scaling ipc.

For some reason though, while moving the character the game will stutter. I thought maybe it was a opengl driver issue, but it does it on both my gpus, intel p630 (from xeon w-1290t) and my amd radeon wx 4100.

I believe I have optimized the code enough to not stutter. I haven't even begun to work on the engine really, I've just been laying out the file structure and getting window management working correctly.

When moving the character across the screen, you can notice the stutter.

This is my platform
OS : Linux (Arch)
API : OpenGL
Version : 4.6 (Core Profile) Mesa 22.1.6
Device : AMD Radeon Pro WX 4100 (polaris11, LLVM 14.0.6, DRM 3.47, 5.19.2-arch1-1)

I was using an nvidia T1000 before I switched the radeon and it was doing the same thing. I originally was programming this in C with raylib, but it was stuttering, so I switched to lua and love, but it seems I'm having the same problem. I am also using luajit compiler to bytecode all the lua files to maybe improve performance but that has no effect. I have no clue what's going on.

I am using gnome / wayland, so I rebooted into Xorg mode and still no change. Can someone test this on Windows/Mac and/or look at the code and see if I'm doign something wrong? Thanks

LOVE archive
game17.love
LOVE archive
(1.89 MiB) Downloaded 108 times
Windows
game17.zip
Windows
(5.93 MiB) Downloaded 97 times
MacOS
game17.zip
MacOS
(11.8 MiB) Downloaded 94 times
User avatar
knorke
Party member
Posts: 239
Joined: Wed Jul 14, 2010 7:06 pm
Contact:

Re: Linux OpenGL stuttering when moving character (love attached)

Post by knorke »

The .love file does not stutter on my X250 ThinkPad but it only has relatively low resolution. Linux Mint with Xfce Desktop.
knuxyl
Citizen
Posts: 52
Joined: Sat Aug 13, 2016 4:40 am

Re: Linux OpenGL stuttering when moving character (love attached)

Post by knuxyl »

knorke wrote: Mon Aug 22, 2022 5:15 pm The .love file does not stutter on my X250 ThinkPad but it only has relatively low resolution. Linux Mint with Xfce Desktop.
hmm. maybe it's the window manager mutter that gnome uses. it has x11 compatibility (xwayland) and i'm guessing the problem is there. what resolution does your laptop go to? the game loads at 1280x720 and i see stuttering there, so i don't think it would be resolution.
User avatar
GVovkiv
Party member
Posts: 670
Joined: Fri Jan 15, 2021 7:29 am

Re: Linux OpenGL stuttering when moving character (love attached)

Post by GVovkiv »

knuxyl wrote: Mon Aug 22, 2022 6:03 pm hmm. maybe it's the window manager mutter that gnome uses. it has x11 compatibility (xwayland)
I'm not sure, that problem with that. I have gt730 with 470 driver, on fedora with gnome with x11 (because nvidia started support wayland from 495 driver version), and i can't see any stuttering on 1920x1080. Also, i resizing window do that: https://www.youtube.com/watch?v=s-RHjh5iAfA
(Also, for some reasons, obs captured that with lags, but at moment of recording, i didn't saw lags, so it's probably obs/mutter/etc problem). As you can see, it creates this weird artifacts. This happens only in this game, default no-game doesn't do that.
knuxyl
Citizen
Posts: 52
Joined: Sat Aug 13, 2016 4:40 am

Re: Linux OpenGL stuttering when moving character (love attached)

Post by knuxyl »

I just tested on Windows, it is the linux installation that has the issue. It has to be the xwayland mutter setup, that's all that is different. I hope love2d devs plan on supporting wayland, that would more than likely fix this issue.

Thanks for uploading the video, that verifies it's a wayland/xwayland issue.

I'll have to look into the artifacts, that's weird. Are you doing alt+left click to move the window? It doesn't do that for me. The game shouldn't be doing anything while just moving it around, only changes stuff on resize.

I'm going to guess those artifacts are from the nvidia driver. I switched to my amd specifically because of nvidia lack of development on linux, it was just problem after problem.
User avatar
GVovkiv
Party member
Posts: 670
Joined: Fri Jan 15, 2021 7:29 am

Re: Linux OpenGL stuttering when moving character (love attached)

Post by GVovkiv »

knuxyl wrote: Mon Aug 22, 2022 6:21 pm The artifacts you're seeing is probably because on right mouse click the window tries to fullscreen, so when you do alt+right click to move the window, the game is probably fighting between the window manager about what size it should be. The right click is only for testing, that won't be permanent.
I don't think it has anything to do with this. At least because, i use super + middle mouse to resize and super + left mouse to move. Also, when super is down, gnome doesn't send any click/keyboard events to window, so game can't react to any of this, Also, i tested it again, and now this artifacts doesn't happens. So, i'm not entierly sure, what cause that.
knuxyl
Citizen
Posts: 52
Joined: Sat Aug 13, 2016 4:40 am

Re: Linux OpenGL stuttering when moving character (love attached)

Post by knuxyl »

GVovkiv wrote: Mon Aug 22, 2022 6:28 pm
knuxyl wrote: Mon Aug 22, 2022 6:21 pm The artifacts you're seeing is probably because on right mouse click the window tries to fullscreen, so when you do alt+right click to move the window, the game is probably fighting between the window manager about what size it should be. The right click is only for testing, that won't be permanent.
I don't think it has anything to do with this. At least because, i use super + middle mouse to resize and super + left mouse to move. Also, when super is down, gnome doesn't send any click/keyboard events to window, so game can't react to any of this, Also, i tested it again, and now this artifacts doesn't happens. So, i'm not entierly sure, what cause that.
Yeah I realized I was getting the combos to move windows mixed up and edited right after. I don't know, it's weird.
I finally got OBS working by using xorg with QT_QPA_PLATFORM=xcb so I was able to record what it's doing for me.

https://www.youtube.com/watch?v=bRx0qzepCoU

Every so often it gets stuck for a little bit. This doesn't happen on your linux or on my windows.

I would love to go back to XFCE, I used that for like 5 years, but they've fallen behind way too much.
User avatar
milon
Party member
Posts: 472
Joined: Thu Jan 18, 2018 9:14 pm

Re: Linux OpenGL stuttering when moving character (love attached)

Post by milon »

No stutter here.

OS: Linux Mint 21 XFCE
OpenGL: renderer: Mesa Intel HD Graphics 4000 (IVB GT2) v: 4.2 Mesa 22.0.5 compat-v: 3.1
CPU: Intel Core i7-3770

My potato handles this flawlessly, but granted screen resolution is 1280x1024, lol! :D
(I did try resizing within that limit, and still no skip/stutter.)
Last edited by milon on Mon Aug 22, 2022 7:43 pm, edited 1 time in total.
Any code samples/ideas by me should be considered Public Domain (no attribution needed) license unless otherwise stated.
User avatar
GVovkiv
Party member
Posts: 670
Joined: Fri Jan 15, 2021 7:29 am

Re: Linux OpenGL stuttering when moving character (love attached)

Post by GVovkiv »

I switched to my amd specifically because of nvidia lack of development on linux
Well, that's offtopic, but i have different situation. I have RX570 with 4gb, which is happens to be amd card, and i have more problems with it. For example, i can't use Cycles in blender with that, so i can only use cpu. I can't record in obs with amd without some black magic with installing encoders/extensions/etc (while in nvidia i just choose NVENC and i'm done), and, probably, more problems with different soft that might need GPU for acceleration/etc.
Also i have problems related (probably) to drivers. For example, in some games in 1080p gpu can crash system, give me black screen, so i need to do hard reboot. (sometimes it happens even in 768p). Sometimes, heavy games can just freeze system, so, yet again, i need to reboot system. And others problems here and there. When i was on windows, there still was problems, like black screens, lags, driver crash, pc unable to go in sleep and much more.
So, meh.
Every so often it gets stuck for a little bit. This doesn't happen on your linux or on my windows.
Can you record game frametime?
Maybe at moments of stuttering something at background start doing something and cause this?
And since you on amd, can you try to use amdpro drive instead of open source? (or open source instead of amdpro)
Maybe it bug with driver?
User avatar
slime
Solid Snayke
Posts: 3132
Joined: Mon Aug 23, 2010 6:45 am
Location: Nova Scotia, Canada
Contact:

Re: Linux OpenGL stuttering when moving character (love attached)

Post by slime »

knuxyl wrote: Mon Aug 22, 2022 6:21 pm It has to be the xwayland mutter setup, that's all that is different. I hope love2d devs plan on supporting wayland, that would more than likely fix this issue.
love doesn't know about wayland versus x11 on its own. You can make sure you have a recent version of SDL and configure it to use Wayland by default (it's not enabled by default in SDL because wayland is/was still not quite ready for it I believe - there were some pretty major issues SDL ran into in various parts, although maybe most of them are fixed now).
Post Reply

Who is online

Users browsing this forum: Google [Bot] and 219 guests