Receive signal from platform driver
-
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?
-
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 ? -
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.
-
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;
}
-
How do you communicate that information currently ?
-
@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.
-
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.
-
@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.
@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
-
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?
@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); ... }
-
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.
-
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.
@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.
-
I am not sure about why you want that object now.