media: add missing wait_prepare/finish ops
Subsystems (9)
cover media: add missing wait_prepare/finish ops
Without these ops the v4l2-compliance blocking wait test will fail. These ops are required to ensure that when VIDIOC_DQBUF has to wait for buffers to arrive, the queue lock is correctly released and retaken. Otherwise the wait for a buffer would block all other queue ioctls.
I would appreciate it if these patches can be tested.
I also updated v4l2-compliance so that it executes the blocking wait test even if the '-s' option was not specified. This should improve coverage since not everyone uses that option.
After this series is (hopefully) applied I plan to make changes to avoid the need to set these two ops, unless you need a custom implementation (omap3isp).
Regards,
Hans
Hans Verkuil (4):
media: atomisp: add missing wait_prepare/finish ops
media: omap3isp: add missing wait_prepare/finish ops
media: pisp_be: add missing wait_prepare/finish ops
media: venus: add missing wait_prepare/finish ops
drivers/media/platform/qcom/venus/vdec.c | 2 ++ drivers/media/platform/qcom/venus/venc.c | 2 ++ .../platform/raspberrypi/pisp_be/pisp_be.c | 2 ++ drivers/media/platform/ti/omap3isp/ispvideo.c | 18 ++++++++++++++++++ .../staging/media/atomisp/pci/atomisp_fops.c | 2 ++ 5 files changed, 26 insertions(+)
Signature · 1 line
2.43.0
PATCH 1/4 media: atomisp: add missing wait_prepare/finish ops
Without these ops the v4l2-compliance blocking wait test will fail. These ops are required to ensure that when VIDIOC_DQBUF has to wait for buffers to arrive, the queue lock is correctly released and retaken. Otherwise the wait for a buffer would block all other queue ioctls.
--- drivers/staging/media/atomisp/pci/atomisp_fops.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/staging/media/atomisp/pci/atomisp_fops.c +2 -0
@@ -441,6 +441,8 @@ const struct vb2_ops atomisp_vb2_ops = { .buf_queue = atomisp_buf_queue, .start_streaming = atomisp_start_streaming, .stop_streaming = atomisp_stop_streaming, + .wait_prepare = vb2_ops_wait_prepare, + .wait_finish = vb2_ops_wait_finish, };static void atomisp_dev_init_struct (struct atomisp_device *isp)
Signature · 1 line
2.43.0
Re: [PATCH 1/4] media: atomisp: add missing wait_prepare/finish ops
Hi Hans,
Quoted 8 lines · Hans Verkuil
Without these ops the v4l2-compliance blocking wait test will fail. These ops are required to ensure that when
VIDIOC_DQBUFhas to wait for buffers to arrive, the queue lock is correctly released and retaken. Otherwise the wait for a buffer would block all other queue ioctls.Signed-off-by Hans Verkuil <[email protected]>Cc Hans de Goede <[email protected]>
Thank you for this patch.
I have merged this in my media-atomisp branch:
https://git.kernel.org/pub/scm/linux/kernel/git/hansg/linux.git/log/?h=media-atomisp
I'll run some tests when I'm back home tonight (with access to atomisp2 hw) before included this in my upcoming atomisp pull-request for 6.12.
Regards,
Hans
Quoted 17 lines
--- drivers/staging/media/atomisp/pci/atomisp_fops.c | 2 ++ 1 file changed, 2 insertions(+)drivers/staging/media/atomisp/pci/atomisp_fops.c +2
-0@@ -441,6 +441,8 @@ const struct vb2_ops atomisp_vb2_ops = { .buf_queue = atomisp_buf_queue, .start_streaming = atomisp_start_streaming, .stop_streaming = atomisp_stop_streaming, + .wait_prepare = vb2_ops_wait_prepare, + .wait_finish = vb2_ops_wait_finish, };static void atomisp_dev_init_struct (struct atomisp_device *isp)
Re: [PATCH 1/4] media: atomisp: add missing wait_prepare/finish ops
Hi Hans,
Quoted 12 lines · Hans de Goede
Hi Hans,
Quoted 8 lines · Hans Verkuil
Without these ops the v4l2-compliance blocking wait test will fail. These ops are required to ensure that when
VIDIOC_DQBUFhas to wait for buffers to arrive, the queue lock is correctly released and retaken. Otherwise the wait for a buffer would block all other queue ioctls.Signed-off-by Hans Verkuil <[email protected]>Cc Hans de Goede <[email protected]>
Quoted 8 lines
Thank you for this patch.
I have merged this in my media-atomisp branch:
https://git.kernel.org/pub/scm/linux/kernel/git/hansg/linux.git/log/?h=media-atomispI'll run some tests when I'm back home tonight (with access to atomisp2 hw) before included this in my upcoming atomisp pull-request for 6.12.
Would you be able to post a PR today? We want to switch over to our new gitlab tree (https://gitlab.freedesktop.org/linux-media/media-staging), but we'd like to get all PRs for 6.12 merged first.
Regards,
Hans
Quoted 25 lines
Regards,
Hans
Quoted 17 lines
--- drivers/staging/media/atomisp/pci/atomisp_fops.c | 2 ++ 1 file changed, 2 insertions(+)drivers/staging/media/atomisp/pci/atomisp_fops.c +2
-0@@ -441,6 +441,8 @@ const struct vb2_ops atomisp_vb2_ops = { .buf_queue = atomisp_buf_queue, .start_streaming = atomisp_start_streaming, .stop_streaming = atomisp_stop_streaming, + .wait_prepare = vb2_ops_wait_prepare, + .wait_finish = vb2_ops_wait_finish, };static void atomisp_dev_init_struct (struct atomisp_device *isp)
Re: [PATCH 1/4] media: atomisp: add missing wait_prepare/finish ops
Hi,
Quoted 20 lines · Hans Verkuil
Hi Hans,
Quoted 17 lines · Hans de Goede
Hi Hans,
Quoted 8 lines · Hans Verkuil
Without these ops the v4l2-compliance blocking wait test will fail. These ops are required to ensure that when
VIDIOC_DQBUFhas to wait for buffers to arrive, the queue lock is correctly released and retaken. Otherwise the wait for a buffer would block all other queue ioctls.Signed-off-by Hans Verkuil <[email protected]>Cc Hans de Goede <[email protected]>Thank you for this patch.
I have merged this in my media-atomisp branch:
https://git.kernel.org/pub/scm/linux/kernel/git/hansg/linux.git/log/?h=media-atomisp
Quoted 7 lines
Quoted 3 lines
I'll run some tests when I'm back home tonight (with access to atomisp2 hw) before included this in my upcoming atomisp pull-request for 6.12.
Would you be able to post a PR today? We want to switch over to our new gitlab tree (https://gitlab.freedesktop.org/linux-media/media-staging), but we'd like to get all PRs for 6.12 merged first.
Yes I already reviewed + merged all the pending atomisp stuff yesterday.
I just need to merge your "media: staging: atomisp: set lock before calling vb2_queue_init()" and run a quick test and then I'll send out the PR today.
Regards,
Hans
PATCH 2/4 media: omap3isp: add missing wait_prepare/finish ops
In reply to Hans VerkuilWithout these ops the v4l2-compliance blocking wait test will fail. These ops are required to ensure that when VIDIOC_DQBUF has to wait for buffers to arrive, the queue lock is correctly released and retaken. Otherwise the wait for a buffer would block all other queue ioctls.
--- drivers/media/platform/ti/omap3isp/ispvideo.c | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+)
drivers/media/platform/ti/omap3isp/ispvideo.c +18 -0
@@ -480,11 +480,29 @@ static int isp_video_start_streaming(struct vb2_queue *queue,return 0 ; } +static void omap3isp_wait_prepare (struct vb2_queue *vq) +{ +struct isp_video_fh *vfh =vb2_get_drv_priv (vq); +struct isp_video *video = vfh->video; + +mutex_unlock (&video->queue_lock); +} + +static void omap3isp_wait_finish (struct vb2_queue *vq) +{ +struct isp_video_fh *vfh =vb2_get_drv_priv (vq); +struct isp_video *video = vfh->video; + +mutex_lock (&video->queue_lock); +} +static const struct vb2_ops isp_video_queue_ops = { .queue_setup = isp_video_queue_setup, .buf_prepare = isp_video_buffer_prepare, .buf_queue = isp_video_buffer_queue, .start_streaming = isp_video_start_streaming, + .wait_prepare = omap3isp_wait_prepare, + .wait_finish = omap3isp_wait_finish, };/*
Signature · 1 line
2.43.0
Re: [PATCH 2/4] media: omap3isp: add missing wait_prepare/finish ops
Quoted 9 lines · Hans Verkuil
Without these ops the v4l2-compliance blocking wait test will fail. These ops are required to ensure that when
VIDIOC_DQBUFhas to wait for buffers to arrive, the queue lock is correctly released and retaken. Otherwise the wait for a buffer would block all other queue ioctls.Signed-off-by Hans Verkuil <[email protected]>Cc Sakari Ailus <[email protected]>Cc Laurent Pinchart <[email protected]>
Signature · 1 line
Sakari Ailus
PATCH 3/4 media: pisp_be: add missing wait_prepare/finish ops
In reply to Hans VerkuilWithout these ops the v4l2-compliance blocking wait test will fail. These ops are required to ensure that when VIDIOC_DQBUF has to wait for buffers to arrive, the queue lock is correctly released and retaken. Otherwise the wait for a buffer would block all other queue ioctls.
--- drivers/media/platform/raspberrypi/pisp_be/pisp_be.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/media/platform/raspberrypi/pisp_be/pisp_be.c +2 -0
@@ -964,6 +964,8 @@ static const struct vb2_ops pispbe_node_queue_ops = { .buf_queue = pispbe_node_buffer_queue, .start_streaming = pispbe_node_start_streaming, .stop_streaming = pispbe_node_stop_streaming, + .wait_prepare = vb2_ops_wait_prepare, + .wait_finish = vb2_ops_wait_finish, };static const struct v4l2_file_operations pispbe_fops = {
Signature · 1 line
2.43.0
Re: [PATCH 3/4] media: pisp_be: add missing wait_prepare/finish ops
Hi Hans
Quoted 9 lines · Hans Verkuil
Without these ops the v4l2-compliance blocking wait test will fail. These ops are required to ensure that when
VIDIOC_DQBUFhas to wait for buffers to arrive, the queue lock is correctly released and retaken. Otherwise the wait for a buffer would block all other queue ioctls.Signed-off-by Hans Verkuil <[email protected]>Cc Jacopo Mondi <[email protected]>Cc Laurent Pinchart <[email protected]>
I can confirm it fixes a previously failing test
was:
fail: v4l2-test-buffers.cpp(3050): !thread_streamoff.done
fail: v4l2-test-buffers.cpp(3078): testBlockingDQBuf(node, q)
test blocking wait: FAILnow:
test blocking wait: OK
Quoted 21 lines
--- drivers/media/platform/raspberrypi/pisp_be/pisp_be.c | 2 ++ 1 file changed, 2 insertions(+)drivers/media/platform/raspberrypi/pisp_be/pisp_be.c +2
-1@@ -964,6 +964,8 @@ static const struct vb2_ops pispbe_node_queue_ops = { .buf_queue = pispbe_node_buffer_queue, .start_streaming = pispbe_node_start_streaming, .stop_streaming = pispbe_node_stop_streaming, + .wait_prepare = vb2_ops_wait_prepare, + .wait_finish = vb2_ops_wait_finish, };static const struct v4l2_file_operations pispbe_fops = { --2.43.0
PATCH 4/4 media: venus: add missing wait_prepare/finish ops
In reply to Hans VerkuilWithout these ops the v4l2-compliance blocking wait test will fail. These ops are required to ensure that when VIDIOC_DQBUF has to wait for buffers to arrive, the queue lock is correctly released and retaken. Otherwise the wait for a buffer would block all other queue ioctls.
--- drivers/media/platform/qcom/venus/vdec.c | 2 ++ drivers/media/platform/qcom/venus/venc.c | 2 ++ 2 files changed, 4 insertions(+)
drivers/media/platform/qcom/venus/vdec.c +2 -0
@@ -1390,6 +1390,8 @@ static const struct vb2_ops vdec_vb2_ops = { .buf_prepare = venus_helper_vb2_buf_prepare, .start_streaming = vdec_start_streaming, .stop_streaming = vdec_stop_streaming, + .wait_prepare = vb2_ops_wait_prepare, + .wait_finish = vb2_ops_wait_finish, .buf_queue = vdec_vb2_buf_queue, };
drivers/media/platform/qcom/venus/venc.c +2 -0
@@ -1319,6 +1319,8 @@ static const struct vb2_ops venc_vb2_ops = { .buf_prepare = venus_helper_vb2_buf_prepare, .start_streaming = venc_start_streaming, .stop_streaming = venus_helper_vb2_stop_streaming, + .wait_prepare = vb2_ops_wait_prepare, + .wait_finish = vb2_ops_wait_finish, .buf_queue = venc_vb2_buf_queue, };
Signature · 1 line
2.43.0
Re: [PATCH 4/4] media: venus: add missing wait_prepare/finish ops
Quoted 31 lines · Hans Verkuil
Without these ops the v4l2-compliance blocking wait test will fail. These ops are required to ensure that when
VIDIOC_DQBUFhas to wait for buffers to arrive, the queue lock is correctly released and retaken. Otherwise the wait for a buffer would block all other queue ioctls.Signed-off-by Hans Verkuil <[email protected]>Cc Stanimir Varbanov <[email protected]>--- drivers/media/platform/qcom/venus/vdec.c | 2 ++ drivers/media/platform/qcom/venus/venc.c | 2 ++ 2 files changed, 4 insertions(+)drivers/media/platform/qcom/venus/vdec.c +2
-0@@ -1390,6 +1390,8 @@ static const struct vb2_ops vdec_vb2_ops = { .buf_prepare = venus_helper_vb2_buf_prepare, .start_streaming = vdec_start_streaming, .stop_streaming = vdec_stop_streaming, + .wait_prepare = vb2_ops_wait_prepare, + .wait_finish = vb2_ops_wait_finish, .buf_queue = vdec_vb2_buf_queue, };drivers/media/platform/qcom/venus/venc.c +0
-0
drivers/media/platform/qcom/venus/venc.c static const struct vb2_ops venc_vb2_ops = { · line 1326
Quoted 8 lines
drivers/media/platform/qcom/venus/venc.c +2
-0@@ -1319,6 +1319,8 @@ static const struct vb2_ops venc_vb2_ops = { .buf_prepare = venus_helper_vb2_buf_prepare, .start_streaming = venc_start_streaming, .stop_streaming = venus_helper_vb2_stop_streaming, + .wait_prepare = vb2_ops_wait_prepare, + .wait_finish = vb2_ops_wait_finish, .buf_queue = venc_vb2_buf_queue, };