[experimental] SDL2 with Tear-Free Zero-copy Rotation

Talking about OS and emulation core development
Post Reply
JohnnyonFlame
Posts: 10
Joined: Tue Dec 07, 2021 4:07 am
languages_spoken: english
ODROIDs: N2+, ODROID Go Super
Has thanked: 9 times
Been thanked: 2 times
Contact:

[experimental] SDL2 with Tear-Free Zero-copy Rotation

Post by JohnnyonFlame »

I am developing a backend for SDL2 that allows for display rotation with libmali on fbdev:
https://github.com/JohnnyonFlame/SDL-ge ... dev-noge2d

This can be configured via the following environment variables:

Code: Select all

# Setup native display orientation for OGU
export SDL_MALI_ORIENTATION=1
# Setup application orientation (e.g. for "TATE Mode")
export SDL_MALI_ROTATION=0
# Final rotation is 'rotation = (SDL_MALI_ORIENTATION+SDL_MALI_ROTATION) % 4;'
Thanks To:
- pcercuei: For the original triple buffering implementation (ported from SDL1.2).
- 7Ji: For the original SDL2.0.22 fbdev backend.
- shantigilbert: For EmuELEC, being patient, and helping with development/testing.
- ODROID: For the provided development hardware, your support is incredibly welcome.
- crashoverride: for the idea of using concurrent OpenGL contexts instead of GE2D for blitting, since the hardware blitter has huge performance overhead when rotating, making it impossible to run on 1080p past 20fps.

Device should land on me soon enough for proper testing. :)
Last edited by JohnnyonFlame on Sat Sep 03, 2022 10:00 am, edited 2 times in total.
These users thanked the author JohnnyonFlame for the post:
tobetter (Sat Sep 03, 2022 11:20 am)

JohnnyonFlame
Posts: 10
Joined: Tue Dec 07, 2021 4:07 am
languages_spoken: english
ODROIDs: N2+, ODROID Go Super
Has thanked: 9 times
Been thanked: 2 times
Contact:

Re: [experimental] SDL2 with Tear-Free Zero-copy Rotation

Post by JohnnyonFlame »

Added support for arbitrary, configurable display rotation:

https://www.youtube.com/watch?v=9rygQApghv8

shanti
Posts: 351
Joined: Fri Feb 15, 2019 3:12 am
languages_spoken: english, spanish
ODROIDs: Odroid N2
Has thanked: 111 times
Been thanked: 140 times
Contact:

Re: [experimental] SDL2 with Tear-Free Zero-copy Rotation

Post by shanti »

JohnnyonFlame wrote:
Sat Sep 03, 2022 4:19 am
- shantigilbert: For EmuELEC, being patient, and helping with development/testing.
Thanks to you!


This is working perfectly on the OGU, SDL is rotating and performance seems to be equal to un-rotated! so amazing job!
These users thanked the author shanti for the post:
JohnnyonFlame (Sat Sep 03, 2022 10:47 am)

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

Re: [experimental] SDL2 with Tear-Free Zero-copy Rotation

Post by crashoverride »

Since the original thread of discussion is locked, I will post to this one. The creation of an open source "libgou" was previously discussed. An initial implementation of it has been made and is expected to be released later this week. A modified version of RetroRun will also be provided to illustrate the library's use. The goal of "libgou" is to illustrate driving the pixel pipeline on OGU with GE2D scale/blit.

Slaminger
Posts: 334
Joined: Tue Jul 16, 2019 12:30 am
languages_spoken: English, French
ODROIDs: XU4, N2, N2+, C2, C4, OGA, OGA-BE, H2+, OGS, OGST
Location: Canada
Has thanked: 30 times
Been thanked: 100 times
Contact:

Re: [experimental] SDL2 with Tear-Free Zero-copy Rotation

Post by Slaminger »

Very nice indeed, seems to be working on my end as well.

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

Re: [experimental] SDL2 with Tear-Free Zero-copy Rotation

Post by crashoverride »

crashoverride wrote:
Thu Sep 08, 2022 10:11 am
The creation of an open source "libgou" was previously discussed.
The library is available here:
https://github.com/OtherCrashOverride/libgou.git

