Commit d547ab66 authored by Sylwester Nawrocki's avatar Sylwester Nawrocki Committed by Mauro Carvalho Chehab

[media] s5p-fimc: Honour sizeimage in VIDIOC_S_FMT

Allow memory buffer size to be increased by means of
struct v4l2_pix_plane_format::sizeimage at VIDIOC_S_FMT ioctl.
Signed-off-by: default avatarSylwester Nawrocki <s.nawrocki@samsung.com>
Signed-off-by: default avatarKyungmin Park <kyungmin.park@samsung.com>
Signed-off-by: default avatarMauro Carvalho Chehab <mchehab@redhat.com>
parent d0da3c35
...@@ -350,7 +350,8 @@ static int queue_setup(struct vb2_queue *vq, const struct v4l2_format *pfmt, ...@@ -350,7 +350,8 @@ static int queue_setup(struct vb2_queue *vq, const struct v4l2_format *pfmt,
if (pixm) if (pixm)
sizes[i] = max(size, pixm->plane_fmt[i].sizeimage); sizes[i] = max(size, pixm->plane_fmt[i].sizeimage);
else else
sizes[i] = size; sizes[i] = max_t(u32, size, frame->payload[i]);
allocators[i] = ctx->fimc_dev->alloc_ctx; allocators[i] = ctx->fimc_dev->alloc_ctx;
} }
...@@ -924,10 +925,10 @@ static int fimc_capture_set_format(struct fimc_dev *fimc, struct v4l2_format *f) ...@@ -924,10 +925,10 @@ static int fimc_capture_set_format(struct fimc_dev *fimc, struct v4l2_format *f)
pix->width = mf->width; pix->width = mf->width;
pix->height = mf->height; pix->height = mf->height;
} }
fimc_adjust_mplane_format(ff->fmt, pix->width, pix->height, pix); fimc_adjust_mplane_format(ff->fmt, pix->width, pix->height, pix);
for (i = 0; i < ff->fmt->colplanes; i++) for (i = 0; i < ff->fmt->colplanes; i++)
ff->payload[i] = ff->payload[i] = pix->plane_fmt[i].sizeimage;
(pix->width * pix->height * ff->fmt->depth[i]) / 8;
set_frame_bounds(ff, pix->width, pix->height); set_frame_bounds(ff, pix->width, pix->height);
/* Reset the composition rectangle if not yet configured */ /* Reset the composition rectangle if not yet configured */
......
...@@ -741,8 +741,8 @@ void fimc_adjust_mplane_format(struct fimc_fmt *fmt, u32 width, u32 height, ...@@ -741,8 +741,8 @@ void fimc_adjust_mplane_format(struct fimc_fmt *fmt, u32 width, u32 height,
pix->width = width; pix->width = width;
for (i = 0; i < pix->num_planes; ++i) { for (i = 0; i < pix->num_planes; ++i) {
u32 bpl = pix->plane_fmt[i].bytesperline; struct v4l2_plane_pix_format *plane_fmt = &pix->plane_fmt[i];
u32 *sizeimage = &pix->plane_fmt[i].sizeimage; u32 bpl = plane_fmt->bytesperline;
if (fmt->colplanes > 1 && (bpl == 0 || bpl < pix->width)) if (fmt->colplanes > 1 && (bpl == 0 || bpl < pix->width))
bpl = pix->width; /* Planar */ bpl = pix->width; /* Planar */
...@@ -754,8 +754,9 @@ void fimc_adjust_mplane_format(struct fimc_fmt *fmt, u32 width, u32 height, ...@@ -754,8 +754,9 @@ void fimc_adjust_mplane_format(struct fimc_fmt *fmt, u32 width, u32 height,
if (i == 0) /* Same bytesperline for each plane. */ if (i == 0) /* Same bytesperline for each plane. */
bytesperline = bpl; bytesperline = bpl;
pix->plane_fmt[i].bytesperline = bytesperline; plane_fmt->bytesperline = bytesperline;
*sizeimage = (pix->width * pix->height * fmt->depth[i]) / 8; plane_fmt->sizeimage = max((pix->width * pix->height *
fmt->depth[i]) / 8, plane_fmt->sizeimage);
} }
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment