From 79b15b4b82013d73e8702d65470419ecbfc7a7b5 Mon Sep 17 00:00:00 2001 From: Laurent Pinchart Date: Thu, 20 Sep 2018 17:54:56 +0100 Subject: [PATCH] media: vsp1: wpf: Fix partition configuration for display pipelines When configuring partitions for memory-to-memory pipelines, the WPF accesses data of the current partition through pipe->partition. Writeback support will require full configuration of the WPF while not providing a valid pipe->partition. Rework the configuration code to fall back to the full image width in that case, as is already done for the part of the configuration currently relevant for display pipelines. Signed-off-by: Laurent Pinchart Reviewed-by: Kieran Bingham Reviewed-by: Mauro Carvalho Chehab --- drivers/media/platform/vsp1/vsp1_wpf.c | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/drivers/media/platform/vsp1/vsp1_wpf.c b/drivers/media/platform/vsp1/vsp1_wpf.c index 32bb207b2007..a07c5944b598 100644 --- a/drivers/media/platform/vsp1/vsp1_wpf.c +++ b/drivers/media/platform/vsp1/vsp1_wpf.c @@ -362,6 +362,7 @@ static void wpf_configure_partition(struct vsp1_entity *entity, const struct vsp1_format_info *fmtinfo = wpf->fmtinfo; unsigned int width; unsigned int height; + unsigned int left; unsigned int offset; unsigned int flip; unsigned int i; @@ -371,13 +372,16 @@ static void wpf_configure_partition(struct vsp1_entity *entity, RWPF_PAD_SINK); width = sink_format->width; height = sink_format->height; + left = 0; /* * Cropping. The partition algorithm can split the image into * multiple slices. */ - if (pipe->partitions > 1) + if (pipe->partitions > 1) { width = pipe->partition->wpf.width; + left = pipe->partition->wpf.left; + } vsp1_wpf_write(wpf, dlb, VI6_WPF_HSZCLIP, VI6_WPF_SZCLIP_EN | (0 << VI6_WPF_SZCLIP_OFST_SHIFT) | @@ -408,13 +412,11 @@ static void wpf_configure_partition(struct vsp1_entity *entity, flip = wpf->flip.active; if (flip & BIT(WPF_CTRL_HFLIP) && !wpf->flip.rotate) - offset = format->width - pipe->partition->wpf.left - - pipe->partition->wpf.width; + offset = format->width - left - width; else if (flip & BIT(WPF_CTRL_VFLIP) && wpf->flip.rotate) - offset = format->height - pipe->partition->wpf.left - - pipe->partition->wpf.width; + offset = format->height - left - width; else - offset = pipe->partition->wpf.left; + offset = left; for (i = 0; i < format->num_planes; ++i) { unsigned int hsub = i > 0 ? fmtinfo->hsub : 1; @@ -436,7 +438,7 @@ static void wpf_configure_partition(struct vsp1_entity *entity, * image height. */ if (wpf->flip.rotate) - height = pipe->partition->wpf.width; + height = width; else height = format->height; -- 2.45.2