xfwm4 does not actually prefer xpresent on some AMD graphics cards because they identify as Radeon not AMD
One of my AMD cards identifies as Device: Radeon RX 570 Series (POLARIS10, DRM 3.37.0, 5.7.8-9-Yeoreum, LLVM 10.0.0) (0x67df) according to GLX_MESA_query_renderer - AMD involvement with it is NOT indicated by the name (Mesa 20.1.3). The result is that xfwm4 does not use xpresent - unless it is explicitly ordered to do so temporary with xfwm4 --vblank=xpresent or permanently with
xfconf-query -c xfwm4 -p /general/vblank_mode -t string -s "xpresent" --create
By examining src/compositor.c line 1067 we see why:
#if HAVE_PRESENT_EXTENSION const char *prefer_xpresent[] = { "Intel", "AMD", NULL }; #endif /* HAVE_PRESENT_EXTENSION */
The code indicates that xfwm4 is meant to use xpresent by default on AMD graphics cards. It does NOT.
By adding a simple debug output in the #if HAVE_PRESENT_EXTENSION section,
#if HAVE_PRESENT_EXTENSION if (screen_info->vblank_mode == VBLANK_AUTO) { i = 0; while (prefer_xpresent[i] && !strcasestr (glRenderer, prefer_xpresent[i])) { i++; g_message ("Checking renderer %s", glRenderer); } if (prefer_xpresent[i]) { g_message ("Prefer XPresent with %s", glRenderer); return FALSE; } } #endif /* HAVE_PRESENT_EXTENSION */
the logs show evidence of the check for AMD involvement failing because modern Mesa will not indicate or admit AMD involvement with graphics cards they produce in glRenderer.
With g_message ("Checking renderer %s", glRenderer); the and --enable-debug=yes the log shows
DBG[compositor.c:1085] check_glx_renderer(): Using GL renderer: Radeon RX 570 Series (POLARIS10, DRM 3.37.0, 5.7.8-9-Yeoreum, LLVM 10.0.0) xfwm4-Message: 06:07:56.423: checking renderer Radeon RX 570 Series (POLARIS10, DRM 3.37.0, 5.7.8-9-Yeoreum, LLVM 10.0.0) xfwm4-Message: 06:07:56.423: checking renderer Radeon RX 570 Series (POLARIS10, DRM 3.37.0, 5.7.8-9-Yeoreum, LLVM 10.0.0) DBG[display.c:521] myDisplayGrabServer(): entering myDisplayGrabServer
which is why xpresent is NOT used. A fix for this is to add the string "Radeon" to the list of strings in src/compositor.c arond line 1067:
#if HAVE_PRESENT_EXTENSION const char *prefer_xpresent[] = { "Intel", "AMD", "Radeon", NULL }; #endif /* HAVE_PRESENT_EXTENSION */
With the magic word "Radeon" present the logs show:
DBG[compositor.c:1086] check_glx_renderer(): Using GL renderer: Radeon RX 570 Series (POLARIS10, DRM 3.37.0, 5.7.8-9-Yeoreum, LLVM 10.0.0) xfwm4-Message: 06:09:39.955: Checking renderer Radeon RX 570 Series (POLARIS10, DRM 3.37.0, 5.7.8-9-Yeoreum, LLVM 10.0.0) xfwm4-Message: 06:09:39.955: Checking renderer Radeon RX 570 Series (POLARIS10, DRM 3.37.0, 5.7.8-9-Yeoreum, LLVM 10.0.0) xfwm4-Message: 06:09:39.955: Prefer XPresent with Radeon RX 570 Series (POLARIS10, DRM 3.37.0, 5.7.8-9-Yeoreum, LLVM 10.0.0) DBG[display.c:521] myDisplayGrabServer(): entering myDisplayGrabServer
Why this may be important: Playing a full screen video 4K with mpv using very high quality settings has the GPU at 70% load with the default, that drops to 50% with xpresent. Further, using low settings has mpv using 50% GPU load playing the same video using defaults & 30% when using xpresent. There is a big difference when it comes to power draw and performance. There is also a big impact on games and other programs.
Interestingly, a pretty similar GPU on a different system has:
Device: AMD Radeon (TM) RX 470 Graphics (POLARIS10, DRM 3.37.0, 5.7.9-9-Yeoreum, LLVM 10.0.0) (0x67df)
Which is identical to this but with AMD in front of it:
Device: Radeon RX 570 Series (POLARIS10, DRM 3.37.0, 5.7.8-9-Yeoreum, LLVM 10.0.0) (0x67df)
Also checked another older box, it too has AMD:
Device: AMD Radeon HD 7800 Series (PITCAIRN, DRM 3.37.0, 5.7.9-9-Yeoreum, LLVM 10.0.0) (0x6819)