mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Alexandre Courbot <acourbot@chromium.org>
To: Mauro Carvalho Chehab <mchehab@kernel.org>,
	Hans Verkuil <hverkuil@xs4all.nl>,
	Laurent Pinchart <laurent.pinchart@ideasonboard.com>,
	Pawel Osciak <posciak@chromium.org>,
	Marek Szyprowski <m.szyprowski@samsung.com>,
	Tomasz Figa <tfiga@chromium.org>,
	Sakari Ailus <sakari.ailus@linux.intel.com>,
	Gustavo Padovan <gustavo.padovan@collabora.com>
Cc: linux-media@vger.kernel.org, linux-kernel@vger.kernel.org,
	Alexandre Courbot <acourbot@chromium.org>
Subject: [RFC PATCH 9/9] media: vim2m: add request support
Date: Fri, 15 Dec 2017 16:56:25 +0900	[thread overview]
Message-ID: <20171215075625.27028-10-acourbot@chromium.org> (raw)
In-Reply-To: <20171215075625.27028-1-acourbot@chromium.org>

Set the necessary ops for supporting requests in vim2m.

Signed-off-by: Alexandre Courbot <acourbot@chromium.org>
---
 drivers/media/platform/vim2m.c | 22 ++++++++++++++++++++++
 1 file changed, 22 insertions(+)

diff --git a/drivers/media/platform/vim2m.c b/drivers/media/platform/vim2m.c
index a32e8a7950eb..ffe94ef9214d 100644
--- a/drivers/media/platform/vim2m.c
+++ b/drivers/media/platform/vim2m.c
@@ -30,6 +30,7 @@
 #include <media/v4l2-ctrls.h>
 #include <media/v4l2-event.h>
 #include <media/videobuf2-vmalloc.h>
+#include <media/media-request.h>
 
 MODULE_DESCRIPTION("Virtual device for mem2mem framework testing");
 MODULE_AUTHOR("Pawel Osciak, <pawel@osciak.com>");
@@ -142,6 +143,7 @@ struct vim2m_dev {
 	struct video_device	vfd;
 #ifdef CONFIG_MEDIA_CONTROLLER
 	struct media_device	mdev;
+	struct media_request_queue *req_queue;
 #endif
 
 	atomic_t		num_inst;
@@ -937,6 +939,11 @@ static int vim2m_open(struct file *file)
 		goto open_unlock;
 	}
 
+#ifdef CONFIG_MEDIA_CONTROLLER
+	v4l2_mem_ctx_request_init(ctx->fh.m2m_ctx, dev->req_queue,
+				  &dev->vfd.entity);
+#endif
+
 	v4l2_fh_add(&ctx->fh);
 	atomic_inc(&dev->num_inst);
 
@@ -992,6 +999,12 @@ static const struct v4l2_m2m_ops m2m_ops = {
 	.job_abort	= job_abort,
 };
 
