Rename RogBios bits to Platform. Better GPU MUX support.

This commit is contained in:
Luke D. Jones
2022-08-12 21:51:04 +12:00
parent d35707f2e4
commit a0f7cf3acd
16 changed files with 122 additions and 164 deletions

View File

@@ -62,7 +62,7 @@ impl Bios {
pub fn post_boot_sound(&self) -> Result<i16> {
Ok(1)
}
pub fn dedicated_graphic_mode(&self) -> Result<i16> {
pub fn gpu_mux_mode(&self) -> Result<i16> {
Ok(1)
}
pub fn panel_overdrive(&self) -> Result<i16> {
@@ -71,7 +71,7 @@ impl Bios {
pub fn set_post_boot_sound(&self, _b: bool) -> Result<()> {
Ok(())
}
pub fn set_dedicated_graphic_mode(&self, _b: bool) -> Result<()> {
pub fn set_gpu_mux_mode(&self, _b: bool) -> Result<()> {
Ok(())
}
pub fn set_panel_overdrive(&self, _b: bool) -> Result<()> {

View File

@@ -5,7 +5,7 @@ use notify_rust::{Hint, Notification, NotificationHandle};
use rog_aura::AuraEffect;
use rog_dbus::{
zbus_anime::AnimeProxy, zbus_charge::ChargeProxy, zbus_led::LedProxy,
zbus_profile::ProfileProxy, zbus_rogbios::RogBiosProxy,
zbus_profile::ProfileProxy, zbus_platform::RogBiosProxy,
};
use rog_profiles::Profile;
use smol::{future, Executor};

View File

@@ -8,7 +8,7 @@ use std::{
use egui::Vec2;
use rog_aura::{layouts::KeyLayout, usb::AuraPowerDev, AuraEffect, AuraModeNum};
use rog_platform::supported::SupportedFunctions;
use rog_platform::{platform::GpuMuxMode, supported::SupportedFunctions};
use rog_profiles::{fan_curve_set::FanCurveSet, FanCurvePU, Profile};
use crate::{error::Result, RogDbusClientBlocking};
@@ -20,7 +20,7 @@ pub struct BiosState {
/// updated, so the full state needs refresh
pub was_notified: Arc<AtomicBool>,
pub post_sound: bool,
pub dedicated_gfx: bool,
pub dedicated_gfx: GpuMuxMode,
pub panel_overdrive: bool,
pub dgpu_disable: bool,
pub egpu_enable: bool,
@@ -40,9 +40,9 @@ impl BiosState {
false
},
dedicated_gfx: if supported.rog_bios_ctrl.dgpu_only {
dbus.proxies().rog_bios().dedicated_graphic_mode()?
dbus.proxies().rog_bios().gpu_mux_mode()?
} else {
false
GpuMuxMode::NotSupported
},
panel_overdrive: if supported.rog_bios_ctrl.panel_overdrive {
dbus.proxies().rog_bios().panel_overdrive()?
@@ -337,7 +337,7 @@ impl Default for PageDataStates {
bios: BiosState {
was_notified: Default::default(),
post_sound: Default::default(),
dedicated_gfx: Default::default(),
dedicated_gfx: GpuMuxMode::NotSupported,
panel_overdrive: Default::default(),
dgpu_disable: Default::default(),
egpu_enable: Default::default(),

View File

@@ -1,6 +1,6 @@
use crate::{page_states::PageDataStates, RogDbusClientBlocking};
use egui::Ui;
use rog_platform::supported::SupportedFunctions;
use rog_platform::{platform::GpuMuxMode, supported::SupportedFunctions};
use rog_profiles::Profile;
pub fn platform_profile(states: &mut PageDataStates, dbus: &RogDbusClientBlocking, ui: &mut Ui) {
@@ -91,16 +91,33 @@ pub fn rog_bios_group(
}
if supported.rog_bios_ctrl.dgpu_only {
if ui
.add(egui::Checkbox::new(
&mut states.bios.dedicated_gfx,
"G-Sync Dedicated GPU mode",
))
.changed()
{
let mut changed = false;
ui.group(|ui| {
ui.vertical(|ui| {
ui.horizontal_wrapped(|ui| ui.label("GPU MUX mode (reboot required)"));
ui.horizontal_wrapped(|ui| {
changed = ui
.selectable_value(
&mut states.bios.dedicated_gfx,
GpuMuxMode::Discrete,
"Dedicated (Ultimate)",
)
.clicked()
|| ui
.selectable_value(
&mut states.bios.dedicated_gfx,
GpuMuxMode::Optimus,
"Optimus (Hybrid)",
)
.clicked();
});
});
});
if changed {
dbus.proxies()
.rog_bios()
.set_dedicated_graphic_mode(states.bios.dedicated_gfx)
.set_gpu_mux_mode(states.bios.dedicated_gfx)
.map_err(|err| {
states.error = Some(err.to_string());
})