mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2026-05-03 11:12:01 -04:00
media: hantro: Set buffers' zeroth plane payload in .buf_prepare
Buffers' zeroth plane payload size is calculated at format negotiation time, and so it can be set in .buf_prepare. Keep in mind that, to make this change easier, hantro_buf_prepare is refactored, using the cedrus driver as reference. This results in cleaner code as byproduct. Signed-off-by: Ezequiel Garcia <ezequiel@collabora.com> Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl> Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
This commit is contained in:
committed by
Mauro Carvalho Chehab
parent
e1e213b1b0
commit
6837e43e9c
@@ -608,7 +608,7 @@ hantro_queue_setup(struct vb2_queue *vq, unsigned int *num_buffers,
|
||||
}
|
||||
|
||||
static int
|
||||
hantro_buf_plane_check(struct vb2_buffer *vb, const struct hantro_fmt *vpu_fmt,
|
||||
hantro_buf_plane_check(struct vb2_buffer *vb,
|
||||
struct v4l2_pix_format_mplane *pixfmt)
|
||||
{
|
||||
unsigned int sz;
|
||||
@@ -630,12 +630,18 @@ static int hantro_buf_prepare(struct vb2_buffer *vb)
|
||||
{
|
||||
struct vb2_queue *vq = vb->vb2_queue;
|
||||
struct hantro_ctx *ctx = vb2_get_drv_priv(vq);
|
||||
struct v4l2_pix_format_mplane *pix_fmt;
|
||||
int ret;
|
||||
|
||||
if (V4L2_TYPE_IS_OUTPUT(vq->type))
|
||||
return hantro_buf_plane_check(vb, ctx->vpu_src_fmt,
|
||||
&ctx->src_fmt);
|
||||
|
||||
return hantro_buf_plane_check(vb, ctx->vpu_dst_fmt, &ctx->dst_fmt);
|
||||
pix_fmt = &ctx->src_fmt;
|
||||
else
|
||||
pix_fmt = &ctx->dst_fmt;
|
||||
ret = hantro_buf_plane_check(vb, pix_fmt);
|
||||
if (ret)
|
||||
return ret;
|
||||
vb2_set_plane_payload(vb, 0, pix_fmt->plane_fmt[0].sizeimage);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void hantro_buf_queue(struct vb2_buffer *vb)
|
||||
|
||||
Reference in New Issue
Block a user