Bug 252371 - devel/sdl20: update to 2.0.14 and refactoring options
Summary: devel/sdl20: update to 2.0.14 and refactoring options
Status: In Progress
Alias: None
Product: Ports & Packages
Classification: Unclassified
Component: Individual Port(s) (show other bugs)
Version: Latest
Hardware: Any Any
: --- Affects Some People
Assignee: Dmitry Marakasov
URL: https://discourse.libsdl.org/t/sdl-2-...
Keywords:
: 218289 (view as bug list)
Depends on: 253850
Blocks:
  Show dependency treegraph
 
Reported: 2021-01-03 07:03 UTC by VVD
Modified: 2021-05-24 11:07 UTC (History)
4 users (show)

See Also:
bugzilla: maintainer-feedback? (amdmi3)


Attachments
update to 2.0.14, add EVDEV option (5.59 KB, patch)
2021-01-03 07:03 UTC, VVD
no flags Details | Diff
update to 2.0.14, refactoring of the options (11.35 KB, patch)
2021-01-03 16:03 UTC, VVD
no flags Details | Diff
update to 2.0.14 and refactoring of the options (13.15 KB, patch)
2021-01-03 18:09 UTC, VVD
no flags Details | Diff
update to 2.0.14 and refactoring of the options (v4) (13.33 KB, patch)
2021-01-19 17:01 UTC, VVD
no flags Details | Diff
update to 2.0.14 and refactoring of the options (v4) (13.20 KB, patch)
2021-01-19 17:05 UTC, VVD
vvd: maintainer-approval?
Details | Diff
Enable embedded gamecontrollerdb.txt for evdev (1.60 KB, patch)
2021-01-23 14:28 UTC, Jan Beich
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description VVD 2021-01-03 07:03:21 UTC
Created attachment 221227 [details]
update to 2.0.14, add EVDEV option

Tested on 12.2 amd64: build, install, check-plist.

https://www.libsdl.org/download-2.0.php
---------------------------------------------------------------------------
2.0.14:
---------------------------------------------------------------------------
General:
* Added support for PS5 DualSense and Xbox Series X controllers to the HIDAPI controller driver
* Added game controller button constants for paddles and new buttons
* Added game controller functions to get additional information:
	* SDL_GameControllerGetSerial()
	* SDL_GameControllerHasAxis()
	* SDL_GameControllerHasButton()
	* SDL_GameControllerGetNumTouchpads()
	* SDL_GameControllerGetNumTouchpadFingers()
	* SDL_GameControllerGetTouchpadFinger()
	* SDL_GameControllerHasSensor()
	* SDL_GameControllerSetSensorEnabled()
	* SDL_GameControllerIsSensorEnabled()
	* SDL_GameControllerGetSensorData()
	* SDL_GameControllerRumbleTriggers()
	* SDL_GameControllerHasLED()
	* SDL_GameControllerSetLED()
* Added the hint SDL_HINT_JOYSTICK_HIDAPI_PS5 to control whether the HIDAPI driver for PS5 controllers should be used.
* Added joystick functions to get additional information:
	* SDL_JoystickGetSerial()
	* SDL_JoystickRumbleTriggers()
	* SDL_JoystickHasLED()
	* SDL_JoystickSetLED()
* Added an API to allow the application to create virtual joysticks:
	* SDL_JoystickAttachVirtual()
	* SDL_JoystickDetachVirtual()
	* SDL_JoystickIsVirtual()
	* SDL_JoystickSetVirtualAxis()
	* SDL_JoystickSetVirtualButton()
	* SDL_JoystickSetVirtualHat()
* Added SDL_LockSensors() and SDL_UnlockSensors() to guarantee exclusive access to the sensor list
* Added SDL_HAPTIC_STEERING_AXIS to play an effect on the steering wheel
* Added the hint SDL_HINT_MOUSE_RELATIVE_SCALING to control whether relative motion is scaled by the screen DPI or renderer logical size
* The default value for SDL_HINT_VIDEO_MINIMIZE_ON_FOCUS_LOSS is now false for better compatibility with modern window managers
* Added SDL_GetPreferredLocales() to get the application's current locale setting
* Added the hint SDL_HINT_PREFERRED_LOCALES to override your application's default locale setting
* Added SDL_OpenURL() to open a URL in the system's default browser
* Added SDL_HasSurfaceRLE() to tell whether a surface is currently using RLE encoding
* Added SDL_SIMDRealloc() to reallocate memory obtained from SDL_SIMDAlloc()
* Added SDL_GetErrorMsg() to get the last error in a thread-safe way
* Added SDL_crc32(), SDL_wcscasecmp(), SDL_wcsncasecmp(), SDL_trunc(), SDL_truncf()
* Added clearer names for RGB pixel formats, e.g. SDL_PIXELFORMAT_XRGB8888, SDL_PIXELFORMAT_XBGR8888, etc.

