Imagination PowerVR SDK Blog

Linux framebuffers and EGL/GL


#1
Hi,

 

I am using the PowerVR OpenGL ES 1.1 on the TI C6A818 EVM under Linux. By default, there are 3 Linux framebuffers available,  /dev/fb0 (HDMI), /dev/fb1 (HDCOMP) and /dev/fb2 (SDVENC). All of these displays work (verified interactively on the command line through the HDVPSS driver).

 

My application, based on the OGLESInitialization_NullWS.cpp template i.e.

 

eglDisplay = eglGetDisplay((NativeDisplayType)0);
eglInitialize(eglDisplay, &iMajorVersion, &iMinorVersion);
eglChooseConfig(eglDisplay, pi32ConfigAttribs, &eglConfig, 1, &iConfigs);
eglSurface = eglCreateWindowSurface(eglDisplay, eglConfig, (NativeWindowType)0, NULL);
eglContext = eglCreateContext(eglDisplay, eglConfig, NULL, NULL);
eglMakeCurrent(eglDisplay, eglSurface, eglSurface, eglContext);


can successfully render to what is obviously /dev/fb0 and the output appears correctly on the monitor attached to the HDMI port. Making the assumption that an EGL display is equivalent to a Linux framebuffer, I then modified the code to use:

 

eglDisplay = eglGetDisplay((NativeDisplayType)1);

 

but ended up with EGL_NO_DISPLAY being returned. Is this a bug with the EGL, a failing of the underlying Linux implementation or a mis-understanding on my part trying to make a (non-existent) connection between a display and a Linux framebuffer? What would be the correct way of using EGL to obtain the necessary contexts to allow rendering into different Linux framebuffers? Or is this dependent on the Linux implementation itself? Ultimately I'd like to be able to render independently to multiple framebuffers


Thanks in advance

Gary

#2

AFAIK, we call eglGetDisplay((NativeDisplayType)0); when there is only one display. In some mobile phones (such as motorola) used to have multiple displays, so for those devices you can call it with non zero number.

Your device must be having only one display, so when you call it by 1, it fails.