The static QCD potential in coordinate space with quark masses through two loops