+ * @process_frame: callback that processes a frame
* @vdev_get_format: callback that returns the current format a pad, used
* only when is_media_entity_v4l2_video_device(ent) returns
* true
@@ -101,8 +102,8 @@ struct vimc_pix_map {
struct vimc_ent_device {
struct device *dev;
struct media_entity *ent;
- void * (*process_frame)(struct vimc_ent_device *ved,
- const void *frame);
+ void * (*get_frame)(struct vimc_ent_device *ved);
+ int (*process_frame)(struct vimc_ent_device *ved);
void (*vdev_get_format)(struct vimc_ent_device *ved,
struct v4l2_pix_format *fmt);
};
diff --git a/drivers/media/test-drivers/vimc/vimc-debayer.c b/drivers/media/test-drivers/vimc/vimc-debayer.c
index c3f6fef34f68..f61e6e8899ac 100644
--- a/drivers/media/test-drivers/vimc/vimc-debayer.c
+++ b/drivers/media/test-drivers/vimc/vimc-debayer.c
@@ -491,17 +491,22 @@ static void vimc_deb_calc_rgb_sink(struct vimc_deb_device *vdeb,
}
}
-static void *vimc_deb_process_frame(struct vimc_ent_device *ved,
- const void *sink_frame)
+static int vimc_deb_process_frame(struct vimc_ent_device *ved)
{
struct vimc_deb_device *vdeb = container_of(ved, struct vimc_deb_device,
ved);
unsigned int rgb[3];
unsigned int i, j;
+ struct v4l2_subdev *sd;
+ const void *sink_frame;
/* If the stream in this node is not active, just return */
if (!vdeb->src_frame)
- return ERR_PTR(-EINVAL);
+ return -EINVAL;
+
+ sd = media_entity_to_v4l2_subdev(vimc_get_source_entity(ved->ent));
+ ved = v4l2_get_subdevdata(sd);
+ sink_frame = ved->get_frame(ved);
for (i = 0; i < vdeb->sink_fmt.height; i++)
for (j = 0; j < vdeb->sink_fmt.width; j++) {
@@ -509,6 +514,13 @@ static void *vimc_deb_process_frame(struct vimc_ent_device *ved,
vdeb->set_rgb_src(vdeb, i, j, rgb);
}
+ return 0;
+}
+
+static void *vimc_deb_get_frame(struct vimc_ent_device *ved)
+{
+ struct vimc_deb_device *vdeb = container_of(ved, struct vimc_deb_device,
+ ved);
return vdeb->src_frame;
}
@@ -593,6 +605,7 @@ static struct vimc_ent_device *vimc_deb_add(struct vimc_device *vimc,
goto err_free_hdl;
vdeb->ved.process_frame = vimc_deb_process_frame;
+ vdeb->ved.get_frame = vimc_deb_get_frame;
vdeb->ved.dev = vimc->mdev.dev;
vdeb->mean_win_size = vimc_deb_ctrl_mean_win_size.def;
diff --git a/drivers/media/test-drivers/vimc/vimc-scaler.c b/drivers/media/test-drivers/vimc/vimc-scaler.c
index 121fa7d62a2e..347f9cd4a168 100644
--- a/drivers/media/test-drivers/vimc/vimc-scaler.c
+++ b/drivers/media/test-drivers/vimc/vimc-scaler.c
@@ -455,18 +455,29 @@ static void vimc_sca_fill_src_frame(const struct vimc_sca_device *const vsca,
vimc_sca_scale_pix(vsca, i, j, sink_frame);
}
-static void *vimc_sca_process_frame(struct vimc_ent_device *ved,
- const void *sink_frame)
+static int vimc_sca_process_frame(struct vimc_ent_device *ved)
{
struct vimc_sca_device *vsca = container_of(ved, struct vimc_sca_device,
ved);
+ const void *sink_frame;
+ struct v4l2_subdev *sd;
/* If the stream in this node is not active, just return */
if (!vsca->src_frame)
- return ERR_PTR(-EINVAL);
+ return -EINVAL;
+ sd = media_entity_to_v4l2_subdev(vimc_get_source_entity(ved->ent));
+ ved = v4l2_get_subdevdata(sd);
+ sink_frame = ved->get_frame(ved);
vimc_sca_fill_src_frame(vsca, sink_frame);
+ return 0;
+};
+
+static void *vimc_sca_get_frame(struct vimc_ent_device *ved)
+{
+ struct vimc_sca_device *vsca = container_of(ved, struct vimc_sca_device,
+ ved);
return vsca->src_frame;
};
@@ -505,6 +516,7 @@ static struct vimc_ent_device *vimc_sca_add(struct vimc_device *vimc,
}
vsca->ved.process_frame = vimc_sca_process_frame;
+ vsca->ved.get_frame = vimc_sca_get_frame;
vsca->ved.dev = vimc->mdev.dev;
/* Initialize the frame format */
diff --git a/drivers/media/test-drivers/vimc/vimc-sensor.c b/drivers/media/test-drivers/vimc/vimc-sensor.c
index ba5db5a150b4..32a2c39de2cd 100644
--- a/drivers/media/test-drivers/vimc/vimc-sensor.c
+++ b/drivers/media/test-drivers/vimc/vimc-sensor.c
@@ -190,8 +190,7 @@ static const struct v4l2_subdev_pad_ops vimc_sen_pad_ops = {
.set_fmt = vimc_sen_set_fmt,
};
-static void *vimc_sen_process_frame(struct vimc_ent_device *ved,
- const void *sink_frame)
+static int vimc_sen_process_frame(struct vimc_ent_device *ved)
{
struct vimc_sen_device *vsen = container_of(ved, struct vimc_sen_device,
ved);
@@ -238,6 +237,13 @@ static void *vimc_sen_process_frame(struct vimc_ent_device *ved,
break;
}
+ return 0;
+}
+
+static void *vimc_sen_get_frame(struct vimc_ent_device *ved)
+{
+ struct vimc_sen_device *vsen = container_of(ved, struct vimc_sen_device,
+ ved);
return vsen->frame;
}
@@ -429,6 +435,7 @@ static struct vimc_ent_device *vimc_sen_add(struct vimc_device *vimc,
goto err_free_tpg;
vsen->ved.process_frame = vimc_sen_process_frame;
+ vsen->ved.get_frame = vimc_sen_get_frame;
vsen->ved.dev = vimc->mdev.dev;
/* Initialize the frame format */
diff --git a/drivers/media/test-drivers/vimc/vimc-streamer.c b/drivers/media/test-drivers/vimc/vimc-streamer.c
index 4f8384246042..c1644d69686d 100644
--- a/drivers/media/test-drivers/vimc/vimc-streamer.c
+++ b/drivers/media/test-drivers/vimc/vimc-streamer.c
@@ -125,7 +125,8 @@ static int vimc_streamer_pipeline_init(struct vimc_stream *stream,
static int vimc_streamer_thread(void *data)
{
struct vimc_stream *stream = data;
- u8 *frame = NULL;
+ struct vimc_ent_device *ved;
+ int ret;
int i;
set_freezable();
@@ -136,9 +137,10 @@ static int vimc_streamer_thread(void *data)
break;
for (i = stream->pipe_size - 1; i >= 0; i--) {
- frame = stream->ved_pipeline[i]->process_frame(
- stream->ved_pipeline[i], frame);
- if (!frame || IS_ERR(frame))
+ ved = stream->ved_pipeline[i];
+ ret = ved->process_frame(ved);
+
+ if (ret)
break;
}
//wait for 60hz