[Mesa-users] Give A directFB surface to EGL

Albert Freeman albertwdfreeman at gmail.com
Thu Oct 22 01:32:58 PDT 2015


On 22 October 2015 at 15:35, 刘涛 <liutao586 at 163.com> wrote:
> Hi
>    I‘m trying to give a directFB surface to eglCreateWindowSurface(), like
> below:
>     //1 create Directfb Surface
>     DFBDisplayLayerConfig dlc;
>     DFBSurfaceDescription dsc;
>     DFBWindowDescription dsc_w;
>     DirectFBInit(0, NULL);
>     DirectFBCreate(&_pDFB);
>     _pDFB->SetCooperativeLevel(_pDFB, DFSCL_FULLSCREEN);
>     memset(&dsc, 0, sizeof(dsc));
>     dsc.flags  = (DFBSurfaceDescriptionFlags)(DSDESC_CAPS);
>     dsc.caps   = (DFBSurfaceCapabilities)(DSCAPS_PRIMARY |
> DSCAPS_DOUBLE|DSCAPS_GL);
>     DFBCHECK(_pDFB->CreateSurface(_pDFB, &dsc, &_pDFB_surface));
>
>     //2 create egl surface
>     EGLDisplay eglDisplay = EGL_NO_DISPLAY;
>     EGLint iMajorVersion, iMinorVersion;
>      EGLint configAttribs[] =
>     {
>         EGL_RED_SIZE,          8,
>         EGL_GREEN_SIZE,      8,
>         EGL_BLUE_SIZE,          8,
>         EGL_ALPHA_SIZE,      8,
>         EGL_DEPTH_SIZE,      24,
>         EGL_STENCIL_SIZE,      8,
>         EGL_SAMPLES,          0,
>         EGL_SURFACE_TYPE,     EGL_WINDOW_BIT,
>         EGL_RENDERABLE_TYPE, EGL_OPENGL_ES2_BIT,
>         EGL_NONE
>     };
>     EGLConfig  eglConfig  = 0;
>     EGLint iConfigs = 0;
>
>     eglDisplay = eglGetDisplay(EGL_DEFAULT_DISPLAY);
>     eglInitialize(eglDisplay, &iMajorVersion, &iMinorVersion);
>     eglBindAPI(EGL_OPENGL_ES_API);
>     eglChooseConfig(eglDisplay, configAttribs, &eglConfig, 1, &iConfigs);
>     eglSurface = eglCreateWindowSurface(eglDisplay, eglConfig,
> (EGLNativeWindowType)_pDFB_surface, NULL);
>
>    But it failed and got 0x3003 error code.
>     Any idea about that?
> Env:
>     Ubuntu 14..04.3, Mesa-10.1.3, DirectFB-1.7.6(use system x11)
>
>
>
>
>
>
>
>
>
>
> _______________________________________________
> mesa-users mailing list
> mesa-users at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/mesa-users
>
You can't use EGL with DirectFB.
DirectFB had a DirectFBGL "extension" for 3D with DirectFB that has
apparently died.
So you can't get 3D hardware acceleration with DirectFB.
DirectFB uses the older fbdev legacy kernel stuff (which the
replacement drm at least partially emulates). Although fbdev supports
more hardware than the drm. If you are on hardware that doesn't
support drm then the best approach I can think of is to software
render OpenGL and then somehow obtain the texture rendered to and
somehow send that as a 2D image with something that can draw to a
fbdev framebuffer (such as DirectFB) (don't ask me how, ask someone
else (best to ask on #dri-devel irc channel)). For someone like you it
is best to use the latest git (not stable) version of mesa.
If your hardware supports drm, your choices for 3D are:
1. Use GL (optionally ES) & EGL & drm & gbm with mesa and without
DirectFB (see eglkms.c demo in mesa demos and "man -k drm" and maybe
http://events.linuxfoundation.org/sites/events/files/slides/brezillon-drm-kms.pdf)
(this runs without a window system and works much like DirectFB but I
believe you must use OpenGL (optionally ES) for 2D too (although you
MIGHT be able to setup a hardware overlay for video)). If you are not
using a relatively modern radeon, intel or nvidia card software
rendering is probably the best way to go here (using softpipe (or if
you are on x86 only: llvmpipe)).
2. Use Wayland with EGL and mesa and without DirectFB.
3. Use X and without DirectFB with (mesa OR proprietary drivers).

How to force softpipe:
"export GALLIUM_DRIVER=softpipe" and
"export LIBGL_ALWAYS_SOFTWARE=1". You will need to add swrast to the
gallium (NOT dri) mesa compile option (e.g.
--with-gallium-drivers=swrast) and
recompile mesa.

You can also force llvmpipe with "export GALLIUM_DRIVER=llvmpipe".
Actually "export LIBGL_ALWAYS_SOFTWARE=1" is only required if you have
a non gallium mesa driver installed (such as the i965 intel driver).

I hope I didn't forget anything.


More information about the mesa-users mailing list