Version of !473 (merged) rebased for 1.20.
The only relevant commit is 8eeff5d7 - "randr: Check rrPrivKey in RRHasScanoutPixmap() ". This commit had to be refactored for the master/slave => primary/secondary ABI break.
Note that although RRProviderAutoConfigGpuScreen() is only present on master currently, some distros currently cherry-pick it into 1.20. These distros should also cherry-pick commit 6172bd2b - "randr: Check rrPrivKey before autobinding GPU screens" to avoid crashes.