Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Receive signal from platform driver
QtWS25 Last Chance

Receive signal from platform driver

Scheduled Pinned Locked Moved Unsolved General and Desktop
12 Posts 3 Posters 750 Views
  • 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.
  • M Offline
    M Offline
    mrsinger61
    wrote on last edited by
    #1

    I have a custom platform driver (application -platform myplatform:args) that needs to emit a signal and that signal needs to call a slot in my main window (QDialog). How do I (or can I) connect that?

    Pablo J. RoginaP 1 Reply Last reply
    0
    • SGaistS Offline
      SGaistS Offline
      SGaist
      Lifetime Qt Champion
      wrote on last edited by
      #2

      Hi and welcome to devnet,

      Can you explain a bit more what you are doing with that custom platform plugin ?
      What do you need signal back up to your application ?

      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
      0
      • M Offline
        M Offline
        mrsinger61
        wrote on last edited by
        #3

        The custom platform plugin is based on linuxfb but draws into specific predefined memory buffers that get mmap'd in. After the drawing occurs and its time to flip buffers, the application needs to send a message to another processor to swap the buffers in the hardware. So I need to send a message to the app from the platform plugin that is needs to do that. The reason for this is that we dont want to have to include any special libraries to send the inter processor messages into the Qt build.

        1 Reply Last reply
        0
        • M Offline
          M Offline
          mrsinger61
          wrote on last edited by
          #4

          So my redraw in the plugin looks like:

          QRegion QXmixerScreen::doRedraw()
          {
          const QRegion dirty = QFbScreen::doRedraw();
          if (dirty.isEmpty()) {
          return dirty;
          }

          QXmixerLayer::Output *output(device->output(0));
          
          for (int i = 0; i < BUFFER_COUNT; ++i)
              output->dirty[i] += dirty;
          
          if (output->fb[output->backFb].wrapper.isNull()) {
              qDebug() << "wrapper is null";
              return dirty;
          }
          
          QPainter pntr(&output->fb[output->backFb].wrapper);
          // Image has alpha but no need for blending at this stage.
          // Do not waste time with the default SourceOver.
          pntr.setCompositionMode(QPainter::CompositionMode_Source);
          
          for (const QRect &rect : qAsConst(output->dirty[output->backFb]))
              pntr.drawImage(rect, mScreenImage, rect);
          pntr.end();
          
          output->dirty[output->backFb] = QRegion();
          
          Q_EMIT swap_buffers(device->layer, output->backFb);
          
          output->backFb = (output->backFb + 1) % BUFFER_COUNT;
          
          return dirty;
          

          }

          1 Reply Last reply
          0
          • SGaistS Offline
            SGaistS Offline
            SGaist
            Lifetime Qt Champion
            wrote on last edited by
            #5

            How do you communicate that information currently ?

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

            M 1 Reply Last reply
            0
            • SGaistS SGaist

              How do you communicate that information currently ?

              M Offline
              M Offline
              mrsinger61
              wrote on last edited by
              #6

              @SGaist I'm not currently sending that. New project. I suppose I could just use a linux message queue and have thread in the app that listens for it.

              M 1 Reply Last reply
              0
              • SGaistS Offline
                SGaistS Offline
                SGaist
                Lifetime Qt Champion
                wrote on last edited by
                #7

                Sorry, I meant how practically do you do that communication with that other "processor" you talked about earlier.

                On a side note, you do not need to build a custom version of Qt if you implement a custom plugin.

                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
                0
                • M mrsinger61

                  @SGaist I'm not currently sending that. New project. I suppose I could just use a linux message queue and have thread in the app that listens for it.

                  M Offline
                  M Offline
                  mrsinger61
                  wrote on last edited by
                  #8

                  @mrsinger61 The a shared memory based message queue built on libMetal. This is a Xilinx UltraScale and Qt is running on ab A54 and the video hardware is controlled by one of the R5 cores

                  1 Reply Last reply
                  0
                  • M mrsinger61

                    I have a custom platform driver (application -platform myplatform:args) that needs to emit a signal and that signal needs to call a slot in my main window (QDialog). How do I (or can I) connect that?

                    Pablo J. RoginaP Offline
                    Pablo J. RoginaP Offline
                    Pablo J. Rogina
                    wrote on last edited by
                    #9

                    @mrsinger61 said in Receive signal from platform driver:

                    that needs to emit a signal and that signal needs to call a slot in my main window (QDialog)

                    I imagine that the main window (QDialog) object has an instance of the "plugin" available (as a member of it or by some indirection, whatever) so I'd say you'll go as with any other signal & slot connection. Pseudocode:

                    MyMainWindowClass::someMethod() {
                    ...
                        connect(&myCustomPluginObject, &MyCustomPluginClass::theSignal, this, &MyMainWindowClass::slotToHandleCustomPluginSignal);
                    ...
                    }
                    

                    Upvote the answer(s) that helped you solve the issue
                    Use "Topic Tools" button to mark your post as Solved
                    Add screenshots via postimage.org
                    Don't ask support requests via chat/PM. Please use the forum so others can benefit from the solution in the future

                    1 Reply Last reply
                    0
                    • SGaistS Offline
                      SGaistS Offline
                      SGaist
                      Lifetime Qt Champion
                      wrote on last edited by
                      #10

                      Then I do not see why you would need your application to be responsible for that communication. It's really the place of the QPA plugin you are writing.

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

                      M 1 Reply Last reply
                      0
                      • SGaistS SGaist

                        Then I do not see why you would need your application to be responsible for that communication. It's really the place of the QPA plugin you are writing.

                        M Offline
                        M Offline
                        mrsinger61
                        wrote on last edited by
                        #11

                        @SGaist That was what I assumed, but how do I get the object of the platform plugin? The platform is given either on the command line or as an environment variable and QT magically instantiates it.

                        1 Reply Last reply
                        0
                        • SGaistS Offline
                          SGaistS Offline
                          SGaist
                          Lifetime Qt Champion
                          wrote on last edited by
                          #12

                          I am not sure about why you want that object now.

                          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
                          0

                          • Login

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