[Solved] Secondary Monitor only detected on replug

Forum rules
Before you post read how to get help. Topics in this forum are automatically closed 6 months after creation.
Locked
CannockChase
Level 1
Level 1
Posts: 6
Joined: Sat Jan 22, 2022 12:07 pm

[Solved] Secondary Monitor only detected on replug

Post by CannockChase »

Secondary monitor issues seem to be a theme here, but I can't find a thread with quite the same issues, so here goes.

Using 5.13.0-27, mint 20.1, Cinnamon 4.8.6 RX480 mesa (inxi at end). I've had this issue across several kernels, can't remember if it was as far back as 4. Update manager reports the system is fully up to date.

I have an AOC primary monitor connected via DVI and a DGM TV as a secondary connected via HDMI (model ETV-2272WH). The only way I have found to get the TV to work consistently, at the correct resolution, is to:
  • set TV to standby
  • boot
  • login
  • turn on tv
  • switch the HDMI cable from one TV port to the other
  • swap the source on the TV (from HDMI1 to HDMI 2 or visa versa)
After doing this xrandr looks like

Code: Select all

Screen 0: minimum 320 x 200, current 3840 x 1091, maximum 16384 x 16384
DisplayPort-0 disconnected (normal left inverted right x axis y axis)
DisplayPort-1 disconnected (normal left inverted right x axis y axis)
HDMI-A-0 connected 1920x1080+1920+0 (normal left inverted right x axis y axis) 1600mm x 900mm
   1360x768      60.37 +
   1920x1080     60.00*   50.00    59.94  
   1280x1024     60.02  
   1280x720      60.61    60.00    50.00    59.94  
   1024x768      60.00  
   800x600       60.32  
   720x576       50.00  
   720x480       60.00    59.94  
   640x480       60.00    59.94  
HDMI-A-1 disconnected (normal left inverted right x axis y axis)
DVI-D-0 connected primary 1920x1080+0+11 (normal left inverted right x axis y axis) 509mm x 286mm
   1920x1080     60.00*+
   1680x1050     59.88  
   1280x1024     75.02    60.02  
   1440x900      59.90  
   1280x960      60.00  
   1280x800      60.00  
   1280x720      60.00  
   1024x768      75.03    70.07    60.00  
   832x624       74.55  
   800x600       72.19    75.00    60.32    56.25  
   640x480       75.00    72.81    66.67    59.94  
   720x400       70.08  
which as far as I can see is the expected behavior I would like by default.

If I boot with the TV on, the DVI monitor displays the BIOS splash screen, then both displays show the login screen at different, 'incorrect' resolutions. Once the desktop is reached only the primary monitor shows anything, xrandr here:

Code: Select all

Screen 0: minimum 320 x 200, current 1920 x 1080, maximum 16384 x 16384
DisplayPort-0 disconnected (normal left inverted right x axis y axis)
DisplayPort-1 disconnected (normal left inverted right x axis y axis)
HDMI-A-0 connected (normal left inverted right x axis y axis)
   640x480       59.94  
HDMI-A-1 disconnected (normal left inverted right x axis y axis)
DVI-D-0 connected primary 1920x1080+0+0 (normal left inverted right x axis y axis) 509mm x 286mm
   1920x1080     60.00*+
   1680x1050     59.88  
   1280x1024     75.02    60.02  
   1440x900      59.90  
   1280x960      60.00  
   1280x800      60.00  
   1280x720      60.00  
   1024x768      75.03    70.07    60.00  
   832x624       74.55  
   800x600       72.19    75.00    60.32    56.25  
   640x480       75.00    72.81    66.67    59.94  
   720x400       70.08  
If I boot into only the TV it works, but defaults to 1360x768, which is for some reason the top value on xrandr. Strangely, in the Display app it believes it to be 72" when it is in fact 23" (I think).

Posts here seem to suggest using cvt and xrandr --addmode to add it manually, but since I can get it to be recognised eventually I can't but help think there is a more elegant fix.

inxi here

Code: Select all

System:
  Kernel: 5.13.0-27-generic x86_64 bits: 64 compiler: N/A 
  Desktop: Cinnamon 4.8.6 wm: muffin 4.8.1 dm: LightDM 1.30.0 
  Distro: Linux Mint 20.1 Ulyssa base: Ubuntu 20.04 focal 
