關閉獨立顯示卡以省電

這篇文章分享給台式機很少關機,經常遠程回家中的台式機上工作的朋友。

我的主力工作機和遊戲機是同一台機器,顯示屏是 4K 144Hz,日常都是開著獨立顯示卡,普通操作顯示都會更順滑一些,但是功耗也是明顯更大。

以下截圖裡的功率同時帶著一個 J4125 小主機,日常功耗在 18w 上下,因此結論可能有不準確的地方

不開遊戲,在桌面快速滑動鼠標的峰值功率可以到192w

關閉獨立顯示卡後,刷新率降到 60Hz,峰值功率降到120w上下。

在外隧道回家工作是使用的騰訊的一個入門主機,帶寬較小,遠端刷新率只有 30hz,這種情況用獨立顯示卡是沒有意義,可以考慮切換到集顯。

多數時候,我不直接使用遠程桌面,而是使用 vscode 的遠程開發,優勢是隱蔽,佔用帶寬小,幾乎是本地開發的體驗。

普通代碼編輯時,約 72w,與關閉獨立顯示卡前的 120w 相比,有一定的節能效果。

使用remote ssh進行遠程開發時,可以使用腳本關閉獨立顯示卡。

腳本保存為switch_dedicate_graphic_cards.ps1,使用方法為switch_dedicate_graphic_cards.ps1 off

# Usage: switch_dedicate_graphic_cards.ps1 on|off

# Get parameters
$switch = $args[0]

# exit if no parameter is passed
if ($switch -eq $null) {
    Write-Host "Usage: switch_dedicate_graphic_cards.ps1 on|off" -ForegroundColor Yellow
    exit
}

# Get display devices
$displayDevices =  Get-CimInstance -Namespace root\cimv2 -ClassName Win32_VideoController

# If there is no display device or only one display device, exit
if ($displayDevices.Count -le 1) {
    Write-Host "No display device found."
    exit
}

# Get dedicated graphic cards
$dedicatedGraphicCards = $displayDevices | Where-Object { $_.Description -like "*NVIDIA*" }

# If there is no dedicated graphic card, exit
if ($dedicatedGraphicCards.Count -eq 0) {
    Write-Host "No dedicated graphic card found."
    exit
}

# turn dedicated graphic cards on or off
if ($switch -eq "on") {
    $dedicatedGraphicCards | ForEach-Object { pnputil /enable-device $_.PNPDeviceID }
    Write-Host "Dedicated graphic cards are turned on."
} elseif ($switch -eq "off") {
    $dedicatedGraphicCards | ForEach-Object { pnputil /disable-device $_.PNPDeviceID }
    Write-Host "Dedicated graphic cards are turned off."
} else {
    Write-Host "Invalid parameter."
    Write-Host "Usage: switch_dedicate_graphic_cards.ps1 on|off" -ForegroundColor Yellow
}