GBM Video Driver - Retro Gaming - Tinkering Image Howto

Moderators: odroid, mdrjr

GBM Video Driver - Retro Gaming - Tinkering Image Howto

Unread postby AreaScout » Sun Sep 09, 2018 11:20 pm

DIY GBM GPU Driver Retro Gaming Tinkering Showcase Image Howto

Hi all, I didn't know exactly where to place this post, somewhere in XU3/XU4 sub forum ? somewhere in VU5A sub forum ? somewhere in gaming ? there is a Howto about
VU5A Display, Howto install GBM enabled Userspace Drivers and Howto build Retro Gaming Emulators, so I decided to place it here 8-) First of all this Howto will showcase
the use of the Mali GBM enabled userspace library in real live, how good it works and for what it can be used. For all the showcases it uses a VU5A display ( really a nice toy )

Image

The Howto will install an Ubuntu 18.04 minimal image for XU3/4 and prepare the use of the GBM Mali Driver for it,
as a result PPSSPP will run notorious hard to emulate games pretty good and without tearing



Download and install the Image:

https://odroid.in/ubuntu_18.04lts/ubuntu-18.04-4.14-minimal-odroid-xu4-20180531.img.xz

Extract and write it on eMMC or SD

Installing and configure:

login for that image is:

user:root
pw:odroid


Update the image:

Code: Select all
apt update && apt full-upgrade -y


Get some package requirements:

Code: Select all
apt-get install mali-x11 libx11-dev libsm-dev libxext-dev git cmake mercurial libudev-dev libdrm-dev zlib1g-dev pkg-config libasound2-dev alsa-utils htop bc ifupdown2 net-tools libssl1.0-dev mlocate bluez libfreetype6-dev libgbm-dev


Add User + add to groups:

Code: Select all
adduser odroid
usermod -aG sudo,adm,audio,operator,input,video,tty,staff,games,users,plugdev,netdev,bluetooth,disk odroid


Logon with created user:

Code: Select all
su - odroid


Enable color prompt:

Code: Select all
sed -i '1iforce_color_prompt=yes' ~/.bashrc
su odroid


Turn the mali-x11 display driver in GBM enabled one, this is normally relatively easy to do by only update eglplatform.h which is multi platform (ie. fbdev x11 and GBM)
But we want update the other headers too !

Code: Select all
cd /usr/include/EGL
sudo rm eglplatform.h
sudo wget https://www.khronos.org/registry/EGL/api/EGL/eglplatform.h
cd /usr/include/GLES2
sudo rm *
sudo wget https://www.khronos.org/registry/OpenGL/api/GLES2/gl2platform.h
sudo wget https://www.khronos.org/registry/OpenGL/api/GLES2/gl2.h
sudo wget https://www.khronos.org/registry/OpenGL/api/GLES2/gl2ext.h
cd /usr/include/GLES3
sudo rm *
sudo wget https://www.khronos.org/registry/OpenGL/api/GLES3/gl3.h
sudo wget https://www.khronos.org/registry/OpenGL/api/GLES3/gl31.h
sudo wget https://www.khronos.org/registry/OpenGL/api/GLES3/gl32.h
sudo wget https://www.khronos.org/registry/OpenGL/api/GLES3/gl3platform.h


Phew done, now get the new driver binary:

Code: Select all
cd ~
wget http://deb.odroid.in/bigmali.tar
tar xf bigmali.tar libmali.so
sudo mv libmali.so /usr/lib/arm-linux-gnueabihf/mali-egl/.


add a missing symbolic link:

Code: Select all
sudo ln -s /usr/lib/arm-linux-gnueabihf/mali-egl/libmali.so /usr/lib/arm-linux-gnueabihf/libGLESv1_CM.so.1


add new directory, open up vi editor for /usr/local/lib/pkgconfig/gbm.pc

Code: Select all
sudo mkdir /usr/local/lib/pkgconfig
sudo vi /usr/local/lib/pkgconfig/gbm.pc


and add this into a new file:

prefix=/usr/local
exec_prefix=${prefix}
includedir=${prefix}/include
libdir=${exec_prefix}/lib
Name: libgbm
Description: A small gbm implementation
Version: 19.0.0
Cflags: -I${includedir}
Libs: -L${libdir} -lgbm


save and close vi

add symbolic links for libgbm:

Code: Select all
cd /usr/local/lib/
sudo ln -s /usr/lib/arm-linux-gnueabihf/mali-egl/libmali.so libgbm.so
sudo ln -s libgbm.so libgbm.so.19
sudo ln -s libgbm.so.19 libgbm.so.19.0.0
sudo ldconfig


get gbm.h and delete the one from mesa

Code: Select all
cd /usr/include
sudo rm gbm.h
sudo wget -O gbm.h https://pastebin.com/raw/5QUd011t


checkout SDL2, build and install it:

Code: Select all
cd ~
hg clone http://hg.libsdl.org/SDL SDL2
cd SDL2
./configure --disable-video-opengl --enable-video-kmsdrm


after configure is finished you should see this line Video drivers : dummy x11(dynamic) kmsdrm(dynamic) opengl_es1 opengl_es2 vulkan

now we have to edit SDL_config.h to permanently dlopen our libgbm.so.19 instead of the libgbm.so.1 from Mesa and start to build and install it:

Code: Select all
sed -i -e 's/libgbm.so.1/libgbm.so.19/g' include/SDL_config.h
make -j7
sudo make install


after building is done -> time to test !

Code: Select all
cd test
./configure
make -j7
./testgles2


You should see a spinning cube, wait some seconds and quit with ESC key

And if you are on VU5A, you will notice something like this which is TOO SLOW:

INFO: 56.89 frames per second

It should reach 60fps, if not it's a real problem for emulators, if they try to just hold 60fps and they can't, then it will really slow down things a lot, very good to observe on PPSSPP game intro videos

Building the Kernel for >60fps on VU5A: (Update: The kernel patch isn't needed anymore, it's already upstream)

As we have to patch the kernel to get more then 56fps, I will open an PR and maybe you can get this patch included in mainline and updated bei the apt package system,
but here a quick reminder on how to do it by our own.

So the pixel clock and probably some H or V sync timing values of HDMI PHY config are not right for that VU5A Display, more explanation here https://github.com/hardkernel/linux/commit/6cb93b55deffdd634a0a114384da2f238493af6d
Ok so Hardkernel took the closest one but they choose it to be on the lower side of 60fps, for emulation it's better to choose the higher side of 60fps, so at the end we will have a fixed frame rate of 64fps, it can't be higher then that but lower, which is ok.

checkout the kernel, you will need some GB free of space ! We choose to take the HDMI PHI config from the next higher pixel clock, what is really inside this HDMI PHY config is unknown to the public
I have asked several developers but no one could give me an answer, only in kernel 3.10 there is some small code to change this 32byte long config, so only some few bytes are known, but they don't change the refresh rate :(

Code: Select all
git clone https://github.com/hardkernel/linux.git
cd linux
wget -O VU5A.patch https://pastebin.com/raw/aWEYArWL
patch -p1 < VU5A.patch

make odroidxu4_defconfig
make -j7
sudo cp arch/arm/boot/zImage /media/boot/.
sudo cp arch/arm/boot/dts/exynos5422-odroidxu4.dtb /media/boot/.
sudo make modules_install


time to reboot and test fps again

Code: Select all
cd SDL2/test
./testgles2


now you should see something like this

INFO: 64.01 frames per second

In the next post we will build PPSSPP, after this we will build RetroArch with GBM KMSDRM backend + some libretros, it's huge, but for today -> see you later !


Have Fun
Last edited by AreaScout on Sun Nov 04, 2018 9:50 pm, edited 5 times in total.
User avatar
AreaScout
 
Posts: 638
Joined: Sun Jul 07, 2013 3:05 am
languages_spoken: english, german
ODROIDs: X2, U3, XU3, C2, XU4, XU4Q, N1, Go, VU5A, Show2, CloudShell2

Re: GBM Video Driver - Retro Gaming - Tinkering Image Howto

Unread postby mad_ady » Mon Sep 10, 2018 1:23 am

Great work! It belongs in the magazine!
User avatar
mad_ady
 
Posts: 4736
Joined: Wed Jul 15, 2015 5:00 pm
Location: Bucharest, Romania
languages_spoken: english
ODROIDs: XU4, C1+, C2, N1

Re: GBM Video Driver - Retro Gaming - Tinkering Image Howto

Unread postby rooted » Mon Sep 10, 2018 3:46 am

I don't know how you figured all that out but I'm glad you did. I agree this could be a nice feature for the magazine.

What are those tiny speakers? They sound amazing.
User avatar
rooted
 
Posts: 5700
Joined: Fri Dec 19, 2014 9:12 am
Location: Gulf of Mexico, US
languages_spoken: english
ODROIDs: C1, C1+, C2
XU3 Lite, XU4
N1
VU7+
HiFi Shield 2
Smart Power (original)

Re: GBM Video Driver - Retro Gaming - Tinkering Image Howto

Unread postby odroid » Mon Sep 10, 2018 11:13 am

Very exciting project!
It seems to be a technical concept for the ODROID-GO Advance.

