Development Resources

Talking about OS and emulation core development
Post Reply
crashoverride
Posts: 4636
Joined: Tue Dec 30, 2014 8:42 pm
languages_spoken: english
ODROIDs: C1
Has thanked: 0
Been thanked: 156 times
Contact:

Development Resources

Unread post by crashoverride » Fri Dec 27, 2019 5:12 pm

Last edited by crashoverride on Fri Jan 03, 2020 4:44 am, edited 1 time in total.
These users thanked the author crashoverride for the post (total 2):
kamots (Fri Jan 03, 2020 3:29 am) • Paspartout (Fri Jan 03, 2020 4:56 am)

User avatar
mad_ady
Posts: 7134
Joined: Wed Jul 15, 2015 5:00 pm
languages_spoken: english
ODROIDs: XU4, C1+, C2, N1, H2, N2, Go, Go Advance
Location: Bucharest, Romania
Has thanked: 313 times
Been thanked: 219 times
Contact:

Re: Development Resources

Unread post by mad_ady » Fri Dec 27, 2019 8:46 pm

Well hello... What's that? Sounds nifty!

pmprog
Posts: 74
Joined: Thu Oct 18, 2018 4:01 am
languages_spoken: english
ODROIDs: ODROID-GO
Has thanked: 19 times
Been thanked: 1 time
Contact:

Re: Development Resources

Unread post by pmprog » Sun Dec 29, 2019 5:48 pm

Is libgo2 going to be the library for accessing display, inputs, gpio etc? Or will libraries like SDL work?

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

Re: Development Resources

Unread post by crashoverride » Mon Dec 30, 2019 3:12 am

libgo2 provides simplified access to the hardware. It is similar in concept to the "odroid-go-common" provided for the original GO:
https://github.com/OtherCrashOverride/g ... nts/odroid

The library handles display (including hardware bitblit and backlight), input (gamepad), audio (including path and volume), and battery status.

SDL will work assuming the target dependencies are met (KMS, X11, Wayland).
These users thanked the author crashoverride for the post:
pmprog (Mon Dec 30, 2019 3:14 am)

pmprog
Posts: 74
Joined: Thu Oct 18, 2018 4:01 am
languages_spoken: english
ODROIDs: ODROID-GO
Has thanked: 19 times
Been thanked: 1 time
Contact:

Re: Development Resources

Unread post by pmprog » Mon Dec 30, 2019 3:29 am

Thanks. Will libgo2 be open source too?

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

Re: Development Resources

Unread post by crashoverride » Mon Dec 30, 2019 3:38 am

pmprog wrote:
Mon Dec 30, 2019 3:29 am
Will libgo2 be open source too?
Yes! The github link will be posted in the first post of this thread when its released.
These users thanked the author crashoverride for the post:
pmprog (Mon Dec 30, 2019 5:39 am)

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

Re: Development Resources

Unread post by crashoverride » Fri Jan 03, 2020 4:44 am

Updated first post with links to libgo2, emulationstation-go2, and retrorun-go2.
These users thanked the author crashoverride for the post (total 5):
Paspartout (Fri Jan 03, 2020 4:56 am) • pmprog (Fri Jan 03, 2020 5:47 am) • odroid (Fri Jan 03, 2020 9:05 am) • joy (Fri Jan 03, 2020 9:26 am) • rooted (Mon Jan 06, 2020 12:12 am)

SlappyMcPhee
Posts: 104
Joined: Fri Aug 18, 2017 2:09 pm
languages_spoken: english
ODROIDs: XU4 (3 of them)
Has thanked: 6 times
Been thanked: 4 times
Contact:

Re: Development Resources

Unread post by SlappyMcPhee » Sat Jan 04, 2020 7:49 am

thanks for the resources!
Owner The Retro Arena and Odroid Retro Arena

maker_gamer
Posts: 9
Joined: Tue Jan 07, 2020 2:50 pm
languages_spoken: english
ODROIDs: Odroid Go, Odroid Go Advanced (preordered)
Has thanked: 0
Been thanked: 3 times
Contact:

Re: Development Resources

Unread post by maker_gamer » Thu Jan 09, 2020 3:00 pm

