Skip to content

Commit

Permalink
[media] v4l: vsp1: Simplify alpha propagation
Browse files Browse the repository at this point in the history
We don't need to walk the pipeline when propagating the alpha value as
all the information needed for propagation is already available from the
pipeline structure.

Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
  • Loading branch information
Laurent Pinchart authored and Mauro Carvalho Chehab committed Jun 28, 2016
1 parent 20fab5e commit 07a23c6
Showing 5 changed files with 15 additions and 37 deletions.
40 changes: 9 additions & 31 deletions drivers/media/platform/vsp1/vsp1_pipe.c
Original file line number Diff line number Diff line change
@@ -301,42 +301,20 @@ void vsp1_pipeline_frame_end(struct vsp1_pipeline *pipe)
* to be scaled, we disable alpha scaling when the UDS input has a fixed alpha
* value. The UDS then outputs a fixed alpha value which needs to be programmed
* from the input RPF alpha.
*
* This function can only be called from a subdev s_stream handler as it
* requires a valid display list context.
*/
void vsp1_pipeline_propagate_alpha(struct vsp1_pipeline *pipe,
struct vsp1_entity *input,
struct vsp1_dl_list *dl,
unsigned int alpha)
struct vsp1_dl_list *dl, unsigned int alpha)
{
struct vsp1_entity *entity;
struct media_pad *pad;

pad = media_entity_remote_pad(&input->pads[RWPF_PAD_SOURCE]);

while (pad) {
if (!is_media_entity_v4l2_subdev(pad->entity))
break;

entity = to_vsp1_entity(media_entity_to_v4l2_subdev(pad->entity));

/* The BRU background color has a fixed alpha value set to 255,
* the output alpha value is thus always equal to 255.
*/
if (entity->type == VSP1_ENTITY_BRU)
alpha = 255;

if (entity->type == VSP1_ENTITY_UDS) {
struct vsp1_uds *uds = to_uds(&entity->subdev);
if (!pipe->uds)
return;

vsp1_uds_set_alpha(uds, dl, alpha);
break;
}
/* The BRU background color has a fixed alpha value set to 255, the
* output alpha value is thus always equal to 255.
*/
if (pipe->uds_input->type == VSP1_ENTITY_BRU)
alpha = 255;

pad = &entity->pads[entity->source_pad];
pad = media_entity_remote_pad(pad);
}
vsp1_uds_set_alpha(pipe->uds, dl, alpha);
}

void vsp1_pipelines_suspend(struct vsp1_device *vsp1)
4 changes: 1 addition & 3 deletions drivers/media/platform/vsp1/vsp1_pipe.h
Original file line number Diff line number Diff line change
@@ -117,9 +117,7 @@ bool vsp1_pipeline_ready(struct vsp1_pipeline *pipe);
void vsp1_pipeline_frame_end(struct vsp1_pipeline *pipe);

void vsp1_pipeline_propagate_alpha(struct vsp1_pipeline *pipe,
struct vsp1_entity *input,
struct vsp1_dl_list *dl,
unsigned int alpha);
struct vsp1_dl_list *dl, unsigned int alpha);

void vsp1_pipelines_suspend(struct vsp1_device *vsp1);
void vsp1_pipelines_resume(struct vsp1_device *vsp1);
2 changes: 1 addition & 1 deletion drivers/media/platform/vsp1/vsp1_rpf.c
Original file line number Diff line number Diff line change
@@ -206,7 +206,7 @@ static void rpf_configure(struct vsp1_entity *entity,
vsp1_rpf_write(rpf, dl, VI6_RPF_MULT_ALPHA, mult);
}

vsp1_pipeline_propagate_alpha(pipe, &rpf->entity, dl, rpf->alpha);
vsp1_pipeline_propagate_alpha(pipe, dl, rpf->alpha);

vsp1_rpf_write(rpf, dl, VI6_RPF_MSK_CTRL, 0);
vsp1_rpf_write(rpf, dl, VI6_RPF_CKEY_CTRL, 0);
4 changes: 3 additions & 1 deletion drivers/media/platform/vsp1/vsp1_uds.c
Original file line number Diff line number Diff line change
@@ -40,9 +40,11 @@ static inline void vsp1_uds_write(struct vsp1_uds *uds, struct vsp1_dl_list *dl,
* Scaling Computation
*/

void vsp1_uds_set_alpha(struct vsp1_uds *uds, struct vsp1_dl_list *dl,
void vsp1_uds_set_alpha(struct vsp1_entity *entity, struct vsp1_dl_list *dl,
unsigned int alpha)
{
struct vsp1_uds *uds = to_uds(&entity->subdev);

vsp1_uds_write(uds, dl, VI6_UDS_ALPVAL,
alpha << VI6_UDS_ALPVAL_VAL0_SHIFT);
}
2 changes: 1 addition & 1 deletion drivers/media/platform/vsp1/vsp1_uds.h
Original file line number Diff line number Diff line change
@@ -35,7 +35,7 @@ static inline struct vsp1_uds *to_uds(struct v4l2_subdev *subdev)

struct vsp1_uds *vsp1_uds_create(struct vsp1_device *vsp1, unsigned int index);

void vsp1_uds_set_alpha(struct vsp1_uds *uds, struct vsp1_dl_list *dl,
void vsp1_uds_set_alpha(struct vsp1_entity *uds, struct vsp1_dl_list *dl,
unsigned int alpha);

#endif /* __VSP1_UDS_H__ */

0 comments on commit 07a23c6

Please sign in to comment.