提交 3dc2046c 编写于 作者: B Benoit Parrot 提交者: Mauro Carvalho Chehab

[media] media: ti-vpe: vpe: allow use of user specified stride

Bytesperline/stride was always overwritten by VPE to the most
adequate value based on needed alignment.

However in order to make use of arbitrary size DMA buffer it
is better to use the user space provide stride instead.

The driver will still calculate an appropriate stride but will
use the provided one when it is larger than the calculated one.
Signed-off-by: NBenoit Parrot <bparrot@ti.com>
Signed-off-by: NMauro Carvalho Chehab <mchehab@s-opensource.com>
上级 da4414ea
...@@ -1597,6 +1597,7 @@ static int __vpe_try_fmt(struct vpe_ctx *ctx, struct v4l2_format *f, ...@@ -1597,6 +1597,7 @@ static int __vpe_try_fmt(struct vpe_ctx *ctx, struct v4l2_format *f,
struct v4l2_plane_pix_format *plane_fmt; struct v4l2_plane_pix_format *plane_fmt;
unsigned int w_align; unsigned int w_align;
int i, depth, depth_bytes, height; int i, depth, depth_bytes, height;
unsigned int stride = 0;
if (!fmt || !(fmt->types & type)) { if (!fmt || !(fmt->types & type)) {
vpe_err(ctx->dev, "Fourcc format (0x%08x) invalid.\n", vpe_err(ctx->dev, "Fourcc format (0x%08x) invalid.\n",
...@@ -1683,16 +1684,27 @@ static int __vpe_try_fmt(struct vpe_ctx *ctx, struct v4l2_format *f, ...@@ -1683,16 +1684,27 @@ static int __vpe_try_fmt(struct vpe_ctx *ctx, struct v4l2_format *f,
plane_fmt = &pix->plane_fmt[i]; plane_fmt = &pix->plane_fmt[i];
depth = fmt->vpdma_fmt[i]->depth; depth = fmt->vpdma_fmt[i]->depth;
if (i == VPE_LUMA) stride = (pix->width * fmt->vpdma_fmt[VPE_LUMA]->depth) >> 3;
plane_fmt->bytesperline = (pix->width * depth) >> 3; if (stride > plane_fmt->bytesperline)
else plane_fmt->bytesperline = stride;
plane_fmt->bytesperline = pix->width;
plane_fmt->bytesperline = ALIGN(plane_fmt->bytesperline,
VPDMA_STRIDE_ALIGN);
if (pix->num_planes == 1 && fmt->coplanar) if (i == VPE_LUMA) {
depth += fmt->vpdma_fmt[VPE_CHROMA]->depth; plane_fmt->sizeimage = pix->height *
plane_fmt->sizeimage = plane_fmt->bytesperline;
(pix->height * pix->width * depth) >> 3;
if (pix->num_planes == 1 && fmt->coplanar)
plane_fmt->sizeimage += pix->height *
plane_fmt->bytesperline *
fmt->vpdma_fmt[VPE_CHROMA]->depth >> 3;
} else { /* i == VIP_CHROMA */
plane_fmt->sizeimage = (pix->height *
plane_fmt->bytesperline *
depth) >> 3;
}
memset(plane_fmt->reserved, 0, sizeof(plane_fmt->reserved)); memset(plane_fmt->reserved, 0, sizeof(plane_fmt->reserved));
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册