diff options
author | Sylwester Nawrocki <s.nawrocki@samsung.com> | 2013-01-11 06:36:19 -0300 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@redhat.com> | 2013-02-05 17:28:48 -0200 |
commit | fa8880bece7321d61a7a5e7bf4b67832071ee047 (patch) | |
tree | a7c425b7b3b7a2a69faad5a42ce11f7f22d1636e /drivers/media/platform/s5p-fimc/fimc-core.c | |
parent | 33133ea7aca7eedf8b1b4cee514c76dce7654a8c (diff) |
[media] s5p-fimc: Fix bytesperline value for V4L2_PIX_FMT_YUV420M format
Make sure bytesperline for Cb, Cr planes for V4L2_PIX_FMT_YUV420M
format is half of the Y plane value, rather than having same
bytesperline for all planes.
While at it, simplify the bytesperline parameter handling by
storing it when image format is set and returning those values
when getting the format, instead of recalculating bytesperline
from intermediate parameters.
Reported-by: Sebastian Dröge <sebastian.droege@collabora.co.uk>
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/media/platform/s5p-fimc/fimc-core.c')
-rw-r--r-- | drivers/media/platform/s5p-fimc/fimc-core.c | 27 |
1 files changed, 12 insertions, 15 deletions
diff --git a/drivers/media/platform/s5p-fimc/fimc-core.c b/drivers/media/platform/s5p-fimc/fimc-core.c index 2e86f44edd23..92d477c91811 100644 --- a/drivers/media/platform/s5p-fimc/fimc-core.c +++ b/drivers/media/platform/s5p-fimc/fimc-core.c @@ -691,7 +691,7 @@ void fimc_alpha_ctrl_update(struct fimc_ctx *ctx) v4l2_ctrl_unlock(ctrl); } -int fimc_fill_format(struct fimc_frame *frame, struct v4l2_format *f) +void __fimc_get_format(struct fimc_frame *frame, struct v4l2_format *f) { struct v4l2_pix_format_mplane *pixm = &f->fmt.pix_mp; int i; @@ -704,19 +704,9 @@ int fimc_fill_format(struct fimc_frame *frame, struct v4l2_format *f) pixm->num_planes = frame->fmt->memplanes; for (i = 0; i < pixm->num_planes; ++i) { - int bpl = frame->f_width; - if (frame->fmt->colplanes == 1) /* packed formats */ - bpl = (bpl * frame->fmt->depth[0]) / 8; - pixm->plane_fmt[i].bytesperline = bpl; - - if (frame->fmt->flags & FMT_FLAGS_COMPRESSED) { - pixm->plane_fmt[i].sizeimage = frame->payload[i]; - continue; - } - pixm->plane_fmt[i].sizeimage = (frame->o_width * - frame->o_height * frame->fmt->depth[i]) / 8; + pixm->plane_fmt[i].bytesperline = frame->bytesperline[i]; + pixm->plane_fmt[i].sizeimage = frame->payload[i]; } - return 0; } void fimc_fill_frame(struct fimc_frame *frame, struct v4l2_format *f) @@ -765,9 +755,16 @@ void fimc_adjust_mplane_format(struct fimc_fmt *fmt, u32 width, u32 height, if (fmt->colplanes == 1 && /* Packed */ (bpl == 0 || ((bpl * 8) / fmt->depth[i]) < pix->width)) bpl = (pix->width * fmt->depth[0]) / 8; - - if (i == 0) /* Same bytesperline for each plane. */ + /* + * Currently bytesperline for each plane is same, except + * V4L2_PIX_FMT_YUV420M format. This calculation may need + * to be changed when other multi-planar formats are added + * to the fimc_formats[] array. + */ + if (i == 0) bytesperline = bpl; + else if (i == 1 && fmt->memplanes == 3) + bytesperline /= 2; plane_fmt->bytesperline = bytesperline; plane_fmt->sizeimage = max((pix->width * pix->height * |