Attempt to provide more info to users gfx switching

This commit is contained in:
Luke D. Jones
2021-05-29 11:42:15 +12:00
parent 1dd543ddf3
commit f520e381a9
3 changed files with 25 additions and 3 deletions

View File

@@ -5,6 +5,10 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
## [Unreleased]
### Changed
- Set PM to auto for Nvidia always
- Extra info output for gfx dev scan
- Extra info in log for G-Sync to help prevent user confusion around gfx switching
# [3.6.1] - 2021-05-25
### Changed

View File

@@ -1,3 +1,4 @@
use sysfs_class::RuntimePM;
use ::zbus::Connection;
use ctrl_gfx::error::GfxError;
use ctrl_gfx::*;
@@ -66,7 +67,10 @@ impl CtrlGraphics {
let mut nvidia = Vec::new();
let mut other = Vec::new();
for dev in devs.iter() {
let c = dev.class()?;
let c = dev.class().map_err(|err|{
error!("GFX: device error: {}, {}", dev.path().to_string_lossy(), err);
err
})?;
if 0x03 == (c >> 16) & 0xFF {
match dev.vendor()? {
0x1002 => {
@@ -75,6 +79,7 @@ impl CtrlGraphics {
}
0x10DE => {
info!("GFX: {}: NVIDIA graphics", dev.id());
dev.set_runtime_pm(sysfs_class::RuntimePowerManagement::On)?;
nvidia.push(GraphicsDevice::new(dev.id().to_owned(), functions(&dev)));
}
0x8086 => {
@@ -400,6 +405,18 @@ impl CtrlGraphics {
) -> Result<(), RogError> {
// Rescan before doing remove or add drivers
bus.rescan()?;
// Make sure the power management is set to auto for nvidia devices
let devs = PciDevice::all()?;
for dev in devs.iter() {
let c = dev.class().map_err(|err|{
error!("GFX: device error: {}, {}", dev.path().to_string_lossy(), err);
err
})?;
if 0x03 == (c >> 16) & 0xFF && dev.vendor()? == 0x10DE {
info!("GFX: {}: NVIDIA graphics, setting PM to auto", dev.id());
dev.set_runtime_pm(sysfs_class::RuntimePowerManagement::On)?;
}
}
//
Self::write_xorg_conf(vendor)?;
// Write different modprobe to enable boot control to work

View File

@@ -121,7 +121,8 @@ impl CtrlRogBios {
CtrlRogBios::set_path_mutable(ASUS_SWITCH_GRAPHIC_MODE)?;
}
Err(err) => {
info!("ROG Switchable Graphics (bios) not detected: {}", err);
info!("G-Sync Switchable Graphics not detected: {}", err);
info!("If your laptop is not a G-Sync enabled laptop then you can ignore this. Standard graphics switching will still work.");
}
}
@@ -130,7 +131,7 @@ impl CtrlRogBios {
CtrlRogBios::set_path_mutable(ASUS_POST_LOGO_SOUND)?;
}
Err(err) => {
info!("ROG boot sound toggle (bios) not detected: {}", err);
info!("Switch for POST boot sound not detected: {}", err);
}
}