Skip to content

CHANGE: ISX-2322 Rely on module to manage polling frequency. #2200

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

Open
wants to merge 6 commits into
base: develop
Choose a base branch
from

Conversation

ekcoh
Copy link
Collaborator

@ekcoh ekcoh commented Jul 3, 2025

Description

Removes polling frequency as a property being managed by InputManager and instead delegates life-time and initial setting to be configured by platform and input-module. This requires a specific Unity branch, see internal issue ISX-2322.

Also removed double-booking of pollingFrequency field from serialised state since I cannot see any reason to have it part of serialised state. Since property is now in native it won't be subject to domain reloads.

Testing status & QA

Tested on macOS by setting native polling frequency to 123 Hz with a custom local build during development.
Recommended to test on Windows with Xbox gamepad on the associated Unity branch since Windows has a higher default than 60 Hz on that branch which affects the Windows Gaming Input backend. E.g. testing with a DualSense on Windows wouldn't make much difference since DualSense is using unconstrained polling at the platform level and do not depend on polling frequency setting.

Overall Product Risks

Small.

  • Complexity: Small
  • Halo Effect: Small

Comments to reviewers

Note that this branch should be merged after the corresponding Unity feature branch has landed since version is otherwise unknown: update changeling, comments and asmdef condition

Checklist

Before review:

  • Changelog entry added.
    • Explains the change in Changed, Fixed, Added sections.
    • For API change contains an example snippet and/or migration example.
    • JIRA ticket linked, example (case %%). If it is a private issue, just add the case ID without a link.
    • Jira port for the next release set as "Resolved".
  • Tests added/changed, if applicable.
    • Functional tests Devices_PollingFrequencyIsAtLeast60HzByDefault conditionally replaces Devices_PollingFrequencyIs60HzByDefault conditionally based on Unity version being used.
    • Performance tests.
    • Integration tests.
  • Docs for new/changed API's.
    • Xmldoc cross references are set correctly.
    • Added explanation how the API works.
    • Usage code examples added.
    • The manual is updated, if needed.

During merge:

  • Commit message for squash-merge is prefixed with one of the list:
    • NEW: ___.
    • FIX: ___.
    • DOCS: ___.
    • CHANGE: ___.
    • RELEASE: 1.1.0-preview.3.

After merge:

  • Create forward/backward port if needed. If you are blocked from creating a forward port now please add a task to ISX-1444.

@ekcoh ekcoh changed the title CHANGE: Rely to module to manage polling frequency. CHANGE: ISX-2322 Rely to module to manage polling frequency. Jul 3, 2025
@ekcoh ekcoh marked this pull request as ready for review July 3, 2025 12:30
@ekcoh ekcoh requested review from Pauliusd01 and jfreire-unity July 3, 2025 12:31
@codecov-github-com
Copy link

codecov-github-com bot commented Jul 3, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

@@           Coverage Diff            @@
##           develop    #2200   +/-   ##
========================================
  Coverage    68.11%   68.12%           
========================================
  Files          367      367           
  Lines        53610    53612    +2     
========================================
+ Hits         36519    36521    +2     
  Misses       17091    17091           
Flag Coverage Δ
mac_2021.3_pkg 5.40% <0.00%> (-0.01%) ⬇️
mac_2021.3_project 70.37% <100.00%> (+<0.01%) ⬆️
mac_2022.3_pkg 5.18% <0.00%> (-0.01%) ⬇️
mac_2022.3_project 65.23% <100.00%> (+<0.01%) ⬆️
mac_6000.0_pkg 5.19% <0.00%> (-0.01%) ⬇️
mac_6000.0_project 68.03% <100.00%> (+<0.01%) ⬆️
mac_6000.1_pkg 5.19% <0.00%> (-0.01%) ⬇️
mac_6000.1_project 68.03% <100.00%> (+<0.01%) ⬆️
mac_6000.2_pkg 5.19% <0.00%> (-0.01%) ⬇️
mac_6000.2_project 68.03% <100.00%> (+<0.01%) ⬆️
mac_trunk_pkg 5.19% <0.00%> (-0.01%) ⬇️
win_2021.3_pkg 5.41% <0.00%> (-0.01%) ⬇️
win_2021.3_project 70.44% <100.00%> (+<0.01%) ⬆️
win_2022.3_pkg 5.18% <0.00%> (-0.01%) ⬇️
win_2022.3_project 65.31% <100.00%> (+<0.01%) ⬆️
win_6000.0_pkg 5.19% <0.00%> (-0.01%) ⬇️
win_6000.0_project 68.10% <100.00%> (+<0.01%) ⬆️
win_6000.1_pkg 5.19% <0.00%> (-0.01%) ⬇️
win_6000.1_project 68.10% <100.00%> (+<0.01%) ⬆️
win_6000.2_pkg 5.19% <0.00%> (-0.01%) ⬇️
win_6000.2_project 68.10% <100.00%> (+<0.01%) ⬆️
win_trunk_pkg 5.19% <0.00%> (-0.01%) ⬇️
win_trunk_project 68.10% <100.00%> (-0.01%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

Files with missing lines Coverage Δ
.../com.unity.inputsystem/InputSystem/InputManager.cs 88.71% <100.00%> (+0.01%) ⬆️
...s/com.unity.inputsystem/InputSystem/InputSystem.cs 82.96% <ø> (ø)
...nity.inputsystem/InputSystem/NativeInputRuntime.cs 45.12% <ø> (ø)
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@ekcoh ekcoh changed the title CHANGE: ISX-2322 Rely to module to manage polling frequency. CHANGE: ISX-2322 Rely on module to manage polling frequency. Jul 3, 2025
@ekcoh
Copy link
Collaborator Author

ekcoh commented Jul 4, 2025

Looks like asmdef condition is true for trunk which it shouldn't be, will make sure related Unity PR is on-par with trunk investigate.

… contain required changes. Note that to test one has to weak this asmdef.
@ekcoh
Copy link
Collaborator Author

ekcoh commented Jul 4, 2025

As suspected trunk had advanced hence asmdef is now a3 to exclude trunk. Note that during testing you have to modify the asmdef to be a2 when tested with the corresponding Unity branch.

Copy link
Collaborator

@jfreire-unity jfreire-unity left a comment

Choose a reason for hiding this comment

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

Looks good. Added a comment of something that would be relevant to have IMO.

Comment on lines +4400 to +4403
public void Devices_PollingFrequencyIsAtLeast60HzByDefault()
{
Assert.That(InputSystem.pollingFrequency, Is.GreaterThanOrEqualTo(60));
}
Copy link
Collaborator

Choose a reason for hiding this comment

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

Can we also run this test when we check XInput on Windows? I'm not sure if its ideal to do this on the package but I'd like to test that this pollingFrequency is at least affected by platforms that do expose it.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

This is just a setting. The KPI branch on module "sampling performance" is testing exactly that.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Then I also added the achievable frequency to input debugger long ago. If you set this to 250 you might get what the device and system conditions support. e.g. 125

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.

2 participants