Crash, will any of the "frontends" have bindings for scripting languages? I suspect Lua would be the easiest to bind out the gate given there's ton's of info on it ( https://www.google.com/search?q=how+to+ ... to+c%2B%2B )

Given this is on aarch64, a scripted language performance should be a non-impact for this machine.

Plus, having scripting bindings would be inviting for more folks to extend this platform. Personally, I've not done any C++ in 25yrs. Anymore I've to hammer things out in Bash, Python, Perl, Lua (and if necessary JavaScript) for my SysAdmin work.

Thanks for all your hard work. Looking forward to my Go Advance and seeing what I can do with it beyond just playing games.

Cheers, MG

pmprog
Posts: 74
Joined: Thu Oct 18, 2018 4:01 am
languages_spoken: english
ODROIDs: ODROID-GO
Has thanked: 19 times
Been thanked: 1 time
Contact:

Re: Development Resources

Unread post by pmprog » Fri Jan 10, 2020 12:43 am

crashoverride wrote:
Fri Dec 27, 2019 5:12 pm
Libgo2
https://github.com/OtherCrashOverride/libgo2
I was expecting to see some GPIO functions in here, but there don't seem to be any, will there be? or are there other references for that?

Also, am I correct in thinking that the go2_presenter_post is what pushes the screen buffer to the LCD?

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

Re: Development Resources

Unread post by crashoverride » Fri Jan 10, 2020 8:57 am

maker_gamer wrote:
Thu Jan 09, 2020 3:00 pm
will any of the "frontends" have bindings for scripting languages?
I can only speak for the RetroRun frontend (since I wrote it). It is a command line program that can be called from a script language like BASH. It does not host any script engines.
pmprog wrote:
Fri Jan 10, 2020 12:43 am
I was expecting to see some GPIO functions in here, but there don't seem to be any, will there be?
There are not currently any GPIO functions. While they can certainly be added at a later date, I anticipated that developers would rather use a port of WIRING(PI).
These users thanked the author crashoverride for the post (total 2):
rooted (Fri Jan 10, 2020 1:40 pm) • pmprog (Fri Jan 10, 2020 4:11 pm)

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

Re: Development Resources

Unread post by crashoverride » Fri Jan 10, 2020 10:29 am

pmprog wrote:
Fri Jan 10, 2020 12:43 am
Also, am I correct in thinking that the go2_presenter_post is what pushes the screen buffer to the LCD?
Yes.

A "display" and "presenter" are created:
https://github.com/OtherCrashOverride/r ... pp#L70-L71

Then a "surface" is created to draw on:
https://github.com/OtherCrashOverride/r ... eo.cpp#L92

After a "surface" is drawn on, it is given to the "presenter" to display with optional rotation:
https://github.com/OtherCrashOverride/r ... #L193-L197

The presenter makes a copy of the surface so that it can immediately be re-used without "tearing". The copy is then queued for display at the next VSYNC.
These users thanked the author crashoverride for the post:
pmprog (Fri Jan 10, 2020 4:12 pm)

User avatar
mad_ady
Posts: 7134
Joined: Wed Jul 15, 2015 5:00 pm
languages_spoken: english
ODROIDs: XU4, C1+, C2, N1, H2, N2, Go, Go Advance
Location: Bucharest, Romania
Has thanked: 313 times
Been thanked: 219 times
Contact:

Re: Development Resources

Unread post by mad_ady » Fri Jan 10, 2020 3:55 pm

@crashoverride am I correct to assume the code is rockchip specific and can't be used to rotate the framebuffer on C2, right?

pmprog
Posts: 74
Joined: Thu Oct 18, 2018 4:01 am
languages_spoken: english
ODROIDs: ODROID-GO
Has thanked: 19 times
Been thanked: 1 time
Contact:

Re: Development Resources

Unread post by pmprog » Fri Jan 10, 2020 4:19 pm

crashoverride wrote:
Fri Jan 10, 2020 8:57 am
I anticipated that developers would rather use a port of WIRING(PI).
Thanks. I'll be happy to use whatever, just want sure what was available.
crashoverride wrote:
Fri Jan 10, 2020 10:29 am
After a "surface" is drawn on, it is given to the "presenter" to display with optional rotation:

The presenter makes a copy of the surface so that it can immediately be re-used without "tearing". The copy is then queued for display at the next VSYNC.
Forgive me then, but what's the "display" for? Why is it separate from the presenter?

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

Re: Development Resources

Unread post by crashoverride » Fri Jan 10, 2020 4:47 pm

pmprog wrote:
Fri Jan 10, 2020 4:19 pm
what's the "display" for? Why is it separate from the presenter?
A "display" object wraps a Linux DRI display device (/dev/dri/card0). All surface allocations are made from this device per Linux KMS/DRM API. This API requires that a "surface" (GEM buffer) be attached to a "framebuffer" which can then be shown by a "display":
https://github.com/OtherCrashOverride/l ... play.h#L69
https://github.com/OtherCrashOverride/l ... play.h#L84
https://github.com/OtherCrashOverride/l ... play.h#L61

The "presenter" is effectively a mini-compositor that provides a simple way to drive the display. This eliminates the need for each program to have its own display management code. In addition to maintaining surface/framebuffer mappings, it also provides triple buffering (threaded operation) and rotation transparently. Applications may still directly drive the display using the above mentioned APIs. These are the same APIs used by the "presenter" itself.
These users thanked the author crashoverride for the post:
pmprog (Fri Jan 10, 2020 7:16 pm)

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

Re: Development Resources

Unread post by crashoverride » Fri Jan 10, 2020 5:04 pm

mad_ady wrote:
Fri Jan 10, 2020 3:55 pm
am I correct to assume the code is rockchip specific and can't be used to rotate the framebuffer on C2, right?
libgo2 uses Linux DRI/KMS/DRM APIs. These are not available on the C2 (or N2) currently. It also uses Rockchip's librga for rotation.

The libgo2 API could theoretically be adapted to C2/N2 in the future. However, at the moment, it is Rockchip specific.
These users thanked the author crashoverride for the post (total 2):
mad_ady (Fri Jan 10, 2020 5:50 pm) • joy (Fri Jan 10, 2020 6:24 pm)

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

Re: Development Resources

Unread post by crashoverride » Thu Jan 23, 2020 9:27 pm

I posted a port of GO1's prosystem (Atari 7800) to GO2. This example serves to illustrate the use of libgo2:
https://github.com/OtherCrashOverride/prosystem-go2

1) A display and presenter are created:
https://github.com/OtherCrashOverride/p ... #L307-L308

