diff mbox

[PATCHv8,13/26] v4l: vivi: support for dmabuf importing

Message ID 1344958496-9373-14-git-send-email-t.stanislaws@samsung.com
State New
Headers show

Commit Message

Tomasz Stanislawski Aug. 14, 2012, 3:34 p.m. UTC
This patch enhances VIVI driver with a support for importing a buffer
from DMABUF file descriptors.

Signed-off-by: Tomasz Stanislawski <t.stanislaws@samsung.com>
Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com>
---
 drivers/media/video/Kconfig |    1 +
 drivers/media/video/vivi.c  |    2 +-
 2 files changed, 2 insertions(+), 1 deletion(-)

Comments

Hans Verkuil Aug. 22, 2012, 10:56 a.m. UTC | #1
On Tue August 14 2012 17:34:43 Tomasz Stanislawski wrote:
> This patch enhances VIVI driver with a support for importing a buffer
> from DMABUF file descriptors.

Thanks for adding DMABUF support to vivi.

What would be great is if DMABUF support is also added to mem2mem_testdev.
It would make an excellent test case to take the vivi output, pass it
through mem2mem_testdev, and finally output the image using the gpu, all
using dmabuf.

It's also very useful for application developers to test dmabuf support
without requiring special hardware (other than a dmabuf-enabled gpu
driver).

Regards,

	Hans

> 
> Signed-off-by: Tomasz Stanislawski <t.stanislaws@samsung.com>
> Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com>
> ---
>  drivers/media/video/Kconfig |    1 +
>  drivers/media/video/vivi.c  |    2 +-
>  2 files changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/media/video/Kconfig b/drivers/media/video/Kconfig
> index 966954d..8fa81be 100644
> --- a/drivers/media/video/Kconfig
> +++ b/drivers/media/video/Kconfig
> @@ -653,6 +653,7 @@ config VIDEO_VIVI
>  	depends on FRAMEBUFFER_CONSOLE || STI_CONSOLE
>  	select FONT_8x16
>  	select VIDEOBUF2_VMALLOC
> +	select DMA_SHARED_BUFFER
>  	default n
>  	---help---
>  	  Enables a virtual video driver. This device shows a color bar
> diff --git a/drivers/media/video/vivi.c b/drivers/media/video/vivi.c
> index a6351c4..37d8fd4 100644
> --- a/drivers/media/video/vivi.c
> +++ b/drivers/media/video/vivi.c
> @@ -1308,7 +1308,7 @@ static int __init vivi_create_instance(int inst)
>  	q = &dev->vb_vidq;
>  	memset(q, 0, sizeof(dev->vb_vidq));
>  	q->type = V4L2_BUF_TYPE_VIDEO_CAPTURE;
> -	q->io_modes = VB2_MMAP | VB2_USERPTR | VB2_READ;
> +	q->io_modes = VB2_MMAP | VB2_USERPTR | VB2_DMABUF | VB2_READ;
>  	q->drv_priv = dev;
>  	q->buf_struct_size = sizeof(struct vivi_buffer);
>  	q->ops = &vivi_video_qops;
>
Laurent Pinchart Aug. 22, 2012, 11:03 a.m. UTC | #2
Hi Hans,

On Wednesday 22 August 2012 12:56:30 Hans Verkuil wrote:
> On Tue August 14 2012 17:34:43 Tomasz Stanislawski wrote:
> > This patch enhances VIVI driver with a support for importing a buffer
> > from DMABUF file descriptors.
> 
> Thanks for adding DMABUF support to vivi.
> 
> What would be great is if DMABUF support is also added to mem2mem_testdev.
> It would make an excellent test case to take the vivi output, pass it
> through mem2mem_testdev, and finally output the image using the gpu, all
> using dmabuf.
> 
> It's also very useful for application developers to test dmabuf support
> without requiring special hardware (other than a dmabuf-enabled gpu
> driver).

