Solved Xorg does not detect the correct resolution.

I am running FreeBSD 12.3 on VMWare 16.2. I have the latest versions of Xorg and XFCE installed. I want this machine to run XFCE as root since it serving any purpose other than development. To that end, I created the .xinitrc file:

Code:
exec /usr/local/bin/startxfce4

And in order to make it run at startup, I appended this line to /etc/crontab:

Code:
@reboot root /usr/local/bin/startx

I know the purists among you will strongly recommend against that and say things like running processes as root might and will cause problems, but I can't be bothered to sudo every time I'd like to try my code; so please let's not go there.

I have installed open-vm-tools and I can copy-paste between the host and the guest.

My problem is that Xorg does not recognise all the resolutions that my screen supports and I am stuck with 1176x885, which is the highest supported. How can I get Xorg to run at 1920x1080?
 
Code:
@reboot root /usr/local/bin/startx
I don't believe this will work reliably since ~FreeBSD 9. There is a race condition that means if the vty login launches *after* xorg, it will steal the keyboard and you won't be able to use it in your X11 session.

Perhaps check this solution out instead:
https://forums.freebsd.org/threads/autologin-and-auto-run-x-server.6782/#post-43547

That said... it does seem to launch, so perhaps for the resolution you simply haven't installed the correct KMS driver for your card.
https://docs.freebsd.org/en/books/handbook/x11/#x-config-video-cards

In short, if your card is capable of open-source drivers:

Code:
# pkg install drm-kmod
<follow instructions from pkg messages>
 
I don't believe this will work reliably since ~FreeBSD 9. There is a race condition that means if the vty login launches *after* xorg, it will steal the keyboard and you won't be able to use it in your X11 session.
It works perfectly fine on my FreeBSD 12.2 installation. The only reason I am doing is because the Gigabyte SDD disk that it is installed has started to go offline from time to time, maybe because of old age or inferior quality.

While that is pertinent to the issue I am having, it is a very old post and I did not have to do that for the previous installation anyway. I forgot how I got it work.


That said... it does seem to launch, so perhaps for the resolution you simply haven't installed the correct KMS driver for your card.
https://docs.freebsd.org/en/books/handbook/x11/#x-config-video-cards
That does not cover VMWare installations, though I did install the necessary drivers for it:

Code:
[root@freebsd123 ~]# pkg info | grep  xf86
libXxf86dga-1.1.5              X DGA Extension
libXxf86vm-1.1.4_3             X Vidmode Extension
xf86-input-keyboard-1.9.0_5    X.Org keyboard input driver
xf86-input-libinput-1.2.0_1    X.Org libinput input driver
xf86-input-mouse-1.9.3_4       X.Org mouse input driver
xf86-input-vmmouse-13.1.0_6    X.Org vmmouse input driver
xf86-video-scfb-0.0.7_1        X.Org syscons display driver
xf86-video-vesa-2.5.0_1        X.Org vesa display driver
xf86-video-vmware-13.3.0_7     X.Org vmware display driver
xf86dga-1.0.3_1                Test program for the XFree86-DGA extension
[root@freebsd123 ~]#


In short, if your card is capable of open-source drivers:
It is indeed.

I have attached the Xorg log file.
 

Attachments

  • Xorg.0.txt
    29.5 KB · Views: 88
Cool. Yeah, I should have put 2 and 2 together to realise you were using the vmware GPU driver!

Looking at the Xorg log:

vmware(0): Not using default mode "1920x1080" (insufficient memory for mode)

How much video RAM have you set for the virtual GPU adapter?

Also, you might be able to set noddy VertRefresh, HorizSync values for your virtual monitor in /usr/local/etc/X11/xorg.conf.

Code:
Section "Monitor"
    Identifier     "Monitor0"
    HorizSync       10.0 - 100.0
    VertRefresh     10.0 - 100.0
EndSection

This might unlock more resolutions in case the EDID isn't passed through.

What does xrandr output?
 
Cool. Yeah, I should have put 2 and 2 together to realise you were using the vmware GPU driver!
Yes, I thought it would be the obvious choice for a virtual machine hosted by VMWare.


How much video RAM have you set for the virtual GPU adapter?
svga.vramSize = "268435456"
vmotion.svga.graphicsMemoryKB = "262144"


Also, you might be able to set noddy VertRefresh, HorizSync values for your virtual monitor in /usr/local/etc/X11/xorg.conf.
I copied the contents of the xorg.conf file the from the FreeBSD 12.2 installation on the Gigabyte SDD, so that cannot be the issue.


What does xrandr output?

