Fixing: libEGL warning: DRI2: failed to authenticate

Discussion about everything. New games, 3d math, development tips...
CuteAlien
Admin
Posts: 9644
Joined: Mon Mar 06, 2006 2:25 pm
Location: Tübingen, Germany
Contact:

Fixing: libEGL warning: DRI2: failed to authenticate

Post by CuteAlien »

Just in case anyone else ever runs into this problem on Debian (it plagued me for a pretty long time).
I got this error every time I tried to run any es2 stuff like es2gears, Irrlicht with es2 or when running nvidia-settings, sometimes even in Firefox startup.

The solution was that I had to run: update-alternatives --config glx
And then chose the (in my case already selected, but somehow broken) Nvidia alternative.
This told me then: "update-alternatives: warning: forcing reinstallation of alternative /usr/lib/nvidia because link group glx is broken"

And voila my es2gears are back. And I finally can code & test ES2 on Linux desktop again.
IRC: #irrlicht on irc.libera.chat
Code snippet repository: https://github.com/mzeilfelder/irr-playground-micha
Free racer made with Irrlicht: http://www.irrgheist.com/hcraftsource.htm
kas1e
Posts: 212
Joined: Sun Jan 21, 2018 8:39 am

Re: Fixing: libEGL warning: DRI2: failed to authenticate

Post by kas1e »

@CuteAlien

So it did mean that ogles2 in irrlicht still rely on EGL for context creation ?

Why not directly X11 and/or SDL tut_jump0.irrbmesh like it happens to be with pure OpenGL ?

I mean, EGL is additional layer which have no needs to be in, especially if we use directly X11 driver or SDL driver. I do use SDL2 with ogles2 all the time here, without needs of any EGL.

Is it worth to create feature-request ticket, so to get rid of EGL and use directly things as in case with pure OpenGL way just via SDL and/or X11 drivers ?

The less layers always better.
CuteAlien
Admin
Posts: 9644
Joined: Mon Mar 06, 2006 2:25 pm
Location: Tübingen, Germany
Contact:

Re: Fixing: libEGL warning: DRI2: failed to authenticate

Post by CuteAlien »

Isn't EGL basically the equivalent of GLX just for ES1 & 2? We do use GLX for OpenGL on X11. I don't know if there is another option to get an ES2 context on X11. And I suppose SDL internally uses it probably as well?

At least that's what I thought so far - never did dig deeper into those parts.
IRC: #irrlicht on irc.libera.chat
Code snippet repository: https://github.com/mzeilfelder/irr-playground-micha
Free racer made with Irrlicht: http://www.irrgheist.com/hcraftsource.htm
kas1e
Posts: 212
Joined: Sun Jan 21, 2018 8:39 am

Re: Fixing: libEGL warning: DRI2: failed to authenticate

Post by kas1e »

To say truth i do not know if it equalent, but surely kind of the same (window/keyboard/context manager). But when we do use SDL driver, be it linux, or win32, or anything else, we do not use not GLX, not EGL, just SDL and SDL's context/window/keyboard managment. So there no reasson to go hardcore EGL route for ogles2. It can be the same SDL1 or SDL2 , as in case with pure OpenGL.

SDL internally may use different stuff that for sure, but the point is that on platforms where we do not have EGL, we can use SDL as it was with OpenGL. For example on my platform i do have opengl, ogles2 , and sdl1/sdl2 , but not EGL or GLX. So, in case with pure OpenGL rendering i just compile it for SDL device and everything go through it. So, the same by logic should be and with Ogles2 route , but in this case , we by some reassons hardcore it to EGL, like, ogles2 can be used only with EGL and not with antyhing else : but it can be used the same as OpenGL , with pure SDL and not only on linux, etc.

See for example this hello triangle:

https://github.com/erik-larsen/emscript ... iangle.cpp
https://github.com/erik-larsen/emscript ... events.cpp

Pure SDL2 + with usage of SDL_opengles2.h , so direct usage of OGLES2, and no GLX or EGL involved , and it works of course and on Linux and on Emscripten, and on any other platform as well.

Maybe issue why in Irrlicht things go through EGL route initially were because of SDL1 where usage of OGLES2 were kind of limited (or was it there at all ? dunno) , but it's long ago need to swith to SDL2 in irrlicht (i do so already for my own fork) , and was in hope to use OGLES2 branch for tests , but it hardcoded to EGL for now reassons :(
CuteAlien
Admin
Posts: 9644
Joined: Mon Mar 06, 2006 2:25 pm
Location: Tübingen, Germany
Contact:

Re: Fixing: libEGL warning: DRI2: failed to authenticate

Post by CuteAlien »

