Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

RPi4 KMS: console only displayed on HDMI1 when two displays are connected #4540

Closed
HiassofT opened this issue Aug 22, 2021 · 9 comments
Closed

Comments

@HiassofT
Copy link
Contributor

When booting RPiOS lite on RPi4 with two 1920x1200 monitors connected the linux console is only displayed on HDMI1 if kms is used.

The monitor on HDMI0 receives a proper (1920x1200@60) signal, but the screen is blank.

Running "modetest" or switching VTs makes the console visible on HDMI0, too.

When booting with drm.debug=0x1f or drm.debug=0x14 the issue didn't show up, so it might be a timing issue or race. Testing without drm.debug or with drm.debug=0x04 reliably showed the issue across multiple reboots and cold boots.

System: RPiOS lite, 32bit running kernel 5.10.60 (commit 2dd846f, bcm2711_defconfig) and Aug 19 firmware

root@raspberrypi:~# uname -a
Linux raspberrypi 5.10.60-v7l+ #1 SMP Sun Aug 22 11:02:45 CEST 2021 armv7l GNU/Linux
root@raspberrypi:~# vcgencmd version
Aug 19 2021 12:27:01 
Copyright (c) 2012 Broadcom
version ef2c018dccdeb94b0376db62a2ea4c882f9b500d (clean) (release) (start)

dmesg with drm.debug=0x04: http://ix.io/3wEC

ping @mripard

@HiassofT
Copy link
Contributor Author

HiassofT commented Aug 22, 2021

I checked through rpi-update firmwares/kernels, up to (and including) the Jul 5 Hexxeh/rpi-firmware@9dbcd6d version it worked fine, the console was displayed on both monitors.

Jul 9 Hexxeh/rpi-firmware@6d1196a up to (and including) Jul 22 Hexxeh/rpi-firmware@1fad1d2 versions locked up during boot when loading the KMS driver if I had 2 monitors connected.

Jul 27 Hexxeh/rpi-firmware@b986fda version booted and had the described issue.

Edit: fixed firmware githash/links

@mripard
Copy link
Contributor

mripard commented Aug 23, 2021

It seems like it's related to the console setup on the kernel command line.

There's several case:

  • No console option -> fbcon on HDMI1 only
  • console=tty1 -> fbcon on HDMI1 only
  • console=ttyAMA0 -> fbcon on HDMI0 and HDMI1
  • console=tty1 console=ttyAMA0 -> fbcon on HDMI0 and HDMI1

It seems like it's related to what the fbdev emulation in KMS is using as framebuffer, but I'm not really clear on why it's changing that decision based on console at the moment.

@mripard
Copy link
Contributor

mripard commented Aug 25, 2021

It's a bit weird, the DRM framework does enable both controllers properly, and yet one is indeed not working. I can't figure out an obvious cause for this, I'll try to bisect it with the commits you pointed, thanks!

@mripard
Copy link
Contributor

mripard commented Sep 9, 2021

I bisected it this morning, and it seems to be another fallout from #4421 . Removing the firmware node in the device tree makes it all work again for some reason, just like #4493.

I started to have a look at what could be the difference. The clock rates are the same, but maybe it's due to some delays missing somewhere. Interestingly, it looks like if one reboots a board / kernel with that bug, the framebuffer is briefly shown before rebooting.

@popcornmix
Copy link
Collaborator

For me this is working on latest 5.10 and 5.15 kernel trees.
I have RPiOS set to boot to console and with two displays connected and both consoles are visible (showing mirrored framebuffer).
Starting X works as expected.

$ kmsprint 
Connector 0 (32) HDMI-A-1 (connected)
  Encoder 0 (31) TMDS
    Crtc 3 (76) 3840x2160@30.00 297.000 3840/176/88/296/+ 2160/8/10/72/+ 30 (30.00) 0x5 0x60
      Plane 3 (70) fb-id: 225 (crtcs: 3) 0,0 3840x2160 -> 0,0 3840x2160 (XR24 AR24 AB24 XB24 RG16 BG16 AR15 XR15 RG24 BG24 YU16 YV16 YU12 YV12 NV12 NV21 NV16 NV61 P030)
        FB 225 3840x2160
Connector 1 (40) HDMI-A-2 (connected)
  Encoder 1 (39) TMDS
    Crtc 4 (83) 1920x1080@60.00 148.500 1920/88/44/148/+ 1080/4/5/36/+ 60 (60.00) 0x5 0x68
      Plane 4 (77) fb-id: 225 (crtcs: 4) 0,0 1920x1080 -> 0,0 1920x1080 (XR24 AR24 AB24 XB24 RG16 BG16 AR15 XR15 RG24 BG24 YU16 YV16 YU12 YV12 NV12 NV21 NV16 NV61 P030)
        FB 225 3840x2160

But from the sound of it, it's just a race condition (if debug level changes behaviour) so may be hard to reproduce reliably.

@popcornmix
Copy link
Collaborator

