Xwayland (from X.org server 1.19.2) takes all CPU and is very slow on ATI R300 because of glamor
Submitted by Émeric Maschino
Assigned to Xorg Project Team
This BR is similar to bug #88316, but in the opposite way, it seems. Let me explain.
I'm running Gentoo Linux on an ia64 workstation (probably irrelevant here) sporting an ATI FireGL X1 graphics adapter (PCI ID 1002:4e47), the professional equivalent to ATI Radeon 9700 Pro cards.
When running GNOME 3.22 on X11, glxinfo reports that I'm using Gallium 0.4 on ATI R300 as OpenGL renderer (Mesa 13.0.5). That's fine and GL apps are running OK.
When running GNOME 3.22 on Wayland, glxinfo reports that I'm using Gallium 0.4 on softpipe as OpenGL renderer and GL apps are barely usable.
Bug #88316 told me this could be related to glamor. So I first ensured that I can enable glamor acceleration (rather than EXA) for my graphics adapter under GNOME on X11. Enabling DRI3 wasn't a problem, but glamor refuses to initialize, reporting in /var/log/Xorg.0.log:
glamor requires at least 128 instructions (64 reported).
Haha, hence the reason. Googling for this error deeper, I found it comes from a check added in glamor  to prevent weak hardware (such as in bug #88316) to enable glamor and get terrific performances.
As a quick test, I've rebuilt my X.org server 1.19.2, lowering GLAMOR_MIN_ALU_INSTRUCTIONS in glamor/glamor_priv.h from 128 to 64, to match the value reported by my graphics adapter. glamor acceleration was then successfully enabled under GNOME 3.22 on X11. Furthermore, running GNOME 3.22 on Wayland was a globally smoother experience (it appears that GNOME Shell itself is still using Xwayland), glxinfo no more reports Gallium 0.4 on softpipe as OpenGL renderer (but Gallium 0.4 on ATI R300) and GL apps are running near-X11 performances.
Where I'm puzzled is why failing to enable glamor (for 2D hardware acceleration) also falls back to 3D software rendering?