[<prev] [next>] [day] [month] [year] [list]
Message-ID: <CA+Px+wWkS-PMVa4DGc9df8p8QLDFEvQXbOhYJb-rqk5P-C_+7A@mail.gmail.com>
Date: Tue, 6 Jul 2021 19:01:00 +0800
From: Tzung-Bi Shih <tzungbi@...gle.com>
To: "kyrie.wu" <kyrie.wu@...iatek.com>
Cc: Hans Verkuil <hverkuil-cisco@...all.nl>,
Mauro Carvalho Chehab <mchehab@...nel.org>,
Rob Herring <robh+dt@...nel.org>,
Bin Liu <bin.liu@...iatek.com>,
Matthias Brugger <matthias.bgg@...il.com>,
Tzung-Bi Shih <tzungbi@...omium.org>,
Project_Global_Chrome_Upstream_Group@...iatek.com,
linux-media@...r.kernel.org, devicetree@...r.kernel.org,
linux-kernel@...r.kernel.org, linux-arm-kernel@...ts.infradead.org,
linux-mediatek@...ts.infradead.org,
Tomasz Figa <tfiga@...omium.org>, xia.jiang@...iatek.com,
maoguang.meng@...iatek.com, srv_heupstream@...iatek.com
Subject: Re: [PATCH v2,9/9] media: mtk-jpegenc: Refactor jpegenc device run interface
On Wed, Jun 30, 2021 at 3:32 PM kyrie.wu <kyrie.wu@...iatek.com> wrote:
> modify jpegenc device run func interface and add worker for encode
The description makes less sense.
> +static void mtk_jpegenc_worker(struct work_struct *work)
> {
> - struct mtk_jpeg_ctx *ctx = priv;
> + struct mtk_jpeg_ctx *ctx = container_of(work, struct mtk_jpeg_ctx,
> + jpeg_work);
> struct mtk_jpeg_dev *jpeg = ctx->jpeg;
> + struct mtk_jpeg_dev *comp_jpeg[MTK_JPEGENC_HW_MAX];
> struct vb2_v4l2_buffer *src_buf, *dst_buf;
> enum vb2_buffer_state buf_state = VB2_BUF_STATE_ERROR;
> unsigned long flags;
> - int ret;
> + struct mtk_jpeg_src_buf *jpeg_src_buf, *jpeg_dst_buf;
> + int ret, i, hw_id = 0;
hw_id doesn't need to be initialized.
> +retry_select:
> + hw_id = mtk_jpeg_select_hw(ctx);
> + if (hw_id < 0) {
> + ret = wait_event_interruptible(jpeg->hw_wq,
> + (atomic_read(hw_rdy[0]) ||
> + atomic_read(hw_rdy[1])) > 0);
Hard-coded refers to hw_rdy[0] and hw_rdy[1] here?
> - mtk_jpeg_enc_reset(jpeg->reg_base);
> -
> - mtk_jpeg_set_enc_src(ctx, jpeg->reg_base, &src_buf->vb2_buf);
> - mtk_jpeg_set_enc_dst(ctx, jpeg->reg_base, &dst_buf->vb2_buf);
> - mtk_jpeg_set_enc_params(ctx, jpeg->reg_base);
> - mtk_jpeg_enc_start(jpeg->reg_base);
> - spin_unlock_irqrestore(&jpeg->hw_lock, flags);
> + spin_lock_irqsave(&comp_jpeg[hw_id]->hw_lock, flags);
> + mtk_jpeg_enc_reset(comp_jpeg[hw_id]->reg_base[0]);
> + mtk_jpeg_set_enc_dst(ctx,
> + comp_jpeg[hw_id]->reg_base[0],
> + &dst_buf->vb2_buf);
> + mtk_jpeg_set_enc_src(ctx,
> + comp_jpeg[hw_id]->reg_base[0],
> + &src_buf->vb2_buf);
> + mtk_jpeg_set_enc_params(ctx, comp_jpeg[hw_id]->reg_base[0]);
> + mtk_jpeg_enc_start(comp_jpeg[hw_id]->reg_base[0]);
Why it uses reg_base[0]?
Powered by blists - more mailing lists