Hi Ivan,

I'm working with an A20 and trying to get fb1 overlay over fb0 and following 
your steps below, however can't get alpha blending to work, instead fb0 shows 
on screen0 and fb1 shows on screen1
Here is the steps I am following for configuring fb1

1. Framebuffer mode is set to screen1 and set mode to 
DISP_LAYER_WORK_MODE_NORMAL (I've also tried other fb modes like 
FB_MODE_DUAL_DIFF_SCREEN_SAME_CONTENTS)
2. Request the framebuffer for screen1 using DISP_CMD_FB_REQUEST
3. Open fb1 for reading/writing fbfd = open("/dev/fb1",O_RDWR);
4. Get the layer id for fb1 ioctl(fbfd, FBIOGET_LAYER_HDL_1, &layer_id);
5. Map the framebuffer device to memory fbp = (char*)mmap(0, finfo.smem_len, 
PROT_READ | PROT_WRITE, MAP_SHARED, fbfd, 0);
6. For screen1 I turn off global alpha and and set global alpha value to 0 
using DISP_CMD_LAYER_ALPHA_OFF and DISP_CMD_LAYER_SET_ALPHA_VALUE
7. For screen1 I set the layer to pipe1 using DISP_CMD_LAYER_SET_PIPE
8. For screen 1 I set the layer to top using DISP_CMD_LAYER_TOP
9. I then get the layer parameters to make sure everything looks ok using 
DISP_CMD_LAYER_GET_PARA
10. Then draw a blue rectangle and a red rectangle on fb1 with alpha set to 127 
(half transparency)
11. draw a green rectangle on fb0 (alpha 255) whose edges would overlap the 
edges of the other rectangles drawn in step 10
12.  wait for 10 seconds
13. release the framebuffer fb1 using DISP_CMD_FB_RELEASE before ending 
program.  (if I don't do this I noticed the layer handle keeps incrementing and 
will eventually crash if the program is run again and saw this documented 
somewhere as a bug)
Result:  If I view screen1 I see the blue and red rectangles but not the green 
rectangle drawn on fb0.  If I view screen0 I can see the green rectangle drawn 
on fb0 but not the rectangles on fb1

Any suggestions on what I am missing?  Is it possible that scalar mode is 
turned on for fb1?  I'm not sure how to check or disable scalar mode.  

Best regards,
Bart





On Wednesday, June 25, 2014 8:50:27 AM UTC-7, Ivan Kozic wrote:
> Hi,
> 
> Transparency layer is in fact fb layer (it's already open and init once you 
> start the system). In contrast, V4L2 layer is opened and initialized in your 
> application.
> 
> In order for everything to work there are a few things you'd need to do (this 
> is for fb0 - for fb1 everything is the same, just with /dev/fb1 and 
> FBIOGET_LAYER_HDL_1):
> 1. You need to set the fex file not to use scaler - fb0_scaler_mode_enable = 
> 0. Also set fb0_format = 10 (this is ARGB8888 format which you need for alpha 
> blending to work).
> 2. The fb layer is using PIPE 0 by default, so for alpha blender to work 
> properly, you need to set the V4L2 layer to use PIPE 1.
> 3. You need to set the global alpha enable for V4L2 layer to 1 and set the 
> global alpha value to 0xff (I did all this with DISP_CMD_LAYER_SET_PARA when 
> opening the layer).
> 4. Move the V4L2 layer to the top (DISP_CMD_LAYER_TOP).
> 5. Get the file descriptor for framebuffer (fb_fd = open("/dev/fb0", 
> O_RDWR);) and fill the complete layer with zeros (malloc a WxHx4 memory 
> chunk, memset it to 0x00 and write the chunk to file descriptor).
> 6. Get the fb layer handle (FBIOGET_LAYER_HDL_0) and move the fb layer to the 
> top (DISP_CMD_LAYER_TOP). Now fb layer is on top with V4L2 layer just under 
> it.
> 7. Turn off global alpha for fb layer (DISP_CMD_LAYER_ALPHA_OFF).
> 8. Set the global alpha value for fb layer to 0x00 
> (DISP_CMD_LAYER_SET_ALPHA_VALUE).
> 
> This is basically all you need to do. If testing with Mali, you could run 
> mali_drv/test/test and a triangle should appear just over the video. You can 
> also edit test.c and put opacity to 0.5, making the triangle 50% transparent.
> For testing without Mali, you can just allocate a memory chunk (fill it with 
> let's say 0x80 - this is light gray, 50% transparent) and write it to fb 
> layer file descriptor - you will get a light gray overlay over the video.
> 
> On Monday, June 23, 2014 8:43:32 AM UTC+2, ryangh...@gmail.com wrote:Hello 
> Sir.
> I have a similar problem, but I'm using the A10 allwinner.
> Can you explain about how to get the transparency layer above video(v4l2) 
> layer?
> Kind Regards,
> Ryang.

-- 
You received this message because you are subscribed to the Google Groups 
"linux-sunxi" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to linux-sunxi+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to