From patchwork Wed Jan 24 10:59:41 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Smitha T Murthy X-Patchwork-Id: 10182201 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 9EC89602B7 for ; Wed, 24 Jan 2018 11:26:09 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 7154D286D4 for ; Wed, 24 Jan 2018 11:26:09 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 65FE8288D3; Wed, 24 Jan 2018 11:26:09 +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=-4.2 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,RCVD_IN_DNSWL_MED autolearn=unavailable version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [65.50.211.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 C7DAB286D4 for ; Wed, 24 Jan 2018 11:26:08 +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:MIME-Version:Cc:List-Subscribe: List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id: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=YnVW63vnFIY9Fh8N3GxnC00QkgSg2miaRvPRppKJMlE=; b=n9llaXCye4BjzI1zejq0lSvi7K iumkpaZhDGd3h4SxwL3Lvhcv3iKveJOidOQ3Eyjz8RKKlxCRJQxsr1ZqXL6CW+vZoeqCplj6GPF2g cqrKKlDdKnXEdkY4e45kWFJtI2BN/lqRP1b1o4iv+WEhw6GevBdvvB4LJBk0rWT6HH9xdpmORkRO5 xJ4l5g3aPU+N/Q45ki0W5cZAApl8DxiF0lyU+vYvp7edXJV+kkoNdE0GEoEsudG+GPUSdXFEMtVMG DXP0py1tBzz2XsDuMWgna1ObLmU4NAnhK+ZiPdq2KJFWU7An9m0oBEh1vI3mRVN+8cN79Nxd/AgRL YsrLjhVg==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.89 #1 (Red Hat Linux)) id 1eeJBu-0005Du-Rl; Wed, 24 Jan 2018 11:26:06 +0000 Received: from mailout4.samsung.com ([203.254.224.34]) by bombadil.infradead.org with esmtps (Exim 4.89 #1 (Red Hat Linux)) id 1eeJ9x-00022E-Bm for linux-arm-kernel@lists.infradead.org; Wed, 24 Jan 2018 11:24:11 +0000 Received: from epcas2p4.samsung.com (unknown [182.195.41.56]) by mailout4.samsung.com (KnoxPortal) with ESMTP id 20180124112353epoutp042bfa1a79ca50e6d54c7880124ffd2757~Muzo3aT-Y1757117571epoutp04S; Wed, 24 Jan 2018 11:23:53 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout4.samsung.com 20180124112353epoutp042bfa1a79ca50e6d54c7880124ffd2757~Muzo3aT-Y1757117571epoutp04S DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1516793033; bh=lkaUBy6RogiNQJdAOaIBDJaFnU5yDlNXHwEpRXe8pZY=; h=From:To:Cc:Subject:Date:In-reply-to:References:From; b=hgy3Nyiuvylbntjxil9QXUDFThc2D2GnSUY0TWDqKjtPgmn+ziWjVgEfPArAXB6gC Y1WA/rhuuWLSAMYV3xIG+UQmku1gWH/Hd+3OsFIuj7z6YzrRYUoCxVP94EYnas6XGb JyItM0wWdaycucNNryJeF92LUk78WqbY048eVJFA= Received: from epsmges2p4.samsung.com (unknown [182.195.42.72]) by epcas2p1.samsung.com (KnoxPortal) with ESMTP id 20180124112352epcas2p15e13ee0054a01ea541f4328b6916cf85~MuzoHkIi51106511065epcas2p1e; Wed, 24 Jan 2018 11:23:52 +0000 (GMT) Received: from epcas2p4.samsung.com ( [182.195.41.56]) by epsmges2p4.samsung.com (Symantec Messaging Gateway) with SMTP id 5D.EA.04080.8CC686A5; Wed, 24 Jan 2018 20:23:52 +0900 (KST) Received: from epsmgms2p2new.samsung.com (unknown [182.195.42.143]) by epcas2p2.samsung.com (KnoxPortal) with ESMTP id 20180124112351epcas2p2e111be35495863530b11043b3fccd795~MuznC_Znh1099410994epcas2p20; Wed, 24 Jan 2018 11:23:51 +0000 (GMT) X-AuditID: b6c32a48-9adff70000000ff0-a2-5a686cc8b791 Received: from epmmp1.local.host ( [203.254.227.16]) by epsmgms2p2new.samsung.com (Symantec Messaging Gateway) with SMTP id 06.9F.03890.7CC686A5; Wed, 24 Jan 2018 20:23:51 +0900 (KST) Received: from localhost.localdomain ([107.108.83.49]) by mmp1.samsung.com (Oracle Communications Messaging Server 7.0.5.31.0 64bit (built May 5 2014)) with ESMTPA id <0P3200KGC4YRQ420@mmp1.samsung.com>; Wed, 24 Jan 2018 20:23:51 +0900 (KST) From: Smitha T Murthy To: linux-arm-kernel@lists.infradead.org, linux-media@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [Patch v7 09/12] [media] s5p-mfc: Add VP9 decoder support Date: Wed, 24 Jan 2018 16:29:41 +0530 Message-id: <1516791584-7980-10-git-send-email-smitha.t@samsung.com> X-Mailer: git-send-email 1.7.2.3 In-reply-to: <1516791584-7980-1-git-send-email-smitha.t@samsung.com> X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFrrIIsWRmVeSWpSXmKPExsWy7bCmhe6JnIwog2c3RS1urTvHanFk7VUm i5kn2lktzp/fwG5xtukNu8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EhifmXYxcHEICOxkl/m5bygzh/GCUuP6kDcjh5GAT0JH49v40 G4gtIpAqsXbreVaQImaQoqYDL9lBEsICThI7d7WxgtgsAqoSb97dAmvgFXCRePxmA5gtIaAg 8erGWnaQzZxA8U1vKkHCQgLOEv1Pu5gnMPIsYGRYxSiZWlCcm55bbFRglJdarlecmFtcmpeu l5yfu4kRGH7bDmv172B8vCT+EKMAB6MSD2+DWXqUEGtiWXFl7iFGCQ5mJRHePFagEG9KYmVV alF+fFFpTmrxIUZpDhYlcV7+/GORQgLpiSWp2ampBalFMFkmDk6pBsbFbtu1N1xY5r91voJ0 yC6m0p/RJ6yfbLRdc/vxwfZjSWumz9kt7iboMmvdXe1tjHdndJZ28RQ+r9zDmKxWOCVnQ7zG TifNZ9tzd+r25B9X9Ra4to1LYYt4t1WIZvSByrNC3T3T7POc7deXqv4X0veK+OpgGFjzcvIe A9/3nxX5NyXItugd367EUpyRaKjFXFScCAB/7DGwOwIAAA== X-CMS-MailID: 20180124112351epcas2p2e111be35495863530b11043b3fccd795 X-Msg-Generator: CA CMS-TYPE: 102P X-CMS-RootMailID: 20180124112351epcas2p2e111be35495863530b11043b3fccd795 X-RootMTR: 20180124112351epcas2p2e111be35495863530b11043b3fccd795 References: <1516791584-7980-1-git-send-email-smitha.t@samsung.com> X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: a.hajda@samsung.com, pankaj.dubey@samsung.com, kamil@wypas.org, krzk@kernel.org, jtp.park@samsung.com, kyungmin.park@samsung.com, s.nawrocki@samsung.com, Smitha T Murthy , mchehab@kernel.org, m.szyprowski@samsung.com MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP Add support for codec definition and corresponding buffer requirements for VP9 decoder. Signed-off-by: Smitha T Murthy Reviewed-by: Andrzej Hajda Acked-by: Hans Verkuil --- drivers/media/platform/s5p-mfc/regs-mfc-v10.h | 6 ++++++ drivers/media/platform/s5p-mfc/s5p_mfc_cmd_v6.c | 3 +++ drivers/media/platform/s5p-mfc/s5p_mfc_common.h | 1 + drivers/media/platform/s5p-mfc/s5p_mfc_dec.c | 7 +++++++ drivers/media/platform/s5p-mfc/s5p_mfc_opr.h | 2 ++ drivers/media/platform/s5p-mfc/s5p_mfc_opr_v6.c | 26 +++++++++++++++++++++++++ 6 files changed, 45 insertions(+) diff --git a/drivers/media/platform/s5p-mfc/regs-mfc-v10.h b/drivers/media/platform/s5p-mfc/regs-mfc-v10.h index d905468..bbfa1cf 100644 --- a/drivers/media/platform/s5p-mfc/regs-mfc-v10.h +++ b/drivers/media/platform/s5p-mfc/regs-mfc-v10.h @@ -17,6 +17,8 @@ /* MFCv10 register definitions*/ #define S5P_FIMV_MFC_CLOCK_OFF_V10 0x7120 #define S5P_FIMV_MFC_STATE_V10 0x7124 +#define S5P_FIMV_D_STATIC_BUFFER_ADDR_V10 0xF570 +#define S5P_FIMV_D_STATIC_BUFFER_SIZE_V10 0xF574 /* MFCv10 Context buffer sizes */ #define MFC_CTX_BUF_SIZE_V10 (30 * SZ_1K) @@ -33,8 +35,12 @@ /* MFCv10 codec defines*/ #define S5P_FIMV_CODEC_HEVC_DEC 17 +#define S5P_FIMV_CODEC_VP9_DEC 18 #define S5P_FIMV_CODEC_HEVC_ENC 26 +/* Decoder buffer size for MFC v10 */ +#define DEC_VP9_STATIC_BUFFER_SIZE 20480 + /* Encoder buffer size for MFC v10.0 */ #define ENC_V100_BASE_SIZE(x, y) \ (((x + 3) * (y + 3) * 8) \ diff --git a/drivers/media/platform/s5p-mfc/s5p_mfc_cmd_v6.c b/drivers/media/platform/s5p-mfc/s5p_mfc_cmd_v6.c index 76eca67..102b47e 100644 --- a/drivers/media/platform/s5p-mfc/s5p_mfc_cmd_v6.c +++ b/drivers/media/platform/s5p-mfc/s5p_mfc_cmd_v6.c @@ -104,6 +104,9 @@ static int s5p_mfc_open_inst_cmd_v6(struct s5p_mfc_ctx *ctx) case S5P_MFC_CODEC_HEVC_DEC: codec_type = S5P_FIMV_CODEC_HEVC_DEC; break; + case S5P_MFC_CODEC_VP9_DEC: + codec_type = S5P_FIMV_CODEC_VP9_DEC; + break; case S5P_MFC_CODEC_H264_ENC: codec_type = S5P_FIMV_CODEC_H264_ENC_V6; break; diff --git a/drivers/media/platform/s5p-mfc/s5p_mfc_common.h b/drivers/media/platform/s5p-mfc/s5p_mfc_common.h index 702e136..e748b99 100644 --- a/drivers/media/platform/s5p-mfc/s5p_mfc_common.h +++ b/drivers/media/platform/s5p-mfc/s5p_mfc_common.h @@ -73,6 +73,7 @@ #define S5P_MFC_CODEC_VC1RCV_DEC 6 #define S5P_MFC_CODEC_VP8_DEC 7 #define S5P_MFC_CODEC_HEVC_DEC 17 +#define S5P_MFC_CODEC_VP9_DEC 18 #define S5P_MFC_CODEC_H264_ENC 20 #define S5P_MFC_CODEC_H264_MVC_ENC 21 diff --git a/drivers/media/platform/s5p-mfc/s5p_mfc_dec.c b/drivers/media/platform/s5p-mfc/s5p_mfc_dec.c index 4749355..5cf4d99 100644 --- a/drivers/media/platform/s5p-mfc/s5p_mfc_dec.c +++ b/drivers/media/platform/s5p-mfc/s5p_mfc_dec.c @@ -151,6 +151,13 @@ static struct s5p_mfc_fmt formats[] = { .num_planes = 1, .versions = MFC_V10_BIT, }, + { + .fourcc = V4L2_PIX_FMT_VP9, + .codec_mode = S5P_FIMV_CODEC_VP9_DEC, + .type = MFC_FMT_DEC, + .num_planes = 1, + .versions = MFC_V10_BIT, + }, }; #define NUM_FORMATS ARRAY_SIZE(formats) diff --git a/drivers/media/platform/s5p-mfc/s5p_mfc_opr.h b/drivers/media/platform/s5p-mfc/s5p_mfc_opr.h index e7a2d46..57f4560 100644 --- a/drivers/media/platform/s5p-mfc/s5p_mfc_opr.h +++ b/drivers/media/platform/s5p-mfc/s5p_mfc_opr.h @@ -170,6 +170,8 @@ struct s5p_mfc_regs { void __iomem *d_used_dpb_flag_upper;/* v7 and v8 */ void __iomem *d_used_dpb_flag_lower;/* v7 and v8 */ void __iomem *d_min_scratch_buffer_size; /* v10 */ + void __iomem *d_static_buffer_addr; /* v10 */ + void __iomem *d_static_buffer_size; /* v10 */ /* encoder registers */ void __iomem *e_frame_width; diff --git a/drivers/media/platform/s5p-mfc/s5p_mfc_opr_v6.c b/drivers/media/platform/s5p-mfc/s5p_mfc_opr_v6.c index 8c47294..f47612c 100644 --- a/drivers/media/platform/s5p-mfc/s5p_mfc_opr_v6.c +++ b/drivers/media/platform/s5p-mfc/s5p_mfc_opr_v6.c @@ -226,6 +226,12 @@ static int s5p_mfc_alloc_codec_buffers_v6(struct s5p_mfc_ctx *ctx) ctx->scratch_buf_size + (ctx->mv_count * ctx->mv_size); break; + case S5P_MFC_CODEC_VP9_DEC: + mfc_debug(2, "Use min scratch buffer size\n"); + ctx->bank1.size = + ctx->scratch_buf_size + + DEC_VP9_STATIC_BUFFER_SIZE; + break; case S5P_MFC_CODEC_H264_ENC: if (IS_MFCV10(dev)) { mfc_debug(2, "Use min scratch buffer size\n"); @@ -336,6 +342,7 @@ static int s5p_mfc_alloc_instance_buffer_v6(struct s5p_mfc_ctx *ctx) case S5P_MFC_CODEC_VC1_DEC: case S5P_MFC_CODEC_MPEG2_DEC: case S5P_MFC_CODEC_VP8_DEC: + case S5P_MFC_CODEC_VP9_DEC: ctx->ctx.size = buf_size->other_dec_ctx; break; case S5P_MFC_CODEC_H264_ENC: @@ -566,6 +573,13 @@ static int s5p_mfc_set_dec_frame_buffer_v6(struct s5p_mfc_ctx *ctx) buf_size1 -= frame_size_mv; } } + if (ctx->codec_mode == S5P_FIMV_CODEC_VP9_DEC) { + writel(buf_addr1, mfc_regs->d_static_buffer_addr); + writel(DEC_VP9_STATIC_BUFFER_SIZE, + mfc_regs->d_static_buffer_size); + buf_addr1 += DEC_VP9_STATIC_BUFFER_SIZE; + buf_size1 -= DEC_VP9_STATIC_BUFFER_SIZE; + } mfc_debug(2, "Buf1: %zx, buf_size1: %d (frames %d)\n", buf_addr1, buf_size1, ctx->total_dpb_count); @@ -2272,6 +2286,18 @@ const struct s5p_mfc_regs *s5p_mfc_init_regs_v6_plus(struct s5p_mfc_dev *dev) R(e_h264_options, S5P_FIMV_E_H264_OPTIONS_V8); R(e_min_scratch_buffer_size, S5P_FIMV_E_MIN_SCRATCH_BUFFER_SIZE_V8); + if (!IS_MFCV10(dev)) + goto done; + + /* Initialize registers used in MFC v10 only. + * Also, over-write the registers which have + * a different offset for MFC v10. + */ + + /* decoder registers */ + R(d_static_buffer_addr, S5P_FIMV_D_STATIC_BUFFER_ADDR_V10); + R(d_static_buffer_size, S5P_FIMV_D_STATIC_BUFFER_SIZE_V10); + done: return &mfc_regs; #undef S5P_MFC_REG_ADDR