US President Barack Obama and his Chinese counterpart Xi Jinping have agreed to make landmark cuts to CO2 emissions over the next two decades.