Forcing both monitors to 1920x1200@60 didn't change.
force_turbo=1 did make one display not show.
Grabbing debug registers for good and bad case shows:
SCALER_DISPLIST0 = 0x00000000 bad
SCALER_DISPLIST0 = 0x00000044 good
and (bad)
HVS chan 0: dlist: 00: 0x80000000
shows one display is going to be blank.
Need to confirm if arm didn't set SCALER_DISPLIST0 = 0x00000044 in bad case,
or perhaps it set it and firmware reset it when second display's SET_NOTIFY_DISPLAY_DONE comes through.
(I was expecting a second call to be ignored, but it might explain a racy failure).

@popcornmix
Copy link
Collaborator

I have confirmed the issue.
The second SET_NOTIFY_DISPLAY_DONE doesn't result in any writes to hvs hardware,
but there is still a single ISR that occurs after the call mailbox call returns and writes to SCALER_DISPLIST0.

The code looks like it should block until that occurs, but isn't behaving as desired.

popcornmix added a commit to raspberrypi/firmware that referenced this issue Sep 21, 2021
firmware: arm_display: Allow null buffer in successful call
See: raspberrypi/linux#4540
popcornmix added a commit to Hexxeh/rpi-firmware that referenced this issue Sep 21, 2021
firmware: arm_display: Allow null buffer in successful call
See: raspberrypi/linux#4540
@popcornmix
Copy link
Collaborator

@HiassofT I've pushed firmware with a fix. Would be good if you can test and report.

@HiassofT
Copy link
Contributor Author

Thanks, it worked fine here in my tests!

mkreisl added a commit to xbianonpi/xbian-package-firmware that referenced this issue Dec 3, 2021
- firmware: isp: Fix handling of different YUV colour spaces

- firmware: poe_hat: Actually close the I2C handle

- firmware: platform: Define DVFS modes and change default to be fixed AVS voltage

- firmware: arm_loader: Auto-select 64-bit for kernel8.img
  See: #1193

- firmware: hdmi: Throttle auto-i2c register writes to avoid PWM audio underrun

- firmware: platform: Define DVFS modes and change default to be fixed AVS voltage

- firmware: arm_loader: Auto-select 64-bit for kernel8.img
  See: #1193

- firmware: hdmi: Throttle auto-i2c register writes to avoid PWM audio underrun

- firmware: video_decode lockup handling

- firmware: isp: Initialise extras to avoid vpitch being random

- firmware: usb: Fix dropouts with USB ethernet gadget
  See: raspberrypi/linux#4084

- firmware: imx477: Allow long exposures for the binned modes.
  See: https://www.raspberrypi.org/forums/viewtopic.php?f=43&t=297521

- firmware: arm_dispmanx: Use ALPHA_MIX flag
  See: https://www.raspberrypi.org/forums/viewtopic.php?t=300769

- firmware: power: Refactor the interface to the PMICs

- firmware: platform: vl805: Get BAR2 address from PCIe BAR2 registers

- firmware: arm_loader: Return all borrowed DMA channels
  See: #1541

- firmware: hdmi_2711: Rework I2C driver to NOT use the AUTO-I2C block

- firmware: gencmd: Allow groups of clocks/plls to be read together

- firmware: power: Fix DA9090 under-voltage detection

- firmware: NVME boot support

- firmware: brfs: Fix USB bulk-read in start.elf
  See: Hexxeh/rpi-firmware#258

- firmware: hdmi_2711_i2c: Correct handling of start/stop codes for long read
  See: #1548

- firmware: video_decode: For VC1/WMV with no signalled header bytes, use start of 1st buffer
  See: raspberrypi/linux#4113

- firmware: vl805: Remove redundant log statement and fix warning

- firmware: power: Fix DA9090 ADC1 register definition

- firmware: arm_loader: Only report clocks arm has set, not siblings

- firmware: arm_loader: Don't report clocks set as turbo side effect of arm clock

- firmware: arm_loader: 2711: gpu clocks are not dependant

- firmware: platform: Need to clear cached versions of get_max_clock_internal vars

- firmware: Move core to PLLA and support accurate clk108
  See: xbmc/xbmc#19263

- firmware: board_info: Separate memory size from OTP field encoding

- firmware: power: Swap DA9090 ADC assignments to match XR77004

- firmware: board-info: Fix memsize on 3B+

- firmware: vcfw/power: Add a new latch for power_pad_control
  See: #1552

- firmware: arm_loader: kernel_old=1 should force kernel_address=0
  See: #1561

- firmware: scalerlib: Fix offset applied to x coordinate of YUV10COL image
  See: https://forum.kodi.tv/showthread.php?tid=361164&pid=3024654#pid3024654

- firmware: isp: Ensure the VRF is locked when setting up video colour denoise
  See: raspberrypi/rpicam-apps#19

- firmware: isp: Remove custom EV mappings from camera tunings

- firmware: Add support for board-type=0xXX conditional filters in bootloader, bootcode and firmware

- firmware: Two UART1 patches
  See: #1566

- firmware: Pi400: Reduce MII clock freq when probing ethernet PHY

- firmware: platform: Remove build-time constant for MICROVOLTS_PER_PIP

