xorg 和 CPU 使用率

xorg 和 CPU 使用率

我的笔记本电脑上安装了 Debian 10,并且在 Debian 之后手动安装了 xorg、i3wm 和 compton。我通过安装 nVidia 专有驱动程序并调整 xorg.conf 文件中的一些选项解决了一些严重的撕裂问题:

/usr/share/X11/xorg.conf.d/10-nvidia.conf    
    # nvidia-settings: X configuration file generated by nvidia-settings
    # nvidia-settings:  version 390.116

    Section "ServerLayout"
        Identifier     "Layout0"
        Screen      0  "Screen0" 0 0
        InputDevice    "Keyboard0" "CoreKeyboard"
        InputDevice    "Mouse0" "CorePointer"
        Option         "Xinerama" "0"
    EndSection

    Section "Files"
    EndSection

    Section "Module"
        Load           "dbe"
        Load           "extmod"
        Load           "type1"
        Load           "freetype"
        Load           "glx"
    EndSection

    Section "InputDevice"
        # generated from default
        Identifier     "Mouse0"
        Driver         "mouse"
        Option         "Protocol" "auto"
        Option         "Device" "/dev/psaux"
        Option         "Emulate3Buttons" "no"
        Option         "ZAxisMapping" "4 5"
    EndSection

    Section "InputDevice"
        # generated from default
        Identifier     "Keyboard0"
        Driver         "kbd"
    EndSection

    Section "Monitor"
        # HorizSync source: edid, VertRefresh source: edid
        Identifier     "Monitor0"
        VendorName     "Unknown"
        ModelName      "FUS P19-3P"
        HorizSync       30.0 - 82.0
        VertRefresh     56.0 - 76.0
        Option         "DPMS"
    EndSection

    Section "Device"
        Identifier     "Device0"
        Driver         "nvidia"
        VendorName     "NVIDIA Corporation"
        BusID          "PCI:1:0:0"
        BoardName      "GeForce GTX 670M"
        Option         "NoLogo" "1"
        Option         "MigrationHeuristic" "greedy"
        Option         "AccelMethod" "sna"
        Option         "TearFree"    "true"
        Option "RenderAccel" "True"
        Option "AddARGBGLXVisuals" "True"
        Option "OnDemandVBlankInterrupts" "True"
        Option "InitialPixmapPlacement" "2"
        Option "BackingStore" "True"
        Option "DamageEvents" "True"
        Option "UseEvents" "False"
        Option "Coolbits" "1"
        Option "DisableGLXRootCliping" "True"
        Option "TripleBuffer" "true"
        Option "Coolbits" "24"
        Option "PixmapCacheSize" "300000"
        Option "GlyphCache" "1"

    EndSection

    Section "Screen"
        Identifier     "Screen0"
        Device         "Device0"
        Monitor        "Monitor0"
        DefaultDepth    24
        Option         "Stereo" "0"
        Option         "metamodes" "HDMI-0: nvidia-auto-select +0+0 {ForceCompositionPipeline=On, ForceFullCompositionPipeline=On}"
        Option         "SLI" "Off"
        Option         "MultiGPU" "Off"
        Option         "BaseMosaic" "off"
        SubSection     "Display"
            Depth       24
        EndSubSection
    EndSection

并在 compton.conf 文件中:

~/.config/compton.conf
# basic configuration
backend = "glx";
vsync = "opengl-swc";
paint-on-overlay = true
glx-no-stencil = true

glx-copy-from-front = true;
glx-swap-method = 2;
xrender-sync = true;
xrender-sync-fence = true;

# transparancy settings for i3
opacity-rule = [
    "0:_NET_WM_STATE@:32a *= '_NET_WM_STATE_HIDDEN'",
    "100:class_g = 'Firefox-esr' && !_NET_WM_STATE@:32a",
    "0:_NET_WM_STATE@[0]:32a *= '_NET_WM_STATE_HIDDEN'",
    "0:_NET_WM_STATE@[1]:32a *= '_NET_WM_STATE_HIDDEN'",
    "0:_NET_WM_STATE@[2]:32a *= '_NET_WM_STATE_HIDDEN'",
    "0:_NET_WM_STATE@[3]:32a *= '_NET_WM_STATE_HIDDEN'",
    "0:_NET_WM_STATE@[4]:32a *= '_NET_WM_STATE_HIDDEN'",
    "92:class_g = 'st-256color' && !_NET_WM_STATE@:32a",
    "0:_NET_WM_STATE@[0]:32a *= '_NET_WM_STATE_HIDDEN'",
    "0:_NET_WM_STATE@[1]:32a *= '_NET_WM_STATE_HIDDEN'",
    "0:_NET_WM_STATE@[2]:32a *= '_NET_WM_STATE_HIDDEN'",
    "0:_NET_WM_STATE@[3]:32a *= '_NET_WM_STATE_HIDDEN'",
    "0:_NET_WM_STATE@[4]:32a *= '_NET_WM_STATE_HIDDEN'"
];

