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 <pawel@osciak.com>,
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 7/9] [media] vim2m: add jobs API support
Date: Thu, 28 Sep 2017 18:50:25 +0900 [thread overview]
Message-ID: <20170928095027.127173-8-acourbot@chromium.org> (raw)
In-Reply-To: <20170928095027.127173-1-acourbot@chromium.org>
Add support for jobs in vim2m, using the generic state handler.
Signed-off-by: Alexandre Courbot <acourbot@chromium.org>
---
drivers/media/platform/vim2m.c | 24 ++++++++++++++++++++++++
1 file changed, 24 insertions(+)
diff --git a/drivers/media/platform/vim2m.c b/drivers/media/platform/vim2m.c
index 970b9b6dab25..aff21d53d898 100644
--- a/drivers/media/platform/vim2m.c
+++ b/drivers/media/platform/vim2m.c
@@ -31,6 +31,8 @@
#include <media/v4l2-event.h>
#include <media/videobuf2-vmalloc.h>
+#include <media/v4l2-job-generic.h>
+
MODULE_DESCRIPTION("Virtual device for mem2mem framework testing");
MODULE_AUTHOR("Pawel Osciak, <pawel@osciak.com>");
MODULE_LICENSE("GPL");
@@ -155,6 +157,7 @@ struct vim2m_ctx {
struct vim2m_dev *dev;
struct v4l2_ctrl_handler hdl;
+ struct v4l2_generic_state_handler state;
/* Processed buffers in this transaction */
u8 num_processed;
@@ -877,6 +880,15 @@ static const struct v4l2_ctrl_config vim2m_ctrl_trans_num_bufs = {
.step = 1,
};
+static void vim2m_process_active_job(struct v4l2_job_state_handler *hdl)
+{
+ struct vim2m_ctx *ctx = container_of(hdl, struct vim2m_ctx, state.base);
+
+ vb2_queue_active_job_buffers(&ctx->fh.m2m_ctx->cap_q_ctx.q);
+ vb2_queue_active_job_buffers(&ctx->fh.m2m_ctx->out_q_ctx.q);
+ v4l2_m2m_try_schedule(ctx->fh.m2m_ctx);
+}
+
/*
* File operations
*/
@@ -886,6 +898,7 @@ static int vim2m_open(struct file *file)
struct vim2m_ctx *ctx = NULL;
struct v4l2_ctrl_handler *hdl;
int rc = 0;
+ int ret;
if (mutex_lock_interruptible(&dev->dev_mutex))
return -ERESTARTSYS;
@@ -913,6 +926,15 @@ static int vim2m_open(struct file *file)
ctx->fh.ctrl_handler = hdl;
v4l2_ctrl_handler_setup(hdl);
+ ret = v4l2_job_generic_init(&ctx->state, vim2m_process_active_job,
+ &ctx->fh, NULL);
+ if (ret) {
+ v4l2_ctrl_handler_free(hdl);
+ v4l2_fh_exit(&ctx->fh);
+ kfree(ctx);
+ goto open_unlock;
+ }
+
ctx->q_data[V4L2_M2M_SRC].fmt = &formats[0];
ctx->q_data[V4L2_M2M_SRC].width = 640;
ctx->q_data[V4L2_M2M_SRC].height = 480;
@@ -934,6 +956,8 @@ static int vim2m_open(struct file *file)
goto open_unlock;
}
+ v4l2_mem_ctx_job_init(ctx->fh.m2m_ctx, &ctx->state.base);
+
v4l2_fh_add(&ctx->fh);
atomic_inc(&dev->num_inst);
--
2.14.2.822.g60be5d43e6-goog
next prev parent reply other threads:[~2017-09-28 9:51 UTC|newest]
Thread overview: 22+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-09-28 9:50 [RFC PATCH 0/9] V4L2 Jobs API WIP Alexandre Courbot
2017-09-28 9:50 ` [RFC PATCH 1/9] [media] v4l2-core: add v4l2_is_v4l2_file function Alexandre Courbot
2017-09-28 9:50 ` [RFC PATCH 2/9] [media] v4l2-core: add core jobs API support Alexandre Courbot
2017-10-16 10:01 ` Hans Verkuil
2017-10-23 8:35 ` Alexandre Courbot
2017-09-28 9:50 ` [RFC PATCH 3/9] [media] videobuf2: add support for jobs API Alexandre Courbot
2017-09-28 9:50 ` [RFC PATCH 4/9] [media] v4l2-ctrls: " Alexandre Courbot
2017-09-28 9:50 ` [RFC PATCH 5/9] [media] v4l2-job: add generic jobs ops Alexandre Courbot
2017-09-28 9:50 ` [RFC PATCH 6/9] [media] m2m: add generic support for jobs API Alexandre Courbot
2017-09-28 9:50 ` Alexandre Courbot [this message]
2017-09-28 9:50 ` [RFC PATCH 8/9] [media] vivid: add jobs API support for capture device Alexandre Courbot
2017-09-28 9:50 ` [RFC PATCH 9/9] [media] document jobs API Alexandre Courbot
2017-10-16 11:06 ` [RFC PATCH 0/9] V4L2 Jobs API WIP Hans Verkuil
2017-10-23 8:36 ` Alexandre Courbot
2017-10-23 19:03 ` Gustavo Padovan
2017-10-19 14:43 ` Sakari Ailus
2017-10-23 8:45 ` Alexandre Courbot
2017-10-25 15:48 ` Laurent Pinchart
2017-10-25 16:19 ` Hans Verkuil
2017-10-25 23:06 ` Laurent Pinchart
2017-10-26 3:08 ` Tomasz Figa
2017-10-26 2:49 ` Tomasz Figa
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=20170928095027.127173-8-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=pawel@osciak.com \
--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