Windows:
* Added the RAWINPUT controller driver to support more than 4 Xbox controllers simultaneously
* Added the hint SDL_HINT_JOYSTICK_RAWINPUT to control whether the RAWINPUT driver should be used
* Added the hint SDL_HINT_JOYSTICK_HIDAPI_CORRELATE_XINPUT to control whether XInput and WGI should be used to for complete controller functionality with the RAWINPUT driver.

macOS:
* Added the SDL_WINDOW_METAL flag to specify that a window should be created with a Metal view
* Added SDL_Metal_GetLayer() to get the CAMetalLayer backing a Metal view
* Added SDL_Metal_GetDrawableSize() to get the size of a window's drawable, in pixels

Linux:
* Added the hint SDL_HINT_AUDIO_DEVICE_APP_NAME to specify the name that shows up in PulseAudio for your application
* Added the hint SDL_HINT_AUDIO_DEVICE_STREAM_NAME to specify the name that shows up in PulseAudio associated with your audio stream
* Added the hint SDL_HINT_LINUX_JOYSTICK_DEADZONES to control whether HID defined dead zones should be respected on Linux
* Added the hint SDL_HINT_THREAD_PRIORITY_POLICY to specify the thread scheduler policy
* Added the hint SDL_HINT_THREAD_FORCE_REALTIME_TIME_CRITICAL to allow time critical threads to use a realtime scheduling policy

Android:
* Added SDL_AndroidRequestPermission() to request a specific system permission
* Added the hint SDL_HINT_ANDROID_BLOCK_ON_PAUSE_PAUSEAUDIO to control whether audio will pause when the application goes intot he background

OS/2:
* Added support for OS/2, see docs/README-os2.md for details

Emscripten (running in a web browser):
* Added the hint SDL_HINT_EMSCRIPTEN_ASYNCIFY to control whether SDL should call emscripten_sleep internally
Comment 1 Alex S 2021-01-03 13:45:36 UTC
> EVDEV_CONFIGURE_ENABLE=		events

I don't think evdev has a direct relation to the SDL's events subsystem.
Comment 2 VVD 2021-01-03 14:41:50 UTC
(In reply to Alex S from comment #1)
I found in configure file this:
            freebsd)
                if test x$use_input_events = xyes; then
            
$as_echo "#define SDL_JOYSTICK_LINUX 1" >>confdefs.h
            
                    SOURCES="$SOURCES $srcdir/src/joystick/linux/*.c"
                    SOURCES="$SOURCES $srcdir/src/joystick/steam/*.c"
                    have_joystick=yes
                fi
            ;;
and this:
        # Set up files for evdev input
        if test x$use_input_events = xyes; then
            SOURCES="$SOURCES $srcdir/src/core/linux/SDL_evdev.c"
            SOURCES="$SOURCES $srcdir/src/core/linux/SDL_evdev_kbd.c"
            SOURCES="$SOURCES $srcdir/src/core/freebsd/SDL_evdev_kbd_freebsd.c"
        fi

But you are right - events is other feature.
I can't find how to avoid picking up evdev if devel/evdev-proto is installed.
Comment 3 VVD 2021-01-03 16:03:06 UTC
Created attachment 221245 [details]
update to 2.0.14, refactoring of the options

