diff options
author | Sylwester Nawrocki <s.nawrocki@samsung.com> | 2012-05-16 14:00:26 -0400 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@redhat.com> | 2012-06-25 08:17:10 -0400 |
commit | d547ab66e275e2f6bf703572e943018ef7c391c5 (patch) | |
tree | 9a5cfc76bfe720de4289559784c9666db4262c6d /drivers | |
parent | d0da3c3565a1dd3cdfa374038d6ccae4b90fe142 (diff) |
[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: Sylwester Nawrocki <s.nawrocki@samsung.com>
Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/media/video/s5p-fimc/fimc-capture.c | 7 | ||||
-rw-r--r-- | drivers/media/video/s5p-fimc/fimc-core.c | 9 |
2 files changed, 9 insertions, 7 deletions
diff --git a/drivers/media/video/s5p-fimc/fimc-capture.c b/drivers/media/video/s5p-fimc/fimc-capture.c index 7083107c2b37..13df7230c8d8 100644 --- a/drivers/media/video/s5p-fimc/fimc-capture.c +++ b/drivers/media/video/s5p-fimc/fimc-capture.c | |||
@@ -350,7 +350,8 @@ static int queue_setup(struct vb2_queue *vq, const struct v4l2_format *pfmt, | |||
350 | if (pixm) | 350 | if (pixm) |
351 | sizes[i] = max(size, pixm->plane_fmt[i].sizeimage); | 351 | sizes[i] = max(size, pixm->plane_fmt[i].sizeimage); |
352 | else | 352 | else |
353 | sizes[i] = size; | 353 | sizes[i] = max_t(u32, size, frame->payload[i]); |
354 | |||
354 | allocators[i] = ctx->fimc_dev->alloc_ctx; | 355 | allocators[i] = ctx->fimc_dev->alloc_ctx; |
355 | } | 356 | } |
356 | 357 | ||
@@ -924,10 +925,10 @@ static int fimc_capture_set_format(struct fimc_dev *fimc, struct v4l2_format *f) | |||
924 | pix->width = mf->width; | 925 | pix->width = mf->width; |
925 | pix->height = mf->height; | 926 | pix->height = mf->height; |
926 | } | 927 | } |
928 | |||
927 | fimc_adjust_mplane_format(ff->fmt, pix->width, pix->height, pix); | 929 | fimc_adjust_mplane_format(ff->fmt, pix->width, pix->height, pix); |
928 | for (i = 0; i < ff->fmt->colplanes; i++) | 930 | for (i = 0; i < ff->fmt->colplanes; i++) |
929 | ff->payload[i] = | 931 | ff->payload[i] = pix->plane_fmt[i].sizeimage; |
930 | (pix->width * pix->height * ff->fmt->depth[i]) / 8; | ||
931 | 932 | ||
932 | set_frame_bounds(ff, pix->width, pix->height); | 933 | set_frame_bounds(ff, pix->width, pix->height); |
933 | /* Reset the composition rectangle if not yet configured */ | 934 | /* Reset the composition rectangle if not yet configured */ |
diff --git a/drivers/media/video/s5p-fimc/fimc-core.c b/drivers/media/video/s5p-fimc/fimc-core.c index 92fc5a20fb76..65124a24c30f 100644 --- a/drivers/media/video/s5p-fimc/fimc-core.c +++ b/drivers/media/video/s5p-fimc/fimc-core.c | |||
@@ -741,8 +741,8 @@ void fimc_adjust_mplane_format(struct fimc_fmt *fmt, u32 width, u32 height, | |||
741 | pix->width = width; | 741 | pix->width = width; |
742 | 742 | ||
743 | for (i = 0; i < pix->num_planes; ++i) { | 743 | for (i = 0; i < pix->num_planes; ++i) { |
744 | u32 bpl = pix->plane_fmt[i].bytesperline; | 744 | struct v4l2_plane_pix_format *plane_fmt = &pix->plane_fmt[i]; |
745 | u32 *sizeimage = &pix->plane_fmt[i].sizeimage; | 745 | u32 bpl = plane_fmt->bytesperline; |
746 | 746 | ||
747 | if (fmt->colplanes > 1 && (bpl == 0 || bpl < pix->width)) | 747 | if (fmt->colplanes > 1 && (bpl == 0 || bpl < pix->width)) |
748 | bpl = pix->width; /* Planar */ | 748 | bpl = pix->width; /* Planar */ |
@@ -754,8 +754,9 @@ void fimc_adjust_mplane_format(struct fimc_fmt *fmt, u32 width, u32 height, | |||
754 | if (i == 0) /* Same bytesperline for each plane. */ | 754 | if (i == 0) /* Same bytesperline for each plane. */ |
755 | bytesperline = bpl; | 755 | bytesperline = bpl; |
756 | 756 | ||
757 | pix->plane_fmt[i].bytesperline = bytesperline; | 757 | plane_fmt->bytesperline = bytesperline; |
758 | *sizeimage = (pix->width * pix->height * fmt->depth[i]) / 8; | 758 | plane_fmt->sizeimage = max((pix->width * pix->height * |
759 | fmt->depth[i]) / 8, plane_fmt->sizeimage); | ||
759 | } | 760 | } |
760 | } | 761 | } |
761 | 762 | ||