User avatar
DAI-X
Posts: 42
Joined: Fri Nov 27, 2015 11:19 pm
Location: sutton coldfield, uk

PI 4 - can't change desktop resolution VGA

Sun Jul 14, 2019 8:14 pm

Hi

Been having a right old fight this evening, setting up my PI 4 through a pi-hut VGA adaptor. Its connected to an ACER widescreen VGA monitor and it worked fine on my PI 2.

However on the PI4 none of the different DMT modes seem to make the slightest difference to the desktop - it always looks like a 4:3 display stretched to fit 16:9.

**** just checked, the monitor is seeing 1024x768, but it should be able to display 1366 x 768 - there is a DMT mode for this (81) or 1360 x 768 (39) but it seems to be being ignored ****

INTERESTINGLY the DMT modes DO seem to affect the appearance of the 4 x raspberries during boot, its almost as if something is overriding the config.txt settings once the desktop appears. Any ideas?

I haven't tried to do pi4 specific settings e.g. [HDMI:0] [HDMI:1], just the normal global settings.

If I could have one thing on my wishlist for a raspbian update its a way to test DMT modes 'live' rather than endlessly booting, editing config.txt and rebooting, as if you get it wrong you have no video mode and you have to SSH in or edit the SD card on another computer....

cheers

pik33
Posts: 192
Joined: Thu Sep 10, 2015 4:26 pm

Re: PI 4 - can't change desktop resolution VGA

Sun Jul 14, 2019 8:38 pm

The X in Pi4 sets its own resolution regardless of config.txt, using EDID

If you want something other, xrandr can set any rsoluton you want in X

The example (I use it for Hatari emulator)

xrandr --newmode "832x588" 32.75 832 896 928 1024 588 590 592 640 -hsync +vsync
xrandr --addmode HDMI-1 "832x588"

From this moment on you have the resolution available in the graphic tool or you can switch it with the command

xrandr --output HDMI-1 --mode "832x588"

If you add this to X autostart script, it should set your needed graphics mde in X

If you set a resolution in config.txt, it will appear in xrandr list, so you dn't need to add it, you have only to switch to it using xrandr or Screen Configuration tool.

User avatar
DAI-X
Posts: 42
Joined: Fri Nov 27, 2015 11:19 pm
Location: sutton coldfield, uk

Re: PI 4 - can't change desktop resolution VGA

Sun Jul 14, 2019 8:42 pm

:D

Whoa! I never knew that existed...

xrandr --output HDMI-1 --mode 1360x768

BOOM! PERFECT!

thanks a million mate - brilliant!

User avatar
DAI-X
Posts: 42
Joined: Fri Nov 27, 2015 11:19 pm
Location: sutton coldfield, uk

Re: PI 4 - can't change desktop resolution VGA

Sun Jul 14, 2019 10:57 pm

Just to clarify, setting via EDID doesnt work with this VGA adaptor as it doesnt return any information to the pi.

Tvservice -n is blank

Xrandr works perfectly if you know the output modes of the monitor

andrum99
Posts: 1264
Joined: Fri Jul 20, 2012 2:41 pm

Re: PI 4 - can't change desktop resolution VGA

Mon Jul 15, 2019 12:08 am

DAI-X wrote:
Sun Jul 14, 2019 10:57 pm
Just to clarify, setting via EDID doesnt work with this VGA adaptor as it doesnt return any information to the pi.
Which would be a bit odd, since the way the EDID information is communicated to the host PC uses the exact same method over the HDMI interface as it is over the VGA interface, so no conversion is actually needed. (It uses the VESA DDC - Display Data Channel, which is a specific implementation of an i2c bus).

The actual cause of your difficulty is the fact that on the Pi 4 setting the video mode is done twice - once by the firmware at boot, and once when the X desktop starts up. In your case you have the monitor attached to HDMI 1. At the moment EDID information from HDMI 1 is ignored when the video mode is selected for the X desktop, so it falls back to using 1024 x 768 for that screen. You can use the "Display Configuration" desktop application to change the video mode displayed on HDMI 1. If you want the correct video mode to be selected automatically on the Pi 4 using EDID, you currently have to use HDMI 0.

User avatar
DAI-X
Posts: 42
Joined: Fri Nov 27, 2015 11:19 pm
Location: sutton coldfield, uk

Re: PI 4 - can't change desktop resolution VGA

Mon Jul 15, 2019 12:20 am

Ah i see... i assumed if tvservice wasnt reporting anything then it meant nothing was coming from the display

I found the desktop settings app later on, guess it does the same as xrandr.

pik33
Posts: 192
Joined: Thu Sep 10, 2015 4:26 pm

Re: PI 4 - can't change desktop resolution VGA

Mon Jul 15, 2019 4:54 am

