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

RPI4B 64bit vc4-kms-v3d blank screen during post #5195

Closed
JerryK13 opened this issue Oct 3, 2022 · 30 comments
Closed

RPI4B 64bit vc4-kms-v3d blank screen during post #5195

JerryK13 opened this issue Oct 3, 2022 · 30 comments

Comments

@JerryK13
Copy link

JerryK13 commented Oct 3, 2022

Describe the bug

On a fresh Raspberry Pi OS Lite 64bit (September 22nd 2022) and also rpi-updated to ed6ef1c57077cc3969ae62a4bd9dc1abe5e2a7b7 (kernel 5.15.70-v8+) using the default vc4-kms-v3d the display turns blank during post on two different displays while vc4-fkms-v3d works as intended.

The first display is a Samsung 2494HM monitor

base64 /sys/devices/platform/gpu/drm/card1/card1-HDMI-A-1/edid

AP///////wBMLdUEAAAAACATAQOAEAl4KmBBplZKnCUSUFQjCACpQIGAgUCBAJUAswABAQEBAjqA
GHE4LUBYLEUAoFoAAAAeAR2AGHEcFiBYLCUAoFoAAACeAAAA/QAyPBtREQAKICAgICAgAAAA/ABT
eW5jTWFzdGVyCiAgAboCAxzxSJAfBRQEEwMSIwkHB4MBAABmAwwAEACAAR0AclHQHiBuKFUAoFoA
AAAeAR0AvFLQHiC4KFVAoFoAAAAejArQkCBAMSAMQFUAoFoAAAAYAR2A0HIcFiAQLCWAoFoAAACe
jArQiiDgLRAQPpYAoFoAAAAYAAAAAAAAAAAADg==

edid-decode output:

edid-decode (hex):

00 ff ff ff ff ff ff 00 4c 2d d5 04 00 00 00 00
20 13 01 03 80 10 09 78 2a 60 41 a6 56 4a 9c 25
12 50 54 23 08 00 a9 40 81 80 81 40 81 00 95 00
b3 00 01 01 01 01 02 3a 80 18 71 38 2d 40 58 2c
45 00 a0 5a 00 00 00 1e 01 1d 80 18 71 1c 16 20
58 2c 25 00 a0 5a 00 00 00 9e 00 00 00 fd 00 32
3c 1b 51 11 00 0a 20 20 20 20 20 20 00 00 00 fc
00 53 79 6e 63 4d 61 73 74 65 72 0a 20 20 01 ba

02 03 1c f1 48 90 1f 05 14 04 13 03 12 23 09 07
07 83 01 00 00 66 03 0c 00 10 00 80 01 1d 00 72
51 d0 1e 20 6e 28 55 00 a0 5a 00 00 00 1e 01 1d
00 bc 52 d0 1e 20 b8 28 55 40 a0 5a 00 00 00 1e
8c 0a d0 90 20 40 31 20 0c 40 55 00 a0 5a 00 00
00 18 01 1d 80 d0 72 1c 16 20 10 2c 25 80 a0 5a
00 00 00 9e 8c 0a d0 8a 20 e0 2d 10 10 3e 96 00
a0 5a 00 00 00 18 00 00 00 00 00 00 00 00 00 0e

----------------

Block 0, Base EDID:
  EDID Structure Version & Revision: 1.3
  Vendor & Product Identification:
    Manufacturer: SAM
    Model: 1237
    Made in: week 32 of 2009
  Basic Display Parameters & Features:
    Digital display
    Maximum image size: 16 cm x 9 cm
    Gamma: 2.20
    DPMS levels: Off
    RGB color display
    First detailed timing is the preferred timing
  Color Characteristics:
    Red  : 0.6494, 0.3378
    Green: 0.2890, 0.6093
    Blue : 0.1455, 0.0703
    White: 0.3125, 0.3291
  Established Timings I & II:
    DMT 0x04:   640x480    59.940476 Hz   4:3     31.469 kHz     25.175000 MHz
    DMT 0x08:   800x600    56.250000 Hz   4:3     35.156 kHz     36.000000 MHz
    DMT 0x09:   800x600    60.316541 Hz   4:3     37.879 kHz     40.000000 MHz
    DMT 0x10:  1024x768    60.003840 Hz   4:3     48.363 kHz     65.000000 MHz
  Standard Timings:
    DMT 0x33:  1600x1200   60.000000 Hz   4:3     75.000 kHz    162.000000 MHz
    DMT 0x23:  1280x1024   60.019740 Hz   5:4     63.981 kHz    108.000000 MHz
    DMT 0x20:  1280x960    60.000000 Hz   4:3     60.000 kHz    108.000000 MHz
    DMT 0x1c:  1280x800    59.810326 Hz  16:10    49.702 kHz     83.500000 MHz
    DMT 0x2f:  1440x900    59.887445 Hz  16:10    55.935 kHz    106.500000 MHz
    DMT 0x3a:  1680x1050   59.954250 Hz  16:10    65.290 kHz    146.250000 MHz
  Detailed Timing Descriptors:
    DTD 1:  1920x1080   60.000000 Hz  16:9     67.500 kHz    148.500000 MHz (160 mm x 90 mm)
                 Hfront   88 Hsync  44 Hback  148 Hpol P
                 Vfront    4 Vsync   5 Vback   36 Vpol P
    DTD 2:  1920x1080i  60.000000 Hz  16:9     33.750 kHz     74.250000 MHz (160 mm x 90 mm)
                 Hfront   88 Hsync  44 Hback  148 Hpol P
                 Vfront    2 Vsync   5 Vback   15 Vpol P Vfront +0.5 Odd Field
                 Vfront    2 Vsync   5 Vback   15 Vpol P Vback  +0.5 Even Field
    Display Range Limits:
      Monitor ranges (GTF): 50-60 Hz V, 27-81 kHz H, max dotclock 170 MHz
    Display Product Name: 'SyncMaster'
  Extension blocks: 1
