From patchwork Wed Apr 10 12:42:23 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: ayaka X-Patchwork-Id: 10893831 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id DF4FF1515 for ; Wed, 10 Apr 2019 12:43:11 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id C0A3026B39 for ; Wed, 10 Apr 2019 12:43:11 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id B4A1C289D7; Wed, 10 Apr 2019 12:43:11 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.2 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED autolearn=unavailable version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 526A926B39 for ; Wed, 10 Apr 2019 12:43:11 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=U0UP8HaS+oQILkwFDUEstqrNv7GiVZNwIHeCWWNx5/U=; b=H6bFlhfo5sczoq LiD9nMNpgOGJfs+lBakL56QtgcCBI7pmKyGP6O3iEXxgMGLk2TF1cYB2k5mAiezVihYhgKL09/HbS Hl1JDkB5cj2DQUAok/OSxu/jc78+wPmUHH8UPQJ7XajE5x2KdeTvbfbnQgVQHWrNnzEeP2uFjaAEz bUu5PkNsDgmLV3fOdNSaD9o9PFUd5DVrY5G7Fxm9F/C592l9cPg/qhIwRdB6M5cNwfy8Ru9D/JWXH t/mDlZucp3eZdxItVmGlSexi/jjgNROAcnC7GUBU4E5V5BGKT4c4CfW5DWg5Wrv8fyPfNNBSVjvlR 4YrmSlEsWJYIVBR5Bkww==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1hECZI-0002qK-To; Wed, 10 Apr 2019 12:43:08 +0000 Received: from kozue.soulik.info ([108.61.200.231]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1hECZE-0002kk-7H for linux-rockchip@lists.infradead.org; Wed, 10 Apr 2019 12:43:07 +0000 Received: from misaki.sumomo.pri (unknown [IPv6:2001:470:b30d:2:c604:15ff:0:401]) by kozue.soulik.info (Postfix) with ESMTPA id CB93F1014F0; Wed, 10 Apr 2019 21:43:51 +0900 (JST) From: ayaka To: linux-media@vger.kernel.org Subject: [PATCH v3 6/9] [TEST]: rockchip: mpp: vdpu2: move qtable to input buffer Date: Wed, 10 Apr 2019 20:42:23 +0800 Message-Id: <20190410124226.8612-7-ayaka@soulik.info> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190410124226.8612-1-ayaka@soulik.info> References: <20190410124226.8612-1-ayaka@soulik.info> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20190410_054304_667699_63AB8DE8 X-CRM114-Status: GOOD ( 10.30 ) X-BeenThere: linux-rockchip@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: Upstream kernel work for Rockchip platforms List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: paul.kocialkowski@bootlin.com, maxime.ripard@bootlin.com, joro@8bytes.org, Randy Li , jernej.skrabec@gmail.com, nicolas@ndufresne.ca, hverkuil@xs4all.nl, linux-rockchip@lists.infradead.org, thomas.petazzoni@bootlin.com, groeck@chromium.org, mchehab@kernel.org, ezequiel@collabora.com, posciak@chromium.org Sender: "Linux-rockchip" Errors-To: linux-rockchip-bounces+patchwork-linux-rockchip=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP From: Randy Li I want the memory region !!! It can save more time if those data are prepared in userspace. Signed-off-by: Randy Li --- drivers/staging/rockchip-mpp/mpp_dev_common.c | 3 +-- drivers/staging/rockchip-mpp/mpp_dev_common.h | 3 --- drivers/staging/rockchip-mpp/mpp_dev_vdpu2.c | 3 +++ drivers/staging/rockchip-mpp/vdpu2/mpeg2.c | 20 +++++++++++-------- 4 files changed, 16 insertions(+), 13 deletions(-) diff --git a/drivers/staging/rockchip-mpp/mpp_dev_common.c b/drivers/staging/rockchip-mpp/mpp_dev_common.c index 21816ad8a43b..97c4d897f168 100644 --- a/drivers/staging/rockchip-mpp/mpp_dev_common.c +++ b/drivers/staging/rockchip-mpp/mpp_dev_common.c @@ -1217,8 +1217,7 @@ static int rockchip_mpp_queue_init(void *priv, struct vb2_queue *src_vq, src_vq->io_modes = VB2_MMAP | VB2_DMABUF; src_vq->drv_priv = session; src_vq->mem_ops = &vb2_dma_contig_memops; - src_vq->dma_attrs = DMA_ATTR_ALLOC_SINGLE_PAGES | - DMA_ATTR_NO_KERNEL_MAPPING; + src_vq->dma_attrs = DMA_ATTR_ALLOC_SINGLE_PAGES; src_vq->buf_struct_size = sizeof(struct v4l2_m2m_buffer); src_vq->min_buffers_needed = 1; src_vq->timestamp_flags = V4L2_BUF_FLAG_TIMESTAMP_COPY; diff --git a/drivers/staging/rockchip-mpp/mpp_dev_common.h b/drivers/staging/rockchip-mpp/mpp_dev_common.h index 33d7725be67b..36770af53a95 100644 --- a/drivers/staging/rockchip-mpp/mpp_dev_common.h +++ b/drivers/staging/rockchip-mpp/mpp_dev_common.h @@ -100,9 +100,6 @@ struct mpp_session { struct v4l2_ctrl_handler ctrl_handler; /* TODO: FIXME: slower than helper function ? */ struct v4l2_ctrl **ctrls; - - dma_addr_t qtable_addr; - void *qtable_vaddr; }; /* The context for the a task */ diff --git a/drivers/staging/rockchip-mpp/mpp_dev_vdpu2.c b/drivers/staging/rockchip-mpp/mpp_dev_vdpu2.c index 1be73ab9c2be..92d68b962fe1 100644 --- a/drivers/staging/rockchip-mpp/mpp_dev_vdpu2.c +++ b/drivers/staging/rockchip-mpp/mpp_dev_vdpu2.c @@ -176,6 +176,9 @@ static int rkvdpu_s_fmt_vid_out_mplane(struct file *filp, void *priv, if (sizes >= SZ_16M) return -EINVAL; + /* For those slice header data */ + pix_mp->plane_fmt[pix_mp->num_planes - 1].sizeimage += SZ_1M; + if (vdpu_setup_ctrls(session, pix_mp->pixelformat)) return -EINVAL; diff --git a/drivers/staging/rockchip-mpp/vdpu2/mpeg2.c b/drivers/staging/rockchip-mpp/vdpu2/mpeg2.c index 837ee4a4a000..c12d1a8ef2da 100644 --- a/drivers/staging/rockchip-mpp/vdpu2/mpeg2.c +++ b/drivers/staging/rockchip-mpp/vdpu2/mpeg2.c @@ -113,7 +113,10 @@ int rkvdpu_mpeg2_gen_reg(struct mpp_session *session, void *regs, const struct v4l2_ctrl_mpeg2_slice_params *params; const struct v4l2_mpeg2_sequence *sequence; const struct v4l2_mpeg2_picture *picture; + const struct v4l2_ctrl_mpeg2_quantization *quantization; struct vdpu2_regs *p_regs = regs; + void *qtable = NULL; + size_t stream_len = 0; params = rockchip_mpp_get_cur_ctrl(session, V4L2_CID_MPEG_VIDEO_MPEG2_SLICE_PARAMS); @@ -122,6 +125,8 @@ int rkvdpu_mpeg2_gen_reg(struct mpp_session *session, void *regs, sequence = ¶ms->sequence; picture = ¶ms->picture; + quantization = rockchip_mpp_get_cur_ctrl(session, + V4L2_CID_MPEG_VIDEO_MPEG2_QUANTIZATION); init_hw_cfg(p_regs); @@ -198,7 +203,13 @@ int rkvdpu_mpeg2_gen_reg(struct mpp_session *session, void *regs, p_regs->sw64.rlc_vlc_base = vb2_dma_contig_plane_dma_addr(&src_buf->vb2_buf, 0); p_regs->sw122.strm_start_bit = params->data_bit_offset; - p_regs->sw51.stream_len = vb2_get_plane_payload(&src_buf->vb2_buf, 0); + stream_len = vb2_get_plane_payload(&src_buf->vb2_buf, 0); + p_regs->sw51.stream_len = stream_len; + + qtable = vb2_plane_vaddr(&src_buf->vb2_buf, 0) + ALIGN(stream_len, 8); + mpeg2_dec_copy_qtable(qtable, quantization); + p_regs->sw61.qtable_base = p_regs->sw64.rlc_vlc_base + + ALIGN(stream_len, 8); return 0; } @@ -207,7 +218,6 @@ int rkvdpu_mpeg2_prepare_buf(struct mpp_session *session, void *regs) { const struct v4l2_ctrl_mpeg2_slice_params *params; const struct v4l2_mpeg2_sequence *sequence; - const struct v4l2_ctrl_mpeg2_quantization *quantization; const struct v4l2_mpeg2_picture *picture; struct vb2_v4l2_buffer *dst_buf; dma_addr_t cur_addr, fwd_addr, bwd_addr; @@ -220,9 +230,6 @@ int rkvdpu_mpeg2_prepare_buf(struct mpp_session *session, void *regs) picture = ¶ms->picture; sequence = ¶ms->sequence; - quantization = rockchip_mpp_get_cur_ctrl(session, - V4L2_CID_MPEG_VIDEO_MPEG2_QUANTIZATION); - dst_buf = v4l2_m2m_next_dst_buf(session->fh.m2m_ctx); cur_addr = vb2_dma_contig_plane_dma_addr(&dst_buf->vb2_buf, 0); @@ -266,8 +273,5 @@ int rkvdpu_mpeg2_prepare_buf(struct mpp_session *session, void *regs) p_regs->sw135.refer3_base = cur_addr >> 2; } - mpeg2_dec_copy_qtable(session->qtable_vaddr, quantization); - p_regs->sw61.qtable_base = session->qtable_addr; - return 0; }