Query for inter-process buffer sharing

From: Jonghun Han <hidden>
Date: 2011-01-14 04:21:34

Hello, 

How do you think about adding a new callback function which makes allocator
for vb2 fill the reserved field in v4l2_buffer as below.
As-Is:  VIDIOC_QUERYBUF -> v4l2_m2m_querybuf -> vb2_querybuf ->
__fill_v4l2_buffer
To-Be: VIDIOC_QUERYBUF -> v4l2_m2m_querybuf -> vb2_querybuf ->
__fill_v4l2_buffer + vb2_mem_ops.fill_v4l2_buffer

I want to use the reserved field as for process unique key to share the
buffer between inter-process.
When I want to send a buffer which is allocated by A device to other
process, I want to get the process unique key from VIDIOC_QUERYBUF.
The process which gets the process unique key from other process will make
user virtual address from the key in any other way.
And then send it to B device using QBUF with USERPTR buffer type.

How do you think about this concept ?


      Process A
Process B

1. VIDIOC_QUERYBUF to get the process unique key 

2. VIDIOC_DQBUF

3. Send the process unique key to Process B
----------------------------------->    Process unique key

						                  4. Make a
user virtual address from the process unique key

                                                                       5.
VIDIOC_QBUF with user virtual address

                                                                       6.
find the paddr or device address from the user virtual addr. in videobuf2

                                                                       7.
H/W operation.

SCM_RIGHTS can be the solution for inter-process buffer sharing.
http://blog.toidinamai.de/en/programming/SCM_RIGHTS
But it has risk that other process can also control the device using the
shared file descriptor.
So I'm trying to make another solution.

Best regards,

Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help