6

I just picked up a Pi 4 and imaged a new card with Raspbian Buster. I'm running this headless (using VNC) but noticed the resolution doesn't match what I've set via raspi-config (which updates /boot/config.txt).

I selected DMT mode 82 (1920 x 1080) and I can see /boot/config.txt has:

# uncomment if hdmi display is not detected and composite is being output
hdmi_force_hotplug=1

uncomment to force a specific HDMI mode (this will force VGA)

hdmi_group=2 hdmi_mode=82

That looks right. Then I check fbset --show and it reads:

pi@tims-raspi4:~ $ fbset --show

mode "1920x1080" geometry 1920 1080 1920 1080 32 timings 0 0 0 0 0 0 0 accel true rgba 8/16,8/8,8/0,0/0 endmode

So that also looks right. But I can clearly see the window is not as larger as my Pi 3B+.

I checked xdpyinfo to see what X thinks it has for a display and the relevant section reads:

default screen number:    0
number of screens:    1

screen #0: dimensions: 1024x768 pixels (270x203 millimeters)

So that's a problem... X is using a lower display resolution than the frame buffer provides.

So finally, I used xrandr -s 1920x1080 to force X to use that resolution -- and this works! (yay!)

BUT puzzlingly... if I reboot, it's right back to the lower 1024x768 resolution despite the frame buffer being in 1920x1080 mode.

This is basically a generic Buster install (downloaded the image from Raspberrypi.org) and the only thing I've done to it is set a hostname, configured wi-fi, enabled ssh, and enabled VNC (same as I've done with my previous Pis).

Any ideas why X is coming up with the wrong resolution?

Note: I did test commenting the hdmi_force_hotplug line. This did not work (it resulted in having no graphical frame buffer). I had to revert back. I'm wondering if there might have been some lingering settings from a previous OS that made the difference.

Greenonline
  • 2,969
  • 5
  • 27
  • 38
Tim Campbell
  • 1,060
  • 8
  • 17

2 Answers2

5

The syntax for HDMI related settings in config.txt on a Raspberry Pi 4B appears to have changed, likely because the Pi4B has two HDMI outputs (numbered 0 and 1 in technical documentation, and somewhat confusingly 1 & 2 otherwise).

Every time I would run the Pi4B headlessly(?), the RealVNC session would use a low resolution filling just a small part of my laptop's screen. With a TV screen connected to HDMI0 the VNC session would use the same high resolution as the TV.

Settings in /boot/config.txt that worked for me, in the new syntax, turned out to be as follows:

# Force HDMI-output on,
# and set VNC screen resolution when headless.
# ar - 21-09-2019, 04-10-2019
hdmi_force_hotplug:0=1
hdmi_drive:0=2
hdmi_group:0=2
hdmi_mode:0=82
#core_freq_min=500
# Not yet implemented for RPi4B
hdmi_blanking:0=1

Settings related to HDMI elsewhere in /boot/config.txt are commented out, as far as I understand them to be related to HDMI.

ArjenR
  • 111
  • 1
  • 4
2

Because Raspbian Buster defaults to vc4-kms-v3d (not the fake one, vc4-fkms-v3d), setting the display resolution is a bit more complicated.

I found an imperfect solution and documented it over here:

Custom screen resolution for Android on Raspberry Pi 3

The main drawback is the initial login is at the 1024x768 resolution, and then shortly after the script kicks in and sets it to the desired resolution.

HTH. YMMV. Would love to see someone post a more perfect solution. =D

Leon Shaner
  • 144
  • 1
  • 7