OGLES2 driver uses the context-manager passed to it. So in theory it should work with SDL setup. But I got to admit I never tested that combination.
IRC: #irrlicht on irc.libera.chat
Code snippet repository: https://github.com/mzeilfelder/irr-playground-micha
Free racer made with Irrlicht: http://www.irrgheist.com/hcraftsource.htm
kas1e
Posts: 212
Joined: Sun Jan 21, 2018 8:39 am

Re: Fixing: libEGL warning: DRI2: failed to authenticate

Post by kas1e »

I just checked ogles2 files in the irrlicht, and for example COGLES2Driver.cpp do have that:

Code: Select all

#if defined(EGL_VERSION_1_0) && defined(_DEBUG)
		EGLint g = eglGetError();
		switch (g)
But so far other ones didn't have EGL referance, so maybe that will works ..

I will try to build today SDL/OGLES2 case, maybe it will work and only need few small fixes..

Is ogles2 branch already have SDL2 , or it still SDL1 ? If it still SDL1 then it probabaly mean i also need to adapt SDL2 to ogles2 branch firstly..
CuteAlien
Admin
Posts: 9644
Joined: Mon Mar 06, 2006 2:25 pm
Location: Tübingen, Germany
Contact:

Re: Fixing: libEGL warning: DRI2: failed to authenticate

Post by CuteAlien »

I've not yet added SDL2. Wasn't on my 1.9 plan and reluctant to add it there. I had it planned for 1.10, although I realize by now it's rather minor changes so maybe I'll reconsider (still bunch of test it will need). There's some patches on forum for it (thought last one I'd seen wasn't optimal as it didn't create a new device for SDL2 and modifed SDL1 instead).
IRC: #irrlicht on irc.libera.chat
Code snippet repository: https://github.com/mzeilfelder/irr-playground-micha
Free racer made with Irrlicht: http://www.irrgheist.com/hcraftsource.htm
kas1e
Posts: 212
Joined: Sun Jan 21, 2018 8:39 am

Re: Fixing: libEGL warning: DRI2: failed to authenticate

Post by kas1e »

@CuteAlien
Adding SDL2 to irrlicht is not easy, it's very-very easy. If it will be complete switch from SDL1 to SDL2 it will even easer (less files to handle, less ifdefs). For my port i do have both and SDL1 and SDL2. See how easy SDL2 are :

SDL2 with just software rendering (All with proper ifdefs everywhere, etc):

https://github.com/kas1e/Irrlicht/commi ... f6d79af7b8

Then i just add opengl at top:

https://github.com/kas1e/Irrlicht/commi ... 8dec7b2c6e

So in general it is matter of copy paste .. But seeing how slow everything in irrlicht is progressing now, i don't hold the hope of course, and may try to just grab ogles2 branch, add SDL2 myself, and then to see, if it possible to build without EGL as it, or it will need some changes still.
kas1e
Posts: 212
Joined: Sun Jan 21, 2018 8:39 am

Re: Fixing: libEGL warning: DRI2: failed to authenticate

Post by kas1e »

@CuteAlien
Can i create a 2 topics : 1 with general bugs about build current repo with OpenGL , speed loss, etc, etc. And second topic about ogles2 with SDL route, etc ? It will be easy for us to discuss, etc and easyly works with in compare with SF tickets, and co .. If you doesn't mind of course.

For example right now i download current ogles2 branch, and trying to build it , and it fail to build fail COpenGLCacheHandler.cpp, because want X11 include , even, if i point out that i build all with SDL. So to fix that i need to do something of that sort:

Code: Select all

Need to fix "irrCompileConfig.h":

#if !defined(_IRR_WINDOWS_API_) && !defined(_IRR_OSX_PLATFORM_) && !defined(_IRR_IOS_PLATFORM_) && !defined(_IRR_ANDROID_PLATFORM_) && !defined(_IRR_EMSCRIPTEN_PLATFORM_)
#ifndef _IRR_SOLARIS_PLATFORM_
#define _IRR_LINUX_PLATFORM_
#endif
#define _IRR_POSIX_API_
#ifndef __amigaos4__
#define _IRR_COMPILE_WITH_X11_DEVICE_
#endif
#endif

But probabaly it should't be fixed a little bit properly, so to not be only amigaos4 , but any plaftform which use posix_api, but not X11 devie.
kas1e
Posts: 212
Joined: Sun Jan 21, 2018 8:39 am

Re: Fixing: libEGL warning: DRI2: failed to authenticate

Post by kas1e »

Ok, find out what wrong with build OGLES2 with SDL : CIrrDeviceSDL.cpp:

Code: Select all

	case video::EDT_OGLES2:
#if defined(_IRR_COMPILE_WITH_OGLES2_) && defined(_IRR_EMSCRIPTEN_PLATFORM_)
		{
			video::SExposedVideoData data;

			ContextManager = new video::CEGLManager();
			ContextManager->initialize(CreationParams, data);

			VideoDriver = video::createOGLES2Driver(CreationParams, FileSystem, ContextManager);
		}