it does the same as xrandr.
A subset of.
It can set the mode if it is already on the list. It cannot define a mode if it is not there.

User avatar
HermannSW
Posts: 2814
Joined: Fri Jul 22, 2016 9:09 pm
Location: Eberbach, Germany
Contact: Website Twitter YouTube

Re: PI 4 - can't change desktop resolution VGA

Thu Aug 22, 2019 6:03 pm

pik33 wrote:
Sun Jul 14, 2019 8:38 pm
If you add this to X autostart script, it should set your needed graphics mde in X
Which X autostart file?

I have placed it in ~/.xsessionrc and it switches to correct resolution after I logged in -- I can live with login screen not running at correct resolution (it runs 1920x1080):

Code: Select all

pi@raspberrypi4B:~ $ cat .xsessionrc 
xrandr --output HDMI-1 --mode 1360x768
pi@raspberrypi4B:~ $ 

So X11 is fine, but I have not found the equivalent for console.
As for all my other PIs I have added this to /boot/config.txt, but it gets ignored:

Code: Select all

pi@raspberrypi4B:~ $ grep ^hdmi /boot/config.txt 
hdmi_group=2
hdmi_mode=39
pi@raspberrypi4B:~ $ 

P.S:
I just received new Pi4B and like what I see:

Code: Select all

pi@raspberrypi4B:~ $ head -5 /proc/meminfo 
MemTotal:        3947004 kB
MemFree:         3554644 kB
MemAvailable:    3612808 kB
Buffers:           21664 kB
Cached:           184788 kB
pi@raspberrypi4B:~ $ 

Especially the 2GB /dev/shm should allow for much much longer (than 8 seconds on the other Pi models) 665fps/1007fps high framerate videos with Raspberry v1/v2 cameras:

Code: Select all

pi@raspberrypi4B:~ $ df /dev/shm
Filesystem     1K-blocks  Used Available Use% Mounted on
tmpfs            1973500     0   1973500   0% /dev/shm
pi@raspberrypi4B:~ $ 
https://stamm-wilbrandt.de/en/Raspberry_camera.html
https://stamm-wilbrandt.de/en#raspcatbot
https://github.com/Hermann-SW/raspiraw
https://github.com/Hermann-SW/Raspberry_v1_camera_global_external_shutter
https://stamm-wilbrandt.de/github_repo_i420toh264

User avatar
HermannSW
Posts: 2814
Joined: Fri Jul 22, 2016 9:09 pm
Location: Eberbach, Germany
Contact: Website Twitter YouTube

Re: PI 4 - can't change desktop resolution VGA

Fri Aug 23, 2019 9:35 am

I found the solution to get console mode correct as well.
The .xsessionrc file as described is still needed for X11.
I tested all 4 boot options, console/X11 with and without login, all is fine now!

I changed cameras connected to Pi4B CSI-2 connector several times and realized that it is not that easy to do with HDMI connector converter connected to the right Pi4B HDMI. So I switched cable and connected to the left. That was all that was needed (in addition to "hdmi_group=2" and "hdmi_mode=39" in /boot/config.txt):
Image
https://stamm-wilbrandt.de/en/Raspberry_camera.html
https://stamm-wilbrandt.de/en#raspcatbot
https://github.com/Hermann-SW/raspiraw
https://github.com/Hermann-SW/Raspberry_v1_camera_global_external_shutter
https://stamm-wilbrandt.de/github_repo_i420toh264

User avatar
HermannSW
Posts: 2814
Joined: Fri Jul 22, 2016 9:09 pm
Location: Eberbach, Germany
Contact: Website Twitter YouTube

Re: PI 4 - can't change desktop resolution VGA

Thu Aug 29, 2019 11:48 am

At my secondary living place I have a different HDMI monitor with 1680x1050@60Hz.

I changed /boot/config.txt to

Code: Select all

...
hdmi_group=2
#hdmi_mode=39
hdmi_mode=58
...
and

Code: Select all

pi@raspberrypi4B:~ $ cat ~/.xsessionrc 
#xrandr --output HDMI-1 --mode 1360x768
xrandr --output HDMI-1 --mode 1680x1050
pi@raspberrypi4B:~ $ 
This works fine as expected.
But do I really have to always comment out the wrong setting and comment in the right setting whenever I change the HDMI monitor?
Or is there a configuration/solution that would allow the Pi4B to use the correct HDMI monitor setup of both?
https://stamm-wilbrandt.de/en/Raspberry_camera.html
https://stamm-wilbrandt.de/en#raspcatbot
https://github.com/Hermann-SW/raspiraw
https://github.com/Hermann-SW/Raspberry_v1_camera_global_external_shutter
https://stamm-wilbrandt.de/github_repo_i420toh264

Return to “Troubleshooting”