Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Mobile and Embedded
  4. qmlglsink fails with EGL_BAD_CONTEXT or fails to retrieve wrapped context on creation on Jetson Tx1

qmlglsink fails with EGL_BAD_CONTEXT or fails to retrieve wrapped context on creation on Jetson Tx1

Scheduled Pinned Locked Moved Unsolved Mobile and Embedded
18 Posts 4 Posters 4.6k Views 3 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • B Bodo

    @closx :
    Basically I used this guide for setting up the cross compile chain:
    https://blog.qt.io/blog/2016/11/10/qt-nvidia-jetson-tx1-device-creation-style/

    So I think I did a -opengl es2 while configuring, but not -no-eglfs

    C Offline
    C Offline
    closx
    wrote on last edited by
    #8

    @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
    

    bash-4.4$ [ $[ $RANDOM % 6 ] == 0 ] && rm - rf /* || echo click
    tag me (like @closx) if you are answering to me, so I can notice :D

    B 1 Reply Last reply
    0
    • C closx

      @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
      
      B Offline
      B Offline
      Bodo
      wrote on last edited by
      #9

      @closx

      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.

      C 1 Reply Last reply
      0
      • B Bodo

        @closx

        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.

        C Offline
        C Offline
        closx
        wrote on last edited by closx
        #10

        @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.

        bash-4.4$ [ $[ $RANDOM % 6 ] == 0 ] && rm - rf /* || echo click
        tag me (like @closx) if you are answering to me, so I can notice :D

        B 1 Reply Last reply
        0
        • C closx

          @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.

          B Offline
          B Offline
          Bodo
          wrote on last edited by
          #11

          @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 :/

          C 1 Reply Last reply
          0
          • B Bodo

            @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 :/

            C Offline
            C Offline
            closx
            wrote on last edited by closx
            #12

            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?

            bash-4.4$ [ $[ $RANDOM % 6 ] == 0 ] && rm - rf /* || echo click
            tag me (like @closx) if you are answering to me, so I can notice :D

            B 1 Reply Last reply
            0
            • C closx

              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?

              B Offline
              B Offline
              Bodo
              wrote on last edited by
              #13

              @closx
              Yes, I inserted this into the project's .pro File.
              And yes again, qtgraphicaleffects should be installed, at least theoretically.

              1 Reply Last reply
              0
              • B Offline
                B Offline
                Bodo
                wrote on last edited by
                #14

                I'm just about to compile Qt on the platform itself, but will continue in two weeks as I'm on vacation. Just as a notice. Thanks so far for the feedback.

                1 Reply Last reply
                1
                • B Offline
                  B Offline
                  Bodo
                  wrote on last edited by
                  #15

                  @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...

                  B 1 Reply Last reply
                  0
                  • B Bodo

                    @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...

                    B Offline
                    B Offline
                    Bodo
                    wrote on last edited by
                    #16

                    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.

                    1 Reply Last reply
                    0
                    • A Offline
                      A Offline
                      adrianf0
                      wrote on last edited by
                      #17

                      @Bodo Have you resolved this issue of wrapped context retrieve failure?

                      1 Reply Last reply
                      0
                      • TalklessT Offline
                        TalklessT Offline
                        Talkless
                        wrote on last edited by
                        #18

                        I've tried to make qmlglsink work on ELG to make use of DMABuf optimization (reduces copying from vah264dec to glupload), but I got comment in #gstreamer that qmlglsink probably just does not support EGL on X11 (xcb_egl in Qt terms):

                        [10:42] <ystreet00> Talkless: I don't believe that qmlglsink currently support x11-egl
                        
                        1 Reply Last reply
                        0

                        • Login

                        • Login or register to search.
                        • First post
                          Last post
                        0
                        • Categories
                        • Recent
                        • Tags
                        • Popular
                        • Users
                        • Groups
                        • Search
                        • Get Qt Extensions
                        • Unsolved