So, OGLES2 do not mean only EMSCRIPTEN of course, and i had to comment this out, but then, as you can see we do have there for no reassons :

ContextManager = new video::CEGLManager();

Why ?:)

I mean why it's not enough to do the same as for OpenGL just "video::createOGLES2Driver" , why needs for additional calls and calling of EGL manager there ? To fill the CreationParams only ? But then, why we didn't do so for pure OpenGL then ?
CuteAlien
Admin
Posts: 9644
Joined: Mon Mar 06, 2006 2:25 pm
Location: Tübingen, Germany
Contact:

Re: Fixing: libEGL warning: DRI2: failed to authenticate

Post by CuteAlien »

Your guess is as good as mine why things are as they are ;-)

And yes, coding SDL2 relatively easy. Testing always a bit more work (several platforms and compilers...). So in the end it probably will need me to have some free day or weekend for it.
IRC: #irrlicht on irc.libera.chat
Code snippet repository: https://github.com/mzeilfelder/irr-playground-micha
Free racer made with Irrlicht: http://www.irrgheist.com/hcraftsource.htm
kas1e
Posts: 212
Joined: Sun Jan 21, 2018 8:39 am

Re: Fixing: libEGL warning: DRI2: failed to authenticate

Post by kas1e »

Well i currently tried to just replace in the CirrDeviceSDL.cpp and in COGLES2Driver.cpp all parts with "IContextManager* contextManager" on just "CIrrDeviceSDL* device", and in CirrDeviceSDL.cpp, in the "createwindow()" do open our ogles2.library. So far all compiles fine, but when i run any example i just have black screen :)

Have any suggestion how to debug next and co ?

Through i fear, that SDL1 will be of no go there for ogles2 on our side, and i need to swith to SDL2, but at least i want to find out by some debugging why it render black screen (because of SDL1 itself, or my changes suck, etc). Any suggestion how to debug this stuff very welcome :) Maybe i need to add some prinfs somewhere to see if they reach the place, etc, or maybe irrlicht have some debugging functionality already, i just need to enabled it or something ? At least the debug functionality which is happens when i just build without NDEBUG=1 is limited, it only throw to a shell some basics about loaded textures, etc, but it didn't say anything about why visually i see nothing, etc.

What is interesting, that FPS count works in the window title,etc, just all black.
CuteAlien
Admin
Posts: 9644
Joined: Mon Mar 06, 2006 2:25 pm
Location: Tübingen, Germany
Contact:

Re: Fixing: libEGL warning: DRI2: failed to authenticate

Post by CuteAlien »

The logging level in release is ELL_INFORMATION while in debug it's ELL_DEBUG. You can set it in createDeviceEx with SIrrlichtCreationParameters::LoggingLevel parameter.
Sound like context creation goes bad (so Window is all fine, but no GL context). Maybe give it a shot first with software driver. If that works ... I really have not much experience with SDL device (I only used it once myself when working with WebGL).
IRC: #irrlicht on irc.libera.chat
Code snippet repository: https://github.com/mzeilfelder/irr-playground-micha
Free racer made with Irrlicht: http://www.irrgheist.com/hcraftsource.htm
kas1e
Posts: 212
Joined: Sun Jan 21, 2018 8:39 am

Re: Fixing: libEGL warning: DRI2: failed to authenticate

Post by kas1e »

@CuteAlien
Maybe give it a shot first with software driver. If that works
Do you mean just run example and choose software mode ? If so, that of course works, as it go through sdl+software driver. It just when i use OGLES2 i an see anything.. Will try to play with SIrrlichtCreationParameters::LoggingLevel , but so far i tried like this:

Code: Select all

	irr::SIrrlichtCreationParameters params;
	
	params.DriverType=driverType;
	params.WindowSize=core::dimension2d<u32>(800, 600);
	params.Bits=16;
	params.Fullscreen=false;
	params.Stencilbuffer=false;
  	params.Vsync=false;
        params.EventReceiver = &receiver;	
	params.LoggingLevel = ELL_DEBUG;
	
	Device = createDeviceEx(params);
And run example.

But it didn't provide me any additional output about context or something.
CuteAlien
Admin
Posts: 9644
Joined: Mon Mar 06, 2006 2:25 pm
Location: Tübingen, Germany
Contact:

Re: Fixing: libEGL warning: DRI2: failed to authenticate

Post by CuteAlien »

Well, not that obvious that it works then. As that then means sdl is setup correct and it's pretty certainly about the opengl context not being created correctly.
IRC: #irrlicht on irc.libera.chat
Code snippet repository: https://github.com/mzeilfelder/irr-playground-micha
Free racer made with Irrlicht: http://www.irrgheist.com/hcraftsource.htm
Post Reply