Machine:
  Type: Desktop Mobo: ASUSTeK model: ROG STRIX B450-F GAMING v: Rev 1.xx 
  serial: <filter> UEFI: American Megatrends v: 2901 date: 10/16/2019 
CPU:
  Topology: 8-Core model: AMD Ryzen 7 2700X bits: 64 type: MT MCP arch: Zen+ 
  rev: 2 L2 cache: 4096 KiB 
  flags: avx avx2 lm nx pae sse sse2 sse3 sse4_1 sse4_2 sse4a ssse3 svm 
  bogomips: 118178 
  Speed: 1883 MHz min/max: 2200/3700 MHz boost: enabled Core speeds (MHz): 
  1: 1884 2: 1922 3: 1808 4: 1726 5: 2138 6: 1886 7: 1890 8: 2191 9: 1884 
  10: 2056 11: 1939 12: 1891 13: 2014 14: 2166 15: 1958 16: 1982 
Graphics:
  Device-1: AMD Ellesmere [Radeon RX 470/480/570/570X/580/580X/590] 
  vendor: ASUSTeK driver: amdgpu v: kernel bus ID: 09:00.0 
  chip ID: 1002:67df 
  Display: x11 server: X.Org 1.20.13 driver: amdgpu,ati 
  unloaded: fbdev,modesetting,vesa 
  resolution: 1920x1080~60Hz, 1920x1080~60Hz 
  OpenGL: renderer: AMD Radeon RX 480 Graphics (POLARIS10 DRM 3.41.0 
  5.13.0-27-generic LLVM 13.0.0) 
  v: 4.6 Mesa 21.3.4 - kisak-mesa PPA direct render: Yes 
Audio:
  Device-1: AMD Ellesmere HDMI Audio [Radeon RX 470/480 / 570/580/590] 
  vendor: ASUSTeK driver: snd_hda_intel v: kernel bus ID: 09:00.1 
  chip ID: 1002:aaf0 
  Device-2: AMD Family 17h HD Audio vendor: ASUSTeK driver: snd_hda_intel 
  v: kernel bus ID: 0b:00.3 chip ID: 1022:1457 
  Device-3: Kingston HyperX 7.1 Audio type: USB 
  driver: hid-generic,snd-usb-audio,usbhid bus ID: 1-2:3 chip ID: 0951:16a4 
  serial: <filter> 
  Sound Server: ALSA v: k5.13.0-27-generic 
Network:
  Device-1: Intel I211 Gigabit Network vendor: ASUSTeK driver: igb v: kernel 
  port: e000 bus ID: 04:00.0 chip ID: 8086:1539 
  IF: enp4s0 state: up speed: 1000 Mbps duplex: full mac: <filter> 
Drives:
  Local Storage: total: 2.05 TiB used: 1.05 TiB (51.2%) 
  ID-1: /dev/nvme0n1 vendor: Corsair model: Force MP600 size: 931.51 GiB 
  speed: 63.2 Gb/s lanes: 4 serial: <filter> rev: EGFM11.3 scheme: GPT 
  ID-2: /dev/sda vendor: Samsung model: SSD 850 EVO 250GB size: 232.89 GiB 
  speed: 6.0 Gb/s serial: <filter> rev: 2B6Q scheme: GPT 
  ID-3: /dev/sdb vendor: Seagate model: ST1000DM010-2EP102 size: 931.51 GiB 
  speed: 6.0 Gb/s rotation: 7200 rpm serial: <filter> rev: CC43 
Partition:
  ID-1: / size: 930.56 GiB used: 722.35 GiB (77.6%) fs: btrfs 
  dev: /dev/nvme0n1p2 
  ID-2: /home size: 930.56 GiB used: 722.35 GiB (77.6%) fs: btrfs 
  dev: /dev/nvme0n1p2 
Sensors:
  System Temperatures: cpu: 43.5 C mobo: N/A gpu: amdgpu temp: 52 C 
  Fan Speeds (RPM): N/A gpu: amdgpu fan: 774 
Info:
  Processes: 379 Uptime: 48m Memory: 15.55 GiB used: 2.17 GiB (14.0%) 
  Init: systemd v: 245 runlevel: 5 Compilers: gcc: 9.3.0 alt: 9 Shell: bash 
  v: 5.0.17 running in: gnome-terminal inxi: 3.0.38 
