All of lore.kernel.org
 help / color / mirror / Atom feed
From: Ezequiel Garcia <ezequiel@collabora.com>
To: linux-media@vger.kernel.org
Cc: Hans Verkuil <hverkuil@xs4all.nl>,
	kernel@collabora.com, Abylay Ospan <aospan@netup.ru>,
	Ezequiel Garcia <ezequiel@collabora.com>
Subject: [PATCH 14/20] mx_emmaprp: Implement wait_prepare and wait_finish
Date: Fri, 18 May 2018 15:52:02 -0300	[thread overview]
Message-ID: <20180518185208.17722-15-ezequiel@collabora.com> (raw)
In-Reply-To: <20180518185208.17722-1-ezequiel@collabora.com>

This driver is currently specifying a video_device lock,
which means it is protecting all the ioctls (including
queue ioctls) with a single mutex.

It's therefore straightforward to implement wait_prepare
and wait_finish, by explicitly setting the vb2_queue lock.

Having these callbacks releases the queue lock while blocking,
which improves latency by allowing for example streamoff
or qbuf operations while waiting in dqbuf.

Signed-off-by: Ezequiel Garcia <ezequiel@collabora.com>
---
 drivers/media/platform/mx2_emmaprp.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/drivers/media/platform/mx2_emmaprp.c b/drivers/media/platform/mx2_emmaprp.c
index 5a8eff60e95f..7f9b356e7cc7 100644
--- a/drivers/media/platform/mx2_emmaprp.c
+++ b/drivers/media/platform/mx2_emmaprp.c
@@ -747,6 +747,8 @@ static const struct vb2_ops emmaprp_qops = {
 	.queue_setup	 = emmaprp_queue_setup,
 	.buf_prepare	 = emmaprp_buf_prepare,
 	.buf_queue	 = emmaprp_buf_queue,
+	.wait_prepare	 = vb2_ops_wait_prepare,
+	.wait_finish	 = vb2_ops_wait_finish,
 };
 
 static int queue_init(void *priv, struct vb2_queue *src_vq,
@@ -763,6 +765,7 @@ static int queue_init(void *priv, struct vb2_queue *src_vq,
 	src_vq->mem_ops = &vb2_dma_contig_memops;
 	src_vq->timestamp_flags = V4L2_BUF_FLAG_TIMESTAMP_COPY;
 	src_vq->dev = ctx->dev->v4l2_dev.dev;
+	src_vq->lock = &ctx->dev->dev_mutex;
 
 	ret = vb2_queue_init(src_vq);
 	if (ret)
@@ -776,6 +779,7 @@ static int queue_init(void *priv, struct vb2_queue *src_vq,
 	dst_vq->mem_ops = &vb2_dma_contig_memops;
 	dst_vq->timestamp_flags = V4L2_BUF_FLAG_TIMESTAMP_COPY;
 	dst_vq->dev = ctx->dev->v4l2_dev.dev;
+	dst_vq->lock = &ctx->dev->dev_mutex;
 
 	return vb2_queue_init(dst_vq);
 }
-- 
2.16.3

  parent reply	other threads:[~2018-05-18 18:54 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-05-18 18:51 [RFC PATCH v2 00/20] v4l2 core: push ioctl lock down to ioctl handler Ezequiel Garcia
2018-05-18 18:51 ` [PATCH 01/20] pvrusb2: replace pvr2_v4l2_ioctl by video_ioctl2 Ezequiel Garcia
2018-05-18 18:51 ` [PATCH 02/20] v4l2-core: push taking ioctl mutex down to ioctl handler Ezequiel Garcia
2018-05-18 18:51 ` [PATCH 03/20] v4l2-ioctl.c: use correct vb2_queue lock for m2m devices Ezequiel Garcia
2018-05-18 18:51 ` [PATCH 04/20] usbtv: Implement wait_prepare and wait_finish Ezequiel Garcia
2018-05-18 18:51 ` [PATCH 05/20] sta2x11: Add video_device and vb2_queue locks Ezequiel Garcia
2018-05-18 18:51 ` [PATCH 06/20] omap4iss: " Ezequiel Garcia
2018-05-22  9:09   ` Hans Verkuil
2018-05-23 21:33     ` Ezequiel Garcia
2018-05-18 18:51 ` [PATCH 07/20] omap3isp: " Ezequiel Garcia
2018-05-18 18:51 ` [PATCH 08/20] mtk-mdp: Add locks for capture and output vb2_queues Ezequiel Garcia
2018-05-18 18:51 ` [PATCH 09/20] s5p-g2d: Implement wait_prepare and wait_finish Ezequiel Garcia
2018-05-18 18:51 ` [PATCH 10/20] staging: bcm2835-camera: Provide lock for vb2_queue Ezequiel Garcia
2018-05-18 18:51 ` [PATCH 11/20] dvb-core: " Ezequiel Garcia
2018-05-18 18:52 ` [PATCH 12/20] venus: Add video_device and vb2_queue locks Ezequiel Garcia
2018-05-18 18:52 ` [PATCH 13/20] davinci_vpfe: " Ezequiel Garcia
2018-05-18 18:52 ` Ezequiel Garcia [this message]
2018-05-18 18:52 ` [PATCH 15/20] m2m-deinterlace: Implement wait_prepare and wait_finish Ezequiel Garcia
2018-05-18 18:52 ` [PATCH 16/20] stk1160: Set the vb2_queue lock before calling vb2_queue_init Ezequiel Garcia
2018-05-18 18:52 ` [PATCH 17/20] videobuf2-core: require q->lock Ezequiel Garcia
2018-05-18 18:52 ` [PATCH 18/20] videobuf2: assume q->lock is always set Ezequiel Garcia
2018-05-18 18:52 ` [PATCH 19/20] v4l2-ioctl.c: assume queue->lock " Ezequiel Garcia
2018-05-18 18:52 ` [PATCH 20/20] media: Remove wait_{prepare, finish} Ezequiel Garcia
2018-05-24 20:35 [PATCH v3 00/20] v4l2 core: push ioctl lock down to ioctl handler Ezequiel Garcia
2018-05-24 20:35 ` [PATCH 14/20] mx_emmaprp: Implement wait_prepare and wait_finish Ezequiel Garcia

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20180518185208.17722-15-ezequiel@collabora.com \
    --to=ezequiel@collabora.com \
    --cc=aospan@netup.ru \
    --cc=hverkuil@xs4all.nl \
    --cc=kernel@collabora.com \
    --cc=linux-media@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.