aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media/platform/vimc/vimc-capture.c
diff options
context:
space:
mode:
authorLucas A. M. Magalhães <lucmaga@gmail.com>2019-01-21 20:05:01 -0500
committerMauro Carvalho Chehab <mchehab+samsung@kernel.org>2019-02-07 12:23:09 -0500
commitadc589d2a20808fb99d46a78175cd023f2040338 (patch)
treed31919d178d5b9a82a3be8fb9aea4a2e74742e66 /drivers/media/platform/vimc/vimc-capture.c
parent276c1f066bdaaed6fe82ed231e1eff2f41c34882 (diff)
media: vimc: Add vimc-streamer for stream control
Add a linear pipeline logic for the stream control. It's created by walking backwards on the entity graph. When the stream starts it will simply loop through the pipeline calling the respective process_frame function of each entity. Fixes: f2fe89061d797 ("vimc: Virtual Media Controller core, capture and sensor") Cc: stable@vger.kernel.org # for v4.20 Signed-off-by: Lucas A. M. Magalhães <lucmaga@gmail.com> Acked-by: Helen Koike <helen.koike@collabora.com> Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl> [hverkuil-cisco@xs4all.nl: fixed small space-after-tab issue in the patch] Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
Diffstat (limited to 'drivers/media/platform/vimc/vimc-capture.c')
-rw-r--r--drivers/media/platform/vimc/vimc-capture.c18
1 files changed, 9 insertions, 9 deletions
diff --git a/drivers/media/platform/vimc/vimc-capture.c b/drivers/media/platform/vimc/vimc-capture.c
index aaeddf24b042..93837d9eecd2 100644
--- a/drivers/media/platform/vimc/vimc-capture.c
+++ b/drivers/media/platform/vimc/vimc-capture.c
@@ -24,6 +24,7 @@
24#include <media/videobuf2-vmalloc.h> 24#include <media/videobuf2-vmalloc.h>
25 25
26#include "vimc-common.h" 26#include "vimc-common.h"
27#include "vimc-streamer.h"
27 28
28#define VIMC_CAP_DRV_NAME "vimc-capture" 29#define VIMC_CAP_DRV_NAME "vimc-capture"
29 30
@@ -44,7 +45,7 @@ struct vimc_cap_device {
44 spinlock_t qlock; 45 spinlock_t qlock;
45 struct mutex lock; 46 struct mutex lock;
46 u32 sequence; 47 u32 sequence;
47 struct media_pipeline pipe; 48 struct vimc_stream stream;
48}; 49};
49 50
50static const struct v4l2_pix_format fmt_default = { 51static const struct v4l2_pix_format fmt_default = {
@@ -248,14 +249,13 @@ static int vimc_cap_start_streaming(struct vb2_queue *vq, unsigned int count)
248 vcap->sequence = 0; 249 vcap->sequence = 0;
249 250
250 /* Start the media pipeline */ 251 /* Start the media pipeline */
251 ret = media_pipeline_start(entity, &vcap->pipe); 252 ret = media_pipeline_start(entity, &vcap->stream.pipe);
252 if (ret) { 253 if (ret) {
253 vimc_cap_return_all_buffers(vcap, VB2_BUF_STATE_QUEUED); 254 vimc_cap_return_all_buffers(vcap, VB2_BUF_STATE_QUEUED);
254 return ret; 255 return ret;
255 } 256 }
256 257
257 /* Enable streaming from the pipe */ 258 ret = vimc_streamer_s_stream(&vcap->stream, &vcap->ved, 1);
258 ret = vimc_pipeline_s_stream(&vcap->vdev.entity, 1);
259 if (ret) { 259 if (ret) {
260 media_pipeline_stop(entity); 260 media_pipeline_stop(entity);
261 vimc_cap_return_all_buffers(vcap, VB2_BUF_STATE_QUEUED); 261 vimc_cap_return_all_buffers(vcap, VB2_BUF_STATE_QUEUED);
@@ -273,8 +273,7 @@ static void vimc_cap_stop_streaming(struct vb2_queue *vq)
273{ 273{
274 struct vimc_cap_device *vcap = vb2_get_drv_priv(vq); 274 struct vimc_cap_device *vcap = vb2_get_drv_priv(vq);
275 275
276 /* Disable streaming from the pipe */ 276 vimc_streamer_s_stream(&vcap->stream, &vcap->ved, 0);
277 vimc_pipeline_s_stream(&vcap->vdev.entity, 0);
278 277
279 /* Stop the media pipeline */ 278 /* Stop the media pipeline */
280 media_pipeline_stop(&vcap->vdev.entity); 279 media_pipeline_stop(&vcap->vdev.entity);
@@ -355,8 +354,8 @@ static void vimc_cap_comp_unbind(struct device *comp, struct device *master,
355 kfree(vcap); 354 kfree(vcap);
356} 355}
357 356
358static void vimc_cap_process_frame(struct vimc_ent_device *ved, 357static void *vimc_cap_process_frame(struct vimc_ent_device *ved,
359 struct media_pad *sink, const void *frame) 358 const void *frame)
360{ 359{
361 struct vimc_cap_device *vcap = container_of(ved, struct vimc_cap_device, 360 struct vimc_cap_device *vcap = container_of(ved, struct vimc_cap_device,
362 ved); 361 ved);
@@ -370,7 +369,7 @@ static void vimc_cap_process_frame(struct vimc_ent_device *ved,
370 typeof(*vimc_buf), list); 369 typeof(*vimc_buf), list);
371 if (!vimc_buf) { 370 if (!vimc_buf) {
372 spin_unlock(&vcap->qlock); 371 spin_unlock(&vcap->qlock);
373 return; 372 return ERR_PTR(-EAGAIN);
374 } 373 }
375 374
376 /* Remove this entry from the list */ 375 /* Remove this entry from the list */
@@ -391,6 +390,7 @@ static void vimc_cap_process_frame(struct vimc_ent_device *ved,
391 vb2_set_plane_payload(&vimc_buf->vb2.vb2_buf, 0, 390 vb2_set_plane_payload(&vimc_buf->vb2.vb2_buf, 0,
392 vcap->format.sizeimage); 391 vcap->format.sizeimage);
393 vb2_buffer_done(&vimc_buf->vb2.vb2_buf, VB2_BUF_STATE_DONE); 392 vb2_buffer_done(&vimc_buf->vb2.vb2_buf, VB2_BUF_STATE_DONE);
393 return NULL;
394} 394}
395 395
396static int vimc_cap_comp_bind(struct device *comp, struct device *master, 396static int vimc_cap_comp_bind(struct device *comp, struct device *master,