[Partial solutions] Preserving aspect ratio for full-screen programs that change resolution on an external monitor?

Forum rules
Before you post read how to get help. Topics in this forum are automatically closed 6 months after creation.
Locked
User avatar
NM64
Level 4
Level 4
Posts: 241
Joined: Sat Feb 04, 2017 11:34 pm

[Partial solutions] Preserving aspect ratio for full-screen programs that change resolution on an external monitor?

Post by NM64 »

Relevant issue that was closed over 2 years ago yet still exists according to my own testing:
REMINDER: This is specifically with regards to external displays, not internal laptop or tablet displays (on such internal displays, the xrandr method will "just work" even on Intel graphics). Furthermore, some external displays, primarily TVs (but some monitors as well), have their own built-in aspect ratio control which negates the need for GPU-based aspect ratio preservation (same goes for if you're using a CRT which needs no scaling at all).


UPDATE 2: If you're on Intel graphics (it works on AMD as well, but simply using the xrandr method below has much better compatibility unless you specifically want to use AMD FSR scaling), then the best solution may be to use Gamescope since, when you set Gamescope itself to fullscreen, it basically forces your desired program to run in "borderless window" style of fullscreen scaled up to your current desktop resolution with the aspect ratio preserved.


Running software through gamescope is simple enough by just doing the following:

Code: Select all

gamescope [insert terminal arguments HERE] -- [insert normal terminal commands to launch whatever program HERE]
So to run True Remembrance in fullscreen through Gamescope, I used the following (ran from the same folder that "true.exe" is located in):

Code: Select all

gamescope -f -- wine true.exe
Also, as of Lutris v0.5.9, if you have Gamescope already installed and you have the advanced options enabled in Lutris, then it'll expose a new option to "Enable Gamescope" if you prefer launching your games through Lutris instead.


Do note however that Gamescope is not perfect and (currently) may have difficulty with auto-hidden menus and the like such as used by True Remembrance. Furthermore, on Mint 20.3 Cinnamon, it seemed to only have like a 50% chance of even launching the software at all (if it failed to launch, I simply just had to try again until it worked).


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


UPDATE: The "easy" solution is to just not use Intel graphics.

On AMD graphics you can just use the following xrandr argument and everything will "just work" (if it's an older AMD GPU, you may or may not have garbled graphics if the width is the same as your monitor however, e.g. running 1280x720 on a 1280x1024 monitor):

Code: Select all

--set "scaling mode" "Full aspect"

And, on Nvidia, this function is apparently something built into their proprietary drivers:

So on my AMD A8-7600 test desktop connected to a 1280x1024 DVI monitor, I was able to use something like the following (replace DVI-0 with whatever xrandr and/or "Display" on Cinnamon lists your current output as):

Code: Select all

xrandr --output DVI-0 --set "scaling mode" "Full aspect"

Then after that, if I change my resolution to anything else whether in the "Display" application or via xrandr even without specifying a "scalling mode", it'd automatically remember to preserve the aspect ratio. The same also goes for if you run a program or game that wants to change your output desktop resolution - even then it'll still remember to preserve the aspect ratio. This even works for custom resolution greater than you monitor, effectively allowing for an easy way to run games with "downsampling" or super-sample anti-aliasing.


Just be aware that, at this time, xrandr's --set "scaling mode" seems to be limited to outputting at your monitor's first-listed EDID refresh which is commonly 60Hz on even higher-refreshing monitors despite the OS claiming to be running at a higher refresh rate, so you may want to keep it disabled by default and instead use a bash script to launch a given program to enable --set "scaling mode" and then have it disable when the program is closed and then subsequently be sure to set your refresh rate back to whatever greater-than-60Hz refresh you'd normally run at.


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


I'm using LM 20.3

I'm trying to run older software that I want to run in 640x480 and/or 800x600 in fullscreen, but my DVI-connected monitor is not 4:3. And, like many DVI monitors, the built-in scaling options on my monitor are basically non-existent and it always just stretches the displayed resolution across the entire screen without preserving the source aspect ratio (In fact, this occurs even if I just change my desktop resolution through the display options in Mint itself).

Running the software in a window is possible but a less-than-ideal solution (not to mention that a 640x480 window is quite small).

For reference, on Windows since the XP days, I could just use "GPU scaling" (even on Intel integrated graphics) to achieve the result I'm looking for, but I don't know if something like that even exists on Linux or if there's some other, non-GPU-based solution (e.g. xrandr, WINE, etc) that would similarly achieve the desired result.


(speaking of xrandr, the part about an external monitor is because I read some stuff about preserving aspect ratios via xrandr that only works on laptops and not desktop monitors)

EDIT: I'm using Intel Haswell aka 4th gen integrated graphics.
Last edited by LockBot on Wed Dec 28, 2022 7:16 am, edited 52 times in total.
Reason: Topic automatically closed 6 months after creation. New replies are no longer allowed.
User avatar
SMG
Level 25
Level 25
Posts: 31333
Joined: Sun Jul 26, 2020 6:15 pm
Location: USA

Re: How do I preserve the aspect ratio for full-screen programs that change my resolution on a desktop monitor?

Post by SMG »

NM64 wrote: Wed Jan 26, 2022 12:38 am(speaking of xrandr, the part about an external monitor is because I read some stuff about preserving aspect ratios via xrandr that only works on laptops and not desktop monitors)
Is the first answer in this GPU Scaling on Linux - Stretched/Black Bars what you are referencing that you said did not work?

You have not provided information about your graphics, but if you have Nvidia, you can check this How to enable GPU scaling in Linux.
Image
A woman typing on a laptop with LM20.3 Cinnamon.
User avatar
NM64
Level 4
Level 4
Posts: 241
Joined: Sat Feb 04, 2017 11:34 pm

Re: How do I preserve the aspect ratio for full-screen programs that change my resolution on a desktop monitor?

Post by NM64 »

SMG wrote: Sun Jan 30, 2022 8:48 pmYou have not provided information about your graphics
Oh oops, I alluded to Intel integrated but didn't actual say that it was what I was using (Haswell aka 4th gen Intel integrated to be specific).

I find Nvidia GPUs to be way too much of a hassle for a Linux beginner like myself and much prefer the "it just works" support via mesa that AMD and Intel graphics provide, especially since I'm someone that also likes to move one OS installation between multiple hardware without reinstalling the OS (blasphemy, I know) - something that seems to also "just work" as long as you stick with AMD and/or Intel graphics.

SMG wrote: Sun Jan 30, 2022 8:48 pmIs the first answer in this GPU Scaling on Linux - Stretched/Black Bars what you are referencing that you said did not work?
Basically yes, and that reddit post is actually specifically why I mentioned that my monitor, like many other bog-standard office-style DVI monitors, does not include any scaling options within the monitor's own on-screen display.

But I had also found the same information about scaling modes on the archwiki, and it even includes a reference link to a years-old discussion on the freedesktop git about it only being enabled for laptop displays and not external displays that unfortunately doesn't seem to have actually gone anywhere development-wise and the issue was eventually closed two years ago.
User avatar
SMG
Level 25
Level 25
Posts: 31333
Joined: Sun Jul 26, 2020 6:15 pm
Location: USA

Re: How do I preserve the aspect ratio for full-screen programs that change my resolution on a desktop monitor?

Post by SMG »

I was not able to find any info with regards to GPU scaling for Intel on Linux-based distros. The only info for changes was the type of info I have already passed along.

I do not know what software you are wanting to run, but if it is something that might be game-based, the only thing which comes to mind which might help is RetroPie. A while back someone had some questions on that so there is a bit of discussion and links in this topic App kills hdmi audio then video after reboot.

I do not know if that or a similar emulator might address the issue you want to solve.
Image
A woman typing on a laptop with LM20.3 Cinnamon.
User avatar
NM64
Level 4
Level 4
Posts: 241
Joined: Sat Feb 04, 2017 11:34 pm

Re: How do I preserve the aspect ratio for full-screen programs that change my resolution on a desktop monitor?

Post by NM64 »

SMG wrote: Tue Feb 01, 2022 7:41 pmI do not know what software you are wanting to run, but if it is something that might be game-based, the only thing which comes to mind which might help is RetroPie.
It's not one specific program but rather a whole slew of programs. Basically I'm a fan of visual novels more-so than anime, and a lot of quality VNs from the 2000s ran at either 640x480 or 800x600 in exclusive fullscreen (they can run in windowed as well, but the "borderless window" style of fullscreen wasn't really a thing yet). Furthermore, being heavily text-based means that running them in a window is sub-optimal as that would similarly make the text small.

Since my monitor seems to handle weird non-standard custom resolutions just fine, I've kind of figured out some work-arounds running these VNs in windowed mode and my monitor running a custom resolution that is of the same aspect ratio as its native resolution (so on a 1440x900 monitor, you'd run a custom resolution of 768x480 when running a 640x480 VN), but that itself has revealed a couple of issues with cropped windows (XFCE) and panels not hiding (Cinnamon) that I plan on making separate threads about.

Oh and for reference, these are 32bit x86 programs typically designed for Windows XP to Windows 7. If you want an actual downloadable example of such a VN, the following is a small (67MB) freely available 640x480 VN that seems to "just work" in WINE v7.x (click "get" from the header bar for the actual download):
I also asked the resident Linux-guru member of the Fate/stay night Ultimate Edition fan-patch/translation project that I help out with (Fate/stay night originally being one such 800x600 visual novel from the mid-2000s), but his response was kind of over my head as his Linux skills are on a whole 'nother level and I've no idea if it's even applicable to Mint:
resident Linux guru from the Fate/stay night Ultimate Edition fan patch/translation wrote: For my purposes, I just use Xvnc to start up a separate X server that can be connected to via VNC, then I just scale the window with Compiz scale plugin.
 

Amusingly, I do actually run a dual-monitor configuration with both an LCD and a CRT, and this whole "issue" with fullscreen changing the output resolution is actually the ideal method for handling fullscreen on a CRT... but that's only an option for me during winter, not summer (my CRT lives in my bedroom, but I move my PC and LCD to the guest bedroom in summer and leave the CRT disconnected in order to reduce heat output as a dew point as high as 20c is not uncommon in summer even at night).
Last edited by NM64 on Tue Apr 05, 2022 4:39 pm, edited 1 time in total.
User avatar
SMG
Level 25
Level 25
Posts: 31333
Joined: Sun Jul 26, 2020 6:15 pm
Location: USA

Re: How do I preserve the aspect ratio for full-screen programs that change my resolution on a desktop monitor?

Post by SMG »

NM64 wrote: Wed Feb 02, 2022 12:08 amI also asked the resident Linux-guru member of the Fate/stay night Ultimate Edition fan-patch/translation project that I help out with (Fate/stay night originally being one such 800x600 visual novel from the mid-2000s), but his response was kind of over my head as his Linux skills are on a whole 'nother level and I've no idea if it's even applicable to Mint:
resident Linux guru from the Fate/stay night Ultimate Edition fan patch/translation wrote: For my purposes, I just use Xvnc to start up a separate X server that can be connected to via VNC, then I just scale the window with Compiz scale plugin.
X Server runs the graphics and other user interfaces on Linux Mint. It works in conjunction with xrandr. The link you provided earlier about information about scaling modes on the archwiki uses xrandr to set the size.

I am familiar with VNC being used to remote into a computer. It's basically an app whereby one connects and controls a second computer. You could think of it as a window where you are viewing what is going on with the other computer as you remotely control the other computer.

I do not know if the guru is remoting in from another computer or just, in essence, remotely connecting into their own computer (in a type of loopback situation?) and using the Xvnc application to do it. Then they I guess they are setting up the Xvnc window size with the Compiz scale plugin.

This is a graphic of Xvnc. This is a definition of xvnc(1) - Linux man page.

While Linux Mint does not normally run more than one X Server at a time, I am guessing because the guru is running the second X Server inside of the Xvnc app that it is running separately from the one which runs in Linux Mint. Or if they are remoting in from a second computer then it does not matter because each computer would be using its own instance of X Server.

Okay, that was a lot of guesses and conjecture on my part so I don't know if it helped or not. This is the first time I've ever heard of a visual novel and you probably have already done searches, but sometimes I find things others do not so I will pass along this link [tutorial] How to run any visual novel on Linux (pretty much) in case it might help.
Image
A woman typing on a laptop with LM20.3 Cinnamon.
User avatar
NM64
Level 4
Level 4
Posts: 241
Joined: Sat Feb 04, 2017 11:34 pm

Re: How do I preserve the aspect ratio for full-screen programs that change my resolution on a desktop monitor?

Post by NM64 »

SMG wrote: Wed Feb 02, 2022 10:09 pmThis is the first time I've ever heard of a visual novel
A good chunk of anime were originally visual novels such as the already-mentioned Fate/stay night, and Clannad is one which was mentioned in the Reddit post. Another, more modern example would be Steins;Gate.

SMG wrote: Wed Feb 02, 2022 10:09 pmI will pass along this link [tutorial] How to run any visual novel on Linux (pretty much) in case it might help.
AFAICT that's about actually getting the software running correctly rather than anything with the display, such as with regards to Japanese font (something you had to do even on Windows - e.g. the "language for non-unicode programs") - in particular, notice how all of the screenshots are running in windowed mode. Furthermore, the suggestion of using a virtual desktop if you're having issues with fullscreen simply results in WINE just forcing the program to run in a window.

Also AFAICT Vulkan was already installed in Mint 20.3 as I was able to use other non-WINE native-Linux programs that use Vulkan without issue.

I mean, this display ratio issue isn't something exclusive to visual novels, it's just that they were probably the newest examples of software that weren't natively widescreen and only had a set resolution while still being new enough that DosBox isn't necessarily an option - I mean, if you go back to the late 90s and early 2000s you'll also find more familiar PC game examples that work this way, e.g. the original PC releases of Myst, Riven, Hydro Thunder, etc.

That being said, Lutris was not something I had tried, and I just spent a few hours fiddling with it after seeing that it includes AMD's FSR which, when ran at the driver level on Windows, will work just like GPU scaling except with a better quality result. However, it doesn't seem to work on my Haswell iGPU, but it turns out it's not necessary to do what I'm trying to achieve since there's a special version of WINE intended to be used with Lutris called "fshack" that pretty much does exactly what I want to do:
https://github.com/lutris/docs/blob/master/WineBuilds.md wrote:Same as lutris, but includes fshack, a software implementation of monitor modesetting (resolution changing), ported over from Proton. With it, your whole monitor will no longer modeset to a lower resolution if the game requests it, instead Wine itself will do it and only do it for the game itself.
...erm, well, at least it tries to do what I want.

Exhibit A using the freely-available Fate/stay night trial (non-torrent download mirror) which natively runs at 800x600 (requires the Japanese locale UTF-8 thing mentioned in the reddit post):
(Both links should be automatically deleted in around a year; btw I tried attaching them but the forum complained they were too large despite only being 347KB? Or maybe it's the 960px width that's the issue?)


I ran with a custom resolution of 960x600 just to keep the screenshot size down, but the exact same thing happens with the native 1440x900 resolution of the monitor I'm testing with. And, as can be seen in the second screenshot, where the program thinks my mouse cursor is located is not the actual location of my mouse cursor (notice how "Ctrl" is highlighted more than any other button, and the tooltip even specifically mentions "Control" since it thinks I'm hovering my cursor over the "Ctrl" button).

These exact issues as well as other mis-alignment issues happened with many other VNs I tested with, including True Remembrance (though, after an alt-tab, it seemed to improve but was still not centered - that trick didn't work for Fate/stay night though and, for other VNs, it sometimes made things worse).

Oh, and the bottom panel was still visible too despite clearly being set to fullscreen (this occurred in both Cinnamon and XFCE).

Lastly, one of the weirdest issues occurred with a 1280x1024 monitor I was separately testing with as well (this was not in a dual-monitor configuration) - on Cinnamon, True Remembrance has a mis-aligned mouse cursor when running a custom output resolution of 640x512, but at the monitor's native 1280x1024 the mouse cursor was perfect... yet on XFCE it was the exact opposite - the mouse cursor was perfect at 640x512, but was mis-aligned when running at 1280x1024.

And to clarify, these aren't just general WINE issues because running them with my desktop resolution at the VN's native 800x600 or 640x480 did not produce any of these issues (the VN's generally "just worked"), even when ran through Lutris... but of course, then you get the infamous stretched fullscreen issue again.
Last edited by NM64 on Tue Apr 05, 2022 4:42 pm, edited 1 time in total.
User avatar
SMG
Level 25
Level 25
Posts: 31333
Joined: Sun Jul 26, 2020 6:15 pm
Location: USA

Re: How do I preserve the aspect ratio for full-screen programs that change my resolution on a desktop monitor?

Post by SMG »

NM64 wrote: Fri Feb 04, 2022 3:40 amI mean, if you go back to the late 90s and early 2000s you'll also find more familiar PC game examples that work this way, e.g. the original PC releases of Myst, Riven, Hydro Thunder, etc.
I've never been a gamer and I have not used WINE, so I'm unlikely to be able to provide more help.
NM64 wrote: Fri Feb 04, 2022 3:40 amExhibit A using the freely-available Fate/stay night trial (non-torrent download mirror) which natively runs at 800x600 (requires the Japanese locale UTF-8 thing mentioned in the reddit post):
And, as can be seen in the second screenshot, where the program thinks my mouse cursor is located is not the actual location of my mouse cursor (notice how "Ctrl" is highlighted more than any other button, and the tooltip even specifically mentions "Control" since it thinks I'm hovering my cursor over the "Ctrl" button).
The second image reminds me of how some people have found their touchscreen cursor does not correlate with where one is touching. Sometimes in those cases a xrandr setting change can fix them, but I do not know if that type of fix might have any relation to what you are experiencing.
NM64 wrote: Fri Feb 04, 2022 3:40 amI tried attaching them but the forum complained they were too large despite only being 347KB?
I believe the max size is 200KB.
NM64 wrote: Fri Feb 04, 2022 3:40 amLastly, one of the weirdest issues occurred with a 1280x1024 monitor I was separately testing with as well (this was not in a dual-monitor configuration) - on Cinnamon, True Remembrance has a mis-aligned mouse cursor when running a custom output resolution of 640x512, but at the monitor's native 1280x1024 the mouse cursor was perfect... yet on XFCE it was the exact opposite - the mouse cursor was perfect at 640x512, but was mis-aligned when running at 1280x1024.
Cinnamon and Xfce use different windows managers and compositors. Perhaps that plays a role.
Image
A woman typing on a laptop with LM20.3 Cinnamon.
User avatar
NM64
Level 4
Level 4
Posts: 241
Joined: Sat Feb 04, 2017 11:34 pm

Re: How do I preserve the aspect ratio for full-screen programs that change my resolution on a desktop monitor?

Post by NM64 »

SMG wrote: Fri Feb 04, 2022 5:09 pmI've never been a gamer and I have not used WINE
Despite myself being a gamer (though my tendency towards more arcade style makes me more of a retro gamer perhaps?), I'm one of those people that actually associates VNs more with manga and ebooks, and especially manga ebooks and prefer my VNs to be heavy on story and lacking on gameplay (and prefer the exact opposite from my videos games).

SMG wrote: Fri Feb 04, 2022 5:09 pm so I'm unlikely to be able to provide more help
This issue is still something that occurs even outside of games since all you have to do is simply change your desktop resolution in any manner (e.g. whether via xrandr or via the "Display" application) to one with an aspect ratio that does not match your display (e.g. 1024x768 on a widescreen monitor) and you'll instantly see the problem. This similarly mirrors the behavior on Windows if you're running your GPU drivers without their according control panel installed (e.g. just directly installing the .inf file via Windows' device manager).



EDIT: I humored myself and tried the --set "scaling mode" "Full aspect" xrandr command line argument on an AMD A8-7600 desktop I had laying around that I use as a sort of test PC and, sure enough, everything "just worked" (well, mostly - if I use the "preserve aspect" combined with a 1280x720 resolution on a 1280x1024 monitor, the output is somewhat garbled but taking a screenshot produces un-garbled screenshots; this "garbled output" occurred with 1280x960 on the same 1280x1024 monitor as well, but I don't know of any VN that uses a 1280px width that doesn't also support borderless fullscreen at 1280x1024 so it'd be a non-issue anyway for me).

So yeah, I guess the moral of the story here is "don't use Intel." :P Now if only I had a Zen-based AMD system so that I could enjoy the same single-threaded CPU performance and efficiency benefits that I get with my dual core Haswell system.

(the only thing is, getting OpenCL with image support is a bajillion times easier on Intel graphics than AMD graphics and, despite being older, Haswell actually has better Vulkan support than Kaveri, but that's besides the point of this thread)

I did still run into a minor issue where some VNs when ran in fullscreen, such as True Remembrance, will still have the bottom panel (which doesn't occur on Windows), but that's for another thread where I'll post screenshots and such, including those of another VN where this only occurs on Cinnamon but not on XFCE.



EDIT 2: Oh so, as mentioned in the freedesktop issue tracker, I guess this means that it is in fact still an issue on Intel graphics? Unless it's something implemented only on newer Intel GPUs (e.g. 5th gen Broadwell and newer) since I know that those use a different graphics stack on Linux. I'll have to ask my "Linux guru friend" if he's could quickly test that out if he does in fact have something with Intel graphics newer than Haswell.

For reference, the issue still occurs even on a daily build of Xubuntu 22.04 built on 2022-02-05 despite definitely coming with a newer version of xrandr (I forgot to check the exact version but, unlike the older version in Mint 20.3, the version in Xubuntu 22.04 @ 2022-02-05 let me set the "--filter nearest" argument).
Last edited by NM64 on Tue Apr 05, 2022 4:49 pm, edited 2 times in total.
User avatar
SMG
Level 25
Level 25
Posts: 31333
Joined: Sun Jul 26, 2020 6:15 pm
Location: USA

Re: How do I preserve the aspect ratio for full-screen programs that change my resolution on a desktop monitor?

Post by SMG »

NM64 wrote: Fri Feb 04, 2022 5:54 pmThis issue is still something that occurs even outside of games since all you have to do is simply change your desktop resolution in any manner (e.g. whether via xrandr or via the "Display" application) to one with an aspect ratio that does not match your display (e.g. 1024x768 on a widescreen monitor) and you'll instantly see the problem.
I have a 13" laptop with Sandy Bridge (2nd-gen) Intel graphics which is 1366x768 (16:9). In the Display app I changed to 1024x768 (4:3) and it put black bars on either side of the screen with the content in the center. Nothing was stretched. Was there something else I was supposed to do to test this?

(I'm running LM20.3 Cinnamon with all the Effects turned off.)
Image
A woman typing on a laptop with LM20.3 Cinnamon.
User avatar
NM64
Level 4
Level 4
Posts: 241
Joined: Sat Feb 04, 2017 11:34 pm

Re: How do I preserve the aspect ratio for full-screen programs that change my resolution on a desktop monitor?

Post by NM64 »

SMG wrote: Sat Feb 05, 2022 1:52 pmWas there something else I was supposed to do to test this?
Yes, you were supposed to try that with an external monitor. :P

The whole point of the "bug" is that, for whatever reason, this function is only supported on embedded displays (which gets a bit odd when considering the likes of embedded DisplayPort and external DisplayPort use the same signaling...)

Keep in mind that TVs almost always have their own aspect ratio settings, so a "dumb" monitor with no aspect ratio settings is the easiest way to test this. Either that or, if/when you change the output resolution to something like 1024x768, that the monitor/TV's own on-screen display still claims that it's receiving a higher-resolution signal (e.g. you want it so that a 1080p display is showing that the input signal is 1080p despite Mint being set to 1024x768 and the end result size-wise actually looking like 1024x768)

(BTW it'd be best to additionally test with 800x600 and not only 1024x768 since many HDTVs use 1366x768 panels and 1024x768 being the same height may or may not give different results)
Last edited by NM64 on Sat Feb 05, 2022 4:36 pm, edited 3 times in total.
User avatar
SMG
Level 25
Level 25
Posts: 31333
Joined: Sun Jul 26, 2020 6:15 pm
Location: USA

Re: How do I preserve the aspect ratio for full-screen programs that change my resolution on a desktop monitor?

Post by SMG »

NM64 wrote: Sat Feb 05, 2022 4:19 pmYes, you were supposed to try that with an external monitor. :P
I don't currently have access to one.
NM64 wrote: Sat Feb 05, 2022 4:19 pmThe whole point of the "bug" is that, for whatever reason, this function is only supported on embedded displays (which gets a bit odd when considering the likes of embedded DisplayPort and external DisplayPort use the same signaling...)
Oh, that's what you meant by it working on laptops. I didn't realize that. Not all laptops (or all-in-one PCs) are eDP. Some, such as mine, are LVDS.
Image
A woman typing on a laptop with LM20.3 Cinnamon.
User avatar
NM64
Level 4
Level 4
Posts: 241
Joined: Sat Feb 04, 2017 11:34 pm

Re: How do I preserve the aspect ratio for full-screen programs that change my resolution on a desktop monitor?

Post by NM64 »

SMG wrote: Sat Feb 05, 2022 4:35 pmI don't currently have access to one.
Not even an HDTV? :(

AFAIK you don't need to use a desktop PC to test this and it'll happen even with externally-connected displays on laptops.
User avatar
SMG
Level 25
Level 25
Posts: 31333
Joined: Sun Jul 26, 2020 6:15 pm
Location: USA

Re: [Easy, don't use Intel] Preserving aspect ratio for full-screen programs that change my resolution on a desktop moni

Post by SMG »

NM64 wrote: Sat Feb 05, 2022 4:37 pmNot even an HDTV? :(

AFAIK you don't need to use a desktop PC to test this and it'll happen even with externally-connected displays on laptops.
Nope. It's been ~15 years since I owned a TV and even longer than that since I've had an external monitor of any type.

I've thought about getting a monitor given how much I help others with theirs, but my current abode is rather space limited so I just make do with my two laptops (the other is a 1400x900 14" with a dedicated Nvidia GPU).
Image
A woman typing on a laptop with LM20.3 Cinnamon.
User avatar
NM64
Level 4
Level 4
Posts: 241
Joined: Sat Feb 04, 2017 11:34 pm

Re: [Easy: don't use Intel] Preserving aspect ratio for full-screen programs that change resolution on an external monit

Post by NM64 »

As I was reminded by the recent Steam Deck (p?)reviews, it turns out that Gamescope supports Intel hardware as of mid-2021, and it seems to work pretty well - it's not perfect though, but it seems to work well enough for my use-case?

Interestingly, Gamescope actually has better behavior in terms of the bottom panel being hidden in fullscreen - there were applications (e.g. True Remembrance) where, when ran without Gamescape but still in fullscreen, the bottom panel would not hide.


The four issues I came across that make it not perfect are:
  1. whenever running software through Gamescope, it (currently?) only has maybe a 50% chance of actually launching on Mint 20.3. If it fails to launch, one simply needs to just try to launch it again until it does launch.
  2. performance in some situations seems noticably worse, e.g. the fade transitions used by True Remembrance. However, setting a custom resolution on my monitor so that Gamescope is only adding black bars and is not doing any upscaling seems to substantially help (I imagine that me using what is possibly the second weakest Vulkan-capable GPU ever made probably doesn't help)
  3. VNs that use an auto-hiding pop-up menu for File and the like in fullscreen (such as, once again, True Remembrance) causes really borky behavior, like it'll focus in on only that part of the screen and zoom in really big and you practically have to use the keyboard to navigate, and that's assuming you even manage to get the menu to stay visible and not "soft lock" you out of even exiting
  4. Some software that would "just work" in WINE by itself (e.g. Touhou 7 and Touhou 8) do not seem to work at all through Gamescope (Touhou 7 in particular, if launched with Gamescope set to fullscreen, can result in a soft-lock).
Also one "half' issue is that the Ever17 Trial needed to be ran in windowed but with Gamescope set to fullscreen in order to get it to even launch (but the end result was fullscreen that worked better than normal fullscreen without Gamescope as this is one VN that the Cinnamon panel would always be visible, but with Gamescope it is not)


All in all, it's... progress. I'm a bit more forgiving towards this than the lack of the xrandr --set "scaling mode" argument since Gamescope is such relatively young software, and it's almost certainly bound to see heavy development going forwards as it seems to be one of the primary pieces of software on the Steam Deck and presumably SteamOS 3.0.

I mean, it's young enough that there isn't even really an "official" way to install the stand-alone version of it - I had to install the following unofficial PPA which, for all I know, could have been the cause of several of my issues (I imagine randomly installing 3rd party PPA's isn't exactly the wisest idea! This is all on a test OS installation though so it's not a big deal if I need to re-format): Also there's the fact that Haswell has incomplete Vulkan support, so who knows if that could also be causing some of the aforementioned issues...
Last edited by NM64 on Tue Apr 05, 2022 4:55 pm, edited 3 times in total.
User avatar
SMG
Level 25
Level 25
Posts: 31333
Joined: Sun Jul 26, 2020 6:15 pm
Location: USA

Re: [Easy: don't use Intel] Preserving aspect ratio for full-screen programs that change resolution on an external monit

Post by SMG »

NM64 wrote: Wed Feb 09, 2022 11:38 pmI mean, it's young enough that there isn't even really an "official" way to install the stand-alone version of it - I had to install the following unofficial PPA which, for all I know, could have been the cause of several of my issues (I imagine randomly installing 3rd party PPA's isn't exactly the wisest idea! This is all on a test OS installation though so it's not a big deal if I need to re-format):
Do you use Timeshift snapshots? I would think this type of experimenting would be ideal for using it. You could have multiple snapshots and switch between them if you wanted to go back and test something you learned by installing a different program. For example you would have a snapshot of your system before anything special was installed, then take a snapshot after installing the first program. Roll back to the before-anything-special-was-installed snapshot and install the second program then take a new snapshot. As long as you have the drive space, you could have multiple different scenarios on snapshots for doing comparisons and testing. Timeshift has a description column where you can mark what you have on each snapshot.
Image
A woman typing on a laptop with LM20.3 Cinnamon.
User avatar
Valsodar
Level 4
Level 4
Posts: 364
Joined: Thu Jul 19, 2018 11:30 pm
Location: Sofia, Bulgaria
Contact:

Re: [Partial solutions] Preserving aspect ratio for full-screen programs that change resolution on an external monitor?

Post by Valsodar »

Hi. I "followed" you here from my topic in the Wine forum about aspect ratios. I tried running NFS Underground 2 with your method but I got this error and the game wouldn't start:

Code: Select all

[rado@arch]: /media/1000GB/GAMES_1000/NFS U2>$ gamescope -f -- wine speed2.exe
No CAP_SYS_NICE, falling back to regular-priority compute and threads.
Performance will be affected.
wlserver: [backend/headless/backend.c:82] Creating headless backend
vulkan: selecting physical device 'NVIDIA GeForce GTX 1660 Ti': queue family 2
vulkan: physical device supports DRM format modifiers
vulkan: vkGetPhysicalDeviceFormatProperties2 returned zero modifiers for DRM format 0x3231564E (VkResult: 0)
vulkan: supported DRM formats for sampling usage:
vulkan:   0x34325241
vulkan:   0x34325258
wlserver: Running compositor on wayland display 'gamescope-0'
wlserver: [backend/headless/backend.c:18] Starting headless backend
wlserver: [xwayland/sockets.c:63] Failed to bind socket @/tmp/.X11-unix/X0: Address already in use
wlserver: [xwayland/server.c:92] Starting Xwayland on :1
wlserver: [types/wlr_surface.c:748] New wlr_surface 0x55cf2cdb62e0 (res 0x55cf2cdac420)
wlserver: [xwayland/server.c:250] Xserver is ready
pipewire: stream state changed: connecting
pipewire: stream state changed: paused
pipewire: stream available on node ID: 33
pipewire: renegotiating stream params (size: 1920x1080)
007c:fixme:hid:handle_IRP_MN_QUERY_ID Unhandled type 00000005
007c:fixme:hid:handle_IRP_MN_QUERY_ID Unhandled type 00000005
007c:fixme:hid:handle_IRP_MN_QUERY_ID Unhandled type 00000005
007c:fixme:hid:handle_IRP_MN_QUERY_ID Unhandled type 00000005
wlserver: [types/wlr_surface.c:748] New wlr_surface 0x55cf2cc68ea0 (res 0x55cf2cdb1c70)
xwm: error 2: BadValue (integer parameter out of range for operation) request 138 minor 31 serial 482
xwm: error 2: BadValue (integer parameter out of range for operation) request 138 minor 31 serial 485
Error getting buffer
xwm: error 141: 141 request 138 minor 32 serial 503
xwm: error 141: 141 request 138 minor 32 serial 506
xwm: error 3: BadWindow (invalid Window parameter) request 15 minor 0 serial 531
wlserver: [types/wlr_surface.c:748] New wlr_surface 0x55cf2cc64350 (res 0x55cf2cdadeb0)
xwm: error 2: BadValue (integer parameter out of range for operation) request 138 minor 31 serial 604
xwm: error 2: BadValue (integer parameter out of range for operation) request 138 minor 31 serial 607
Error getting buffer
xwm: error 141: 141 request 138 minor 32 serial 624
xwm: error 141: 141 request 138 minor 32 serial 627
0024:fixme:ntdll:NtQuerySystemInformation info_class SYSTEM_PERFORMANCE_INFORMATION
0024:fixme:imm:ImeSetActiveContext (00010058, 1): stub
0024:fixme:imm:ImmReleaseContext (00030056, 00010058): stub
0098:fixme:imm:ImeSetActiveContext (0000000000010026, 0): stub
0098:fixme:imm:ImmReleaseContext (0000000000010020, 0000000000010026): stub
0024:err:system:NtUserChangeDisplaySettings Changing L"\\\\.\\DISPLAY1" display settings returned -2.
wlserver: [types/wlr_surface.c:748] New wlr_surface 0x55cf2cd83940 (res 0x55cf2cdadfd0)
xwm: Unhandled initial NET_WM_STATE property: _NET_WM_STATE_ABOVE
xwm: Unhandled NET_WM_STATE property change: _NET_WM_STATE_ABOVE
xwm: Unhandled NET_WM_STATE property change: _NET_WM_STATE_MAXIMIZED_VERT
xwm: Unhandled NET_WM_STATE property change: _NET_WM_STATE_MAXIMIZED_HORZ
xwm: Unhandled NET_WM_STATE property change: _NET_WM_STATE_ABOVE
xwm: Unhandled NET_WM_STATE property change: _NET_WM_STATE_MAXIMIZED_VERT
xwm: Unhandled NET_WM_STATE property change: _NET_WM_STATE_MAXIMIZED_HORZ
xwm: Unhandled NET_WM_STATE property change: _NET_WM_STATE_ABOVE
xwm: Unhandled NET_WM_STATE property change: _NET_WM_STATE_MAXIMIZED_VERT
xwm: Unhandled NET_WM_STATE property change: _NET_WM_STATE_MAXIMIZED_HORZ
xwm: Unhandled NET_WM_STATE property change: _NET_WM_STATE_ABOVE
xwm: Unhandled NET_WM_STATE property change: _NET_WM_STATE_MAXIMIZED_VERT
xwm: Unhandled NET_WM_STATE property change: _NET_WM_STATE_MAXIMIZED_HORZ
0024:err:system:NtUserChangeDisplaySettings Changing L"\\\\.\\DISPLAY1" display settings returned -2.
wine: Unhandled page fault on read access to 00000000 at address 005D24C0 (thread 0024), starting debugger...
Error getting buffer
0120:fixme:imm:ImeSetActiveContext (00010076, 1): stub
0120:fixme:imm:ImmReleaseContext (00010080, 00010076): stub
wlserver: [types/wlr_surface.c:748] New wlr_surface 0x55cf2cd84f60 (res 0x55cf2cdae500)
Error getting buffer
Core i7-4770, Palit GTX 1660 Ti, 32GB DDR3 RAM, Firefox, Arch LTS w/ Cinnamon 5.2.7
My Linux group on Telegram
Avatar & desktop: https://ibb.co/album/GFx0yV
User avatar
NM64
Level 4
Level 4
Posts: 241
Joined: Sat Feb 04, 2017 11:34 pm

Re: [Partial solutions] Preserving aspect ratio for full-screen programs that change resolution on an external monitor?

Post by NM64 »

Valsodar wrote: Wed Sep 21, 2022 2:42 am Hi. I "followed" you here from my topic in the Wine forum about aspect ratios. I tried running NFS Underground 2 with your method but I got this error and the game wouldn't start:

Code: Select all

[rado@arch]: /media/1000GB/GAMES_1000/NFS U2>$ gamescope -f -- wine speed2.exe
No CAP_SYS_NICE, falling back to regular-priority compute and threads.
Performance will be affected.
wlserver: [backend/headless/backend.c:82] Creating headless backend
vulkan: selecting physical device 'NVIDIA GeForce GTX 1660 Ti': queue family 2
It seems you're using Gamescope on an Nvidia GPU; I believe gamescope requires the use of mesa which means it works on AMD or Intel only, not Nvidia (though hypothetically it may or may not work with the nouveau driver paired with older Nvidia GPUs).

That being said, as I mentioned in the first post, Nvidia's proprietary GPU drives should have this preserving of aspect ratios built in: (the fastest/newest Nvidia GPU I own is a GTX 260, no not 2060, so I can't really test this out myself)

If worst comes to worst, it may be worth mentioning that NFS Underground 2 had console versions which you could always emulate with Dolphin or PCSX2 (your i7-4770 should be plenty performance-wise), and the game may even work with a "widescreen hack" as well in the aforementioned emulators (there's an Xbox version as well but Xbox emulation is in a sad state currently); normally I'd recommend the GameCube version due to the combination of the GameCube's superior hardware and Dolphin's more well-developed emulation, but I recall the GameCube version of that game being the "worst" console version in terms of polish and the like, so...

Speaking of the i7-4770, there's also the unconventional method of using its integrated graphics paired with gamescope since, being an older game, even the Intel iGPU should have no trouble running it unless you're trying to run it at uber-high resolutions or something (I'd actually be more concerned about Haswell's incomplete Vulkan support in that case).


EDIT: Oh and I'd be remiss if I didn't at least mention the "fshack" version of lutris that is supposed to implement this sort of aspect ratio control/preservation, but I found it to be much more buggy than gamescope:
Locked

Return to “Graphics Cards & Monitors”