- firmware: dt-blob.dts: Correct HDMI HPD and EMMC_ENABLE for CM4
  See: https://www.raspberrypi.org/forums/viewtopic.php?f=29&p=1858516

- firmware: vcfw/hdmi: CUSTOM modes used for FKMS didn't set RGB quant range correctly
  See: #1580

- firmware: PoE+ HAT support
  See: raspberrypi/linux#4367

- firmware: arm_loader: Use Pi4 bootloader MAC_ADDRESS if set

- firmware: platform: Apply ARM thermal throttling rules on BCM2711

- firmware: bcm_host: Recognise all Pi 4 variants, add BCM2711
  See: raspberrypi/userland#695

- firmware: video_decode: Use the ISP instead of vc_image_convert

- firmware: hdmi-2711: Wait for HDMI hardware scheduler to activate in HDMI mode

- arm_loader: Add message to release firmware framebuffer

- firmware: arm_loader: Add rng-seed DT property
  See: #1595

- firmware: isp: Set the YUV420/YVU420 format stride to 64 byte

- firmware: Revert: video_decode: Use the ISP instead of vc_image_convert

- firmware: cec: Avoid sending messages with kms
  See: raspberrypi/linux#4460

- firmware: hdmi_cec: Remove TX/RX SW_INIT on power_on
  See: Hexxeh/rpi-firmware#267
  See: https://www.raspberrypi.org/forums/viewtopic.php?p=1895082#p1895082

- firmware: arm_dt: Limit CMA to 256MB if total_mem < 2GB or gpu_mem > 256MB
  See: #1603

- firmware: video_decode: Use the ISP instead of vc_image_convert

- firmware: video_decode: Correct support for YVU formats using ISP

- firmware: firmware: Disable VLL loading from file system
  See: #1605

- firmware: arm_loader: Make most arm clock requests required
  See: #1598

- firmware: arm_loader: Consider required flags from GET_CLOCK_RATE
  See: #1598

- firmware: arm_dt: Load overlays for detected cameras

- firmware: Make more use of the user-warnings DT property

- firmware: hdmi_2711: Use HDMI block REPEAT_PIXEL instead of PV
  See: https://forum.libreelec.tv/thread/24415-le-10-beta-for-i4-force-hdmi-resolution

- firmware: DSI display autodetection for kms

- firmware: arm_loader: Allow hvs interrupt during SET_NOTIFY_DISPLAY_DONE

- firmware: arm_display: Allow null buffer in successful call
  See: raspberrypi/linux#4540

- firmware: video_decode: Ensure all buffers are flushed before port disable completes

- firmware: filesystem: sdcard: Fix Hybrid GPT partitions
  See: #1465

- firmware: tvservice: Add check to warn when running with kms

- firmware: arm_loader: Allow non-optional reads of current clock
  See: #1619

- firmware: dispmanx: Demote null eptr from vcos_verify to no warning
  See: raspberrypi/linux#4592

- firmware: filesystem: sdcard: Probe FAT type in GPT ESD partitions

- firmware: clock-2711: Limit PLLB VCO frequency to the high range

- firmware: arm_dt: Export the boot-mode, partition and usb state via device-tree
  See: #1621

- firmware: video_decode: i/p port enable/disable without o/p active could stall
  See: RPi-Distro/vlc#48
  See: Hexxeh/rpi-firmware#272
  See: #1637

- firmware: userland: Reduce debug_sym error messages
  See: https://forums.raspberrypi.com/viewtopic.php?f=98&t=322238

- firmware: arm_dt: Increase maximum line length to 98
  See: raspberrypi/linux#4638

- firmware: arm_loader: Allow VEC clock to be controlled by arm

- firmware: platform: Remove licence on VP6, VP8, Theora, and FLAC
  See: raspberrypi/linux#4661

- firmware: ISP: Fix magenta colour in right hand image of stereo pair
  See: https://forums.raspberrypi.com/viewtopic.php?t=321089

- firmware: platform: Fix incorrect turbo voltage scaling on Pi0
  See: raspberrypi/documentation#2255

- firmware: platform: Declare CM4's SIO_1V8_SEL and SD_PWR_ON
  See: raspberrypi/Raspberry-Pi-OS-64bit#188

- firmware: hello_fft: Update outdated link to V3D spec

- firmware: hello_fft: Remove unused function declaration
  See: #1645
  See: raspberrypi/userland#710

- firmware: dtoverlay: Rebase aliases in overlays like labels

- firmware: isp: Set core/vpu min clock to 320Mhz during ISP operation

- firmware: arm_loader: Enable watchdog early if wanted
  See: #1651

- firmware: board_info: Add upstream dtb names for cm1 & 3

- firmware: board_info: Add upstream dtb name for cm4
  See: #1660

- firmware: platform: Allow users to disable camera boot HMAC check
  See: #1657

- firmware: clock: 2711: Fix potential API issue in 2711 VCO setup

- firmware: arm_loader: Enable USB MSD boot mode on Zero 2 W

- firmware: isp: Fix Rec.709 colour space problems
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants