OSDN Git Service

media: cedrus: Remove dst_bufs from context
authorJernej Skrabec <jernej.skrabec@siol.net>
Thu, 30 May 2019 21:15:13 +0000 (18:15 -0300)
committerMauro Carvalho Chehab <mchehab+samsung@kernel.org>
Tue, 13 Aug 2019 14:42:03 +0000 (11:42 -0300)
This array is just duplicated capture buffer queue. Remove it and adjust
code to look into capture buffer queue instead.

Signed-off-by: Jernej Skrabec <jernej.skrabec@siol.net>
Acked-by: Maxime Ripard <maxime.ripard@bootlin.com>
Acked-by: Paul Kocialkowski <paul.kocialkowski@bootlin.com>
Reviewed-by: Ezequiel Garcia <ezequiel@collabora.com>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
drivers/staging/media/sunxi/cedrus/cedrus.h
drivers/staging/media/sunxi/cedrus/cedrus_h264.c
drivers/staging/media/sunxi/cedrus/cedrus_video.c

index 3f476d0..d8e6777 100644 (file)
@@ -100,8 +100,6 @@ struct cedrus_ctx {
        struct v4l2_ctrl_handler        hdl;
        struct v4l2_ctrl                **ctrls;
 
-       struct vb2_buffer               *dst_bufs[VIDEO_MAX_FRAME];
-
        union {
                struct {
                        void            *mv_col_buf;
@@ -187,7 +185,7 @@ static inline dma_addr_t cedrus_dst_buf_addr(struct cedrus_ctx *ctx,
        if (index < 0)
                return 0;
 
-       buf = ctx->dst_bufs[index];
+       buf = ctx->fh.m2m_ctx->cap_q_ctx.q.bufs[index];
        return buf ? cedrus_buf_addr(buf, &ctx->dst_fmt, plane) : 0;
 }
 
index a30bb28..d6a7827 100644 (file)
@@ -118,7 +118,7 @@ static void cedrus_write_frame_list(struct cedrus_ctx *ctx,
                if (buf_idx < 0)
                        continue;
 
-               cedrus_buf = vb2_to_cedrus_buffer(ctx->dst_bufs[buf_idx]);
+               cedrus_buf = vb2_to_cedrus_buffer(cap_q->bufs[buf_idx]);
                position = cedrus_buf->codec.h264.position;
                used_dpbs |= BIT(position);
 
@@ -193,7 +193,7 @@ static void _cedrus_write_ref_list(struct cedrus_ctx *ctx,
                if (buf_idx < 0)
                        continue;
 
-               ref_buf = to_vb2_v4l2_buffer(ctx->dst_bufs[buf_idx]);
+               ref_buf = to_vb2_v4l2_buffer(cap_q->bufs[buf_idx]);
                cedrus_buf = vb2_v4l2_to_cedrus_buffer(ref_buf);
                position = cedrus_buf->codec.h264.position;
 
index e2b530b..681dfe3 100644 (file)
@@ -411,26 +411,6 @@ static void cedrus_queue_cleanup(struct vb2_queue *vq, u32 state)
        }
 }
 
-static int cedrus_buf_init(struct vb2_buffer *vb)
-{
-       struct vb2_queue *vq = vb->vb2_queue;
-       struct cedrus_ctx *ctx = vb2_get_drv_priv(vq);
-
-       if (!V4L2_TYPE_IS_OUTPUT(vq->type))
-               ctx->dst_bufs[vb->index] = vb;
-
-       return 0;
-}
-
-static void cedrus_buf_cleanup(struct vb2_buffer *vb)
-{
-       struct vb2_queue *vq = vb->vb2_queue;
-       struct cedrus_ctx *ctx = vb2_get_drv_priv(vq);
-
-       if (!V4L2_TYPE_IS_OUTPUT(vq->type))
-               ctx->dst_bufs[vb->index] = NULL;
-}
-
 static int cedrus_buf_out_validate(struct vb2_buffer *vb)
 {
        struct vb2_v4l2_buffer *vbuf = to_vb2_v4l2_buffer(vb);
@@ -517,8 +497,6 @@ static void cedrus_buf_request_complete(struct vb2_buffer *vb)
 static struct vb2_ops cedrus_qops = {
        .queue_setup            = cedrus_queue_setup,
        .buf_prepare            = cedrus_buf_prepare,
-       .buf_init               = cedrus_buf_init,
-       .buf_cleanup            = cedrus_buf_cleanup,
        .buf_queue              = cedrus_buf_queue,
        .buf_out_validate       = cedrus_buf_out_validate,
        .buf_request_complete   = cedrus_buf_request_complete,