OpenLara icon indicating copy to clipboard operation
OpenLara copied to clipboard

Building with latest OpenDingux/gcw0 Toolchain results in an error

Open john-parton opened this issue 4 years ago • 9 comments

Cloned down master and tried to compile with the latest gcw0 toolchain.

Got this error:

~/Code/projects/OpenLara/src/platform/gcw0$ ./build.sh 
In file included from /opt/gcw0-toolchain/mipsel-gcw0-linux-uclibc/sysroot/usr/include/EGL/egl.h:39,
                 from main.cpp:10:
/opt/gcw0-toolchain/mipsel-gcw0-linux-uclibc/sysroot/usr/include/EGL/eglplatform.h:134:10: fatal error: X11/Xlib.h: No such file or directory
  134 | #include <X11/Xlib.h>
      |          ^~~~~~~~~~~~
compilation terminated.

More information about the latest OpenDingux: https://opendingux.net/opendingux/2020/10/13/we-have-nighties.html

john-parton avatar Jul 08 '21 05:07 john-parton

sudo apt install libx11-dev

XProger avatar Jul 09 '21 04:07 XProger

That doesn't work. I'm cross-compiling for the gcw0. The toolchain doesn't have X11-dev, because the platform doesn't have X11 at all.

john-parton avatar Jul 09 '21 04:07 john-parton

gcw0/OpendDingux requires rendering directly with SDL or OpenGL ES

john-parton avatar Jul 09 '21 04:07 john-parton

yep, you can check why your toolchain EGL header require X Window libraries in /opt/gcw0-toolchain/mipsel-gcw0-linux-uclibc/sysroot/usr/include/EGL/eglplatform.h:134

XProger avatar Jul 09 '21 04:07 XProger

gcw0 devices literally don't have X11. I'm not sure what else to say.

Does EGL require X11 to function?

john-parton avatar Jul 15 '21 18:07 john-parton

I had also tried to build for mainline OpenDingux (current beta) using gcw0 platform. I have success compiling using EGL_NO_X11 and adjusting _OS_GCW0 definitions in src/gapi/gl.h. But I have not success to obtain an EGL config for a window blit, only pixel buffer.

Then I have tried to build with SDL2/GLES2 and SDL2/OpenGL and get positive results.

So I have created a new platform named opendingux as a copy of sdl2 platform and then made some changes:

  • Add rumble
  • Adjust the input functions to return the button keypresses as joystick pressed buttons buttons.
  • Changed to RGB565
  • Added GLSL version 100 for GLES2 and OpenGL
  • Added VAO and binary load for GLES2 build.

With VAO enabled the SDL2/GLES2 build I believe that have similar performance as the gcw0 build in stock firmware.

At first I also had compiled for GLES3, but it have no sense because JZ4770 is only GLES2 compatible.

Take into account that I have no knowledge in GLES/OpenGL so probably I have missing some points that could improve performance or made some mistakes that must be corrected.

I am not sure if my changes can be pushed upstream, for sure the code must be revised to accommodate to the project coding and porting style and also to fix mistakes I had probably introduced. I suspect that cloned sdl2 platform as opendingux it is not the best strategy. And also having two platforms for same devices maybe confusing, gcw0 for old firmware and opendingux for mainline beta firmware.

You can see all this changes and download opk files here

OpenDingux latest changes here + subprojects (kernel, pwswd, gmenu2x, etc) OpenDingux latest firmware here

In OpenDingux OpenGL is using GL4ES wrapper on top of OpenGL ES 2.0

plrguez avatar Nov 06 '21 15:11 plrguez

I had also tried to build for mainline OpenDingux (current beta) using gcw0 platform. I have success compiling using EGL_NO_X11 and adjusting _OS_GCW0 definitions in src/gapi/gl.h. But I have not success to obtain an EGL config for a window blit, only pixel buffer.

Then I have tried to build with SDL2/GLES2 and SDL2/OpenGL and get positive results.

So I have created a new platform named opendingux as a copy of sdl2 platform and then made some changes:

* Add rumble

* Adjust the input functions to return the button keypresses as joystick pressed buttons buttons.

* Changed to RGB565

* Added GLSL version 100 for GLES2 and OpenGL

* Added VAO and binary load for GLES2 build.

With VAO enabled the SDL2/GLES2 build I believe that have similar performance as the gcw0 build in stock firmware.

At first I also had compiled for GLES3, but it have no sense because JZ4770 is only GLES2 compatible.

Take into account that I have no knowledge in GLES/OpenGL so probably I have missing some points that could improve performance or made some mistakes that must be corrected.

I am not sure if my changes can be pushed upstream, for sure the code must be revised to accommodate to the project coding and porting style and also to fix mistakes I had probably introduced. I suspect that cloned sdl2 platform as opendingux it is not the best strategy. And also having two platforms for same devices maybe confusing, gcw0 for old firmware and opendingux for mainline beta firmware.

You can see all this changes and download opk files here

OpenDingux latest changes here + subprojects (kernel, pwswd, gmenu2x, etc) OpenDingux latest firmware here

In OpenDingux OpenGL is using GL4ES wrapper on top of OpenGL ES 2.0

Hey @plrguez thanks for this fixes, I was able to launch Open Lara on OpenDingux beta using your version. It works well and performance is good. However, there is a problem on some devices with particular resolutions (320*480 - rectangular pixels). The image looks squished vertically, it doesn't display in the correct aspect ratio. Is there a way to force the resolution to something like 320x240 so the aspect ratio is preserved?

MMouta avatar Feb 01 '22 06:02 MMouta

Hey @plrguez thanks for this fixes, I was able to launch Open Lara on OpenDingux beta using your version. It works well and performance is good. However, there is a problem on some devices with particular resolutions (320*480 - rectangular pixels). The image looks squished vertically, it doesn't display in the correct aspect ratio. Is there a way to force the resolution to something like 320x240 so the aspect ratio is preserved?

Hello, I have created a new release to fix the aspect ratio in 320x480 devices. Grab the new version here

plrguez avatar Feb 01 '22 17:02 plrguez

Hey @plrguez thanks for this fixes, I was able to launch Open Lara on OpenDingux beta using your version. It works well and performance is good. However, there is a problem on some devices with particular resolutions (320*480 - rectangular pixels). The image looks squished vertically, it doesn't display in the correct aspect ratio. Is there a way to force the resolution to something like 320x240 so the aspect ratio is preserved?

Hello, I have created a new release to fix the aspect ratio in 320x480 devices. Grab the new version here

Amazing, thank you very much for this. The game is displaying in the correct aspect ratio now. Looks and plays great!

MMouta avatar Feb 01 '22 20:02 MMouta