media: vim2m: better handle cap/out buffers with different sizes
authorMauro Carvalho Chehab <mchehab+samsung@kernel.org>
Tue, 26 Feb 2019 11:36:00 +0000 (06:36 -0500)
committerMauro Carvalho Chehab <mchehab+samsung@kernel.org>
Fri, 1 Mar 2019 16:12:23 +0000 (11:12 -0500)
commit24cc418b5b2790b1d7da5c8a9e3d46fa92b25f33
treef4b027b437d86afd28cb52e03d330efb8dab2cf9
parentc8af44e1e791c5d6e38c464603ae8d9a7b0468b1
media: vim2m: better handle cap/out buffers with different sizes

The vim2m driver doesn't enforce that the capture and output
buffers would have the same size. Do the right thing if the
buffers are different, zeroing the buffer before writing,
ensuring that lines will be aligned and it won't write past
the buffer area.

This is a temporary fix.

A proper fix is to either implement a simple scaler at vim2m,
or to better define the behaviour of M2M transform drivers
at V4L2 API with regards to its capability of scaling the
image or not.

In any case, such changes would deserve a separate patch
anyway, as it would imply on some behavoral change.

Also, as we have an actual bug of writing data at wrong
places, let's fix this here, and add a mental note that
we need to properly address it.

Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
drivers/media/platform/vim2m.c