alpha blending between fb1 and fb0 on iMX6

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

alpha blending between fb1 and fb0 on iMX6

4,252 Views
andreit
Contributor I

Hello everyone,

I have video output on fb1 (using g-streamer's mfw_isink) and GUI on fb0  and I am trying to blend them together.

Video takes part of the screen. I use  MXCFB_SET_LOC_ALPHA on fb1 to set the transparency of the video portion to 117.

The rest of the fb1 frame is fully transparent (0).

Since video portion of fb1 is not solid I can see part of the GUI drawn on fb0. Corresponding video pane of fb0 consists of solid background color (dark orchard) and small stripe containing some video info.  I need to see video info and I don't need to see background color.

I tried to set color key MXCFB_SET_CLR_KEY on fb1 to filter out dark orchard but it doesn't seem have any effect.

Is it doable at all ? Or my approach is wrong ?

PS. Color key works fine if I use mfw_v4lsink which I think sends video to /dev/video17, but I need to use mfw_isink because it allows me to send the same video to LCD and HDMI.

CPU: iMX6Q,  Kernel:  3.10.17

Any help will be appreciated.

Andrei

0 Kudos
7 Replies

2,496 Views
reuelhaavrahami
Contributor III

Hi

Perhaps a late reply, but for those interested...

The MXCFB_SET_CLR_KEY and MXCFB_SET_GBL_ALPHA ioctls should be applied to the overlay buffer. When working with X11 fb0 would be your gui and video on videoxx. when working with framebuffers you should output the gui on fb1. Then you can apply the alpha blending and color key values to fb1.

We have this working...

0 Kudos

2,496 Views
yyuan
Contributor III

hello

please  can you  tell me how to do it  like you say?  i don`t understand it all.

now   i can putout qt to fb1,but it is small,   putout video to video17,but it is  discontinuity

i don`t know  how to do.   i think my board is X11,so   i shoule do like your second?

thank you 

0 Kudos

2,496 Views
reuelhaavrahami
Contributor III

Hi

It sounds like things are working since you have a gui, although small, on video17. You should seemingly play with QT settings.

We have long ago switched to framebuffer system instead of x11. However you might need to set the following (change according to your system) parameters for QT to output the GUI to the correct size.

export QT_QPA_EGLFS_FB="/dev/fb1"
export FB_FRAMEBUFFER_0=/dev/fb1
export QT_QPA_EGLFS_WIDTH=800
export QT_QPA_EGLFS_HEIGHT=480
export QT_QPA_EGLFS_PHYSICAL_WIDTH=108.0
export QT_QPA_EGLFS_PHYSICAL_HEIGHT=64.8
export FB_MULTI_BUFFER=2

Like is said, change the values to fit your solution.

you can change the MXCFB_SET_CLR_KEY and MXCFB_SET_GBL_ALPHA settings with calls from your application like this:

int fb4 = 0;
fb4 = open("/dev/fb4",O_RDWR);
alpha.enable = 1;
alpha.alpha = 0;
if (ioctl(fb4, MXCFB_SET_GBL_ALPHA, &alpha) < 0) {
//print some error
}

key.color_key = 38912;
key.enable = 1;

if(ioctl(fb4, MXCFB_SET_CLR_KEY, &key)< 0) {
//print some error
}
close(fb4);

0 Kudos

2,496 Views
yyuan
Contributor III

first  

thank you

i try you say,  

export QT_QPA_EGLFS_FB="/dev/fb1"
export FB_FRAMEBUFFER_0=/dev/fb1
export QT_QPA_EGLFS_WIDTH=800
export QT_QPA_EGLFS_HEIGHT=480
export QT_QPA_EGLFS_PHYSICAL_WIDTH=108.0
export QT_QPA_EGLFS_PHYSICAL_HEIGHT=64.8
export FB_MULTI_BUFFER=2

it is no change after setting, i think i must have someing wrong, it doesn`t seem to work after i set it up.

i try change the MXCFB_SET_CLR_KEY and MXCFB_SET_GBL_ALPHA 

now  gui is on fb0(bg),  video is on fb1(fg),

i set the MXCFB_SET_CLR_KEY and MXCFB_SET_GBL_ALPHA  of fb0 and fb 1,     I set them up separately

but the video is still blocking gui (qt)

video is by gstreamer.   i think  it is correlation with gstreamer

but i don`t how to salve it

please give me some suggestion again?

thank you again

0 Kudos

2,496 Views
reuelhaavrahami
Contributor III

Hi

I suppose you have some "background" in your GUI set to a certain color value where you want to see the video. You should know what the color value is (as seen by the overlay hardware) and then use this value in your MXCFB_SET_CLR_KEY (key.color_key = ) or MXCFB_SET_GBL_ALPHA (alpha.alpha =) value. Note: We used RGB 227, 227, 227 in QT and a value of 38912 in the MXCFB_SET_CLR_KEY. To this day I don't understand how to calculate the RGB to the value needed in hardware. Perhaps NXP can shed light on this...

You should use the ioctl commands on the GUI framebuffer. and also the environment variables should be on the GUI framebuffer thus you should be using

export QT_QPA_EGLFS_FB="/dev/fb0"
export FB_FRAMEBUFFER_0=/dev/fb0

when your GUI is on fb0.

Note: For each framebuffer /dev/fb_ there is a /dev/video_. for example we had /dev/fb0 that is the same as /dev/video16. (This depends on how you setup your system). You should use the /dev/video_ value that corresponds to /dev/fb1 in gstreamer for the video.

 

0 Kudos

2,496 Views
yyuan
Contributor III

thank you very much

i used to put video in video0,gui put fb1 ,it is ok, but gui `s size is small and i don`t know how to storage the gui and video together.

i will try you said ,   thank you very much.

thank you very much.

0 Kudos

2,496 Views
Yuri
NXP Employee
NXP Employee

Hello,

  Please check  mfw_isink configuration, using section Appendix A (mfw_isink Usage) of
"i.MX_6_Series_Yocto_Project_Multimedia_User's_Guide.pdf" in BSP documentation.


Have a great day,
Yuri

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

0 Kudos