From patchwork Wed Apr 10 12:42:24 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: ayaka X-Patchwork-Id: 10893835 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 D459517EF for ; Wed, 10 Apr 2019 12:43:12 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id B71D1289B6 for ; Wed, 10 Apr 2019 12:43:12 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id AB3F226B39; Wed, 10 Apr 2019 12:43:12 +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 4A885289B6 for ; Wed, 10 Apr 2019 12:43:12 +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=AkM6GsBNcsQd9TG3IAEs9O+KgNaIL5DGL6uMKjZN52E=; b=hii12LnmK7pCMB wy210Wlv8fb8EyNH+S5v6C0C1ZD4UGExtEPKJJi45KT/HH9H10nCfgfif4VqMvKXR8z2ZA8xMJFev VjYb+RyL0Nu/IOVktJ9qbNZ1jg/kJzA4xLQQu3OGp0qlLEgoPnY3/40F8IvczKWSfZBtJ+z1PEVJg ONxRHHexh4a0KpJ/hH9LuF8SWWVBGkyurLTgBQCN6tP3lfJ9dQ/f43qBIvhiR2ME49isZ0PUPdnIf riFzh+mjJ+CdXfeJf+jnmiyMwtAbvATgxMbJ0VgQ5WSr2tzmhQ/yDPuX/RBD05uBypWiYDvIns92f AjsfEunGXsZ1rWXLQkjw==; 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 1hECZK-0002re-D8; Wed, 10 Apr 2019 12:43:10 +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 1hECZH-0002p8-W4 for linux-rockchip@lists.infradead.org; Wed, 10 Apr 2019 12:43:09 +0000 Received: from misaki.sumomo.pri (unknown [IPv6:2001:470:b30d:2:c604:15ff:0:401]) by kozue.soulik.info (Postfix) with ESMTPA id 086B81014F2; Wed, 10 Apr 2019 21:43:53 +0900 (JST) From: ayaka To: linux-media@vger.kernel.org Subject: [PATCH v3 7/9] [TEST]: rkvdec: spspps address alignment Date: Wed, 10 Apr 2019 20:42:24 +0800 Message-Id: <20190410124226.8612-8-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_054308_236754_8048041D X-CRM114-Status: UNSURE ( 9.68 ) X-CRM114-Notice: Please train this message. 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, ayaka , randy.li@rock-chips.com, 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 I found the offset for cpu access is not equal to the DMA opeartion. Signed-off-by: ayaka --- drivers/staging/rockchip-mpp/mpp_dev_common.h | 3 +++ drivers/staging/rockchip-mpp/mpp_dev_rkvdec.c | 3 +++ drivers/staging/rockchip-mpp/rkvdec/avc.c | 14 +++++++------- 3 files changed, 13 insertions(+), 7 deletions(-) diff --git a/drivers/staging/rockchip-mpp/mpp_dev_common.h b/drivers/staging/rockchip-mpp/mpp_dev_common.h index 36770af53a95..6718bcccde1f 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; + + void *aux_vaddr; + dma_addr_t aux_addr; }; /* The context for the a task */ diff --git a/drivers/staging/rockchip-mpp/mpp_dev_rkvdec.c b/drivers/staging/rockchip-mpp/mpp_dev_rkvdec.c index 97abfdfc344f..cc1fa9737bc1 100644 --- a/drivers/staging/rockchip-mpp/mpp_dev_rkvdec.c +++ b/drivers/staging/rockchip-mpp/mpp_dev_rkvdec.c @@ -382,6 +382,9 @@ static int rkvdec_open(struct file *filp) filp->private_data = &session->fh; pm_runtime_get_sync(mpp_dev->dev); + session->aux_vaddr = dmam_alloc_coherent(mpp_dev->dev, SZ_1M, + &session->aux_addr, GFP_KERNEL); + mpp_debug_leave(); return 0; } diff --git a/drivers/staging/rockchip-mpp/rkvdec/avc.c b/drivers/staging/rockchip-mpp/rkvdec/avc.c index 1cb5b2208bfa..8266a990dca6 100644 --- a/drivers/staging/rockchip-mpp/rkvdec/avc.c +++ b/drivers/staging/rockchip-mpp/rkvdec/avc.c @@ -26,8 +26,8 @@ #include "regs.h" #include "avc-data.h" -static void generate_input_data(struct rkvdec_regs *p_regs, - struct vb2_v4l2_buffer *src_buf, +static void generate_input_data(struct mpp_session *session, + struct rkvdec_regs *p_regs, const struct v4l2_ctrl_h264_sps *sps, const struct v4l2_ctrl_h264_pps *pps, const struct v4l2_ctrl_h264_scaling_matrix @@ -44,8 +44,8 @@ static void generate_input_data(struct rkvdec_regs *p_regs, stream_len = slice_param->size + 64; - r_data = vb2_plane_vaddr(&src_buf->vb2_buf, 0); - r_scaling_offs = ALIGN(stream_len, 16); + r_data = session->aux_vaddr; + r_scaling_offs = 0; r_data += r_scaling_offs; if (pps->flags & V4L2_H264_PPS_FLAG_PIC_SCALING_MATRIX_PRESENT) { @@ -62,7 +62,7 @@ static void generate_input_data(struct rkvdec_regs *p_regs, rkvdec_avc_write_sps(&rbsp, sps); rkvdec_avc_write_pps(&rbsp, pps); rkvdec_avc_write_pps_tail(&rbsp, scaling_addr, decode_param); - p_regs->sw_pps_base = p_regs->sw_strm_rlc_base + r_sps_offs; + p_regs->sw_pps_base = session->aux_addr + r_sps_offs; for (i = 1; i < 256; i++) memset(r_data + r_sps_offs + i * 32, 0, 32); @@ -72,7 +72,7 @@ static void generate_input_data(struct rkvdec_regs *p_regs, r_rps_offs = ALIGN(r_rps_offs, 16); rbsp_init(&rbsp, r_data + r_rps_offs, SZ_2M - r_rps_offs, 0); rkvdec_avc_write_rps(&rbsp, sps, slice_param, decode_param); - p_regs->sw_rps_base = p_regs->sw_strm_rlc_base + r_rps_offs; + p_regs->sw_rps_base = session->aux_addr + r_rps_offs; } static void init_hw_cfg(struct rkvdec_regs *p_regs) @@ -238,7 +238,7 @@ int rkvdec_avc_gen_reg(struct mpp_session *session, void *regs, dst_buf = v4l2_m2m_next_dst_buf(session->fh.m2m_ctx); rkvdec_avc_gen_ref(p_regs, dst_buf, decode_param); - generate_input_data(p_regs, src_buf, sps, pps, scaling, slice_param, + generate_input_data(session, p_regs, sps, pps, scaling, slice_param, decode_param); return 0;