并调用康普顿 exec --no-startup-id compton --config ~/.config/compton.conf -CGb --backend glx --paint-on-overlay --vsync opengl-swc

来自 i3wm 配置文件。

我还附上了 lspci 的输出

00:00.0 Host bridge: Intel Corporation 3rd Gen Core processor DRAM Controller (rev 09)
00:01.0 PCI bridge: Intel Corporation Xeon E3-1200 v2/3rd Gen Core processor PCI Express Root Port (rev 09)
00:14.0 USB controller: Intel Corporation 7 Series/C210 Series Chipset Family USB xHCI Host Controller (rev 04)
00:16.0 Communication controller: Intel Corporation 7 Series/C216 Chipset Family MEI Controller #1 (rev 04)
00:1a.0 USB controller: Intel Corporation 7 Series/C216 Chipset Family USB Enhanced Host Controller #2 (rev 04)
00:1b.0 Audio device: Intel Corporation 7 Series/C216 Chipset Family High Definition Audio Controller (rev 04)
00:1c.0 PCI bridge: Intel Corporation 7 Series/C216 Chipset Family PCI Express Root Port 1 (rev c4)
00:1c.1 PCI bridge: Intel Corporation 7 Series/C210 Series Chipset Family PCI Express Root Port 2 (rev c4)
00:1c.3 PCI bridge: Intel Corporation 7 Series/C216 Chipset Family PCI Express Root Port 4 (rev c4)
00:1c.4 PCI bridge: Intel Corporation 7 Series/C210 Series Chipset Family PCI Express Root Port 5 (rev c4)
00:1d.0 USB controller: Intel Corporation 7 Series/C216 Chipset Family USB Enhanced Host Controller #1 (rev 04)
00:1f.0 ISA bridge: Intel Corporation HM77 Express Chipset LPC Controller (rev 04)
00:1f.2 SATA controller: Intel Corporation 7 Series Chipset Family 6-port SATA Controller [AHCI mode] (rev 04)
00:1f.3 SMBus: Intel Corporation 7 Series/C216 Chipset Family SMBus Controller (rev 04)
01:00.0 VGA compatible controller: NVIDIA Corporation GF114M [GeForce GTX 670M] (rev a1)
01:00.1 Audio device: NVIDIA Corporation GF114 HDMI Audio Controller (rev a1)
03:00.0 Network controller: Intel Corporation Centrino Wireless-N 105 (rev c4)
04:00.0 Ethernet controller: Qualcomm Atheros AR8151 v2.0 Gigabit Ethernet (rev c0)

即使我用发现的测试来测试我的显示器,问题显然也消失了这个网站我时不时(大约每 10 秒)看到 UFO 向后退一小段距离,然后再次前进......

我尝试调查这个问题,发现一些用户还抱怨 xorg 的 CPU 使用率过高。我通常没有很高的 CPU 使用率(当我写这个问题时,我的每个 8 核 CPU 都保持在 7% 以下,但如果我开始来回调整盒子大小,CPU 使用率会上升到 70/80%) ,但如果我尝试在 i3 中移动浮动窗口,某些核心的 CPU 使用率开始上升到 50/60%(所有这些结果都是通过使用检查的htop),罪魁祸首是 xorg 和 compton(有时也是我的窗口)移动)。

那么问题是:为什么会发生这种情况?这可能与我在屏幕上看到的问题有关吗?屏幕不是由GPU重绘的吗?如果是这样的话,为什么会对CPU使用率产生这么大的影响呢?有没有办法解决这个可能导致我看到的小屏幕伪影的问题?

提前致谢。

相关内容