Checksum: 0xba

----------------

Block 1, CTA-861 Extension Block:
  Revision: 3
  Underscans IT Video Formats by default
  Basic audio support
  Supports YCbCr 4:4:4
  Supports YCbCr 4:2:2
  Native detailed modes: 1
  Video Data Block:
    VIC  16:  1920x1080   60.000000 Hz  16:9     67.500 kHz    148.500000 MHz (native)
    VIC  31:  1920x1080   50.000000 Hz  16:9     56.250 kHz    148.500000 MHz
    VIC   5:  1920x1080i  60.000000 Hz  16:9     33.750 kHz     74.250000 MHz
    VIC  20:  1920x1080i  50.000000 Hz  16:9     28.125 kHz     74.250000 MHz
    VIC   4:  1280x720    60.000000 Hz  16:9     45.000 kHz     74.250000 MHz
    VIC  19:  1280x720    50.000000 Hz  16:9     37.500 kHz     74.250000 MHz
    VIC   3:   720x480    59.940060 Hz  16:9     31.469 kHz     27.000000 MHz
    VIC  18:   720x576    50.000000 Hz  16:9     31.250 kHz     27.000000 MHz
  Audio Data Block:
    Linear PCM:
      Max channels: 2
      Supported sample rates (kHz): 48 44.1 32
      Supported sample sizes (bits): 24 20 16
  Speaker Allocation Data Block:
    FL/FR - Front Left/Right
  Vendor-Specific Data Block (HDMI), OUI 00-0C-03:
    Source physical address: 1.0.0.0
    Supports_AI
  Detailed Timing Descriptors:
    DTD 3:  1280x720    60.000000 Hz  16:9     45.000 kHz     74.250000 MHz (160 mm x 90 mm)
                 Hfront  110 Hsync  40 Hback  220 Hpol P
                 Vfront    5 Vsync   5 Vback   20 Vpol P
    DTD 4:  1280x720    50.000000 Hz  16:9     37.500 kHz     74.250000 MHz (160 mm x 90 mm)
                 Hfront  440 Hsync  40 Hback  220 Hpol P
                 Vfront    5 Vsync   5 Vback   20 Vpol P
    DTD 5:   720x576    50.000000 Hz   5:4     31.250 kHz     27.000000 MHz (160 mm x 90 mm)
                 Hfront   12 Hsync  64 Hback   68 Hpol N
                 Vfront    5 Vsync   5 Vback   39 Vpol N
    DTD 6:  1920x1080i  50.000000 Hz  16:9     28.125 kHz     74.250000 MHz (160 mm x 90 mm)
                 Hfront  528 Hsync  44 Hback  148 Hpol P
                 Vfront    2 Vsync   5 Vback   15 Vpol P Vfront +0.5 Odd Field
                 Vfront    2 Vsync   5 Vback   15 Vpol P Vback  +0.5 Even Field
    DTD 7:   720x480    59.940060 Hz   3:2     31.469 kHz     27.000000 MHz (160 mm x 90 mm)
                 Hfront   16 Hsync  62 Hback   60 Hpol N
                 Vfront    9 Vsync   6 Vback   30 Vpol N
Checksum: 0x0e  Unused space in Extension Block: 9 bytes

Switching source or unplugging/plugging the HDMI cable on this display does nothing. However if I unplug the display power cable and plug it back, the display comes to life. After that, the sound is not working, unless I put the snd_bcm2835.enable_hdmi=1 snd_bcm2835.enable_headphones=1 snd_bcm2835.enable_compat_alsa=0 in cmdline.txt. I am attaching kern.log with the events
kernmonitor.log

The second display is a LG 42LM3400-ZA TV

base64 /sys/devices/platform/gpu/drm/card1/card1-HDMI-A-1/edid

AP///////wAebQEAAQEBAQEWAQOAoFp4Cu6Ro1RMmSYPUFShCAAxQEVAYUBxQIGAAQEBAQEBAjqA
GHE4LUBYLEUAoFoAAAAeZiFQsFEAGzBAcDYAoFoAAAAeAAAA/QA6Ph5TEAAKICAgICAgAAAA/ABM
RyBUVgogICAgICAgAUMCAzPxThCfBBMFFAMCEiAhIhUBJhUHUAlXB3gDDAAgAIAeIMAOAUAKDwgQ
GBCYEFgQOBABHYAYcRwWIFgsJQAgwjEAAJ4BHQByUdAeIG4oVQAgwjEAAB4COoAYcTgtQFgsRQCg
WgAAAB4BHQC8UtAeILgoVUDEjiEAAB4AAAAAEw==