I did big refactoring of the options and didn't add EVDEV.
Comment 4 Alex S 2021-01-03 16:26:58 UTC
(In reply to VVD from comment #2)

> I can't find how to avoid picking up evdev if devel/evdev-proto is installed.

This is not configurable. It's generally in our best interest to fix possible evdev issues, rather than work around them, so I don't think it should configurable either.

My aim with making this an option in bug 249874 was giving users some way of avoiding the situation where a gamepad gets picked by both backends, which might be quite confusing (in case they produce different button mappings or whatever). It's not clear whether this will be a problem in practice. It's possible to implement this as a runtime switch if necessary. Or maybe we should eventually just disable the uhid backend, it going to be redundant once iichid is merged (https://reviews.freebsd.org/D27777).

I'd like to see the port's maintainer opinion on the matter.
Comment 5 VVD 2021-01-03 18:09:17 UTC
Created attachment 221249 [details]
update to 2.0.14 and refactoring of the options

More refactoring.

Check, please.
Comment 6 Greg V 2021-01-07 13:33:35 UTC
Works for me, evdev gamepad is picked up fine :) (Unlike some previous evdev patches)
Comment 7 VVD 2021-01-19 13:45:07 UTC
Maintainer timeout?
Comment 8 Li-Wen Hsu freebsd_committer 2021-01-19 14:13:59 UTC
maintainer timeout.
Comment 9 Dmitry Marakasov freebsd_committer 2021-01-19 15:18:08 UTC
This is in the works
Comment 10 Dmitry Marakasov freebsd_committer 2021-01-19 15:59:31 UTC
Please split into topic patches. At least separate options refactoring, new options (vulkan) and 2.0.14 update.

> VIDEO_KMSDRM_ENABLE=		video-kmsdrm kmsdrm-shared
> VIDEO_OPENGL_ENABLE=		video-opengl

These and some others do not seem to be correct.
Comment 11 VVD 2021-01-19 17:01:36 UTC
Created attachment 221746 [details]
update to 2.0.14 and refactoring of the options (v4)

(In reply to Dmitry Marakasov from comment #10)
> Please split into topic patches. At least separate options refactoring, new options (vulkan) and 2.0.14 update.
It's a lot of manual work…
We can discuss changes in the IRC #bsdports @ EFNet or #freebsd @ Freenode.

> These and some others do not seem to be correct.
Typo, then copy&paste his typo.
Fixed.
Comment 12 VVD 2021-01-19 17:05:17 UTC
Created attachment 221747 [details]
update to 2.0.14 and refactoring of the options (v4)
Comment 13 Dmitry Marakasov freebsd_committer 2021-01-19 18:29:45 UTC
(In reply to VVD from comment #11)
> It's a lot of manual work…

But it should be done.

> We can discuss changes in the IRC #bsdports @ EFNet or #freebsd @ Freenode.

I don't see any major problems, it should just not be committed as a single blob. I've had a WIP patch with a similar options refactoring, as least it should be compared to yours to make sure nothing's missing from the final variant.
Comment 14 Jan Beich freebsd_committer 2021-01-23 14:10:46 UTC
*** Bug 218289 has been marked as a duplicate of this bug. ***
Comment 15 Jan Beich freebsd_committer 2021-01-23 14:28:02 UTC
Created attachment 221841 [details]
Enable embedded gamecontrollerdb.txt for evdev

GameController API maps various joysticks onto standard gamepad layout, avoiding having to rebind buttons in each game. With evdev-based joystick support FreeBSD can re-use Linux mappings, so users no longer need to define SDL_GAMECONTROLLERCONFIG via environ(7) for popular gamepads.

   $ pkg install controllermap
   $ testgamecontroller
   INFO: Supported mappings:
   ...
  -INFO: Joystick 0: Mega World Thrustmaster dual analog 3.2 Gamepad (guid 030000004f04000015b3000001010000, VID 0x044f, PID 0xb315, player index = -1)
  -INFO: There are 0 game controller(s) attached (1 joystick(s))
  +INFO: PS3 Controller 0: Thrustmaster Dual Analog 3.2 (guid 030000004f04000015b3000001010000, VID 0x044f, PID 0xb315, player index = 0)
  +INFO: There are 1 game controller(s) attached (1 joystick(s))
Comment 16 Dmitry Marakasov freebsd_committer 2021-02-27 13:19:43 UTC
Submitter timeout;
Currently testing dependent ports
Comment 17 VVD 2021-02-27 13:24:58 UTC
The patch is ready. I have no time to split it in two.
Comment 18 Patrick McMunn 2021-04-13 19:26:06 UTC
I tested the refactoring patch plus the gamecontrollerdb.txt patch, and it compiled and installed successfully. I also had the HIDAPI option enabled, so once this is committed it can close bug 247863 also.
Comment 19 Patrick McMunn 2021-05-13 03:04:51 UTC
(In reply to VVD from comment #17)
What parts need to be split apart? Maybe I can do that work in my spare time. Splitting a patch should be within reach of my skill level.
Comment 20 Patrick McMunn 2021-05-23 20:24:28 UTC
(In reply to VVD from comment #17)
I had some time to take a look at splitting the patch. As it turns out, there's a utility already available in ports called splitpatch. There's no need for any manual work whatsoever. Just run "splitpatch sdl20_v4.diff" and it spits out 5 separate patch files ready to go.
Comment 21 Dmitry Marakasov freebsd_committer 2021-05-24 11:07:02 UTC
(In reply to Patrick McMunn from comment #20)
There's no need to split it into parts for each file. It needs to be split into topic commits, one which does options refactoring and one with the update. These are indepenent changes and should not be mixed together.