This:
Code:
[root@freebsd123 ~]# xrandr
xrandr: Failed to get size of gamma for output default
Screen 0: minimum 320 x 200, current 1176 x 885, maximum 1176 x 885
default connected 1176x885+0+0 0mm x 0mm
   800x600       60.00    85.00    75.00    72.00    56.00     0.00 
   1152x864      75.00     0.00 
   1024x768      85.00    75.00    70.00    60.00     0.00 
   1024x576      60.00 
   832x624       75.00 
   960x540       60.00 
   864x486       60.00 
   640x480       85.00    75.00    73.00    60.00     0.00 
   720x405       60.00 
   720x400       85.00 
   640x400       85.00     0.00 
   640x360       60.00    59.00 
   640x350       85.00 
   320x240        0.00 
   400x300        0.00 
   512x384        0.00 
   854x480        0.00 
   720x480        0.00 
   720x576        0.00 
   320x200        0.00 
   800x480        0.00 
   1176x885       0.00*
[root@freebsd123 ~]#
 
Hmm, it could just be that the video BIOS (or equivalent) doesn't list the correct resolution. Potentially you can add your own display mode.

https://medium.com/@AbhiXpert/add-c...randr-on-ubuntu-18-04-in-a-minute-338caec6e29

Code:
# Get display line info (optional if you use the values below)
cvt 1920 1080 60

# Create new mode based on display line
xrandr --newmode "1920x1080_60.00"  173.00  1920 2048 2248 2576  1080 1088 1120 -hsync +vsync

# Add new mode
xrandr --addmode <device> "1920x1080_60.00"

You should now see it.
 
Hmm, it could just be that the video BIOS (or equivalent) doesn't list the correct resolution. Potentially you can add your own display mode.

https://medium.com/@AbhiXpert/add-c...randr-on-ubuntu-18-04-in-a-minute-338caec6e29

Code:
# Get display line info (optional if you use the values below)
cvt 1920 1080 60

# Create new mode based on display line
xrandr --newmode "1920x1080_60.00"  173.00  1920 2048 2248 2576  1080 1088 1120 -hsync +vsync

# Add new mode
xrandr --addmode <device> "1920x1080_60.00"

You should now see it.
Done that already, to no avail...
 
Darn. What error message do you get when you try? That might give some hints.

We have the Xorg.log file and this:
Code:
[root@freebsd123 ~]# xrandr
xrandr: Failed to get size of gamma for output default
Screen 0: minimum 320 x 200, current 1176 x 885, maximum 1176 x 885
default connected 1176x885+0+0 0mm x 0mm
   800x600       60.00    85.00    75.00    72.00    56.00     0.00 
   1152x864      75.00     0.00 
   1024x768      85.00    75.00    70.00    60.00     0.00 
   1024x576      60.00 
   832x624       75.00 
   960x540       60.00 
   864x486       60.00 
   640x480       85.00    75.00    73.00    60.00     0.00 
   720x405       60.00 
   720x400       85.00 
   640x400       85.00     0.00 
   640x360       60.00    59.00 
   640x350       85.00 
   320x240        0.00 
   400x300        0.00 
   512x384        0.00 
   854x480        0.00 
   720x480        0.00 
   720x576        0.00 
   320x200        0.00 
   800x480        0.00 
   1176x885       0.00*
  1920x1080_60.00 (0x54e) 173.000MHz -HSync +VSync
        h: width  1920 start 2048 end 2248 total 2576 skew    0 clock  67.16KHz
        v: height 1080 start 1083 end 1088 total 1120           clock  59.96Hz
[root@freebsd123 ~]# cvt 1920 1080 60
# 1920x1080 59.96 Hz (CVT 2.07M9) hsync: 67.16 kHz; pclk: 173.00 MHz
Modeline "1920x1080_60.00"  173.00  1920 2048 2248 2576  1080 1083 1088 1120 -hsync +vsync
[root@freebsd123 ~]# xrandr --newmode "1920x1080_60.00"  173.00  1920 2048 2248 2576  1080 1083 1088 1120 -hsync +vsync
xrandr: Failed to get size of gamma for output default
X Error of failed request:  BadName (named color or font does not exist)
  Major opcode of failed request:  142 (RANDR)
  Minor opcode of failed request:  16 (RRCreateMode)
  Serial number of failed request:  19
  Current serial number in output stream:  19
[root@freebsd123 ~]# xrandr --addmode default "1920x1080_60"
xrandr: Failed to get size of gamma for output default
xrandr: cannot find mode "1920x1080_60"
[root@freebsd123 ~]#
 
I have solved the problem. The issue was a line in the .vmx file:
Code:
vmotion.checkpointFBSize = "4194304"

I don't know what it is, but I edited as shown below and it worked.
Code:
vmotion.checkpointFBSize = "134217728"

However, for some curious reason, it would reset every time I started the VM, but then I copied the working .vmx and edited the relevant lines and now it works. That really got me anxious though.
 
Back
Top