EGLPort (interfaces to use EGL with SDL/RAW framebuffers)


Hi.

I use EGLPort for, well, porting to EGL, and it worked very well so far. I have used it with SDL until now. This time, I used it with Raw (I'm working on Allegro 5.1), but it fail, with a EGL_BAD_DISPLAY (0x3008). I used the R5.
 
Ok, I called EGL_Open and EGL_Init in the wrong order... My mistake

So now, EGL is initialized, I have the list of extensions...

...but...

It than fail with EGL_BAD_ATTRIBUTE (0x3004) at the FindAppropriateEGLConfigs
 
Ok, I tweaked EGLPort, to be abble to use X11 without SDL.

First, if GetNativeDisplay (and FreeNativeDisplay of course), if changed


#if defined(USE_EGL_SDL)

to


#if defined(USE_EGL_SDL) || defined(USE_EGL_RAW)


and also, in FindAppropriateEGLConfig, I have to remove the part with the 


#if defined(EGL_VERSION_1_2)

to avoid a BAD_ATTRIBUTE error.

And it seems to be ok...

...But...

I need to use some GLES Extensions...

I declared


 PFNGLBINDFRAMEBUFFEROESPROC glBindFramebufferEXT;


 

And created a 


glBindFramebufferEXT = (PFNGLBINDFRAMEBUFFEROESPROC) eglGetProcAddress("glBindFramebufferOES");
if (glBindFramebufferEXT == NULL)
printf("*** NO glBindFramebufferOES found !!!\n");

 

 

 

 

 

The eglGetProcAddress run fine.

But when I try a


glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, 0);


