Commit d21fbbb4 authored by Laurent Pinchart's avatar Laurent Pinchart Committed by Mauro Carvalho Chehab

[media] v4l: vsp1: Pass parameter type to entity configuration operation

Replace the current boolean parameter (full / !full) with an explicit
enum.

- VSP1_ENTITY_PARAMS_INIT for parameters to be configured at pipeline
  initialization time only (V4L2 stream on or DRM atomic update)
- VSP1_ENTITY_PARAMS_RUNTIME for all parameters that can be freely
  modified at runtime (through V4L2 controls)

This will allow future extensions when implementing image partitioning
support.
Signed-off-by: default avatarLaurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
Acked-by: default avatarNiklas Söderlund <niklas.soderlund+renesas@ragnatech.se>
Signed-off-by: default avatarMauro Carvalho Chehab <mchehab@s-opensource.com>
parent abe9609f
...@@ -285,14 +285,15 @@ static const struct v4l2_subdev_ops bru_ops = { ...@@ -285,14 +285,15 @@ static const struct v4l2_subdev_ops bru_ops = {
static void bru_configure(struct vsp1_entity *entity, static void bru_configure(struct vsp1_entity *entity,
struct vsp1_pipeline *pipe, struct vsp1_pipeline *pipe,
struct vsp1_dl_list *dl, bool full) struct vsp1_dl_list *dl,
enum vsp1_entity_params params)
{ {
struct vsp1_bru *bru = to_bru(&entity->subdev); struct vsp1_bru *bru = to_bru(&entity->subdev);
struct v4l2_mbus_framefmt *format; struct v4l2_mbus_framefmt *format;
unsigned int flags; unsigned int flags;
unsigned int i; unsigned int i;
if (!full) if (params != VSP1_ENTITY_PARAMS_INIT)
return; return;
format = vsp1_entity_get_pad_format(&bru->entity, bru->entity.config, format = vsp1_entity_get_pad_format(&bru->entity, bru->entity.config,
......
...@@ -214,27 +214,30 @@ static const struct v4l2_subdev_ops clu_ops = { ...@@ -214,27 +214,30 @@ static const struct v4l2_subdev_ops clu_ops = {
static void clu_configure(struct vsp1_entity *entity, static void clu_configure(struct vsp1_entity *entity,
struct vsp1_pipeline *pipe, struct vsp1_pipeline *pipe,
struct vsp1_dl_list *dl, bool full) struct vsp1_dl_list *dl,
enum vsp1_entity_params params)
{ {
struct vsp1_clu *clu = to_clu(&entity->subdev); struct vsp1_clu *clu = to_clu(&entity->subdev);
struct vsp1_dl_body *dlb; struct vsp1_dl_body *dlb;
unsigned long flags; unsigned long flags;
u32 ctrl = VI6_CLU_CTRL_AAI | VI6_CLU_CTRL_MVS | VI6_CLU_CTRL_EN; u32 ctrl = VI6_CLU_CTRL_AAI | VI6_CLU_CTRL_MVS | VI6_CLU_CTRL_EN;
/* The format can't be changed during streaming, only verify it at switch (params) {
* stream start and store the information internally for future partial case VSP1_ENTITY_PARAMS_INIT: {
* reconfiguration calls. /* The format can't be changed during streaming, only verify it
* at setup time and store the information internally for future
* runtime configuration calls.
*/ */
if (full) {
struct v4l2_mbus_framefmt *format; struct v4l2_mbus_framefmt *format;
format = vsp1_entity_get_pad_format(&clu->entity, format = vsp1_entity_get_pad_format(&clu->entity,
clu->entity.config, clu->entity.config,
CLU_PAD_SINK); CLU_PAD_SINK);
clu->yuv_mode = format->code == MEDIA_BUS_FMT_AYUV8_1X32; clu->yuv_mode = format->code == MEDIA_BUS_FMT_AYUV8_1X32;
return; break;
} }
case VSP1_ENTITY_PARAMS_RUNTIME:
/* 2D mode can only be used with the YCbCr pixel encoding. */ /* 2D mode can only be used with the YCbCr pixel encoding. */
if (clu->mode == V4L2_CID_VSP1_CLU_MODE_2D && clu->yuv_mode) if (clu->mode == V4L2_CID_VSP1_CLU_MODE_2D && clu->yuv_mode)
ctrl |= VI6_CLU_CTRL_AX1I_2D | VI6_CLU_CTRL_AX2I_2D ctrl |= VI6_CLU_CTRL_AX1I_2D | VI6_CLU_CTRL_AX2I_2D
...@@ -250,6 +253,8 @@ static void clu_configure(struct vsp1_entity *entity, ...@@ -250,6 +253,8 @@ static void clu_configure(struct vsp1_entity *entity,
if (dlb) if (dlb)
vsp1_dl_list_add_fragment(dl, dlb); vsp1_dl_list_add_fragment(dl, dlb);
break;
}
} }
static const struct vsp1_entity_operations clu_entity_ops = { static const struct vsp1_entity_operations clu_entity_ops = {
......
...@@ -492,8 +492,10 @@ void vsp1_du_atomic_flush(struct device *dev) ...@@ -492,8 +492,10 @@ void vsp1_du_atomic_flush(struct device *dev)
vsp1_entity_route_setup(entity, pipe->dl); vsp1_entity_route_setup(entity, pipe->dl);
if (entity->ops->configure) { if (entity->ops->configure) {
entity->ops->configure(entity, pipe, pipe->dl, true); entity->ops->configure(entity, pipe, pipe->dl,
entity->ops->configure(entity, pipe, pipe->dl, false); VSP1_ENTITY_PARAMS_INIT);
entity->ops->configure(entity, pipe, pipe->dl,
VSP1_ENTITY_PARAMS_RUNTIME);
} }
/* The memory buffer address must be applied after configuring /* The memory buffer address must be applied after configuring
......
...@@ -35,6 +35,16 @@ enum vsp1_entity_type { ...@@ -35,6 +35,16 @@ enum vsp1_entity_type {
VSP1_ENTITY_WPF, VSP1_ENTITY_WPF,
}; };
/*
* enum vsp1_entity_params - Entity configuration parameters class
* @VSP1_ENTITY_PARAMS_INIT - Initial parameters
* @VSP1_ENTITY_PARAMS_RUNTIME - Runtime-configurable parameters
*/
enum vsp1_entity_params {
VSP1_ENTITY_PARAMS_INIT,
VSP1_ENTITY_PARAMS_RUNTIME,
};
#define VSP1_ENTITY_MAX_INPUTS 5 /* For the BRU */ #define VSP1_ENTITY_MAX_INPUTS 5 /* For the BRU */
/* /*
...@@ -73,7 +83,7 @@ struct vsp1_entity_operations { ...@@ -73,7 +83,7 @@ struct vsp1_entity_operations {
void (*destroy)(struct vsp1_entity *); void (*destroy)(struct vsp1_entity *);
void (*set_memory)(struct vsp1_entity *, struct vsp1_dl_list *dl); void (*set_memory)(struct vsp1_entity *, struct vsp1_dl_list *dl);
void (*configure)(struct vsp1_entity *, struct vsp1_pipeline *, void (*configure)(struct vsp1_entity *, struct vsp1_pipeline *,
struct vsp1_dl_list *, bool); struct vsp1_dl_list *, enum vsp1_entity_params);
}; };
struct vsp1_entity { struct vsp1_entity {
......
...@@ -132,11 +132,12 @@ static const struct v4l2_subdev_ops hsit_ops = { ...@@ -132,11 +132,12 @@ static const struct v4l2_subdev_ops hsit_ops = {
static void hsit_configure(struct vsp1_entity *entity, static void hsit_configure(struct vsp1_entity *entity,
struct vsp1_pipeline *pipe, struct vsp1_pipeline *pipe,
struct vsp1_dl_list *dl, bool full) struct vsp1_dl_list *dl,
enum vsp1_entity_params params)
{ {
struct vsp1_hsit *hsit = to_hsit(&entity->subdev); struct vsp1_hsit *hsit = to_hsit(&entity->subdev);
if (!full) if (params != VSP1_ENTITY_PARAMS_INIT)
return; return;
if (hsit->inverse) if (hsit->inverse)
......
...@@ -129,7 +129,8 @@ static const struct v4l2_subdev_ops lif_ops = { ...@@ -129,7 +129,8 @@ static const struct v4l2_subdev_ops lif_ops = {
static void lif_configure(struct vsp1_entity *entity, static void lif_configure(struct vsp1_entity *entity,
struct vsp1_pipeline *pipe, struct vsp1_pipeline *pipe,
struct vsp1_dl_list *dl, bool full) struct vsp1_dl_list *dl,
enum vsp1_entity_params params)
{ {
const struct v4l2_mbus_framefmt *format; const struct v4l2_mbus_framefmt *format;
struct vsp1_lif *lif = to_lif(&entity->subdev); struct vsp1_lif *lif = to_lif(&entity->subdev);
...@@ -137,7 +138,7 @@ static void lif_configure(struct vsp1_entity *entity, ...@@ -137,7 +138,7 @@ static void lif_configure(struct vsp1_entity *entity,
unsigned int obth = 400; unsigned int obth = 400;
unsigned int lbth = 200; unsigned int lbth = 200;
if (!full) if (params != VSP1_ENTITY_PARAMS_INIT)
return; return;
format = vsp1_entity_get_pad_format(&lif->entity, lif->entity.config, format = vsp1_entity_get_pad_format(&lif->entity, lif->entity.config,
......
...@@ -190,17 +190,19 @@ static const struct v4l2_subdev_ops lut_ops = { ...@@ -190,17 +190,19 @@ static const struct v4l2_subdev_ops lut_ops = {
static void lut_configure(struct vsp1_entity *entity, static void lut_configure(struct vsp1_entity *entity,
struct vsp1_pipeline *pipe, struct vsp1_pipeline *pipe,
struct vsp1_dl_list *dl, bool full) struct vsp1_dl_list *dl,
enum vsp1_entity_params params)
{ {
struct vsp1_lut *lut = to_lut(&entity->subdev); struct vsp1_lut *lut = to_lut(&entity->subdev);
struct vsp1_dl_body *dlb; struct vsp1_dl_body *dlb;
unsigned long flags; unsigned long flags;
if (full) { switch (params) {
case VSP1_ENTITY_PARAMS_INIT:
vsp1_lut_write(lut, dl, VI6_LUT_CTRL, VI6_LUT_CTRL_EN); vsp1_lut_write(lut, dl, VI6_LUT_CTRL, VI6_LUT_CTRL_EN);
return; break;
}
case VSP1_ENTITY_PARAMS_RUNTIME:
spin_lock_irqsave(&lut->lock, flags); spin_lock_irqsave(&lut->lock, flags);
dlb = lut->lut; dlb = lut->lut;
lut->lut = NULL; lut->lut = NULL;
...@@ -208,6 +210,8 @@ static void lut_configure(struct vsp1_entity *entity, ...@@ -208,6 +210,8 @@ static void lut_configure(struct vsp1_entity *entity,
if (dlb) if (dlb)
vsp1_dl_list_add_fragment(dl, dlb); vsp1_dl_list_add_fragment(dl, dlb);
break;
}
} }
static const struct vsp1_entity_operations lut_entity_ops = { static const struct vsp1_entity_operations lut_entity_ops = {
......
...@@ -60,7 +60,8 @@ static void rpf_set_memory(struct vsp1_entity *entity, struct vsp1_dl_list *dl) ...@@ -60,7 +60,8 @@ static void rpf_set_memory(struct vsp1_entity *entity, struct vsp1_dl_list *dl)
static void rpf_configure(struct vsp1_entity *entity, static void rpf_configure(struct vsp1_entity *entity,
struct vsp1_pipeline *pipe, struct vsp1_pipeline *pipe,
struct vsp1_dl_list *dl, bool full) struct vsp1_dl_list *dl,
enum vsp1_entity_params params)
{ {
struct vsp1_rwpf *rpf = to_rwpf(&entity->subdev); struct vsp1_rwpf *rpf = to_rwpf(&entity->subdev);
const struct vsp1_format_info *fmtinfo = rpf->fmtinfo; const struct vsp1_format_info *fmtinfo = rpf->fmtinfo;
...@@ -73,7 +74,7 @@ static void rpf_configure(struct vsp1_entity *entity, ...@@ -73,7 +74,7 @@ static void rpf_configure(struct vsp1_entity *entity,
u32 pstride; u32 pstride;
u32 infmt; u32 infmt;
if (!full) { if (params == VSP1_ENTITY_PARAMS_RUNTIME) {
vsp1_rpf_write(rpf, dl, VI6_RPF_VRTCOL_SET, vsp1_rpf_write(rpf, dl, VI6_RPF_VRTCOL_SET,
rpf->alpha << VI6_RPF_VRTCOL_SET_LAYA_SHIFT); rpf->alpha << VI6_RPF_VRTCOL_SET_LAYA_SHIFT);
vsp1_rpf_write(rpf, dl, VI6_RPF_MULT_ALPHA, rpf->mult_alpha | vsp1_rpf_write(rpf, dl, VI6_RPF_MULT_ALPHA, rpf->mult_alpha |
......
...@@ -271,7 +271,8 @@ static const struct v4l2_subdev_ops sru_ops = { ...@@ -271,7 +271,8 @@ static const struct v4l2_subdev_ops sru_ops = {
static void sru_configure(struct vsp1_entity *entity, static void sru_configure(struct vsp1_entity *entity,
struct vsp1_pipeline *pipe, struct vsp1_pipeline *pipe,
struct vsp1_dl_list *dl, bool full) struct vsp1_dl_list *dl,
enum vsp1_entity_params params)
{ {
const struct vsp1_sru_param *param; const struct vsp1_sru_param *param;
struct vsp1_sru *sru = to_sru(&entity->subdev); struct vsp1_sru *sru = to_sru(&entity->subdev);
...@@ -279,7 +280,7 @@ static void sru_configure(struct vsp1_entity *entity, ...@@ -279,7 +280,7 @@ static void sru_configure(struct vsp1_entity *entity,
struct v4l2_mbus_framefmt *output; struct v4l2_mbus_framefmt *output;
u32 ctrl0; u32 ctrl0;
if (!full) if (params != VSP1_ENTITY_PARAMS_INIT)
return; return;
input = vsp1_entity_get_pad_format(&sru->entity, sru->entity.config, input = vsp1_entity_get_pad_format(&sru->entity, sru->entity.config,
......
...@@ -260,7 +260,8 @@ static const struct v4l2_subdev_ops uds_ops = { ...@@ -260,7 +260,8 @@ static const struct v4l2_subdev_ops uds_ops = {
static void uds_configure(struct vsp1_entity *entity, static void uds_configure(struct vsp1_entity *entity,
struct vsp1_pipeline *pipe, struct vsp1_pipeline *pipe,
struct vsp1_dl_list *dl, bool full) struct vsp1_dl_list *dl,
enum vsp1_entity_params params)
{ {
struct vsp1_uds *uds = to_uds(&entity->subdev); struct vsp1_uds *uds = to_uds(&entity->subdev);
const struct v4l2_mbus_framefmt *output; const struct v4l2_mbus_framefmt *output;
...@@ -269,7 +270,7 @@ static void uds_configure(struct vsp1_entity *entity, ...@@ -269,7 +270,7 @@ static void uds_configure(struct vsp1_entity *entity,
unsigned int vscale; unsigned int vscale;
bool multitap; bool multitap;
if (!full) if (params != VSP1_ENTITY_PARAMS_INIT)
return; return;
input = vsp1_entity_get_pad_format(&uds->entity, uds->entity.config, input = vsp1_entity_get_pad_format(&uds->entity, uds->entity.config,
......
...@@ -254,7 +254,8 @@ static void vsp1_video_pipeline_run(struct vsp1_pipeline *pipe) ...@@ -254,7 +254,8 @@ static void vsp1_video_pipeline_run(struct vsp1_pipeline *pipe)
list_for_each_entry(entity, &pipe->entities, list_pipe) { list_for_each_entry(entity, &pipe->entities, list_pipe) {
if (entity->ops->configure) if (entity->ops->configure)
entity->ops->configure(entity, pipe, pipe->dl, false); entity->ops->configure(entity, pipe, pipe->dl,
VSP1_ENTITY_PARAMS_RUNTIME);
} }
for (i = 0; i < vsp1->info->rpf_count; ++i) { for (i = 0; i < vsp1->info->rpf_count; ++i) {
...@@ -629,7 +630,8 @@ static int vsp1_video_setup_pipeline(struct vsp1_pipeline *pipe) ...@@ -629,7 +630,8 @@ static int vsp1_video_setup_pipeline(struct vsp1_pipeline *pipe)
vsp1_entity_route_setup(entity, pipe->dl); vsp1_entity_route_setup(entity, pipe->dl);
if (entity->ops->configure) if (entity->ops->configure)
entity->ops->configure(entity, pipe, pipe->dl, true); entity->ops->configure(entity, pipe, pipe->dl,
VSP1_ENTITY_PARAMS_INIT);
} }
return 0; return 0;
......
...@@ -206,7 +206,8 @@ static void wpf_set_memory(struct vsp1_entity *entity, struct vsp1_dl_list *dl) ...@@ -206,7 +206,8 @@ static void wpf_set_memory(struct vsp1_entity *entity, struct vsp1_dl_list *dl)
static void wpf_configure(struct vsp1_entity *entity, static void wpf_configure(struct vsp1_entity *entity,
struct vsp1_pipeline *pipe, struct vsp1_pipeline *pipe,
struct vsp1_dl_list *dl, bool full) struct vsp1_dl_list *dl,
enum vsp1_entity_params params)
{ {
struct vsp1_rwpf *wpf = to_rwpf(&entity->subdev); struct vsp1_rwpf *wpf = to_rwpf(&entity->subdev);
struct vsp1_device *vsp1 = wpf->entity.vsp1; struct vsp1_device *vsp1 = wpf->entity.vsp1;
...@@ -216,7 +217,7 @@ static void wpf_configure(struct vsp1_entity *entity, ...@@ -216,7 +217,7 @@ static void wpf_configure(struct vsp1_entity *entity,
u32 outfmt = 0; u32 outfmt = 0;
u32 srcrpf = 0; u32 srcrpf = 0;
if (!full) { if (params == VSP1_ENTITY_PARAMS_RUNTIME) {
const unsigned int mask = BIT(WPF_CTRL_VFLIP) const unsigned int mask = BIT(WPF_CTRL_VFLIP)
| BIT(WPF_CTRL_HFLIP); | BIT(WPF_CTRL_HFLIP);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment