X server crashs when trying to use more than 16 screens

We have a device with 7 GTX1050 cards, each GTX1050 has 4 HDMI outputs.
And we want to output videos to all 28 HDMIs.
But we can only use up to 16 outputs.
After some study, we find that Xorg has a macro defining the MAXSCREENS it supports.
We patch the xorg-server-1.20.4 source as following:

#ifndef MAXSCREENS
#define MAXSCREENS      32
#endif
#ifndef MAXGPUSCREENS
#define MAXGPUSCREENS   32
#endif

but still not working, Xorg keeps crashing when loading nvidia’s glx extension.

Please help!
nvidia-bug-report.log.gz (3.9 MB)