(I have been editing new notes into the original bug description so that all the details are in one place)
DISCLAIMER: I know very little about Hardware and OS Compositors, so this may be wild and inaccurate speculation.
There appears to be an interesting situation going on, which makes sense in retrospect, but that I also never really thought about until now.
Intel Graphics drives the monitor, but NVIDIA drives the firefox window, and this seems to be required to trigger the issue!
Windows is very certain that my builtin display is "connected to" my Intel GPU, while if I connect an external display via HDMI, windows says my that one is "connected to" my NVIDIA GPU. This makes sense to me: things like HDMI ports tend to be physically part of discrete gpu packages, and not the motherboard. So seemingly the native laptop display is physically connected to the Intel GPU: again, this makes sense, it's desirable to be able to completely disable the discrete GPU for performance reasons.
However NVIDIA nonetheless ends up "driving" my firefox windows regardless of what monitor they're connected to (firefox reports in about:support that it's using the NVIDIA GPU and not the Intel one, although it sees both). The NVIDIA Control Panel reflects this: it says Firefox should use the "high performance NVIDIA processor".
The bug goes away if I do any of the following:
- Change the NVIDIA Control Panel to make Firefox use the integrated graphics (and restart firefox).
- Move the firefox window to the external display that is "connected to" my NVIDIA GPU.
- Have the firefox window cover every pixel on the builtin laptop display (maximized with a hidden windows task bar).
All 3 of these point me to a theory: the bug only occurs when my Intel GPU is compositing a firefox window drawn by my NVIDIA GPU. Looking at the 3 things that fix the issue:
- Removes NVIDIA from the picture. (note: an intel window on the NVIDIA display does not have any issues)
- Removes Intel from the picture.
- Potentially enters a fast-path where Intel is bypassed and NVIDIA performs final composition.