black screen flicker after starting QT linux application? - qt

I used embedded linux (imx6q) with eglfs.
Framebuffer is drawing black screen while starting Qt application.
Simple application is black for 1sec under. Heavy application is for 4~5sec.
This happens only once when first QT run.
How to prevent qt from drawing to black? I can modify kernel or QT sources.
i am looking for qt and kernel source (related framebuffer blank, switch mode).
but, i have no idea. help me.
I already posted it on the qt forum, but there is no response.
Additional edits>
I think it only happens where using Linux framebuffer.
And it seems that the QT framework takes time to load the first one-time QML modules into the system.
After that, It use cached ones, so I wonder if there is flickr for a very short period of time.
The unavoidable loading time is fine.
But I want to prevent the QT system from erasing the framebuffer in black.

Related

Qt: Switching 'virtual desktops' on linux makes the multimediawidgets/videographicsitem example, stop displaying the video

If you've got the Qt 5.12.8 (the version that ships with Ubuntu 20.04) examples installed + built, start playing a video with it, switch virtual desktops and the video stops (you can't hear it). Come back, and the widget is white, in some sense it forgot the video. The example's 'brother', multimediawidgets/videowidget, works as you'd expect: start playing a video, go to another virtual desktop, you can hear it still playing, come back, and it's carried on as you'd expect. Interestingly, if you first pause the video in the videographicsitem example, do the switch-and-back, the video correctly still shows and is resumable when you come back, so, it's just if you switch while playing. I presume it's a bug - can anyone think of a workaround? Thanks.
edit: This is the same for Qt 5.15.2, the latest Qt 5.x as I write. As for Qt 6.2.x (latest as I write), it didn't have that example - I've read that totally new versions of Qt take a while to get the multimedia stuff.

Turn on GPS when App starts in QT

So I was working on a positioning app which needs GPS to be turned on. So I wanted a way to automatically turn on GPS in the background, if even possible with high accuracy or atleast have a popup window come up so the user can turn on the GPS right away. But sadly I couldn't find a single way to do so in QT, if there is a solution it's always written in Java. Can I somehow do it in QT too or import Java code in it?
Would I also be able to keep my GPS updates running in the background? Because as soon as I press the home button the updates stop to come up in the console with qDebug... or is it just the qDebug function that can't run when the app is not open?
Will I be able to use GPS in my Qt app?
First, check if the target platform has GPS and/or capable of resolving geo-coordinates. Next check the manual out: Qt Location. Mind that they refer to this functionality as 'location' so it maybe partially available even without actual GPS unit on device if there is another provider type (I guess partially and not for all platforms). I could only find this list of platforms supported:
Qt Location Classes for accessing GPS and other location services and
for mapping and navigation. Split off from the Qt 4 Mobility module of
Qt Location. Supported on Android, BlackBerry, iOS, Linux (using
GeoClue), Windows and Sailfish OS.
As for starting the GPS (location services provider) there is such entry for QML for sure called start() of PositionSource. It also implies one can find the same functionality in C++ as well.
Would I also be able to keep my GPS updates running in the background? Because as soon as I press the home button the updates stop to come up in the console with qDebug... or is it just the qDebug function that can't run when the app is not open?
Home button: it implies Android? Unclear what you ask but the Android app lifecycle is a bit different matter than that. The GPS will be working independently of your app but will the app respond to messages is more determined by Android.

How to determine cause of DirectX 11 driver hang

