Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Switch graphics mode without reboot #119

Closed
wants to merge 1 commit into from
Closed

Conversation

crawfxrd
Copy link
Member

@crawfxrd crawfxrd commented Oct 25, 2019

By further utilizing gpu-manager, we can perform most operations for switching graphics modes without requiring a reboot.

In order for switching and runpm to work correctly, GDM must be restarted. This will end all running GNOME sessions.

system76-power graphics <mode>
systemctl restart display-manager

See: #57

@brs17 brs17 requested review from a team October 25, 2019 16:14
mmstick
mmstick previously approved these changes Oct 25, 2019
@crawfxrd crawfxrd changed the title WIP: Switch graphics mode without reboot Switch graphics mode without reboot Oct 28, 2019
@crawfxrd crawfxrd force-pushed the switch-without-reboot branch 2 times, most recently from 9ef7d46 to 9b85470 Compare October 30, 2019 18:02
@gase12
Copy link

gase12 commented Nov 4, 2019

hi whats up with the review? :)

@brs17 brs17 added this to In progress in Pop!_OS via automation Nov 6, 2019
@brs17 brs17 moved this from In progress to Ready to test in Pop!_OS Nov 6, 2019
@flukejones
Copy link

Hey thanks for doing this!

@leviport
Copy link
Member

I began testing this and it's looking good, but it's definitely a WIP at the moment. Here is what I'm seeing:

  • As @crawfxrd specified, switching from Intel to either Nvidia or Hybrid after a logout/login seems to work pretty well. The first switch seemed very reliable, with subsequent switches sometimes getting more error-prone.

  • When switching from Hybrid to Nvidia at one point (I lost track of how many other switches preceded this switch), I logged out and back in again and saw that all gnome extensions had been disabled.

  • I was able to switch from either Nvidia or Hybrid to Intel by restarting GDM with systemctl restart display-manager, but switching then from Intel to Hybrid/Nvidia without restarting resulted in a hang at the "Switching graphics modes" window, and that window never changed to the version with "restart now" and "restart later" buttons.

  • All of the messaging and dialogs still point to restarting after a switch, so that will all need to be updated eventually as well.

Once we're further along, we can start doing some more testing!

@brs17 brs17 moved this from Ready to test to In progress in Pop!_OS Nov 12, 2019
@isantop
Copy link

isantop commented Nov 14, 2019

I would imagine we want to have the messaging and dialog restart the session/GDM for the user. We can probably co-opt the current reboot dialog for that.

@brs17 brs17 added this to In progress in Power Nov 15, 2019
@crawfxrd
Copy link
Member Author

crawfxrd commented Nov 20, 2019

Need to investigate runpm. I'm seeing the card left active after switching from Intel to hybrid.


Restarting GDM fixes it. Not sure why it interferes with runpm.

@crawfxrd crawfxrd force-pushed the switch-without-reboot branch 3 times, most recently from a8963ad to 3ea9acd Compare November 25, 2019 22:32
jackpot51
jackpot51 previously approved these changes Nov 26, 2019
@crawfxrd
Copy link
Member Author

@leviport I haven't been able to reproduce the issues. I'd be interested in getting any logs for the hang if you're able to repro it.

Remaining work for #57 is:

  • restart GDM
  • apply run-time power management workarounds
  • integrate with the shell extension

@leviport
Copy link
Member

leviport commented Nov 26, 2019

I'd be interested in getting any logs for the hang if you're able to repro it.

I can take another look to see if I can make it happen again, though it looks like the latest eoan build didn't succeed. Once it builds again I will see if it's still an issue and gather logs if it is.

self.set_power(true)?;
}

let status = process::Command::new(SYSTEMCTL_CMD)
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

gpu-manager is configured to run before display-manager, so implementing a display-manager restart would allow this call to be removed.

@lzyang2000
Copy link

lzyang2000 commented Dec 17, 2019

Great feature, hope it gets merged soon.
I definitely do not want to reboot every time I switch graphics lol
Thanks for all the work!

@brs17
Copy link
Contributor

brs17 commented Dec 24, 2019

@crawfxrd are we expecting this to function in 18.04 (between Intel and NVIDIA modes)?

@crawfxrd
Copy link
Member Author

crawfxrd commented Dec 24, 2019

It looks like the required logic exists in ubuntu-drivers-common for 18.04. I don't see why it wouldn't work, but I didn't consider it.

@lzyang2000
Copy link

Any plans to merge this

By further utilizing gpu-manager, we can perform most operations
for switching graphics modes without requiring a reboot.

In order for switching and runpm to work correctly, GDM must be
restarted. This will end all running GNOME sessions.

    system76-power graphics <mode>
    systemctl restart display-manager

See: #57
Copy link
Contributor

@brs17 brs17 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have been unable to recreate the issues seen previously. This looks good to me.

Things to note going forward:

@crawfxrd crawfxrd moved this from In progress to Ready for testing in Power Dec 26, 2019
@crawfxrd
Copy link
Member Author

crawfxrd commented Jan 2, 2020

Because this can't be implemented cleanly (must kill all X sessions), we're going to keep requiring a reboot. Steps in #57 will still work.

@crawfxrd crawfxrd closed this Jan 2, 2020
Pop!_OS automation moved this from In progress to Done Jan 2, 2020
Power automation moved this from Ready for testing to Done Jan 2, 2020
@crawfxrd crawfxrd deleted the switch-without-reboot branch January 21, 2020 18:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Pop!_OS
  
Done
Power
  
Done
Development

Successfully merging this pull request may close these issues.

None yet

9 participants