@@ -363,10 +363,10 @@ static void bru_configure(struct vsp1_entity *entity,
* disabled BRU inputs are used in ROP NOP mode to ignore the
* SRC input.
*/
- if (bru->inputs[i].rpf) {
+ if (pipe->bru_inputs[i]) {
ctrl |= VI6_BRU_CTRL_RBC;
- premultiplied = bru->inputs[i].rpf->format.flags
+ premultiplied = pipe->bru_inputs[i]->format.flags
& V4L2_PIX_FMT_FLAG_PREMUL_ALPHA;
} else {
ctrl |= VI6_BRU_CTRL_CROP(VI6_ROP_NOP)
@@ -29,10 +29,6 @@ struct vsp1_bru {
struct v4l2_ctrl_handler ctrls;
- struct {
- struct vsp1_rwpf *rpf;
- } inputs[VSP1_MAX_RPF];
-
u32 bgcolor;
};
@@ -93,8 +93,8 @@ int vsp1_du_setup_lif(struct device *dev, unsigned int width,
media_entity_pipeline_stop(&pipe->output->entity.subdev.entity);
for (i = 0; i < bru->entity.source_pad; ++i) {
- bru->inputs[i].rpf = NULL;
- pipe->inputs[i] = NULL;
+ pipe->bru_inputs[i] = NULL;
+ pipe->inputs[i].rpf = NULL;
}
pipe->num_inputs = 0;
@@ -290,12 +290,12 @@ int vsp1_du_atomic_update(struct device *dev, unsigned int rpf_index,
spin_lock_irqsave(&pipe->irqlock, flags);
- if (pipe->inputs[rpf_index]) {
+ if (pipe->inputs[rpf_index].rpf) {
/* Remove the RPF from the pipeline if it was previously
* enabled.
*/
- vsp1->bru->inputs[rpf_index].rpf = NULL;
- pipe->inputs[rpf_index] = NULL;
+ pipe->bru_inputs[rpf_index] = NULL;
+ pipe->inputs[rpf_index].rpf = NULL;
pipe->num_inputs--;
}
@@ -411,7 +411,7 @@ int vsp1_du_atomic_update(struct device *dev, unsigned int rpf_index,
sel.pad);
/* Store the BRU input pad number in the RPF. */
- rpf->bru_input = rpf->entity.index;
+ pipe->inputs[rpf->entity.index].bru_pad = rpf->entity.index;
/* Cache the memory buffer address but don't apply the values to the
* hardware as the crop offsets haven't been computed yet.
@@ -425,9 +425,9 @@ int vsp1_du_atomic_update(struct device *dev, unsigned int rpf_index,
/* If the RPF was previously stopped set the BRU input to the RPF and
* store the RPF in the pipeline inputs array.
*/
- if (!pipe->inputs[rpf->entity.index]) {
- vsp1->bru->inputs[rpf_index].rpf = rpf;
- pipe->inputs[rpf->entity.index] = rpf;
+ if (!pipe->inputs[rpf->entity.index].rpf) {
+ pipe->bru_inputs[rpf_index] = rpf;
+ pipe->inputs[rpf->entity.index].rpf = rpf;
pipe->num_inputs++;
}
@@ -454,7 +454,7 @@ void vsp1_du_atomic_flush(struct device *dev)
if (entity->type == VSP1_ENTITY_RPF) {
struct vsp1_rwpf *rpf = to_rwpf(&entity->subdev);
- if (!pipe->inputs[rpf->entity.index]) {
+ if (!pipe->inputs[rpf->entity.index].rpf) {
vsp1_dl_list_write(pipe->dl, entity->route->reg,
VI6_DPR_NODE_UNUSED);
continue;
@@ -164,16 +164,12 @@ void vsp1_pipeline_reset(struct vsp1_pipeline *pipe)
{
unsigned int i;
- if (pipe->bru) {
- struct vsp1_bru *bru = to_bru(&pipe->bru->subdev);
-
- for (i = 0; i < ARRAY_SIZE(bru->inputs); ++i)
- bru->inputs[i].rpf = NULL;
- }
+ for (i = 0; i < ARRAY_SIZE(pipe->bru_inputs); ++i)
+ pipe->bru_inputs[i] = NULL;
for (i = 0; i < pipe->num_inputs; ++i) {
- pipe->inputs[i]->pipe = NULL;
- pipe->inputs[i] = NULL;
+ pipe->inputs[i].rpf->pipe = NULL;
+ pipe->inputs[i].rpf = NULL;
}
pipe->output->pipe = NULL;
@@ -67,11 +67,13 @@ enum vsp1_pipeline_state {
* @stream_count: number of streaming video nodes
* @buffers_ready: bitmask of RPFs and WPFs with at least one buffer available
* @num_inputs: number of RPFs
- * @inputs: array of RPFs in the pipeline (indexed by RPF index)
+ * @inputs.rpf: RPFs in the pipeline (indexed by RPF index)
+ * @inputs.bru_pad: BRU input pad for each RPF (indexed by RPF index)
* @output: WPF at the output of the pipeline
* @bru: BRU entity, if present
* @lif: LIF entity, if present
* @uds: UDS entity, if present
+ * @bru_inputs: RPFs at the inputs of the BRU, if the BRU is present
* @uds_input: entity at the input of the UDS, if the UDS is present
* @entities: list of entities in the pipeline
* @dl: display list associated with the pipeline
@@ -91,11 +93,16 @@ struct vsp1_pipeline {
unsigned int buffers_ready;
unsigned int num_inputs;
- struct vsp1_rwpf *inputs[VSP1_MAX_RPF];
+ struct {
+ struct vsp1_rwpf *rpf;
+ unsigned int bru_pad;
+ } inputs[VSP1_MAX_RPF];
struct vsp1_rwpf *output;
struct vsp1_entity *bru;
struct vsp1_entity *lif;
struct vsp1_entity *uds;
+
+ struct vsp1_rwpf *bru_inputs[VSP1_MAX_RPF];
struct vsp1_entity *uds_input;
struct list_head entities;
@@ -134,10 +134,12 @@ static void rpf_configure(struct vsp1_entity *entity,
if (pipe->bru) {
struct v4l2_subdev_pad_config *bru_config;
const struct v4l2_rect *compose;
+ unsigned int bru_pad;
bru_config = vsp1_entity_get_req_pad_config(pipe->bru, req);
+ bru_pad = pipe->inputs[rpf->entity.index].bru_pad;
compose = vsp1_entity_get_pad_compose(pipe->bru, bru_config,
- rpf->bru_input);
+ bru_pad);
left = compose->left;
top = compose->top;
}
@@ -44,7 +44,6 @@ struct vsp1_rwpf {
unsigned int max_height;
struct v4l2_pix_format_mplane format;
- unsigned int bru_input;
unsigned int alpha;
@@ -194,13 +194,11 @@ static int vsp1_video_pipeline_build_branch(struct vsp1_pipeline *pipe,
entity = to_vsp1_entity(media_entity_to_v4l2_subdev(pad->entity));
/* A BRU is present in the pipeline, store the BRU input pad
- * number in the input RPF for use when configuring the RPF.
+ * number for use when configuring the RPF.
*/
if (entity->type == VSP1_ENTITY_BRU) {
- struct vsp1_bru *bru = to_bru(&entity->subdev);
-
- bru->inputs[pad->index].rpf = input;
- input->bru_input = pad->index;
+ pipe->bru_inputs[pad->index] = input;
+ pipe->inputs[input->entity.index].bru_pad = pad->index;
bru_found = true;
}
@@ -269,7 +267,7 @@ static int vsp1_video_pipeline_build(struct vsp1_pipeline *pipe,
if (e->type == VSP1_ENTITY_RPF) {
rwpf = to_rwpf(subdev);
- pipe->inputs[rwpf->entity.index] = rwpf;
+ pipe->inputs[rwpf->entity.index].rpf = rwpf;
rwpf->video->pipe_index = ++pipe->num_inputs;
rwpf->pipe = pipe;
} else if (e->type == VSP1_ENTITY_WPF) {
@@ -296,10 +294,11 @@ static int vsp1_video_pipeline_build(struct vsp1_pipeline *pipe,
* contains no loop and that all branches end at the output WPF.
*/
for (i = 0; i < video->vsp1->info->rpf_count; ++i) {
- if (!pipe->inputs[i])
+ if (!pipe->inputs[i].rpf)
continue;
- ret = vsp1_video_pipeline_build_branch(pipe, pipe->inputs[i],
+ ret = vsp1_video_pipeline_build_branch(pipe,
+ pipe->inputs[i].rpf,
pipe->output);
if (ret < 0)
goto error;
@@ -430,7 +429,7 @@ static void vsp1_video_pipeline_run(struct vsp1_pipeline *pipe)
pipe->dl = vsp1_dl_list_get(pipe->output->dlm);
for (i = 0; i < vsp1->info->rpf_count; ++i) {
- struct vsp1_rwpf *rwpf = pipe->inputs[i];
+ struct vsp1_rwpf *rwpf = pipe->inputs[i].rpf;
if (rwpf)
vsp1_rwpf_set_memory(rwpf, pipe->dl);
@@ -454,10 +453,10 @@ static void vsp1_video_pipeline_frame_end(struct vsp1_pipeline *pipe)
/* Complete buffers on all video nodes. */
for (i = 0; i < vsp1->info->rpf_count; ++i) {
- if (!pipe->inputs[i])
+ if (!pipe->inputs[i].rpf)
continue;
- vsp1_video_frame_end(pipe, pipe->inputs[i]);
+ vsp1_video_frame_end(pipe, pipe->inputs[i].rpf);
}
vsp1_video_frame_end(pipe, pipe->output);
@@ -164,7 +164,7 @@ static void wpf_configure(struct vsp1_entity *entity,
* layer.
*/
for (i = 0; i < vsp1->info->rpf_count; ++i) {
- struct vsp1_rwpf *input = pipe->inputs[i];
+ struct vsp1_rwpf *input = pipe->inputs[i].rpf;
if (!input)
continue;
Move the array of BRU inputs and the RPF BRU input index to the pipeline structure. This prepares the driver for the request API that will need to handle pipeline state for every request separately from the active state. Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com> --- drivers/media/platform/vsp1/vsp1_bru.c | 4 ++-- drivers/media/platform/vsp1/vsp1_bru.h | 4 ---- drivers/media/platform/vsp1/vsp1_drm.c | 20 ++++++++++---------- drivers/media/platform/vsp1/vsp1_pipe.c | 12 ++++-------- drivers/media/platform/vsp1/vsp1_pipe.h | 11 +++++++++-- drivers/media/platform/vsp1/vsp1_rpf.c | 4 +++- drivers/media/platform/vsp1/vsp1_rwpf.h | 1 - drivers/media/platform/vsp1/vsp1_video.c | 21 ++++++++++----------- drivers/media/platform/vsp1/vsp1_wpf.c | 2 +- 9 files changed, 39 insertions(+), 40 deletions(-)