I am working on a QT application for which I've integrated DirectX 11 into a custom widget. The application renders a scrolling display - a graphical representation of data being read from a file. The user can speed up and slow down the scrolling speed.
For the most part, this is working great. The DirectX 11 rendering is presented to my custom widget just as I'd expect. The problem is that the graphics driver randomly hangs and crashes my program. I say "random" because I have been testing this with the same data file and it never seems to crash at the same point in the file, after a specific amount of time, or at a specific scrolling speed (the faster the scrolling speed, the more work being done by the GPU per frame).
When the application hangs, my screen freezes for a moment, goes black, then returns with a nice message from NVidia that it has recovered from a driver crash. The Debug Output in Visual Studio contains the following:
D3D11: Removing Device.
D3D11 ERROR: ID3D11Device::RemoveDevice:
Device removal has been triggered for the following reason
(DXGI_ERROR_DEVICE_HUNG: The Device took an unreasonable amount of
time to execute its commands, or the hardware crashed/hung. As a
result, the TDR (Timeout Detection and Recovery) mechanism has been
triggered. The current Device Context was executing commands when the
hang occurred. The application may want to respawn and fallback to
less aggressive use of the display hardware). [ EXECUTION ERROR #378:
DEVICE_REMOVAL_PROCESS_AT_FAULT]
I have discovered that by simply commenting out the IDXGISwapChain1::Present call, the application will run through the file at blazing speed. Graphics-wise it is still pushing data to the GPU and drawing to render targets, it just never gets displayed to my window.
What I'm hoping for is help with ideas of what types of things cause driver hangs. My shaders are incredibly simple - basically just positioning my vertices using a projection matrix. And considering what I described in the above paragraph, shaders should still be cranking through vertices and pixels even when Present isn't being called, yes?
I was suspicious that this could be a compatibility issue with Qt - I know DirectX isn't officially supported by Qt. So I tried creating a separate window using CreateWindowEx and using that for my swap chain instead of the custom Qt widget. It rendered to that window but also hung the driver just like before.
I was also suspicious of a driver bug in my laptop, so I tried running the application on a beefier desktop PC that regularly runs another DirectX 11 application (non-Qt) without a hitch (worth mentioning that this other application renders similar data in a scrolling display as well, using shaders that are a lot more complex). But my QT application hangs the driver on that PC as well.
Anyone know of a way I can get a more detailed description of what is causing the driver to hang?
Thank you in advance for any help you can offer.
UPDATE: 2013-08-01 17:16 CST
I am currently investigating a possible thread syncing issue that may be the culprit. Will continue tomorrow morning and post if I solve this on my own.
After some testing today, it appears to have been a threading issue. I have run several times today with no graphics crash. So my problem must be fixed, unless I've just been getting lucky with my tests today (or unlucky, rather - if this shows its ugly face again in a day or two).
I was aware that the immediate device context is not thread safe. Rather than using deferred contexts, though, I was using critical sections to sync my threads and coordinate use of the device context. What I did not realize is that it is not safe to call IDXGISwapChain1::Present while another thread is using the device context. Makes sense, but since it is not call directly from the device context itself, I overlooked it. I literally moved my Present() call a few lines up into my critical section block, and it hasn't given me a crash since.

Qt Creator, Symbian - how to package multiple aplications?

Problem background:
I have a Qt/QML Symbian application targeting Qt 4.7.4, that requires a QML Camera component. The current state of Camera component has a serious performance bug, where once initialized, in order to overlay the camera view on the screen, it forces the whole application to "raster" graphics system. Even when the camera element is closed and destroyed the application remains in raster graphics system, and the whole app takes a large performance hit, rendering it almost unusable (scrolling lists, navigating through pages... ). The problem is gone only after the application is closed and restarted again, which is not really helpful.
As it appears this will not be resolved any time soon (it is marked as resolved only for some small subset of devices, which I doubt as I have a fairly high-end symbian device that suffers the same bug), I have to look into alternatives and workarounds.
One plausible workaround idea I have is to create a separate application, one whose only job is to capture the required image, process it and then closes. Currently I can do this by externally calling the native device camera application, but this is not a viable production solution. The main application would then start this second external application and wait for the result.
The question: is this possible with Qt creator? Packaging two different applications, and deploying them with a single deployment unit, such that the user does not have a complicated installation procedure?
I would have liked to solve this problem with QtCreator a few months ago but I failed. I managed to package two different applications into a single sis file by studying the pkg file format and creating a pkg file containing both applications.
It is worth examining the pkg files generated by QMake for each application and studying the pkg file format.
It is possible to get QMake to generate the desired pkg file. See the documentation of variable DEPLOYMENT, especially the part where pkg_postrules is discussed.
You can add your signed SIS file to another package with this line in PKG:
#"sub.sis",(0x20000002)

Qt performance when running executable outside of Qt Creator is awful!

I just tried running a program that I've been developing with Qt outside of Qt. I double clicked on the program in /release, resolve all the missing DLLs, and find that my app has awful slow performance compared to when it is launched from within Qt Creator. What might be the reason for this?!
Well, I have never encountered this. Is there any files you are loading in your application which is big enough to make the application load slow? Like reading a big flat file and get the contents out of it. If so, just make sure that the file's contents hasn't changed while you were running through Qt Creator and when you run it outside. It's my guess though. For me, the performances doesn't have much differences in either cases.

Resources