SDL2 Mouse Cursor acts inverted when cmdline.txt uses rotate=180
-
Pi Model or other hardware: Raspberry Pi 5 Model B Rev 1.0
Power Supply used: 45W USB C
RetroPie Version Used: 4.8.9 - rpi5 (aarch64) - Bookworm - Commit: 750fdd63, SDL2 2.30.8+1rpi
Built From: RaspiOS 12 Lite and RetroPie-Setup
Kernel: 6.6.51+rpt-rpi-2712
USB Devices connected: Mouse, Keyboard
Controller used: N/A
Error messages received: None
Emulator: Amiberry (5.7.1) build against SDL2 2.30.8, but any emulator that uses/displays a SDL Mouse is affectedHow to replicate the problem:
- Enter display rotation in
/boot/firmware/cmdline.txt
: eg. video=HDMI-A-1:1280x1024M@60,rotate=180 (cf. https://www.raspberrypi.com/documentation/computers/configuration.html#set-the-kms-display-mode) - Reboot and start the emulator. For Amiberry: Switch into the Amiga Menu (F12)
- Notice the Cursor is upside down and moves inverted to the user's movement. However, in an Amiberry game the mouse acts as expected.
My guess is that the firmware of the Raspberry either does provide wrong information or SDL2 does not read the values correctly.
Questions: Has someone else encountered/confirm this? Does someone with deeper insights know where to dig for the culprit or is there already a bugreport filed for this issue (firmware or SDL2)?
- Enter display rotation in
-
Can the problem be reproduced with just the SDL test apps ? In https://github.com/libsdl-org/SDL/tree/main/test, there's a
testmouse
test program that should help. That in combination withtestwm
can help diagnose the issue. -
@mitu Hmm. Did run
testwm
(compiled as Debug and with tests enabled from main/HEAD from libsdl-org/SDL) but mouse movement and orientation is the same as in Amiberry. I started X11 viaxinit $(which xterm)
from the console.testwm
was not able to start from the console directly as there was no X display.Would rebuilding this SDL with the KMSDRM settings from RP-SDL make a difference?
-
@Lolonois said in SDL2 Mouse Cursor acts inverted when cmdline.txt uses rotate=180:
Would rebuilding this SDL with the KMSDRM settings from RP-SDL make a difference?
I don't think so, the only addition from RetroPie to the KMSDRM video drvier is the initial resolution of the viewport, the rest is stock SDL2.
... as there was no X display.
or rather no WM ?
-
@mitu I was now able to run testwm/testmouse from the console without X but bottom line remains: Mouse is upside down and moves inverted.
-
@Lolonois So it's not an Amiberry bug, it's the SDL render (?) that's having this issue when you rotate the display. Does the same issue occur if you rotate the display from userspace, via
xrandr
? -
@mitu without
rotate=180
incmdline.txt
and withxrandr -o inverted
within X the orientation is upside down and the mouse follows the on desk movement: Thus when using xrandr is everything as expected. This makes me leaning towards a Rpi firmware regression. -
@Lolonois said in SDL2 Mouse Cursor acts inverted when cmdline.txt uses rotate=180:
This makes me leaning towards a Rpi firmware regression.
AFAIK Pi5 is entirely firmware free, so I don't think this is a regression ? You're supposed to use either
xrandr
orwlrandr
to rotate the video output, without the firmware. -
@mitu Well, if something worked incl. mouse orientation in the past (hdmi_rotate=..., config.txt) and then stops (rotate=..., cmdline.txt) working it is IMHO a regression as the foundation is still issuing the Rpi Kernel and firmware.
Anyhow, using
xrandr
orwlrandr
is not an option as I don't want to configure X/Wayland for SDL based emulators I have in use.It seems I have to table it at the Raspberry Pi forum.
Contributions to the project are always appreciated, so if you would like to support us with a donation you can do so here.
Hosting provided by Mythic-Beasts. See the Hosting Information page for more information.