mirror of
https://mirrors.bfsu.edu.cn/git/linux.git
synced 2024-11-18 01:34:14 +08:00
[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>
This commit is contained in:
parent
c4a627333f
commit
045030fa16
@ -539,8 +539,10 @@ static int fimc_cap_s_fmt_mplane(struct file *file, void *priv,
|
|||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (i = 0; i < frame->fmt->colplanes; i++)
|
for (i = 0; i < frame->fmt->colplanes; i++) {
|
||||||
frame->payload[i] = pix->plane_fmt[i].bytesperline * pix->height;
|
frame->payload[i] =
|
||||||
|
(pix->width * pix->height * frame->fmt->depth[i]) >> 3;
|
||||||
|
}
|
||||||
|
|
||||||
/* Output DMA frame pixel size and offsets. */
|
/* Output DMA frame pixel size and offsets. */
|
||||||
frame->f_width = pix->plane_fmt[0].bytesperline * 8
|
frame->f_width = pix->plane_fmt[0].bytesperline * 8
|
||||||
|
@ -927,23 +927,23 @@ int fimc_vidioc_try_fmt_mplane(struct file *file, void *priv,
|
|||||||
pix->num_planes = fmt->memplanes;
|
pix->num_planes = fmt->memplanes;
|
||||||
pix->colorspace = V4L2_COLORSPACE_JPEG;
|
pix->colorspace = V4L2_COLORSPACE_JPEG;
|
||||||
|
|
||||||
|
|
||||||
for (i = 0; i < pix->num_planes; ++i) {
|
for (i = 0; i < pix->num_planes; ++i) {
|
||||||
int bpl = pix->plane_fmt[i].bytesperline;
|
u32 bpl = pix->plane_fmt[i].bytesperline;
|
||||||
|
u32 *sizeimage = &pix->plane_fmt[i].sizeimage;
|
||||||
|
|
||||||
dbg("[%d] bpl: %d, depth: %d, w: %d, h: %d",
|
if (fmt->colplanes > 1 && (bpl == 0 || bpl < pix->width))
|
||||||
i, bpl, fmt->depth[i], pix->width, pix->height);
|
bpl = pix->width; /* Planar */
|
||||||
|
|
||||||
if (!bpl || (bpl * 8 / fmt->depth[i]) > pix->width)
|
if (fmt->colplanes == 1 && /* Packed */
|
||||||
bpl = (pix->width * fmt->depth[0]) >> 3;
|
(bpl == 0 || ((bpl * 8) / fmt->depth[i]) < pix->width))
|
||||||
|
bpl = (pix->width * fmt->depth[0]) / 8;
|
||||||
|
|
||||||
if (!pix->plane_fmt[i].sizeimage)
|
if (i == 0) /* Same bytesperline for each plane. */
|
||||||
pix->plane_fmt[i].sizeimage = pix->height * bpl;
|
mod_x = bpl;
|
||||||
|
|
||||||
pix->plane_fmt[i].bytesperline = bpl;
|
pix->plane_fmt[i].bytesperline = mod_x;
|
||||||
|
*sizeimage = (pix->width * pix->height * fmt->depth[i]) / 8;
|
||||||
dbg("[%d]: bpl: %d, sizeimage: %d",
|
|
||||||
i, pix->plane_fmt[i].bytesperline,
|
|
||||||
pix->plane_fmt[i].sizeimage);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
@ -985,8 +985,10 @@ static int fimc_m2m_s_fmt_mplane(struct file *file, void *priv,
|
|||||||
if (!frame->fmt)
|
if (!frame->fmt)
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
|
|
||||||
for (i = 0; i < frame->fmt->colplanes; i++)
|
for (i = 0; i < frame->fmt->colplanes; i++) {
|
||||||
frame->payload[i] = pix->plane_fmt[i].bytesperline * pix->height;
|
frame->payload[i] =
|
||||||
|
(pix->width * pix->height * frame->fmt->depth[i]) / 8;
|
||||||
|
}
|
||||||
|
|
||||||
frame->f_width = pix->plane_fmt[0].bytesperline * 8 /
|
frame->f_width = pix->plane_fmt[0].bytesperline * 8 /
|
||||||
frame->fmt->depth[0];
|
frame->fmt->depth[0];
|
||||||
|
Loading…
Reference in New Issue
Block a user