AMD: Modeline calculation and stability fixes

This is currently upstream work in progress. Likely to change in the future, but it the best we currently have.