# Locked Dummy Plug — BadMatch on xrandr Mode Switch

## Symptom

All `xrandr --output HDMI-0 --mode <res>` commands fail with:

```
xrandr: Configure crtc 0 failed
X Error of failed request:  BadMatch (invalid parameter attributes)
  Major opcode of failed request:  140 (RANDR)
  Minor opcode of failed request:  7 (RRSetScreenSize)
```

Exit code 1. Occurs for every resolution/refresh combination — 4K@60, 1440p@120, 1080p@120 — even though EDID advertises all of them.

## Root Cause

Cheap HDMI dummy plugs ("FUEARAN 4K/120" and similar unbranded adapters) use a fixed-resolution video signal generator chip that cannot be reconfigured via CRTC/PHY. The EDID is static and lists many modes but the hardware can only output its single native resolution (typically 3840x2160@60). xrandr accepts the mode switch request, passes it to the NVIDIA driver, which tries to reconfigure the CRTC, and the hardware returns `BadMatch`.

## Hardware Details

- **Make/Model:** FUEARAN 4K/120 (labeled as HDMI 2.1 dummy plug)
- **EDID tag:** `0046554552414e20344b2f313230` (decoded: "FUEARAN 4K/120")
- **Physical connection:** HDMI-0 (NVIDIA port, X11 connector)
- **NVIDIA GPU:** RTX 2080 Ti, driver 580.159.03
- **Xorg mode:** X11 (not Wayland, not KMS capture)
- **Reports available via xrandr:** 3840x2160@60*, 2560x1440@120, 1920x1080@120, etc.
- **Actually works:** 3840x2160 at whatever rate it powers up (60Hz via xrandr)

## Diagnosis

```bash
# Test any mode switch — if it fails, plug is locked
DISPLAY=:0 xrandr --output HDMI-0 --mode 1920x1080 2>&1

# Check current actual mode
DISPLAY=:0 xrandr | grep "*"

# Verify Sunshine captures it correctly despite the lock
grep "Streaming display:" ~/.config/sunshine/sunshine.log
# Should show: HDMI-0 with res 3840x2160 offset by 0x0
```

## Fix

The `output_name = 2` fix in sunshine.conf is the primary black-screen fix (ensures Sunshine captures HDMI-0, not a disconnected display). Since the dummy plug can't switch modes, set all app prep-cmds to no-ops:

```json
"prep-cmd": [
  {
    "do": "",
    "undo": "setsid steam steam://close/bigpicture"
  }
]
```

## Alternatives

1. **Better dummy plug:** "Headless Ghost" or "Dr. HDMI" series — these support actual mode switching via hardware.
2. **Custom modeline:** Generate with `cvt 1920 1080 120` and add via `xrandr --newmode` + `xrandr --addmode` — may fail if the hardware PHY truly cannot drive different timings.
3. **NVIDIA Virtual Display (NVFBC-based):** `sudo nvidia-xconfig --virtual=1920x1080 --mode=1920x1080` — only works with `capture = nvfbc` which is broken on driver 580+.
