Issue with Screen Resolution on Raspberry Pi after HDMI Cable Swap

Here is the fix, thank you ChatGPT!

Raspberry Pi 4 (Bookworm, KMS): Force HDMI-0 and HDMI-1 to 1920×1080@60

On Bookworm the default display stack is KMS (vc4-kms-v3d). With KMS, forcing resolution is most reliable via the kernel command line (/boot/firmware/cmdline.txt) — not config.txt. Many hdmi_* settings in config.txt are ignored under KMS.

1) Confirm connector names (mine are on card1)

ls -1 /sys/class/drm | grep -E 'HDMI|DSI|eDP'

cat /sys/class/drm/card1-HDMI-A-1/status
cat /sys/class/drm/card1-HDMI-A-2/status
# (generic)
cat /sys/class/drm/card*-HDMI-A-*/status

2) Force 1920×1080@60 from boot (recommended)

Edit cmdline.txt — it’s one single line:

sudo nano /boot/firmware/cmdline.txt

Append at the end (precede with a space):

video=HDMI-A-1:1920x1080@60 video=HDMI-A-2:1920x1080@60

Reboot:

sudo reboot

Verify after boot:

cat /proc/cmdline | tr ' ' '\n' | grep ^video=
cat /sys/class/drm/card1-HDMI-A-1/modes
cat /sys/class/drm/card1-HDMI-A-2/modes

3) config.txt hygiene (optional but tidy)

I’m using:

dtoverlay=vc4-kms-v3d
disable_fw_kms_setup=1

Clean up duplicates like multiple hdmi_force_hotplug=1 lines, and remove hdmi_enable_4kp60=1 if you only want 1080p. Reminder: with KMS, these hdmi_* options don’t enforce modes — the video= args in cmdline.txt do.

4) (Optional) Re-apply in the desktop session

If you need to re-set modes after login (hotplug scenarios):

Xorg:

DISPLAY=:0 xrandr --output HDMI-1 --mode 1920x1080 --rate 60 \
                  --output HDMI-2 --mode 1920x1080 --rate 60

Wayland/wlroots (e.g., Sway/Wayfire/kiosk):

wlr-randr --output HDMI-A-1 --mode 1920x1080@60
wlr-randr --output HDMI-A-2 --mode 1920x1080@60

Common pitfalls

  • Using card0 paths: with vc4-kms-v3d the HDMI connectors are typically on card1.

  • Breaking cmdline.txt into multiple lines: keep it a single line.

  • Mixing legacy (f)kms with modern KMS: stick to vc4-kms-v3d if you’re on Bookworm.