Skip to content
GitLab
Projects Groups Topics Snippets
  • /
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in
  • Plasma Desktop Plasma Desktop
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributor statistics
    • Graph
    • Compare revisions
  • Issues 31
    • Issues 31
    • List
    • Boards
    • Service Desk
    • Milestones
  • Bugzilla
    • Bugzilla
  • Merge requests 59
    • Merge requests 59
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Artifacts
    • Schedules
  • Deployments
    • Deployments
    • Releases
  • Analytics
    • Analytics
    • Value stream
    • CI/CD
    • Repository
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • PlasmaPlasma
  • Plasma DesktopPlasma Desktop
  • Merge requests
  • !1360

kcms/joystick: process all available events

  • Review changes

  • Download
  • Patches
  • Plain diff
Merged Bartosz Taudul requested to merge wolfpld/plasma-desktop:master into master Jan 25, 2023
  • Overview 4
  • Commits 2
  • Pipelines 4
  • Changes 4

Processing of joystick events is performed in a response to a zero-timeout timer. Previously only one event was handled when the timer fired. The 10 ms timeout of the select call checking if there are events to process prevented 100% CPU usage of a constantly firing timer.

The problem with such an approach is that joystick events are visibly slow to process and show up in the buttons and axis readout. In some cases they are even lost. It is not clear why this happens, my guess would be that each update of the button or axis state in the UI triggers a redraw, which then waits for VSync, preventing the timer from running.

This commit changes the event processing logic to run until there are no events left to consume. This requires zeroing of the select call timeout, as otherwise a joystick emitting events every 9 ms would be able completely block the UI.

To prevent 100% CPU usage, 10 ms sleep calls are issued when the event queue is empty. This has similar effect as the previous 10 ms select timeout.

Changes in the joystick calibration dialog are minimal, as I don't have use for it. The behavior there shouldn't be degraded, but that's it.

BUG: 426230 FIXED-IN: 5.27


The previous behavior of joystick event processing can be seen at https://cdn.discordapp.com/attachments/745210855725203516/1067207157923201096/2023-01-23_23-01-29.mp4 In this video jstest is running in the terminal, printing joystick events as they arrive. The readout of same axis in the system settings heavily lags behind.


Comparison of position graph when the joystick is manipulated to produce circles.

Before:

circle-before

After:

circle-after

Assignee
Assign to
Reviewers
Request review from
Time tracking
Source branch: master