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 8/8] media: vim2m: add request support
Date: Fri, 26 Jan 2018 15:02:16 +0900 [thread overview]
Message-ID: <20180126060216.147918-9-acourbot@chromium.org> (raw)
In-Reply-To: <20180126060216.147918-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 | 31 +++++++++++++++++++++++++++++++
1 file changed, 31 insertions(+)
diff --git a/drivers/media/platform/vim2m.c b/drivers/media/platform/vim2m.c
index a32e8a7950eb..1ddbad5eb569 100644
--- a/drivers/media/platform/vim2m.c
+++ b/drivers/media/platform/vim2m.c
@@ -30,6 +30,8 @@
#include <media/v4l2-ctrls.h>
#include <media/v4l2-event.h>
#include <media/videobuf2-vmalloc.h>
+#include <media/media-request.h>
+#include <media/media-request-mgr.h>
MODULE_DESCRIPTION("Virtual device for mem2mem framework testing");
MODULE_AUTHOR("Pawel Osciak, <pawel@osciak.com>");
@@ -370,6 +372,24 @@ static void job_abort(void *priv)
ctx->aborting = 1;
}
+static void apply_request_params(struct media_request *req,
+ struct vim2m_ctx *ctx)
+{
+ struct media_request_entity_data *data;
+
+ if (!req)
+ return;
+
+ data = media_request_get_entity_data(req, &ctx->dev->vfd.entity,
+ &ctx->fh);
+ if (WARN_ON(!data))
+ return;
+
+ /* apply controls here */
+
+ data->applied = true;
+}
+
/* device_run() - prepares and starts the device
*
* This simulates all the immediate preparations required before starting
@@ -385,8 +405,15 @@ static void device_run(void *priv)
src_buf = v4l2_m2m_next_src_buf(ctx->fh.m2m_ctx);
dst_buf = v4l2_m2m_next_dst_buf(ctx->fh.m2m_ctx);
+ /* Apply request if needed */
+ apply_request_params(src_buf->vb2_buf.request, ctx);
+ WARN_ON(dst_buf->vb2_buf.request != NULL);
+
device_process(ctx, src_buf, dst_buf);
+ /* Inform user about which request produced the destination buffer */
+ dst_buf->request_fd = src_buf->request_fd;
+
/* Run a timer, which simulates a hardware irq */
schedule_irq(dev, ctx->transtime);
}
@@ -841,6 +868,7 @@ static int queue_init(void *priv, struct vb2_queue *src_vq, struct vb2_queue *ds
src_vq->mem_ops = &vb2_vmalloc_memops;
src_vq->timestamp_flags = V4L2_BUF_FLAG_TIMESTAMP_COPY;
src_vq->lock = &ctx->dev->dev_mutex;
+ src_vq->allow_requests = true;
ret = vb2_queue_init(src_vq);
if (ret)
@@ -1006,6 +1034,9 @@ static int vim2m_probe(struct platform_device *pdev)
#ifdef CONFIG_MEDIA_CONTROLLER
dev->mdev.dev = &pdev->dev;
+ dev->mdev.req_mgr = media_request_mgr_alloc(&dev->mdev);
+ if (IS_ERR(dev->mdev.req_mgr))
+ return PTR_ERR(dev->mdev.req_mgr);
strlcpy(dev->mdev.model, "vim2m", sizeof(dev->mdev.model));
media_device_init(&dev->mdev);
dev->v4l2_dev.mdev = &dev->mdev;
--
2.16.0.rc1.238.g530d649a79-goog
next prev parent reply other threads:[~2018-01-26 6:03 UTC|newest]
Thread overview: 25+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-01-26 6:02 [RFC PATCH 0/8] [media] Request API, take three Alexandre Courbot
2018-01-26 6:02 ` [RFC PATCH 1/8] media: add request API core and UAPI Alexandre Courbot
2018-01-26 6:02 ` [RFC PATCH 2/8] videodev2.h: Add request field to v4l2_buffer Alexandre Courbot
2018-01-26 6:02 ` [RFC PATCH 3/8] media: videobuf2: add support for requests Alexandre Courbot
2018-01-31 12:19 ` Sakari Ailus
2018-01-26 6:02 ` [RFC PATCH 4/8] media: vb2: add support for requests in QBUF ioctl Alexandre Courbot
2018-01-26 6:02 ` [RFC PATCH 5/8] media: Document the media request API Alexandre Courbot
2018-01-29 16:04 ` Hans Verkuil
2018-01-30 6:31 ` Alexandre Courbot
2018-01-26 6:02 ` [RFC PATCH 6/8] v4l2: document the request API interface Alexandre Courbot
2018-01-26 20:40 ` Randy Dunlap
2018-01-26 21:44 ` Nicolas Dufresne
2018-01-29 16:03 ` Hans Verkuil
2018-01-30 6:31 ` Alexandre Courbot
2018-01-31 8:26 ` Hans Verkuil
2018-02-06 22:19 ` Sakari Ailus
2018-01-26 6:02 ` [RFC PATCH 7/8] media: vim2m: add media device Alexandre Courbot
2018-01-26 6:02 ` Alexandre Courbot [this message]
2018-01-29 11:21 ` [RFC PATCH 0/8] [media] Request API, take three Hans Verkuil
2018-01-30 6:31 ` Alexandre Courbot
2018-01-31 7:50 ` Hans Verkuil
2018-01-31 8:10 ` Tomasz Figa
2018-01-31 8:47 ` Hans Verkuil
2018-01-31 9:46 ` Tomasz Figa
2018-01-31 16:16 ` 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=20180126060216.147918-9-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®