]> asedeno.scripts.mit.edu Git - linux.git/blobdiff - drivers/media/platform/vsp1/vsp1_wpf.c
[media] v4l: vsp1: Fix RPF/WPF U/V order in 3-planar formats on Gen3
[linux.git] / drivers / media / platform / vsp1 / vsp1_wpf.c
index 7c48f81cd5c1ff7e8ac83f228989cab57c198c83..052a83e2d4891a045369c4886a2bc7e32766652c 100644 (file)
@@ -216,6 +216,7 @@ static void wpf_configure(struct vsp1_entity *entity,
 
        if (params == VSP1_ENTITY_PARAMS_PARTITION) {
                const struct v4l2_pix_format_mplane *format = &wpf->format;
+               const struct vsp1_format_info *fmtinfo = wpf->fmtinfo;
                struct vsp1_rwpf_memory mem = wpf->mem;
                unsigned int flip = wpf->flip.active;
                unsigned int width = source_format->width;
@@ -281,6 +282,14 @@ static void wpf_configure(struct vsp1_entity *entity,
                        }
                }
 
+               /*
+                * On Gen3 hardware the SPUVS bit has no effect on 3-planar
+                * formats. Swap the U and V planes manually in that case.
+                */
+               if (vsp1->info->gen == 3 && format->num_planes == 3 &&
+                   fmtinfo->swap_uv)
+                       swap(mem.addr[1], mem.addr[2]);
+
                vsp1_wpf_write(wpf, dl, VI6_WPF_DSTM_ADDR_Y, mem.addr[0]);
                vsp1_wpf_write(wpf, dl, VI6_WPF_DSTM_ADDR_C0, mem.addr[1]);
                vsp1_wpf_write(wpf, dl, VI6_WPF_DSTM_ADDR_C1, mem.addr[2]);