2) A surface is created and memory mapped for the emulator to draw on:
https://github.com/OtherCrashOverride/p ... #L310-L311

3) Audio and input (gamepad) are initialized:
https://github.com/OtherCrashOverride/p ... main.c#L74
https://github.com/OtherCrashOverride/p ... main.c#L84

4) The render loop is then entered. The gamepad is sampled. The simulator is then stepped a single frame. This produces both audio and video:
https://github.com/OtherCrashOverride/p ... main.c#L89
https://github.com/OtherCrashOverride/p ... ain.c#L342

5) The audio is submitted and buffered by libgo2:
https://github.com/OtherCrashOverride/p ... main.c#L79

6) The surface is submitted and buffered+rotated by libgo2:
https://github.com/OtherCrashOverride/p ... #L344-L348

7) The render loop then repeats at step #4.
These users thanked the author crashoverride for the post (total 4):
mad_ady (Fri Jan 24, 2020 12:59 am) • rooted (Fri Jan 24, 2020 1:17 am) • midwan (Fri Jan 24, 2020 5:53 am) • pmprog (Fri Jan 24, 2020 7:51 am)

User avatar
mad_ady
Posts: 7134
Joined: Wed Jul 15, 2015 5:00 pm
languages_spoken: english
ODROIDs: XU4, C1+, C2, N1, H2, N2, Go, Go Advance
Location: Bucharest, Romania
Has thanked: 313 times
Been thanked: 219 times
Contact:

Re: Development Resources

Unread post by mad_ady » Fri Jan 24, 2020 1:00 am

This would be the shortest but most complex Odroid Magazine article ever :D

shanti
Posts: 85
Joined: Fri Feb 15, 2019 3:12 am
languages_spoken: english, spanish
ODROIDs: Odroid N2
Has thanked: 16 times
Been thanked: 11 times
Contact:

Re: Development Resources

Unread post by shanti » Sat Jan 25, 2020 7:30 am

For libgo2, other than to compile, is Lua needed after that? any possibility for alternative compile method?

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

Re: Development Resources

Unread post by crashoverride » Sat Jan 25, 2020 7:50 am

shanti wrote:
Sat Jan 25, 2020 7:30 am
For libgo2, other than to compile, is Lua needed after that?
Premake generates 'make' files or project files for IDEs such as Visual Studio and XCode. Lua is only used in the construction of these files.
https://premake.github.io/

Install premake4:

Code: Select all

sudo apt install premake4
Generate makefile in the libgo2 repo:

Code: Select all

premake4 gmake
make
These users thanked the author crashoverride for the post:
shanti (Sat Jan 25, 2020 2:07 pm)

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

Re: Development Resources

