EGL + Wayland woes

Started by Aisaaax, March 20, 2020, 11:48:47

Previous topic - Next topic


Hi there!

I've been tasked on running my 3d modules under wayland, and I'm running into problems.

The way I'm currently doing stuff, is taking AWT Canvas, getting the DrawingSurface from it, and from that I can get Display and Native Window components.
I can then use EGL to connect those components and GLES, and create a context.

Here's a small code snippet:

this.ds = JAWT_GetDrawingSurface(canvas, awt.GetDrawingSurface());
JAWTDrawingSurfaceInfo dsi = JAWT_DrawingSurface_GetDrawingSurfaceInfo(ds, ds.GetDrawingSurfaceInfo());

JAWTX11DrawingSurfaceInfo dsiWin = JAWTX11DrawingSurfaceInfo.create(dsi.platformInfo());

int depth = dsiWin.depth();
long display = dsiWin.display();
long drawable = dsiWin.drawable();

// convert JAWT display handle into EGL display.
eglDisplay = eglGetDisplay(display);

I want to stress that everything until the last line works fine. Everything is set up as it should be, and the handles all seem good and well.

I run into a bit of a snag on the last line.
Here's the thing. It works fine on Desktop Linux PC. It works fine on ARM Debian machine. It seems to work fine on the Wayland ARM machine...
Only it returns Display = 0.
At the same time, it returns EGL_SUCCESS as the error code! So EGL basically thinks that everything went well, only display handle address is 0, which is unusable, obviously.

Because the display is 0, when I get to eglInitialize() - I get null pointer exception.

Another funny thing - I can get past that point if I do this:
eglDisplay = eglGetDisplay(EGL_DEFAULT_DISPLAY);

It works fine, it initializes EGL, it even finds frameBuffers and creates EGL capabilities.
It even creates the context just fine!
But then I need to get SURFACE, and for that I need Native Window, and obviously my Default Display that I used and the drawable that I got from JAWT - are incompatible. Bummer.

Any tips?