Backports from 3.1 + some battery tweaks + tearing fix attempt