hi,
i want to use prgb driver to display video on lcd module.in my mind,i only need
fd = open("/sys/class/davinci_display/ch0/PRGB", O_RDWR);
and then like other display device such as composite,component :
fmt.type = V4L2_BUF_TYPE_VIDEO_OUTPUT; if (format == 0) { width += 15; width &= (~15); fmt.fmt.pix.pixelformat = V4L2_PIX_FMT_UYVY; } else { width += 31; width &= (~31); fmt.fmt.pix.bytesperline = width; fmt.fmt.pix.sizeimage = width * height * 1.5; fmt.fmt.pix.pixelformat = V4L2_PIX_FMT_NV12; } fmt.fmt.pix.height = height; fmt.fmt.pix.width = width; ret = ioctl(fd, VIDIOC_S_FMT, &fmt); if (ret) { perror("VIDIOC_S_FMT\n"); close(fd); exit(1); }
req.count = NUM_BUF; req.type = V4L2_BUF_TYPE_VIDEO_OUTPUT; req.memory = V4L2_MEMORY_USERPTR;
ret = ioctl(fd, VIDIOC_REQBUFS, &req); if (ret) { perror("cannot allocate memory\n"); close(fd); exit(1); }
crop.type = V4L2_BUF_TYPE_VIDEO_OUTPUT; crop.c.top = 0; crop.c.left = 0; crop.c.width= width; crop.c.height= height;
ret = ioctl(fd, VIDIOC_S_CROP, &crop); if (ret) { perror("VIDIOC_S_CROP\n"); close(fd); exit(0); } /* Enqueue buffers */ for (i = 0; i < req.count; i++) { memcpy(display_buffer[i].user_addr, in_buf, size); bzero(&buf, sizeof(struct v4l2_buffer)); buf.type = V4L2_BUF_TYPE_VIDEO_OUTPUT; buf.index = i; buf.memory = V4L2_MEMORY_USERPTR; buf.length = ALIGN(size, 4096); buf.m.userptr = display_buffer[i].user_addr; ret = ioctl(fd, VIDIOC_QBUF, &buf); //memset(buff_info[i].start,0xff,buff_info[i].length); if (ret) { perror("VIDIOC_QBUF\n"); close(fd); exit(1); } }
a = 0; ret = ioctl(fd, VIDIOC_STREAMON, &a); if (ret < 0) { perror("VIDIOC_STREAMON\n"); close(fd); exit(1); }
getchar(); ret = ioctl(fd, VIDIOC_STREAMOFF, &a); if (ret) { perror("VIDIOC_STREAMOFF\n"); close(fd); exit(1); } close(fd);
Am i right?any expert give me a light?
thanks