Sharing buffers between devices
Sharing buffers between devices
Posted Aug 26, 2011 14:37 UTC (Fri) by slashdot (guest, #22014)Parent article: Sharing buffers between devices
If the issue is accessibility via restricted DMA, then add some way to mmap ZONE_DMA or similar memory.
If the issue is physical contiguity, add support to mmap contiguous memory.
If the issue is synchronous IO, make the APIs asynchronous.
Posted Sep 10, 2011 2:53 UTC (Sat)
by smowton (guest, #57076)
[Link]
I *think* splice() should be able to accomplish the same feats as this patchset providing both ends can provide an FD that adequately represents what we want to do with the buffer; e.g. in the case that we're piping network packets to a video device, the video driver needs to be able to provide an FD representing the target video buffer, pixel format, etc, so something like:
// fd is a socket
In the language of this patchset the network driver would provide an ioctl that yields a buffer FD, and the video driver would provide one that copies buffer data into specified video memory.
int bufferfd;
Basically a splice()-based approach would need more ioctls in order to establish something that looks like a "connection endpoint" that means what we want it to, but mean less FD table operations if we want to repeatedly perform a similar operation (likely?), whilst an ioctl() + fd-per-buffer approach means lots of fd table operations (efficient locks in the table?) but less syscalls if we're routing buffers in a way that would effectively compel a splice operation to create a new channel per operation.
Sharing buffers between devices
int fd2 = ioctl(video_control_fd, IOCTL_GET_SINK_FD, /* description of sink buffer */);
splice(fd, fd2, ...);
int fd = ioctl(socket_or_if_control_fd, IOCTL_GET_PACKET_BUFFER, &bufferfd);
ioctl(video_control_fd, IOCTL_COPY_BUFFER_TO_VMEM, fd2, /* buffer description */);