Unread post by crashoverride » Sat Jan 25, 2020 7:53 am

shanti wrote:
Sat Jan 25, 2020 7:30 am
any possibility for alternative compile method?
The compile uses standard 'make' and GCC (sudo apt install build-essential). I do not currently have any plans to change it.

shanti
Posts: 85
Joined: Fri Feb 15, 2019 3:12 am
languages_spoken: english, spanish
ODROIDs: Odroid N2
Has thanked: 16 times
Been thanked: 11 times
Contact:

Re: Development Resources

Unread post by shanti » Sat Jan 25, 2020 8:39 am

Thanks I was not aware of Premake :)

shanti
Posts: 85
Joined: Fri Feb 15, 2019 3:12 am
languages_spoken: english, spanish
ODROIDs: Odroid N2
Has thanked: 16 times
Been thanked: 11 times
Contact:

Re: Development Resources

Unread post by shanti » Sat Jan 25, 2020 9:00 am

Trying to cross-compile, first error:

Code: Select all

../../src/display.c:42:10: fatal error: rga/RgaApi.h: No such file or directory
 #include <rga/RgaApi.h>
compiled librga from here https://github.com/rockchip-linux/librga and it seems at least on my build (with default settings) librga is installed to "include/rk_rga" so I manually edit the display.c from <rga/RgaApi.h> to <rk_rga/RgaApi.h>

Second error:

Code: Select all

../../src/display.c: In function 'go2_surface_blit':
../../src/display.c:632:8: error: 'rga_info_t' {aka 'struct rga_info'} has no member named 'scale_mode'
     src.scale_mode = 2;
        ^
../../src/display.c: In function 'go2_presenter_post':
../../src/display.c:1003:15: warning: implicit declaration of function 'c_RkRgaColorFill'; did you mean 'c_RkRgaBlit'? [-Wimplicit-function-declaration]
     int ret = c_RkRgaColorFill(&dst);
               ^~~~~~~~~~~~~~~~
               c_RkRgaBlit
make[1]: *** [Makefile:133: obj/Debug/display.o] Error 1
make: *** [Makefile:17: go2] Error 2
any ideas?
Last edited by shanti on Sun Jan 26, 2020 3:09 am, edited 1 time in total.

User avatar
AreaScout
Posts: 1214
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
Has thanked: 44 times
Been thanked: 110 times
Contact:

Re: Development Resources

Unread post by AreaScout » Sat Jan 25, 2020 5:59 pm

    @shanti

    Use this repo https://github.com/rockchip-linux/linux-rga.git so ->

    Code: Select all

    git clone https://github.com/rockchip-linux/linux-rga.git
    cd linux-rga
    sudo mkdir /usr/local/include/rga
    sudo cp *.h /usr/local/include/rga/.
    make -j3 PROJECT_DIR=/home/odroid/linux-rga/
    sudo cp lib/librga.so /usr/local/lib/.
    sudo ldconfig
    
    edit: disable debug, by setting DEBUG := y to DEBUG := n inside the Makefile

    RG
    Last edited by AreaScout on Sat Jan 25, 2020 8:59 pm, edited 1 time in total.
    These users thanked the author AreaScout for the post:
    shanti (Sun Jan 26, 2020 3:09 am)

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

    Re: Development Resources

    Unread post by crashoverride » Sat Jan 25, 2020 8:06 pm

    As noted by @AreaScout, the librga.so repo is:
    https://github.com/rockchip-linux/linux-rga.git

    The compile procedure used is:

    Code: Select all

    mkdir build
    make CFLAGS=-fPIC PROJECT_DIR=build
    
    # Library
    cp build/lib/librga.so /usr/local/lib/aarch64-linux-gnu/
    
    # Headers
    cp drmrga.h /usr/local/include/rga/
    cp rga.h /usr/local/include/rga/
    cp RgaApi.h /usr/local/include/rga/
    cp RockchipRgaMacro.h /usr/local/include/rga/
    
    These users thanked the author crashoverride for the post:
    shanti (Sun Jan 26, 2020 3:09 am)

    shanti
    Posts: 85
    Joined: Fri Feb 15, 2019 3:12 am
    languages_spoken: english, spanish
    ODROIDs: Odroid N2
    Has thanked: 16 times
    Been thanked: 11 times
    Contact:

    Re: Development Resources

    Unread post by shanti » Sun Jan 26, 2020 2:57 am

    Thanks, that did it:)

    Post Reply

    Return to “Platform development”

    Who is online

    Users browsing this forum: No registered users and 0 guests