summaryrefslogtreecommitdiffstats
path: root/drivers/media/platform
diff options
context:
space:
mode:
authorAndré Almeida2019-02-04 18:37:33 +0100
committerMauro Carvalho Chehab2019-02-07 18:24:03 +0100
commita442940534b77f3892dd629c12b0d01e65d4f314 (patch)
treee15c155e3db1f26c20aed340117ffa42e1b79ec6 /drivers/media/platform
parentmedia: vimc: Add vimc-streamer for stream control (diff)
downloadkernel-qcow2-linux-a442940534b77f3892dd629c12b0d01e65d4f314.tar.gz
kernel-qcow2-linux-a442940534b77f3892dd629c12b0d01e65d4f314.tar.xz
kernel-qcow2-linux-a442940534b77f3892dd629c12b0d01e65d4f314.zip
media: vivid: add vertical down sampling to imagesize calc
To correctly set the size of the image in a plane, it's needed to divide the height of image by the vertical down sampling factor. This was only happening in vivid_try_fmt_vid_cap(), but now it applied in others sizeimage calculations as well. Signed-off-by: André Almeida <andre.almeida@collabora.com> Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl> Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
Diffstat (limited to 'drivers/media/platform')
-rw-r--r--drivers/media/platform/vivid/vivid-vid-cap.c10
1 files changed, 7 insertions, 3 deletions
diff --git a/drivers/media/platform/vivid/vivid-vid-cap.c b/drivers/media/platform/vivid/vivid-vid-cap.c
index c059fc12668a..52eeda624d7e 100644
--- a/drivers/media/platform/vivid/vivid-vid-cap.c
+++ b/drivers/media/platform/vivid/vivid-vid-cap.c
@@ -124,7 +124,8 @@ static int vid_cap_queue_setup(struct vb2_queue *vq,
}
} else {
for (p = 0; p < buffers; p++)
- sizes[p] = tpg_g_line_width(&dev->tpg, p) * h +
+ sizes[p] = (tpg_g_line_width(&dev->tpg, p) * h) /
+ dev->fmt_cap->vdownsampling[p] +
dev->fmt_cap->data_offset[p];
}
@@ -161,7 +162,9 @@ static int vid_cap_buf_prepare(struct vb2_buffer *vb)
return -EINVAL;
}
for (p = 0; p < buffers; p++) {
- size = tpg_g_line_width(&dev->tpg, p) * dev->fmt_cap_rect.height +
+ size = (tpg_g_line_width(&dev->tpg, p) *
+ dev->fmt_cap_rect.height) /
+ dev->fmt_cap->vdownsampling[p] +
dev->fmt_cap->data_offset[p];
if (vb2_plane_size(vb, p) < size) {
@@ -545,7 +548,8 @@ int vivid_g_fmt_vid_cap(struct file *file, void *priv,
for (p = 0; p < mp->num_planes; p++) {
mp->plane_fmt[p].bytesperline = tpg_g_bytesperline(&dev->tpg, p);
mp->plane_fmt[p].sizeimage =
- tpg_g_line_width(&dev->tpg, p) * mp->height +
+ (tpg_g_line_width(&dev->tpg, p) * mp->height) /
+ dev->fmt_cap->vdownsampling[p] +
dev->fmt_cap->data_offset[p];
}
return 0;