Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1741375

[RFC PATCH 7/9] [media] vim2m: add jobs API support

Path csiph.com!eternal-september.org!feeder.eternal-september.org!news.unit0.net!news.panservice.it!bofh.it!news.nic.it!robomod
From Alexandre Courbot <acourbot@chromium.org>
Newsgroups linux.kernel
Subject [RFC PATCH 7/9] [media] vim2m: add jobs API support
Date Thu, 28 Sep 2017 12:00:04 +0200
Message-ID <uuDLS-7o2-71@gated-at.bofh.it> (permalink)
References <uuDLQ-7o2-25@gated-at.bofh.it>
X-Original-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>
Dkim-Signature v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=IwJVuUazoxPrqtNU+b/iTD7Vg2VAVpFG6mVrppAoj5w=; b=GC13TPb+d4SrJLknRJZc23t19JY3suUzoSnMbaaqGuTEj1+hvFfgX/Qt3XUE+UeYg+ jWtd/ymrilH1u87T3RqHzkeF+al5bcp8/Z2R3ZAD/rQa7sCKbqtmtboDkaC0oSvxiKmy 5ZhQDbRQYGI1AIzZMKvt8J8m7ihnEz+br01Co=
X-Google-Dkim-Signature v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=IwJVuUazoxPrqtNU+b/iTD7Vg2VAVpFG6mVrppAoj5w=; b=tBktzkALLr1y+FUAWQ1/9qJh8fVuLMCHhEvSI22vdD/OJaAC5H+mT5Nvk0+pQqaZ6Q unJvdrwxAXoT5hcnzx/vtGKANDBPNxw7Ker5bNqNRgt1b4oGmmq/Kqtp1b64vqwCezRv 1vzagTlU4DVXNbl7LOVa/dlWrnxC90vVUqzj3HH6hqbWrYHZw6xM1t+P+qN/4S8dZwfk 899cBdXT6qZWppOmSd25jtAIqYBkmhDI2+Q4ZLaztHPrMPjgPUlf7DaCvdOIUvs8eRy0 UA/yMc2oIw/p2sJvNDh2Ystl1sUmT9JHit53C+Z9AcOYGsgf7d+yZxkcUXn4Krf8kyom r42Q==
X-Gm-Message-State AHPjjUhHHuGXk2HQuEaSUns+p0dvL5KmYMhMUaQN47ySsN8UXXaGoU8k +EuNZxWYPdbx8RNh+y5c9is+ow==
X-Google-SMTP-Source AOwi7QAwzRTKZh2n0M10V/d5yK9nd1zCzF7fgK0ukfB/iCT+/BVCpe7sGMjVYJIkbuoxETSmujrlbg==
X-Received by 10.98.72.83 with SMTP id v80mr3949798pfa.54.1506592281993; Thu, 28 Sep 2017 02:51:21 -0700 (PDT)
X-Mailer git-send-email 2.14.2.822.g60be5d43e6-goog
Sender robomod@news.nic.it
List-ID <linux-kernel.vger.kernel.org>
X-Mailing-List linux-kernel@vger.kernel.org
Approved robomod@news.nic.it
Lines 79
Organization linux.* mail to news gateway
X-Original-Cc linux-media@vger.kernel.org, linux-kernel@vger.kernel.org, Alexandre Courbot <acourbot@chromium.org>
X-Original-Date Thu, 28 Sep 2017 18:50:25 +0900
X-Original-Message-ID <20170928095027.127173-8-acourbot@chromium.org>
X-Original-References <20170928095027.127173-1-acourbot@chromium.org>
X-Original-Sender linux-kernel-owner@vger.kernel.org
Xref csiph.com linux.kernel:1741375

Show key headers only | View raw


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

Back to linux.kernel | Previous | NextPrevious in thread | Find similar | Unroll thread


Thread

[RFC PATCH 0/9] V4L2 Jobs API WIP Alexandre Courbot <acourbot@chromium.org> - 2017-09-28 12:00 +0200
  [RFC PATCH 2/9] [media] v4l2-core: add core jobs API support Alexandre Courbot <acourbot@chromium.org> - 2017-09-28 12:00 +0200
  [RFC PATCH 5/9] [media] v4l2-job: add generic jobs ops Alexandre Courbot <acourbot@chromium.org> - 2017-09-28 12:00 +0200
  [RFC PATCH 3/9] [media] videobuf2: add support for jobs API Alexandre Courbot <acourbot@chromium.org> - 2017-09-28 12:00 +0200
  [RFC PATCH 4/9] [media] v4l2-ctrls: add support for jobs API Alexandre Courbot <acourbot@chromium.org> - 2017-09-28 12:00 +0200
  [RFC PATCH 7/9] [media] vim2m: add jobs API support Alexandre Courbot <acourbot@chromium.org> - 2017-09-28 12:00 +0200

csiph-web