edid-decode output:

edid-decode (hex):

00 ff ff ff ff ff ff 00 1e 6d 01 00 01 01 01 01
01 16 01 03 80 a0 5a 78 0a ee 91 a3 54 4c 99 26
0f 50 54 a1 08 00 31 40 45 40 61 40 71 40 81 80
01 01 01 01 01 01 02 3a 80 18 71 38 2d 40 58 2c
45 00 a0 5a 00 00 00 1e 66 21 50 b0 51 00 1b 30
40 70 36 00 a0 5a 00 00 00 1e 00 00 00 fd 00 3a
3e 1e 53 10 00 0a 20 20 20 20 20 20 00 00 00 fc
00 4c 47 20 54 56 0a 20 20 20 20 20 20 20 01 43

02 03 33 f1 4e 10 9f 04 13 05 14 03 02 12 20 21
22 15 01 26 15 07 50 09 57 07 78 03 0c 00 20 00
80 1e 20 c0 0e 01 40 0a 0f 08 10 18 10 98 10 58
10 38 10 01 1d 80 18 71 1c 16 20 58 2c 25 00 20
c2 31 00 00 9e 01 1d 00 72 51 d0 1e 20 6e 28 55
00 20 c2 31 00 00 1e 02 3a 80 18 71 38 2d 40 58
2c 45 00 a0 5a 00 00 00 1e 01 1d 00 bc 52 d0 1e
20 b8 28 55 40 c4 8e 21 00 00 1e 00 00 00 00 13

----------------

Block 0, Base EDID:
  EDID Structure Version & Revision: 1.3
  Vendor & Product Identification:
    Manufacturer: GSM
    Model: 1
    Serial Number: 16843009
    Made in: week 1 of 2012
  Basic Display Parameters & Features:
    Digital display
    Maximum image size: 160 cm x 90 cm
    Gamma: 2.20
    RGB color display
    First detailed timing is the preferred timing
  Color Characteristics:
    Red  : 0.6396, 0.3300
    Green: 0.2998, 0.5996
    Blue : 0.1503, 0.0595
    White: 0.3125, 0.3291
  Established Timings I & II:
    IBM     :   720x400    70.081663 Hz   9:5     31.467 kHz     28.320000 MHz
    DMT 0x04:   640x480    59.940476 Hz   4:3     31.469 kHz     25.175000 MHz
    DMT 0x09:   800x600    60.316541 Hz   4:3     37.879 kHz     40.000000 MHz
    DMT 0x10:  1024x768    60.003840 Hz   4:3     48.363 kHz     65.000000 MHz
  Standard Timings:
    DMT 0x04:   640x480    59.940476 Hz   4:3     31.469 kHz     25.175000 MHz
    DMT 0x09:   800x600    60.316541 Hz   4:3     37.879 kHz     40.000000 MHz
    DMT 0x10:  1024x768    60.003840 Hz   4:3     48.363 kHz     65.000000 MHz
    GTF     :  1152x864    60.000000 Hz   4:3     53.700 kHz     81.624000 MHz
    DMT 0x23:  1280x1024   60.019740 Hz   5:4     63.981 kHz    108.000000 MHz
  Detailed Timing Descriptors:
    DTD 1:  1920x1080   60.000000 Hz  16:9     67.500 kHz    148.500000 MHz (160 mm x 90 mm)
                 Hfront   88 Hsync  44 Hback  148 Hpol P
                 Vfront    4 Vsync   5 Vback   36 Vpol P
    DTD 2:  1360x768    60.015162 Hz  85:48    47.712 kHz     85.500000 MHz (160 mm x 90 mm)
                 Hfront   64 Hsync 112 Hback  256 Hpol P
                 Vfront    3 Vsync   6 Vback   18 Vpol P
    Display Range Limits:
      Monitor ranges (GTF): 58-62 Hz V, 30-83 kHz H, max dotclock 160 MHz
    Display Product Name: 'LG TV'
  Extension blocks: 1
Checksum: 0x43
  
----------------
  