A modified version of RetroRun was created to illustrate its use (note the "gou" branch):
https://github.com/OtherCrashOverride/r ... 2/tree/gou

At the time of this writing there an issue that I can not seem to locate with regard to memory corruption in RetroRun. When using the Dreamcast core, it will appear as if a button is always pressed. In other cores, it appears that the exit button is pressed. Since the core SIGSEVs as part of its JIT, it is difficult to debug.
These users thanked the author crashoverride for the post (total 4):
shanti (Tue Sep 13, 2022 1:34 pm) • odroid (Tue Sep 13, 2022 2:17 pm) • JohnnyonFlame (Tue Sep 13, 2022 3:21 pm) • Slaminger (Tue Sep 13, 2022 10:43 pm)

JohnnyonFlame
Posts: 10
Joined: Tue Dec 07, 2021 4:07 am
languages_spoken: english
ODROIDs: N2+, ODROID Go Super
Has thanked: 9 times
Been thanked: 2 times
Contact:

Re: [experimental] SDL2 with Tear-Free Zero-copy Rotation

Post by JohnnyonFlame »

crashoverride wrote:
Tue Sep 13, 2022 1:26 pm
crashoverride wrote:
Thu Sep 08, 2022 10:11 am
The creation of an open source "libgou" was previously discussed.
The library is available here:
https://github.com/OtherCrashOverride/libgou.git

A modified version of RetroRun was created to illustrate its use (note the "gou" branch):
https://github.com/OtherCrashOverride/r ... 2/tree/gou

At the time of this writing there an issue that I can not seem to locate with regard to memory corruption in RetroRun. When using the Dreamcast core, it will appear as if a button is always pressed. In other cores, it appears that the exit button is pressed. Since the core SIGSEVs as part of its JIT, it is difficult to debug.
Thank you.

Right now I'm trying to implement SDL2 via fbdev+ge2d or fbdev+gl, but I am unable to maintain 60fps when VSync is enabled on OGU, with stock unrotated SDL2 fbdev patches, with SDL2+GE2D blitter or SDL2+GL blitter, the only way I've managed to achieve 200fps was with vsync disabled, but the tearing is absurd.

I'll investigate more in the coming days, but is there any known problem with the vop or panel drivers that could cause this? Specially since the SDL2+GL blitter runs perfectly on N2+.

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

Re: [experimental] SDL2 with Tear-Free Zero-copy Rotation

Post by crashoverride »

JohnnyonFlame wrote:
Tue Sep 13, 2022 3:25 pm
is there any known problem with the vop or panel drivers that could cause this?
I am not aware of any driver issues that would cause it. The fact that libgou + RetroRun does not experience it also further supports the premise that its not a driver issue.

JohnnyonFlame
Posts: 10
Joined: Tue Dec 07, 2021 4:07 am
languages_spoken: english
ODROIDs: N2+, ODROID Go Super
Has thanked: 9 times
Been thanked: 2 times
Contact:

Re: [experimental] SDL2 with Tear-Free Zero-copy Rotation

Post by JohnnyonFlame »

crashoverride wrote:
Tue Sep 13, 2022 5:51 pm
JohnnyonFlame wrote:
Tue Sep 13, 2022 3:25 pm
is there any known problem with the vop or panel drivers that could cause this?
I am not aware of any driver issues that would cause it. The fact that libgou + RetroRun does not experience it also further supports the premise that its not a driver issue.
The problem is that my implementation works perfectly out of the box, no tearing, 60fps on 1080p when testing on N2+ w/ EmuELEC v4.6, testing on OGU + EmuELEC sees my performance drop to 25 to 40fps with noticeable tearing.

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

Re: [experimental] SDL2 with Tear-Free Zero-copy Rotation

Post by crashoverride »

JohnnyonFlame wrote:
Tue Sep 13, 2022 10:11 pm
sees my performance drop to 25 to 40fps with noticeable tearing.
This actually reminded me of an issue I reported early on during OGU development and was the main reason for the GE2D pipeline.
viewtopic.php?p=309112#p309112
These users thanked the author crashoverride for the post:
JohnnyonFlame (Tue Sep 13, 2022 10:28 pm)

Post Reply

Return to “Platform development”

Who is online

Users browsing this forum: No registered users and 1 guest