[0.17.52] CPU pegged and high lag even on menu screen
Re: [0.17.52] CPU pegged and high lag even on menu screen [Linux, Xinerama]
Not using xrandr. That would be my preference, but it does not work on my setup; I forget the reason. I think it is just unsupported with the nvidia X.
- LinearJ
Re: [0.17.52] CPU pegged and high lag even on menu screen
Yes, we moved from Allegro to SDL in 0.17.
That was my thought as well, but it doesn't appear to be actually using the refresh rate anywhere in the code. Also it uses XRandR to query the refresh rate, so if that doesn't work on your setup, that would explain why Factorio can't get the refresh rate. And for what it's worth, XRandR works for me with an NVidia card – it might be worth investigating why it doesn't work for you, it might be connected to what's wrong with Factorio here.
Re: [0.17.52] CPU pegged and high lag even on menu screen
Well, xrandr, as I understand it, is going away as a protocol, so it would well-behoove you to look at more generic APIs.
A thought... can you add a variable to the configuration file for factorio that, if present, overrides the refresh rate? If so, then I could put in the value and test whether that resolves...
As for xrandr on my system,
hamilton ~ [45] /usr/bin/xrandr
RandR extension missing
hamilton ~ [46]
The nvidia driver does not support the extension. It used to, as I used to use it a lot and wrote a lot of scripts around it. Strangely, search google for nvidia "xrandr extension missing" gives almost no results and certainly no useful ones.
A thought... can you add a variable to the configuration file for factorio that, if present, overrides the refresh rate? If so, then I could put in the value and test whether that resolves...
As for xrandr on my system,
hamilton ~ [45] /usr/bin/xrandr
RandR extension missing
hamilton ~ [46]
The nvidia driver does not support the extension. It used to, as I used to use it a lot and wrote a lot of scripts around it. Strangely, search google for nvidia "xrandr extension missing" gives almost no results and certainly no useful ones.
- LinearJ
Re: [0.17.52] CPU pegged and high lag even on menu screen
Are you calling xrandr or are you using an API? If the former, then I can write a script to produce the expected output and put it ahead of the real xrandr in the PATH...
- LinearJ
Re: [0.17.52] CPU pegged and high lag even on menu screen
Aha... I looked into it and remembered the issue. I cannot use xrandr because I have multiple video cards. I have two ganged GTX 960 video cards, each driving two monitors. The RAndR extension does not work in this setup.
- LinearJ
Re: [0.17.52] CPU pegged and high lag even on menu screen
Oh, I haven't heard about that. Do you know what it's being replaced by? Unless you mean the general move away from X and toward Wayland.
We use libxrandr; we don't exec the xrandr binary.Are you calling xrandr or are you using an API? If the former, then I can write a script to produce the expected output and put it ahead of the real xrandr in the PATH...
Ah, that could be it. Are you using xinerama/TwinView, then? Could you post your Xorg.0.log and your Xorg.conf?
Re: [0.17.52] CPU pegged and high lag even on menu screen
Xinerama. Was trying to remember what the name of the thing was instead of xrandr.
I would have to look for the source again, but when I was originally configuring this desktop, I could not use xrandr and had to use xinerama. At the time, the docs I read implied that there was a general move away from xrandr and towards xinerama.
conf and log attached.
Sorry for the zip, but I could not get the browser to see the xorg.conf file, even though it is readable by me and in the same dir. Very weird.
I would have to look for the source again, but when I was originally configuring this desktop, I could not use xrandr and had to use xinerama. At the time, the docs I read implied that there was a general move away from xrandr and towards xinerama.
conf and log attached.
Sorry for the zip, but I could not get the browser to see the xorg.conf file, even though it is readable by me and in the same dir. Very weird.
- Attachments
-
- xfiles.zip
- (7.46 KiB) Downloaded 110 times
- LinearJ
Re: [0.17.52] CPU pegged and high lag even on menu screen
Found this:
https://unix.stackexchange.com/question ... riple-head
Is very scary and painful, as my experience with nvidia X is that I cannot get my current setup back just by saving and restore the xorg.conf file. But, I will try this weekend when I can afford some downtime on my system.
If I am able to switch to randr, I will let you know how factorio runs (and I will be a much happer camper, as I prefer randr).
This page implies that randr is replacing xinerama, whereas I saw the reverse when I was setting up my system a few years ago. Not sure which is true, but if the coding isn't too hard, you might consider trying both methods (i.e., test if randr is enabled, and if not, get the info from xinerama, etc).
https://unix.stackexchange.com/question ... riple-head
Is very scary and painful, as my experience with nvidia X is that I cannot get my current setup back just by saving and restore the xorg.conf file. But, I will try this weekend when I can afford some downtime on my system.
If I am able to switch to randr, I will let you know how factorio runs (and I will be a much happer camper, as I prefer randr).
This page implies that randr is replacing xinerama, whereas I saw the reverse when I was setting up my system a few years ago. Not sure which is true, but if the coding isn't too hard, you might consider trying both methods (i.e., test if randr is enabled, and if not, get the info from xinerama, etc).
- LinearJ
Re: [0.17.52] CPU pegged and high lag even on menu screen
My impression is also that Xinerama is old and XRandR is new, so XRandR would be replacing Xinerama.
Nevertheless, I think this is all a bit of a red herring. Factorio simply doesn't detect the refresh rate when you're using Xinerama, which as far as I can tell, should be completely inconsequential. I could be wrong, of course.
I'll try with a Xinerama setup and see if I can reproduce the lag that way.
Nevertheless, I think this is all a bit of a red herring. Factorio simply doesn't detect the refresh rate when you're using Xinerama, which as far as I can tell, should be completely inconsequential. I could be wrong, of course.
I'll try with a Xinerama setup and see if I can reproduce the lag that way.
Re: [0.17.52] CPU pegged and high lag even on menu screen
I am also happy to run a copy of factorio with any tracing turned on that you might have. The only thing I have done for that so far is strace, which shows the process spinning on the same sequence of calls indefinitely (see post from a couple of days ago).
- LinearJ
Re: [0.17.52] CPU pegged and high lag even on menu screen
The good news: I disabled xinerama and now xrandr appears to be working. Even better, Factorio is running just fine.
The bad news: this has trashed my multiple monitor display. I am now down to one monitor and the documentation from nvidia is just plain wrong:
http://download.nvidia.com/XFree86/Linu ... E/sli.html
I enabled SLI, rebooted, started up X, and ran nvidia-settings. I am supposed to now go to the "SLI Mosaic Mode Settings" tab on the left. There is no such tab there.
So, now I am where I am two years ago, wandering in the dark trying to get my multiple monitors working, but now trying to do it without xinerama, which at the time was the only way I could find to make it work.
But, it does show that xrandr vs xinerama is significant to factorio performance as of 0.17...
The bad news: this has trashed my multiple monitor display. I am now down to one monitor and the documentation from nvidia is just plain wrong:
http://download.nvidia.com/XFree86/Linu ... E/sli.html
I enabled SLI, rebooted, started up X, and ran nvidia-settings. I am supposed to now go to the "SLI Mosaic Mode Settings" tab on the left. There is no such tab there.
So, now I am where I am two years ago, wandering in the dark trying to get my multiple monitors working, but now trying to do it without xinerama, which at the time was the only way I could find to make it work.
But, it does show that xrandr vs xinerama is significant to factorio performance as of 0.17...
- LinearJ
Re: [0.17.52] CPU pegged and high lag even on menu screen
So, my computer was dead for most of the weekend. Could only get it working on two monitors. Finally managed to get it back into a working 4 monitor state, but had to re-enable Xinerama to do it. None of the links I found earlier helped.
So, I am back where I started: working 4 monitor setup with Xinerama, Factorio eating 100% of CPU and unplayable due to lag.
So, I am back where I started: working 4 monitor setup with Xinerama, Factorio eating 100% of CPU and unplayable due to lag.
- LinearJ
Re: [0.17.52] CPU pegged and high lag even on menu screen
Any news? I am still dead in the water on my desktop.
If I disable Xinerama, then Factorio works fine, but I only get two monitors. To see all four, I need to enable Xinerama, but then Factorio uses 100% CPU and is slow to respond.
Tried everything I could find online about configuring nvidia, but if I disable Xinerama, then it only sees the two monitors on one of my video cards. Tried enablng SLI (I have the bridge connected and the cards in the right slots for it) but no dice.
I would much rather that my set up used randr instead of xinerama, but there does not seem to be a way to make that work and see all of the monitors.
So my options are:
* Only use two monitors; not acceptable.
* Use four monitors, but only play Factorio 0.16, which has always worked. Fortunately, 0.16 is a great game, but I really want to play 0.17
* Only play Factorio 0.17 on my laptop. Also not good, as laptop horsepower is limited. It runs fine, but as the base gets big, I hit the limits of laptop performance. My large 0.17 base on my laptop is still far outperforming the 0.17 main menu on the desktop though...
If I disable Xinerama, then Factorio works fine, but I only get two monitors. To see all four, I need to enable Xinerama, but then Factorio uses 100% CPU and is slow to respond.
Tried everything I could find online about configuring nvidia, but if I disable Xinerama, then it only sees the two monitors on one of my video cards. Tried enablng SLI (I have the bridge connected and the cards in the right slots for it) but no dice.
I would much rather that my set up used randr instead of xinerama, but there does not seem to be a way to make that work and see all of the monitors.
So my options are:
* Only use two monitors; not acceptable.
* Use four monitors, but only play Factorio 0.16, which has always worked. Fortunately, 0.16 is a great game, but I really want to play 0.17
* Only play Factorio 0.17 on my laptop. Also not good, as laptop horsepower is limited. It runs fine, but as the base gets big, I hit the limits of laptop performance. My large 0.17 base on my laptop is still far outperforming the 0.17 main menu on the desktop though...
- LinearJ
Re: [0.17.52] CPU pegged and high lag even on menu screen
Well, the news is twofold. The good part is that I have been able to reproduce it on my machine if I switch to Xinerama. The bad part is that 97% of the CPU time is spent inside the NVidia driver, which means that there probably isn't anything I can do. This sounds like a performance issue with the NVidia driver itself.
Re: [0.17.52] CPU pegged and high lag even on menu screen
I wonder ... does setting ogl-accelerated-renderer=true in config.ini or setting environment variable SDL_VIDEO_X11_NET_WM_BYPASS_COMPOSITOR=0 make any difference?
Re: [0.17.52] CPU pegged and high lag even on menu screen
Odd that it only spins CPU in the nvidia driver when using xinerama. Same driver works fine without xinerama.
Will test the ogl / SDL settings tonight.
It would be great if there is a setting that would allow this to run with xinerama. Seems like there should be since the same driver works without it.
Having said that, I'd still like to get rid of xinerama and go back to randr. I tried most of the past weekend, but without xinerama, nvidia would not see any of the monitors plugged into the second card.
Will test the ogl / SDL settings tonight.
It would be great if there is a setting that would allow this to run with xinerama. Seems like there should be since the same driver works without it.
Having said that, I'd still like to get rid of xinerama and go back to randr. I tried most of the past weekend, but without xinerama, nvidia would not see any of the monitors plugged into the second card.
- LinearJ
Re: [0.17.52] CPU pegged and high lag even on menu screen
P.S., I was using the 410.78 nvidia driver. As part of trying to get randr working this past weekend, I upgraded to 430.26 and the issue is there as well.
If it is indeed a performance issue in the driver, it has been there for a while and is still there.
If it is indeed a performance issue in the driver, it has been there for a while and is still there.
- LinearJ
Re: [0.17.52] CPU pegged and high lag even on menu screen
I should have also noted that "ogl-accelerated-renderer" setting was added to config.ini in 0.17.54, so you'll have to update (it won't do anything on 0.17.52)
Re: [0.17.52] CPU pegged and high lag even on menu screen
Sorry... forgot to post results last night.
Firstly, no worries: I always upgrade to latest/greatest, so I was on .55 before trying the suggestions, anyway .
Bad news, good news and bad news.
Bad news: making the changes had no effect.
Good news: I searched for "nvidia xinerama performance issues" and found some more pages on how to get nvidia working without xinerama and was finally successful at accessing my monitors on the second card without xinerama.
Bad news: Apparently there is a three monitor limit hardcoded into the non-xinerama code. Seems silly as the same setup works fine (except for that performance issue) with 4 monitors with xinerama. Possibly the issue is that there is no hw acceleration when using four monitors because the GPUs cannot handle it. But, that also does not make sense as this system dual boots to windows, where all of my windows games (including my steam copy of factorio) run just fine. Unfortunately, I prefer to run Factorio under Linux as I can play while I am working on my code, and I prefer running Linux 2x2 instead of just 3 monitors, especially if I am coding/building while playing Factorio.
I'd open a support case with nvidia, but since their configuration tool specifically pops up an error message, "error, more than 3 displays are configured" (or some such), I don't think I am likely to get very far.
Many thanks for your help. I still hold out hope that you guys will find a setting that allows this to work with xinerama, but I understand that I am an edge case and this will take more horsepower than results will justify. If you do happen to find something, though, please let me know!
Firstly, no worries: I always upgrade to latest/greatest, so I was on .55 before trying the suggestions, anyway .
Bad news, good news and bad news.
Bad news: making the changes had no effect.
Good news: I searched for "nvidia xinerama performance issues" and found some more pages on how to get nvidia working without xinerama and was finally successful at accessing my monitors on the second card without xinerama.
Bad news: Apparently there is a three monitor limit hardcoded into the non-xinerama code. Seems silly as the same setup works fine (except for that performance issue) with 4 monitors with xinerama. Possibly the issue is that there is no hw acceleration when using four monitors because the GPUs cannot handle it. But, that also does not make sense as this system dual boots to windows, where all of my windows games (including my steam copy of factorio) run just fine. Unfortunately, I prefer to run Factorio under Linux as I can play while I am working on my code, and I prefer running Linux 2x2 instead of just 3 monitors, especially if I am coding/building while playing Factorio.
I'd open a support case with nvidia, but since their configuration tool specifically pops up an error message, "error, more than 3 displays are configured" (or some such), I don't think I am likely to get very far.
Many thanks for your help. I still hold out hope that you guys will find a setting that allows this to work with xinerama, but I understand that I am an edge case and this will take more horsepower than results will justify. If you do happen to find something, though, please let me know!
- LinearJ
Re: [0.17.52] CPU pegged and high lag even on menu screen
Have you reported this to Nvidia? I realize that their priorities are closer to CS:GO and PUBG on a single monitor, but since you bought their product they should either support it themselves or make it possible for others to support it.