mesa/main: use call_once instead of open-coding