Commit 4467bd9e authored by Laurent Pinchart's avatar Laurent Pinchart

media: renesas: vsp1: Get configuration from partition instead of state

Entities access various piece of information from the subdev state when
configuring a partition. The same data is available through the
partition structure passed to the .configure_partition() operation. Use
it to avoid accessing the state, which will simplify moving to the V4L2
subdev active state API.
Signed-off-by: default avatarLaurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
Reviewed-by: default avatarJacopo Mondi <jacopo.mondi+renesas@ideasonboard.com>
parent 0656babf
...@@ -289,7 +289,7 @@ static void rpf_configure_partition(struct vsp1_entity *entity, ...@@ -289,7 +289,7 @@ static void rpf_configure_partition(struct vsp1_entity *entity,
struct vsp1_device *vsp1 = rpf->entity.vsp1; struct vsp1_device *vsp1 = rpf->entity.vsp1;
const struct vsp1_format_info *fmtinfo = rpf->fmtinfo; const struct vsp1_format_info *fmtinfo = rpf->fmtinfo;
const struct v4l2_pix_format_mplane *format = &rpf->format; const struct v4l2_pix_format_mplane *format = &rpf->format;
struct v4l2_rect crop; struct v4l2_rect crop = partition->rpf[rpf->entity.index];
/* /*
* Source size and crop offsets. * Source size and crop offsets.
...@@ -299,22 +299,6 @@ static void rpf_configure_partition(struct vsp1_entity *entity, ...@@ -299,22 +299,6 @@ static void rpf_configure_partition(struct vsp1_entity *entity,
* offsets are needed, as planes 2 and 3 always have identical * offsets are needed, as planes 2 and 3 always have identical
* strides. * strides.
*/ */
crop = *v4l2_subdev_state_get_crop(rpf->entity.state, RWPF_PAD_SINK);
/*
* Partition Algorithm Control
*
* The partition algorithm can split this frame into multiple
* slices. We must scale our partition window based on the pipe
* configuration to match the destination partition window.
* To achieve this, we adjust our crop to provide a 'sub-crop'
* matching the expected partition window. Only 'left' and
* 'width' need to be adjusted.
*/
if (pipe->partitions > 1) {
crop.width = partition->rpf[rpf->entity.index].width;
crop.left += partition->rpf[rpf->entity.index].left;
}
if (pipe->interlaced) { if (pipe->interlaced) {
crop.height = round_down(crop.height / 2, fmtinfo->vsub); crop.height = round_down(crop.height / 2, fmtinfo->vsub);
...@@ -369,8 +353,23 @@ static void rpf_partition(struct vsp1_entity *entity, ...@@ -369,8 +353,23 @@ static void rpf_partition(struct vsp1_entity *entity,
struct v4l2_rect *window) struct v4l2_rect *window)
{ {
struct vsp1_rwpf *rpf = to_rwpf(&entity->subdev); struct vsp1_rwpf *rpf = to_rwpf(&entity->subdev);
struct v4l2_rect *rpf_rect = &partition->rpf[rpf->entity.index];
partition->rpf[rpf->entity.index] = *window; /*
* Partition Algorithm Control
*
* The partition algorithm can split this frame into multiple slices. We
* must adjust our partition window based on the pipe configuration to
* match the destination partition window. To achieve this, we adjust
* our crop to provide a 'sub-crop' matching the expected partition
* window.
*/
*rpf_rect = *v4l2_subdev_state_get_crop(entity->state, RWPF_PAD_SINK);
if (pipe->partitions > 1) {
rpf_rect->width = window->width;
rpf_rect->left += window->left;
}
} }
static const struct vsp1_entity_operations rpf_entity_ops = { static const struct vsp1_entity_operations rpf_entity_ops = {
......
...@@ -305,10 +305,6 @@ static void uds_configure_partition(struct vsp1_entity *entity, ...@@ -305,10 +305,6 @@ static void uds_configure_partition(struct vsp1_entity *entity,
struct vsp1_dl_body *dlb) struct vsp1_dl_body *dlb)
{ {
struct vsp1_uds *uds = to_uds(&entity->subdev); struct vsp1_uds *uds = to_uds(&entity->subdev);
const struct v4l2_mbus_framefmt *output;
output = v4l2_subdev_state_get_format(uds->entity.state,
UDS_PAD_SOURCE);
/* Input size clipping. */ /* Input size clipping. */
vsp1_uds_write(uds, dlb, VI6_UDS_HSZCLIP, VI6_UDS_HSZCLIP_HCEN | vsp1_uds_write(uds, dlb, VI6_UDS_HSZCLIP, VI6_UDS_HSZCLIP_HCEN |
...@@ -320,7 +316,7 @@ static void uds_configure_partition(struct vsp1_entity *entity, ...@@ -320,7 +316,7 @@ static void uds_configure_partition(struct vsp1_entity *entity,
vsp1_uds_write(uds, dlb, VI6_UDS_CLIP_SIZE, vsp1_uds_write(uds, dlb, VI6_UDS_CLIP_SIZE,
(partition->uds_source.width (partition->uds_source.width
<< VI6_UDS_CLIP_SIZE_HSIZE_SHIFT) | << VI6_UDS_CLIP_SIZE_HSIZE_SHIFT) |
(output->height (partition->uds_source.height
<< VI6_UDS_CLIP_SIZE_VSIZE_SHIFT)); << VI6_UDS_CLIP_SIZE_VSIZE_SHIFT));
} }
......
...@@ -370,7 +370,6 @@ static void wpf_configure_partition(struct vsp1_entity *entity, ...@@ -370,7 +370,6 @@ static void wpf_configure_partition(struct vsp1_entity *entity,
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;
struct vsp1_rwpf_memory mem = wpf->mem; struct vsp1_rwpf_memory mem = wpf->mem;
const struct v4l2_mbus_framefmt *sink_format;
const struct v4l2_pix_format_mplane *format = &wpf->format; const struct v4l2_pix_format_mplane *format = &wpf->format;
const struct vsp1_format_info *fmtinfo = wpf->fmtinfo; const struct vsp1_format_info *fmtinfo = wpf->fmtinfo;
unsigned int width; unsigned int width;
...@@ -380,20 +379,13 @@ static void wpf_configure_partition(struct vsp1_entity *entity, ...@@ -380,20 +379,13 @@ static void wpf_configure_partition(struct vsp1_entity *entity,
unsigned int flip; unsigned int flip;
unsigned int i; unsigned int i;
sink_format = v4l2_subdev_state_get_format(wpf->entity.state,
RWPF_PAD_SINK);
width = sink_format->width;
height = sink_format->height;
left = 0;
/* /*
* Cropping. The partition algorithm can split the image into * Cropping. The partition algorithm can split the image into multiple
* multiple slices. * slices.
*/ */
if (pipe->partitions > 1) {
width = partition->wpf.width; width = partition->wpf.width;
left = partition->wpf.left; left = partition->wpf.left;
} height = partition->wpf.height;
vsp1_wpf_write(wpf, dlb, VI6_WPF_HSZCLIP, VI6_WPF_SZCLIP_EN | vsp1_wpf_write(wpf, dlb, VI6_WPF_HSZCLIP, VI6_WPF_SZCLIP_EN |
(0 << VI6_WPF_SZCLIP_OFST_SHIFT) | (0 << VI6_WPF_SZCLIP_OFST_SHIFT) |
......
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