OpenGLES cores do not render on Odroid XU4
#1
Hi there,

I started forking some libretro cores so they properly build for the Odroid XU4.
So I have  cmake/addons/bootstrap/repositories/binary-addons.txt set to:
Code:
binary-addons https://github.com/MastaG/repo-binary-addons.git Matrix
In my own repository I'm pointing some cores to my own forks so I can set the correct build flags instead of just "platform=unix" which fails for the XU4.
Example mupen64plus (updated to the next core):
https://github.com/MastaG/game.libretro....ts.txt#L22
and Flycast (bumped to the latest version):
https://github.com/MastaG/game.libretro....ad553bbe01

Now they build fine but when attempting to run the core, Kodi will not output any video on the screen:
Code:
2020-05-29 19:38:40.509 T:19868    INFO <general>: RetroPlayer[PLAYER]: No compatible game client selected, aborting playback
2020-05-29 19:39:10.327 T:19868    INFO <general>: RetroPlayer[PROCESS]: Created process info for GBM
2020-05-29 19:39:10.627 T:19868    INFO <general>: Loading controller layout: /home/odroid/.kodi/addons/game.controller.dreamcast/resources/layout.xml
2020-05-29 19:39:10.631 T:19868    INFO <general>: GAME: ------------------------------------
2020-05-29 19:39:10.631 T:19868    INFO <general>: GAME: Loaded DLL for game.libretro.flycast
2020-05-29 19:39:10.631 T:19868    INFO <general>: GAME: Client: Sega - Dreamcast/NAOMI (Flycast) at version 0.1.0.18
2020-05-29 19:39:10.631 T:19868    INFO <general>: GAME: Valid extensions: .7z .bin .cdi .chd .cue .dat .elf .gdi .iso .lst .m3u .zip
2020-05-29 19:39:10.631 T:19868    INFO <general>: GAME: Supports VFS:                  no
2020-05-29 19:39:10.631 T:19868    INFO <general>: GAME: Supports standalone execution: no
2020-05-29 19:39:10.631 T:19868    INFO <general>: GAME: ------------------------------------
2020-05-29 19:39:10.631 T:19868    INFO <general>: RetroPlayer[PLAYER]: Opening: /mnt/sdcard/src/RA_Profile/roms/dreamcast/Sonic Adventure International v1.003 (1999)(Sega)(NTSC)(JP)(M5)[!]/Sonic Adventure International v1.003 (1999)(Sega)(NTSC)(JP)(M5)[!].gdi
2020-05-29 19:39:10.632 T:19868    INFO <general>: AddOnLog: Sega - Dreamcast/NAOMI (Flycast): Rumble interface supported!
                                                    
2020-05-29 19:39:10.632 T:19868    INFO <general>: AddOnLog: Sega - Dreamcast/NAOMI (Flycast): File extension is: .gdi
                                                    
2020-05-29 19:39:10.636 T:19868    INFO <general>: AddOnLog: Sega - Dreamcast/NAOMI (Flycast): 00:00:636 hw/mem/_vmem.cpp:556 N[VMEM]: Info: nvmem is enabled, with addr space of size 512MB
                                                    
2020-05-29 19:39:10.801 T:19868    INFO <general>: AddOnLog: Sega - Dreamcast/NAOMI (Flycast): Unable to find bios in /home/odroid/.kodi/addons/game.libretro.flycast/resources/system/dc/. Exiting...
                                                    
2020-05-29 19:39:10.836 T:19868   ERROR <general>: AddOnLog: Sega - Dreamcast/NAOMI (Flycast): 00:00:836 nullDC.cpp:436 W[COMMON]: Did not load bios, using reios
                                                    
2020-05-29 19:39:12.343 T:19868    INFO <general>: AddOnLog: Sega - Dreamcast/NAOMI (Flycast): 00:02:343 hw/maple/maple_devs.cpp:569 N[MAPLE]: Loaded VMU from file "/home/odroid/.kodi/addons/game.libretro.flycast/resources/system/dc/vmu_save_A1.bin"
                                                    
2020-05-29 19:39:12.345 T:19868    INFO <general>: AddOnLog: Sega - Dreamcast/NAOMI (Flycast): 00:02:345 hw/maple/maple_devs.cpp:569 N[MAPLE]: Loaded VMU from file "/home/odroid/.kodi/addons/game.libretro.flycast/resources/system/dc/vmu_save_B1.bin"
                                                    