I just have a Segfault :(

Does someone have a hint?
 
Last edited by a moderator:
I will have to think some more on the other changes you made, but


GL_FRAMEBUFFER_EXT is only valid for opengl, you probably wanted to use GL_FRAMEBUFFER_OES
Is your segfault when you  call  glBindFramebufferEXT? That would usually mean the address was wrong or null.
 
The adress is not null (something 0x4..... don't remember), and I forgot to tell I have a

Code:
#define GL_FRAMEBUFFER_EXT    GL_FRAMEBUFFER_OES
 
Last edited by a moderator:
I'm getting this out of eglport using games when running on .next :



ERROR: Unable to initialise EGL display.
EGL Open display
EGL Get display


Could you please boot that image and pock me on irc ;)

EDIT : was drivers' fault not this good stuff
 
Last edited by a moderator:
Is there a way to disable VSync ?

I'm trying, using EGLPort (or similar way to create an EGLContext) to disable VSynch, but it always seems to stay activated.

I put



Code:
eglSwapInterval(EglDisplay, 0);

 

but I see no change.

So in the contextAttrib, I add



Code:
EGL_MIN_SWAP_INTERVAL, 0,
but then, the context selection failed... 

Does anybody has an hint on this subject?
 
Also, I am quite sure the



Code:
eglSwap();

is doing a blit and not a flip, so consumming precious time.

 

I tried to add 



Code:
eglSurfaceAttrib(EglDisplay, EglSurface, EGL_SWAP_BEHAVIOR, EGL_BUFFER_DESTROYED);
But then, I see nothing on screen :(
 
Well, about flip/blit

If I create the surface as



Code:
EglSurface = eglCreateWindowSurface(EglDisplay, config, NULL, NULL);
then I can change the surface swap behavior... But I'm not sure it improve things...
 
Revision 6 is now submitted at the sourceforge project.

This is significant revision as much of the code has been move and simplified. EGL_Init is gone and combined with EGL_Open.

RAW/Framebuffer render mode is now always available. SDL render is still another option.

Significant feature added is the eglport.cfg, this file can contain a select number of manual settings to change EGL behavior during runtime. For instance a quick change in the file and the user can switch between raw and sdl modes. Turn on/off fsaa or vsync. Enable a FPS timer. Change color/depth settings.

Platforms tested so far are x86 Mesa, Caanoo, Wiz, Pandora, Raspberry Pi.
 
This does look good, I'll try it.

Pickle, I suggest edit the first post to link to HEAD, not the old revision 3, i.e.:

Code:
http://sourceforge.net/p/eglport/code-0/HEAD/tree/trunk/
 
What needs to be changed to make this work on the Raspberry Pi? Got the example j0n posted some time ago to work on the Pandora using revision 6 without having to change much, but the same code runs into trouble on the Pi. I've added the /opt/vc and bcm_host stuff from hello_triangle and added -DRPI, but it's giving me "libEGL warning: DRI2: failed to authenticate" and "EGL_BAD_ALLOC EGL (0x3003)".

Also is there more info/documentation on eglport besides this thread?
 
What needs to be changed to make this work on the Raspberry Pi? Got the example j0n posted some time ago to work on the Pandora using revision 6 without having to change much, but the same code runs into trouble on the Pi. I've added the /opt/vc and bcm_host stuff from hello_triangle and added -DRPI, but it's giving me "libEGL warning: DRI2: failed to authenticate" and "EGL_BAD_ALLOC EGL (0x3003)".

Also is there more info/documentation on eglport besides this thread?
Whats your memory slice allocation? Too low and you get errors like that.

The source code is the documentation ;-) Check the the header for some comments on the defines and other things.
 
GPU was originally at 64MB. I just upped it to 128, but still the same problem.

I got some hints from the c file, but hadn't thought to check the header. Everything looks pretty alright based on what I'm reading there.

Here's how I'm compiling the code. Perhaps something is amiss here? Otherwise I'll start a fresh copy tomorrow and try again.

Code:
g++ *.cpp -o g `sdl-config --cflags --libs` -lGLESv1_CM -lEGL -lSDL_image -lX11 -DUSE_GLES1 -DUSE_EGL_SDL -DRPI -lbcm_host -lvcos -lvchiq_arm -lpthread -lrt -L/opt/vc/lib -I/opt/vc/include -I/opt/vc/include/interface/vcos/pthreads -I/opt/vc/include/interface/vmcs_host/linux
 
So it seems the EGL_BAD_ALLOC was from interference from a Mesa header taking precedence somewhere. Thought I'd uninstalled it all, but apparently not the libegl1 part. Started with a spare copy of Raspbian with no Mesa stuff installed, and getting more useful results. I can get a screen going using USE_EGL_RAW and draw a quad on the screen, at the expense of SDL keyboard input and image loading capability, which I would like to keep. If I USE_EGL_SDL:


if (SDL_Init(SDL_INIT_EVERYTHING) < 0) exit(1);
screen = SDL_SetVideoMode(800,600,16,SDL_SWSURFACE|SDL_FULLSCREEN);
if (screen == NULL) { cout << "SDL video didn't initialise." << endl; exit(1); }
//EGL_Init();
if (EGL_Open(800,600))
{
cout << "No EGL window." << endl;
exit(1);
}

Code:
EGLport: Opening EGL display
EGLport: Opening SDL/X11 display
EGLport ERROR: Unable to create EGL display.
No EGL window
Edit:

I modified eglport to pass EGL_DEFAULT_DISPLAY to peglGetDisplay instead of nativeDisplay as retrieved in GetNativeDisplay(), and now it works. Printing the nativeDisplay variable before that call indicates there is some information there, but apparently not something that EGL is happy with, regardless of what resolution or colour depth I set in SDL_SetVideoMode. Is this workaround likely to have any repercussions?

So far I can draw a solid quad and textured quad, although the screen is scaled to the edge of the screen as opposed to being boxed at 1:1 size as a standard SDL screen would be. Trying orthogonal mode, but nothing is showing up yet.
 
Last edited by a moderator:
Yup, revision 6 as linked above by DREDD.

I got it going by setting egl_mode=RENDER_RAW in eglport.cfg while USE_EGL_SDL is still flagged. Orthogonal mode is working too. Plus I was able to revert to passing nativeDisplay to peglGetDisplay. Pretty much success all round. \o/
 
Last edited by a moderator:
Significant feature added is the eglport.cfg, this file can contain a select number of manual settings to change EGL behavior during runtime. For instance a quick change in the file and the user can switch between raw and sdl modes. Turn on/off fsaa or vsync. Enable a FPS timer. Change color/depth settings.
I'm looking at the source code (Revision 6) and I see that you can't enable a FPS timer using eglport.cfg.

In function OpenCfg, you're missing a line like this:

Code:
strncpy( eglStrings[CFG_FPS], "use_fps=", MAX_STRING );
 
Back
Top