Last edited by LockBot on Wed Dec 28, 2022 7:16 am, edited 2 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: 31307
Joined: Sun Jul 26, 2020 6:15 pm
Location: USA

Re: Secondary Monitor only detected on replug

Post by SMG »

CannockChase wrote: Sat Jan 22, 2022 12:44 pm After doing this xrandr looks like

Code: Select all

Screen 0: minimum 320 x 200, current 3840 x 1091, maximum 16384 x 16384
HDMI-A-0 connected 1920x1080+1920+0 (normal left inverted right x axis y axis) 1600mm x 900mm
   1360x768      60.37 +
DVI-D-0 connected primary 1920x1080+0+11 (normal left inverted right x axis y axis) 509mm x 286mm
   1920x1080     60.00*+
which as far as I can see is the expected behavior I would like by default.
Welcome to the forum, CannockChase.

When you look at the xrandr data, *= current resolution and += preferred resolution. The system does its best to automatically have the monitors run at their preferred resolutions. The AOC monitor is currently running at its preferred resolution. However, there is no current resolution listed for the TV which seems to indicate there is an issue with the system being able to detect what the TV is doing.

Usually, the system gets its information from the monitor's EDID which is passed from the monitor through the cable to the computer. You can check xrandr --verbose to verify if the EDID information is coming through.
CannockChase wrote: Sat Jan 22, 2022 12:44 pmIf I boot with the TV on, the DVI monitor displays the BIOS splash screen, then both displays show the login screen at different, 'incorrect' resolutions.
There is a Login Window app where you can specify which monitor you would like to display the login prompt. Open the app and go to the Settings tab. Under the Settings option the last one is "Monitor" and the default is "Auto". There are also some
CannockChase wrote: Sat Jan 22, 2022 12:44 pmIf I boot into only the TV it works, but defaults to 1360x768, which is for some reason the top value on xrandr. Strangely, in the Display app it believes it to be 72" when it is in fact 23" (I think).
What is the make and model of the TV and what is its preferred resolution? The inxi you posted shows it as displaying 1920x1080, but that is not what the first xrandr output you posted indicates is the preferred resolution of the monitor.
Image
A woman typing on a laptop with LM20.3 Cinnamon.
CannockChase
Level 1
Level 1
Posts: 6
Joined: Sat Jan 22, 2022 12:07 pm

Re: Secondary Monitor only detected on replug

Post by CannockChase »

Hi

Sorry for taking so long to reply after your post and thanks for the welcome!

I've eventually found a workaround which I'll post below.
CannockChase
Level 1
Level 1
Posts: 6
Joined: Sat Jan 22, 2022 12:07 pm

Re: Secondary Monitor only detected on replug

Post by CannockChase »

The workaround I've found was: (explained as I understand it, for me when I forget anyone stumbling across this)

Code: Select all

sudo nano /etc/secondaryMonitor.sh 
to create an empty script called secondaryMonitor.sh. Inside that file:

Code: Select all

#!/usr/bin/env sh
#forces resolution on 2nd monitor
xrandr --newmode "Mode 9" 148.500 1920 2008 2052 2200 1080 1084 1089 1125 +hsync +vsync
xrandr --addmode HDMI-A-0 "Mode 9"
xrandr --output HDMI-A-0 --mode "Mode 9"
xrandr is a command to configure displays
--newmode creates a new configuration (a mode) called mode 9. The numbers specify resolution/refresh rates/etc and the +hsync/+vsync are flags for vertical and horizontal syncronisation. To generate this line you can use cvt X Y refesh rate e.g.

Code: Select all

cvt 1920 1080 60
but I grabbed mine from my faulty edid.
--addmode tells xrandr that the config we just made can be used on a specific monitor, in this case HDMI-A-0
--output tells that monitor to use that config.

Then allow this code to be executed and check it works

Code: Select all

