media: vsp1: wpf: Fix partition configuration for display pipelines
authorLaurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
Thu, 20 Sep 2018 16:54:56 +0000 (17:54 +0100)
committerLaurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
Mon, 18 Mar 2019 15:23:42 +0000 (17:23 +0200)
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 <laurent.pinchart+renesas@ideasonboard.com>
Reviewed-by: Kieran Bingham <kieran.bingham+renesas@ideasonboard.com>
Reviewed-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
drivers/media/platform/vsp1/vsp1_wpf.c

index 32bb207..a07c594 100644 (file)
@@ -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;