2020-05-29 19:39:12.346 T:19868    INFO <general>: AddOnLog: Sega - Dreamcast/NAOMI (Flycast): 00:02:346 hw/maple/maple_devs.cpp:569 N[MAPLE]: Loaded VMU from file "/home/odroid/.kodi/addons/game.libretro.flycast/resources/system/dc/vmu_save_C1.bin"
                                                    
2020-05-29 19:39:12.348 T:19868    INFO <general>: AddOnLog: Sega - Dreamcast/NAOMI (Flycast): 00:02:348 hw/maple/maple_devs.cpp:569 N[MAPLE]: Loaded VMU from file "/home/odroid/.kodi/addons/game.libretro.flycast/resources/system/dc/vmu_save_D1.bin"
                                                    
2020-05-29 19:39:12.359 T:19868    INFO <general>: AddOnLog: Sega - Dreamcast/NAOMI (Flycast): 00:02:359 nullDC.cpp:152 N[BOOT]: [LUT]: Product number: HDR-0043  .
                                                    
2020-05-29 19:39:12.371 T:19868    INFO <general>: GAME: ---------------------------------------
2020-05-29 19:39:12.371 T:19868    INFO <general>: GAME: Game loop:      true
2020-05-29 19:39:12.371 T:19868    INFO <general>: GAME: FPS:            60.000000
2020-05-29 19:39:12.371 T:19868    INFO <general>: GAME: Sample Rate:    44100.000000
2020-05-29 19:39:12.371 T:19868    INFO <general>: GAME: Region:         NTSC
2020-05-29 19:39:12.371 T:19868    INFO <general>: GAME: Savestate size: 28120411
2020-05-29 19:39:12.371 T:19868    INFO <general>: GAME: ---------------------------------------
2020-05-29 19:39:13.362 T:19868    INFO <general>: Loading skin file: VideoFullScreen.xml, load type: KEEP_IN_MEMORY
2020-05-29 19:39:13.367 T:19868    INFO <general>: Loading skin file: GameOSD.xml, load type: KEEP_IN_MEMORY
2020-05-29 19:39:13.389 T:19868    INFO <general>: Loading controller layout: /usr/local/share/kodi/addons/game.controller.snes/resources/layout.xml
2020-05-29 19:39:13.626 T:20805    INFO <general>: RetroPlayer[AUDIO]: Creating audio stream, format = AE_FMT_S16NE, sample rate = 44100, channels = 2
2020-05-29 19:42:03.226 T:19868    INFO <general>: Loading skin file: Custom_1101_SettingsList.xml, load type: KEEP_IN_MEMORY
2020-05-29 19:42:15.426 T:19868    INFO <general>: Loading skin file: DialogSelect.xml, load type: KEEP_IN_MEMORY
2020-05-29 19:42:15.428 T:19868 WARNING <general>: Trying to add unsupported control type 17
2020-05-29 19:42:15.428 T:19868 WARNING <general>: Trying to add unsupported control type 17
2020-05-29 19:42:19.860 T:19868    INFO <general>: Loading skin file: DialogSelect.xml, load type: KEEP_IN_MEMORY
2020-05-29 19:42:19.861 T:19868 WARNING <general>: Trying to add unsupported control type 17
2020-05-29 19:42:19.862 T:19868 WARNING <general>: Trying to add unsupported control type 17
2020-05-29 19:42:28.889 T:19868    INFO <general>: ADDON: Dll Destroyed - Sega - Dreamcast/NAOMI (Flycast)

The same core library works fine if I move it to RetroArch.