Can you please check the God of War performance with only four LITTLE cores?
Edit /media/boot/boot.ini something like this and you can disable four big cores.
Code: Select all
setenv bootrootfs "maxcpus=4 console=tty1 console=ttySAC2,115200n8 root=UUID=e139ce78-9841-40fe-8823-96a304a09859 rootwait ro fsck.repair=yes net.ifnames=0"

I want to know the PPSSPP performance without big A15 cores to see a feasbility of the battery powered Exynos-5422 portable device with a 3.5inch 480x320 MIPI LCD.
User avatar
odroid
Site Admin
 
Posts: 28890
Joined: Fri Feb 22, 2013 11:14 pm
languages_spoken: English
ODROIDs: ODROID

Re: GBM Video Driver - Retro Gaming - Tinkering Image Howto

Unread postby memeka » Mon Sep 10, 2018 1:43 pm

odroid wrote:Very exciting project!
It seems to be a technical concept for the ODROID-GO Advance.

Can you please check the God of War performance with only four LITTLE cores?
Edit /media/boot/boot.ini something like this and you can disable four big cores.
Code: Select all
setenv bootrootfs "maxcpus=4 console=tty1 console=ttySAC2,115200n8 root=UUID=e139ce78-9841-40fe-8823-96a304a09859 rootwait ro fsck.repair=yes net.ifnames=0"

I want to know the PPSSPP performance without big A15 cores to see a feasbility of the battery powered Exynos-5422 portable device with a 3.5inch 480x320 MIPI LCD.


PPSSPP should work great even with little cores since it actually uses the GPU, and the resolution you want to use is quite small.
I know GPU is slowed down by the little cores (probably because of memcpy since zero-copy is not working with gbm drivers - hope @mdrjr can fix this soon) but it should still be ok for small resolution.
User avatar
memeka
 
Posts: 4056
Joined: Mon May 20, 2013 10:22 am
languages_spoken: english
ODROIDs: XU rev2 + eMMC + UART
U3 + eMMC + IO Shield + UART

Re: GBM Video Driver - Retro Gaming - Tinkering Image Howto

Unread postby AreaScout » Mon Sep 10, 2018 3:27 pm

odroid wrote:Very exciting project!
It seems to be a technical concept for the ODROID-GO Advance.

Can you please check the God of War performance with only four LITTLE cores?
Edit /media/boot/boot.ini something like this and you can disable four big cores.
Code: Select all
setenv bootrootfs "maxcpus=4 console=tty1 console=ttySAC2,115200n8 root=UUID=e139ce78-9841-40fe-8823-96a304a09859 rootwait ro fsck.repair=yes net.ifnames=0"

I want to know the PPSSPP performance without big A15 cores to see a feasbility of the battery powered Exynos-5422 portable device with a 3.5inch 480x320 MIPI LCD.


Code: Select all
odroid@odroid:~/usb/ppsspp$ cat /proc/cmdline
maxcpus=4 console=tty1 console=ttySAC2,115200n8 root=UUID=e139ce78-9841-40fe-8823-96a304a09859 rootwait ro fsck.repair=yes net.ifnames=0  HPD=true vout=hdmi usbhid.quirks=0x0eef:0x0005:0x0004 smsc95xx.macaddr=00:1e:06:61:7a:39 false s5p_mfc.mem=16M


@odroid

unplayable 44% Speed, compared to 100% with all 8 cores, but still better compared to other SBC's, this game is really hard to emulate there are for sure some special PSP hacks in there, that game was tuned on the bare maximum that hardware could archive I believe, absolutely incredible how good it runs, I have seen desktop PC's struggle with it.

rooted wrote:I don't know how you figured all that out but I'm glad you did. I agree this could be a nice feature for the magazine.

What are those tiny speakers? They sound amazing.


@rooted

Those are the once from HK sold with that Display, they are really cool looking and sound is very good

RG
User avatar
AreaScout
 
Posts: 638
Joined: Sun Jul 07, 2013 3:05 am
languages_spoken: english, german
ODROIDs: X2, U3, XU3, C2, XU4, XU4Q, N1, Go, VU5A, Show2, CloudShell2

Re: GBM Video Driver - Retro Gaming - Tinkering Image Howto

Unread postby odroid » Mon Sep 10, 2018 3:49 pm

Thank you for the test result.
Please try "maxcpus=5" and let me know the speed rate. I think 4+1 cluster is still acceptable to play 4~5 hours continuously with a 3000mAh Li-Polymer battery.
User avatar
odroid
Site Admin
 
Posts: 28890
Joined: Fri Feb 22, 2013 11:14 pm
languages_spoken: English
ODROIDs: ODROID

Re: GBM Video Driver - Retro Gaming - Tinkering Image Howto

Unread postby memeka » Mon Sep 10, 2018 4:06 pm

@AreaScout also try ppsspp with frameskipping on little cores.
User avatar
memeka
 
Posts: 4056
Joined: Mon May 20, 2013 10:22 am
languages_spoken: english
ODROIDs: XU rev2 + eMMC + UART
U3 + eMMC + IO Shield + UART

Re: GBM Video Driver - Retro Gaming - Tinkering Image Howto

Unread postby AreaScout » Mon Sep 10, 2018 5:18 pm

memeka wrote:@AreaScout also try ppsspp with frameskipping on little cores.


I use 2 times Frameskipping as a standard and Auto frameskip off, with 3 times it's not smooth anymore, 2 times it's still smooth and Auto frameskip on does things slow down (audio hickups) on GoW which is totally the way around compared to all other games

RG
User avatar
AreaScout
 
Posts: 638
Joined: Sun Jul 07, 2013 3:05 am
languages_spoken: english, german
ODROIDs: X2, U3, XU3, C2, XU4, XU4Q, N1, Go, VU5A, Show2, CloudShell2

Re: GBM Video Driver - Retro Gaming - Tinkering Image Howto

Unread postby AreaScout » Mon Sep 10, 2018 5:40 pm

odroid wrote:Thank you for the test result.
Please try "maxcpus=5" and let me know the speed rate. I think 4+1 cluster is still acceptable to play 4~5 hours continuously with a 3000mAh Li-Polymer battery.


Code: Select all
odroid@odroid:~$ cat /proc/cmdline
maxcpus=5 console=tty1 console=ttySAC2,115200n8 root=UUID=e139ce78-9841-40fe-8823-96a304a09859 rootwait ro fsck.repair=yes net.ifnames=0  HPD=true vout=hdmi usbhid.quirks=0x0eef:0x0005:0x0004 smsc95xx.macaddr=00:1e:06:61:7a:39 false s5p_mfc.mem=16M


No still unplayable < 70% Speed, but with that combination (4+1) I think 80% of the games would be playable, GoW is really CPU/GPU hungry

But it's just slow, all graphic effects are there and it's smooth slow which is already a good sign
User avatar
AreaScout
 
Posts: 638
Joined: Sun Jul 07, 2013 3:05 am
languages_spoken: english, german
ODROIDs: X2, U3, XU3, C2, XU4, XU4Q, N1, Go, VU5A, Show2, CloudShell2

Re: GBM Video Driver - Retro Gaming - Tinkering Image Howto

Unread postby odroid » Mon Sep 10, 2018 6:07 pm

Appreciate your test. It is very helpful to understand what GoW is a very heavy game to emulate.
User avatar
odroid
Site Admin
 
Posts: 28890
Joined: Fri Feb 22, 2013 11:14 pm
languages_spoken: English
ODROIDs: ODROID

Re: GBM Video Driver - Retro Gaming - Tinkering Image Howto

Unread postby AreaScout » Mon Sep 10, 2018 6:14 pm

odroid wrote:Appreciate your test. It is very helpful to understand what GoW is a very heavy game to emulate.


Tekken 6, Indiana Jones - Staff of Kings, The Lord of the Rings: Aragorn's Quest

All playable with 4+1 2xPSP
User avatar
AreaScout
 
Posts: 638
Joined: Sun Jul 07, 2013 3:05 am
languages_spoken: english, german
ODROIDs: X2, U3, XU3, C2, XU4, XU4Q, N1, Go, VU5A, Show2, CloudShell2

Re: GBM Video Driver - Retro Gaming - Tinkering Image Howto

Unread postby memeka » Mon Sep 10, 2018 6:33 pm

wow GoW must be really heavy.
i always used tekken 6 as a benchmark...
User avatar
memeka
 
Posts: 4056
Joined: Mon May 20, 2013 10:22 am
languages_spoken: english
ODROIDs: XU rev2 + eMMC + UART
U3 + eMMC + IO Shield + UART

Re: GBM Video Driver - Retro Gaming - Tinkering Image Howto

Unread postby AreaScout » Mon Sep 10, 2018 7:02 pm

@odroid

I know everything is about Gameboy like devices a.t.m, but a nice case for VU5A as traveling device, but it on table with a pillar and play games, read email, write notes, like a device in the middle between cellphone and laptop, able to just connect a keyboard or a gamepad would be nice ;)

RG
User avatar
AreaScout
 
Posts: 638
Joined: Sun Jul 07, 2013 3:05 am
languages_spoken: english, german
ODROIDs: X2, U3, XU3, C2, XU4, XU4Q, N1, Go, VU5A, Show2, CloudShell2

Re: GBM Video Driver - Retro Gaming - Tinkering Image Howto

Unread postby AreaScout » Tue Sep 11, 2018 9:56 pm