+#ifdef CONFIG_MEDIA_CONTROLLER
+static const struct media_entity_operations vim2m_entity_ops = {
+	.process_request = v4l2_m2m_process_request,
+};
+#endif
+
 static int vim2m_probe(struct platform_device *pdev)
 {
 	struct vim2m_dev *dev;
@@ -1006,6 +1019,10 @@ static int vim2m_probe(struct platform_device *pdev)
 
 #ifdef CONFIG_MEDIA_CONTROLLER
 	dev->mdev.dev = &pdev->dev;
+	dev->req_queue = media_request_queue_generic_alloc(&dev->mdev);
+	if (IS_ERR(dev->req_queue))
+		return PTR_ERR(dev->req_queue);
+	dev->mdev.req_queue = dev->req_queue;
 	strlcpy(dev->mdev.model, "vim2m", sizeof(dev->mdev.model));
 	media_device_init(&dev->mdev);
 	dev->v4l2_dev.mdev = &dev->mdev;
@@ -1023,6 +1040,11 @@ static int vim2m_probe(struct platform_device *pdev)
 	vfd->lock = &dev->dev_mutex;
 	vfd->v4l2_dev = &dev->v4l2_dev;
 
+#ifdef CONFIG_MEDIA_CONTROLLER
+	vfd->entity.ops = &vim2m_entity_ops;
+	vfd->entity.req_ops = &media_entity_request_generic_ops;
+#endif
+
 	ret = video_register_device(vfd, VFL_TYPE_GRABBER, 0);
 	if (ret) {
 		v4l2_err(&dev->v4l2_dev, "Failed to register video device\n");
-- 
2.15.1.504.g5279b80103-goog

  parent reply	other threads:[~2017-12-15  7:57 UTC|newest]

Thread overview: 39+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-12-15  7:56 [RFC PATCH 0/9] media: base request API support Alexandre Courbot
2017-12-15  7:56 ` [RFC PATCH 1/9] media: add request API core and UAPI Alexandre Courbot
2017-12-15 10:37   ` Philippe Ombredanne
2018-01-12 10:16   ` Hans Verkuil
2018-01-26  8:39   ` Sakari Ailus
2018-01-30  4:23     ` Alexandre Courbot
2018-02-02  7:33       ` Sakari Ailus
2018-02-02  7:41         ` Tomasz Figa
2018-02-02  8:00         ` Hans Verkuil
2017-12-15  7:56 ` [RFC PATCH 2/9] media: request: add generic queue Alexandre Courbot
2017-12-15  7:56 ` [RFC PATCH 3/9] media: request: add generic entity ops Alexandre Courbot
2017-12-15  7:56 ` [RFC PATCH 4/9] videodev2.h: Add request field to v4l2_buffer Alexandre Courbot
2018-01-12 10:22   ` Hans Verkuil
2018-01-15  8:24     ` Alexandre Courbot
2017-12-15  7:56 ` [RFC PATCH 5/9] media: vb2: add support for requests Alexandre Courbot
2018-01-12 10:49   ` Hans Verkuil
2018-01-15  8:24     ` Alexandre Courbot
2018-01-15  9:07       ` Hans Verkuil
2018-01-16  9:39         ` Alexandre Courbot
2018-01-16 10:37           ` Hans Verkuil
2018-01-17  8:01             ` Alexandre Courbot
2018-01-17  8:37               ` Hans Verkuil
2017-12-15  7:56 ` [RFC PATCH 6/9] media: vb2: add support for requests in QBUF ioctl Alexandre Courbot
2018-01-12 11:37   ` Hans Verkuil
2018-01-15  8:24     ` Alexandre Courbot
2018-01-15  9:19       ` Hans Verkuil
2018-01-16  9:40         ` Alexandre Courbot
2017-12-15  7:56 ` [RFC PATCH 7/9] media: v4l2-mem2mem: add request support Alexandre Courbot
2017-12-15  7:56 ` [RFC PATCH 8/9] media: vim2m: add media device Alexandre Courbot
2017-12-15  7:56 ` Alexandre Courbot [this message]
2017-12-18 20:53   ` [RFC PATCH 9/9] media: vim2m: add request support Gustavo Padovan
2017-12-20  9:29     ` Alexandre Courbot
2017-12-15 21:02 ` [RFC PATCH 0/9] media: base request API support Nicolas Dufresne
2017-12-20  9:24   ` Alexandre Courbot
2017-12-15 21:04 ` Nicolas Dufresne
2017-12-20  9:27   ` Alexandre Courbot
2018-01-12 11:45 ` Hans Verkuil
2018-01-15  8:24   ` Alexandre Courbot
2018-01-15  8:43     ` Hans Verkuil

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=20171215075625.27028-10-acourbot@chromium.org \
    --to=acourbot@chromium.org \
    --cc=gustavo.padovan@collabora.com \
    --cc=hverkuil@xs4all.nl \
    --cc=laurent.pinchart@ideasonboard.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-media@vger.kernel.org \
    --cc=m.szyprowski@samsung.com \
    --cc=mchehab@kernel.org \
    --cc=posciak@chromium.org \
    --cc=sakari.ailus@linux.intel.com \
    --cc=tfiga@chromium.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®