Sway switch-workspace erratic

I investigated this a little when I first figured out what was happening. I don’t think the HDMI output is enabled per wayland, but I couldn’t figure out why sway was treating it as enabled.

Here’s what wlr-randr and sway say, with the stock sway config, on a311d pocket reform:

$ wlr-randr 
DSI-1 "(null) (null) (DSI-1)"
  Make: (null)
  Model: (null)
  Serial: (null)
  Physical size: 95x151 mm
  Enabled: yes
  Modes:
    1200x1920 px, 54.021999 Hz (current)
  Position: 0,0
  Transform: 90
  Scale: 1.500000
  Adaptive Sync: disabled
HDMI-A-1 "(null) (null) (HDMI-A-1)"
  Make: (null)
  Model: (null)
  Serial: (null)
  Enabled: no
  Modes:
    1024x768 px, 60.004002 Hz
    800x600 px, 60.317001 Hz
    800x600 px, 56.250000 Hz
    848x480 px, 60.000000 Hz
$ swaymsg -t get_outputs
Output DSI-1 'Unknown Unknown Unknown' (focused)
  Current mode: 1200x1920 @ 54.022 Hz
  Power: on
  Position: 0,0
  Scale factor: 1.500000
  Scale filter: linear
  Subpixel hinting: unknown
  Transform: 270
  Workspace: 3
  Max render time: off
  Adaptive sync: disabled
  Allow tearing: no
  Available modes:
    1200x1920 @ 54.022 Hz

Output HDMI-A-1 'Unknown Unknown Unknown'
  Current mode: 0x0 @ 0.000 Hz
  Power: off
  Position: 1280,0
  Scale factor: 1.000000
  Scale filter: nearest
  Subpixel hinting: unknown
  Transform: normal
  Workspace: 2
  Max render time: off
  Adaptive sync: disabled
  Allow tearing: no
  Available modes:
    1024x768 @ 60.004 Hz
    800x600 @ 60.317 Hz
    800x600 @ 56.250 Hz
    848x480 @ 60.000 Hz

I don’t know why sway assigns workspaces to / enables outputs it knows are off, and I’m not sure how this behavior is different than e.g. imx8plus.

I also had some other issues with the HDMI output on a311d, so it seems like something is misconfigured somewhere in the display driver stack? But I couldn’t guess what.