memeka wrote:wow GoW must be really heavy.
i always used tekken 6 as a benchmark...


Yes and there are thousands of videos out there on YouTube how to squeeze out all of the performance on your Android Cellphone with choosing the right settings !
On a modern Mali G71 MP20 GPU this game runs with 3xPSP (hi ODROID N2 hopefully)

https://www.youtube.com/results?search_query=ppsspp+god+of+war+chains+of+olympus+settings

But still not bad for our 6 years old T-628 GPU
User avatar
AreaScout
 
Posts: 638
Joined: Sun Jul 07, 2013 3:05 am
languages_spoken: english, german
ODROIDs: X2, U3, XU3, C2, XU4, XU4Q, N1, Go, VU5A, Show2, CloudShell2

Re: GBM Video Driver - Retro Gaming - Tinkering Image Howto

Unread postby AreaScout » Wed Sep 12, 2018 12:14 am

Building PPSSPP

Image

Checkout the source:

Code: Select all
cd ~
git clone --recursive https://github.com/hrydgard/ppsspp.git


As the source is finished downloading do apply a patch

FFmpeg needs to build before the ppsspp binary is build, the pre-build binaries are all for soft floating points and we need hardfp

Code: Select all
cd ppsspp/ffmpeg
./linux_armhf.sh
cd ..


Before we can start to compile we have to turn our /usr/include/GLES2/gl2ext.h into an vendor specific one by disable the use of GL_EXT_buffer_storage, a backup file is created gl2ext.h.back
Our Mali library does not include/export that function so we can't define it.

Code: Select all
sudo sed -i.bak '/^\#ifndef GL_EXT_buffer_storage$/,/^$/d' /usr/include/GLES2/gl2ext.h


You may want to set the use of only 4 cores in FFmpeg for tinkering and experimenting, I have observed that FFmpeg with threading doesn't work out very well when all cores are choosen with
HMP (switching higher demanding tasks from LITTLE to the BIG CPU's), for this you can edit this file:

Core/HW/MediaEngine.cpp Line number 475 to use only 4 cores (better for switching from 4 LITTLE to 4 BIG instead using all 8 cores)

But this was observed in Moonlight with GameStreaming 1080p video files, PPSSPP video files are not that big and maybe therefore not so CPU intensive so that may only impact very little to nothing

Code: Select all
av_dict_set(&opt, "threads", "4", 0);


Now to generate the Makefile

Code: Select all
cmake -DUSING_EGL=OFF -DUSING_GLES2=ON -DUSE_FFMPEG=YES -DUSE_SYSTEM_FFMPEG=NO .


And start compiling the binary with

Code: Select all
make -j7


If you are on VU5A you have now touchscreen capabilities in menu and you can also enable 'On-Screen touch controls' if you want ;)

https://youtu.be/QegJlwflkZk?t=374

And you can now brand your emulated PPSSPP to an unique region by generate a locale for it, that would be for my country de_AT, so:

Code: Select all
sudo locale-gen de_AT.UTF-8
sudo update-locale LANG=de_AT.UTF-8


Some Games may use it for In-Game Language

And attached I have my settings for GoW + some texture replacements for Star Wars - The Clone Wars and Star Wars - The Force Unleashed so the Games are playable

edit: new updated ppsspp.zip file

Code: Select all
odroid@odroid:~$ tree -d .config/ppsspp/
.config/ppsspp/
└── PSP
    ├── PPSSPP_STATE
    ├── SAVEDATA
    │   ├── ULES01284SAVE00
    │   └── ULES01376SYSDATA
    ├── SYSTEM
    │   └── CACHE
    └── TEXTURES
        ├── ULES00981
        └── ULES01284

10 directories


ppsspp.zip
(8.61 KiB) Downloaded 19 times


Have Fun
Last edited by AreaScout on Wed Oct 03, 2018 6:41 pm, edited 11 times in total.
User avatar
AreaScout
 
Posts: 638
Joined: Sun Jul 07, 2013 3:05 am
languages_spoken: english, german
ODROIDs: X2, U3, XU3, C2, XU4, XU4Q, N1, Go, VU5A, Show2, CloudShell2

Re: GBM Video Driver - Retro Gaming - Tinkering Image Howto

Unread postby odroid » Thu Sep 13, 2018 9:14 am

Thank you for the detail and beautiful guide :D
User avatar
odroid
Site Admin
 
Posts: 28890
Joined: Fri Feb 22, 2013 11:14 pm
languages_spoken: English
ODROIDs: ODROID

Re: GBM Video Driver - Retro Gaming - Tinkering Image Howto

Unread postby AreaScout » Thu Sep 13, 2018 5:50 pm

odroid wrote:Thank you for the detail and beautiful guide :D


And there is more about to come !

@all

There was still a circular dependencies linkage error in my PPSSPP tutorial, I have fixed and updated the post, further more I will look into get this Upstream in an acceptable state
stay tuned the next days/weeks

RG

P.S.: So don't forget to always pull the latest updates from Upstream
User avatar
AreaScout
 
Posts: 638
Joined: Sun Jul 07, 2013 3:05 am
languages_spoken: english, german
ODROIDs: X2, U3, XU3, C2, XU4, XU4Q, N1, Go, VU5A, Show2, CloudShell2

Re: GBM Video Driver - Retro Gaming - Tinkering Image Howto

Unread postby AreaScout » Sat Sep 15, 2018 12:54 am

Building and configure RetroArch



Get source code and apply patch + build:

First we need a small patch which prevents us to have the menu with only a black background, ok let's start

Code: Select all
git clone https://github.com/libretro/RetroArch.git
cd RetroArch
wget -O retro.patch https://pastebin.com/raw/1SCeb8EG
patch -p1 < retro.patch
./configure --enable-opengles3 --enable-opengles --enable-neon --enable-floathard --enable-freetype
make -j7
sudo make install
retroarch



Apply some useful settings:

First of all this is a suggestion from me to you to setup RetroArch, after it's installed you don't have to follow that tutorial anymore !

Update the Assets (Icons, background pictures and stuff), you can find it here:

MainMenu -> Online Updater -> Upate Assets I suggest you to Update also this packages Core Info Files, Joypad Profiles, Database, GLSL Shaders
and of course you should use the Core Updater to get some emulators :)

Enable Advanced Settings:

Settings -> User Interface -> Show Advanced Settings -> ON

Enable Threaded Video - It will boost up emulation a lot:

Settings -> Video -> Threaded Video -> ON

Enable FPS counter, it is helpful to see how fast the emulation runs, especially when you setup things:

Settings -> Onscreen Display -> Onscreen Notifications -> Display Framerate -> ON

Settings -> Onscreen Display -> Onscreen Notifications -> Show frame count on FPS Display -> OFF

Settings -> Driver -> Audio Driver -> alsathread

and if you are on VU5A:

Settings -> Onscreen Display -> Onscreen Notifications -> Notification size -> 18

Settings -> Onscreen Display -> Onscreen Notifications -> Notification X position -> 0.010

Settings -> Onscreen Display -> Onscreen Notifications -> Notification Y position -> 0.010

If you have already games somewhere in a folder on your XU4, scan for your games:

Import Content -> Scan Directory choose your root game folder to let RetroArch scan for your games, they will appear on the right side of the menu after some time

That's it for now, next time mame libretro 0.200 will be compiled because the one online seems not to work and I have some speed 'hacks' for it + some more emulator specific settings

Have fun
Last edited by AreaScout on Sat Sep 22, 2018 8:17 pm, edited 1 time in total.
User avatar
AreaScout
 
Posts: 638
Joined: Sun Jul 07, 2013 3:05 am
languages_spoken: english, german
ODROIDs: X2, U3, XU3, C2, XU4, XU4Q, N1, Go, VU5A, Show2, CloudShell2

Re: GBM Video Driver - Retro Gaming - Tinkering Image Howto

Unread postby AreaScout » Wed Sep 19, 2018 6:15 am

Building and configure Versatile Commodore Emulator with no-border hack

Image

Prolog

You may have noticed that the PPSSPP guide was broken sometimes, either the patches didn't apply to current master or I simply forgot something for the new patch :o
The good news it, today my changes got merged into master and if you have that modified header files mentioned in the PPSSPP howto it will build out of the box (ffmpeg still needs patch) :)
I am happy that this commit is done, it was not easy to solve that puzzle but at the end it worked out and I had some good help from the project maintainers.

Ok now to vice libretro ... yes vice before mame libretro ;)

Checkout the source and apply a patch:

Get some pre-requirements

Code: Select all
sudo apt-get install bison


Checkout the source and apply the no-border patch for VIC-II Commodore machines if you want
This will remove the border of C64 and C128 machine models, the games are way better to view without it
this is more or like a quick and dirty way to do it, a better approach would be to add it to the libretro config
able to adjust it from within RetroArch, maybe I will add that too.
If a game draws inside those borders it will not work and the core will probably segfault, but not a lot of games
are drawing into the border.

Code: Select all
git clone https://github.com/libretro/vice-libretro.git
cd vice-libretro
wget -O noborder.patch https://pastebin.com/raw/VwtSDj50
patch -p1 < noborder.patch


Start to build a Commodore machine of your choice, valid machine types are:

x128, x64, x64sc, x64dtv, x64scpu, xplus4, xvic, xcbm5x0, xcbm2, xpet

