i want to display the YUV(4:2:0)picture on the LCD.
i do in the following ways:
#include <linux/fb.h>
#include <asm-arm/arch-omap/omapfb.h>
setup_fb(int width, int height)
{
int fb = open("/dev/fb0", O_RDWR);
if (fb == -1)
{
perror("/dev/fb0");
exit(1);
}
if (ioctl(fb, FBIOGET_VSCREENINFO, &sinfo_p0) == -1)
{
perror("FBIOGET_VSCREENINFO");
exit(1);
}
if (ioctl(fb, OMAPFB_QUERY_PLANE, &pinfo) == -1)
{
perror("OMAPFB_QUERY_PLANE");
exit(1);
}
if (ioctl(fb, OMAPFB_QUERY_MEM, &minfo) == -1)
{
perror("OMAPFB_QUERY_MEM");
exit(1);
}
sinfo.xres = FFMIN(sinfo_p0.xres, width) & ~15;
sinfo.yres = FFMIN(sinfo_p0.xres, height) & ~15;
sinfo.nonstd = OMAPFB_COLOR_YUV420;
if (ioctl(fb, FBIOPUT_VSCREENINFO, &sinfo) == -1)
{
perror("FBIOPUT_VSCREENINFO");
exit(1);
}
pinfo.enabled = 1;
pinfo.pos_x = sinfo_p0.xres / 2 - sinfo.xres / 2;
pinfo.pos_y = sinfo_p0.yres / 2 - sinfo.yres / 2;
pinfo.out_width = sinfo.xres;
pinfo.out_height = sinfo.yres;
if (ioctl(fb, OMAPFB_SETUP_PLANE, &pinfo) == -1)
{
perror("OMAPFB_SETUP_PLANE");
exit(1);
}
return fb;
}
in the main function:
{
fb = setup_fb(320,240);
fbmem = mmap(NULL, minfo.size, PROT_READ|PROT_WRITE, MAP_SHARED, fb, 0);
then we read the display YUV to fbmem.
}
then it display the "OMAPFB_QUERY_MEM invalid argument"
can anybody tell me the reason
|