Bug 254240 - xorg/drm-kmod/modesetting driver: XResetScreenSaver() very slow
Summary: xorg/drm-kmod/modesetting driver: XResetScreenSaver() very slow
Status: New
Alias: None
Product: Ports & Packages
Classification: Unclassified
Component: Individual Port(s) (show other bugs)
Version: Latest
Hardware: amd64 Any
: --- Affects Some People
Assignee: freebsd-x11 (Nobody)
Depends on:
Reported: 2021-03-12 15:56 UTC by Tassilo Philipp
Modified: 2021-03-13 14:36 UTC (History)
1 user (show)

See Also:
linimon: maintainer-feedback? (x11)

xorg log when using modesetting/glamor (30.86 KB, text/plain)
2021-03-12 17:15 UTC, Tassilo Philipp
no flags Details
xorg log when using intel/sna (17.90 KB, text/plain)
2021-03-12 17:16 UTC, Tassilo Philipp
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Tassilo Philipp 2021-03-12 15:56:12 UTC
I apologize for filing this bug here, as I don't know if this is the correct place. However, given the issue at hand I have a hard time even figuring out who to report it to:

After an upgrade to 12.2, I noticed heavy stutters in a game I work on. I traced them down to xlib's XResetScreenSaver() function, which the game loop calls on input events (so fairly regularly, often every frame), to avoid the screen saver from triggering. Measuring this, calls to this function sometimes take sometimes even up to a second to complete, nearly always at least 40-50ms, though, which for a real time game creates a heavy stutter.

system info:

- uname -a: FreeBSD x210 12.2-RELEASE-p4 FreeBSD 12.2-RELEASE-p4 GENERIC  amd64
- GPU in question is Intel UHD graphics 620 (KBL GT2)
- drm-fbsd12.0-kmod-4.16.g20201016_1
- gpu-firmware-kmod-g20201213
- libdrm-2.4.104,1
- my application is using OpenGL 4.6 via mesa 20.2.3, however given the xlib call I think this is unrelated to mesa

Trying to isolate the issue, here's what I found:

- this *only* happens on FreeBSD 12.2-RELEASE (and not on 12.1-RELEASE, haven't tested 13-CURRENT, though)
- this *only* happens with the modesetting driver (w/ AccelMethod "glamor", haven't tested "none" b/c the game wouldn't be accelerated to begin with)
- with the intel driver (using either "sna" or "uxa" as AccelMethod), this does *not* happen

I decided to report this here, for now, b/c of this behaviour only being present on 12.2. Please let me know if this should go somewhere else, e.g. the xorg people, etc.. Also, sorry for the brevity, I'm a bit lost where to and what to report, let me know if I can debug this further, what logs might be helpful, etc..

Comment 1 Tassilo Philipp 2021-03-12 17:15:57 UTC
Created attachment 223214 [details]
xorg log when using modesetting/glamor
Comment 2 Tassilo Philipp 2021-03-12 17:16:35 UTC
Created attachment 223215 [details]
xorg log when using intel/sna