From patchwork Tue Jun 13 07:48:46 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ming Qian X-Patchwork-Id: 13278115 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id AC58BC7EE29 for ; Tue, 13 Jun 2023 07:49:45 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:Message-Id:Date:Subject:Cc :To:From:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References: List-Owner; bh=nPr0ZTV++SeBo7KhYxir6czq29aGXOsQyXEykagjZ3w=; b=HRTBMkVphfnaBs gsW5qN6Glk8TFhB1lySdatJZe8jT7Avi48CIRDG6qwY7qy5gZghThTUJp/JhTrRvKQ6AGO7fH58W1 kktbBdJJc+HokrCl63vU+CR1jWd46l/xDFCnSf0va7hnf2N7KwWCLyyemtLFnfNwFXt3PTdqnbpme RNUJfWLDVVa+Oiqn4JarFXbdlLOqTlQ/B2ReyDeGjOTs53d7WakJnyB/rOfc0SDgFAhXnuz8pZVsU wpeZWT1FVrq7Wiu7rA0urIbiogFMgdsmZ5QdH/wrXGlszYY60Yx9JnGaHg9BsxSOPSVEXwasT8ab+ BAHDAkE+wQbbZwZLw42Q==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1q8ymF-007GtH-0E; Tue, 13 Jun 2023 07:49:19 +0000 Received: from mail-he1eur04on0608.outbound.protection.outlook.com ([2a01:111:f400:fe0d::608] helo=EUR04-HE1-obe.outbound.protection.outlook.com) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1q8ymC-007Grl-1y for linux-arm-kernel@lists.infradead.org; Tue, 13 Jun 2023 07:49:17 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=KcATIlpWfP6B/IevjecTIeRA7x6NsnNH2IGwikXU40H1Ncwjl08ze2csd7LVlAN51k0n1owAfoSAI2l1gSQDdogoRjkSFUn3/4mofrQmL2CedxKvzppjV3Iydz3YWmw90XlR78A3EytYMM+HmFVAkFa3uEeCythN7tEQJuqMavfX9ni7T2gkoWOe2tJ2e1Fn3vX2ktqIz6qXcp04+h8XnpEnqEgALhuVwdprZPSX95fcbKUNXoMFos3UacFR39bDcCpDZtjwms1//EwZcg9JJ+baUrsqU/FeqEKGsNw74Wznstp45vyo0+FgSceUez7VBUkfHh9VQ2kC8sX4w1IM/Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=Af93fDqXRu5YU8Vnwu8C4ZAYZOBeMNDCy2/lscY4CF4=; b=Vsc+MH5EXs7tvz5QAbKtERWEhfdRwzRN1tvEouGAmKqxwEYYhEFKGU4AsGklxZRvoOsPadaDWCbiH91U3yOLkoAcHY+jYn6zMVSfiRiNunjTWO2H/d85z7Tz2LtgugVU+cRNOhX2B86BSdl3GN5D9/VXVqWqeq+S8xXdg+nXgD+FKJjjr/9YIots2Xc0XnjgFqthXJy8Cz+R+FPdNR/NPY/YVFlaF5N8bJbcpVcb4S7CPCByMVH1cMVSa5ZQJ45QYD1hLNx9xhmvqvTJdeH+veZsan/Iii0OHrKfRbZK7/dbLCQY8f4NgvaV/Fg/mlbJFw8zDGPiDOW5z8ujh+71Cw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=nxp.com; dmarc=pass action=none header.from=nxp.com; dkim=pass header.d=nxp.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nxp.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=Af93fDqXRu5YU8Vnwu8C4ZAYZOBeMNDCy2/lscY4CF4=; b=DlRkud95rJdbFtpnM7rl5WZUJOdl7oH6ApmwZoqzaAzEtT6/nJBVgBLI2lJi4rduYAKzvWzmEZI08EipdStnuoHNWgOq+8hbRLrnXWums18E8arIQC56Rd3f9ug6QatN5MIOetoj3okXeHekVy5Qz3iPzHk1kYY17kHHdJtSPUc= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nxp.com; Received: from AM6PR04MB6341.eurprd04.prod.outlook.com (2603:10a6:20b:d8::14) by PAXPR04MB8591.eurprd04.prod.outlook.com (2603:10a6:102:21a::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6455.44; Tue, 13 Jun 2023 07:49:08 +0000 Received: from AM6PR04MB6341.eurprd04.prod.outlook.com ([fe80::79f2:2888:dbd7:ad6f]) by AM6PR04MB6341.eurprd04.prod.outlook.com ([fe80::79f2:2888:dbd7:ad6f%7]) with mapi id 15.20.6455.039; Tue, 13 Jun 2023 07:49:08 +0000 From: Ming Qian To: mchehab@kernel.org, hverkuil-cisco@xs4all.nl Cc: shawnguo@kernel.org, robh+dt@kernel.org, s.hauer@pengutronix.de, kernel@pengutronix.de, festevam@gmail.com, linux-imx@nxp.com, xiahong.bao@nxp.com, eagle.zhou@nxp.com, tao.jiang_2@nxp.com, linux-media@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org Subject: [PATCH] media: amphion: reinit vpu if reqbufs output 0 Date: Tue, 13 Jun 2023 15:48:46 +0800 Message-Id: <20230613074846.25964-1-ming.qian@nxp.com> X-Mailer: git-send-email 2.38.1 X-ClientProxiedBy: SG2PR06CA0193.apcprd06.prod.outlook.com (2603:1096:4:1::25) To AM6PR04MB6341.eurprd04.prod.outlook.com (2603:10a6:20b:d8::14) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: AM6PR04MB6341:EE_|PAXPR04MB8591:EE_ X-MS-Office365-Filtering-Correlation-Id: 3f1f6871-cc36-4175-69be-08db6be2ab3e X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: PCBpNE3efftURHO2hgjl9imdD5fWU6de7zcHzdLkNdPgJ0rDgmTMU9y4+2J5/wiBL/NW+pJhmsA7JegkAjginLaUWUMroLG9lVi9KCndeh1zWtmT9u84FtlqtI77EnqF7QzxcYlA9YbLpy8T5DLhHQDcsHCXHvMwlpEe9ivIzm9THZlhLx3TkSLGwg+ngpHOZazjCsNovRsZM/JoPeClFPX/DFSkrT2Xaw3KPTi84SDbcMh9A5021vlrXSHmLPjlCnRsoyIJAKJBDCyBoJ/zRi89t04/Wgs/jOdB51C0GwqIBNW649ngPzY2Vpe5Uf9Deu6pxKsCIiOGrsbzWaWaOS+NeUsKaHSqddLe/ULRc3N3zPfjYLMO/3V025riLgAFAtGmJHC9xYSb1uzOENZoGv43PCojhu9nqZGIiBUGTOVza9HvjEXnqWElnISCq+73J9GH6DUBIIEOtC0cxB5oehQ/QTC8K1vKvKfIIVXz78nYd6qCIwbEOxu5xvtQgKeM1feFbLL/JzSig7DnkxELnYKPGNZxlZSt57+0ybXxlTnrS4saDDSjydUbELP0voNgGieVzpzYm5YbbvlYrM2aKv1G/DnwT3v6VE38BpPEj7f6DLDb1C2B3yWGj+ix2v8Q X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:AM6PR04MB6341.eurprd04.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230028)(4636009)(366004)(346002)(39860400002)(136003)(396003)(376002)(451199021)(6486002)(52116002)(6666004)(83380400001)(36756003)(2616005)(38100700002)(38350700002)(86362001)(6512007)(1076003)(6506007)(26005)(186003)(2906002)(66476007)(4326008)(44832011)(316002)(7416002)(66556008)(66946007)(41300700001)(5660300002)(478600001)(8936002)(8676002);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: 9YkpMoFW/nXiuCHiEz6p5OqkOggvPw3B0GGqfPN1OEIvJ3JJCMepZ5lFkj8JJWyVtRPd/m0/W7tuh27pSqtmERZoCTvXU9EWUyXZToJLpTRzHaJgBBd6lL3DYoYDRbWIGES+4M9p1ibqpYEaPwkUpVJyEXDZSNs5O4i1SflhL/ddAaz8+Yw0zV94cM8jZVKCUl06P8b1k8cJ8WAqRSSD6TQ1seFSZyFMOOyRIv5BCLoISJXdVQq90aADdJEwsQmezjZwzRbIjAhEc9wnJDtsiR9os61v/i9NtANs8N2KmWdpjjzJBPIlNFJyJ1cJdDlnccygS2Ks7EEBa3icuEXHgGd0mMr7cmKVxv45BvBi3xHBGQX9V1FmvgubloPoYjB2r/z70q+HtqyTdVCGgGp+rHQu2l/FgvpUP4a4+GkSwKxyF3jx0fDY05iDHPZFIQheBJWralusG87o5eekwU0dfolKdBhbbMxJynO9zdyPD8+D0Ia9TB0iakxpjBrTCEoDEnoEo+3eJy8GHCtCpTi5rvaVPYnAhbIFQqeGZKbN+C+ILJGW2Tk8mUdoHT1rmrHiFraOh1YNDLY5B+TtN0kxOVN21+Qdk20M+L6ZEzY965GR/JzHDjdsqW/eEUVPe2gJtxDW0ETTP7gU8KsMY0LtoU5Z+T1vsWHec9iYuTGFyP02v0YqxgN4AQRjh+77xcJShbc4TCwkHprjLkOOwJyrCj9R5dZO7eigNyIDFvWbj0GiVZGLpyyL0HdD1sMEJBR17ivZ9ADEfwPGf3Yg7qDrr1cQGuhisdEUeb6vKR7BoZZ0dOoCP4g74hy0JiwHC2gkUFd31+x9tmKMoVaFHicHPkvBvODN/kCFPPUcUoXEkwYGsiIRtQfimDxGihENU77aJaIr9YjqPzSzz310PVUrs3t20QC47dYCcGMRd7U9m/JjM86DHzaBUev7BImPP/kECMByzFmD4PCGeRw3jwMJjkHbY8F2boF0+BusmtQVKQaSBQhYHUHi3KYPgQ1a6Cn7NY9p49PXpiUvYVFHSxbhVy2MvIrGtPvGMhloC+alwufo2suAjylisaYD0nzcxpLCAjj+qOoMUyXtlhRE9vyCsIPbiszDABvl9jyC3i3K/wdivft4deVd9o2nI1TkkdxbsTVExyPN50ldkRUMv2G+wskaCZVrwh0cohlDscE8zyY0fqg4dqUiygVh82RYVODbLDApJhoWgsmO6SmWvC2ysNqk90EaBV6xYMaw0DZweltvjcIx09oobizHgLrG8gNH7s200hsOzhbAJ6dhyhtRhQvY6TImX4bK+kC73k7mNXi01S5+tcaVzt7CWOA8SNyMpGmD6AfJDXTFDdwZjT1k+yww2sue+FjzpES+wICdA0tlnzjRtvuVKTtb4cBXvXOsNvQ9n8MvjbhOruVCdppIc0qf9aWt7+5xklvH/Q9HHM8zIqefj9GsE3QRXa3HcxOncV9j+o224Hfo+6HovINm6mdO5vdcx6BpBaD0/uEY3+i0GGx6tMRM9FyN8ghC9TFoY88yDaE/Z7XaJMyU/AZHh4p4tiTva456dAGblm+kJgXGT19ySVotGaDPPhbWe/81 X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 3f1f6871-cc36-4175-69be-08db6be2ab3e X-MS-Exchange-CrossTenant-AuthSource: AM6PR04MB6341.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 13 Jun 2023 07:49:08.5127 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 686ea1d3-bc2b-4c6f-a92c-d99c5c301635 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: 6LdMsaAc9bABs1sbkq1qyYNTVP/F8E2psDsb4RqB2cXH2EZRe8QPpRmSWH3QVf01mAGKkNx6P6/8kmId5NZdAQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: PAXPR04MB8591 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230613_004916_670751_5570055A X-CRM114-Status: GOOD ( 11.95 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org according to v4l2 stateful decoder document 4.5.1.3. State Machine, the state should change from seek to initialization if call VIDIOC_REQBUFS(OUTPUT, 0). so reinit the vpu decoder if reqbufs output 0 Fixes: 6de8d628df6e ("media: amphion: add v4l2 m2m vpu decoder stateful driver") Signed-off-by: Ming Qian Tested-by: Nicolas Dufresne Reviewed-by: Nicolas Dufresne --- drivers/media/platform/amphion/vdec.c | 2 -- drivers/media/platform/amphion/vpu_v4l2.c | 7 ++++++- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/drivers/media/platform/amphion/vdec.c b/drivers/media/platform/amphion/vdec.c index 6515f3cdb7a7..56c4deea4494 100644 --- a/drivers/media/platform/amphion/vdec.c +++ b/drivers/media/platform/amphion/vdec.c @@ -1453,9 +1453,7 @@ static void vdec_release(struct vpu_inst *inst) { if (inst->id != VPU_INST_NULL_ID) vpu_trace(inst->dev, "[%d]\n", inst->id); - vpu_inst_lock(inst); vdec_stop(inst, true); - vpu_inst_unlock(inst); } static void vdec_cleanup(struct vpu_inst *inst) diff --git a/drivers/media/platform/amphion/vpu_v4l2.c b/drivers/media/platform/amphion/vpu_v4l2.c index 810e93d2c954..8c9028df3bf4 100644 --- a/drivers/media/platform/amphion/vpu_v4l2.c +++ b/drivers/media/platform/amphion/vpu_v4l2.c @@ -489,6 +489,11 @@ static int vpu_vb2_queue_setup(struct vb2_queue *vq, for (i = 0; i < cur_fmt->mem_planes; i++) psize[i] = vpu_get_fmt_plane_size(cur_fmt, i); + if (V4L2_TYPE_IS_OUTPUT(vq->type) && inst->state == VPU_CODEC_STATE_SEEK) { + vpu_trace(inst->dev, "reinit when VIDIOC_REQBUFS(OUTPUT, 0)\n"); + call_void_vop(inst, release); + } + return 0; } @@ -773,9 +778,9 @@ int vpu_v4l2_close(struct file *file) v4l2_m2m_ctx_release(inst->fh.m2m_ctx); inst->fh.m2m_ctx = NULL; } + call_void_vop(inst, release); vpu_inst_unlock(inst); - call_void_vop(inst, release); vpu_inst_unregister(inst); vpu_inst_put(inst);