Re: [PATCH v8 12/13] [media] v4l: Add V4L2_CAP_FENCES to drivers

2018-03-14 Thread Hans Verkuil
On 03/09/2018 09:49 AM, Gustavo Padovan wrote:
> From: Gustavo Padovan 
> 
> Drivers that use videobuf2 are capable of using fences and
> should report that to userspace.
> 
> The coding style is following what each drivers was already
> doing.

I think this can be simplified for most drivers: you can set this
flag in the v4l_querycap function if vdev->queue is not NULL or if
m2m_ctx is set in struct v4l2_fh.

I believe all non-m2m drivers that use vb2 set vdev->queue. But not
all m2m drivers will set m2m_ctx, so that will need to be checked.

In other words, this way you only need to modify m2m drivers that
do not set m2m_ctx.

Regards,

Hans


[PATCH v8 12/13] [media] v4l: Add V4L2_CAP_FENCES to drivers

2018-03-09 Thread Gustavo Padovan
From: Gustavo Padovan 

Drivers that use videobuf2 are capable of using fences and
should report that to userspace.

The coding style is following what each drivers was already
doing.

Signed-off-by: Gustavo Padovan 
---
 drivers/media/pci/cobalt/cobalt-v4l2.c | 3 ++-
 drivers/media/pci/cx23885/cx23885-417.c| 2 +-
 drivers/media/pci/cx23885/cx23885-video.c  | 3 ++-
 drivers/media/pci/cx88/cx88-video.c| 3 ++-
 drivers/media/pci/dt3155/dt3155.c  | 2 +-
 drivers/media/pci/saa7134/saa7134-video.c  | 2 ++
 drivers/media/pci/solo6x10/solo6x10-v4l2-enc.c | 3 ++-
 drivers/media/pci/solo6x10/solo6x10-v4l2.c | 3 ++-
 drivers/media/pci/sta2x11/sta2x11_vip.c| 2 +-
 drivers/media/pci/tw68/tw68-video.c| 3 ++-
 drivers/media/pci/tw686x/tw686x-video.c| 2 +-
 drivers/media/platform/am437x/am437x-vpfe.c| 2 +-
 drivers/media/platform/blackfin/bfin_capture.c | 3 ++-
 drivers/media/platform/coda/coda-common.c  | 3 ++-
 drivers/media/platform/davinci/vpbe_display.c  | 3 ++-
 drivers/media/platform/davinci/vpfe_capture.c  | 3 ++-
 drivers/media/platform/davinci/vpif_capture.c  | 3 ++-
 drivers/media/platform/davinci/vpif_display.c  | 3 ++-
 drivers/media/platform/exynos-gsc/gsc-m2m.c| 3 ++-
 drivers/media/platform/exynos4-is/fimc-capture.c   | 3 ++-
 drivers/media/platform/exynos4-is/fimc-isp-video.c | 3 ++-
 drivers/media/platform/exynos4-is/fimc-lite.c  | 2 +-
 drivers/media/platform/exynos4-is/fimc-m2m.c   | 3 ++-
 drivers/media/platform/m2m-deinterlace.c   | 3 ++-
 drivers/media/platform/marvell-ccic/mcam-core.c| 2 +-
 drivers/media/platform/mx2_emmaprp.c   | 3 ++-
 drivers/media/platform/omap3isp/ispvideo.c | 2 +-
 drivers/media/platform/pxa_camera.c| 3 ++-
 drivers/media/platform/rcar_jpu.c  | 3 ++-
 drivers/media/platform/s3c-camif/camif-capture.c   | 3 ++-
 drivers/media/platform/s5p-g2d/g2d.c   | 3 ++-
 drivers/media/platform/s5p-jpeg/jpeg-core.c| 3 ++-
 drivers/media/platform/s5p-mfc/s5p_mfc_dec.c   | 3 ++-
 drivers/media/platform/s5p-mfc/s5p_mfc_enc.c   | 3 ++-
 drivers/media/platform/sh_veu.c| 3 ++-
 drivers/media/platform/sh_vou.c| 2 +-
 drivers/media/platform/sti/bdisp/bdisp-v4l2.c  | 3 ++-
 drivers/media/platform/ti-vpe/cal.c| 2 +-
 drivers/media/platform/ti-vpe/vpe.c| 3 ++-
 drivers/media/platform/vim2m.c | 3 ++-
 drivers/media/platform/vivid/vivid-core.c  | 2 +-
 drivers/media/platform/vsp1/vsp1_histo.c   | 2 +-
 drivers/media/platform/vsp1/vsp1_video.c   | 2 +-
 drivers/media/platform/xilinx/xilinx-dma.c | 2 +-
 drivers/media/usb/airspy/airspy.c  | 2 +-
 drivers/media/usb/au0828/au0828-video.c| 3 ++-
 drivers/media/usb/em28xx/em28xx-video.c| 1 +
 drivers/media/usb/go7007/go7007-v4l2.c | 2 +-
 drivers/media/usb/hackrf/hackrf.c  | 3 ++-
 drivers/media/usb/msi2500/msi2500.c| 2 +-
 drivers/media/usb/pwc/pwc-v4l.c| 2 +-
 drivers/media/usb/s2255/s2255drv.c | 2 +-
 drivers/media/usb/stk1160/stk1160-v4l.c| 3 ++-
 drivers/media/usb/usbtv/usbtv-video.c  | 3 ++-
 drivers/media/usb/uvc/uvc_driver.c | 1 +
 55 files changed, 89 insertions(+), 52 deletions(-)

diff --git a/drivers/media/pci/cobalt/cobalt-v4l2.c 
b/drivers/media/pci/cobalt/cobalt-v4l2.c
index 6b6611a0e190..ef1014b5d4a7 100644
--- a/drivers/media/pci/cobalt/cobalt-v4l2.c
+++ b/drivers/media/pci/cobalt/cobalt-v4l2.c
@@ -484,7 +484,8 @@ static int cobalt_querycap(struct file *file, void *priv_fh,
strlcpy(vcap->card, "cobalt", sizeof(vcap->card));
snprintf(vcap->bus_info, sizeof(vcap->bus_info),
 "PCIe:%s", pci_name(cobalt->pci_dev));
-   vcap->device_caps = V4L2_CAP_STREAMING | V4L2_CAP_READWRITE;
+   vcap->device_caps = V4L2_CAP_STREAMING | V4L2_CAP_READWRITE |
+   V4L2_CAP_FENCES;
if (s->is_output)
vcap->device_caps |= V4L2_CAP_VIDEO_OUTPUT;
else
diff --git a/drivers/media/pci/cx23885/cx23885-417.c 
b/drivers/media/pci/cx23885/cx23885-417.c
index a71f3c7569ce..56bf7ec4e25f 100644
--- a/drivers/media/pci/cx23885/cx23885-417.c
+++ b/drivers/media/pci/cx23885/cx23885-417.c
@@ -1334,7 +1334,7 @@ static int vidioc_querycap(struct file *file, void  *priv,
sizeof(cap->card));
sprintf(cap->bus_info, "PCIe:%s", pci_name(dev->pci));
cap->device_caps = V4L2_CAP_VIDEO_CAPTURE | V4L2_CAP_READWRITE |
-  V4L2_CAP_STREAMING;
+  V4L2_CAP_STREAMING | V4L2_CAP_FENCES;
if (dev->tuner_type != TUNER_ABSENT)