[Release] SDL2 with screen rotation

Talking about OS and emulation core development
PaulF8080
Posts: 71
Joined: Fri Feb 14, 2020 9:40 am
languages_spoken: english
ODROIDs: go, go advance, xu4
Has thanked: 0
Been thanked: 9 times
Contact:

Re: [Release] SDL2 with screen rotation

Post by PaulF8080 »

crashoverride wrote: โ†‘
Wed Apr 22, 2020 1:55 pm
PaulF8080 wrote: โ†‘
Wed Apr 22, 2020 12:22 pm
What do mean by "provide rotation transparently"? Do you swap X and Y widths?
It means the display is rotated 90 degrees (portrait to landscape) without any modifications to programs using SDL. The X and Y widths are swapped to reflect this.
Thanks. I think I get it now. I'm learning a lot. The /dev/dri/card0 is totally new to me. The /dev/fb0 doesn't do rotation anymore via /sys/class/graphics/fb0/rotate.

I ordered touch screen for my Raspberry Pi with the same resolution. I'm hoping it will be easier for me to do SDL2 migration on the old PI which I'm comfortable with.

escalade
Posts: 270
Joined: Thu Mar 14, 2019 8:34 pm
languages_spoken: english and norwegian
Has thanked: 15 times
Been thanked: 122 times
Contact:

Re: [Release] SDL2 with screen rotation

Post by escalade »

Did anyone manage to rebase on latest git? I tried but failed :) The current code is getting a bit long in the tooth.
Maintainer of RetroELEC (XU4 / OGA / x86_64)

AreaScout
Posts: 1478
Joined: Sun Jul 07, 2013 3:05 am
languages_spoken: german, english
ODROIDs: X2, U3, XU3, C2, HiFi Shield, XU4, XU4Q,
N1, Go, VU5A, Show2, CloudShell2,
H2, N2, VU7A, VuShell, Go2, C4
Has thanked: 74 times
Been thanked: 234 times
Contact:

Re: [Release] SDL2 with screen rotation

