Qt Forum

    • Login
    • Search
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Unsolved

    Unsolved qt5.5 Qt3D rendering & crash problems on Nvidia K1

    Mobile and Embedded
    qt5.5
    2
    4
    1128
    Loading More Posts
    • 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.
    • J
      jrecker last edited by

      Built a open source version of Qt5.5 on a nvidia K1 (see below for steps, running apps on Linux for Tegra Ubuntu desktop)

      Initially, all seems OK, and I can run qt3d examples. However, when I run the below toy app or a larger main app, I am seeing both random crashes && rendering issues. Note both below toy app and main app run fine on both Windows & Linux desktop with downloaded Qt5.5

      Crashes

      I've seen a few different crashes running qt5.5 QML apps with Qt3D components, which occur some random time into running the app and which appear memory related. The crashes typically occur in only a few different places. Unix free command doesn't suggest that the app is running out of memory.

      1. memory corruption crash in malloc after alloc call in QHashData::allocateNode()
      2. segfault on line 226 valueIt.value()->apply(ctx, uniform) in Qt3D::Render::RenderShader::updateUniforms() (Not exactly sure what is causing the crash here, presumably the address returned by value()?)
      3. segfault on line 343 if (*const_cast<QUniformValue *>(refValue) in Qt3D::Render::RenderView::sort() (class this pointer is invalid - unmapped virtual memory, and thus so is refValue, stack is corrupt).

      Rendering

      The rendering issue seen in the below app is that the torus does not rotate in the center of the window. Instead it is offset to the right. Furthermore stretching the width of the window renders a torus clipped against a vertical boundary inside the window, stretching the window vertically clips against a horizontal boundary within the window. None of these behaviors are seen on qt5.5 on Linux & Windows.

      Any suggestions as to any of the above issues?
      Anyone know if any of these issues are addressed in 5.6?

      thanks,

      John

      ------------ build qt5.5 ---------------------

      Build qt5.5

      git clone git://code.qt.io/qt/qt5.git; cd qt5; git checkout 5.5; perl init-repository --no-webkit
      ./configure -v -qpa xcb -no-eglfs -opengl desktop -prefix /opt/qt5-tegra-k1 -opensource -confirm-license -optimized-qmake -reduce-exports -debug -nomake tests -make examples -no-pch -no-icu -qt-xcb -skip qttools -no-kms -v 2>&1 | tee configure.log
      make && make install

      ------------ App ------------------------------

      main.cpp:

      #include <QGuiApplication>
      #include <QQmlApplicationEngine>

      int main(int argc, char *argv[])
      {
      QGuiApplication app(argc, argv);
      QQmlApplicationEngine engine;
      engine.load(QUrl(QStringLiteral("qrc:/main.qml")));
      return app.exec();
      }

      +++++++++++++++++

      main.qml:

      import QtQuick 2.1
      import QtQuick.Window 2.0
      import QtQuick.Scene3D 2.0

      Window {
      visible: true
      width: 512
      height: 512

      MouseArea {
          anchors.fill: parent
          onClicked: {
              Qt.quit();
          }
      }
      
      Item {
          id: scene
          width: Math.min(parent.width, parent.height) - 100
          height: width
          anchors.centerIn: parent
      
          Scene3D {
              anchors.fill: parent
              anchors.margins: 10
              focus: true
              aspects: "input"
      
              Donuts {}
          }
      }
      

      }

      +++++++++++++++++

      Donuts.qml

      import Qt3D 2.0
      import Qt3D.Renderer 2.0
      import QtQuick 2.1 as QQ2

      Entity {
      id: sceneRoot

      Camera {
          id: camera
          projectionType: CameraLens.PerspectiveProjection
          fieldOfView: 45
          nearPlane : 0.1
          farPlane : 1000.0
          position: Qt.vector3d( 0.0, 0.0, -40.0 )
          upVector: Qt.vector3d( 0.0, 1.0, 0.0 )
          viewCenter: Qt.vector3d( 0.0, 0.0, 0.0 )
      }
      
      components: [
          FrameGraph {
              activeFrameGraph: Viewport {
                  id: viewport
                  rect: Qt.rect(0.0, 0.0, 1.0, 1.0) // From Top Left
                  clearColor: Qt.rgba(0, 0, 0, 0)
      
                  CameraSelector {
                      id : cameraSelector
                      camera: camera
      
                      ClearBuffer {
                          buffers : ClearBuffer.ColorDepthBuffer
      
                      }
                  }
              }
          }
      ]
      
      PhongMaterial {
          id: material
      }
      
      TorusMesh {
          id: torusMesh
          radius: 2
          minorRadius: 1
          rings: 100
          slices: 20
      }
      
      property real rotationDuration: 5000
      
      Transform {
          id: torusTransform1
          Scale { scale3D: Qt.vector3d(1.5, 1.5, 0.5) }
          MatrixTransform {
              matrix: {
                  var m = mtmStream.qp_mtmstream_matrix;
                  return m;
              }
          }
          Rotate {
              id: torusRotation1
              angle: 45
              axis: Qt.vector3d(1, 0, 0)
          }
      }
      QQ2.NumberAnimation {
          target: torusRotation1
          property: "angle"
          duration: rotationDuration
          from: 45
          to: 405
      
          loops: QQ2.Animation.Infinite
          running: true
      }
      Entity {
          id: torusEntity1
          components: [ torusMesh, material, torusTransform1 ]
      }
      

      }

      1 Reply Last reply Reply Quote 0
      • SGaist
        SGaist Lifetime Qt Champion last edited by

        Hi and welcome to devnet,

        Since you're already building Qt, I'd recommend trying with 5.6. If it's still not working properly, you should check the bug report system to see if it's something known. If not, please consider opening a new report providing that sample.

        Interested in AI ? www.idiap.ch
        Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

        1 Reply Last reply Reply Quote 0
        • J
          jrecker last edited by

          Followup to the above to note that the Qt3D rendering anomaly I described above is related to the scheme I use for selecting the height/width of the target rendering item in main.qml, specifically the lines:

              width: Math.min(parent.width, parent.height) - 100
              height: width
              anchors.centerIn: parent
          

          Changing the magnitude of the border (eg "100") changes the center of rotation of the torus in the window, and a sufficiently large offset will cause the torus to be clipped un-equally about the center of rotation by the item borders. I believe this is incorrect behavior (at least my understanding is that the "anchors.centerIn: parent" line in the Item description should result in a item centered in the window and the view parameters should yield a torus centered in the item) , and behavior that changed between 5.5.0 & 5.5.1 (where I think the behavior was correct in 5.5.0)

          1 Reply Last reply Reply Quote 0
          • SGaist
            SGaist Lifetime Qt Champion last edited by

            Then I'd recommend checking the bug report system to see if it's something known. If not please consider opening a new report providing a minimal compilable example showing that behavior.

            Interested in AI ? www.idiap.ch
            Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

            1 Reply Last reply Reply Quote 0
            • First post
              Last post