RetroPie forum home
    • Recent
    • Tags
    • Popular
    • Home
    • Docs
    • Register
    • Login
    Please do not post a support request without first reading and following the advice in https://retropie.org.uk/forum/topic/3/read-this-first

    SDL2 Mouse Cursor acts inverted when cmdline.txt uses rotate=180

    Scheduled Pinned Locked Moved Help and Support
    sdl2firmware
    9 Posts 2 Posters 398 Views
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • LolonoisL
      Lolonois
      last edited by

      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 affected

      How to replicate the problem:

      1. 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)
      2. Reboot and start the emulator. For Amiberry: Switch into the Amiga Menu (F12)
      3. Notice the Cursor is upside down and moves inverted to the user's movement. However, in an Amiberry game the mouse acts as expected.

      Amiberry_Mouse_Upside_Down.jpeg

      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)?

      1 Reply Last reply Reply Quote 0
      • mituM
        mitu Global Moderator
        last edited by

        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 with testwm can help diagnose the issue.

        LolonoisL 1 Reply Last reply Reply Quote 0
        • LolonoisL
          Lolonois @mitu
          last edited by

          @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 via xinit $(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?

          testwm.jpg

          mituM 1 Reply Last reply Reply Quote 0
          • mituM
            mitu Global Moderator @Lolonois
            last edited by mitu

            @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 ?

            LolonoisL 1 Reply Last reply Reply Quote 0
            • LolonoisL
              Lolonois @mitu
              last edited by

              @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.

              mituM 1 Reply Last reply Reply Quote 0
              • mituM
                mitu Global Moderator @Lolonois
                last edited by

                @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 ?

                LolonoisL 1 Reply Last reply Reply Quote 0
                • LolonoisL
                  Lolonois @mitu
                  last edited by

                  @mitu without rotate=180 in cmdline.txt and with xrandr -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.

                  mituM 1 Reply Last reply Reply Quote 0
                  • mituM
                    mitu Global Moderator @Lolonois
                    last edited by mitu

                    @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 or wlrandr to rotate the video output, without the firmware.

                    LolonoisL 1 Reply Last reply Reply Quote 0
                    • LolonoisL
                      Lolonois @mitu
                      last edited by

                      @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 or wlrandr 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.

                      1 Reply Last reply Reply Quote 0
                      • First post
                        Last post

                      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.