Block 1, CTA-861 Extension Block:
  Revision: 3
  Underscans IT Video Formats by default
  Basic audio support
  Supports YCbCr 4:4:4
  Supports YCbCr 4:2:2
  Native detailed modes: 1
  Video Data Block:
    VIC  16:  1920x1080   60.000000 Hz  16:9     67.500 kHz    148.500000 MHz
    VIC  31:  1920x1080   50.000000 Hz  16:9     56.250 kHz    148.500000 MHz (native)
    VIC   4:  1280x720    60.000000 Hz  16:9     45.000 kHz     74.250000 MHz
    VIC  19:  1280x720    50.000000 Hz  16:9     37.500 kHz     74.250000 MHz
    VIC   5:  1920x1080i  60.000000 Hz  16:9     33.750 kHz     74.250000 MHz
    VIC  20:  1920x1080i  50.000000 Hz  16:9     28.125 kHz     74.250000 MHz
    VIC   3:   720x480    59.940060 Hz  16:9     31.469 kHz     27.000000 MHz
    VIC   2:   720x480    59.940060 Hz   4:3     31.469 kHz     27.000000 MHz
    VIC  18:   720x576    50.000000 Hz  16:9     31.250 kHz     27.000000 MHz
    VIC  32:  1920x1080   24.000000 Hz  16:9     27.000 kHz     74.250000 MHz
    VIC  33:  1920x1080   25.000000 Hz  16:9     28.125 kHz     74.250000 MHz
    VIC  34:  1920x1080   30.000000 Hz  16:9     33.750 kHz     74.250000 MHz
    VIC  21:  1440x576i   50.000000 Hz   4:3     15.625 kHz     27.000000 MHz
    VIC   1:   640x480    59.940476 Hz   4:3     31.469 kHz     25.175000 MHz
  Audio Data Block:
    AC-3:
      Max channels: 6
      Supported sample rates (kHz): 48 44.1 32
      Maximum bit rate: 640 kb/s
    Linear PCM:
      Max channels: 2
      Supported sample rates (kHz): 192 96 48 44.1 32
      Supported sample sizes (bits): 24 20 16
  Vendor-Specific Data Block (HDMI), OUI 00-0C-03:
    Source physical address: 2.0.0.0
    Supports_AI
    Maximum TMDS clock: 150 MHz
    Extended HDMI video details:
      3D present
      3D-capable-VIC mask present
      3D: Side-by-side (half, horizontal)
      3D: Top-and-bottom
      3D VIC indices that support these capabilities:
        VIC  16:  1920x1080   60.000000 Hz  16:9     67.500 kHz    148.500000 MHz
        VIC  31:  1920x1080   50.000000 Hz  16:9     56.250 kHz    148.500000 MHz
        VIC   4:  1280x720    60.000000 Hz  16:9     45.000 kHz     74.250000 MHz
        VIC  19:  1280x720    50.000000 Hz  16:9     37.500 kHz     74.250000 MHz
        VIC  32:  1920x1080   24.000000 Hz  16:9     27.000 kHz     74.250000 MHz
        VIC  34:  1920x1080   30.000000 Hz  16:9     33.750 kHz     74.250000 MHz
      3D VIC indices with specific capabilities:
        VIC  16:  1920x1080   60.000000 Hz  16:9     67.500 kHz    148.500000 MHz (side-by-side, horizontal)
        VIC  31:  1920x1080   50.000000 Hz  16:9     56.250 kHz    148.500000 MHz (side-by-side, horizontal)
        VIC  32:  1920x1080   24.000000 Hz  16:9     27.000 kHz     74.250000 MHz (side-by-side, horizontal)
        VIC  20:  1920x1080i  50.000000 Hz  16:9     28.125 kHz     74.250000 MHz (side-by-side, horizontal)
        VIC  19:  1280x720    50.000000 Hz  16:9     37.500 kHz     74.250000 MHz (side-by-side, horizontal)
  Detailed Timing Descriptors:
    DTD 3:  1920x1080i  60.000000 Hz  16:9     33.750 kHz     74.250000 MHz (800 mm x 450 mm)
                 Hfront   88 Hsync  44 Hback  148 Hpol P
                 Vfront    2 Vsync   5 Vback   15 Vpol P Vfront +0.5 Odd Field
                 Vfront    2 Vsync   5 Vback   15 Vpol P Vback  +0.5 Even Field
    DTD 4:  1280x720    60.000000 Hz  16:9     45.000 kHz     74.250000 MHz (800 mm x 450 mm)
                 Hfront  110 Hsync  40 Hback  220 Hpol P
                 Vfront    5 Vsync   5 Vback   20 Vpol P
    DTD 5:  1920x1080   60.000000 Hz  16:9     67.500 kHz    148.500000 MHz (160 mm x 90 mm)
                 Hfront   88 Hsync  44 Hback  148 Hpol P
                 Vfront    4 Vsync   5 Vback   36 Vpol P
    DTD 6:  1280x720    50.000000 Hz  16:9     37.500 kHz     74.250000 MHz (708 mm x 398 mm)
                 Hfront  440 Hsync  40 Hback  220 Hpol P
                 Vfront    5 Vsync   5 Vback   20 Vpol P
Checksum: 0x13  Unused space in Extension Block: 4 bytes

On this display, just switching the source to something else then back brings it back to life. For the sound I haven't tested this one without entries in cmdline.txt. I am attaching kern.log of the events
kerntv.log

All logs, decodes and edids were obtained after switching source or power cycling the display.

Is there something obviously wrong with these edids? At least I would like to know what to modify and then load the modified edid via drm.edid_firmware.

Thank you!

@pelwell
Copy link
Contributor

pelwell commented Oct 3, 2022

This is not a firmware bug - moving to the Linux repo.

