
(eglInitialize)SelectGraphicsMode - Failed to initialize display connection, error ????????
Posted Friday, 4 November, 2011 - 11:18 by MoKa inI am trying to run OpenTK using Mono, with GLES 2.0 context on various platforms.
I downloaded PowerVR Insider SDK for PC (Windows and Linux), and been able to run that context on Windows XP SP3, and Ubuntu 11.10.
Both works well, and runs well.
Now I am trying to run it on i.MX53 card, that has Ubuntu 11.10 MX5 version, special for i.MX53 board that has ARM type processor.
By the documents, it does support GLES 2.0.
I was able to run OpenGL 1.0 context on it, but it uses Software Rasterizer to render it.
But when I am trying to run GLES 2.0 context, it fails. I installed PowerVR Insider SDK libraries for ARM specially. And it has executables (they are written in C++), they does run, and renders properly. But when I am trying to run my code, it does not initialize window.
So I did further researches to find it an issue and got closer. Not sure that it will be an issue, but I hope I will get help from community to find solution.
For windows its a bit weird, it does run several functions many times, like creating context, or versions etc. But i need just GLES 2.0 (EGL) and nothing else..
Here is some part of log:
START Detected configuration: Windows / Mono Running on Windows Platform Egl is supported Running on Egl Windows Platform ### implementation: OpenTK.Platform.Windows.WinGLNative, exists: True ... GraphicsMode: Index: 2, Color: 32 (8888), Depth: 24, Stencil: 8, Samples: 0, Accum: 0 (0000), Buffers: 2, Stereo: False ... ### implementation - error: False, current: False, type: OpenTK.Platform.Windows.WinGLContext Selecting pixel format (ARB)... success! Disposing context 196609. Destroying window: Windows.WindowInfo: Handle 329360, Parent (null) ### GameWindow - width: 1024, height: 768, mode: bpp: 32, depth: 24, index: 2, samples: 0, stencil: 8, stereo: False, options: Default, device: bpp: 32, width: 1280, height: 960, major: 2, minor: 0, flags: Embedded, sharedContext: null ### GraphicsContext - window: Windows.WindowInfo: Handle 525682, Parent (Windows.WindowInfo: Handle 525688, Parent (null)) Creating GraphicsContext. GraphicsMode: Index: 2, Color: 32 (8888), Depth: 24, Stencil: 8, Samples: 0, Accum: 0 (0000), Buffers: 2, Stereo: False IWindowInfo: Windows.WindowInfo: Handle 525682, Parent (Windows.WindowInfo: Handle 525688, Parent (null)) GraphicsContextFlags: Embedded Requested version: 2.0 ### Factory: OpenTK.Platform.Egl.EglWinPlatformFactory maj: 2, min: 0 flags: Embedded Window: 2, handle: 525682, surface: 0 ... maj: 1, min: 3 GetConfigs: 6 ChooseConfig: 1 config: r: 8, g: 8, b: 8, a: 8, d: 24, s: 8, sb: 0, s: 0 ### implementation - error: False, current: True, type: OpenTK.Platform.Egl.EglContext Loading extensions for OpenTK.Graphics.ES10.GL... 106 extensions loaded in 21.8527 ms. Loading extensions for OpenTK.Graphics.ES11.GL... 247 extensions loaded in 42.1999 ms. Loading extensions for OpenTK.Graphics.ES20.GL... 177 extensions loaded in 32.7835 ms.
And after it runs well. Under Mono and under .Net works fine, and there is no difference in logs.
Now lets take a look on Linux (Ubuntu 11.10) from laptop log:
START System: Linux Initializing threaded X11: 1. Display connection: 148312096, Screen count: 1 Detected configuration: Linux / Mono Initializing threaded X: success. Running on X11 Platform dlopen tries: libGL.so Egl is supported Initializing threaded X: success. Running on Egl X11 Platform Xinerama query failed. Creating default GraphicsMode (24, 16, 0, 0, 0, 2, False). Bits per pixel: 24 Depth: 16 Display: 148312096, Screen: 0, RootWindow: 289 Getting FB config. ### NativeWindow Creating X11GLNative window. Display: 148633016, Screen 0, Root window: 289 Registering atoms. Bits per pixel: 24 Depth: 16 Display: 148312096, Screen: 0, RootWindow: 289 Getting FB config. Opening render window... Initalizing X11 input driver. First keycode: 8, last 255 6 keysyms per keycode. X11GLNative window created successfully (id: 65011714). ### implementation: OpenTK.Platform.X11.X11GLNative, exists: True ### GameWindow - width: 1024, height: 768, mode: bpp: 24, depth: 24, index: 243, samples: 0, stencil: 0, stereo: False, options: Default, device: bpp: 24, width: 1280, height: 800, major: 2, minor: 0, flags: Embedded, sharedContext: null ### GraphicsContext - window: X11.WindowInfo: Display 148633016, Screen 0, Handle 65011714, Parent: (null) Creating GraphicsContext. GraphicsMode: Index: 243, Color: 24 (8880), Depth: 24, Stencil: 0, Samples: 0, Accum: 0 (0000), Buffers: 2, Stereo: False IWindowInfo: X11.WindowInfo: Display 148633016, Screen 0, Handle 65011714, Parent: (null) GraphicsContextFlags: Embedded Requested version: 2.0 ### Factory: OpenTK.Platform.Egl.EglX11PlatformFactory maj: 2, min: 0 flags: Embedded Window: 2, handle: 65011714, surface: 0 maj: 1, min: 3 GetConfigs: 4 ChooseConfig: 1 config: r: 8, g: 8, b: 8, a: 8, d: 24, s: 8, sb: 0, s: 0 ### implementation - error: False, current: True, type: OpenTK.Platform.Egl.EglContext Loading extensions for OpenTK.Graphics.ES10.GL... PVRVFrameSetGlesLibraryPath: /home/efortiori/Downloads/ProjectC/libGLES_CM.so PVRVFrameSetGlesv2LibraryPath: /home/efortiori/Downloads/ProjectC/libGLESv2.so 106 extensions loaded in 10.4933 ms. Loading extensions for OpenTK.Graphics.ES11.GL... 247 extensions loaded in 19.1499 ms. Loading extensions for OpenTK.Graphics.ES20.GL... 177 extensions loaded in 12.6892 ms. Making WindowBorder hidden. Removed decorations through motif. Success.
There is no much difference. Another platform is used, on Windows is native, and on Linux is X11. As well on windows GetConfigs gives 6, but on linux 4.
And now lets take a look at i.MX53 log:
Initializing threaded X11: 1. Display connection: 35211328, Screen count: 1 Detected configuration: Linux / Mono Initializing threaded X: success. Running on X11 Platform Egl is supported Initializing threaded X: success. Running on Egl X11 Platform Xinerama query failed. Creating default GraphicsMode (16, 16, 0, 0, 0, 2, False). Bits per pixel: 16 Depth: 16 Display: 35211328, Screen: 0, RootWindow: 226 Getting FB config. ### NativeWindow Creating X11GLNative window. Display: 35552040, Screen 0, Root window: 226 Registering atoms. Bits per pixel: 24 Depth: 16 Display: 35211328, Screen: 0, RootWindow: 226 Getting FB config. Opening render window... Initalizing X11 input driver. First keycode: 8, last 255 6 keysyms per keycode. X11GLNative window created successfully (id: 56623106). ### implementation: OpenTK.Platform.X11.X11GLNative, exists: True ### GameWindow - width: 1024, height: 768, mode: bpp: 32, depth: 24, index: 65, samples: 0, stencil: 8, stereo: False, options: Default, device: bpp: 16, width: 1024, height: 768, major: 2, minor: 0, flags: Embedded, sharedContext: null ### GraphicsContext - window: X11.WindowInfo: Display 35552040, Screen 0, Handle 56623106, Parent: (null) Creating GraphicsContext. GraphicsMode: Index: 65, Color: 32 (8888), Depth: 24, Stencil: 8, Samples: 0, Accum: 0 (0000), Buffers: 2, Stereo: False IWindowInfo: X11.WindowInfo: Display 35552040, Screen 0, Handle 56623106, Parent: (null) GraphicsContextFlags: Embedded Requested version: 2.0 ### Factory: OpenTK.Platform.Egl.EglX11PlatformFactory maj: 2, min: 0 flags: Embedded Window: 35552040, handle: 56623106, surface: 0
And then it gives error:
OpenTK.Graphics.GraphicsModeException: Failed to initialize display connection, error 33966456 at OpenTK.Platform.Egl.EglGraphicsMode.SelectGraphicsMode (ColorFormat color, Int32 depth, Int32 stencil, Int32 samples, ColorFormat accum, Int32 buffers, Boolean stereo, IntPtr di) [0x00000] in <filename unknown>:0 at OpenTK.Platform.Egl.EglContext..ctor (OpenTK.Graphics.GraphicsMode mode, OpenTK.Platform.Egl.EglWindowInfo window, IGraphicsContext sharedContext, Int32 major, Int32 minor, GraphicsContextFlags flags) [0x00000] in <filename unknown>:0 at OpenTK.Platform.Egl.EglX11PlatformFactory.CreateGLContext (OpenTK.Graphics.GraphicsMode mode, IWindowInfo window, IGraphicsContext shareContext, Boolean directRendering, Int32 major, Int32 minor, GraphicsContextFlags flags) [0x00000] in <filename unknown>:0 at OpenTK.Graphics.GraphicsContext..ctor (OpenTK.Graphics.GraphicsMode mode, IWindowInfo window, Int32 major, Int32 minor, GraphicsContextFlags flags) [0x00000] in <filename unknown>:0 at OpenTK.GameWindow..ctor (Int32 width, Int32 height, OpenTK.Graphics.GraphicsMode mode, System.String title, GameWindowFlags options, OpenTK.DisplayDevice device, Int32 major, Int32 minor, GraphicsContextFlags flags, IGraphicsContext sharedContext) [0x00000] in <filename unknown>:0
Interesting thing, that when it does eglInitialize on display from window that comes before. In OpenTK.Platform.Egl.EglContext constructor.
But then it calls new EglGraphicsMode().SelectGraphicsMode and it calls eglInitialize there, it falls exactly here. So what an issue here?
If needed, I am able to provide any other tests. Remember, tests that comes with PowerVR Insider SDK, using X11 works, but mine doesn't (using OpenTK).
King Regards, Max.


Comments
Re: (eglInitialize)SelectGraphicsMode - Failed to ...
Ok, I made public some classes, enums and strucs, to be able to use Platform interfaces (X11 and EGL).
And, after parsing simple example based on C++ code, I manage to run GLES 2.0 context on i.MX53!
Here is dirty raw code to make it:
And it works! It creates window and context, no errors.
Right now I am doing investigation into OpenTK to make it work properly as this small code.
Re: (eglInitialize)SelectGraphicsMode - Failed to ...
Some update.
Unfortunately, I was unable to do any changes in OpenTK it self, looks like my skill is too low, but imho, architecture is really weird. Sometimes there is calls of Lazy functions or "API" multiple times, without any actual reason for it. And other weird things. Flow is uncontrollable :(
So, if there is someone who is still working on library improvements, and could fix that issue? Based on flow that I presented in previous post.
It would be really cool..
Re: (eglInitialize)SelectGraphicsMode - Failed to ...
OpenTK was not designed with OpenGL ES or EGL in mind, hence the strangeness. This will be improved in later versions.
Someone modified OpenTK recently, to improve support for embedded systems. I don't have the link right now (at work), but a search should reveal more information. These improvements will be ported back to the core distribution in the future.