One important missing feature is support for exporting GPU buffers as dmabuf 
file descriptors in the userspace APIs. I'm not sure where that would plug in 
the graphics stack, but we probably need at least a Linux-specific OpenGL 
extension for that. I've heard from Rob Clark that work was ongoing in that 
direction. I believe that  
https://wiki.linaro.org/OfficeofCTO/MemoryManagement?action=AttachFile&do=get&target=linux-
video.pdf is also related.
Hans Verkuil Aug. 22, 2012, 11:47 a.m. UTC | #3
On Wed August 22 2012 12:56:30 Hans Verkuil wrote:
> On Tue August 14 2012 17:34:43 Tomasz Stanislawski wrote:
> > This patch enhances VIVI driver with a support for importing a buffer
> > from DMABUF file descriptors.
> 
> Thanks for adding DMABUF support to vivi.
> 
> What would be great is if DMABUF support is also added to mem2mem_testdev.
> It would make an excellent test case to take the vivi output, pass it
> through mem2mem_testdev, and finally output the image using the gpu, all
> using dmabuf.
> 
> It's also very useful for application developers to test dmabuf support
> without requiring special hardware (other than a dmabuf-enabled gpu
> driver).

Adding VIDIOC_EXPBUF support to vivi and mem2mem_testdev would be
welcome as well for the same reasons.

Regards,

	Hans

> 
> Regards,
> 
> 	Hans
> 
> > 
> > Signed-off-by: Tomasz Stanislawski <t.stanislaws@samsung.com>
> > Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com>
> > ---
> >  drivers/media/video/Kconfig |    1 +
> >  drivers/media/video/vivi.c  |    2 +-
> >  2 files changed, 2 insertions(+), 1 deletion(-)
> > 
> > diff --git a/drivers/media/video/Kconfig b/drivers/media/video/Kconfig
> > index 966954d..8fa81be 100644
> > --- a/drivers/media/video/Kconfig
> > +++ b/drivers/media/video/Kconfig
> > @@ -653,6 +653,7 @@ config VIDEO_VIVI
> >  	depends on FRAMEBUFFER_CONSOLE || STI_CONSOLE
> >  	select FONT_8x16
> >  	select VIDEOBUF2_VMALLOC
> > +	select DMA_SHARED_BUFFER
> >  	default n
> >  	---help---
> >  	  Enables a virtual video driver. This device shows a color bar
> > diff --git a/drivers/media/video/vivi.c b/drivers/media/video/vivi.c
> > index a6351c4..37d8fd4 100644
> > --- a/drivers/media/video/vivi.c
> > +++ b/drivers/media/video/vivi.c
> > @@ -1308,7 +1308,7 @@ static int __init vivi_create_instance(int inst)
> >  	q = &dev->vb_vidq;
> >  	memset(q, 0, sizeof(dev->vb_vidq));
> >  	q->type = V4L2_BUF_TYPE_VIDEO_CAPTURE;
> > -	q->io_modes = VB2_MMAP | VB2_USERPTR | VB2_READ;
> > +	q->io_modes = VB2_MMAP | VB2_USERPTR | VB2_DMABUF | VB2_READ;
> >  	q->drv_priv = dev;
> >  	q->buf_struct_size = sizeof(struct vivi_buffer);
> >  	q->ops = &vivi_video_qops;
> > 
> --
> To unsubscribe from this list: send the line "unsubscribe linux-media" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
>
Tomasz Stanislawski Sept. 25, 2012, 2:41 p.m. UTC | #4
On 08/22/2012 01:47 PM, Hans Verkuil wrote:
> On Wed August 22 2012 12:56:30 Hans Verkuil wrote:
>> On Tue August 14 2012 17:34:43 Tomasz Stanislawski wrote:
>>> This patch enhances VIVI driver with a support for importing a buffer
>>> from DMABUF file descriptors.
>>
>> Thanks for adding DMABUF support to vivi.
>>
>> What would be great is if DMABUF support is also added to mem2mem_testdev.
>> It would make an excellent test case to take the vivi output, pass it
>> through mem2mem_testdev, and finally output the image using the gpu, all
>> using dmabuf.
>>
>> It's also very useful for application developers to test dmabuf support
>> without requiring special hardware (other than a dmabuf-enabled gpu
>> driver).
> 
> Adding VIDIOC_EXPBUF support to vivi and mem2mem_testdev would be
> welcome as well for the same reasons.
> 
> Regards,
> 
> 	Hans
> 

Hi Hans,

