media: rcar-vin: fix handling of single field frames (top, bottom and alternate fields)
authorNiklas Söderlund <niklas.soderlund+renesas@ragnatech.se>
Sat, 14 Apr 2018 11:57:05 +0000 (07:57 -0400)
committerMauro Carvalho Chehab <mchehab@s-opensource.com>
Fri, 20 Apr 2018 13:53:41 +0000 (09:53 -0400)
commit6c51f646f6414f7123395bbaa0449c8b5d2614ad
tree5a1d65eaa530c80c2fb9e991366d1c74ba9c7581
parent2db44b3dac9fb572707a20c38a334824f3684c24
media: rcar-vin: fix handling of single field frames (top, bottom and alternate fields)

There was never proper support in the VIN driver to deliver ALTERNATING
field format to user-space, remove this field option. The problem is
that ALTERNATING field order requires the sequence numbers of buffers
returned to userspace to reflect if fields were dropped or not,
something which is not possible with the VIN drivers capture logic.

The VIN driver can still capture from a video source which delivers
frames in ALTERNATING field order, but needs to combine them using the
VIN hardware into INTERLACED field order. Before this change if a source
was delivering fields using ALTERNATE the driver would default to
combining them using this hardware feature. Only if the user explicitly
requested ALTERNATE field order would incorrect frames be delivered.

The height should not be cut in half for the format for TOP or BOTTOM
fields settings. This was a mistake and it was made visible by the
scaling refactoring. Correct behavior is that the user should request a
frame size that fits the half height frame reflected in the field
setting. If not the VIN will do its best to scale the top or bottom to
the requested format and cropping and scaling do not work as expected.

Signed-off-by: Niklas Söderlund <niklas.soderlund+renesas@ragnatech.se>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
drivers/media/platform/rcar-vin/rcar-dma.c
drivers/media/platform/rcar-vin/rcar-v4l2.c