[337.12] "xrandr --output eDP-1-0 --primary" generates BadMatch error (GTX 760M)

When gnome-shell tries to set primary output using RandR, it receives BadMatch error and crashes.
To reproduce BadMatch error:

~ $ xrandr
Screen 0: minimum 8 x 8, current 1920 x 1080, maximum 16384 x 16384
eDP-1-0 connected 1920x1080+0+0 (normal left inverted right x axis y axis) 344mm x 194mm
1920x1080 60.1*+
1400x1050 60.0
1280x1024 60.0
1280x960 60.0
1024x768 60.0 60.0
960x720 60.0
928x696 60.1
896x672 60.0
800x600 60.0 60.3 56.2
700x525 60.0
640x512 60.0
640x480 60.0 59.9
512x384 60.0
400x300 60.3 56.3
320x240 60.1
VGA-1-0 disconnected (normal left inverted right x axis y axis)
HDMI-1-0 disconnected (normal left inverted right x axis y axis)
~ $ xrandr --output eDP-1-0 --primary
X Error of failed request: BadMatch (invalid parameter attributes)
Major opcode of failed request: 139 (RANDR)
Minor opcode of failed request: 30 (RRSetOutputPrimary)
Serial number of failed request: 31
Current serial number in output stream: 33

I think it’s similar bug to the one from 304.30 driver: “Fixed a bug that caused RRSetOutputPrimary requests to incorrectly generate BadValue errors when setting the primary output to None. This caused gnome-settings-daemon to crash after changing the screen configuration in response to a display hotplug or the display change hot-key being pressed.”

except it generates BadMatch error now, and crashes gnome-shell at startup.

edit: it’s fixed in mutter: xrandr: ignore the error if setting the primary output fails (3d1d1555) · Commits · GNOME / mutter · GitLab

nvidia-bug-report.log.gz (167 KB)
xorg.conf.gz (522 Bytes)