Slow performance due to 4k rendering

Discussions related to using VirtualBox on Mac OS X hosts.
Locked
electr0sheep
Posts: 3
Joined: 9. Oct 2020, 20:19

Slow performance due to 4k rendering

Post by electr0sheep »

Hey guys, I've observed that my windows vm runs great when I am plugged into an external monitor, but is laggy when running it on my mac's display (even when scaled to 200% so the font is readable). I believe the reason is that windows runs at 1080p on the external monitor, but the mac's display is close to 4k resolution.

I would like to change the resolution to 1080p when running on the mac's display, but this creates an enormous black border with just a tiny viewport in the middle.

On the other hand, the problem really is that it runs super slow. Does anyone know how I can get virtualbox to not run like crap at 4k, or how I can change the resolution to something reasonable without simply creating a giant black border?

Thanks!
scottgus1
Site Moderator
Posts: 20965
Joined: 30. Dec 2009, 20:14
Primary OS: MS Windows 10
VBox Version: PUEL
Guest OSses: Windows, Linux

Re: Slow performance due to 4k rendering

Post by scottgus1 »

4K-resoltion is hard to calculate for the Virtualbox video cards. Once more Oracle paying customers go to 4K, then the devs might be able to get more zing in the cards.
electr0sheep wrote:enormous black border with just a tiny viewport in the middle
This might be a setting on the monitor itself. I once had a monitor that would scale the smaller resolution or make the border. There was a setting to change that behavior from one to the other.

There was a forum post where the solution to 1080p on 4K was diagnosed by forum guru 'fth0'. I don't have the link, but its in the Mac OS Hosts forum with the first few pages.
electr0sheep
Posts: 3
Joined: 9. Oct 2020, 20:19

Re: Slow performance due to 4k rendering

Post by electr0sheep »

scottgus1 wrote:There was a forum post where the solution to 1080p on 4K was diagnosed by forum guru 'fth0'. I don't have the link, but its in the Mac OS Hosts forum with the first few pages.
Okay, I'll try to do some more searching. I tried searching around before I posted, but wasn't able to find anything that helped. If I find it, I'll link it here. Thank you!
electr0sheep
Posts: 3
Joined: 9. Oct 2020, 20:19

Re: Slow performance due to 4k rendering

Post by electr0sheep »

Okay...I've found it.

I don't know what kind of insane sleuthing was necessary to figure this out, but I'm blown away. I would have never in a million years figured this out.

Here are the relevant comments
fth0 wrote:Today I started a detailed investigation:

On my iMac host with Retina display, I generally use(d) a Scale Factor of 200% for my Linux guest (and other guests as well). The VM window is configured with a 1600 x 900 resolution, and covers about 3200 x 1800 pixels on the Retina display. In the Linux guest, the keyboard repeat rate is configured to be 30 characters per second. Using xev and a stopwatch, I measured that if I press and hold a letter key for about 5 seconds, there are KeyPress and KeyRelease events generated about every 33 ms (at irregular intervals between 31 and 38 ms), but for a total duration of 12.5 seconds.

Changing the resolution, the scale factor or the key press duration all lead to different timings, but with the commonality that the key events are generated longer than the key is pressed. Changing 3d acceleration, the graphics controller, or uninstalling the VirtualBox Guest Additions also lead to different timings.

In the end, I found a solution: VirtualBoxVM is the binary application that runs the VM. Setting it to Open in Low Resolution, and using a Scale Factor of 100% results in the same VM window size, but macOS does the doubling of the resolution, and my problem is gone. Can you try if it also solves your problems?
mannyk wrote:Thanks for the investigation! The workaround worked on a brief test. To be clear: I navigated to the package contents of the VirtualBox app and found
'VirtualBoxVM' under Contents/Resources. In Finder, right-clicked -> get-info -> and clicked on "open in low resolution", then changed to "scale to 100%" under "view -> virtual screen 1" for my VM.
Once you follow these instructions, you won't have to deal with the bull crap 4k resolution micro-font anymore when running vms on a mac's retina display. I'm not sure if I'll have to change this back if I connect to an external monitor, but even if I do, I can live with that.

