High CPU usage on xorg when the external monitor is plugged in

Hello,

I see a constant 30% CPU usage in this particular xorg process:

/usr/lib/xorg/Xorg vt2 -displayfd 3 -auth /run/user/1000/gdm/Xauthority -nolisten tcp -background none -noreset -keeptty -novtswitch -verbose 3

With some perf I have found that most of the time is spent on:

- 32,91% 32,65% [vdso] [.] 0000000000000755
- 32,65% clock_gettime

This only happens when the external monitor is plugged in. Since this a laptop with hybrid graphics, the external monitor is connected directly to the Nvidia card.

How I can solve this problem? Because of this, the fans are always on and I can also see that the desktop lags a bit.

I have attached the support script output. nvidia-bug-report.log.gz (461.5 KB)

Thank you!

The monitor gets detected over and over again, please check/replace cable.
Please also check if this is also happening in nvidia prime output mode.

Hello Generix,

Thank you for your answer.

I changed the cable and the problem is the same.

I also changed the configuration from hybrid to Nvidia only, and high CPU problem is gone. Is there anything I can do to be able to use the hybrid mode?

Thank you!

There seems to be a hidpi-daemon hammering nvidia-settings at time. Can you kill it to test if that’s responsible for the monitor-requeries?

Hello,

I have disabled, then killed the daemon. But the 30% CPU usage is still there. I also tried connecting the screen with HDMI and USB-C, makes no difference.

I am attaching the new outputs in case they help. nvidia-bug-report.log.gz (334.8 KB)

Regards.

Do you see any other process in top that’s eating an unusual amount of cpu? The logs look like something is calling “xrandr” in a loop.

Hello,

No, all the CPU usage goes to that xorg process, that internally are all clock_gettime syscalls. Every other process is mostly idle. Once I disable hybrid mode and only use Nvidia, the problem is gone. The desktop is more responsive, the CPU usage goes back to normal, but of course battery usage increases.

If I can collect any data that could help in the analysis of the issue, let me know and I will be happy to do it.

In any case, thank you for the time spent helping me!

The monitors get requeried in fast succession, which gets written to the log, which is why clock_gettime is called. No idea what initiates the query, though.

I have the same issue as OP.

Hybrid graphics. Nvidia and Intel.

NVIDIA GeForce GTX 1070 Mobile

Running Pop OS 20.10

Driver installed:
xserver-xorg-video-nvidia-460 460.39-1pop0~1611882295~20.10~5279175

Kernel: 5.8.0-7642-generic

$ system76-power graphics
hybrid

nvidia-bug-report.log.gz (632.5 KB)

I get the feeling this is popos specific. It has its own means of switching graphics, there should be some system76-powerdaemon and a gnome plugin, please check if disabling both stops the requeries.