qmlglsink fails with EGL_BAD_CONTEXT or fails to retrieve wrapped context on creation on Jetson Tx1
-
Hi,
not sure if this a topic for this forum, but as it is a Qt Project and QML related, I'll try it here.
I have a simple Quick Project with a VideoItem using a qmlglsink.
Basically I'd link to have a gstreamer stream within a QML UI where I can use it as part of the UI there (overlay with other UI, transform, stylize and such..)
Everything is running fine on an X11 host machine.When I cross compile the project for the Nvidia Jetson Tx1 (ARM) and run it, I get this error:
DEBUG glcontext gstglcontext_egl.c:321:gst_gl_context_egl_create_context:<glcontextegl0> Creating EGL context INFO glcontext gstglcontext_egl.c:367:gst_gl_context_egl_create_context: egl initialized, version: 1.5 INFO glcontext gstglcontext_egl.c:479:gst_gl_context_egl_create_context: Bound OpenGL|ES INFO glcontext gstglcontext_egl.c:226:gst_gl_context_egl_choose_config: config set: 13300551, 1 DEBUG glcontext gstglcontext_egl.c:270:_create_context_with_flags:<glcontextegl0> attempting to create OpenGL ES context version 3.2 flags 1 profile 0 DEBUG glcontext gstglcontext_egl.c:270:_create_context_with_flags:<glcontextegl0> attempting to create OpenGL ES context version 3.2 flags 0 profile 0 INFO glcontext gstglcontext_egl.c:226:gst_gl_context_egl_choose_config: config set: 13300551, 1 DEBUG glcontext gstglcontext_egl.c:270:_create_context_with_flags:<glcontextegl0> attempting to create OpenGL ES context version 3.1 flags 1 profile 0 DEBUG glcontext gstglcontext_egl.c:270:_create_context_with_flags:<glcontextegl0> attempting to create OpenGL ES context version 3.1 flags 0 profile 0 INFO glcontext gstglcontext_egl.c:226:gst_gl_context_egl_choose_config: config set: 13300551, 1 DEBUG glcontext gstglcontext_egl.c:270:_create_context_with_flags:<glcontextegl0> attempting to create OpenGL ES context version 3.0 flags 1 profile 0 DEBUG glcontext gstglcontext_egl.c:270:_create_context_with_flags:<glcontextegl0> attempting to create OpenGL ES context version 3.0 flags 0 profile 0 INFO glcontext gstglcontext_egl.c:226:gst_gl_context_egl_choose_config: config set: 13300551, 1 DEBUG glcontext gstglcontext_egl.c:270:_create_context_with_flags:<glcontextegl0> attempting to create OpenGL ES context version 2.0 flags 1 profile 0 DEBUG glcontext gstglcontext_egl.c:270:_create_context_with_flags:<glcontextegl0> attempting to create OpenGL ES context version 2.0 flags 0 profile 0 INFO glcontext gstglcontext_egl.c:226:gst_gl_context_egl_choose_config: config set: 13300551, 1 DEBUG glcontext gstglcontext_egl.c:270:_create_context_with_flags:<glcontextegl0> attempting to create OpenGL ES context version 0.0 flags 1 profile 0 DEBUG glcontext gstglcontext_egl.c:270:_create_context_with_flags:<glcontextegl0> attempting to create OpenGL ES context version 0.0 flags 0 profile 0 WARN glcontext gstglcontext.c:1161:gst_gl_context_create_thread:<glcontextegl0> Failed to create context INFO glcontext gstglcontext.c:963:gst_gl_context_create:<glcontextegl0> gl thread created ERROR qtglwidget qtitem.cc:322:qt_item_init_winsys: Failed to create a OpenGL context: EGL_BAD_CONTEXT WARN qtsink gstqtsink.cc:325:gst_qt_sink_change_state:<qtsink1> error: Could not initialize window system
The tested pipeline is pretty basic: Videotestsrc ! glupload ! qmlglsink
(I can get rid of the glupload as it is already integrated in the qmlglsink)
This is when I run the binary with '-platform eglfs'.When running it without this parameter then I also get an error:
ERROR qtglwidget qtitem.cc:308:qt_item_init_winsys: 0x74e490 failed to retrieve wrapped context (NULL) WARN qtsink gstqtsink.cc:325:gst_qt_sink_change_state:<qtsink1> error: Could not initialize window system
Did anyone encounter this problem too?
Any help here is appreciated,Thanks + Best,
Bodo -
@Bodo is gdm or xdm installed in system? And which one is the default one?
You can check that with;
on Debian/Ubuntu:cat /etc/X11/default-display-manager
on Fedora/RedHat:
cat /etc/sysconfig/desktop
on OpenSUSE:
cat /etc/sysconfig/displaymanager
And you can paste the output of
uname -a
to show system info so maybe it helps others to solve :D -
@Bodo I guess something is wrong with your opengl - qt communication for your board. Try this commands on your Jetson,
sudo apt-get build-dep qt5-default sudo apt-get install build-essential libx11-xcb-dev libglu1-mesa-dev
after that, try to compile your application again. If you have a native qmake, you can try to compile your application in a native way too. For example, you can run these commands on Jetson to native compile.
closx@closx-pc:~$ find / -name qmake /opt/Qt5.12.3/Docs/Qt-5.12.3/qmake /opt/Qt5.12.3/Tools/QtCreator/share/qtcreator/templates/wizards/projects/qmake /opt/Qt5.12.3/5.12.3/android_x86/bin/qmake /opt/Qt5.12.3/5.12.3/gcc_64/bin/qmake //This is //the qmake i will use. Since I am using GCC x64 on my host system. //for you it can be something like /usr/lib/something/qt5/bin/qmake /opt/Qt5.12.3/5.12.3/android_armv7/bin/qmake ... closx@closx-pc:~$ /opt/Qt5.12.3/5.12.3/gcc_64/bin/qmake /path/to/my/project/someproject.pro
-
I installed the mentioned package (most ot them already were installed) and recompiled via the cross chain with the same result.
Tried a build on the Jetson:
sudo find / -name qmake /usr/bin/qmake /usr/share/qt4/bin/qmake /usr/lib/aarch64-linux-gnu/qt5/bin/qmake /usr/lib/aarch64-linux-gnu/qt4/bin/qmake
Here I tried the 3rd qmake, but it Exits with:
Project ERROR: Unknown module(s) in QT: qml quick
So I think I'll have to install missing packages here.
-
@Bodo A-HA! This is why I hate cross-compiling. It skips some packages I dunno why.
Or is it possible you have just built qtbase, not all qt?
Well, I can offer you to remove your currently-built qt builds, maybe restore your Jetson image, install dependencies again, and native-build whole qt. By this way, you can try if can Jetson run your application. Then you can cross-compile and stuff later if you want.wget "http://download.qt-project.org/official_releases/qt/5.12/5.12.3/single/qt-everywhere-src-5.12.3.tar.xz" //or choose the version you want from http://download.qt-project.org/official_releases/qt/ tar -xf qt-everywhere-src-5.12.3.tar.xz mkdir qtconf cd qtconf sudo apt-get build-dep qt5-default sudo apt-get install build-essential libx11-xcb-dev libglu1-mesa-dev ../qt-everywhere-src-5.12.3/configure -release -opensource -confirm-license -opengl es2 -nomake examples -nomake tests -skip qtwebengine -prefix /opt/Qt5.12.3 //I have skipt the module "qtwebengine" cuz it can be a lil-bit tricky some times. //Be sure that OpenGL ES 2.x .is detected after configuration. make -j4 //I remember as Jetson has Quad ARM Processor so you can run 4 threads with -j4 option. //If you dont wanna risk it, just use -j2. And it WILL take a while. Would leave it overnight. make install //qmake should be at.. /opt/Qt5.12.3/bin/qmake ..or so similar too that. You can run, /opt/Qt5.12.3/bin/qmake /path/to/project/someproject.pro
UPDATE: I have checked your guide again, it only compiles qtbase as I said. But you need other modules too. You can use what I wrote up here, or use the same guide with another git sources you can find from here to install qml and quick. But there is TOOOO MANY SOURCES to build qml.
-
@closx
Thanks, will have to read through all this.Basically I started off with qtbase and added up qtdeclarative and other packages later on (cross compile + sync back to target). This worked fine so far.
I did a compilation on the target platform and it generated a binary now.
But when I run it, I get this:QQmlApplicationEngine failed to load component qrc:/main.qml:6 module "QtGraphicalEffects" version 1.12 is not installed
Now I tried:
apt-file search 'qml/QtGraphicalEffects/qmldir' qml-module-qtgraphicaleffects: /usr/lib/aarch64-linux-gnu/qt5/qml/QtGraphicalEffects/qmldir
and added an Import path in my .pro file:
QML_IMPORT_PATH += /usr/lib/aarch64-linux-gnu/qt5/qml/QtGraphicalEffects
But still get the same result :/
-
The module "QtGraphicalEffects" is from the QML package. So, you have qml installed your system, at least theoretically, right?
@Bodo said in qmlglsink fails with EGL_BAD_CONTEXT or fails to retrieve wrapped context on creation on Jetson Tx1:
QML_IMPORT_PATH += /usr/lib/aarch64-linux-gnu/qt5/qml/QtGraphicalEffects
Which .pro file you insert this line? Your application's one?
-
@closx :
Back on the problem..We setup a fresh system and compiled Qt.
When running our testapp, it told me that module 'qmlglsink' is missing.
So I cloned the gst-plugins-bad branch 1.8.3 from the gstreamer repos and configure / maked it.
After some minor adjustments (proper PKG_CONFIG_PATH to /opt/Qt5.12.3/lib/pkgconfig and added c++11 standard to the make it build the plugins).Then I set the GST_PLUGIN_PATH to /usr/local/lib/gstreamer-1.0/ and gst-inspect now properly found the new qmlglsink module.
Now when running the test project I get this problem:
WARN glcontext gstglcontext.c:495:gst_gl_context_get_current_gl_context: Could not retrieve current context
ERROR qtglutility gstqtglutility.cc:158:gst_qt_get_gl_wrapcontext: cannot wrap qt OpenGL context (NULL)So obviously I do not get a proper context and have to investigate whats different to the x86 configuration.
Seems as some gst_element_factory_make is failing or something... -
Add:
This is happening while loading the qml file with the VideoItem:
engine.load(QUrl(QStringLiteral("qrc:/main.qml")));
Maybe the window isn't setup properly at this moment and the OpenGL Context does not exist yet?
I'll start a thread on this in the gstreamer devel mailing list too.
-
I've tried to make
qmlglsink
work onELG
to make use ofDMABuf
optimization (reduces copying fromvah264dec
toglupload
), but I got comment in#gstreamer
thatqmlglsink
probably just does not supportEGL
onX11
(xcb_egl
in Qt terms):[10:42] <ystreet00> Talkless: I don't believe that qmlglsink currently support x11-egl