media: staging: rkisp1: cap: support uv swapped planar formats
authorDafna Hirschfeld <dafna.hirschfeld@collabora.com>
Sat, 11 Apr 2020 16:06:01 +0000 (18:06 +0200)
committerMauro Carvalho Chehab <mchehab+huawei@kernel.org>
Tue, 21 Apr 2020 15:25:34 +0000 (17:25 +0200)
Planar formats with the u and v planes swapped can be
supported by swapping the address of the cb and cr buffers.

Signed-off-by: Dafna Hirschfeld <dafna.hirschfeld@collabora.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
drivers/staging/media/rkisp1/rkisp1-capture.c

index 4c18b081480c97f3d18fe7520d18b84d4d222687..21496fb2c4daa05b0eccb1bfdb44f6748306243d 100644 (file)
@@ -738,6 +738,14 @@ static void rkisp1_vb2_buf_queue(struct vb2_buffer *vb)
                        rkisp1_pixfmt_comp_size(pixm, RKISP1_PLANE_CB);
        }
 
+       /*
+        * uv swap can be supported for planar formats by switching
+        * the address of cb and cr
+        */
+       if (cap->pix.info->comp_planes == 3 && cap->pix.cfg->uv_swap)
+               swap(ispbuf->buff_addr[RKISP1_PLANE_CR],
+                    ispbuf->buff_addr[RKISP1_PLANE_CB]);
+
        spin_lock_irqsave(&cap->buf.lock, flags);
 
        /*