Skip to content

Commit

Permalink
[media] v4l: vsp1: rwpf: Support runtime modification of controls
Browse files Browse the repository at this point in the history
Allow reconfiguration of the alpha value at runtime.

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 07a23c6 commit d05a331
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 14 deletions.
21 changes: 12 additions & 9 deletions drivers/media/platform/vsp1/vsp1_rpf.c
Original file line number Diff line number Diff line change
Expand Up @@ -73,8 +73,15 @@ static void rpf_configure(struct vsp1_entity *entity,
u32 pstride;
u32 infmt;

if (!full)
if (!full) {
vsp1_rpf_write(rpf, dl, VI6_RPF_VRTCOL_SET,
rpf->alpha << VI6_RPF_VRTCOL_SET_LAYA_SHIFT);
vsp1_rpf_write(rpf, dl, VI6_RPF_MULT_ALPHA, rpf->mult_alpha |
(rpf->alpha << VI6_RPF_MULT_ALPHA_RATIO_SHIFT));

vsp1_pipeline_propagate_alpha(pipe, dl, rpf->alpha);
return;
}

/* Source size, stride and crop offsets.
*
Expand Down Expand Up @@ -171,9 +178,6 @@ static void rpf_configure(struct vsp1_entity *entity,
(fmtinfo->alpha ? VI6_RPF_ALPH_SEL_ASEL_PACKED
: VI6_RPF_ALPH_SEL_ASEL_FIXED));

vsp1_rpf_write(rpf, dl, VI6_RPF_VRTCOL_SET,
rpf->alpha << VI6_RPF_VRTCOL_SET_LAYA_SHIFT);

if (entity->vsp1->info->gen == 3) {
u32 mult;

Expand All @@ -191,8 +195,7 @@ static void rpf_configure(struct vsp1_entity *entity,
mult = VI6_RPF_MULT_ALPHA_A_MMD_RATIO
| (premultiplied ?
VI6_RPF_MULT_ALPHA_P_MMD_RATIO :
VI6_RPF_MULT_ALPHA_P_MMD_NONE)
| (rpf->alpha << VI6_RPF_MULT_ALPHA_RATIO_SHIFT);
VI6_RPF_MULT_ALPHA_P_MMD_NONE);
} else {
/* When the input doesn't contain an alpha channel the
* global alpha value is applied in the unpacking unit,
Expand All @@ -203,11 +206,9 @@ static void rpf_configure(struct vsp1_entity *entity,
| VI6_RPF_MULT_ALPHA_P_MMD_NONE;
}

vsp1_rpf_write(rpf, dl, VI6_RPF_MULT_ALPHA, mult);
rpf->mult_alpha = mult;
}

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);

Expand Down Expand Up @@ -253,6 +254,8 @@ struct vsp1_rwpf *vsp1_rpf_create(struct vsp1_device *vsp1, unsigned int index)
goto error;
}

v4l2_ctrl_handler_setup(&rpf->ctrls);

return rpf;

error:
Expand Down
2 changes: 0 additions & 2 deletions drivers/media/platform/vsp1/vsp1_rwpf.c
Original file line number Diff line number Diff line change
Expand Up @@ -243,8 +243,6 @@ static const struct v4l2_ctrl_ops vsp1_rwpf_ctrl_ops = {

int vsp1_rwpf_init_ctrls(struct vsp1_rwpf *rwpf)
{
rwpf->alpha = 255;

v4l2_ctrl_handler_init(&rwpf->ctrls, 1);
v4l2_ctrl_new_std(&rwpf->ctrls, &vsp1_rwpf_ctrl_ops,
V4L2_CID_ALPHA_COMPONENT, 0, 255, 1, 255);
Expand Down
3 changes: 3 additions & 0 deletions drivers/media/platform/vsp1/vsp1_rwpf.h
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,9 @@ struct vsp1_rwpf {

unsigned int alpha;

u32 mult_alpha;
u32 outfmt;

unsigned int offsets[2];
struct vsp1_rwpf_memory mem;

Expand Down
10 changes: 7 additions & 3 deletions drivers/media/platform/vsp1/vsp1_wpf.c
Original file line number Diff line number Diff line change
Expand Up @@ -104,8 +104,11 @@ static void wpf_configure(struct vsp1_entity *entity,
u32 outfmt = 0;
u32 srcrpf = 0;

if (!full)
if (!full) {
vsp1_wpf_write(wpf, dl, VI6_WPF_OUTFMT, wpf->outfmt |
(wpf->alpha << VI6_WPF_OUTFMT_PDV_SHIFT));
return;
}

/* Cropping */
crop = vsp1_rwpf_get_crop(wpf, wpf->entity.config);
Expand Down Expand Up @@ -151,8 +154,7 @@ static void wpf_configure(struct vsp1_entity *entity,
if (sink_format->code != source_format->code)
outfmt |= VI6_WPF_OUTFMT_CSC;

outfmt |= wpf->alpha << VI6_WPF_OUTFMT_PDV_SHIFT;
vsp1_wpf_write(wpf, dl, VI6_WPF_OUTFMT, outfmt);
wpf->outfmt = outfmt;

vsp1_dl_list_write(dl, VI6_DPR_WPF_FPORCH(wpf->entity.index),
VI6_DPR_WPF_FPORCH_FP_WPFN);
Expand Down Expand Up @@ -239,6 +241,8 @@ struct vsp1_rwpf *vsp1_wpf_create(struct vsp1_device *vsp1, unsigned int index)
goto error;
}

v4l2_ctrl_handler_setup(&wpf->ctrls);

return wpf;

error:
Expand Down

0 comments on commit d05a331

Please sign in to comment.