@pelwell pelwell transferred this issue from raspberrypi/firmware Oct 3, 2022
@popcornmix
Copy link
Collaborator

On a fresh Raspberry Pi OS Lite 64bit (September 22nd 2022) and also rpi-updated to ed6ef1c57077cc3969ae62a4bd9dc1abe5e2a7b7 (kernel 5.15.70-v8+) using the default vc4-kms-v3d the display turns blank during post on two different displays while vc4-fkms-v3d works as intended.

There are a few stages during boot where hdmi is output. Do you see output in some of them?

  1. bootloader outputs a diagnostic screen with white text and a raspberry in corner (this can be quite quick so monitor may not switch mode in time - removing sdcard will make it stay up permanently).
  2. start.elf outputs a rainbow square
  3. kernel stars boot using a simple framebuffer (created with firmware settings)
  4. kms driver is probed and takes over second half of boot (you'll see a screen clear here)
  5. X starts and may choose a new hdmi mode

Booting to desktop does hide some of the console output, so booting to console may be a simpler case to investigate.

@popcornmix
Copy link
Collaborator

popcornmix commented Oct 3, 2022

I've tested your edid on my Pi and it seems fine. I boot to console in 1920x1080@60 mode.
mode: "1920x1080": 60 148500 1920 2008 2052 2200 1080 1084 1089 1125 0x48 0x5

You could try capturing the edid:
sudo cp sys/devices/platform/gpu/drm/card1/card1-HDMI-A-1/edid /lib/firmware

and then use the captured edid and a specified mode. Add this to end of cmdline.txt (same line)
drm.edid_firmware=edid video=HDMI-A-1:1920x1080@60

Can you ssh in and run commands when display is blank?
I'd be interested in

base64 /sys/devices/platform/gpu/drm/card1/card1-HDMI-A-1/edid # it may be invalid before the switch

@JerryK13
Copy link
Author

JerryK13 commented Oct 3, 2022

Thank you for the reply.
None of the displays are fast enough to display the diagnostic screen. The rainbow screen is displayed and then the framebuffer. After switching to KMS, the displays go blank. My Pi is not configured to enter X/Wayland. I have however tried turning that on, to see if it makes any difference and it does not. Neither starting X nor Sway produce any visible output. I can however at anytime powercycle the monitor (or switch source on the TV) to get the picture working.
(just for the reference, If I use the obsolete FKMS, it does produce a clear but the picture is returned in a second.)

The first thing I tired, was capturing the monitor edid and loading it via cmdline.txt (with and without using the video attribute) but it hasn't worked (haven't tried on the TV yet).

