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

Real-time dGPU power status update #15

Open
m0nk3h opened this issue Feb 12, 2022 · 7 comments
Open

Real-time dGPU power status update #15

m0nk3h opened this issue Feb 12, 2022 · 7 comments
Assignees
Labels
enhancement New feature or request good first issue Good for newcomers help wanted Extra attention is needed

Comments

@m0nk3h
Copy link

m0nk3h commented Feb 12, 2022

On booting the dGPU is active, and then goes to suspended after a short while of the desktop loading. If asusctltray is started during the time when the dGPU is active, then the status line always shows active, even after the dGPU has successfully suspended afterwards (as confirmed by supergfxctl -S). I haven't tested, but presuming that if some task/app managed to wake the dGPU and not successfully suspend it afterwards, asusctltray would always show suspended when it wasn't?

Would it be possible to re-get the status of the dGPU either on a timer, or some onClick event (if there is such a thing) of the asusctltray widget?

Thanks. :)

@Baldomo
Copy link
Owner

Baldomo commented Feb 12, 2022

Thank you and you're absolutely right again, this is quite the problem. I've been trying to get asusctltray to automatically update itself with the latest information from the system every time it pop up but sadly it's proven to be extremely difficult to do in the right way because of deliberate Gtk library choices for the AppIndicator bindings. I'm exploring the following solutions (this is more of a reminder for my future self):

  • Gtk.events_pending with internal update function
    • Need to know how to refresh the UI correctly
  • Same as above but with internal signals callbacks, fire a "update" event or something and do everything async (good option)
    • Need to know how to refresh the UI correctly, again
  • Subscribe to asusctl/powerprofilesctl/supergfxctl DBus signals and update UI when signals are received (event better option)
    • Still need to know how to refresh the UI correctly

I'll be working more on it at a later date because exams anyways, so more updates will be coming when I can find some spare time here and there.

@Baldomo Baldomo self-assigned this Feb 12, 2022
@Baldomo Baldomo added bug Something isn't working enhancement New feature or request labels Feb 12, 2022
@m0nk3h
Copy link
Author

m0nk3h commented Feb 12, 2022

Thank you. Good luck with your exams. :)

@Baldomo
Copy link
Owner

Baldomo commented Feb 15, 2022

Alas, I have bad news regarding this issue. After looking into it and having a functional (and rather slick, if I say so myself) implementation of async signal handlers for power profiles, I checked the supergfxctl DBus API and saw this:

interface org.supergfxctl.Daemon {
    methods:
        Version(out s arg_0);
        Mode(out u arg_0);
        Supported(out au arg_0);
        Vendor(out s arg_0);
        Power(out u arg_0);
        SetMode(in  u mode,
                out u arg_1);
        PendingMode(out u arg_0);
        PendingUserAction(out u arg_0);
        Config(out (ubbbbbt) arg_0);
        SetConfig(in  (ubbbbbt) config);
    signals:
        NotifyGfx(u vendor);
        NotifyAction(u action);
    properties:
};

As you can clearly see, there's no signal sender for changes in the power status of the dGPU, although they added ones for user required action when switching and for some vendor thing. Funnily enough, not even asusctl-gex uses the latter and they resorted to checking the GPU power with a timer, then force-updating the UI. But since Gtk won't let me do that, I have to put this on hold until:

  • supergfxctl adds the required signal senders to their API
  • I come to terms with having a timer run all the time and checking th GPU by hand (which I really feel "meh" about)

Until then, I'll put this on the backburner (the issue will be pinned and stay open of course). I'll probably still end up pushing the aformentioned signal-handler-for-profiles thing in the future.

@Baldomo Baldomo pinned this issue Feb 15, 2022
@Baldomo Baldomo changed the title dGPU:active / suspended Real-time dGPU power status update Feb 15, 2022
@m0nk3h
Copy link
Author

m0nk3h commented Feb 15, 2022

Ah, that is a shame. I understand Fluke is very busy, and wouldn't like to ask him to implement a niche feature. I've semi solved the issue for me, by adding a kdeplasma-applets-supergfxctl to monitor the dGPU status. Thanks for looking into this.

@AFAgarap
Copy link

This may seem a naive question/suggestion, but would it be possible to use supergfxctl -S to get the dGPU power status update?

@Baldomo
Copy link
Owner

Baldomo commented Jul 18, 2022

asusctltrayalready uses supergfxctl's DBus API (object connection and fetching status), the problem lies in how to uodate the actual status while the application is running in a reliable way. Sadly gtk in Python is extremely limited in weird corner cases, for example custom widgets in menus and the blocking event loop. I'll have to experiment some more, but the situation was discussed in the comments above.

P.S. if it isn't clear, the supergfxctl CLI uses its DBus API internally so it's the same as how we're doing things here

@AFAgarap
Copy link

asusctltrayalready uses supergfxctl's DBus API (object connection and [fetching status](asusctltrayalready uses supergfxctl's DBus API (object connection), the problem lies in how to uodate the actual status while the application is running in a reliable way. Sadly gtk in Python is extremely limited in weird corner cases, for example custom widgets in menus and the blocking event loop. I'll have to experiment some more, but the situation was discussed in the comments above.

P.S. if it isn't clear, the supergfxctl CLI uses its DBus API internally so it's the same as how we're doing things here

Thanks for the response. Hopefully, it would be possible for this feature to be implemented in the future.

Repository owner deleted a comment from Arpitkandwal Feb 23, 2024
@Baldomo Baldomo added help wanted Extra attention is needed good first issue Good for newcomers and removed bug Something isn't working labels May 20, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request good first issue Good for newcomers help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

3 participants