Hello,
I am currently porting a software that use EGL under linux on the colibri IMX8X platform and there is a crash when I run the software.
I am not familiar with EGL / GLES software ( I am network programmer ) so I don’t know exactly how it works, but I was able to create a minimal code example that crashes.
Here is the code :
#include <stdio.h>
#include <X11/Xlib.h>
#include <X11/Xutil.h>
#include <EGL/egl.h>
#include <GLES2/gl2.h>
GC gc;
Display *display;
int screen;
Window win, root;
unsigned long white_pixel, black_pixel;
main() {
XInitThreads();
if ((display = XOpenDisplay ("")) == NULL) {
fprintf (stderr, "Can't open Display\n");
exit (1);
}
gc = DefaultGC (display, screen);
screen = DefaultScreen (display);
root = RootWindow (display, screen);
white_pixel = WhitePixel (display, screen);
black_pixel = BlackPixel (display, screen);
XSetBackground (display, gc, white_pixel);
XSetForeground (display, gc, black_pixel);
win = XCreateSimpleWindow (display, root,
0, 0, 400, 300, 5, black_pixel, white_pixel);
XSelectInput (display, win, ExposureMask);
XStoreName (display, win, "test egl");
XMapWindow (display, win);
EGLDisplay egl_disp = eglGetDisplay((NativeDisplayType)display);
EGLint major, minor;
printf("avant initialize\n");
eglInitialize(egl_disp, &major, &minor);
printf("major : %d , minor : %d\n",major,minor);
for (;;) {
XEvent ev;
XNextEvent (display, &ev);
switch (ev.type) {
case Expose :
break;
default :
break;
}
}
}
I have set my environnement build like this :
. /opt/tdx-xwayland/5.2.0/environment-setup-aarch64-tdx-linux
And I have build the sample test like this ( ignore warnings, this is just a quick sample ):
$CC -o test test.c -lX11 -lXext -lxcb -lXau -lpthread -lm -lEGL -lGLESv2
If I comment the part with EGL… , it runs well and the window is created.
If I uncomment the part with EGL … it crashes when eglInitialize is called.
I have tested this code under my linux desktop ( debian 10 64 bits ), and it runs well , and the major/minor version displayed is : 1.4
The code I have to build is an old software written in X11 and with EGL extension after. I cannot rewrite it. Maybe the issue is that I want X11 + EGL on the IMX8X where the graphic layer is wayland and not xorg/x11 ?
Or maybe there is another way to initialize egl , or any restriction ?
Regards,