Adding DMABUF exporting to vmalloc is not easy as it seams.
Exporting introduces a new level of complexity and code bloat to a framework.
I mean support for:
- NULL devices as DMABUF exporters
- vmalloc to sglist conversions
- calling dma_map_sg for importers
- cache management

I admit that most of the work should be delegated to dmabuf framework.
I propose to postpone support for dmabuf exporting in vmalloc until
vb2-dmabuf gets merged.

Regards,
Tomasz Stanislawski


>>
>> Regards,
>>
>> 	Hans
>>
>>>
>>> Signed-off-by: Tomasz Stanislawski <t.stanislaws@samsung.com>
>>> Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com>
>>> ---
>>>  drivers/media/video/Kconfig |    1 +
>>>  drivers/media/video/vivi.c  |    2 +-
>>>  2 files changed, 2 insertions(+), 1 deletion(-)
>>>
>>> diff --git a/drivers/media/video/Kconfig b/drivers/media/video/Kconfig
>>> index 966954d..8fa81be 100644
>>> --- a/drivers/media/video/Kconfig
>>> +++ b/drivers/media/video/Kconfig
>>> @@ -653,6 +653,7 @@ config VIDEO_VIVI
>>>  	depends on FRAMEBUFFER_CONSOLE || STI_CONSOLE
>>>  	select FONT_8x16
>>>  	select VIDEOBUF2_VMALLOC
>>> +	select DMA_SHARED_BUFFER
>>>  	default n
>>>  	---help---
>>>  	  Enables a virtual video driver. This device shows a color bar
>>> diff --git a/drivers/media/video/vivi.c b/drivers/media/video/vivi.c
>>> index a6351c4..37d8fd4 100644
>>> --- a/drivers/media/video/vivi.c
>>> +++ b/drivers/media/video/vivi.c
>>> @@ -1308,7 +1308,7 @@ static int __init vivi_create_instance(int inst)
>>>  	q = &dev->vb_vidq;
>>>  	memset(q, 0, sizeof(dev->vb_vidq));
>>>  	q->type = V4L2_BUF_TYPE_VIDEO_CAPTURE;
>>> -	q->io_modes = VB2_MMAP | VB2_USERPTR | VB2_READ;
>>> +	q->io_modes = VB2_MMAP | VB2_USERPTR | VB2_DMABUF | VB2_READ;
>>>  	q->drv_priv = dev;
>>>  	q->buf_struct_size = sizeof(struct vivi_buffer);
>>>  	q->ops = &vivi_video_qops;
>>>
>> --
>> To unsubscribe from this list: send the line "unsubscribe linux-media" in
>> the body of a message to majordomo@vger.kernel.org
>> More majordomo info at  http://vger.kernel.org/majordomo-info.html
>>
diff mbox

Patch

diff --git a/drivers/media/video/Kconfig b/drivers/media/video/Kconfig
index 966954d..8fa81be 100644
--- a/drivers/media/video/Kconfig
+++ b/drivers/media/video/Kconfig
@@ -653,6 +653,7 @@  config VIDEO_VIVI
 	depends on FRAMEBUFFER_CONSOLE || STI_CONSOLE
 	select FONT_8x16
 	select VIDEOBUF2_VMALLOC
+	select DMA_SHARED_BUFFER
 	default n
 	---help---
 	  Enables a virtual video driver. This device shows a color bar
diff --git a/drivers/media/video/vivi.c b/drivers/media/video/vivi.c
index a6351c4..37d8fd4 100644
--- a/drivers/media/video/vivi.c
+++ b/drivers/media/video/vivi.c
@@ -1308,7 +1308,7 @@  static int __init vivi_create_instance(int inst)
 	q = &dev->vb_vidq;
 	memset(q, 0, sizeof(dev->vb_vidq));
 	q->type = V4L2_BUF_TYPE_VIDEO_CAPTURE;
-	q->io_modes = VB2_MMAP | VB2_USERPTR | VB2_READ;
+	q->io_modes = VB2_MMAP | VB2_USERPTR | VB2_DMABUF | VB2_READ;
 	q->drv_priv = dev;
 	q->buf_struct_size = sizeof(struct vivi_buffer);
 	q->ops = &vivi_video_qops;