[Solved] Has anyone got Qt rendering to the Linux framebuffer using the Mesa Gallium OpenGL ES drivers?
-
I have been working on getting Qt to render to the Linux framebuffer using the Mesa-7.9 OpenGL ES libraries rendering to the intel i915 drivers and could do with some help or advice.
The roadmap so far:
compile and install the latest libdrm (2.4.23)
build and install Mesa, use the following configure options for i915
./configure --prefix=/usr --enable-gles-overlay --enable-gallium-i915 --with-egl-platforms=drm
This should give you a running OpenGL ES stack, you can test this by compiling the Mesa demos and running eglgears.
I have tested this procedure on both an intel mac-mini (dev box) and the target board an Advantech SOM7562 (requires Mesa-7.10)
I then build Qt with the following
@./configure -embedded x86 -qt-gfx-linuxfb -qt-mouse-tslib -qt-gfx-transformed -egl -gfx-plugin-simplegl -DMESA_EGL_NO_X11_HEADERS
@
Note: I have included the simplegl full screen window rendering system from qt-labs.When I run this up using the following command
@
./myapp -display simplegl:argb32 -qws
@I get the following output
@
QEglContext::chooseConfig(): Could not find a suitable EGL configuration
Requested: "type=es2 rgba=8,8,8,0 surface-type=window"
Available:
"id=1 type=es1,es2,gl,13 rgba=8,8,8,8 surface-type=pbuffer,9
caveat=none max-pbuffer-size=4096x4096 native-renderable=true
visual-id=0 visual-type=12344 bind-texture=rgb,rgba
min-swap-interval=0 max-swap-interval=0 conformant=true"
"id=2 type=es1,es2,gl,13 rgba=8,8,8,8 depth=24 stencil=8
surface-type=pbuffer,9 caveat=none max-pbuffer-size=4096x4096
native-renderable=true visual-id=0 visual-type=12344
bind-texture=rgb,rgba min-swap-interval=0 max-swap-interval=0
conformant=true"
"id=3 type=es1,es2,gl,13 rgba=8,8,8,8 depth=24 surface-type=pbuffer,9
caveat=none max-pbuffer-size=4096x4096 native-renderable=true
visual-id=0 visual-type=12344 bind-texture=rgb,rgba
min-swap-interval=0 max-swap-interval=0 conformant=true"
simplegl: driver cannot connect
@
Now I am trying to figure out whether I need to give up on simplegl and write a driver based on the PowerVR code or if this problem is deeper in the Qt code, it seems the problem is coming from src/gui/egl/qegl.cppAny advice or comments appreciated.
-
configuring open gl es problem http://developer.qt.nokia.com/forums/viewthread/879
-
Hi Moshen,
Thanks for the reply, I already have Qt configured and built against open GL ES, the configure string is above. I also have Qt running but not rendering to the simplegl screen manager.
Here is a little more info for anyone interested, the output of eginfo...
@
EGL API version: 1.4
EGL vendor string: Mesa Project
EGL version string: 1.4 (Gallium)
EGL client APIs: OpenGL OpenGL_ES OpenGL_ES2
EGL extensions string:
EGL_MESA_screen_surface EGL_MESA_drm_display EGL_MESA_drm_image
EGL_KHR_image_base EGL_KHR_reusable_sync EGL_KHR_fence_sync
EGL_KHR_surfaceless_gles1 EGL_KHR_surfaceless_gles2
EGL_KHR_surfaceless_opengl
Configurations:
bf lv colorbuffer dp st ms vis cav bi renderable supported
id sz l r g b a th cl ns b id eat nd gl es es2 vg surfaces0x01 32 0 8 8 8 8 0 0 0 0 0x00-- a y y y pb,scrn
0x02 32 0 8 8 8 8 24 8 0 0 0x00-- a y y y pb,scrn
0x03 32 0 8 8 8 8 24 0 0 0 0x00-- a y y y pb,scrn
Number of Screens: 1Screen 0 Modes:
id width height refresh name0x01 1280 1024 60.000 1280x1024
0x02 1280 1024 75.000 1280x1024
0x03 1152 864 75.000 1152x864
0x04 1024 768 75.000 1024x768
0x05 1024 768 60.000 1024x768
0x06 800 600 75.000 800x600
0x07 800 600 60.000 800x600
0x08 640 480 75.000 640x480
0x09 640 480 60.000 640x480
0x0a 720 400 70.000 720x400
@
I have finally figured out why this isn't working... MESA instead of giving a window with the EGL_WINDOW_BIT option, instead allows us to query and retrieve a screen surface using the extension EGL_SCREEN_BIT_MESASo I'll have to hack in some code based on the eglgears example into qegl...
After getting the surface code into qegl and qgl_qws I get the program started and running but GLSL isn't compiling, MESA implementation isn't complete, so off to the fixed pipeline and ES1
-
And the winning numbers are...
It is possible to render to the framebuffer using OpenGL ES1, Mesa and Gallium but I have made some nasty hacks that may not work for the rest of you...
Use the recipe above but with the following Qt configuration
@
./configure -embedded x86 -qt-gfx-linuxfb -qt-mouse-tslib -qt-gfx-transformed
-egl -opengl es1 -gfx-plugin-simplegl -DMESA_EGL_NO_X11_HEADERS
@
We can only use ES1 as Mesa-7.10 would not compile the vertex and fragment programs..?Then patch the following, these are hacks and have my screen resolution hard coded, you will have to modify them to suit your setup!
@
diff --git a/src/gui/egl/qegl.cpp b/src/gui/egl/qegl.cpp
index f21765e..69d8e92 100644
--- a/src/gui/egl/qegl.cpp
+++ b/src/gui/egl/qegl.cpp
@@ -285,10 +285,14 @@ EGLConfig QEgl::chooseConfig(const QEglProperties* properties, QEgl::PixelFormat
{
QEglProperties props(*properties);
EGLConfig cfg = QEGL_NO_CONFIG;- EGLint matching = 0;
- EGLDisplay dpy = QEgl::display();
- eglGetConfigs(dpy,&cfg,1,&matching);
- return cfg;
- do {
// Get the number of matching configurations for this set of properties.
-
EGLint matching = 0;
-
EGLDisplay dpy = QEgl::display(); if (!eglChooseConfig(dpy, props.properties(), 0, 0, &matching) || !matching) continue;
diff --git a/src/gui/egl/qegl_p.h b/src/gui/egl/qegl_p.h
index 37f4c2a..d5f10bd 100644
--- a/src/gui/egl/qegl_p.h
+++ b/src/gui/egl/qegl_p.h
@@ -64,6 +64,8 @@ QT_BEGIN_INCLUDE_NAMESPACEinclude <GLES/egl.h>
#else
include <EGL/egl.h>
+# define EGL_EGLEXT_PROTOTYPES
+# include <EGL/eglext.h>
#endif
#if !defined(EGL_VERSION_1_2)
typedef unsigned int EGLenum;
diff --git a/src/opengl/qgl_qws.cpp b/src/opengl/qgl_qws.cpp
index 6ad2774..738ab1b 100644
--- a/src/opengl/qgl_qws.cpp
+++ b/src/opengl/qgl_qws.cpp
@@ -156,8 +156,33 @@ static EGLSurface qt_egl_create_surface
props = 0;
EGLSurface surf;
if (devType == QInternal::Widget) {-
surf = eglCreateWindowSurface
-
(context->display(), context->config(), windowDrawable, props);
-
EGLint screenAttribs[10];
-
int i = 0;
-
screenAttribs[i++] = EGL_WIDTH;
-
screenAttribs[i++] = 1280;
-
screenAttribs[i++] = EGL_HEIGHT;
-
screenAttribs[i++] = 1024;
-
screenAttribs[i++] = EGL_NONE;
-
EGLint matching = 0;
-
EGLConfig cfg;
-
eglGetConfigs(QEgl::display(),&cfg,1,&matching);
-
surf = eglCreateScreenSurfaceMESA(context->display(), cfg, screenAttribs);
-
EGLScreenMESA screen;
-
eglGetScreensMESA(context->display(), &screen, 1, &matching);
-
EGLModeMESA mode;
-
eglGetModesMESA(context->display(), screen, &mode, 1, &matching);
-
bool b = eglShowScreenSurfaceMESA(context->display(), screen, surf, mode);
-
if (!b) {
-
printf("QEgl::createSurface(): show surface failed\n");
-
return 0;
-
}
-
qWarning("QEgl::createSurface(): widget surface");
+// surf = eglCreateWindowSurface
+// (context->display(), context->config(), windowDrawable, props);
} else {
surf = eglCreatePixmapSurface
(context->display(), context->config(), pixmapDrawable, props);@
Compile and install simplegl in the plugins directory, you will have to get it from the labs...
Now you should be able to run your program like this...
./myprogram -display simplegl -qws
One thing to note is that this still has some issues.
There is a problem with screen refreshes not working properly, changing tty and back forces a redraw
There is a problem with QML rendering the painters algrorithm in a different order, so some stuff at the back of your pages may be drawn over the top...
and while we are discussing programmable pipelines and GLSL I'd like to know the purpose of qglslShockingPinkSrcFragmentShader, I mean we have all had mornings like that but...
-
Hi,
I have got the SimpleGL Plugin downloaded from the GIT Repository.
But have a confusion over it here, a post in the forum "Regarding_Making&Installing":http://developer.qt.nokia.com/forums/viewthread/14047/
I think I should use @-gfx-plugin-simplegl@
in my configure path, but not sure how to get a makefile, so that I get libqscreensimplegl.so in the plugins/gfxdrivers, which will facilitate use on target