Commit 0aaf7db0 authored by Laurent Pinchart's avatar Laurent Pinchart

media: renesas: vsp1: Drop vsp1_entity_get_pad_format() wrapper

The vsp1_entity_get_pad_format() function is just a wrapper around
v4l2_subdev_state_get_format() without any added value. Drop it and call
v4l2_subdev_state_get_format() directly.
Signed-off-by: default avatarLaurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
Reviewed-by: default avatarJacopo Mondi <jacopo.mondi+renesas@ideasonboard.com>
parent dce86320
...@@ -119,7 +119,7 @@ static void brx_try_format(struct vsp1_brx *brx, ...@@ -119,7 +119,7 @@ static void brx_try_format(struct vsp1_brx *brx,
default: default:
/* The BRx can't perform format conversion. */ /* The BRx can't perform format conversion. */
format = vsp1_entity_get_pad_format(&brx->entity, sd_state, format = v4l2_subdev_state_get_format(sd_state,
BRX_PAD_SINK(0)); BRX_PAD_SINK(0));
fmt->code = format->code; fmt->code = format->code;
break; break;
...@@ -150,7 +150,7 @@ static int brx_set_format(struct v4l2_subdev *subdev, ...@@ -150,7 +150,7 @@ static int brx_set_format(struct v4l2_subdev *subdev,
brx_try_format(brx, state, fmt->pad, &fmt->format); brx_try_format(brx, state, fmt->pad, &fmt->format);
format = vsp1_entity_get_pad_format(&brx->entity, state, fmt->pad); format = v4l2_subdev_state_get_format(state, fmt->pad);
*format = fmt->format; *format = fmt->format;
/* Reset the compose rectangle. */ /* Reset the compose rectangle. */
...@@ -169,8 +169,7 @@ static int brx_set_format(struct v4l2_subdev *subdev, ...@@ -169,8 +169,7 @@ static int brx_set_format(struct v4l2_subdev *subdev,
unsigned int i; unsigned int i;
for (i = 0; i <= brx->entity.source_pad; ++i) { for (i = 0; i <= brx->entity.source_pad; ++i) {
format = vsp1_entity_get_pad_format(&brx->entity, format = v4l2_subdev_state_get_format(state, i);
state, i);
format->code = fmt->format.code; format->code = fmt->format.code;
} }
} }
...@@ -242,8 +241,7 @@ static int brx_set_selection(struct v4l2_subdev *subdev, ...@@ -242,8 +241,7 @@ static int brx_set_selection(struct v4l2_subdev *subdev,
* The compose rectangle top left corner must be inside the output * The compose rectangle top left corner must be inside the output
* frame. * frame.
*/ */
format = vsp1_entity_get_pad_format(&brx->entity, state, format = v4l2_subdev_state_get_format(state, brx->entity.source_pad);
brx->entity.source_pad);
sel->r.left = clamp_t(unsigned int, sel->r.left, 0, format->width - 1); sel->r.left = clamp_t(unsigned int, sel->r.left, 0, format->width - 1);
sel->r.top = clamp_t(unsigned int, sel->r.top, 0, format->height - 1); sel->r.top = clamp_t(unsigned int, sel->r.top, 0, format->height - 1);
...@@ -251,7 +249,7 @@ static int brx_set_selection(struct v4l2_subdev *subdev, ...@@ -251,7 +249,7 @@ static int brx_set_selection(struct v4l2_subdev *subdev,
* Scaling isn't supported, the compose rectangle size must be identical * Scaling isn't supported, the compose rectangle size must be identical
* to the sink format size. * to the sink format size.
*/ */
format = vsp1_entity_get_pad_format(&brx->entity, state, sel->pad); format = v4l2_subdev_state_get_format(state, sel->pad);
sel->r.width = format->width; sel->r.width = format->width;
sel->r.height = format->height; sel->r.height = format->height;
...@@ -290,7 +288,7 @@ static void brx_configure_stream(struct vsp1_entity *entity, ...@@ -290,7 +288,7 @@ static void brx_configure_stream(struct vsp1_entity *entity,
unsigned int flags; unsigned int flags;
unsigned int i; unsigned int i;
format = vsp1_entity_get_pad_format(&brx->entity, brx->entity.state, format = v4l2_subdev_state_get_format(brx->entity.state,
brx->entity.source_pad); brx->entity.source_pad);
/* /*
......
...@@ -181,8 +181,7 @@ static void clu_configure_stream(struct vsp1_entity *entity, ...@@ -181,8 +181,7 @@ static void clu_configure_stream(struct vsp1_entity *entity,
* The yuv_mode can't be changed during streaming. Cache it internally * The yuv_mode can't be changed during streaming. Cache it internally
* for future runtime configuration calls. * for future runtime configuration calls.
*/ */
format = vsp1_entity_get_pad_format(&clu->entity, clu->entity.state, format = v4l2_subdev_state_get_format(clu->entity.state, 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;
} }
......
...@@ -127,23 +127,6 @@ vsp1_entity_get_state(struct vsp1_entity *entity, ...@@ -127,23 +127,6 @@ vsp1_entity_get_state(struct vsp1_entity *entity,
} }
} }
/**
* vsp1_entity_get_pad_format - Get a pad format from storage for an entity
* @entity: the entity
* @sd_state: the state storage
* @pad: the pad number
*
* Return the format stored in the given configuration for an entity's pad. The
* configuration can be an ACTIVE or TRY configuration.
*/
struct v4l2_mbus_framefmt *
vsp1_entity_get_pad_format(struct vsp1_entity *entity,
struct v4l2_subdev_state *sd_state,
unsigned int pad)
{
return v4l2_subdev_state_get_format(sd_state, pad);
}
/** /**
* vsp1_entity_get_pad_selection - Get a pad selection from storage for entity * vsp1_entity_get_pad_selection - Get a pad selection from storage for entity
* @entity: the entity * @entity: the entity
...@@ -191,7 +174,7 @@ int vsp1_subdev_get_pad_format(struct v4l2_subdev *subdev, ...@@ -191,7 +174,7 @@ int vsp1_subdev_get_pad_format(struct v4l2_subdev *subdev,
return -EINVAL; return -EINVAL;
mutex_lock(&entity->lock); mutex_lock(&entity->lock);
fmt->format = *vsp1_entity_get_pad_format(entity, state, fmt->pad); fmt->format = *v4l2_subdev_state_get_format(state, fmt->pad);
mutex_unlock(&entity->lock); mutex_unlock(&entity->lock);
return 0; return 0;
...@@ -238,7 +221,7 @@ int vsp1_subdev_enum_mbus_code(struct v4l2_subdev *subdev, ...@@ -238,7 +221,7 @@ int vsp1_subdev_enum_mbus_code(struct v4l2_subdev *subdev,
return -EINVAL; return -EINVAL;
mutex_lock(&entity->lock); mutex_lock(&entity->lock);
format = vsp1_entity_get_pad_format(entity, state, 0); format = v4l2_subdev_state_get_format(state, 0);
code->code = format->code; code->code = format->code;
mutex_unlock(&entity->lock); mutex_unlock(&entity->lock);
} }
...@@ -276,7 +259,7 @@ int vsp1_subdev_enum_frame_size(struct v4l2_subdev *subdev, ...@@ -276,7 +259,7 @@ int vsp1_subdev_enum_frame_size(struct v4l2_subdev *subdev,
if (!state) if (!state)
return -EINVAL; return -EINVAL;
format = vsp1_entity_get_pad_format(entity, state, fse->pad); format = v4l2_subdev_state_get_format(state, fse->pad);
mutex_lock(&entity->lock); mutex_lock(&entity->lock);
...@@ -346,7 +329,7 @@ int vsp1_subdev_set_pad_format(struct v4l2_subdev *subdev, ...@@ -346,7 +329,7 @@ int vsp1_subdev_set_pad_format(struct v4l2_subdev *subdev,
goto done; goto done;
} }
format = vsp1_entity_get_pad_format(entity, state, fmt->pad); format = v4l2_subdev_state_get_format(state, fmt->pad);
if (fmt->pad == entity->source_pad) { if (fmt->pad == entity->source_pad) {
/* The output format can't be modified. */ /* The output format can't be modified. */
...@@ -374,7 +357,7 @@ int vsp1_subdev_set_pad_format(struct v4l2_subdev *subdev, ...@@ -374,7 +357,7 @@ int vsp1_subdev_set_pad_format(struct v4l2_subdev *subdev,
fmt->format = *format; fmt->format = *format;
/* Propagate the format to the source pad. */ /* Propagate the format to the source pad. */
format = vsp1_entity_get_pad_format(entity, state, entity->source_pad); format = v4l2_subdev_state_get_format(state, entity->source_pad);
*format = fmt->format; *format = fmt->format;
/* Reset the crop and compose rectangles. */ /* Reset the crop and compose rectangles. */
......
...@@ -138,10 +138,6 @@ struct v4l2_subdev_state * ...@@ -138,10 +138,6 @@ struct v4l2_subdev_state *
vsp1_entity_get_state(struct vsp1_entity *entity, vsp1_entity_get_state(struct vsp1_entity *entity,
struct v4l2_subdev_state *sd_state, struct v4l2_subdev_state *sd_state,
enum v4l2_subdev_format_whence which); enum v4l2_subdev_format_whence which);
struct v4l2_mbus_framefmt *
vsp1_entity_get_pad_format(struct vsp1_entity *entity,
struct v4l2_subdev_state *sd_state,
unsigned int pad);
struct v4l2_rect * struct v4l2_rect *
vsp1_entity_get_pad_selection(struct vsp1_entity *entity, vsp1_entity_get_pad_selection(struct vsp1_entity *entity,
struct v4l2_subdev_state *sd_state, struct v4l2_subdev_state *sd_state,
......
...@@ -229,8 +229,7 @@ static int histo_get_selection(struct v4l2_subdev *subdev, ...@@ -229,8 +229,7 @@ static int histo_get_selection(struct v4l2_subdev *subdev,
case V4L2_SEL_TGT_CROP_BOUNDS: case V4L2_SEL_TGT_CROP_BOUNDS:
case V4L2_SEL_TGT_CROP_DEFAULT: case V4L2_SEL_TGT_CROP_DEFAULT:
format = vsp1_entity_get_pad_format(&histo->entity, state, format = v4l2_subdev_state_get_format(state, HISTO_PAD_SINK);
HISTO_PAD_SINK);
sel->r.left = 0; sel->r.left = 0;
sel->r.top = 0; sel->r.top = 0;
sel->r.width = format->width; sel->r.width = format->width;
...@@ -262,8 +261,7 @@ static int histo_set_crop(struct v4l2_subdev *subdev, ...@@ -262,8 +261,7 @@ static int histo_set_crop(struct v4l2_subdev *subdev,
struct v4l2_rect *selection; struct v4l2_rect *selection;
/* The crop rectangle must be inside the input frame. */ /* The crop rectangle must be inside the input frame. */
format = vsp1_entity_get_pad_format(&histo->entity, sd_state, format = v4l2_subdev_state_get_format(sd_state, HISTO_PAD_SINK);
HISTO_PAD_SINK);
sel->r.left = clamp_t(unsigned int, sel->r.left, 0, format->width - 1); sel->r.left = clamp_t(unsigned int, sel->r.left, 0, format->width - 1);
sel->r.top = clamp_t(unsigned int, sel->r.top, 0, format->height - 1); sel->r.top = clamp_t(unsigned int, sel->r.top, 0, format->height - 1);
sel->r.width = clamp_t(unsigned int, sel->r.width, HISTO_MIN_SIZE, sel->r.width = clamp_t(unsigned int, sel->r.width, HISTO_MIN_SIZE,
......
...@@ -78,7 +78,7 @@ static int hsit_set_format(struct v4l2_subdev *subdev, ...@@ -78,7 +78,7 @@ static int hsit_set_format(struct v4l2_subdev *subdev,
goto done; goto done;
} }
format = vsp1_entity_get_pad_format(&hsit->entity, state, fmt->pad); format = v4l2_subdev_state_get_format(state, fmt->pad);
if (fmt->pad == HSIT_PAD_SOURCE) { if (fmt->pad == HSIT_PAD_SOURCE) {
/* /*
...@@ -101,8 +101,7 @@ static int hsit_set_format(struct v4l2_subdev *subdev, ...@@ -101,8 +101,7 @@ static int hsit_set_format(struct v4l2_subdev *subdev,
fmt->format = *format; fmt->format = *format;
/* Propagate the format to the source pad. */ /* Propagate the format to the source pad. */
format = vsp1_entity_get_pad_format(&hsit->entity, state, format = v4l2_subdev_state_get_format(state, HSIT_PAD_SOURCE);
HSIT_PAD_SOURCE);
*format = fmt->format; *format = fmt->format;
format->code = hsit->inverse ? MEDIA_BUS_FMT_ARGB8888_1X32 format->code = hsit->inverse ? MEDIA_BUS_FMT_ARGB8888_1X32
: MEDIA_BUS_FMT_AHSV8888_1X32; : MEDIA_BUS_FMT_AHSV8888_1X32;
......
...@@ -93,7 +93,7 @@ static void lif_configure_stream(struct vsp1_entity *entity, ...@@ -93,7 +93,7 @@ static void lif_configure_stream(struct vsp1_entity *entity,
unsigned int obth; unsigned int obth;
unsigned int lbth; unsigned int lbth;
format = vsp1_entity_get_pad_format(&lif->entity, lif->entity.state, format = v4l2_subdev_state_get_format(lif->entity.state,
LIF_PAD_SOURCE); LIF_PAD_SOURCE);
switch (entity->vsp1->version & VI6_IP_VERSION_MODEL_MASK) { switch (entity->vsp1->version & VI6_IP_VERSION_MODEL_MASK) {
......
...@@ -80,11 +80,9 @@ static void rpf_configure_stream(struct vsp1_entity *entity, ...@@ -80,11 +80,9 @@ static void rpf_configure_stream(struct vsp1_entity *entity,
vsp1_rpf_write(rpf, dlb, VI6_RPF_SRCM_PSTRIDE, pstride); vsp1_rpf_write(rpf, dlb, VI6_RPF_SRCM_PSTRIDE, pstride);
/* Format */ /* Format */
sink_format = vsp1_entity_get_pad_format(&rpf->entity, sink_format = v4l2_subdev_state_get_format(rpf->entity.state,
rpf->entity.state,
RWPF_PAD_SINK); RWPF_PAD_SINK);
source_format = vsp1_entity_get_pad_format(&rpf->entity, source_format = v4l2_subdev_state_get_format(rpf->entity.state,
rpf->entity.state,
RWPF_PAD_SOURCE); RWPF_PAD_SOURCE);
infmt = VI6_RPF_INFMT_CIPM infmt = VI6_RPF_INFMT_CIPM
......
...@@ -79,7 +79,7 @@ static int vsp1_rwpf_set_format(struct v4l2_subdev *subdev, ...@@ -79,7 +79,7 @@ static int vsp1_rwpf_set_format(struct v4l2_subdev *subdev,
fmt->format.code != MEDIA_BUS_FMT_AYUV8_1X32) fmt->format.code != MEDIA_BUS_FMT_AYUV8_1X32)
fmt->format.code = MEDIA_BUS_FMT_AYUV8_1X32; fmt->format.code = MEDIA_BUS_FMT_AYUV8_1X32;
format = vsp1_entity_get_pad_format(&rwpf->entity, state, fmt->pad); format = v4l2_subdev_state_get_format(state, fmt->pad);
if (fmt->pad == RWPF_PAD_SOURCE) { if (fmt->pad == RWPF_PAD_SOURCE) {
/* /*
...@@ -113,8 +113,7 @@ static int vsp1_rwpf_set_format(struct v4l2_subdev *subdev, ...@@ -113,8 +113,7 @@ static int vsp1_rwpf_set_format(struct v4l2_subdev *subdev,
} }
/* Propagate the format to the source pad. */ /* Propagate the format to the source pad. */
format = vsp1_entity_get_pad_format(&rwpf->entity, state, format = v4l2_subdev_state_get_format(state, RWPF_PAD_SOURCE);
RWPF_PAD_SOURCE);
*format = fmt->format; *format = fmt->format;
if (rwpf->flip.rotate) { if (rwpf->flip.rotate) {
...@@ -157,8 +156,7 @@ static int vsp1_rwpf_get_selection(struct v4l2_subdev *subdev, ...@@ -157,8 +156,7 @@ static int vsp1_rwpf_get_selection(struct v4l2_subdev *subdev,
break; break;
case V4L2_SEL_TGT_CROP_BOUNDS: case V4L2_SEL_TGT_CROP_BOUNDS:
format = vsp1_entity_get_pad_format(&rwpf->entity, state, format = v4l2_subdev_state_get_format(state, RWPF_PAD_SINK);
RWPF_PAD_SINK);
sel->r.left = 0; sel->r.left = 0;
sel->r.top = 0; sel->r.top = 0;
sel->r.width = format->width; sel->r.width = format->width;
...@@ -204,8 +202,7 @@ static int vsp1_rwpf_set_selection(struct v4l2_subdev *subdev, ...@@ -204,8 +202,7 @@ static int vsp1_rwpf_set_selection(struct v4l2_subdev *subdev,
} }
/* Make sure the crop rectangle is entirely contained in the image. */ /* Make sure the crop rectangle is entirely contained in the image. */
format = vsp1_entity_get_pad_format(&rwpf->entity, state, format = v4l2_subdev_state_get_format(state, RWPF_PAD_SINK);
RWPF_PAD_SINK);
/* /*
* Restrict the crop rectangle coordinates to multiples of 2 to avoid * Restrict the crop rectangle coordinates to multiples of 2 to avoid
...@@ -229,8 +226,7 @@ static int vsp1_rwpf_set_selection(struct v4l2_subdev *subdev, ...@@ -229,8 +226,7 @@ static int vsp1_rwpf_set_selection(struct v4l2_subdev *subdev,
*crop = sel->r; *crop = sel->r;
/* Propagate the format to the source pad. */ /* Propagate the format to the source pad. */
format = vsp1_entity_get_pad_format(&rwpf->entity, state, format = v4l2_subdev_state_get_format(state, RWPF_PAD_SOURCE);
RWPF_PAD_SOURCE);
format->width = crop->width; format->width = crop->width;
format->height = crop->height; format->height = crop->height;
......
...@@ -131,7 +131,7 @@ static int sru_enum_frame_size(struct v4l2_subdev *subdev, ...@@ -131,7 +131,7 @@ static int sru_enum_frame_size(struct v4l2_subdev *subdev,
if (!state) if (!state)
return -EINVAL; return -EINVAL;
format = vsp1_entity_get_pad_format(&sru->entity, state, SRU_PAD_SINK); format = v4l2_subdev_state_get_format(state, SRU_PAD_SINK);
mutex_lock(&sru->entity.lock); mutex_lock(&sru->entity.lock);
...@@ -184,8 +184,7 @@ static void sru_try_format(struct vsp1_sru *sru, ...@@ -184,8 +184,7 @@ static void sru_try_format(struct vsp1_sru *sru,
case SRU_PAD_SOURCE: case SRU_PAD_SOURCE:
/* The SRU can't perform format conversion. */ /* The SRU can't perform format conversion. */
format = vsp1_entity_get_pad_format(&sru->entity, sd_state, format = v4l2_subdev_state_get_format(sd_state, SRU_PAD_SINK);
SRU_PAD_SINK);
fmt->code = format->code; fmt->code = format->code;
/* /*
...@@ -234,13 +233,12 @@ static int sru_set_format(struct v4l2_subdev *subdev, ...@@ -234,13 +233,12 @@ static int sru_set_format(struct v4l2_subdev *subdev,
sru_try_format(sru, state, fmt->pad, &fmt->format); sru_try_format(sru, state, fmt->pad, &fmt->format);
format = vsp1_entity_get_pad_format(&sru->entity, state, fmt->pad); format = v4l2_subdev_state_get_format(state, fmt->pad);
*format = fmt->format; *format = fmt->format;
if (fmt->pad == SRU_PAD_SINK) { if (fmt->pad == SRU_PAD_SINK) {
/* Propagate the format to the source pad. */ /* Propagate the format to the source pad. */
format = vsp1_entity_get_pad_format(&sru->entity, state, format = v4l2_subdev_state_get_format(state, SRU_PAD_SOURCE);
SRU_PAD_SOURCE);
*format = fmt->format; *format = fmt->format;
sru_try_format(sru, state, SRU_PAD_SOURCE, format); sru_try_format(sru, state, SRU_PAD_SOURCE, format);
...@@ -277,9 +275,8 @@ static void sru_configure_stream(struct vsp1_entity *entity, ...@@ -277,9 +275,8 @@ static void sru_configure_stream(struct vsp1_entity *entity,
struct v4l2_mbus_framefmt *output; struct v4l2_mbus_framefmt *output;
u32 ctrl0; u32 ctrl0;
input = vsp1_entity_get_pad_format(&sru->entity, sru->entity.state, input = v4l2_subdev_state_get_format(sru->entity.state, SRU_PAD_SINK);
SRU_PAD_SINK); output = v4l2_subdev_state_get_format(sru->entity.state,
output = vsp1_entity_get_pad_format(&sru->entity, sru->entity.state,
SRU_PAD_SOURCE); SRU_PAD_SOURCE);
if (input->code == MEDIA_BUS_FMT_ARGB8888_1X32) if (input->code == MEDIA_BUS_FMT_ARGB8888_1X32)
...@@ -307,9 +304,8 @@ static unsigned int sru_max_width(struct vsp1_entity *entity, ...@@ -307,9 +304,8 @@ static unsigned int sru_max_width(struct vsp1_entity *entity,
struct v4l2_mbus_framefmt *input; struct v4l2_mbus_framefmt *input;
struct v4l2_mbus_framefmt *output; struct v4l2_mbus_framefmt *output;
input = vsp1_entity_get_pad_format(&sru->entity, sru->entity.state, input = v4l2_subdev_state_get_format(sru->entity.state, SRU_PAD_SINK);
SRU_PAD_SINK); output = v4l2_subdev_state_get_format(sru->entity.state,
output = vsp1_entity_get_pad_format(&sru->entity, sru->entity.state,
SRU_PAD_SOURCE); SRU_PAD_SOURCE);
/* /*
...@@ -333,9 +329,8 @@ static void sru_partition(struct vsp1_entity *entity, ...@@ -333,9 +329,8 @@ static void sru_partition(struct vsp1_entity *entity,
struct v4l2_mbus_framefmt *input; struct v4l2_mbus_framefmt *input;
struct v4l2_mbus_framefmt *output; struct v4l2_mbus_framefmt *output;
input = vsp1_entity_get_pad_format(&sru->entity, sru->entity.state, input = v4l2_subdev_state_get_format(sru->entity.state, SRU_PAD_SINK);
SRU_PAD_SINK); output = v4l2_subdev_state_get_format(sru->entity.state,
output = vsp1_entity_get_pad_format(&sru->entity, sru->entity.state,
SRU_PAD_SOURCE); SRU_PAD_SOURCE);
/* Adapt if SRUx2 is enabled. */ /* Adapt if SRUx2 is enabled. */
......
...@@ -136,7 +136,7 @@ static int uds_enum_frame_size(struct v4l2_subdev *subdev, ...@@ -136,7 +136,7 @@ static int uds_enum_frame_size(struct v4l2_subdev *subdev,
if (!state) if (!state)
return -EINVAL; return -EINVAL;
format = vsp1_entity_get_pad_format(&uds->entity, state, UDS_PAD_SINK); format = v4l2_subdev_state_get_format(state, UDS_PAD_SINK);
mutex_lock(&uds->entity.lock); mutex_lock(&uds->entity.lock);
...@@ -183,8 +183,7 @@ static void uds_try_format(struct vsp1_uds *uds, ...@@ -183,8 +183,7 @@ static void uds_try_format(struct vsp1_uds *uds,
case UDS_PAD_SOURCE: case UDS_PAD_SOURCE:
/* The UDS scales but can't perform format conversion. */ /* The UDS scales but can't perform format conversion. */
format = vsp1_entity_get_pad_format(&uds->entity, sd_state, format = v4l2_subdev_state_get_format(sd_state, UDS_PAD_SINK);
UDS_PAD_SINK);
fmt->code = format->code; fmt->code = format->code;
uds_output_limits(format->width, &minimum, &maximum); uds_output_limits(format->width, &minimum, &maximum);
...@@ -217,13 +216,12 @@ static int uds_set_format(struct v4l2_subdev *subdev, ...@@ -217,13 +216,12 @@ static int uds_set_format(struct v4l2_subdev *subdev,
uds_try_format(uds, state, fmt->pad, &fmt->format); uds_try_format(uds, state, fmt->pad, &fmt->format);
format = vsp1_entity_get_pad_format(&uds->entity, state, fmt->pad); format = v4l2_subdev_state_get_format(state, fmt->pad);
*format = fmt->format; *format = fmt->format;
if (fmt->pad == UDS_PAD_SINK) { if (fmt->pad == UDS_PAD_SINK) {
/* Propagate the format to the source pad. */ /* Propagate the format to the source pad. */
format = vsp1_entity_get_pad_format(&uds->entity, state, format = v4l2_subdev_state_get_format(state, UDS_PAD_SOURCE);
UDS_PAD_SOURCE);
*format = fmt->format; *format = fmt->format;
uds_try_format(uds, state, UDS_PAD_SOURCE, format); uds_try_format(uds, state, UDS_PAD_SOURCE, format);
...@@ -265,9 +263,8 @@ static void uds_configure_stream(struct vsp1_entity *entity, ...@@ -265,9 +263,8 @@ static void uds_configure_stream(struct vsp1_entity *entity,
unsigned int vscale; unsigned int vscale;
bool multitap; bool multitap;
input = vsp1_entity_get_pad_format(&uds->entity, uds->entity.state, input = v4l2_subdev_state_get_format(uds->entity.state, UDS_PAD_SINK);
UDS_PAD_SINK); output = v4l2_subdev_state_get_format(uds->entity.state,
output = vsp1_entity_get_pad_format(&uds->entity, uds->entity.state,
UDS_PAD_SOURCE); UDS_PAD_SOURCE);
hscale = uds_compute_ratio(input->width, output->width); hscale = uds_compute_ratio(input->width, output->width);
...@@ -310,7 +307,7 @@ static void uds_configure_partition(struct vsp1_entity *entity, ...@@ -310,7 +307,7 @@ static void uds_configure_partition(struct vsp1_entity *entity,
struct vsp1_partition *partition = pipe->partition; struct vsp1_partition *partition = pipe->partition;
const struct v4l2_mbus_framefmt *output; const struct v4l2_mbus_framefmt *output;
output = vsp1_entity_get_pad_format(&uds->entity, uds->entity.state, output = v4l2_subdev_state_get_format(uds->entity.state,
UDS_PAD_SOURCE); UDS_PAD_SOURCE);
/* Input size clipping. */ /* Input size clipping. */
...@@ -335,9 +332,8 @@ static unsigned int uds_max_width(struct vsp1_entity *entity, ...@@ -335,9 +332,8 @@ static unsigned int uds_max_width(struct vsp1_entity *entity,
const struct v4l2_mbus_framefmt *input; const struct v4l2_mbus_framefmt *input;
unsigned int hscale; unsigned int hscale;
input = vsp1_entity_get_pad_format(&uds->entity, uds->entity.state, input = v4l2_subdev_state_get_format(uds->entity.state, UDS_PAD_SINK);
UDS_PAD_SINK); output = v4l2_subdev_state_get_format(uds->entity.state,
output = vsp1_entity_get_pad_format(&uds->entity, uds->entity.state,
UDS_PAD_SOURCE); UDS_PAD_SOURCE);
hscale = output->width / input->width; hscale = output->width / input->width;
...@@ -377,9 +373,8 @@ static void uds_partition(struct vsp1_entity *entity, ...@@ -377,9 +373,8 @@ static void uds_partition(struct vsp1_entity *entity,
partition->uds_sink = *window; partition->uds_sink = *window;
partition->uds_source = *window; partition->uds_source = *window;
input = vsp1_entity_get_pad_format(&uds->entity, uds->entity.state, input = v4l2_subdev_state_get_format(uds->entity.state, UDS_PAD_SINK);
UDS_PAD_SINK); output = v4l2_subdev_state_get_format(uds->entity.state,
output = vsp1_entity_get_pad_format(&uds->entity, uds->entity.state,
UDS_PAD_SOURCE); UDS_PAD_SOURCE);
partition->uds_sink.width = window->width * input->width partition->uds_sink.width = window->width * input->width
......
...@@ -104,8 +104,7 @@ static int uif_get_selection(struct v4l2_subdev *subdev, ...@@ -104,8 +104,7 @@ static int uif_get_selection(struct v4l2_subdev *subdev,
switch (sel->target) { switch (sel->target) {
case V4L2_SEL_TGT_CROP_BOUNDS: case V4L2_SEL_TGT_CROP_BOUNDS:
case V4L2_SEL_TGT_CROP_DEFAULT: case V4L2_SEL_TGT_CROP_DEFAULT:
format = vsp1_entity_get_pad_format(&uif->entity, state, format = v4l2_subdev_state_get_format(state, UIF_PAD_SINK);
UIF_PAD_SINK);
sel->r.left = 0; sel->r.left = 0;
sel->r.top = 0; sel->r.top = 0;
sel->r.width = format->width; sel->r.width = format->width;
...@@ -150,7 +149,7 @@ static int uif_set_selection(struct v4l2_subdev *subdev, ...@@ -150,7 +149,7 @@ static int uif_set_selection(struct v4l2_subdev *subdev,
} }
/* The crop rectangle must be inside the input frame. */ /* The crop rectangle must be inside the input frame. */
format = vsp1_entity_get_pad_format(&uif->entity, state, UIF_PAD_SINK); format = v4l2_subdev_state_get_format(state, UIF_PAD_SINK);
sel->r.left = clamp_t(unsigned int, sel->r.left, 0, format->width - 1); sel->r.left = clamp_t(unsigned int, sel->r.left, 0, format->width - 1);
sel->r.top = clamp_t(unsigned int, sel->r.top, 0, format->height - 1); sel->r.top = clamp_t(unsigned int, sel->r.top, 0, format->height - 1);
......
...@@ -203,8 +203,7 @@ static void vsp1_video_calculate_partition(struct vsp1_pipeline *pipe, ...@@ -203,8 +203,7 @@ static void vsp1_video_calculate_partition(struct vsp1_pipeline *pipe,
* Partitions are computed on the size before rotation, use the format * Partitions are computed on the size before rotation, use the format
* at the WPF sink. * at the WPF sink.
*/ */
format = vsp1_entity_get_pad_format(&pipe->output->entity, format = v4l2_subdev_state_get_format(pipe->output->entity.state,
pipe->output->entity.state,
RWPF_PAD_SINK); RWPF_PAD_SINK);
/* A single partition simply processes the output size in full. */ /* A single partition simply processes the output size in full. */
...@@ -268,8 +267,7 @@ static int vsp1_video_pipeline_setup_partitions(struct vsp1_pipeline *pipe) ...@@ -268,8 +267,7 @@ static int vsp1_video_pipeline_setup_partitions(struct vsp1_pipeline *pipe)
* Partitions are computed on the size before rotation, use the format * Partitions are computed on the size before rotation, use the format
* at the WPF sink. * at the WPF sink.
*/ */
format = vsp1_entity_get_pad_format(&pipe->output->entity, format = v4l2_subdev_state_get_format(pipe->output->entity.state,
pipe->output->entity.state,
RWPF_PAD_SINK); RWPF_PAD_SINK);
div_size = format->width; div_size = format->width;
......
...@@ -65,11 +65,9 @@ static int vsp1_wpf_set_rotation(struct vsp1_rwpf *wpf, unsigned int rotation) ...@@ -65,11 +65,9 @@ static int vsp1_wpf_set_rotation(struct vsp1_rwpf *wpf, unsigned int rotation)
goto done; goto done;
} }
sink_format = vsp1_entity_get_pad_format(&wpf->entity, sink_format = v4l2_subdev_state_get_format(wpf->entity.state,
wpf->entity.state,
RWPF_PAD_SINK); RWPF_PAD_SINK);
source_format = vsp1_entity_get_pad_format(&wpf->entity, source_format = v4l2_subdev_state_get_format(wpf->entity.state,
wpf->entity.state,
RWPF_PAD_SOURCE); RWPF_PAD_SOURCE);
mutex_lock(&wpf->entity.lock); mutex_lock(&wpf->entity.lock);
...@@ -245,11 +243,9 @@ static void wpf_configure_stream(struct vsp1_entity *entity, ...@@ -245,11 +243,9 @@ static void wpf_configure_stream(struct vsp1_entity *entity,
u32 srcrpf = 0; u32 srcrpf = 0;
int ret; int ret;
sink_format = vsp1_entity_get_pad_format(&wpf->entity, sink_format = v4l2_subdev_state_get_format(wpf->entity.state,
wpf->entity.state,
RWPF_PAD_SINK); RWPF_PAD_SINK);
source_format = vsp1_entity_get_pad_format(&wpf->entity, source_format = v4l2_subdev_state_get_format(wpf->entity.state,
wpf->entity.state,
RWPF_PAD_SOURCE); RWPF_PAD_SOURCE);
/* Format */ /* Format */
...@@ -383,8 +379,7 @@ static void wpf_configure_partition(struct vsp1_entity *entity, ...@@ -383,8 +379,7 @@ static void wpf_configure_partition(struct vsp1_entity *entity,
unsigned int flip; unsigned int flip;
unsigned int i; unsigned int i;
sink_format = vsp1_entity_get_pad_format(&wpf->entity, sink_format = v4l2_subdev_state_get_format(wpf->entity.state,
wpf->entity.state,
RWPF_PAD_SINK); RWPF_PAD_SINK);
width = sink_format->width; width = sink_format->width;
height = sink_format->height; height = sink_format->height;
......
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