sudo chmod +x /etc/secondaryMonitor.sh
sudo /etc/secondaryMonitor.sh
.
Finally use add it to startup applications from the taskbar (bottom left, type startup applications, add command /etc/secondaryMonitor.sh. I had to add a 1 second delay.

This still has a strange resolution on the login page, but otherwise works.
Below I'll list some of the things I tried/came across while troubleshooting, in the hope they help someone.
Last edited by CannockChase on Sat Mar 19, 2022 8:16 pm, edited 2 times in total.
CannockChase
Level 1
Level 1
Posts: 6
Joined: Sat Jan 22, 2022 12:07 pm

Re: Secondary Monitor only detected on replug

Post by CannockChase »

Above is my solution, these are just some of the things I came across on my way there.

Was clear from

Code: Select all

xrandr --verbose
that the problem was with the EDID, the information about a monitor that should be sent down the HDMI cable. This could have been a fault with the cable, but I tried several, including a brand new one. I installed read-edid to find more information -

Code: Select all

get-edid | parse-edid

Code: Select all

Attempting to use i2c interface
No EDID on bus 1
No EDID on bus 2
No EDID on bus 3
No EDID on bus 4
No EDID on bus 6
No EDID on bus 8
No EDID on bus 9
3 potential busses found: 0 5 7
Will scan through until the first EDID is found.
Pass a bus number as an option to this program to go only for that one.
Bus 0 doesn't really have an EDID...
256-byte EDID successfully retrieved from i2c bus 5
Looks like i2c was successful. Have a good day.
WARNING: Checksum failed
Trying to continue...
Section "Monitor"
	Identifier "LCD TV"
	ModelName "LCD TV"
	VendorName "___"
	# Monitor Manufactured week 1 of 2008
	# EDID version 1.3
	# Digital Display
	DisplaySize 1600 900
	Gamma 2.20
	Option "DPMS" "false"
	Horizsync 14-68
	VertRefresh 48-62
	# Maximum pixel clock is 150MHz
	#Not giving standard mode: 640x480, 60Hz
	#Not giving standard mode: 800x600, 60Hz
	#Not giving standard mode: 1024x768, 60Hz
	#Not giving standard mode: 1280x1024, 60Hz

	#Extension block found. Parsing...
	Modeline 	"Mode 2" 25.200 640 656 752 800 480 490 492 525 -hsync -vsync
	Modeline 	"Mode 0" 86.00 1360 1424 1536 1792 768 771 777 795 +hsync +vsync 
	Modeline 	"Mode 1" 75.00 1280 1390 1430 1650 720 725 730 750 +hsync +vsync 
	Modeline 	"Mode 3" 27.027 720 736 798 858 480 489 495 525 -hsync -vsync
	Modeline 	"Mode 4" 27.027 720 736 798 858 480 489 495 525 -hsync -vsync
	Modeline 	"Mode 5" 74.250 1280 1390 1420 1650 720 725 730 750 +hsync +vsync
	Modeline 	"Mode 6" 74.250 1920 2008 2052 2200 1080 1082 1087 1125 +hsync +vsync interlace
	Modeline 	"Mode 7" 27.027 1440 1478 1602 1716 480 484 487 525 -hsync -vsync interlace
	Modeline 	"Mode 8" 27.027 1440 1478 1602 1716 480 484 487 525 -hsync -vsync interlace
	Modeline 	"Mode 9" 148.500 1920 2008 2052 2200 1080 1084 1089 1125 +hsync +vsync
	Modeline 	"Mode 10" 27.000 720 732 796 864 576 581 586 625 -hsync -vsync
	Modeline 	"Mode 11" 27.000 720 732 796 864 576 581 586 625 -hsync -vsync
	Modeline 	"Mode 12" 74.250 1280 1720 1760 1980 720 725 730 750 +hsync +vsync
	Modeline 	"Mode 13" 74.250 1920 2448 2492 2640 1080 1082 1089 1125 +hsync +vsync interlace
	Modeline 	"Mode 14" 27.000 1440 1464 1590 1728 576 578 581 625 -hsync -vsync interlace
	Modeline 	"Mode 15" 27.000 1440 1464 1590 1728 576 578 581 625 -hsync -vsync interlace
	Modeline 	"Mode 16" 148.500 1920 2448 2492 2640 1080 1084 1089 1125 +hsync +vsync
	Modeline 	"Mode 17" 74.25 1920 2448 2492 2640 540 542 547 562 +hsync +vsync interlace
	Modeline 	"Mode 18" 74.25 1920 2008 2052 2200 540 542 547 562 -hsync -vsync interlace
	Modeline 	"Mode 19" 74.25 1280 1720 1760 1980 720 725 730 750 +hsync +vsync 
	Modeline 	"Mode 20" 148.50 1920 2448 2492 2640 1080 1084 1089 1125 +hsync +vsync 
	Option "PreferredMode" "Mode 2"
EndSection
Which confirms some of the EDID is received, but that the checksum failed. I tried to to force it to use the EDID from my similar other monitor by adding a xorg.conf file to /usr/share/X11/xorg.conf.d, with option "CustomEDID" "HDMI-A-0:/etc/X11//your_edid.bin" in the device sectionhttps://askubuntu.com/questions/789513/ ... iding-edid. However /var/log/Xorg.0.log it showed that amdgpu driver does not use this option. I moved on to getting it to run at boot with a command added to /etc/default/grub

Code: Select all

GRUB_CMDLINE_LINUX_DEFAULT="drm.edid_firmware=HDMI-A-0:/edid/your_edid.bin"
(required some messing with initramfs, see viewtopic.php?f=59&t=369032&p=2148192&h ... d#p2148192

Or force it to ignore EDID

Code: Select all

GRUB_CMDLINE_LINUX_DEFAULT="video=HDMI-A-0:1920x1080@60,noedid"
(run sudo update-grub after both of these)

Both were not fruitful, but did notice error about EDID at boot. Found them using dmesg.

Code: Select all

[drm:dc_link_detect_helper [amdgpu]] *ERROR* No EDID read.
[drm:dc_link_detect_helper [amdgpu]] *ERROR* EDID checksum invalid.
It appears to be a known issue with AMD gpus and some monitors https://bugzilla.kernel.org/show_bug.cgi?id=201497.

I then decided to use a xrandr script as in the previous post. I thought it would be best to have this run as early as possible, so i created /etc/systemd/system/secondaryMonitor.service

Code: Select all

[Unit]
Description=Force secondary monitor resolution

[Service]
Type=oneshot
ExecStart=/etc/secondaryMonitor.sh
User=root
Group=root
SuccessExitStatus=0 1

[Install]
WantedBy=multi-user.target

Code: Select all

sudo systemctl enable secondaryMonitor
sudo systemctl start secondaryMonitor
Which didn't work, but I found evidence of it being executed, perhaps too early.

Then I tried adding the script as /etc/X11/Xsession.d/99secondaryMonitor, to run as soon as xwindows started. This also didn't work and I settled on the above method.

I hope someone finds this useful, or even better, tells me how I should have done this.
User avatar
SMG
Level 25
Level 25
Posts: 31307
Joined: Sun Jul 26, 2020 6:15 pm
Location: USA

Re: Secondary Monitor only detected on replug

Post by SMG »

CannockChase wrote: Sun Mar 13, 2022 12:07 pmI've eventually found a workaround which I'll post below.
Many people use xrandr commands and usually just add those few lines to the .profile file (a hidden file in the home directory). Creating a separate script also works.

The info you mentioned is also in this topic New kernel doesn't recognize monitor SOLVED. That topic also includes how you can add it before login so the login screen resolution is correct. However, you mentioned a need for a one second delay? I'm not sure why that is needed, but that might affect adding the resolution prior to login.
Image
A woman typing on a laptop with LM20.3 Cinnamon.
CannockChase
Level 1
Level 1
Posts: 6
Joined: Sat Jan 22, 2022 12:07 pm

Re: Secondary Monitor only detected on replug

Post by CannockChase »

The post you linked did the trick for me. Is there an 'official' way to mark this as solved or should I just append SOLVED to the title?

Thanks very much for your help here, it's nice to get such a warm welcome. Really makes me want to do the same when I have a bit more experience.
User avatar
SMG
Level 25
Level 25
Posts: 31307
Joined: Sun Jul 26, 2020 6:15 pm
Location: USA

Re: Secondary Monitor only detected on replug

Post by SMG »

CannockChase wrote: Wed Mar 16, 2022 11:52 am The post you linked did the trick for me. Is there an 'official' way to mark this as solved or should I just append SOLVED to the title?
Glad that helped.
The official way to mark it solved is to go to your very first post in this topic, click the pencil icon, and add [SOLVED] to the beginning of the title.
Image
A woman typing on a laptop with LM20.3 Cinnamon.
Locked

Return to “Graphics Cards & Monitors”