IMX6. Start of Qt5 application causes flicker and tearing of camera preview on background framebuffer

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

IMX6. Start of Qt5 application causes flicker and tearing of camera preview on background framebuffer

4,817 Views
maximkuk
Contributor III

Hello!

I use Freescale sabresd board with imx6q. My goal is to run camera preview as early as possible, so I modifyed mxc_v4l2_capture driver to start overlay task right after load and find camera. After that, when kernel completly loaded, I start GUI - qt5 application on fb0 (camera preview already running on fb1). I use eglfs plugin. The problem is that fb1 begins tearing when qt application starts. Can I force qt to use vsync of fb1? Or there are any other solution? 

And another problem: fb0 have short one-time flicker when qt app starts (but fb0 set to fully transparent by default and it should not appear on top of fb1 until global alpha is disabled, right? I turn on local alpha blending on Component.onCompleted() signal of QML window). How can I start GUI more smoothy?

If there is a way to not flicker on GUI start, I can simply stop overlay task and run camera preview by gstreamer itself or qml from user space.

I attached video of my device booting. First appears camera preview on fb1 - no tearing, then one-time flicker, fb1 begin tearing, then appears test qml scene - background should be transparent, but it black in first time.

Labels (4)
0 Kudos
10 Replies

3,744 Views
yyuan
Contributor III

hi

 please  how do you output qt above video?

thank you

0 Kudos

3,744 Views
maximkuk
Contributor III

Hello!

I draw qt to fb0 with local alpha turned-on and show video on fb1 by gstreamer or v4l2 video overlay.

Or you may configure QtMultimedia and use QCamera in qt scene.

0 Kudos

3,743 Views
yyuan
Contributor III

please again

if do like you say,   i want to know how to store fused qt   and  video together,   So whether the combined qt and video can not be saved?

do you know ?

thank you very much again

0 Kudos

3,744 Views
maximkuk
Contributor III

you can draw qt to some buffer and combine it with video by gstreamer. Or show video by qt and grab content of framebuffer.

0 Kudos

3,744 Views
yyuan
Contributor III

thank you

I don't quite understand, i must thank it over.

thank you very much

0 Kudos

3,744 Views
yyuan
Contributor III

thank you

i will try

thank you 

0 Kudos

3,744 Views
igorpadykov
NXP Employee
NXP Employee

Hi Maxim

what bsp used in the case, please try official Demo Images on link

i.MX Software|NXP 

Best regards
igor
-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------

0 Kudos

3,744 Views
maximkuk
Contributor III

Hello! I have run test image from youre link (kernel 4.9.11, imx6q-sabresd.dtb, qt5-validation-imx-fb rootsf) with hdmi to not corrapt it by my configurations.

When I start Qt5_CinematicExperience it fills screen black, and after short time app screen appears. in console it prints: libpng warning: "iCCP: known incorrect sRGB profile"

When I start my test Qt application it fills screen black, and after short time app screen appears. No errors in console.

environment variables QT_QPA_EGLFS_PHYSICAL_WIDTH and QT_QPA_EGLFS_PHYSICAL_HEIGHT set to real screen size, QT_QPA_EGLFS_FB=/dev/fb2, FB_MULTI_BUFFER=2 (setting FB_MULTI_BUFFER to greater values not changing situation, if set it to 1 screen will freeze on first frame)

framebuffer settins:

root@imx6qpdlsolox:~# fbset -fb /dev/fb2

mode "1920x1080-60"
# D: 148.500 MHz, H: 67.500 kHz, V: 60.000 Hz
geometry 1920 1080 1920 4320 16
timings 6734 148 88 36 4 44 5
hsync high
vsync high
rgba 5/11,6/5,5/0,0/0
endmode

How to not filling screen black before QML scene will be shown?

0 Kudos

3,744 Views
maximkuk
Contributor III

Hello! Thank you for reply!

I use yocto BSP from fsl-arm-yocto-bsp.git, linux kernel 4.9.11.

I will try Demo Images and report the result.

May this issuses be caused by incorrect fb or display configuration? My display is SVGA050 800x600 and I add its configurations to device tree and mxc_lcdif driver:

mxc_lcdif.c:

{

/* 800x600 @ 60 Hz , pixel clk @ 24MHz */
"SVGA050", 60, 800, 600, 41666, 1, 7, 10, 10, 60, 2,
0,
FB_VMODE_NONINTERLACED,
0,}

device-tree:

&mxcfb1 {
 disp_dev = "lcd";
 interface_pix_fmt = "RGB24";
 default_bpp = <32>;
 mode_str ="SVGA050";
 late_init = <0>;
status = "okay";
};

lcd@0 {
compatible = "fsl,lcd";
ipu_id = <0>;
disp_id = <0>;
default_ifmt = "RGB24";
pinctrl-names = "default";
pinctrl-0 = <&pinctrl_ipu1>;
status = "okay";
};

0 Kudos

3,744 Views
maximkuk
Contributor III

Tearing of camera preview begins after any framebuffer configuration, not Qt application itself. To avoid it, we can add MXCFB_WAIT_FOR_VSYNC ioctl before ipu_queue_task() in function csi_buf_work_func() in ipu_fg_overlay_sdc.c, but it redueces framerate. May be I can add MXCFB_WAIT_FOR_VSYNC in other place, somewear in framebuffer configuration.

But how can I avoid flicker on GUI start?

0 Kudos