You must add a EMUTYPE variable followed by the machine type you want to build, if you don't x64(C64) is default

Code: Select all
make EMUTYPE=x64 -f Makefile.libretro -j7


If you want to build more then one machine type, don't forget to run clean (make EMUTYPE=x64 -f Makefile.libretro -j7 clean) on the project otherwise the core will not work

Do some RetroArch config:

Copy the binary into RetroArch core folder

Code: Select all
cp vice_x64_libretro.so ~/.config/retroarch/cores/.


Start RetroArch select the vice core, either start the core without game or with, hit the Guide button on your game controller or F1 on the keyboard and scroll down to Options
enter it and disable DriveTrueEmulaton->OFF, with, it will take very long to load a game and set Controller0Type to joystick

I also enable a Aspect Ratio of 16:10, I think it's a good compromise between 4:3 and 16:9

Settings -> Video -> Aspect Ratio -> 16:10

With the Start button you activate the nuklear GUI settings (Select button has to pressed once to activate mouse) from there you can choose the C64 Joyport, machine cpu, sid type and more
The Onscreen keyboard is activated with the x button (Xbox layout)

That should be all

Have fun
User avatar
AreaScout
 
Posts: 638
Joined: Sun Jul 07, 2013 3:05 am
languages_spoken: english, german
ODROIDs: X2, U3, XU3, C2, XU4, XU4Q, N1, Go, VU5A, Show2, CloudShell2

Re: GBM Video Driver - Retro Gaming - Tinkering Image Howto

Unread postby AreaScout » Sat Sep 22, 2018 6:18 pm

.
Building and configure Reicast core - a Dreamcast emulator

Image



Checkout the source and apply a patch as usual:

Code: Select all
cd ~
git clone https://github.com/libretro/reicast-emulator.git
wget -O xu4.patch https://pastebin.com/raw/pfVjnVs3
patch -p1 < xu4.patch
platform=odroid ARCH=arm make -j7
strip reicast_libretro.so
cp reicast_libretro.so ~/.config/retroarch/cores/.


First you need some bios for NAOMI and Dreamcast here are some good links how they called and where to place them

https://www.libretro.com/index.php/reicast-libretro-now-supports-naomi-other-additions/

and

https://docs.libretro.com/library/reicast/

If you want to know the md5 checksum of the NAOMI bios file you can take a look into the core info file /home/odroid/.config/retroarch/cores/reicast_libretro.info

Inside a game open RetroArch menu and go to core options find the following settings and change them to:

reicast_framerate = "normal"
reicast_enable_rttb = "enabled"
reicast_threaded_rendering = "enabled"

This are the most important to get a decent speed

Have fun
User avatar
AreaScout
 
Posts: 638
Joined: Sun Jul 07, 2013 3:05 am
languages_spoken: english, german
ODROIDs: X2, U3, XU3, C2, XU4, XU4Q, N1, Go, VU5A, Show2, CloudShell2

Re: GBM Video Driver - Retro Gaming - Tinkering Image Howto