I tried to make a small change to the Kodi source because mali driver doesn't support dmabuf/gbm_bo_map/gbm_bo_unmap.
Code:
bool CWinSystemGbmGLESContext::InitWindowSystem()
{
  VIDEOPLAYER::CRendererFactory::ClearRenderer();
  CDVDFactoryCodec::ClearHWAccels();
  CLinuxRendererGLES::Register();
  RETRO::CRPProcessInfoGbm::Register();
  /* RETRO::CRPProcessInfoGbm::RegisterRendererFactory(new RETRO::CRendererFactoryDMA); */
  RETRO::CRPProcessInfoGbm::RegisterRendererFactory(new RETRO::CRendererFactoryOpenGLES);
 ...
/* #if defined(HAS_GBM_BO_MAP)
  CGBMBufferObject::Register();
#endif */
#if defined(HAVE_LINUX_MEMFD) && defined(HAVE_LINUX_UDMABUF)
  CUDMABufferObject::Register();
#endif
#if defined(HAVE_LINUX_DMA_HEAP)
  CDMAHeapBufferObject::Register();
#endif
So it only gives GBM and OpenGLES when starting Kodi:
Code:
2020-05-29 19:36:04.538 T:19868    INFO <general>: RetroPlayer[PROCESS]: Registering process control for GBM
2020-05-29 19:36:04.538 T:19868    INFO <general>: RetroPlayer[RENDER]: Registering renderer factory for OpenGLES

Bomberman works fine for example.

Any ideas?
Reply
#2
Same thing when running under Wayland (gnome 3.34):
Code:
2020-05-29 20:17:03.032 T:2642     INFO <general>: RetroPlayer[RENDER]: Registering renderer factory for DMA
2020-05-29 20:17:03.032 T:2642     INFO <general>: RetroPlayer[RENDER]: Registering renderer factory for OpenGLES
...
2020-05-29 20:17:36.859 T:2642     INFO <general>: RetroPlayer[PROCESS]: Created process info for Wayland
2020-05-29 20:17:37.071 T:2642     INFO <general>: Loading controller layout: /home/odroid/.kodi/addons/game.controller.dreamcast/resources/layout.xml
2020-05-29 20:17:37.072 T:2642     INFO <general>: GAME: ------------------------------------
2020-05-29 20:17:37.072 T:2642     INFO <general>: GAME: Loaded DLL for game.libretro.flycast
2020-05-29 20:17:37.072 T:2642     INFO <general>: GAME: Client: Sega - Dreamcast/NAOMI (Flycast) at version 0.1.0.18
2020-05-29 20:17:37.072 T:2642     INFO <general>: GAME: Valid extensions: .7z .bin .cdi .chd .cue .dat .elf .gdi .iso .lst .m3u .zip
2020-05-29 20:17:37.072 T:2642     INFO <general>: GAME: Supports VFS:                  no
2020-05-29 20:17:37.072 T:2642     INFO <general>: GAME: Supports standalone execution: no
2020-05-29 20:17:37.072 T:2642     INFO <general>: GAME: ------------------------------------
2020-05-29 20:17:37.072 T:2642     INFO <general>: RetroPlayer[PLAYER]: Opening: /mnt/sdcard/src/RA_Profile/roms/dreamcast/Sonic Adventure International v1.003 (1999)(Sega)(NTSC)(JP)(M5)[!]/Sonic Adventure International v1.003 (1999)(Sega)(NTSC)(JP)(M5)[!].gdi
2020-05-29 20:17:37.072 T:2642     INFO <general>: AddOnLog: Sega - Dreamcast/NAOMI (Flycast): Rumble interface supported!
                                                    
2020-05-29 20:17:37.073 T:2642     INFO <general>: AddOnLog: Sega - Dreamcast/NAOMI (Flycast): File extension is: .gdi
                                                    
2020-05-29 20:17:37.075 T:2642     INFO <general>: AddOnLog: Sega - Dreamcast/NAOMI (Flycast): 00:00:075 hw/mem/_vmem.cpp:556 N[VMEM]: Info: nvmem is enabled, with addr space of size 512MB
                                                    
2020-05-29 20:17:37.142 T:2642     INFO <general>: AddOnLog: Sega - Dreamcast/NAOMI (Flycast): Unable to find bios in /home/odroid/.kodi/addons/game.libretro.flycast/resources/system/dc/. Exiting...
                                                    
2020-05-29 20:17:37.151 T:2642    ERROR <general>: AddOnLog: Sega - Dreamcast/NAOMI (Flycast): 00:00:151 nullDC.cpp:436 W[COMMON]: Did not load bios, using reios
                                                    
2020-05-29 20:17:37.322 T:2642     INFO <general>: AddOnLog: Sega - Dreamcast/NAOMI (Flycast): 00:00:322 hw/maple/maple_devs.cpp:569 N[MAPLE]: Loaded VMU from file "/home/odroid/.kodi/addons/game.libretro.flycast/resources/system/dc/vmu_save_A1.bin"
                                                    
2020-05-29 20:17:37.324 T:2642     INFO <general>: AddOnLog: Sega - Dreamcast/NAOMI (Flycast): 00:00:324 hw/maple/maple_devs.cpp:569 N[MAPLE]: Loaded VMU from file "/home/odroid/.kodi/addons/game.libretro.flycast/resources/system/dc/vmu_save_B1.bin"
                                                    
2020-05-29 20:17:37.326 T:2642     INFO <general>: AddOnLog: Sega - Dreamcast/NAOMI (Flycast): 00:00:326 hw/maple/maple_devs.cpp:569 N[MAPLE]: Loaded VMU from file "/home/odroid/.kodi/addons/game.libretro.flycast/resources/system/dc/vmu_save_C1.bin"
                                                    
2020-05-29 20:17:37.329 T:2642     INFO <general>: AddOnLog: Sega - Dreamcast/NAOMI (Flycast): 00:00:329 hw/maple/maple_devs.cpp:569 N[MAPLE]: Loaded VMU from file "/home/odroid/.kodi/addons/game.libretro.flycast/resources/system/dc/vmu_save_D1.bin"
                                                    
2020-05-29 20:17:37.336 T:2642     INFO <general>: AddOnLog: Sega - Dreamcast/NAOMI (Flycast): 00:00:336 nullDC.cpp:152 N[BOOT]: [LUT]: Product number: HDR-0043  .
                                                    
2020-05-29 20:17:37.336 T:2642     INFO <general>: GAME: ---------------------------------------
2020-05-29 20:17:37.336 T:2642     INFO <general>: GAME: Game loop:      true
2020-05-29 20:17:37.336 T:2642     INFO <general>: GAME: FPS:            60.000000
2020-05-29 20:17:37.337 T:2642     INFO <general>: GAME: Sample Rate:    44100.000000
2020-05-29 20:17:37.337 T:2642     INFO <general>: GAME: Region:         NTSC
2020-05-29 20:17:37.337 T:2642     INFO <general>: GAME: Savestate size: 28120411
2020-05-29 20:17:37.337 T:2642     INFO <general>: GAME: ---------------------------------------
2020-05-29 20:17:38.150 T:2642     INFO <general>: Loading skin file: VideoFullScreen.xml, load type: KEEP_IN_MEMORY
2020-05-29 20:17:38.152 T:2642     INFO <general>: Loading skin file: GameOSD.xml, load type: KEEP_IN_MEMORY
2020-05-29 20:17:38.162 T:2642     INFO <general>: Loading controller layout: /usr/local/share/kodi/addons/game.controller.snes/resources/layout.xml
2020-05-29 20:17:38.310 T:2947     INFO <general>: RetroPlayer[AUDIO]: Creating audio stream, format = AE_FMT_S16NE, sample rate = 44100, channels = 2
Reply
#3
So for the record anything that uses GLES for rendering does not work on both kodi-gbm and kodi-wayland.
Cores that do not use GLES (e.g) Snes9x work fine on both kodi-gbm and kodi-wayland.

But for gbm two changes are required for the ARM mali driver:
disable the DMA renderer in: xbmc/windowing/gbm/WinSystemGbmGLESContext.cpp
Code:
/* RETRO::CRPProcessInfoGbm::RegisterRendererFactory(new RETRO::CRendererFactoryDMA); */
disable gbm_bo_map in: xbmc/windowing/gbm/WinSystemGbmGLESContext.cpp
Code:
/* #if defined(HAS_GBM_BO_MAP)
  CGBMBufferObject::Register();
#endif */

Now if somebody can point me to a fix for cores utilizing GLES (Mupen64, Parallel64, Flycast etc..) then that would make me happy Smile
Reply
#4
AFAIK it's simply is not yet implemented at all, gl/gles cores do not work on any platform.
Reply
#5
(2020-05-30, 04:28)asavah Wrote: AFAIK it's simply is not yet implemented at all, gl/gles cores do not work on any platform.

Are you sure?
Because they all have been ported complete with controller profiles...
Mupen64, Flycast, Parallel_N64 etc..
Reply
#6
Yeah. No GPU accelerated cores atm.
Reply
#7
Alright thanks for the information.
I'm kinda new to this and have not much experience in C++ programming.
However I find the source code very readable.

All software cores work great nevertheless.

Only the DMA renderer is giving me EGL errors using the Mali driver.
Will try to debug it.
Reply
#8
Hardware rendering isn't finished yet, sadly. I've done the needed change to the Game API for this: https://github.com/garbear/xbmc/commit/retro-gl-gbm-wip

IIRC there were some difficulties due to GL contexts being used on different threads. If this is something you'd like to work on, I recommend tracking down @lrusak and @a1rwulf
Reply
#9
(2020-05-31, 02:26)MastaG Wrote: Alright thanks for the information.
I'm kinda new to this and have not much experience in C++ programming.
However I find the source code very readable.

All software cores work great nevertheless.

Only the DMA renderer is giving me EGL errors using the Mali driver.
Will try to debug it.

Get a proper device with proper drivers  Blush
"PPC is too slow, your CPU has no balls to handle HD content." ~ Davilla
"Maybe it's a toaster. Who knows, but it has nothing to do with us." ~ Ned Scott
Reply
#10
(2020-06-22, 20:53)lrusak Wrote: Get a proper device with proper drivers  Blush

What is some different recommended minimum hardware/system requirements specification for "proper device with proper drivers" when it comes to running/rendering RetroPlayer and game-cores today?

Would you recommend Raspberry Pi 3, Raspberry Pi 4, or any other ARM-based device? Or is an x86 or x86-64 CPU recommended instead and if so do you, in general, recommend AMD, Nvidia or Intel HD Graphics and drivers for RetroPlayer?

Regardless of the answer, I guess that the listed recommended platformed in https://kodi.wiki/view/Supported_hardware should probably need to be updated specifically with RetroPlayer in mind, or?
Reply
#11
(2020-06-22, 20:53)lrusak Wrote:
(2020-05-31, 02:26)MastaG Wrote: Alright thanks for the information.
I'm kinda new to this and have not much experience in C++ programming.
However I find the source code very readable.

All software cores work great nevertheless.

Only the DMA renderer is giving me EGL errors using the Mali driver.
Will try to debug it.

Get a proper device with proper drivers  Blush
Yeah the driver is kinda limited in what it can do.
Kodi uses EGL_EXT_image_dma_buf_import to render the images.
However Odroid XU3/4's mali drivers only support: DRM_FORMAT_RGBA8888 when utilizing EGL_EXT_image_dma_buf_import.

I can see the following for Kodi's GameClient translation:
cpp:

AVPixelFormat CGameClientTranslator::TranslatePixelFormat(GAME_PIXEL_FORMAT format)
{
  switch (format)
  {
    case GAME_PIXEL_FORMAT_0RGB8888:
      return AV_PIX_FMT_0RGB32;
    case GAME_PIXEL_FORMAT_RGB565:
      return AV_PIX_FMT_RGB565;
    case GAME_PIXEL_FORMAT_0RGB1555:
      return AV_PIX_FMT_RGB555;
    default:
      break;
  }
  return AV_PIX_FMT_NONE;

Which get's translated by the DMA renderer:
cpp:
bool CRenderBufferPoolDMA::ConfigureInternal()
{
  switch (m_format)
  {
    case AV_PIX_FMT_0RGB32:
    {
      m_fourcc = DRM_FORMAT_ARGB8888;
      return true;
    }
    case AV_PIX_FMT_RGB555:
    {
      m_fourcc = DRM_FORMAT_ARGB1555;
      return true;
    }
    case AV_PIX_FMT_RGB565:
    {
      m_fourcc = DRM_FORMAT_RGB565;
      return true;
    }
    default:
      break; // we shouldn't even get this far if we are given an unsupported pixel format
  }

Now the snes9x will render to RGB565 pixel format, this will eventually end up calling EGL_EXT_image_dma_buf_import with: DRM_FORMAT_RGB565.
Which fails with error 12300 (EGL_BAD_PARAMETER)
Code:
2020-07-29 00:16:11.051 T:1590    DEBUG <general>: RetroPlayer[RENDER]: Creating render buffer of size 256x224 for buffer pool
2020-07-29 00:16:11.051 T:1590    DEBUG <general>: CRenderBufferDMA: using BufferObject type: CUDMABufferObject
2020-07-29 00:16:11.063 T:1439    ERROR <general>: CEGLImage::CreateImage - failed to import buffer into EGL image: 12300
2020-07-29 00:16:11.063 T:1439    DEBUG <general>: CEGLImage::CreateImage - attributes:
                                                   EGL_WIDTH: 256
                                                   EGL_HEIGHT: 224
                                                   EGL_LINUX_DRM_FOURCC_EXT: 909199186
                                                   EGL_DMA_BUF_PLANE0_FD_EXT: 42
                                                   EGL_DMA_BUF_PLANE0_OFFSET_EXT: 0
                                                   EGL_DMA_BUF_PLANE0_PITCH_EXT: 512

Is it possible to somehow upscale RGB565 to RGBA8888 ?
Reply
#12
We can always fall back to software framebuffers if 565 importing is not supported. What do you think @lrusak ?
Reply
#13
Any news on GPU accelerated hardware rendering?
Reply
#14
No news on my end. I'm working with our GSoC student on finishing the saved game manager.
Reply

Logout Mark Read Team Forum Stats Members Help
OpenGLES cores do not render on Odroid XU40