[Linaro-mm-sig] [PATCH 05/10] v4l: add buffer exporting via dmabuf
t.stanislaws at samsung.com
Mon Jan 23 15:56:20 UTC 2012
On 01/23/2012 04:04 PM, Mauro Carvalho Chehab wrote:
> Em 23-01-2012 12:42, Tomasz Stanislawski escreveu:
>> Hi Mauro.
>> On 01/23/2012 03:32 PM, Mauro Carvalho Chehab wrote:
>>> Em 23-01-2012 11:51, Tomasz Stanislawski escreveu:
>>>> This patch adds extension to V4L2 api. It allow to export a mmap buffer as file
>>>> descriptor. New ioctl VIDIOC_EXPBUF is added. It takes a buffer offset used by
>>>> mmap and return a file descriptor on success.
>>> This requires more discussions.
>>> The usecase for this new API seems to replace the features previously provided
>>> by the overlay mode. There, not only the buffer were exposed to userspace, but
>>> some control were provided, in order to control the overlay window.
>> This ioctl was introduced to support exporting of V4L2 buffers via dma-buf interface. This framework was little common with overlay mode. Could you describe what overlay mode feature is replaced by VIDIOC_EXPBUF?
> The V4L2 API doesn't just export "raw" buffers. It provides a logic to control
> the streams, with includes buffer settings, buffer queue/dequeue, buffer meta-data
> (like timestamps), etc.
The DMABUF buffers are handled by vb2-core. It provides control for
queuing and passing streaming and metadata management (like timestamps)
to the driver.
> I would expect to see something similar for the dma buffers.
Those features may be introduced to dma-buf. As I understand
queue/dequeue refers to passing ownership between a CPU and a driver. It
is handled in vb2-core. Passing buffer between multiple APIs like V4L2
and DRM will be probably handled in the userspace. Currently the dma-buf
provides only the mechanism for mapping the same memory by multiple devices.
> With regards to the overlay mode, this is the old way to export DMA buffers between
> a video capture driver and a graphics adapter driver. A dma-buf interface will
> superseed the video overlay mode, as it will provide more features. Yet, care
> should be taken when writing the userspace interface, in order to be sure that all
> features needed will be provided there.
The s5p-tv and s5p-fimc do not have support for OVERLAY mode. As I know
vb2-core has no support for the mode, either. What kind of features
present in OVERLAYS are needed in dmabuf? Note that dmabuf do not have
be used only for buffers with video data.
>>> Please start a separate thread about that, explaining how are you imagining that
>>> a V4L2 application would use such ioctl.
I will post a simple application that does buffer sharing between two
V4L2 devices (camera and TV output).
>> This patch is essential for full implementation of support for DMABUF framework in V4L2. Therefore the patch cannot be moved to separate thread.
> I'm not proposing to move the patch to a separate thread. All I'm saying
> is that the API extensions for dmabuf requires its own separate discussions.
I agree. However DMA patches plays important role in this PoC patchset
so I decided to keep patches to together. Moreover I wanted this code to
I prefer to have a good reason for adding extension before proposing it
on the mailing list. The DMA buffer sharing seams to be a right reason
for adding dma_get_pages but comments for V4L2/Linaro people is needed.
> I couldn't guess, just from your patches, what ioctl's a V4L2 application
> like tvtime or xawtv would use the DMABUF.
DMABUF is dedicated for application that use streaming between at least
two devices. Especially if those devices are controlled by different
APIs, like DRM and V4L2. It would be probably used in the middle-ware
like gstreamer or OpenMAX.
More information about the Linaro-mm-sig