From patchwork Wed Apr 10 12:42:22 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: ayaka X-Patchwork-Id: 10893827 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 233F11390 for ; Wed, 10 Apr 2019 12:43:08 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 0507726B39 for ; Wed, 10 Apr 2019 12:43:08 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id ED42B289B6; Wed, 10 Apr 2019 12:43:07 +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 9603726B39 for ; Wed, 10 Apr 2019 12:43:07 +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=EsIkxFDmbWsKvr+9jokqF/XCfIhNWuugrZqWYCNrl5Q=; b=rDse3A+/50iXel WKsF/iVuu03OGXdaBUx9joRoX3gLCUxNB2sdMTBkkpW37ennsQDdzdBvQUq7W7GMwd6Re6hiN8TI8 d4V15rhSUIpImjF1hq9qjfxy/Ndc/m31gfDgCM2PZaKh9qy9noAAJGYQc6GFyf2u8w987xOJwaaBa AsxFo21yvDYGPVycmpOuSOVN9KZI4hes+3bReRob8DnGPYfkayWfGBnI1urd/lz+xCtyJGDTQlY8F Lzqsks2gfOUv98UWa3VQOcSz9AbqKJXcPZA/nmyf6zDBdwfSEZNmeO9pQ/aa0w7qYj27w+PKYNO5L uz7a/fOtLrfhxrCDahOg==; 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 1hECZF-0002mT-5B; Wed, 10 Apr 2019 12:43:05 +0000 Received: from kozue.soulik.info ([2001:19f0:7000:8404:5054:ff:fe75:428f]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1hECZC-0002j5-21 for linux-rockchip@lists.infradead.org; Wed, 10 Apr 2019 12:43:03 +0000 Received: from misaki.sumomo.pri (unknown [IPv6:2001:470:b30d:2:c604:15ff:0:401]) by kozue.soulik.info (Postfix) with ESMTPA id A5EA21014ED; Wed, 10 Apr 2019 21:43:48 +0900 (JST) From: ayaka To: linux-media@vger.kernel.org Subject: [PATCH v3 5/9] [TEST]: rockchip: mpp: support qtable Date: Wed, 10 Apr 2019 20:42:22 +0800 Message-Id: <20190410124226.8612-6-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_054302_336319_D130E08E X-CRM114-Status: GOOD ( 10.86 ) 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 don't care, I don't want to store buffers for a session. I just want to use it to verify the FFmpeg. --- drivers/staging/rockchip-mpp/mpp_dev_common.h | 3 +++ drivers/staging/rockchip-mpp/mpp_dev_vdpu2.c | 5 ++++- drivers/staging/rockchip-mpp/vdpu2/mpeg2.c | 13 ++++++++----- 3 files changed, 15 insertions(+), 6 deletions(-) diff --git a/drivers/staging/rockchip-mpp/mpp_dev_common.h b/drivers/staging/rockchip-mpp/mpp_dev_common.h index 36770af53a95..33d7725be67b 100644 --- a/drivers/staging/rockchip-mpp/mpp_dev_common.h +++ b/drivers/staging/rockchip-mpp/mpp_dev_common.h @@ -100,6 +100,9 @@ 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 dbd9f334562e..1be73ab9c2be 100644 --- a/drivers/staging/rockchip-mpp/mpp_dev_vdpu2.c +++ b/drivers/staging/rockchip-mpp/mpp_dev_vdpu2.c @@ -246,6 +246,9 @@ static int rkvdpu_open(struct file *filp) if (IS_ERR_OR_NULL(session)) return PTR_ERR(session); + session->qtable_vaddr = dmam_alloc_coherent(mpp_dev->dev, 64 * 4, + &session->qtable_addr, + GFP_KERNEL); filp->private_data = &session->fh; pm_runtime_get_sync(mpp_dev->dev); @@ -529,7 +532,7 @@ static int rockchip_mpp_rkvdpu_probe(struct platform_device *pdev) ret = mpp_dev_register_node(mpp_dev, mpp_dev->variant->node_name, NULL, &rkvdpu_ioctl_ops); if (ret) - dev_err(dev, "register char device failed: %d\n", ret); + dev_err(dev, "register v4l2/media device failed: %d\n", ret); memcpy(mpp_dev->fmt_out, fmt_out_templ, sizeof(fmt_out_templ)); memcpy(mpp_dev->fmt_cap, fmt_cap_templ, sizeof(fmt_cap_templ)); diff --git a/drivers/staging/rockchip-mpp/vdpu2/mpeg2.c b/drivers/staging/rockchip-mpp/vdpu2/mpeg2.c index d32958c4cb20..837ee4a4a000 100644 --- a/drivers/staging/rockchip-mpp/vdpu2/mpeg2.c +++ b/drivers/staging/rockchip-mpp/vdpu2/mpeg2.c @@ -52,7 +52,7 @@ static const u8 intra_default_q_matrix[64] = { static void mpeg2_dec_copy_qtable(u8 * qtable, const struct v4l2_ctrl_mpeg2_quantization *ctrl) { - int i, n; + int i; if (!qtable || !ctrl) return; @@ -111,16 +111,12 @@ int rkvdpu_mpeg2_gen_reg(struct mpp_session *session, void *regs, struct vb2_v4l2_buffer *src_buf) { const struct v4l2_ctrl_mpeg2_slice_params *params; - const struct v4l2_ctrl_mpeg2_quantization *quantization; const struct v4l2_mpeg2_sequence *sequence; const struct v4l2_mpeg2_picture *picture; struct vdpu2_regs *p_regs = regs; params = rockchip_mpp_get_cur_ctrl(session, V4L2_CID_MPEG_VIDEO_MPEG2_SLICE_PARAMS); - quantization = rockchip_mpp_get_cur_ctrl(session, - V4L2_CID_MPEG_VIDEO_MPEG2_QUANTIZATION); - if (!params) return -EINVAL; @@ -211,6 +207,7 @@ 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; @@ -223,6 +220,9 @@ 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,5 +266,8 @@ 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; }