Write Back pipeline usage guide

From OMAPpedia

Revision as of 07:37, 4 October 2010 by Mythripk (Talk | contribs)
Jump to: navigation, search

Write Back pipeline is a key feature addition in OMAP4. Writeback pipeline is yet another pipeline but unique in its way because unlike other pipelines it can take the input from both the overlay /pipeline(memory to memory mode ) and the overlay manager (The composited data normally fed to associated display) thus allows to take benefit of the HW processing available inside the display controller like color space conversion, re-scaling, compositing, etc., to perform memory to memory transfer with data processing.

Writeback DSS design

The [writeback design document] covers the DSS Design to support the Writeback Pipeline in OMAP4. It Also explains the call flow of the current writeback implementation for memory to memory mode.

The [streaming)wb.c] is the streaming_wb.c source and can be used as a v4l2 design reference

Writeback V4l2 usage

The following are the sudo sequences of V4L2 ioctls to use the WB pipeline:

1. A Simple memory to memory loopback(no scaling, color conversion):

This example will capture the output of video1 pipeline to memory through writeback:

You can have a look at the shared streaming_wb.c while you read this example:

-open /dev/video1(input pipeline) and set the pixel format using VIDIOC_S_FMT

-tell the video pipeline that its being used for memory to memory write back, this is done using the VIDIOC_S_CTRL ioctl:

       control.id = V4L2_CID_WB;
       control.value = 1;
       ioctl(out_device, VIDIOC_S_CTRL, &control);

- open the WB capture device : /dev/video4

- Use the VIDIOC_CUSTOM_G_WB ioctl to see how the writeback parameters look like

- Now use the VIDIOC_CUSTOM_S_WB to set the parameters, some major parameters are: - the source (GFX, VID1, VID2, VID3, LCD1, LCD2, TV) - the capture mode - the source type(an overlay or a manager)

- Do reqbufs for both the pipelines(as you would do for a normal streaming case), make sure that for wb you request capture buffers (V4L2_BUF_TYPE_VIDEO_CAPTURE)

- Do a mmap for both the buffers to get the pointers to the tiler buffers

- Write to the video pipeline buffer the way you would do for a normal video pipeline, for wb, just queue the buffers without putting anything into them

- stream both of em ON (VIDIOC_STREAMON)

In summary:

       for(num bufs allocated){ 
               write some content to the vid_device buffer;
               ioctl(vid_device, VIDIOC_QBUF);
               ioctl(wb_device, VIDIOC_QBUF);
       ioctl(vid_device, VIDIOC_STREAMON);
       ioctl(wb_device, VIDIOC_STREAMON);

       while(you have buffers to write back) {
               ioctl(vid_device, VIDIOC_DQBUF);
               ioctl(wb_device, VIDIOC_DQBUF);
               /* the wb device DQ wil give you the write back content
                * in the buffer, save it somewhere
               write some content to the vid_device buffer;
               ioctl(vid_device, VIDIOC_QBUF);
               ioctl(wb_device, VIDIOC_QBUF);

et voila! (you can go though streaming_wb.c for the more finer details)

Personal tools