diff options
author | Sylwester Nawrocki <s.nawrocki@samsung.com> | 2011-04-08 08:11:43 -0400 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@redhat.com> | 2011-04-19 15:01:53 -0400 |
commit | 045030fa16648449b416d4fc8dcc54bfefd6f4aa (patch) | |
tree | 293ee918e8b1a754906b8122756ababc5a5756e6 /drivers/media | |
parent | c4a627333f0d952c5e10c02609493fa63b5c7b28 (diff) |
[media] s5p-fimc: Fix bytesperline and plane payload setup
Make sure the sizeimage for 3-planar color formats is
width * height * 3/2 and the bytesperline is same for each
plane in case of a multi-planar format.
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')
-rw-r--r-- | drivers/media/video/s5p-fimc/fimc-capture.c | 6 | ||||
-rw-r--r-- | drivers/media/video/s5p-fimc/fimc-core.c | 30 |
2 files changed, 20 insertions, 16 deletions
diff --git a/drivers/media/video/s5p-fimc/fimc-capture.c b/drivers/media/video/s5p-fimc/fimc-capture.c index 00c561ca3870..d142b40ea64e 100644 --- a/drivers/media/video/s5p-fimc/fimc-capture.c +++ b/drivers/media/video/s5p-fimc/fimc-capture.c | |||
@@ -539,8 +539,10 @@ static int fimc_cap_s_fmt_mplane(struct file *file, void *priv, | |||
539 | return -EINVAL; | 539 | return -EINVAL; |
540 | } | 540 | } |
541 | 541 | ||
542 | for (i = 0; i < frame->fmt->colplanes; i++) | 542 | for (i = 0; i < frame->fmt->colplanes; i++) { |
543 | frame->payload[i] = pix->plane_fmt[i].bytesperline * pix->height; | 543 | frame->payload[i] = |
544 | (pix->width * pix->height * frame->fmt->depth[i]) >> 3; | ||
545 | } | ||
544 | 546 | ||
545 | /* Output DMA frame pixel size and offsets. */ | 547 | /* Output DMA frame pixel size and offsets. */ |
546 | frame->f_width = pix->plane_fmt[0].bytesperline * 8 | 548 | frame->f_width = pix->plane_fmt[0].bytesperline * 8 |
diff --git a/drivers/media/video/s5p-fimc/fimc-core.c b/drivers/media/video/s5p-fimc/fimc-core.c index 115a1e0d8c29..ef4e3f66eac0 100644 --- a/drivers/media/video/s5p-fimc/fimc-core.c +++ b/drivers/media/video/s5p-fimc/fimc-core.c | |||
@@ -927,23 +927,23 @@ int fimc_vidioc_try_fmt_mplane(struct file *file, void *priv, | |||
927 | pix->num_planes = fmt->memplanes; | 927 | pix->num_planes = fmt->memplanes; |
928 | pix->colorspace = V4L2_COLORSPACE_JPEG; | 928 | pix->colorspace = V4L2_COLORSPACE_JPEG; |
929 | 929 | ||
930 | for (i = 0; i < pix->num_planes; ++i) { | ||
931 | int bpl = pix->plane_fmt[i].bytesperline; | ||
932 | 930 | ||
933 | dbg("[%d] bpl: %d, depth: %d, w: %d, h: %d", | 931 | for (i = 0; i < pix->num_planes; ++i) { |
934 | i, bpl, fmt->depth[i], pix->width, pix->height); | 932 | u32 bpl = pix->plane_fmt[i].bytesperline; |
933 | u32 *sizeimage = &pix->plane_fmt[i].sizeimage; | ||
935 | 934 | ||
936 | if (!bpl || (bpl * 8 / fmt->depth[i]) > pix->width) | 935 | if (fmt->colplanes > 1 && (bpl == 0 || bpl < pix->width)) |
937 | bpl = (pix->width * fmt->depth[0]) >> 3; | 936 | bpl = pix->width; /* Planar */ |
938 | 937 | ||
939 | if (!pix->plane_fmt[i].sizeimage) | 938 | if (fmt->colplanes == 1 && /* Packed */ |
940 | pix->plane_fmt[i].sizeimage = pix->height * bpl; | 939 | (bpl == 0 || ((bpl * 8) / fmt->depth[i]) < pix->width)) |
940 | bpl = (pix->width * fmt->depth[0]) / 8; | ||
941 | 941 | ||
942 | pix->plane_fmt[i].bytesperline = bpl; | 942 | if (i == 0) /* Same bytesperline for each plane. */ |
943 | mod_x = bpl; | ||
943 | 944 | ||
944 | dbg("[%d]: bpl: %d, sizeimage: %d", | 945 | pix->plane_fmt[i].bytesperline = mod_x; |
945 | i, pix->plane_fmt[i].bytesperline, | 946 | *sizeimage = (pix->width * pix->height * fmt->depth[i]) / 8; |
946 | pix->plane_fmt[i].sizeimage); | ||
947 | } | 947 | } |
948 | 948 | ||
949 | return 0; | 949 | return 0; |
@@ -985,8 +985,10 @@ static int fimc_m2m_s_fmt_mplane(struct file *file, void *priv, | |||
985 | if (!frame->fmt) | 985 | if (!frame->fmt) |
986 | return -EINVAL; | 986 | return -EINVAL; |
987 | 987 | ||
988 | for (i = 0; i < frame->fmt->colplanes; i++) | 988 | for (i = 0; i < frame->fmt->colplanes; i++) { |
989 | frame->payload[i] = pix->plane_fmt[i].bytesperline * pix->height; | 989 | frame->payload[i] = |
990 | (pix->width * pix->height * frame->fmt->depth[i]) / 8; | ||
991 | } | ||
990 | 992 | ||
991 | frame->f_width = pix->plane_fmt[0].bytesperline * 8 / | 993 | frame->f_width = pix->plane_fmt[0].bytesperline * 8 / |
992 | frame->fmt->depth[0]; | 994 | frame->fmt->depth[0]; |