Skip to content

Hold power profile through power-profiles-daemon - #573

Draft
caniko wants to merge 2 commits into
FeralInteractive:masterfrom
caniko:hold-power-profile
Draft

caniko wants to merge 2 commits into
FeralInteractive:masterfrom
caniko:hold-power-profile

Conversation

@caniko

@caniko caniko commented Aug 13, 2026 •

Copy link
Copy Markdown

Summary

Use the power-profiles-daemon HoldProfile API while GameMode is active.

The first registered client requests the configured performance profile, and the final client releases it. The system D-Bus connection remains open for the lifetime of the hold, so daemon exit also releases it.

Behavior

  • Prefer org.freedesktop.UPower.PowerProfiles.
  • Fall back to the legacy net.hadess.PowerProfiles API used by older PPD versions and compatible implementations such as tuned-ppd.
  • Preserve direct platform_profile handling when neither API exists, desiredprof cannot be represented by a PPD hold, or defaultprof requests exact restoration semantics.
  • Do not bypass a present policy daemon after authorization or operational errors.
  • Let PPD restore the user-selected base profile when the hold ends.

No new dependency or configuration option is added; the implementation uses the existing sd-bus dependency.

Testing

  • scripts/format-check.sh
  • Meson build with -Dwith-examples=true
  • meson test -C builddir --print-errorlogs
  • Live PPD 0.30 modern endpoint: hold appears with the expected application ID, profile, and reason, then disappears on release
  • Two concurrent clients: one hold remains until the final client exits
  • Forced GameMode daemon exit: D-Bus disconnect removes the hold
  • clang-tidy on the changed daemon sources (only existing project-wide logging warnings)

Full gamemoded -t hardware validation is pending the local removal of competing ASUS profile writers, hence this is submitted as a draft.

Fixes #333
Fixes #462

Current qualification — 8 October 2026

Head 627aac2f605824d6ba71c73a6c2f7cbd197d661c rejects empty HoldProfile replies instead of accepting cookie zero. The regression failed before the fix. Native Meson build with examples and all 18 Meson tests pass, including a new host-independent test of modern/legacy endpoints, unavailable services, denied requests, empty/malformed replies and bus failure. Scoped clang-format checks pass.

The new test uses a fake system bus. Full hardware/PPD qualification, current Codex review and hosted upstream CI remain outstanding.

Current upstream CI — 8 October 2026

Run 37754242744 is completed/action_required at signed head 627aac2f605824d6ba71c73a6c2f7cbd197d661c. Maintainers must approve the fork workflow and obtain passing current-head CI. Native build and all 18 Meson tests pass; hardware/PPD qualification and the existing complete-candidate Codex review remain open.

@caniko

caniko commented Oct 4, 2026

Copy link
Copy Markdown
Author

The retained Build and test run reports failure at the current head, but GitHub now returns zero jobs/check runs, so there is no diagnostic evidence available to identify a code failure. My rerun request returned HTTP 403 (Must have admin rights to Repository). Could a maintainer rerun it? The draft's hardware/PPD acceptance requirement is still outstanding. No local tests or evaluations were run during this maintenance pass.

Treat an empty HoldProfile reply as a failed hold instead of retaining cookie zero. Exercise the real hold lifecycle against a fake bus so modern and legacy endpoints, missing services, denied requests and malformed replies are checked without changing the host power profile.
@caniko

caniko commented Oct 8, 2026

Copy link
Copy Markdown
Author

@codex review

Please review the complete candidate against the current target branch (code review). Head 627aac2f605824d6ba71c73a6c2f7cbd197d661c; target a74b8106a2236d1f2696aa44c93bc4c8ef13b42e. The new commit rejects empty HoldProfile replies. A fake-bus regression failed before the fix; the native build and all 18 Meson tests now pass. Live hardware/PPD qualification remains outstanding.

Upstream merge remains a maintainer action after review and qualification.

@caniko

caniko commented Oct 8, 2026

Copy link
Copy Markdown
Author

The signed empty-cookie repair at 627aac2f605824d6ba71c73a6c2f7cbd197d661c passes the native build and all 18 Meson tests. The current upstream Build and test run 37754242744 is waiting for fork-workflow approval (action_required). Maintainers: please approve that current run, then carry the candidate through the existing full-code-review and hardware/PPD gates before native merge.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Try to use power-profiles-daemon API to hold performance profile if available Support for power profiles daemon

1 participant