I have now stored the edid (via SSH) while the monitor displayed blank (haven't tried the TV yet), and the edid is exactly the same as when power cycled:

AP///////wBMLdUEAAAAACATAQOAEAl4KmBBplZKnCUSUFQjCACpQIGAgUCBAJUAswABAQEBAjqA
GHE4LUBYLEUAoFoAAAAeAR2AGHEcFiBYLCUAoFoAAACeAAAA/QAyPBtREQAKICAgICAgAAAA/ABT
eW5jTWFzdGVyCiAgAboCAxzxSJAfBRQEEwMSIwkHB4MBAABmAwwAEACAAR0AclHQHiBuKFUAoFoA
AAAeAR0AvFLQHiC4KFVAoFoAAAAejArQkCBAMSAMQFUAoFoAAAAYAR2A0HIcFiAQLCWAoFoAAACe
jArQiiDgLRAQPpYAoFoAAAAYAAAAAAAAAAAADg==

Pressing the power button on the monitor also doesn't do it. I have to physically remove it's power.

@JerryK13
Copy link
Author

JerryK13 commented Oct 3, 2022

It is exactly the same on the TV. The /sys/devices/platform/gpu/drm/card1/card1-HDMI-A-1/edid is the same as after switching source (you just have to remember to remove the loaded edid from the cmdline first!). On this device just switching the source makes it work.

AP///////wAebQEAAQEBAQEWAQOAoFp4Cu6Ro1RMmSYPUFShCAAxQEVAYUBxQIGAAQEBAQEBAjqA
GHE4LUBYLEUAoFoAAAAeZiFQsFEAGzBAcDYAoFoAAAAeAAAA/QA6Ph5TEAAKICAgICAgAAAA/ABM
RyBUVgogICAgICAgAUMCAzPxThCfBBMFFAMCEiAhIhUBJhUHUAlXB3gDDAAgAIAeIMAOAUAKDwgQ
GBCYEFgQOBABHYAYcRwWIFgsJQAgwjEAAJ4BHQByUdAeIG4oVQAgwjEAAB4COoAYcTgtQFgsRQCg
WgAAAB4BHQC8UtAeILgoVUDEjiEAAB4AAAAAEw==

I also tried another HDMI cable to no avail.

In the process I also discovered that using the stable EEPROM bootloader (Tue Aug 2 15:55:05 UTC 2022 (1659455705)) causes my Pi to hang at rainbow if I issue a reboot command with 7 power led flashes, while shutdown or power cycling boots normally. The critical branch (Tue Apr 26 10:24:28 UTC 2022 (1650968668)) does not do this and reboots normally. This probably warrants another bug report in the firmware section.

@popcornmix
Copy link
Collaborator

This probably warrants another bug report in the firmware section.

Yes. Sounds like an unrelated issue.

@popcornmix
Copy link
Collaborator

Switching source or unplugging/plugging the HDMI cable on this display does nothing. However if I unplug the display power cable and plug it back, the display comes to life.

I'd like to be sure whether, after the power cycle of the display, the display becomes happy with the existing signal we output, or whether some hotplug toggling that occurs causes us to switch to a hdmi signal the display likes better.

Can you use this in cmdline.txt:
drm.edid_firmware=edid video=HDMI-A-1:1920x1080@60 vc4.force_hotplug=1

I believe now the pi will not be able to detect any cable unplug or power cycle of display.
Does power cycling the display bring the picture back?

It may also be interesting to look at:
sudo cat /sys/kernel/debug/dri/1/state
(if there is no file use replace the 1 with a 0).

Perhaps copy that file somewhere before and after the power cycle and diff them just to see if anything changes.

@JerryK13
Copy link
Author

JerryK13 commented Oct 4, 2022

I've setup the Pi to startx on tty7 (lightdm) and did some testing. All the testing is on the monitor.

With drm.edid_firmware=edid video=HDMI-A-1:1920x1080@60 in cmdlinte.txt and HDMI connected before booting up, it's blank across all ttys.
If I disconnect the HDMI (at the Pi end), boot up the Pi, connect the HDMI and then switch to tty1 I get a picture of the console. Switching back to tty7 however produces a blank screen again. I can then switch between the working tty1 and blank tty7 as much as I want to.
But if I disconnect the HDMI (at the Pi end), boot up the Pi, switch to tty1 and then connect the HDMI, I get blank across all the ttys. In this case, the only way to see some output is to power cycle the monitor. The same happens if I switch to tty1 and then back to tty7 and then connect the HDMI, blank across all the ttys.

With drm.edid_firmware=edid video=HDMI-A-1:1920x1080@60 vc4.force_hotplug=1 in the cmdline.txt and HDMI connected before booting up, it's blank across all ttys. But if I boot with disconnected HDMI (at the Pi end) and plug it in after KMS took over, I get output on all ttys without any tty switching.

Here is the /sys/kernel/debug/dri/1/state with vc4.force_hotplug=1 before and after

# diff statebefore stateafter
30,31c30,31
< 	fb=340
< 		allocated by = Xorg
---
> 	fb=338
> 		allocated by = [fbcon]
33c33
< 		format=XR24 little-endian (0x34325258)
---
> 		format=RG16 little-endian (0x36314752)
38c38
< 			pitch[0]=7680
---
> 			pitch[0]=3840
43,44c43,44
< 				start=001003f5
< 				size=8294400
---
> 				start=00100000
> 				size=4149248
46,47c46,47
< 				paddr=0x00000000cfb00000
< 				vaddr=00000000a69ab5ba
---
> 				paddr=0x00000000cf700000
> 				vaddr=00000000be273bc4
244,264c244,247
< 	crtc=crtc-3
< 	fb=342
< 		allocated by = Xorg
< 		refcount=1
< 		format=AR24 little-endian (0x34325241)
< 		modifier=0x0
< 		size=64x64
< 		layers:
< 			size[0]=64x64
< 			pitch[0]=256
< 			offset[0]=0
< 			obj[0]:
< 				name=0
< 				refcount=3
< 				start=00100bea
< 				size=16384
< 				imported=no
< 				paddr=0x00000000cf050000
< 				vaddr=000000001f264dee
< 	crtc-pos=64x64+949+528
< 	src-pos=64.000000x64.000000+0.000000+0.000000
---
> 	crtc=(null)
> 	fb=0
> 	crtc-pos=0x0+0+0
> 	src-pos=0.000000x0.000000+0.000000+0.000000
335c318
< 	plane_mask=2000008
---
> 	plane_mask=8
338c321
< 	mode: "": 60 148500 1920 2008 2052 2200 1080 1084 1089 1125 0x0 0x5
---
> 	mode: "1920x1080": 60 148500 1920 2008 2052 2200 1080 1084 1089 1125 0x68 0x5

@popcornmix
Copy link
Collaborator

I don't think you've run the test I described in my previous post.
My understanding was that if you to boot to console (with hdmi attached), you see some console text but screen goes blank when kernel starts the kms driver. You can get output back by power cycling the monitor.

I want you to repeat this with this in config.txt
drm.edid_firmware=edid video=HDMI-A-1:1920x1080@60 vc4.force_hotplug=1

Do you still get blank screen at end of boot, and do you get output back after power cycling the monitor?

@popcornmix
Copy link
Collaborator

< 	fb=340
< 		allocated by = Xorg
---
> 	fb=338
> 		allocated by = [fbcon]

You seem to be running with X active in the first case and X inactive (possibly switched to a different VT) in the second case.
That makes any comparison impossible. The useful comparison would be for the no display case and the display working case with everything else the same. Ideally run in the simple boot to console case for each of these cases.

@JerryK13
Copy link
Author

JerryK13 commented Oct 4, 2022

I don't think you've run the test I described in my previous post. My understanding was that if you to boot to console (with hdmi attached), you see some console text but screen goes blank when kernel starts the kms driver. You can get output back by power cycling the monitor.

I want you to repeat this with this in config.txt drm.edid_firmware=edid video=HDMI-A-1:1920x1080@60 vc4.force_hotplug=1

Do you still get blank screen at end of boot, and do you get output back after power cycling the monitor?

Yes. Everything stays the same as before. I see the rainbow screen and the framebuffer but after kms takes over it goes blank. I can bring it back with power cycling the monitor. The only difference is, with vc4.force_hotplug=1, I can boot without hdmi cable attached and if I attach it later when the KMS is in charge, I get output without the need to power cycle the monitor. This does not work without vc4.force_hotplug=1.

You seem to be running with X active in the first case and X inactive (possibly switched to a different VT) in the second case.
That makes any comparison impossible. The useful comparison would be for the no display case and the display working case with everything else the same. Ideally run in the simple boot to console case for each of these cases.

Sorry about that one, didn't notice I switched ttys. Retested again with X disabled, the dri state before and after remain the same.

@JerryK13
Copy link
Author

JerryK13 commented Oct 4, 2022

And it is exactly the same on the TV. I can even use the monitors edid in the cmdline.txt and produce the same results (get output by plugging the HDMI after KMS takes over or by switching source on the TV).

Just to rule out if this particular Pi is a bit wonky, I tried this sdcard with this image in two other RPI4B on both the TV and the monitor and the results are the same.

@popcornmix
Copy link
Collaborator

That is strange. I believe the signal we are outputting is identical before and after the display power cycle, so the fix is the display resetting its state which sounds like a display problem.

But as this is a very rare issue (I'm not sure I've seen this reported), it seems inconceivable you have two unrelated displays with this issue.

Just a sanity check. What does vcgencmd get_throttled report after boot?

@JerryK13
Copy link
Author

JerryK13 commented Oct 4, 2022

It reports throttled=0x0.

Both of displays are old (2009 and 2012).

I tried it now with again two different even older monitors (these are not FHD) that only have DVI ports, so I used a HDMI-DVI adapter and removed the cmdline.txt stuff. One is a Hannsg 19" at 1280x1024 and works. The other is a AIC 22" at 1680x1050 and displays no rainbow and no frame buffer but "signal out of range", however when the KMS takes over the output is restored.

As the deprecated firmware FKMS version works without the need to power cycle or source switch on the TV, is there any edid trickery I can do, to make it work with KMS without the hassle of pulling cables?

@popcornmix
Copy link
Collaborator

I wonder if the issue is the switchover that occurs from firmware to kms driver (effectively the TV sees two hdmi mode changes a few seconds apart). It's a longshot but add to cmdline.txt:
drm.debug=0x14 boot_delay=1000

That will generate more drm debugging and also delay debug messages to 1 per second.
It will take a couple of minutes to boot, but if it works it may indicate issue is timing related.

@JerryK13
Copy link
Author

JerryK13 commented Oct 4, 2022

The drm.debug=0x14 was already included in the default of the foundation supplied image (and my kern.log and syslog were already couple of GB in size. I wander if the periodic freezes I was experiencing with this setup were due to this excessive logging) my cmdline.txt so I just added the boot_delay=1000.

Now the boot up is taking about 180s, and once systemd starts spawning services it starts flying (no more ~1/s, more like 10/s, not sure if any slower than without boot delay). I noticed, that the mode change occurs somewhere near the end of systemd spawning services. Before that the output is always visible and not changing mode. Now I am not sure where KMS mode change occurs (4th point in your first reply), perhaps something else is changing mode later on?

Anyway, did a couple of test with drm.debug=0x14 boot_delay=1000. The first ones I removed the edid, video and hotplug from cmdline.txt. Tried with lightdm enabled and disabled and nothing changed - all blank until I power cycle the monitor.
The second tests I did, were in addition to debug and delay with added edid, video and hotplug. I did roughly 10 start ups, and on about half of them, during the systemd spawning, the output went blank and returned, so I could see the console. If I enabled lightdm, then the output was always blanked.

You can compare kernwoxwcmd.log (kern.log with debug, delay, edid, video, hotplug and without starting X) with kernmonitor.log (kern.log without those bootloader/kernel parameters also without starting X) from opening post.

@popcornmix
Copy link
Collaborator

The drm.debug=0x14 was already included in the default of the foundation supplied image

I don't believe that to be true.

@JerryK13
Copy link
Author

JerryK13 commented Oct 4, 2022

Yes, you are right! I've must have missed copy&pasting that while messing with loading the edid from file before opening this report. Sorry for the miss information.

@macmpi
Copy link

macmpi commented Oct 12, 2022

It will take a couple of minutes to boot, but if it works it may indicate issue is timing related.

aside this debug workaround, is a permanent firmware/driver fix possible?

@popcornmix
Copy link
Collaborator

macmpi, this issue is a very specific failure mode which sounds like a problem with the display (power cycling the display fixes it, even though the signal received is the same before and after power cycle).

I don't believe there is a reliable workaround yet (sounds like significant delays only sometimes avoids the issue).

Are you saying you have exactly the same issue?

@HiassofT
Copy link
Contributor

The issue with the LG TV in the initial report reads a lot like this firmware issue raspberrypi/firmware#1647 - which also mentions an LG TV of the same vintage.

As that issue was narrowed down to a firmware-only change I suspect something in the FW->KMS handover (timing maybe?) might have changed that results in the TV not wanting to show a picture.

A shot in the dark: the vc4 KMS driver doesn't seem to implement AVMUTE support while changing modes. ISTR I read some reports on LE slack or forums (could have been on Rockchip or Allwinner devices) that some TVs didn't like (some?) mode changes unless AVMUTE was set before mode change and cleared after.

Might be worth adding AVMUTE support to the driver, maybe that helps (getting the timing right might be a bit tricky as IIRC AVMUTE can only be changed at the beginning of each frame and any clock changes have to be delayed until the GCP has been transmitted)

@macmpi
Copy link

macmpi commented Oct 13, 2022

Are you saying you have exactly the same issue?

It looked similar on a Toshiba TV with PiZeroW, but I do not have that TV with me right now to confirm if it is exactly same issue.
Will check at next opportunity but may take time...

@bruceb85
Copy link

bruceb85 commented Oct 14, 2022

I had same issue with LG 34WK95U-W using CM4

commenting out this lines solves the issue, but why?
# Enable DRM VC4 V3D driver #dtoverlay=vc4-kms-v3d

@macmpi
Copy link

macmpi commented Oct 14, 2022

A shot in the dark: the vc4 KMS driver doesn't seem to implement AVMUTE support while changing modes.[...]
Might be worth adding AVMUTE support to the driver, [...]

@HiassofT : very enlightening indeed thanks.
I guess AVMUTE support is probably key for supporting AVR use-cases as per raspberrypi/firmware#1647 (comment) (Yamaha AVR + Sony TV in that specific case)?

@popcornmix
Copy link
Collaborator

@HiassofT
HDMI 1.4b spec:

The General Control Packet contains fields for indicating AVMUTE information and color-depth
information. Each transmitted GCP may contain valid indications for AVMUTE and/or color-depth
or may contain no information (all fields zero).
General Control packets indicating Set_AVMUTE or Clear_AVMUTE may only be transmitted
between the active edge of VSYNC and 384 pixels following this edge. A Source may not send a
General Control Packet with the Clear_AVMUTE and Set_AVMUTE flags set simultaneously.
Source transmission of the General Control Packet is optional. Sinks may optionally interpret
General Control Packet contents. Sinks shall be capable of receiving any General Control Packet.
The General Control packet’s Set_AVMUTE and Clear_AVMUTE flags may be used by a Source
to reduce the negative impact on the Sink of TMDS clock changes or interruptions. Use of the
AVMUTE function may prevent spurious pops or noises in the audio during these clock changes.
When AVMUTE is set, the Sink may assume that no valid audio or video data is being received.
The Sink may optionally apply a mute function to the audio data and/or a blank function to the
video.

"Source transmission of the General Control Packet is optional" suggests this isn't something required and a display shouldn't behave badly if it is missing.

@picov
Copy link

picov commented Nov 1, 2022

Same problem with 2022-09-22-raspios-bullseye-arm64.img
Same problem updating LibreElec from 9.x to 10.x series.
The problem occours with both TV (Panasonic VIERA TX P46GT30) and Monitor (Asus QHD 27")
I've a RPI4.
If I modify the config.txt by replacing dtoverlay=vc4-kms-v3d with dtoverlay=vc4-fkms-v3d the problem disappears.

@popcornmix
Copy link
Collaborator

popcornmix commented Jan 24, 2023

There is a potential update for this issue (screen going blank at point of transition of kms driver on a pi4) in latest rpi-update kernel. It would be useful if anyone who experiences this issue can test and report back.
See: #5317

@JerryK13
Copy link
Author

I can confirm that with the rpi-update commit 20169be87eee199ab8c958a02ef923597f15f944 the firmware to kms handover works on both displays from the opening comment! Good work!

@popcornmix
Copy link
Collaborator

@JerryK13 Great to hear. This issue has taken a while to understand.
Hopefully the fix resolves a number of blank screen issues.

@JerryK13 JerryK13 closed this as completed Feb 6, 2023
@markusand
Copy link

Same problem with 2022-09-22-raspios-bullseye-arm64.img Same problem updating LibreElec from 9.x to 10.x series. The problem occours with both TV (Panasonic VIERA TX P46GT30) and Monitor (Asus QHD 27") I've a RPI4. If I modify the config.txt by replacing dtoverlay=vc4-kms-v3d with dtoverlay=vc4-fkms-v3d the problem disappears.

This solved my problem

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

8 participants