Much thanks to fth0 for figuring this out, I didn't even know mac's had an option to run in low resolution mode!
fth0
Volunteer
Posts: 5668
Joined: 14. Feb 2019, 03:06
Primary OS: Mac OS X other
VBox Version: PUEL
Guest OSses: Linux, Windows 10, ...
Location: Germany

Re: Slow performance due to 4k rendering

Post by fth0 »

electr0sheep wrote:Much thanks to fth0 for figuring this out, I didn't even know mac's had an option to run in low resolution mode!
You're welcome!

To be honest, the workaround to Open in low resolution to get a major performance benefit has been contributed by other forum users in the past. My contribution was to analyze the keyboard repeat rate problem and to figure out that it doesn't occur when opening in low resolution.
MurderMostFowl
Posts: 1
Joined: 25. Apr 2021, 00:39

Re: Slow performance due to 4k rendering

Post by MurderMostFowl »

electr0sheep wrote:Okay...I've found it.

I don't know what kind of insane sleuthing was necessary to figure this out, but I'm blown away. I would have never in a million years figured this out.

Here are the relevant comments
fth0 wrote:Today I started a detailed investigation:

On my iMac host with Retina display, I generally use(d) a Scale Factor of 200% for my Linux guest (and other guests as well). The VM window is configured with a 1600 x 900 resolution, and covers about 3200 x 1800 pixels on the Retina display. In the Linux guest, the keyboard repeat rate is configured to be 30 characters per second. Using xev and a stopwatch, I measured that if I press and hold a letter key for about 5 seconds, there are KeyPress and KeyRelease events generated about every 33 ms (at irregular intervals between 31 and 38 ms), but for a total duration of 12.5 seconds.

Changing the resolution, the scale factor or the key press duration all lead to different timings, but with the commonality that the key events are generated longer than the key is pressed. Changing 3d acceleration, the graphics controller, or uninstalling the VirtualBox Guest Additions also lead to different timings.

In the end, I found a solution: VirtualBoxVM is the binary application that runs the VM. Setting it to Open in Low Resolution, and using a Scale Factor of 100% results in the same VM window size, but macOS does the doubling of the resolution, and my problem is gone. Can you try if it also solves your problems?

OMG Thank all of you so much!!!!! I literally signed up for an account just to thank you guys for this.
I have had this problem for almost 2 years ( I think? ) and it brought all of my use of VirtualBox to a screeching halt. My Windows XP and Windows 7 guests came to s screeching halt sometime around version 6 and I could never figure it out... I kept hoping with the new version this would get fixed and it was so bad I could hardly use the VMs for awhile.
And this trick fixed EVERYTHING.

WHY is this not the way the app comes configured by default? I had to choose between. a tiny 2-3inch screen or a scaled mode that was so slow in some builds the cursor wouldn't even track correctly.
My long nightmare is over :)
fth0
Volunteer
Posts: 5668
Joined: 14. Feb 2019, 03:06
Primary OS: Mac OS X other
VBox Version: PUEL
Guest OSses: Linux, Windows 10, ...
Location: Germany

Re: Slow performance due to 4k rendering

Post by fth0 »

MurderMostFowl wrote:WHY is this not the way the app comes configured by default?
Because this workaround makes the guest display quite blurry, and the people not having problems without using the workaround would (rightfully) complain then.
creatorr
Posts: 1
Joined: 31. Mar 2021, 19:46
Primary OS: Mac OS X other
VBox Version: OSE self-compiled
Guest OSses: Linux
Location: USA
Contact:

Re: Slow performance due to 4k rendering

Post by creatorr »

scottgus1 wrote:4K-resoltion is hard to calculate for the Virtualbox video cards. Once more Oracle paying customers go to 4K, then the devs might be able to get more zing in the cards.
electr0sheep wrote:enormous black border with just a tiny viewport in the middle
This might be a setting on the monitor itself. I once had a monitor that would scale the smaller resolution or make the border. There was a setting to change that behavior from one to the other.

There was a forum post where the solution to 1080p on 4K was diagnosed by forum guru 'fth0'. I don't have the link, but its in the Mac OS Hosts forum with the first few pages.

Can't find the exact post, but fond all fth0 posts, hope it helps forums. virtualbox. org/ search. php? author_id=116563&sr=posts
sorry can't post links, just delete spaces


Lol, sorry, fth0, you already here :D
Locked