[media] v4l: vsp1: Fix RPF/WPF U/V order in 3-planar formats on Gen3

The RPF and WPF U/V order bits have no effect for 3-planar formats on
Gen3 hardware. Swap the U and V planes addresses manually instead in
that case.

Fixes: b915bd24a0 ("[media] v4l: vsp1: Add tri-planar memory formats support")

Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
This commit is contained in:
Laurent Pinchart 2017-02-12 20:58:20 -02:00 committed by Mauro Carvalho Chehab
parent dadc3be66c
commit 3425382288
2 changed files with 33 additions and 15 deletions

View file

@ -72,7 +72,8 @@ static void rpf_configure(struct vsp1_entity *entity,
} }
if (params == VSP1_ENTITY_PARAMS_PARTITION) { if (params == VSP1_ENTITY_PARAMS_PARTITION) {
unsigned int offsets[2]; struct vsp1_device *vsp1 = rpf->entity.vsp1;
struct vsp1_rwpf_memory mem = rpf->mem;
struct v4l2_rect crop; struct v4l2_rect crop;
/* /*
@ -120,22 +121,30 @@ static void rpf_configure(struct vsp1_entity *entity,
(crop.width << VI6_RPF_SRC_ESIZE_EHSIZE_SHIFT) | (crop.width << VI6_RPF_SRC_ESIZE_EHSIZE_SHIFT) |
(crop.height << VI6_RPF_SRC_ESIZE_EVSIZE_SHIFT)); (crop.height << VI6_RPF_SRC_ESIZE_EVSIZE_SHIFT));
offsets[0] = crop.top * format->plane_fmt[0].bytesperline mem.addr[0] += crop.top * format->plane_fmt[0].bytesperline
+ crop.left * fmtinfo->bpp[0] / 8; + crop.left * fmtinfo->bpp[0] / 8;
if (format->num_planes > 1) if (format->num_planes > 1) {
offsets[1] = crop.top * format->plane_fmt[1].bytesperline unsigned int offset;
+ crop.left / fmtinfo->hsub
* fmtinfo->bpp[1] / 8;
else
offsets[1] = 0;
vsp1_rpf_write(rpf, dl, VI6_RPF_SRCM_ADDR_Y, offset = crop.top * format->plane_fmt[1].bytesperline
rpf->mem.addr[0] + offsets[0]); + crop.left / fmtinfo->hsub
vsp1_rpf_write(rpf, dl, VI6_RPF_SRCM_ADDR_C0, * fmtinfo->bpp[1] / 8;
rpf->mem.addr[1] + offsets[1]); mem.addr[1] += offset;
vsp1_rpf_write(rpf, dl, VI6_RPF_SRCM_ADDR_C1, mem.addr[2] += offset;
rpf->mem.addr[2] + offsets[1]); }
/*
* 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_rpf_write(rpf, dl, VI6_RPF_SRCM_ADDR_Y, mem.addr[0]);
vsp1_rpf_write(rpf, dl, VI6_RPF_SRCM_ADDR_C0, mem.addr[1]);
vsp1_rpf_write(rpf, dl, VI6_RPF_SRCM_ADDR_C1, mem.addr[2]);
return; return;
} }

View file

@ -216,6 +216,7 @@ static void wpf_configure(struct vsp1_entity *entity,
if (params == VSP1_ENTITY_PARAMS_PARTITION) { if (params == VSP1_ENTITY_PARAMS_PARTITION) {
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;
struct vsp1_rwpf_memory mem = wpf->mem; struct vsp1_rwpf_memory mem = wpf->mem;
unsigned int flip = wpf->flip.active; unsigned int flip = wpf->flip.active;
unsigned int width = source_format->width; 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_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_C0, mem.addr[1]);
vsp1_wpf_write(wpf, dl, VI6_WPF_DSTM_ADDR_C1, mem.addr[2]); vsp1_wpf_write(wpf, dl, VI6_WPF_DSTM_ADDR_C1, mem.addr[2]);