Division by zero using custom mode with refresh rate 0
Arithmetic exception at address 0x7fa912355b37
/home/ifreund/repos/wlroots/build/../backend/drm/drm.c:1696:25: 0x7fa912355b37 in mhz_to_nsec (../backend/drm/drm.c)
return 1000000000000LL / mhz;
^
/home/ifreund/repos/wlroots/build/../backend/drm/drm.c:1756:14: 0x7fa912353d08 in handle_page_flip (../backend/drm/drm.c)
.refresh = mhz_to_nsec(conn->output.refresh),
^
???:?:?: 0x7fa912271afb in ??? (libdrm.so.2)
Unwind information for `libdrm.so.2:0x7fa912271afb` was not available, trace may be incomplete
Considering that wlr_output.refresh
is documented as
int32_t refresh; // mHz, may be zero
it seems that this code should handle a refresh rate of zero but I don't see how it ever has.
I can reproduce this after upgrading river to wlroots 0.17.1 but not with wlroots 0.16.2.
It doesn't seem that the code in the stack trace has changed at all between those versions though. I can only assume something else in river's or wlroots' behavior has changed which results in a refresh rate of 0 actually making it to the drm backend.
If the documentation is wrong and a refresh rate of zero should not be allowed we need to fix the comments :)