[meta-freescale] Enabling transparency on overlay surface
Jason Anderson
janderson at disti.com
Mon Nov 10 06:30:21 PST 2014
Hi Eric,
>Hi Jason,
>
>On 11/07/2014 12:11 PM, Jason Anderson wrote:
>> HI,
>>
>> I am working on an OpenGL ES application and trying to use /dev/fb1 as
>> an overlay on my i.MX6 (Boundary Devices BD-SL-i.MX6) . My current
>> image is Yocto 1.6 , 3.10.17 kernel.
>>
>> I have my app rendering my background to /dev/fb0 and my overlay to
>> /dev/fb1, but I can’t get fb1 transparency enabled. Does any have have
>> an example of how to use the overlay with OpenGL ES/EGL?
>>
>
>The fb1 transparency doesn't have anything to do with OpenGL,
>but is available using a set of custom ioctls on the frame-buffer
>device.
>
>In particular, look at MXCFB_SET_GBL_ALPHA and MXCFB_SET_CLR_KEY:
>
> https://github.com/boundarydevices/linux-imx6/blob/boundary-imx_3.10.17_1.0.2_ga/drivers/video/mxc/mxc_ipuv3_fb.c#L1029
>
>The MXCFB_SET_OVERLAY_POS ioctl is also very useful for placing
>fb1 on top of fb0.
Thanks for your response, I tried the following code and still not getting any transparency on the overlay:
#define MXCFB_SET_GBL_ALPHA _IOW('F', 0x21, struct mxcfb_gbl_alpha)
#define MXCFB_SET_CLR_KEY _IOW('F', 0x22, struct mxcfb_color_key)
struct mxcfb_gbl_alpha {
int enable;
int alpha;
};
struct mxcfb_color_key {
int enable;
unsigned int color_key;
};
void setFB() {
int fd_fb = open("/dev/fb1", O_RDWR, 0);
if (fd_fb < 0) {
printf("unable to open fb0\n");
return ;
}
struct mxcfb_gbl_alpha a;
a.enable = 1;
a.alpha = 0;
int err = ioctl(fd_fb,MXCFB_SET_GBL_ALPHA,&a);
if ( err ) {
perror( "MXCFB_SET_GBL_ALPHA");
return;
}
struct mxcfb_color_key c;
c.enable = 1;
c.color_key = 0x0;
err = ioctl(fd_fb,MXCFB_SET_CLR_KEY,&c);
if ( err ) {
perror( "MXCFB_SET_CLR_KEY");
return;
}
close (fd_fb);
}
I make sure to clear the frame buffers correctly when drawing to them. Am I missing something here? Are there any "gotchas" I should be looking out for. Also, does the video parameter in the bootargs for u-boot play any part in the availability in the alpha buffer for the fb device? I noticed the default u-boot script does not explicitly set bpp and uses RGB24 for hdmi output. Should I be setting this to bpp=32, is there any RGBA format?
Also, when I run cat /sys/class/graphics/f1/
Thanks again!
More information about the meta-freescale
mailing list