Post by AreaScout »

    Well, I will have a look on it, but I am on training now, so earliest on weekend


    RG
    These users thanked the author AreaScout for the post:
    escalade (Wed Aug 19, 2020 12:49 pm)

    AreaScout
    Posts: 1478
    Joined: Sun Jul 07, 2013 3:05 am
    languages_spoken: german, english
    ODROIDs: X2, U3, XU3, C2, HiFi Shield, XU4, XU4Q,
    N1, Go, VU5A, Show2, CloudShell2,
    H2, N2, VU7A, VuShell, Go2, C4
    Has thanked: 74 times
    Been thanked: 234 times
    Contact:

    Re: [Release] SDL2 with screen rotation

    Post by AreaScout »


      Oho, I have just take a look on the source code and the kmsdrm backend seems to get a whole rewrite to atomic drm until now it seems that this code is only working on Android devices :o I hope that this will change and linux will also be supported, if not we have to backport drm legacy to SDL2 for versions >= 2.0.13


      https://github.com/bminor/SDL/blob/mast ... les.c#L102

      RG

      escalade
      Posts: 270
      Joined: Thu Mar 14, 2019 8:34 pm
      languages_spoken: english and norwegian
      Has thanked: 15 times
      Been thanked: 122 times
      Contact:

      Re: [Release] SDL2 with screen rotation

      Post by escalade »

      I just compiled latest git for my NUC and it works fine, so the atomic drm rewrite isn't android only. That would be big news if SDL did that :)
      Maintainer of RetroELEC (XU4 / OGA / x86_64)

      AreaScout
      Posts: 1478
      Joined: Sun Jul 07, 2013 3:05 am
      languages_spoken: german, english
      ODROIDs: X2, U3, XU3, C2, HiFi Shield, XU4, XU4Q,
      N1, Go, VU5A, Show2, CloudShell2,
      H2, N2, VU7A, VuShell, Go2, C4
      Has thanked: 74 times
      Been thanked: 234 times
      Contact:

      Re: [Release] SDL2 with screen rotation

      Post by AreaScout »

        Hello escalade


        Then the KMSDRM Video backend is now Mesa only, Mesa also supports Android extensions/functions and I think the Gallium Mesa backend aka Panfrost, Lima and what not must support them too, that means that a lot of proprietary drivers are not supported anymore by this SDL2 video backend including the one from GO2, so we must backport in the future if someone wants a version >=2.0.13


        RG

        escalade
        Posts: 270
        Joined: Thu Mar 14, 2019 8:34 pm
        languages_spoken: english and norwegian
        Has thanked: 15 times
        Been thanked: 122 times
        Contact:

        Re: [Release] SDL2 with screen rotation

        Post by escalade »

        I see, that really sucks. G31 is fully supported by Panfrost AFAIK, too bad we only got a 4.4 kernel to play with.
        Maintainer of RetroELEC (XU4 / OGA / x86_64)

        AreaScout
        Posts: 1478
        Joined: Sun Jul 07, 2013 3:05 am
        languages_spoken: german, english
        ODROIDs: X2, U3, XU3, C2, HiFi Shield, XU4, XU4Q,
        N1, Go, VU5A, Show2, CloudShell2,
        H2, N2, VU7A, VuShell, Go2, C4
        Has thanked: 74 times
        Been thanked: 234 times
        Contact:

        Re: [Release] SDL2 with screen rotation

        Post by AreaScout »

          Yes that's true but sooner or later we will get a newer kernel I hope, it's just sad to see SDL2 KMSDRM not supported anymore with the official RockChip drivers, because the support is fantastic

          edit: It's not a big deal to port the rotation patch to atomic drm for Panfrost if we use a newer kernel, in case Panfrost supports eglDupNativeFenceFDANDROID

          RG

          crashoverride
          Posts: 5144
          Joined: Tue Dec 30, 2014 8:42 pm
          languages_spoken: english
          ODROIDs: C1
          Has thanked: 0
          Been thanked: 381 times
          Contact:

          Re: [Release] SDL2 with screen rotation

          Post by crashoverride »

          This is actually a SDL problem. The kernel version and/or proprietary vendor extension (EGL_ANDROID_native_fence_sync) are not required to achieve the goal. As proof, libgo2 does the same thing using a thread with a semaphore.
          https://github.com/OtherCrashOverride/l ... lay.c#L858

          Is there a high profile GO2 application that can only work with a newer version of SDL?

          AreaScout
          Posts: 1478
          Joined: Sun Jul 07, 2013 3:05 am
          languages_spoken: german, english
          ODROIDs: X2, U3, XU3, C2, HiFi Shield, XU4, XU4Q,
          N1, Go, VU5A, Show2, CloudShell2,
          H2, N2, VU7A, VuShell, Go2, C4
          Has thanked: 74 times
          Been thanked: 234 times
          Contact:

          Re: [Release] SDL2 with screen rotation

          Post by AreaScout »

            Of course it is not needed or required, the legacy drm video backend in sdl2 was working great, thought they just changed it to stay on the newest technology
            crashoverride wrote: โ†‘
            Sat Aug 22, 2020 1:31 am
            Is there a high profile GO2 application that can only work with a newer version of SDL?
            I don't think so, maybe the OS itself requires it, if the image builders are want to stay on early releases, but 2.0.13 not even out yet, let's see and wait how this will turn out

            Thanks crash ๐Ÿ‘

            crashoverride
            Posts: 5144
            Joined: Tue Dec 30, 2014 8:42 pm
            languages_spoken: english
            ODROIDs: C1
            Has thanked: 0
            Been thanked: 381 times
            Contact:

            Re: [Release] SDL2 with screen rotation

            Post by crashoverride »

            For completeness, I should note the GO2 Kernel does support DRM Atomic Mode Setting. It just is not of any use since there is exactly one mode (320x480@60). The "legacy" API blocks on VSYNC so frame buffer switching is always "atomic".

            AreaScout
            Posts: 1478
            Joined: Sun Jul 07, 2013 3:05 am
            languages_spoken: german, english
            ODROIDs: X2, U3, XU3, C2, HiFi Shield, XU4, XU4Q,
            N1, Go, VU5A, Show2, CloudShell2,
            H2, N2, VU7A, VuShell, Go2, C4
            Has thanked: 74 times
            Been thanked: 234 times
            Contact:

            Re: [Release] SDL2 with screen rotation

            Post by AreaScout »

              The default behavior is to have VSYNC on with the legacy drm backend but if you look on the examples in the test suite of SDL2 it's the other way around

              ./testgles2 runs without VSYNC and ./testgles2 --vsync with, so in general the legacy drm video backend is able to do both

              RG

              escalade
              Posts: 270
              Joined: Thu Mar 14, 2019 8:34 pm
              languages_spoken: english and norwegian
              Has thanked: 15 times
              Been thanked: 122 times
              Contact:

              Re: [Release] SDL2 with screen rotation

              Post by escalade »

              @crashoverride

              Sorry to go a little off topic here, but I've been experimenting with gl4es in hopes of getting OpenGL working in my image but no success as of yet. I can compile it fine and link GL applications to it but I have yet to get it to display anything either on Wayland/Xwayland or through creating the context with SDL2 or RetroArch. I'd appreciate any insight you have on the matter. I've gone through every possible LIBGL_FB options and GBM/EGL/X11 CMake options but no success. I can get glxinfo to work and glxgears creates a window and reports FPS but no visual on the wheels. Here's the gl4es log when trying to start Retroarch with the gl driver:

              http://ix.io/2uSZ

              That's trying to get the KMS context working, seems to be EGL related. When glxgears runs on Weston I believe the log said glamor failed due to lack of wl_drm. I'd love to get it spinning and offer more golden oldies in my images.
              Maintainer of RetroELEC (XU4 / OGA / x86_64)

              crashoverride
              Posts: 5144
              Joined: Tue Dec 30, 2014 8:42 pm
              languages_spoken: english
              ODROIDs: C1
              Has thanked: 0
              Been thanked: 381 times
              Contact:

              Re: [Release] SDL2 with screen rotation

              Post by crashoverride »

              escalade wrote: โ†‘
              Sat Aug 22, 2020 9:05 pm
              I'd appreciate any insight you have on the matter.
              For KMS/GBM, you likely need to replace this:
              https://github.com/ptitSeb/gl4es/blob/0 ... ext.c#L196

              With GBM specific initialization like this:
              https://github.com/OtherCrashOverride/l ... 1146-L1167

              [edit]
              It looks like the function "OpenGBMDisplay" is supposed to do exactly that. Make sure its getting compiled:
              https://github.com/ptitSeb/gl4es/blob/f ... gbm.c#L311
              (NO_GBM is not defined)

              [edit2]
              Also, make sure its linking with libmali.so and not MESA libeg/gles.

              escalade
              Posts: 270
              Joined: Thu Mar 14, 2019 8:34 pm
              languages_spoken: english and norwegian
              Has thanked: 15 times
              Been thanked: 122 times
              Contact:

              Re: [Release] SDL2 with screen rotation

              Post by escalade »

              crashoverride wrote: โ†‘
              Sat Aug 22, 2020 1:31 am
              This is actually a SDL problem. The kernel version and/or proprietary vendor extension (EGL_ANDROID_native_fence_sync) are not required to achieve the goal. As proof, libgo2 does the same thing using a thread with a semaphore.
              https://github.com/OtherCrashOverride/l ... lay.c#L858

              Is there a high profile GO2 application that can only work with a newer version of SDL?
              Looks like they have rectified the situation now: https://hg.libsdl.org/SDL/rev/889d85d67a02
              Maintainer of RetroELEC (XU4 / OGA / x86_64)

              AreaScout
              Posts: 1478
              Joined: Sun Jul 07, 2013 3:05 am
              languages_spoken: german, english
              ODROIDs: X2, U3, XU3, C2, HiFi Shield, XU4, XU4Q,
              N1, Go, VU5A, Show2, CloudShell2,
              H2, N2, VU7A, VuShell, Go2, C4
              Has thanked: 74 times
              Been thanked: 234 times
              Contact:

              Re: [Release] SDL2 with screen rotation

              Post by AreaScout »

              escalade wrote: โ†‘
              Thu Sep 17, 2020 8:56 am
              Looks like they have rectified the situation now: https://hg.libsdl.org/SDL/rev/889d85d67a02
              No they don't, it is the eglDupNativeFenceFDANDROID ( https://hg.libsdl.org/SDL/file/ed05d821 ... les.c#l147 ) function they are using which our EGL lib does not support, but this is just a nested function for eglCreateSyncKHR which our driver does support, here is the function implementation commit in Mesa https://lists.freedesktop.org/archives/ ... 11577.html I am not that expert here but if they just cloud implement this function in SDL2 we still would be able to use our proprietary driver !

              edit: uhh, I have run testgles2 from latest SDL2 test suite and at least with software renderer the test does not run :( I don't like this situation, no proprietary driver support under Linux and kmsdrm backend not working with mesa software renderer, I must admit that the situation before the changes was way better !

              RG
              These users thanked the author AreaScout for the post:
              odroid (Mon Oct 19, 2020 9:50 am)

              Post Reply

              Return to โ€œPlatform developmentโ€

              Who is online

              Users browsing this forum: No registered users and 1 guest