Unread postby AreaScout » Fri Sep 28, 2018 8:22 pm

    Config HDMI signal strength for i.e Game cabinet with long HDMI cables

    Image

    This is for makers and tinkering only ! Use it for your own risk !

    Some of you may know this feature, it was part of the 3.10.y kernel and it has to be configured via boot.ini https://wiki.odroid.com/odroid-xu4/application_note/hdmiphy_configuration
    on 4.14 kernel it's not implemented and with this feature on 3.10 kernel you could edit exactly those 32 bytes from the HDMI PHY config which we changed in the first post to get >60fps on a VU5A Display

    I have written a small tool to change those parameters and output the whole 32 byte string with the changes you made to console, from there you can copy paste it to the source code compile it and use the zImage on your Image.
    Compiling this on an already generated existing kernel source tree takes only 2min.

    Ok, checkout the source code

    Code: Select all
    git clone https://github.com/AreaScout/HDMI-PHY-config.git
    cd HDMI-PHY-config
    make
    ./hdmi_signal -h
    Usage: ./hdmi_signal [-h] [--help] this screen
            [-A]  TMDS data TX_AMP_LVL amplitude control, default is 17
            [-C0] TMDS data TX_LVL_CH0 amplitude fine control for each channel, Default is 1
            [-C1] TMDS data TX_LVL_CH1 amplitude fine control for each channel, Default is 0
            [-C2] TMDS data TX_LVL_CH2 amplitude fine control for each channel, Default is 2
            [-E]  TMDS data TX_EMP_LVL pre-emphasis level control, default is 6
            [-CA] TMDS data TX_CLK_LVL clock amplitude control, 0 - 31, default is 12
            [-R]  TMDS data TX_RES source termination resistor control, 0 - 3, default is 0 OFF
            ========================================
                     HDMI PHY TUNE INFO
            ========================================
            TX_AMP_LVL [17] (760 mVdiff ~ 1380 mVdiff) = 1100 mVdiff
            TX_LVL_CH0 [1] (0 mVdiff ~ 60 mVdiff) = 20 mVdiff
            TX_LVL_CH1 [0] (0 mVdiff ~ 60 mVdiff) = 0 mVdiff
            TX_LVL_CH2 [2] (0 mVdiff ~ 60 mVdiff) = 40 mVdiff
            TX_EMP_LVL [0] (0 db ~ -7.45 db) = 0 db
            TX_CLK_LVL [12] (790 mVdiff ~ 1410 mVdiff) = 1030 mVdiff
            TX_RES [0] = Source Termination OFF
            ========================================


    The help screen shows us which parameters to give to configure the 32 byte long PHY config and as a info the current config in memory, in the following example the source termination resistor is configures to 200 ohm

    Code: Select all
    odroid@odroid:~/usb/HDMI-PHY-config$ ./hdmi_signal -R 1
            ========================================
                     HDMI PHY TUNE INFO
            ========================================
            TX_AMP_LVL [17] (760 mVdiff ~ 1380 mVdiff) = 1100 mVdiff
            TX_LVL_CH0 [1] (0 mVdiff ~ 60 mVdiff) = 20 mVdiff
            TX_LVL_CH1 [0] (0 mVdiff ~ 60 mVdiff) = 0 mVdiff
            TX_LVL_CH2 [2] (0 mVdiff ~ 60 mVdiff) = 40 mVdiff
            TX_EMP_LVL [0] (0 db ~ -7.45 db) = 0 db
            TX_CLK_LVL [16] (790 mVdiff ~ 1410 mVdiff) = 1110 mVdiff
            TX_RES [1] = 200 ohm
            ========================================

            HDMI PHY config in memory:
            0x01, 0x51, 0x2D, 0x55, 0x40, 0x40, 0x00, 0xC8,
            0x02, 0xC8, 0x0E, 0xD9, 0x45, 0xA0, 0xAC, 0x90,
            0x08, 0x80, 0x09, 0x84, 0x05, 0x02, 0x24, 0x86,
            0x54, 0xAB, 0x24, 0x00, 0x00, 0x00, 0x01, 0x80,


    The output will be the 32 bytes, from there you can copy it and paste it to the source file drivers/gpu/drm/exynos/exynos_hdmi.c line 453 pixel_clock = 33900000 VU5A, compile the kernel and use it

    Changing this for any other pixel clock / monitor you have to edit the source and but the default PHY config in there ... again be careful !


    RG
    User avatar
    AreaScout
     
    Posts: 638
    Joined: Sun Jul 07, 2013 3:05 am
    languages_spoken: english, german
    ODROIDs: X2, U3, XU3, C2, XU4, XU4Q, N1, Go, VU5A, Show2, CloudShell2

    Re: GBM Video Driver - Retro Gaming - Tinkering Image Howto

    Unread postby odroid » Mon Oct 01, 2018 9:53 am

    Most advanced gaming console development guide!
    Did @robroy contact you to talk about an article for Magazine?
    User avatar
    odroid
    Site Admin
     
    Posts: 28890
    Joined: Fri Feb 22, 2013 11:14 pm
    languages_spoken: English
    ODROIDs: ODROID

    Re: GBM Video Driver - Retro Gaming - Tinkering Image Howto

    Unread postby AreaScout » Mon Oct 01, 2018 5:38 pm

    odroid wrote:Most advanced gaming console development guide!
    Did @robroy contact you to talk about an article for Magazine?


    Thanks still not finished, mame libretro is missing, but current master has so much build errors that I don't want to add a patch for it, waiting before fixed, if not then I will take an older commit ID
    nanogui was also on the list, to show possible scenarios for the gbm kms/drm driver

    No robroy didn't contact me, if he want he can just take this thread as it is, modify it a little and put it in the magazin

    RG
    User avatar
    AreaScout
     
    Posts: 638
    Joined: Sun Jul 07, 2013 3:05 am
    languages_spoken: english, german
    ODROIDs: X2, U3, XU3, C2, XU4, XU4Q, N1, Go, VU5A, Show2, CloudShell2

    Re: GBM Video Driver - Retro Gaming - Tinkering Image Howto

    Unread postby odroid » Mon Oct 01, 2018 5:43 pm

    Ok. I've contacted him. :)
    User avatar
    odroid
    Site Admin
     
    Posts: 28890
    Joined: Fri Feb 22, 2013 11:14 pm
    languages_spoken: English
    ODROIDs: ODROID

    Re: GBM Video Driver - Retro Gaming - Tinkering Image Howto

    Unread postby joy » Tue Oct 02, 2018 10:43 am

    AreaScout wrote:The help screen shows us which parameters to give to configure the 32 byte long PHY config and as a info the current config in memory, in the following example the source termination resistor is configures to 200 ohm

    Code: Select all
    odroid@odroid:~/usb/HDMI-PHY-config$ ./hdmi_signal -R 1
            ========================================
                     HDMI PHY TUNE INFO
            ========================================
            TX_AMP_LVL [17] (760 mVdiff ~ 1380 mVdiff) = 1100 mVdiff
            TX_LVL_CH0 [1] (0 mVdiff ~ 60 mVdiff) = 20 mVdiff
            TX_LVL_CH1 [0] (0 mVdiff ~ 60 mVdiff) = 0 mVdiff
            TX_LVL_CH2 [2] (0 mVdiff ~ 60 mVdiff) = 40 mVdiff
            TX_EMP_LVL [0] (0 db ~ -7.45 db) = 0 db
            TX_CLK_LVL [16] (790 mVdiff ~ 1410 mVdiff) = 1110 mVdiff
            TX_RES [1] = 200 ohm
            ========================================

            HDMI PHY config in memory:
            0x01, 0x51, 0x2D, 0x55, 0x40, 0x40, 0x00, 0xC8,
            0x02, 0xC8, 0x0E, 0xD9, 0x45, 0xA0, 0xAC, 0x90,
            0x08, 0x80, 0x09, 0x84, 0x05, 0x02, 0x24, 0x86,
            0x54, 0xAB, 0x24, 0x00, 0x00, 0x00, 0x01, 0x80,


    The output will be the 32 bytes, from there you can copy it and paste it to the source file drivers/gpu/drm/exynos/exynos_hdmi.c line 453 pixel_clock = 33900000 VU5A, compile the kernel and use it

    Changing this for any other pixel clock / monitor you have to edit the source and but the default PHY config in there ... again be careful !

    RG


    Thank you for the valuable information. :)
    Please let me check it.
    joy
     
    Posts: 575
    Joined: Fri Oct 02, 2015 1:44 pm
    languages_spoken: english
    ODROIDs: ODROID-C1+, XU4, X

    Re: GBM Video Driver - Retro Gaming - Tinkering Image Howto

    Unread postby MastaG » Sat Oct 06, 2018 4:44 pm

    memeka wrote:
    odroid wrote:Very exciting project!
    It seems to be a technical concept for the ODROID-GO Advance.

    Can you please check the God of War performance with only four LITTLE cores?
    Edit /media/boot/boot.ini something like this and you can disable four big cores.
    Code: Select all
    setenv bootrootfs "maxcpus=4 console=tty1 console=ttySAC2,115200n8 root=UUID=e139ce78-9841-40fe-8823-96a304a09859 rootwait ro fsck.repair=yes net.ifnames=0"

    I want to know the PPSSPP performance without big A15 cores to see a feasbility of the battery powered Exynos-5422 portable device with a 3.5inch 480x320 MIPI LCD.


    PPSSPP should work great even with little cores since it actually uses the GPU, and the resolution you want to use is quite small.
    I know GPU is slowed down by the little cores (probably because of memcpy since zero-copy is not working with gbm drivers - hope @mdrjr can fix this soon) but it should still be ok for small resolution.


    Memeka, you seem to be the one around here who knows whats needs to be fixed for the mali gbm drivers..
    Now I know the folks over at ARM aren't going to do anything anymore for the odroid mali drivers.
    Perhaps you can contact mdrjr to sign a NDA or something, so you can have a copy of the sources and play with it yourself?
    It would be a dream to get these fixes for zero-copy/drm-prime and all other things you've mentioned before into our mali gbm drivers :)
    MastaG
     
    Posts: 215
    Joined: Mon Aug 26, 2013 6:05 pm
    languages_spoken: english

    Re: GBM Video Driver - Retro Gaming - Tinkering Image Howto

    Unread postby AreaScout » Sat Oct 06, 2018 9:26 pm

    MastaG wrote:Memeka, you seem to be the one around here who knows whats needs to be fixed for the mali gbm drivers..
    Now I know the folks over at ARM aren't going to do anything anymore for the odroid mali drivers.
    Perhaps you can contact mdrjr to sign a NDA or something, so you can have a copy of the sources and play with it yourself?
    It would be a dream to get these fixes for zero-copy/drm-prime and all other things you've mentioned before into our mali gbm drivers :)


    If I remember correctly this changes are have to be made on the kernel side of DRM drivers not on Mali User-Space library side and is not worth the effort, but there are two ways to get DRMPRIME working maybe one needs the user space library too to be changed.

    DRMPRIME will speed up decoding a lot and is mostly used to display with 4k videos but there is only one scenario out there on Exynos5422 where this could be happen and this is the XU3 which has a 4k display port

    But with this driver you still can use the GBM window backend from Kodi and the hwdecoder for supported 1080p video codecs, it should build out of the box

    RG
    User avatar
    AreaScout
     
    Posts: 638
    Joined: Sun Jul 07, 2013 3:05 am
    languages_spoken: english, german
    ODROIDs: X2, U3, XU3, C2, XU4, XU4Q, N1, Go, VU5A, Show2, CloudShell2

    Re: GBM Video Driver - Retro Gaming - Tinkering Image Howto

    Unread postby memeka » Sun Oct 07, 2018 6:06 am

    From what I remember (being told by kodi devs), drmprime works in kodi with the Mali renderer quite well via gbm.
    The zero copy support can be added only from the closed source userspace driver.
    For 4K support I think that you need drm zero copy indeed. This has nothing to do with Mali drivers, and @Ely might know more if it’s working or being developed by Baylibre in the drm driver.
    User avatar
    memeka
     
    Posts: 4056
    Joined: Mon May 20, 2013 10:22 am
    languages_spoken: english
    ODROIDs: XU rev2 + eMMC + UART
    U3 + eMMC + IO Shield + UART

    Re: GBM Video Driver - Retro Gaming - Tinkering Image Howto

    Unread postby AreaScout » Sun Oct 07, 2018 5:25 pm

    memeka wrote:From what I remember (being told by kodi devs), drmprime works in kodi with the Mali renderer quite well via gbm.
    The zero copy support can be added only from the closed source userspace driver.
    For 4K support I think that you need drm zero copy indeed. This has nothing to do with Mali drivers, and @Ely might know more if it’s working or being developed by Baylibre in the drm driver.


    Have I said 'should build out of the box' -> nope, it does not anymore, to be exactly since two month which is a while, the GBM windowing system used by Kodi does now only support Mesa as GPU driver which means ...
    we will see a Mali 3D Gallium driver for Mesa soon :) It's called Panfrost driver if it's that, more over here https://rosenzweig.io/blog/panfrost-on-the-rk3399-meow.html

    So ! I have to make a tutorial how to get backward compatibility with our T-6x0 driver, I will add that soon
    User avatar
    AreaScout
     
    Posts: 638
    Joined: Sun Jul 07, 2013 3:05 am
    languages_spoken: english, german
    ODROIDs: X2, U3, XU3, C2, XU4, XU4Q, N1, Go, VU5A, Show2, CloudShell2

    Re: GBM Video Driver - Retro Gaming - Tinkering Image Howto

    Unread postby odroid » Mon Oct 08, 2018 9:10 am

    This great guide has been ported to the Magazine. ;)
    https://magazine.odroid.com/article/gbm-video-driver/

    And the HDMI 800x480 64Hz patch(areascout's pull-request) has been merged to Kernel 4.14.73.
    https://github.com/hardkernel/linux/commit/ab1ca97487fc92c9fca593e48e671d9f444a2d7a
    User avatar
    odroid
    Site Admin
     
    Posts: 28890
    Joined: Fri Feb 22, 2013 11:14 pm
    languages_spoken: English
    ODROIDs: ODROID

    Re: GBM Video Driver - Retro Gaming - Tinkering Image Howto

    Unread postby MastaG » Mon Oct 08, 2018 3:48 pm

    So whats the difference between this driver: http://deb.odroid.in/bigmali.tar
    And the generic one: malit62xr12p004rel0linux1wayland.tar.gz from here: https://developer.arm.com/products/soft ... user-space

    The bigmali.tar seems to missing the wayland-egl bits so it won't run gnome?
    MastaG
     
    Posts: 215
    Joined: Mon Aug 26, 2013 6:05 pm
    languages_spoken: english

    Re: GBM Video Driver - Retro Gaming - Tinkering Image Howto

    Unread postby AreaScout » Mon Oct 08, 2018 5:03 pm

    MastaG wrote:So whats the difference between this driver: http://deb.odroid.in/bigmali.tar
    And the generic one: malit62xr12p004rel0linux1wayland.tar.gz from here: https://developer.arm.com/products/soft ... user-space

    The bigmali.tar seems to missing the wayland-egl bits so it won't run gnome?


    First the driver is newer r17p0-01rel0 compared to the wayland r12 and second it can do also, X11, fbdev and GBM but not wayland, therefore it's so big

    As a scenario you can install it on any Ubuntu or Debian distribution with X11 running HK offers and switch between window system or console only system with systemctl set-default multi-user.target and back systemctl set-default graphical.target without changing the driver.

    GBM was never enabled on all X11 drivers before that, mdrjr did compile it in and also added fbdev

    RG
    User avatar
    AreaScout
     
    Posts: 638
    Joined: Sun Jul 07, 2013 3:05 am
    languages_spoken: english, german
    ODROIDs: X2, U3, XU3, C2, XU4, XU4Q, N1, Go, VU5A, Show2, CloudShell2

    Re: GBM Video Driver - Retro Gaming - Tinkering Image Howto

    Unread postby MastaG » Mon Oct 08, 2018 6:32 pm

    Thanks @AreaScout!
    Perhaps HK can add wayland as well in the future then :)
    MastaG
     
    Posts: 215
    Joined: Mon Aug 26, 2013 6:05 pm
    languages_spoken: english

    Re: GBM Video Driver - Retro Gaming - Tinkering Image Howto

    Unread postby AreaScout » Tue Oct 09, 2018 12:29 am

      The great KODI build guide as promised !

      ImageImage

      !! This guide assumes that you have installed the packages from the first post and using the exact same image, this is not tested on any other image but may also work !!
      We are again modifying the kernel ! I am in no way responsable for any damage on your hardware, this howto is for tinkering and HIFI/Video hobby enthusiasts that are know what they do


      Prolog

      Changing the Kernel

      Back in spring this year the great memeka and AreaScout (hey! that's me) were about to discover the great unknown, I was studying the DRM mixer source code in the kernel and saw that one plane with NV21 and NV12 color capabilities is disabled, in short it was the OVERLAY plane (the picture as you can see it on your TV is made of different layers in DRM that are put on top of each other, the highest Z position is the top most layer), that OVERLAY plane is normally
      provided to display videos coming from the hardware decoder of the board which exactly outputs in that NV21/NV12 format but it was disabled ! And this is needed to do DRMPRIME with zero copy !!??

      Ok long story short answer, that pictures coming from the HW-Decoder has to be scaled down and or color convert and the scaler hardware component on the board was not implemented in this kernel version so it couldn't be used. But as Kodi makes use of different layers in DRM and needs at least two layers for the concept the GBM backend was designed for, we where thinking about what can be done, memeka came up with the genius idea to just use the Cursor plane as OVERLAY plane and this is what we do first in this howto -> PATCH THE KERNEL and swap the disabled OVERLAY plane with the CURSOR plane. Kodi will then be able to switch video resolution and GUI resolution independently !

      So we are not getting DRMPRIME with this but Kodi with GBM windowing system with great video performance without any tearing and as far as I know automatic framerate control

      Changing Kodi

      Team Kodi has closed the doors to everything other then Mesa GBM GPU drivers (I hope we will see Mali for Mesa soon to be released), so we have to change that and the use of DRM inside Kodi which means
      that this will be the second part of this howto -> PATCHING KODI

      Getting done with talking and start doing real work !

      Patching the Kernel

      Get the source code if you don't have it already

      Code: Select all
      git clone https://github.com/hardkernel/linux.git
      cd linux
      wget -O drm_plane_fix.patch https://pastebin.com/raw/MiTbZsPs
      patch -p1 < drm_plane_fix.patch

      make odroidxu4_defconfig
      make -j7
      sudo cp arch/arm/boot/zImage /media/boot/.
      sudo cp arch/arm/boot/dts/exynos5422-odroidxu4.dtb /media/boot/.
      sudo make modules_install


      Patching Kodi + building

      Code: Select all
      git clone https://github.com/xbmc/xbmc.git
      cd xbmc
      wget -O kodi.patch https://pastebin.com/raw/mzAiCU2Q
      patch -p1 < kodi.patch


      Get a ton of pre-requirements, I haven't testet if all those packages will break any other howto in this post !

      Code: Select all
      sudo apt-get install antlr autoconf automake autopoint autotools-dev ca-certificates-java curl debhelper default-jre default-jre-headless default-libmysqlclient-dev dh-autoreconf dh-python dh-strip-nondeterminism doxygen fontforge-common fontforge-nox fonts-droid-fallback gawk gettext gettext-base gir1.2-harfbuzz-0.0 gir1.2-ibus-1.0 gperf groovy icu-devtools intltool-debian ivy java-common junit4 libantlr-java libao-common libao-dev libao4 libapache-pom-java libarchive-zip-perl libasan3 libasm-java libass-dev   libass9 libasyncns0 libavahi-client-dev libavahi-common-dev libbluetooth-dev libbluray-dev libbluray2 libboost-atomic1.65-dev libboost-atomic1.65.1 libboost-chrono1.65-dev libboost-chrono1.65.1   libboost-date-time1.65-dev libboost-date-time1.65.1 libboost-dev libboost-filesystem1.65.1 libboost-serialization1.65-dev libboost-serialization1.65.1 libboost-system1.65-dev   libboost-system1.65.1 libboost-thread-dev libboost-thread1.65-dev libboost-thread1.65.1 libboost1.65-dev libbs2b0 libbsf-java libbz2-dev libcap-dev libcapnp-0.6.1 libcdio-dev   libcdio17 libcec-dev libcec4 libchromaprint1 libclang1-6.0 libcommons-cli-java libcommons-lang-java libcommons-logging-java libcommons-parent-java libcrossguid-dev libcrossguid0   libcurl4-gnutls-dev libcwiid-dev libcwiid1 libdbus-1-dev libevent-2.1-6 libexpat1-dev libfftw3-double3 libfile-stripnondeterminism-perl libflac8 libflite1   libfluidsynth1 libfontconfig1-dev libfontforge2 libfribidi-dev libfstrcmp-dev libfstrcmp0 libgcrypt20-dev libgdraw5 libgif-dev libgif7 libglib2.0-bin libglib2.0-dev libglib2.0-dev-bin libglvnd-core-dev libglvnd-dev libgme0 libgmp-dev libgmpxx4ldbl libgnutls-dane0 libgnutls-openssl27 libgnutls28-dev libgnutlsxx28 libgpg-error-dev libgraphite2-dev libgsm1 libgtest-dev   libhamcrest-java libharfbuzz-dev libharfbuzz-gobject0 libharfbuzz-icu0 libhawtjni-runtime-java libibus-1.0-5 libibus-1.0-dev libicu-dev libicu-le-hb-dev libicu-le-hb0 libiculx60   libidn2-0-dev libidn2-dev libiso9660-10 libiso9660-dev libjack-jackd2-0 libjansi-java libjansi-native-java libjline2-java libjpeg-dev libjpeg-turbo8-dev libjpeg8-dev liblcms2-dev   libldb1 libllvm6.0 libltdl-dev liblzo2-dev libmad0 libmicrohttpd-dev libmicrohttpd12 libmirclient-dev libmirclient9 libmircommon-dev libmircommon7 libmircookie-dev libmircookie2   libmircore-dev libmircore1 libmirprotobuf3 libmodplug-dev libmodplug1 libmp3lame0 libmpg123-0 libmysofa0 libmysqlclient-dev libmysqlclient20 libnfs-dev libnfs11 libnorm1 libnspr4   libnss3 libogg0 libomxil-bellagio-dev libomxil-bellagio0 libopengl0 libopenjp2-7 libopenmpt0 libopus0 libp11-kit-dev libp8-platform-dev libp8-platform2 libpangoxft-1.0-0 libpcre16-3 libpcre3-dev libpcre32-3 libpcrecpp0v5 libpgm-5.2-0 libplist-dev libplist3 libpostproc-dev libpostproc54 libprotobuf-dev libprotobuf-lite10 libprotobuf10 libpython-dev libpython2.7 libpython2.7-dev libqdox-java librsvg2-bin librubberband2 libsensors4 libservlet3.1-java libshairport-dev libshairport2 libshine3 libsmbclient libsmbclient-dev libsnappy1v5   libsndfile1 libsndio-dev libsndio6.1 libsodium23 libsoxr0 libspeex1 libspiro0 libsqlite3-dev libssh-gcrypt-4 libssh-gcrypt-dev libtag1-dev libtag1v5 libtag1v5-vanilla libtalloc2 libtasn1-6-dev libtdb1 libtevent0 libtheora0 libtimedate-perl libtinyxml-dev libtinyxml2.6.2v5   libtool libtwolame0 libunbound2 libuninameslist1 libvdpau1 libvorbis0a libvorbisenc2 libvorbisfile3 libvpx5 libwavpack1 libwbclient0 libwebpdemux2 libwebpmux3 libx264-152 libx265-146 libxapian30 libxml2-dev libxmu-dev libxmu-headers libxmu6 libxpp3-java libxvidcore4 libyajl-dev libyajl2 libzmq5 libzvbi-common libzvbi0 mysql-common nettle-dev openjdk-11-jre openjdk-11-jre-headless po-debconf python-dev python-pil python-talloc python2.7-dev python3-distutils python3-lib2to3 samba-libs swig swig3.0 unzip uuid-dev yasm zip ccache libinput-dev libpulse-dev pulseaudio


      Generate the Makefile and export some extra compiler switches:

      Code: Select all
      export CPPFLAGS="-mfloat-abi=hard -marm -mtune=cortex-a15.cortex-a7 -mcpu=cortex-a15 -mfpu=neon-vfpv4 -ftree-vectorize -mvectorize-with-neon-quad -ffast-math"
      export CXXFLAGS=$CPPFLAGS


      Code: Select all
      mkdir kodi
      cd kodi
      cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=/usr/local -DCORE_PLATFORM_NAME=gbm -DGBM_RENDER_SYSTEM=gles \
         -DENABLE_ALSA=ON -DENABLE_AIRTUNES=ON -DENABLE_UPNP=ON \
         -DENABLE_INTERNAL_FMT=ON -DENABLE_INTERNAL_RapidJSON=ON \
         -DENABLE_OPENGLES=ON -DENABLE_OPENGL=OFF -DENABLE_X=OFF \
         -DVERBOSE=OFF -DENABLE_SMBCLIENT=OFF -DENABLE_CEC=ON -DENABLE_NEON=ON \
         -DWITH_CPU=armv7-a -DENABLE_AVAHI=ON \
         -DENABLE_PULSEAUDIO=ON -DENABLE_CCACHE=ON \
         -DENABLE_APP_AUTONAME=OFF -DENABLE_DVDCSS=OFF -DENABLE_INTERNAL_CROSSGUID=OFF -DENABLE_OPTICAL=OFF \
         -DENABLE_EVENTCLIENTS=ON \
         -DENABLE_VAAPI=OFF -DENABLE_VDPAU=OFF -DENABLE_INTERNAL_FLATBUFFERS=ON ../.


      Code: Select all
      make -j7
      sudo make install


      Run Kodi and:

      Go to Settings -> Player and adjust setting level on the lower left side, there is Basic, Sandard, Advanced and Expert chose either Advanced or Expert

      Go to Settings -> Player -> Videos and enable adjust display refresh rate to On start/stop

      Go to Settings -> System -> Display -> Whitelist and add all resolutions you want to be able to switch automatically

      Enjoy a great Media Center

      P.S.: There is already a 'pull request' send to mailing list (I think Lukas did it) of FFmpeg to turn the v4l2-m2m hw decoder into an DRMPRIME only one (like rockchip does it), if this is will be accepted and Kodi moves forward with the new changes, the hwdecoder will not work anymore, you have then take the external FFmpeg from the HK repository

      RG
      Last edited by AreaScout on Sat Nov 17, 2018 10:39 pm, edited 12 times in total.
      User avatar
      AreaScout
       
      Posts: 638
      Joined: Sun Jul 07, 2013 3:05 am
      languages_spoken: english, german
      ODROIDs: X2, U3, XU3, C2, XU4, XU4Q, N1, Go, VU5A, Show2, CloudShell2

      Re: GBM Video Driver - Retro Gaming - Tinkering Image Howto

      Unread postby MastaG » Tue Oct 09, 2018 10:06 pm

      @AreaScout
      Thank you for the detailed Kodi guide.
      Will the kernel patch for switching to the CURSOR plane break anything for the wayland drivers?
      MastaG
       
      Posts: 215
      Joined: Mon Aug 26, 2013 6:05 pm
      languages_spoken: english

      Re: GBM Video Driver - Retro Gaming - Tinkering Image Howto

      Unread postby AreaScout » Wed Oct 10, 2018 12:21 am

      MastaG wrote:@AreaScout
      Thank you for the detailed Kodi guide.
      Will the kernel patch for switching to the CURSOR plane break anything for the wayland drivers?


      Honestly I don't know, I haven't tested it on wayland, IIRC it will not break anything on X11 side and X11 uses armsoc which also uses DRM and the mouse cursor was still working but you have to test it.

      Best is, use Kodi on the image I mentioned but it in /etc/rc.local to autostart Kodi and have fun with a great Movie experience, it runs some days now in my home without any trouble

      RG
      User avatar
      AreaScout
       
      Posts: 638
      Joined: Sun Jul 07, 2013 3:05 am
      languages_spoken: english, german
      ODROIDs: X2, U3, XU3, C2, XU4, XU4Q, N1, Go, VU5A, Show2, CloudShell2

      Re: GBM Video Driver - Retro Gaming - Tinkering Image Howto

      Unread postby AreaScout » Mon Oct 29, 2018 9:12 pm




          Hi all

          If you concentrate your eye on the side-by-side video to the right side you will notice that it stutters, in real live it looks even worse ! Why is that ? Because the video is recorded or encoded with an fps of 23.976 and the display runs on 60 fps this will give you that stutter effect, to bypass this Kodi has a feature to switch your TV resolution and fps to the one from the movie if the resolution is supported by your display (TV, LCD Panel, Monitor or what so ever).

          I have changed the Kodi patch from the tutorial above to the latest Github revision and have also added a new feature where automatic display refresh rate adjust on videos with an fps with commas did not work.
          It seems that the XU4 HDMI hardware does not support it (correct me if I am wrong).

          So all videos with an fps of 23.976025, 29.970032 or 59.940063 are now rounded to 24, 30 or 60 and thus they DO work now, automatic display refresh rate adjust was already working if you applied my patch but only for videos with an fps without commas AND if the feature was enabled AND the resolutions you want to switch automatically were added to the WHITELIST

          So here is how the enable this feature, it was not described by my tutorial so you maybe didn't know about it and how cool it is !

          First rebuild Kodi and apply the new path:

          Code: Select all
          cd ~/xbmc
          git reset --hard HEAD
          git pull
          rm kodi.patch
          wget -O kodi.patch https://pastebin.com/raw/mzAiCU2Q
          patch -p1 < kodi.patch


          Rerun cmake, make and make install like from previous howto post

          Run Kodi and:

          Go to Settings -> Player and adjust setting level on the lower left side, there is Basic, Sandard, Advanced and Expert chose either Advanced or Expert

          Go to Settings -> Player -> Videos and enable adjust display refresh rate to On start/stop

          Go to Settings -> System -> Display -> Whitelist and add all resolutions you want to be able to switch automatically

          You are all set now ! Enjoy your XU4 as a great media center with great video quality !

          RG
          Last edited by AreaScout on Mon Nov 12, 2018 4:48 am, edited 6 times in total.
          User avatar
          AreaScout
           
          Posts: 638
          Joined: Sun Jul 07, 2013 3:05 am
          languages_spoken: english, german
          ODROIDs: X2, U3, XU3, C2, XU4, XU4Q, N1, Go, VU5A, Show2, CloudShell2

          Re: GBM Video Driver - Retro Gaming - Tinkering Image Howto

          Unread postby rooted » Tue Oct 30, 2018 3:28 am

          So that's what whitelist is for, thanks for the howto.
          User avatar
          rooted
           
          Posts: 5700
          Joined: Fri Dec 19, 2014 9:12 am
          Location: Gulf of Mexico, US
          languages_spoken: english
          ODROIDs: C1, C1+, C2
          XU3 Lite, XU4
          N1
          VU7+
          HiFi Shield 2
          Smart Power (original)

          Re: GBM Video Driver - Retro Gaming - Tinkering Image Howto

          Unread postby AreaScout » Tue Oct 30, 2018 5:24 am

          rooted wrote:So that's what whitelist is for, thanks for the howto.


          You can't believe how long I was champ on that, I even did a bug report on github and Lukas gave me the Info, that feature was new to me ;)

          edit:
          I have just changed the patch to not use mpeg4 hw codec but instead mpeg4 sw codec, cpu usage is a little bit higher but our 8 core SoC will do a nice job on it, H.264, mpeg, mpeg2, vp1 a.s.o are still hw accelerated
          To summarizing it up what you get with that patch:
          1. Kodi with GBM windowing backend enabled for Exynos
          2. Independent Video and GUI PLANE usage instead of drawing Video and GUI on the same PLANE
          3. Support for Video refresh rates with commas like 29.970032 fps on auto adjust display

          edit2: -> new patch is online, please rebuild
          forget what I was saying about avi and mpeg4 files, it was a stupid copy/paste error, those codecs are now supported with HW acceleration
          MPEG2TS (dunno if interlaced frames are working)
          H263
          H264
          MPEG4
          MPEG1
          MPEG2
          VC1
          VP8
          VP9

          edit3:
          no interlaced (i.e 1080i) transport stream files are not working, progressive do !

          Have fun
          User avatar
          AreaScout
           
          Posts: 638
          Joined: Sun Jul 07, 2013 3:05 am
          languages_spoken: english, german
          ODROIDs: X2, U3, XU3, C2, XU4, XU4Q, N1, Go, VU5A, Show2, CloudShell2

          Re: GBM Video Driver - Retro Gaming - Tinkering Image Howto

          Unread postby odroid » Thu Nov 08, 2018 12:16 pm

          We made a small MIPI LCD(3.5inch 320x480 IPS) add-on board for XU3 to check feasibility of portable gaming device.
          In fact, XU3 board had a hidden connector for the MIPI-DSI signals.
          We developed a MIPI DSI device driver on Exynos-5422 Kernel 4.14 and we could run glmark2-es2 on the 320x480 framebuffer.
          Unfortunately, the 3.5inch MIPI LCD internal controller has no rotation feature.
          Framebufffer console could be easily rotated with echo 1 > /sys/class/graphics/fbcon/rotate_all command.
          But drm driven egl surface couldn't be rotated. Therefore, the glmark2-es2 run in portrait mode.
          Please see this video to understand the current situation.
          https://www.odroid.in/quake3/20181011_0 ... 371706.mp4

          My questions.
          Is the gscaler(2d accelerator) driver can rotate the drm egl surface?
          If 2d accelerator can't rotate the egl surface, what can we do?
          - PPSSPP has a feature to rotate the screen even in build time?
          - how about other software like retroarch, reicast, mame, n64, kodi, and others?
          User avatar
          odroid
          Site Admin
           
          Posts: 28890
          Joined: Fri Feb 22, 2013 11:14 pm
          languages_spoken: English
          ODROIDs: ODROID

          Re: GBM Video Driver - Retro Gaming - Tinkering Image Howto

          Unread postby AreaScout » Thu Nov 08, 2018 4:04 pm

          odroid wrote:My questions.
          Is the gscaler(2d accelerator) driver can rotate the drm egl surface?
          If 2d accelerator can't rotate the egl surface, what can we do?
          - PPSSPP has a feature to rotate the screen even in build time?
          - how about other software like retroarch, reicast, mame, n64, kodi, and others?


          Hi odroid :)

          This is great news and it's useful for a lot of applications !

          For EGL/GLES if the emulator draws a 2D texture, it would as simple as 'rotate' (order) the texture coordinates https://github.com/AreaScout/retro/blob ... c#L89-L107
          retroarch can also rotate the screen for it's libretros (reicast, n64, mame etc.) but you want to have that on system level, so for DRM I am quite sure that there is an exynos driver specific option for it, I will have a lock and ask

          RG
          User avatar
          AreaScout
           
          Posts: 638
          Joined: Sun Jul 07, 2013 3:05 am
          languages_spoken: english, german
          ODROIDs: X2, U3, XU3, C2, XU4, XU4Q, N1, Go, VU5A, Show2, CloudShell2

          Re: GBM Video Driver - Retro Gaming - Tinkering Image Howto

          Unread postby odroid » Thu Nov 08, 2018 4:58 pm

          Thank you for the answer.
          Texture coordinate rotation seems to be a promising approach as a backup plan if we can't find a system level solution.

          Can you help us if we send you an XU3 + MIPI LCD kit?
          We will share our kernel patch to activate the MIPI-DSI.
          User avatar
          odroid
          Site Admin
           
          Posts: 28890
          Joined: Fri Feb 22, 2013 11:14 pm
          languages_spoken: English
          ODROIDs: ODROID

          Re: GBM Video Driver - Retro Gaming - Tinkering Image Howto

          Unread postby AreaScout » Thu Nov 08, 2018 6:49 pm

          odroid wrote:Can you help us if we send you an XU3 + MIPI LCD kit?
          We will share our kernel patch to activate the MIPI-DSI.


          Sure I will do my best I am for sure good for some testing, a lot has changed in the kernel especially on DRM 2d api, mali display port drm code can do it out of the box I think, looking forward to the kit :)
          User avatar
          AreaScout
           
          Posts: 638
          Joined: Sun Jul 07, 2013 3:05 am
          languages_spoken: english, german
          ODROIDs: X2, U3, XU3, C2, XU4, XU4Q, N1, Go, VU5A, Show2, CloudShell2

          Re: GBM Video Driver - Retro Gaming - Tinkering Image Howto

          Unread postby memeka » Fri Nov 09, 2018 8:54 am

          rotation can be done with gscaler although i don't know if it works with EGL specific texture.
          you can check formats accepted by gscaler with v4l2 tools package. if i remember correctly, it works with formats that MFC also works with (nv12/21, rgba, etc.)
          User avatar
          memeka
           
          Posts: 4056
          Joined: Mon May 20, 2013 10:22 am
          languages_spoken: english
          ODROIDs: XU rev2 + eMMC + UART
          U3 + eMMC + IO Shield + UART

          Re: GBM Video Driver - Retro Gaming - Tinkering Image Howto

          Unread postby AreaScout » Sat Nov 10, 2018 6:37 pm

          memeka wrote:rotation can be done with gscaler although i don't know if it works with EGL specific texture.
          you can check formats accepted by gscaler with v4l2 tools package. if i remember correctly, it works with formats that MFC also works with (nv12/21, rgba, etc.)


          Thanks for the tip, can't wait to see how this driver got integrated in DRM
          User avatar
          AreaScout
           
          Posts: 638
          Joined: Sun Jul 07, 2013 3:05 am
          languages_spoken: english, german
          ODROIDs: X2, U3, XU3, C2, XU4, XU4Q, N1, Go, VU5A, Show2, CloudShell2

          Re: GBM Video Driver - Retro Gaming - Tinkering Image Howto

          Unread postby memeka » Sat Nov 10, 2018 6:51 pm

          AreaScout wrote:
          memeka wrote:rotation can be done with gscaler although i don't know if it works with EGL specific texture.
          you can check formats accepted by gscaler with v4l2 tools package. if i remember correctly, it works with formats that MFC also works with (nv12/21, rgba, etc.)


          Thanks for the tip, can't wait to see how this driver got integrated in DRM


          there are 2 drivers:

          1. gscaler v4l2m2m driver, which exists and you can use (e.g. very simple to use with gstreamer)
          2. gscaler drm driver, which can be accessed by a exynos specific API (kernel 4.18 onwards). if you select this one in kernel options, it will disable the v4l2m2m driver.
          User avatar
          memeka
           
          Posts: 4056
          Joined: Mon May 20, 2013 10:22 am
          languages_spoken: english
          ODROIDs: XU rev2 + eMMC + UART
          U3 + eMMC + IO Shield + UART

          Re: GBM Video Driver - Retro Gaming - Tinkering Image Howto

          Unread postby AreaScout » Sun Nov 11, 2018 12:12 am

          memeka wrote:there are 2 drivers:

          1. gscaler v4l2m2m driver, which exists and you can use (e.g. very simple to use with gstreamer)
          2. gscaler drm driver, which can be accessed by a exynos specific API (kernel 4.18 onwards). if you select this one in kernel options, it will disable the v4l2m2m driver.


          I haven't done much with it, I only looked at the kernel log (4.14) and could see that a rotator driver is loaded, the corresponding file seems to be drivers/gpu/drm/exynos/exynos_drm_rotator.c .

          I have observed also something interesting, in Kernel 4.19 there was an commit who enabled NV12 for the Display Port https://github.com/torvalds/linux/commi ... ca15ef14b9 , if this is the driver that is used for XU3 Display Port then it could be that DRMPRIME with Kodi works out of the box now with it, I hope it is. 4.18 is not so far away from 4.19 could that be worth a try ?

          @odroid

          Maybe that DRM driver for the Display Port can then be used to connect the MIPI DSI device, that driver (if it's working with the XU3 DP) could be used ? it also does rotation very easily

          edit: The Exynos 5422 does not contain a Mali Display Core so this was a wrong assumption, information found on internet was confusing -> bad, that driver would be easier to use :?
          User avatar
          AreaScout
           
          Posts: 638
          Joined: Sun Jul 07, 2013 3:05 am
          languages_spoken: english, german
          ODROIDs: X2, U3, XU3, C2, XU4, XU4Q, N1, Go, VU5A, Show2, CloudShell2

          Re: GBM Video Driver - Retro Gaming - Tinkering Image Howto

          Unread postby Tomas J. » Sun Nov 11, 2018 10:42 pm

          Hello,
          I am trying get kodi working with gbm driver, but so far no luck... I follow every step in post 1 and kodi build post. There is no obvious (at least to me) errors. Kodi runs fine, refresh rate change works, video plays. But, when playing video, kodi leaks memory (very easy to check turning debug log on). After about 30 min memory runs out, playback starts stutter and stops. I attach "top" screenshot after about 15 min playback and kodi log file.
          Attachments
          kodi.log.gz
          (22.82 KiB) Downloaded 7 times
          top_kodi_bin.png
          top_kodi_bin.png (18.35 KiB) Viewed 352 times
          Tomas J.
           
          Posts: 21
          Joined: Wed Aug 16, 2017 4:23 am
          languages_spoken: english
          ODROIDs: XU4

          Re: GBM Video Driver - Retro Gaming - Tinkering Image Howto

          Unread postby AreaScout » Mon Nov 12, 2018 12:26 am

          Tomas J. wrote:Hello,
          I am trying get kodi working with gbm driver, but so far no luck... I follow every step in post 1 and kodi build post. There is no obvious (at least to me) errors. Kodi runs fine, refresh rate change works, video plays. But, when playing video, kodi leaks memory (very easy to check turning debug log on). After about 30 min memory runs out, playback starts stutter and stops. I attach "top" screenshot after about 15 min playback and kodi log file.


          Hi

          I remember having the exact problem too but I forgot how I solved it :?:, I think a kernel update solved the problem, try to do a

          sudo apt-get update && sudp apt-get upgrade && sudo apt-get dist-upgrade

          If you build the kernel for yourself please git pull the latest changes and rebuild

          please let me know if that worked ( It was not a Kodi problem as far as I remember )

          RG
          User avatar
          AreaScout
           
          Posts: 638
          Joined: Sun Jul 07, 2013 3:05 am
          languages_spoken: english, german
          ODROIDs: X2, U3, XU3, C2, XU4, XU4Q, N1, Go, VU5A, Show2, CloudShell2

          Next

          Return to Projects

          Who is online

          Users browsing this forum: No registered users and 1 guest