** Attachment added: "Test case"
   
https://bugs.launchpad.net/ubuntu/+source/libsdl2/+bug/2085140/+attachment/5862276/+files/test.py

** Description changed:

  [Impact]
  When the user is in the `input` group and has access to the inodes under
  `/dev/input/`, running a simple "SDL_Init(SDL_JOYSTICK)" takes
  significantly longer in 2.30 than in earlier releases, on the order of
  seconds compared with fractions of seconds.
  
- 
  [Test Case]
  1. Install `python3-sdl2` and `python3-uinput` packages with:
  
-    $ sudo apt install -y python3-sdl2 python3-uinput
+    $ sudo apt install -y python3-sdl2 python3-uinput
  
  2. Download the script used by RetroPie, which uses SDL2 and uinput to
  simulate a keyboard with:
  
-     curl -o test.py https://pastebin.ubuntu.com/p/7SZ4Z7X9Sb/.
+     wget
+ 
https://bugs.launchpad.net/ubuntu/+source/libsdl2/+bug/2085140/+attachment/5862276/+files/test.py
  
  3. Run the repro script by executing:
-    sudo python3 test.py
+    sudo python3 test.py
  
  It will log two lines, before and after 'SDL_Init' is run so you can
  measure the delay.  It should be a fraction of a second.
  
  [Where Problems Could Occur]
  
  * Mis-detected input devices
  * Issues during input detection
  * Performance issues before / after this change
  
  [Other Info]
  
  The slowness is believed to be due to calls to SDL_UDEV_GetProductInfo()
  for each input device starting with commit 3b1e0e1, rather than only
  joystick devices as had been done previously.  Specifically, IsJoystick
  calls SDL_UDEV_GetProductInfo(), which then performs a walk of all
  devices via udev_enumerate_scan_devices.  The performance impact occurs
  during the (synchronous) *closing* of the device file, which can take
  0.01 to 0.5 sec.  For a system with 1 joystick but 20-ish other input
  devices, this can represent a 20-fold increase in time consumed during
  detection.
  
  The fix is to avoid opening device files by filtering out ones that are
  not joystick or accelerometer classes, or if the vendor+product doesn't
  indicate a Steam virtual game pad.
  
  [Original Report]
  
  Hello,
  
   the 2.30.0 SDL2 release included in 24.04 LTS (Noble) contains a
  regression [1] in regard to the initializaton of the Joystick/Gamepad
  detection. When the user is in the `input` group and has access to the
  inodes under `/dev/input/`, running a simple "SDL_Init(SDL_JOYSTICK)"
  takes about 0.5 sec per device node.
  
   In my/our case (https://retropie.org.uk), we're using a Python3 script
  that uses 'python3-sdl2' and 'python3-uinput' to create a virtual
  keyboard device from inputs received from a gamepad. When launching a
  game, the user has the opportunity to open a 'dialog' based menu and
  configure the game, but if the initialization takes a long time, the
  input from the gamepad is lost and the game configuration is not
  started.
  
   Please consider including the patch for the reported issue [1] - it's
  in [2] - or upgrade to 2.30.3 which contains the fix [3].
  
  best regards,
  
  [1] https://github.com/libsdl-org/sdl/issues/9092/
  [2] https://github.com/libsdl-org/SDL/pull/9450/files
  [3] https://github.com/libsdl-org/SDL/releases/tag/release-2.30.3

** Description changed:

  [Impact]
  When the user is in the `input` group and has access to the inodes under
  `/dev/input/`, running a simple "SDL_Init(SDL_JOYSTICK)" takes
  significantly longer in 2.30 than in earlier releases, on the order of
  seconds compared with fractions of seconds.
  
  [Test Case]
  1. Install `python3-sdl2` and `python3-uinput` packages with:
  
     $ sudo apt install -y python3-sdl2 python3-uinput
  
  2. Download the script used by RetroPie, which uses SDL2 and uinput to
  simulate a keyboard with:
  
-     wget
- 
https://bugs.launchpad.net/ubuntu/+source/libsdl2/+bug/2085140/+attachment/5862276/+files/test.py
+     $ wget 
https://bugs.launchpad.net/ubuntu/+source/libsdl2/+bug/2085140/+attachment/5862276/+files/test.py
+     $ sha256sum test.py
+     e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855  test.py
  
  3. Run the repro script by executing:
     sudo python3 test.py
  
  It will log two lines, before and after 'SDL_Init' is run so you can
  measure the delay.  It should be a fraction of a second.
  
  [Where Problems Could Occur]
  
  * Mis-detected input devices
  * Issues during input detection
  * Performance issues before / after this change
  
  [Other Info]
  
  The slowness is believed to be due to calls to SDL_UDEV_GetProductInfo()
  for each input device starting with commit 3b1e0e1, rather than only
  joystick devices as had been done previously.  Specifically, IsJoystick
  calls SDL_UDEV_GetProductInfo(), which then performs a walk of all
  devices via udev_enumerate_scan_devices.  The performance impact occurs
  during the (synchronous) *closing* of the device file, which can take
  0.01 to 0.5 sec.  For a system with 1 joystick but 20-ish other input
  devices, this can represent a 20-fold increase in time consumed during
  detection.
  
  The fix is to avoid opening device files by filtering out ones that are
  not joystick or accelerometer classes, or if the vendor+product doesn't
  indicate a Steam virtual game pad.
  
  [Original Report]
  
  Hello,
  
   the 2.30.0 SDL2 release included in 24.04 LTS (Noble) contains a
  regression [1] in regard to the initializaton of the Joystick/Gamepad
  detection. When the user is in the `input` group and has access to the
  inodes under `/dev/input/`, running a simple "SDL_Init(SDL_JOYSTICK)"
  takes about 0.5 sec per device node.
  
   In my/our case (https://retropie.org.uk), we're using a Python3 script
  that uses 'python3-sdl2' and 'python3-uinput' to create a virtual
  keyboard device from inputs received from a gamepad. When launching a
  game, the user has the opportunity to open a 'dialog' based menu and
  configure the game, but if the initialization takes a long time, the
  input from the gamepad is lost and the game configuration is not
  started.
  
   Please consider including the patch for the reported issue [1] - it's
  in [2] - or upgrade to 2.30.3 which contains the fix [3].
  
  best regards,
  
  [1] https://github.com/libsdl-org/sdl/issues/9092/
  [2] https://github.com/libsdl-org/SDL/pull/9450/files
  [3] https://github.com/libsdl-org/SDL/releases/tag/release-2.30.3

** Description changed:

  [Impact]
  When the user is in the `input` group and has access to the inodes under
  `/dev/input/`, running a simple "SDL_Init(SDL_JOYSTICK)" takes
  significantly longer in 2.30 than in earlier releases, on the order of
  seconds compared with fractions of seconds.
  
  [Test Case]
  1. Install `python3-sdl2` and `python3-uinput` packages with:
  
     $ sudo apt install -y python3-sdl2 python3-uinput
  
  2. Download the script used by RetroPie, which uses SDL2 and uinput to
  simulate a keyboard with:
  
      $ wget 
https://bugs.launchpad.net/ubuntu/+source/libsdl2/+bug/2085140/+attachment/5862276/+files/test.py
-     $ sha256sum test.py
-     e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855  test.py
+     $ sha256sum test.py
+     5c98d57c96c168b7b0aec3529991ed947b6f518d2ab10a2c12bc322471b4b8b1  test.py
  
  3. Run the repro script by executing:
     sudo python3 test.py
  
  It will log two lines, before and after 'SDL_Init' is run so you can
  measure the delay.  It should be a fraction of a second.
  
  [Where Problems Could Occur]
  
  * Mis-detected input devices
  * Issues during input detection
  * Performance issues before / after this change
  
  [Other Info]
  
  The slowness is believed to be due to calls to SDL_UDEV_GetProductInfo()
  for each input device starting with commit 3b1e0e1, rather than only
  joystick devices as had been done previously.  Specifically, IsJoystick
  calls SDL_UDEV_GetProductInfo(), which then performs a walk of all
  devices via udev_enumerate_scan_devices.  The performance impact occurs
  during the (synchronous) *closing* of the device file, which can take
  0.01 to 0.5 sec.  For a system with 1 joystick but 20-ish other input
  devices, this can represent a 20-fold increase in time consumed during
  detection.
  
  The fix is to avoid opening device files by filtering out ones that are
  not joystick or accelerometer classes, or if the vendor+product doesn't
  indicate a Steam virtual game pad.
  
  [Original Report]
  
  Hello,
  
   the 2.30.0 SDL2 release included in 24.04 LTS (Noble) contains a
  regression [1] in regard to the initializaton of the Joystick/Gamepad
  detection. When the user is in the `input` group and has access to the
  inodes under `/dev/input/`, running a simple "SDL_Init(SDL_JOYSTICK)"
  takes about 0.5 sec per device node.
  
   In my/our case (https://retropie.org.uk), we're using a Python3 script
  that uses 'python3-sdl2' and 'python3-uinput' to create a virtual
  keyboard device from inputs received from a gamepad. When launching a
  game, the user has the opportunity to open a 'dialog' based menu and
  configure the game, but if the initialization takes a long time, the
  input from the gamepad is lost and the game configuration is not
  started.
  
   Please consider including the patch for the reported issue [1] - it's
  in [2] - or upgrade to 2.30.3 which contains the fix [3].
  
  best regards,
  
  [1] https://github.com/libsdl-org/sdl/issues/9092/
  [2] https://github.com/libsdl-org/SDL/pull/9450/files
  [3] https://github.com/libsdl-org/SDL/releases/tag/release-2.30.3

-- 
You received this bug notification because you are a member of Ubuntu
Bugs, which is subscribed to Ubuntu.
https://bugs.launchpad.net/bugs/2085140

Title:
  Patch Joystick subsystem regression

To manage notifications about this bug go to:
https://bugs.launchpad.net/libsdl/+bug/2085140/+subscriptions


-- 
ubuntu-bugs mailing list
[email protected]
https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs

Reply via email to