From patchwork Tue Nov 12 02:15:12 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Jackson.lee" X-Patchwork-Id: 844055 Received: from SEVP216CU002.outbound.protection.outlook.com (mail-koreacentralazon11022128.outbound.protection.outlook.com [40.107.43.128]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id A627020495C; Tue, 12 Nov 2024 02:15:31 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.43.128 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1731377733; cv=fail; b=fVKgQIuYj5fBAhU/dRScpQTEgJPvunSBEGMLnzZmiPqC9CHtA01ErmiVrHkGTTdEGBu9ddhkdWgI4ss/GECSMyhs4SYgL6Ub9vMEfxcfK4ze5JhkujChA+IjfRebI2jhXAAUdnCMoztQCjQ3ZCtMnpqs5oUilyizkQ+LRJVukEE= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1731377733; c=relaxed/simple; bh=6Jo/sF+cOaN5tzi7stLcpLUnnPM1GRltVyH0XACHYdM=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: Content-Type:MIME-Version; b=E0Rb0jW5yMerhEc6XQbyEQyjr2Z3BZipsivpVA7tdydSyocTPB5NbtGed4BxpYTlRWuVLm32Y9b+TMSMdbTl5DGrlVNGMtY7oWQTBDty8P6L9HYkwPhBIdf4KqxRj3qwYDWtFhH2DCFlpla5OYwmDwe4qzN5c13viUb0hEtNTQY= ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=chipsnmedia.com; spf=fail smtp.mailfrom=chipsnmedia.com; dkim=pass (1024-bit key) header.d=chipsnmedia.com header.i=@chipsnmedia.com header.b=X9HGrINd; arc=fail smtp.client-ip=40.107.43.128 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=chipsnmedia.com Authentication-Results: smtp.subspace.kernel.org; spf=fail smtp.mailfrom=chipsnmedia.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=chipsnmedia.com header.i=@chipsnmedia.com header.b="X9HGrINd" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=JLtrbcnwT1wn2xRQb9tdESaDPFGknwW2RROFyAJFA5+clhr0SovNxn/FviEQD1D25uxFTMAae5RqPaBitvF1gbXYkLevNSeJftaWYLycCjeMAO2YeqeCRG0eKDJBaqFEEq/pzFGO8Q+LvB3JCOXvXLXx+XOB2yXd4BshcxVI2OHJlsvHh7TfM+xm4Wa2hc9toNUlDpx/nEKNL6R9jD/Gp3mwfB/HU2Vyof+S24zO+/2CTuxzSSNLglDx13t7kBUf4XpAdRaKzNEVBAjoc4nE2ngVazLccgMrXg8+RuIX7XjhvnhaFVQEC3Z0S5k6aNJhpSN5xPS9CNZyCVHxTy4mCg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; 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=PjPtAm/hRnUMCrkhdL3i4MNXAHVNv8jzN/M99OmObOE=; b=XBxUf0KREylxTLXFdVaCg6zan6Teju/orzXujnPXa8jSoUXwlAHO5tBYMrpq8hdjm6+5ZaHs29DAqJV153kRLCs/ETjLWf/9OCecRwamXfTpdTYFZ59HtHKknzU2L9vGHBa5SajSbuGxmW24HuEwUfYqZ7GvHy/DC2H84xtbb0Tnc4kHmdAS693AWPJTVNp/E2kqNRg6rzM+vNVx00h6aZVjcmGjpJ+j5mb1jUiLXMd2KwC6JRhztBTX8ST5glbg6vpL2HVA8Gh92lqzBKVFj4cFfQDkF3WvpPN+zbYHozC+j1VQCJ/i6lJgl5NT9iLqJW2+EJdODXRjY4K5apWRzQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=chipsnmedia.com; dmarc=pass action=none header.from=chipsnmedia.com; dkim=pass header.d=chipsnmedia.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chipsnmedia.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=PjPtAm/hRnUMCrkhdL3i4MNXAHVNv8jzN/M99OmObOE=; b=X9HGrINdbuiTzZSCEYrqVRvdQHUpTJRtOLAGwSV9qv7e5HGugRvRmsQMMWW6eDriZTtpwyFiWUnm0rukhpeofrfN15iHlQWbeduF5Zu66JtPLV0740lLf3cplespOvKUqteBWS2vOGCBGyexj9eIT9Eg8Y6z5CfbTRuXlh0TIXY= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=chipsnmedia.com; Received: from SE1P216MB1303.KORP216.PROD.OUTLOOK.COM (2603:1096:101:15::5) by SE2P216MB1900.KORP216.PROD.OUTLOOK.COM (2603:1096:101:f8::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8137.29; Tue, 12 Nov 2024 02:15:25 +0000 Received: from SE1P216MB1303.KORP216.PROD.OUTLOOK.COM ([fe80::b711:5ab1:b5a4:d01b]) by SE1P216MB1303.KORP216.PROD.OUTLOOK.COM ([fe80::b711:5ab1:b5a4:d01b%6]) with mapi id 15.20.8137.027; Tue, 12 Nov 2024 02:15:25 +0000 From: "Jackson.lee" To: mchehab@kernel.org, nicolas@ndufresne.ca, sebastian.fricke@collabora.com Cc: linux-media@vger.kernel.org, linux-kernel@vger.kernel.org, hverkuil@xs4all.nl, nas.chung@chipsnmedia.com, lafley.kim@chipsnmedia.com, b-brnich@ti.com, jackson.lee@chipsnmedia.com Subject: [PATCH v0 1/6] media: chips-media: wave5: Fix to display gray color on screen Date: Tue, 12 Nov 2024 11:15:12 +0900 Message-Id: <20241112021517.121-2-jackson.lee@chipsnmedia.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20241112021517.121-1-jackson.lee@chipsnmedia.com> References: <20241112021517.121-1-jackson.lee@chipsnmedia.com> X-ClientProxiedBy: SE2P216CA0042.KORP216.PROD.OUTLOOK.COM (2603:1096:101:116::7) To SE1P216MB1303.KORP216.PROD.OUTLOOK.COM (2603:1096:101:15::5) Precedence: bulk X-Mailing-List: linux-media@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: SE1P216MB1303:EE_|SE2P216MB1900:EE_ X-MS-Office365-Filtering-Correlation-Id: ed2d9298-7fc3-4edc-cbee-08dd02bfdee2 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; ARA:13230040|376014|1800799024|52116014|366016|38350700014; X-Microsoft-Antispam-Message-Info: sqS+Ve+BF2LVE9NLProHdqR/t/dJdRrvxzVCYLPefHTW9OjwszWkkgAUvEmh3LOMfg8Blm715cjaHc8p5Z+/M2o55INlQI3BF2UNUXpoLtpG8ghTpLHr8TOqIsmQRlmEw3p3JN/JFVZZLg1AXU6BOTMqY5kLcWEWfKHc7WmugRwlgn+eFGtsbgfWnJyI7TZ69dqBMTdcTHA9r3mTGOe9KhcHOskeiv0gO7cPj2nGpIuISopmVByegx4virt+wpslFoDvxQCsZQNnT2HsRmmxqcY6+VY3JdjBLxXujkqCQmarrNR+1k2fkce7wnbdwwKicw3Xzj6PakkTjQogNyqxCZNUARKuPVu+8dGwW4DMDudec7QEWdRO3ot55+3Nz8LPNvFSTpITdA5dtYQNOT7MB6vlshgSqZeNcgiTCFgzKUnG7QeReqU696MgCIwp8a40hcI69lv18n0fixuYljoZUn+fhu+bFsDewIZ2LTpg/vp49aipJjwfn6i0resF8TTDOl+MR+Uw3goXDO6Z1R17fY/ptFPnMdw7L4bYZmRONCDht5I8xo/VVIUmnfZB4zu8Et2QmzByyJkDJ53zVFXCxgdL97+uXpvEQBoZ3OBqk1p7Mw9Xog3qKr7ywIsc1inPUI0IPGUIeXLrMAZfyONuXJ0EIVB3rZ1XqqXs0587+UnMSIkdvuQK6vmVaocLviK3p6b5myygxijPKdXCTt54NRAUWzNDXD9bUJ80UKGHb4Z/VcbDHuX1km4j//aI/4UfEOUXQ3D/ZJITpl083UVxyshgVso3HZYs4xeWySi+XR5fMXqLkOzO1390tGH3XaPiHL4rvMRJdtAxa8thTvUUVveTbuYxV3ST4F2WTpyoGw6UfZ1LaT9pAZkUQyAQtt3uAMbF2+7e5HbXOQQmV3mm1RHyqBXc6zOsxdMP6fCV8aMfhk5UQpoCcMQQRQ7shY+lktX8dM5uyliqwj0ttOCzk2fM1CGonk9L3qg8nz4NuVwHcBnAIoj0rCVtP306GLkOAksxD+Fy7X/5PUwPshOh8GITG98kTVkNPty8SYF223+7TYY+0fn/QzEGiFKfTHZcjpz1vgFiz/vHa6n4h7S+BC7LCMce2IAYlhNAnCyOIGXufPwwgNy2+wftxaAwh3Xwzpk3gRr6D+9+H/DG7Ja1flCRwVNi9fr2m+zTSO0BRekoLcQDH/R+PoKZEGc4K8lUbpF8KEaBJRTzztNs+gFh2wzbTlbumiNtjndc3wcXlyBx+KyyHkaM0EAveoaxdtqs6+BOgpORBEnRi2pF1f7lZaCuFhnJUNY7ccSLGnWhI0rcfUWY2vFNrf+TD8LAbvyUwbdWS/0lVoiuZP819Y65uIGZ12uTzH/P6XYpcpUx0x0= X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:SE1P216MB1303.KORP216.PROD.OUTLOOK.COM; PTR:; CAT:NONE; SFS:(13230040)(376014)(1800799024)(52116014)(366016)(38350700014); DIR:OUT; SFP:1102; X-MS-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UkFCbv5iB2bYc3bz6G9f89XhWlzQhjQ+pGGXiz/pNnIQiVh7ACZUC0A//qAx+DxR+cfiSiR7ueAGJGHN3eA9LQUmGEMj2D66URQ34P785Kxqr6uhTNecLPCLjLorYziUIBKcytQCfSWIPPfplJOIj39qJfUe17NvoXPAVrxe/zdUWIOScVqZg1tiieruYihQg9Bko18kPn+fIMIto16xWi8moRl5umbcnv1lyJBqI36dotIc7l1vwKloUCdGqBtfQN4mNkN3A7tGfL7jvwlhmvgyuBZo4Ba9gPjSPEgGAfJj5+jahMAHK44Zc//AplDsSmxtn80WvXtHiuZZmM42lqmYpbNDiergqI0fm3Fa+bwH8xdGZoYT1HtBjEqI70caQUtOcnogzJWDb+d5w8wk+npPoTVhyeYA3RvfQha60AVDOrsSQS+yP4DM0aBZUT3isnp5pB2NT45GqKrwalqodZJHAyFS4BOAn5LfYkPzBNLdY0k+0xaMJLTefEcGWXRConpttF6oM9Z6YQeMrQIYWeqw/ABH375lxsmc1lFdCh3Y2WAJh0IrLBBC2VcvQh+HnQ3ZJbqX6JB8J2SsLQ== X-OriginatorOrg: chipsnmedia.com X-MS-Exchange-CrossTenant-Network-Message-Id: ed2d9298-7fc3-4edc-cbee-08dd02bfdee2 X-MS-Exchange-CrossTenant-AuthSource: SE1P216MB1303.KORP216.PROD.OUTLOOK.COM X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 12 Nov 2024 02:15:25.8874 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 4d70c8e9-142b-4389-b7f2-fa8a3c68c467 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: El3UKR5Xqv/RLV4/H1k3brrzYV7uC9rdGnEVwcl/eKXlfH5JC1n2jU3Lv2X0WpPwFKUqbawlZ+i4Q9iaOgs7eDBey2CBsHNDx0QL3vCJ/y0= X-MS-Exchange-Transport-CrossTenantHeadersStamped: SE2P216MB1900 When a decoder instance is created, W5_CMD_ERR_CONCEAL register should be initialized to 0. If not set to 0, gray color can occasionally be displayed on screen while decoding. Signed-off-by: Jackson.lee Signed-off-by: Nas Chung --- drivers/media/platform/chips-media/wave5/wave5-hw.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/media/platform/chips-media/wave5/wave5-hw.c b/drivers/media/platform/chips-media/wave5/wave5-hw.c index c8a905994109..d94cf84c3ee5 100644 --- a/drivers/media/platform/chips-media/wave5/wave5-hw.c +++ b/drivers/media/platform/chips-media/wave5/wave5-hw.c @@ -585,7 +585,7 @@ int wave5_vpu_build_up_dec_param(struct vpu_instance *inst, vpu_write_reg(inst->dev, W5_CMD_NUM_CQ_DEPTH_M1, WAVE521_COMMAND_QUEUE_DEPTH - 1); } - + vpu_write_reg(inst->dev, W5_CMD_ERR_CONCEAL, 0); ret = send_firmware_command(inst, W5_CREATE_INSTANCE, true, NULL, NULL); if (ret) { wave5_vdi_free_dma_memory(vpu_dev, &p_dec_info->vb_work); From patchwork Tue Nov 12 02:15:13 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Jackson.lee" X-Patchwork-Id: 844054 Received: from SEVP216CU002.outbound.protection.outlook.com (mail-koreacentralazon11022128.outbound.protection.outlook.com [40.107.43.128]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id A853D208215; Tue, 12 Nov 2024 02:15:33 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.43.128 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1731377735; cv=fail; b=VXy1ncGzCVXt1Rsg+q5LoZXxJ7eXpU2zwml6CrgVWTtHLwLDIcH9sX5zvQ5VwQQp4TYl99446/u20BAcnQE/nuMvsCsmp+a2LLZeoHHZ8n0Uq4GNvoHVds3Pstw85bI+L2pvgECH+vLEFcZjRXx7RF6JMcgXcqI1dBSqFfm4K2U= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1731377735; c=relaxed/simple; bh=yvEX9kLTXiGl1IHcoffjzsUsLxKTj7HHrndozi0qKO0=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: Content-Type:MIME-Version; b=BbRl4LNlIMAb74a9VvUay8dmyFvWiy9048XsWrT3jhPfDnpWMfs6P2pTSwxn+1Hkm6Ovur6Ux/SSnB9zB4BuPsdejzRi/9WVIBptfVB4PJ/87My6AnNv9S8Z6glV7w6N7os+RIgW8OLnPrexiF0ec8qNUJ/ShK3EPTfXpgWxzBI= ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=chipsnmedia.com; spf=fail smtp.mailfrom=chipsnmedia.com; dkim=pass (1024-bit key) header.d=chipsnmedia.com header.i=@chipsnmedia.com header.b=WXPrxH4u; arc=fail smtp.client-ip=40.107.43.128 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=chipsnmedia.com Authentication-Results: smtp.subspace.kernel.org; spf=fail smtp.mailfrom=chipsnmedia.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=chipsnmedia.com header.i=@chipsnmedia.com header.b="WXPrxH4u" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=DVZH01RPGqdqzA3UO92OkfjbsQWmLOBkoKCXXX6TvuDoF5SlLitD9cKucmAeJx9R4y2aWEsUd/PfRsi+e1MsBVCD9ENfTpOYvmy3h4cx0ZZ9sb92n9lYYSdgl+aZ5ZcUQNOp2HgDFnVaVr2WG0DYJ0Ff0aw4KW5m10Ppq1vrJZITTMpBJ+0uMfJF+yMoQ9xln2Q03Pdy53umnM+MSuBo43bPtNvKmc1zXw7XyKi/LEem0jisq9zdgGnuuxUDflcp0SoElEwDkq4ol+nmqNRcrR6NYGSYmZ/iRyN5FE74djXYA+uSvATdD/bljaOge27Xa5Y7XN/YPXt0dipwl4u2bQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; 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=N86sxHpu0ZmI+36m85EhEa8AuGXjwCSEGGlTjuc7HhI=; b=XiKIrCOnaki4655JMUqHZnuVBN4sM8/YdJmyrM8c6LzgH+bv0Rw0E7lF/bIySIApfN+3COzQCTPZxyoFvYUdbyfRNDfwu/cub7miWQRPFvQ/EvB7lzsUv13oAIJ3S1DoZkhdnBoP6VYbonptLTwngbJ9BxwvFwy5ZSabyh756nMoa5DewilwBipNAqbwP91bNfK11agU5d1qtMFWDJDtWfQ4GrxHl5+WBA4NFN1kVIcrnX4ox9sO7KuMC98U2m13NcZeesAdUTDAUd1QhfUf1Y54gY1/gNI53DG/q65mE0jVk0RfuGziIrfh82yi57A/+9Dev8J7YoCxJ9fMFUjkkQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=chipsnmedia.com; dmarc=pass action=none header.from=chipsnmedia.com; dkim=pass header.d=chipsnmedia.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chipsnmedia.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=N86sxHpu0ZmI+36m85EhEa8AuGXjwCSEGGlTjuc7HhI=; b=WXPrxH4uTVMjw4Zf9pv/ZE7MHtGB/JumZ/MfD91fn8vqBnZ6M+0ShOHai6X41Ms/mappLfI2a5GlX5m5UW6wBSfjE0eN0NIPeki7lC5NzGo4l3Fwcp0rrdfL/K91ZER55QfcwX3IO4Wfh8BALLMdLRa51ChSPBqlBBfU7ElOQ4g= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=chipsnmedia.com; Received: from SE1P216MB1303.KORP216.PROD.OUTLOOK.COM (2603:1096:101:15::5) by SE2P216MB1900.KORP216.PROD.OUTLOOK.COM (2603:1096:101:f8::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8137.29; Tue, 12 Nov 2024 02:15:26 +0000 Received: from SE1P216MB1303.KORP216.PROD.OUTLOOK.COM ([fe80::b711:5ab1:b5a4:d01b]) by SE1P216MB1303.KORP216.PROD.OUTLOOK.COM ([fe80::b711:5ab1:b5a4:d01b%6]) with mapi id 15.20.8137.027; Tue, 12 Nov 2024 02:15:26 +0000 From: "Jackson.lee" To: mchehab@kernel.org, nicolas@ndufresne.ca, sebastian.fricke@collabora.com Cc: linux-media@vger.kernel.org, linux-kernel@vger.kernel.org, hverkuil@xs4all.nl, nas.chung@chipsnmedia.com, lafley.kim@chipsnmedia.com, b-brnich@ti.com, jackson.lee@chipsnmedia.com Subject: [PATCH v0 2/6] media: chips-media: wave5: Avoid race condition for interrupt handling Date: Tue, 12 Nov 2024 11:15:13 +0900 Message-Id: <20241112021517.121-3-jackson.lee@chipsnmedia.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20241112021517.121-1-jackson.lee@chipsnmedia.com> References: <20241112021517.121-1-jackson.lee@chipsnmedia.com> X-ClientProxiedBy: SE2P216CA0042.KORP216.PROD.OUTLOOK.COM (2603:1096:101:116::7) To SE1P216MB1303.KORP216.PROD.OUTLOOK.COM (2603:1096:101:15::5) Precedence: bulk X-Mailing-List: linux-media@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: SE1P216MB1303:EE_|SE2P216MB1900:EE_ X-MS-Office365-Filtering-Correlation-Id: 6c462faf-08e7-4332-3921-08dd02bfdf12 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; ARA:13230040|376014|1800799024|52116014|366016|38350700014; X-Microsoft-Antispam-Message-Info: WPEqI/t8/XLBy+HoLM/1rFGemi/SNpoAgLq8vma8pwwezjH/KLR0bZLEUI3o5uEi5uKjU+mGgYC/Ke9CIOdP+SuB1WrAQrBZ4eGU6B+FrtHk3r6BzCVz08UeQEq0EB1iUBrhiPJKxwjoISJ6ijnjr+Xm2yzobCIXj8sbB9rOIn+/uk94CoWBUf+XG08Cwwo5Y4zjVhO3g9GX13evCdahErtD0HPz6VaoTJf+c9N0pe+YBaHHdl5tCkDCs6a52r5Xhg2JmebJmFKpL5Kr603dXOIL0trO3358O6SQKxlTxjSohVmqfqIEZgNizwENOWIVNpHSOB5KQkZgUKGDqIsbjyMYfuU0oIvJ7n8+t2AG/+aVqSV1EUFtuMiEyRWHsrrJvqwy0uFg5i/BH1BIqGYEKJ+wf2n9HAmA97iahkuESXOnuDOl+X76THXF9W7nhF3HCPE5F4JRHJ/auXltKHHRLb/kG2wPbL4JT4yTnA9mM/4mBSPS6IokNB1vG3NqiO5R+WMKhPPHRbQeVpb6EuaIVkLTlSDJV+cYwRM6JCry5kHxzf6xDA1D1GcEJm5DBM8+exX2jRdZIAI2GKZe1e2fDwzp2A19vMvzwOzDIXu9NEnp+CayjiLnzFKhk1PwoVJepEdEfXD2we4AQWWDFsreNXu/wpl0eI3aNqOZS5cDkUK+S21WqTTUffqK6U9mLFZzFtdq8J9PYkfru3fPhmMD+UYsdN9m8yX9yZgzBXtHKzMEPoXrK0bN2kbZvhfKPhV9BNNUW5D45LvieFqQql873h5+oW/fuBnm1MSW6LZV+3UDYF/2X4C9zEGdrwiR8MvbWVdqaPOaastQOd+ULY6S2rvVD1EeAwtSidF1oOSojaLDwBOyYJDJhl+/Qd0G7lFvTftaRKAEi4SKvbMnaBgaa5LEGZq5l2eJrbRho4jxg+h9Fwau8Cm2k48zd7pguDkxP4fuKVsPdPrsmgrVretA1ndPWdp4r8x64pb+xLWV1fxH2bfQinwkSQKAPeUlCiFaLYzRDm22Y+OTAuu+AJEoY3MZ9cfb5B03mLtnFzRijvuCB9R2yGqEfBPDBH2Wc1dOH/pg0xImQMbIQ550qIOXS640juCNRMYILGJgFLyxi64WXhlDLgAkjUS65EhfG1h7+ER7zYSA1SMOdSwU57t8x5KKOtAFftEPEqWDtbX7iHPfGUEHybrB1aW7eX6meMoqK+7OcOyRgDcnGJlKUmPfswrXBl/h+nZfuYsVkt6/XPtmVi2c+Y1kqu9XRKneoNrh0VXRUh4Gs5FSVuKyNDw3YymyEnXAncZGhdFNh0zf7/0RL3fbmfHa7bZpb5zY5tvxxsaxMHS0qX+1gpiggd4R4I0dSURM+kDIq186WlkSRiE= X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:SE1P216MB1303.KORP216.PROD.OUTLOOK.COM; PTR:; CAT:NONE; SFS:(13230040)(376014)(1800799024)(52116014)(366016)(38350700014); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: QiE5C/vF+J1lMpt77ETPKDqxaUZvPa5pYQ26PYSO0QHbLPF1Wg4pP9TSP2JLRCDy6u9cLQWYn0ebXdi1IFZWtSx4Mfu+4V3wuDFljoNZnjCBl+KXRsf3fOG+zKv04aiaB7F6AQBxLbr/ZaymyDgPRZOBs4AT0XdSVmYfs+8wNuRiszPD7mQa+FVeBaUl2rakSJOc26SIn4fV6kIxA2I/IjkTVJDpusASdLIs4Aow+Hfvumce2G0yuDtErJ1+oWkLVCK283hVvcjWGOOY8uucHdaGnyTAaGDITRVHyNy9xSzMtv5Jp3gIncsi5helGq2qOCPgK4jONTzuclgm8eHDrvD3JCI3kadDHGCV29LGI7W8aEJ8FWdspi1V2v65OWlozRaPynb0ihrzI1bb77caVMEEBIrZv6paf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7EoRDpCdZ6d26nLHM8r+35RtZRnRICPZZ7iSw3LRf3EW8RqO1BCsIFuUJnBQRixzTMq1b03zAaEfa8NBGtQWDRILmaDBY+E/gw7AXvfG/RxCi6eScsISntX1tSEpQIA== X-OriginatorOrg: chipsnmedia.com X-MS-Exchange-CrossTenant-Network-Message-Id: 6c462faf-08e7-4332-3921-08dd02bfdf12 X-MS-Exchange-CrossTenant-AuthSource: SE1P216MB1303.KORP216.PROD.OUTLOOK.COM X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 12 Nov 2024 02:15:26.2658 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 4d70c8e9-142b-4389-b7f2-fa8a3c68c467 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: HlS3/lvvZVYynuK3Y3KvSkbruXekonKbEgvNRGeQdO08dQSrV57qUycl/tWs25565XerTiMYQdJlgL7ZfsEFN06mAnlxmT4AbkuAcHocRH0= X-MS-Exchange-Transport-CrossTenantHeadersStamped: SE2P216MB1900 In case of multi instance, interrupts can occurr for other instances as soon as interrupt is cleared. If driver reads the instance_info after clearing the interrupt, it is not guaranteed that the instance_info is valid for the current interrupt. Read the instance_info register for each interrupt before clearing the interrupt. Signed-off-by: Jackson.lee Signed-off-by: Nas Chung --- drivers/media/platform/chips-media/wave5/wave5-vpu.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/media/platform/chips-media/wave5/wave5-vpu.c b/drivers/media/platform/chips-media/wave5/wave5-vpu.c index 6b294a2d6717..63a607d10433 100644 --- a/drivers/media/platform/chips-media/wave5/wave5-vpu.c +++ b/drivers/media/platform/chips-media/wave5/wave5-vpu.c @@ -55,12 +55,12 @@ static void wave5_vpu_handle_irq(void *dev_id) struct vpu_device *dev = dev_id; irq_reason = wave5_vdi_read_register(dev, W5_VPU_VINT_REASON); + seq_done = wave5_vdi_read_register(dev, W5_RET_SEQ_DONE_INSTANCE_INFO); + cmd_done = wave5_vdi_read_register(dev, W5_RET_QUEUE_CMD_DONE_INST); wave5_vdi_write_register(dev, W5_VPU_VINT_REASON_CLR, irq_reason); wave5_vdi_write_register(dev, W5_VPU_VINT_CLEAR, 0x1); list_for_each_entry(inst, &dev->instances, list) { - seq_done = wave5_vdi_read_register(dev, W5_RET_SEQ_DONE_INSTANCE_INFO); - cmd_done = wave5_vdi_read_register(dev, W5_RET_QUEUE_CMD_DONE_INST); if (irq_reason & BIT(INT_WAVE5_INIT_SEQ) || irq_reason & BIT(INT_WAVE5_ENC_SET_PARAM)) { From patchwork Tue Nov 12 02:15:14 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Jackson.lee" X-Patchwork-Id: 842809 Received: from SEVP216CU002.outbound.protection.outlook.com (mail-koreacentralazon11022128.outbound.protection.outlook.com [40.107.43.128]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id CE3F9209F4F; Tue, 12 Nov 2024 02:15:35 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.43.128 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1731377738; cv=fail; b=ejjWqZ4Hw3g+4gapLC7p6ncNyNE+MwrfVi0QCDm4LykopHZQ891H6FvcgS1n4MxToJKFkOLUZswkPnxgSus1fDMzSj0q41TL7nCHdfgJZW4LJ+SZhVzJMYfiVysZsqKElQYSxQqUqG0OsPjkIiJokipPEZDRCTiFPanpe6u98PE= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1731377738; c=relaxed/simple; bh=N3Yj0iMNtUNAZAJAfr3z41w7AjWsEfTQFPQ7kX4I1NU=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: Content-Type:MIME-Version; b=KFSc9Ijo6Agv7g1RmV1joMCU4WSwhaZlasExHmXTRuEwQdiv0SDQg/oSLynIL7xtFkO+uTgDTh81frImMbH2p85EzEc6PyBpAksB0G5an3RY+iZuyCOkFRqupy8zEsw6E/Sp6lij6988azZIaAQxn31cif5R/rjK2LW71aA4TtA= ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=chipsnmedia.com; spf=fail smtp.mailfrom=chipsnmedia.com; dkim=pass (1024-bit key) header.d=chipsnmedia.com header.i=@chipsnmedia.com header.b=bu14Lbxz; arc=fail smtp.client-ip=40.107.43.128 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=chipsnmedia.com Authentication-Results: smtp.subspace.kernel.org; spf=fail smtp.mailfrom=chipsnmedia.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=chipsnmedia.com header.i=@chipsnmedia.com header.b="bu14Lbxz" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=tzSEiqPxt0/GrmnAropgh7YmPPUZ0Y8UP2w5cHUgGWmorVI+/CSZzS2iVQpp7vC0DTVmcv8a8pZ4u2fWwVkwL13i67CxcNIpsCE+k3xtjQLzAH5TLpztnSVJupZIJOWYCgHZT9Er9dt9YlYdL+PdKt4S4M/0cHSo3pWdaq2soiVVpItecYOEAL4T/bRBpsCYfUr+ZKG9cC5izGXSrODniO/V5sIecxUMj37I6Aj95wLU1MKlFsAN7I94upeevvkAX4jZCe33jCRXtbsTglZOEu9UZfVNXF9PyEGJ6LnvJH2xENDdQgpIqoZ3nf29BkddNmNj8vhKiCn+1wT0mB+lYQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; 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=A6MkY9YRYaVg2Xr1l6/qILMXCx7qImi+hmeMOU4PNH4=; b=xAVQMwGU1wLNbr/wmFuZYTXLswRUfAtD+MPVXBnl+wmMX1Zqa5vnmGz8NSuK7eeaEfwu8ns932EbA4k5S1x5P+BmoszEzSPvzqrF1/shnORkBfxkc08ZsOn3B070L7Bjm+R9nuinCMZoPraADGFqe+GV3xyConWJmbt6h2fglV5wADkwMKdVBQmJ5Et9tphZe67XXowCNqpubBt77IJF7jOgPrajcu915ZqVqtYxtlFlvezsB9pOSznrhJcsb6wNT9CftxJl9xRveULLYlG+Hf3LNfm15G/Zou/KnyfP91ulf8Cg2mhm4tZUNEE+zE33XUyBMRiBC29sTULYfmC5dQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=chipsnmedia.com; dmarc=pass action=none header.from=chipsnmedia.com; dkim=pass header.d=chipsnmedia.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chipsnmedia.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=A6MkY9YRYaVg2Xr1l6/qILMXCx7qImi+hmeMOU4PNH4=; b=bu14Lbxzlrt0W8phnpud91Bys5hSfH2ZGAsPM2L3XCdE+JHQD9sOCDofEWPOod/Fu526+A+eEeXxEoi3lHtlD1Tl+6to0fZBHcQjEf6UNSltv/CpndqTMnG1fnp2Fp/pfTrtiDuiA4rO2T6hVp9KoW2UmdyUuf30dSVlMbIE4hs= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=chipsnmedia.com; Received: from SE1P216MB1303.KORP216.PROD.OUTLOOK.COM (2603:1096:101:15::5) by SE2P216MB1900.KORP216.PROD.OUTLOOK.COM (2603:1096:101:f8::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8137.29; Tue, 12 Nov 2024 02:15:26 +0000 Received: from SE1P216MB1303.KORP216.PROD.OUTLOOK.COM ([fe80::b711:5ab1:b5a4:d01b]) by SE1P216MB1303.KORP216.PROD.OUTLOOK.COM ([fe80::b711:5ab1:b5a4:d01b%6]) with mapi id 15.20.8137.027; Tue, 12 Nov 2024 02:15:26 +0000 From: "Jackson.lee" To: mchehab@kernel.org, nicolas@ndufresne.ca, sebastian.fricke@collabora.com Cc: linux-media@vger.kernel.org, linux-kernel@vger.kernel.org, hverkuil@xs4all.nl, nas.chung@chipsnmedia.com, lafley.kim@chipsnmedia.com, b-brnich@ti.com, jackson.lee@chipsnmedia.com Subject: [PATCH v0 3/6] media: chips-media: wave5: Improve performance of decoder Date: Tue, 12 Nov 2024 11:15:14 +0900 Message-Id: <20241112021517.121-4-jackson.lee@chipsnmedia.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20241112021517.121-1-jackson.lee@chipsnmedia.com> References: <20241112021517.121-1-jackson.lee@chipsnmedia.com> X-ClientProxiedBy: SE2P216CA0042.KORP216.PROD.OUTLOOK.COM (2603:1096:101:116::7) To SE1P216MB1303.KORP216.PROD.OUTLOOK.COM (2603:1096:101:15::5) Precedence: bulk X-Mailing-List: linux-media@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: SE1P216MB1303:EE_|SE2P216MB1900:EE_ X-MS-Office365-Filtering-Correlation-Id: 6269aab7-27a3-43fd-7c9c-08dd02bfdf46 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; ARA:13230040|376014|1800799024|52116014|366016|38350700014; X-Microsoft-Antispam-Message-Info: yl7WMXVlYIeG1cUPWu3UANPIfmx14dG6Q0GGVWZ/uvHpQTJoUjGnkMOFla9iTp34pZsquy0xT6rvMkZVCpXXSS6AvCpFVrfvBBuXdFfjck2+C5yXUJf4V0Dc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PAv8KLYSgpGY+SGpdfEUpgtaFKyeg0eUg+ApaInwW88qiCuZY6nu5xBhkwnsv8KnP08xeGVXC/d/DbwOaVLvI/YQNoBMBXA1DRBDgeUpP0Dr5lWLOtdPrtlfcy/KRT3OR9VKH3mGBP6AFgVrvDszpVFUY30BfgibmIHysyXSvzcRZ++sloe7HuY= X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:SE1P216MB1303.KORP216.PROD.OUTLOOK.COM; PTR:; CAT:NONE; SFS:(13230040)(376014)(1800799024)(52116014)(366016)(38350700014); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: OPnV+slbNGd1+LovkQ7UJqWnHS/8Xi5hcSUqAWUC77WLAFnU3PLygGxN0PbvcIMYeAgU/nLVCTxw8RjcFcLz8+c/8sASM5nXkL88WxQ8ib19fp55DKvoy93KjTxGfAzGa1907PgYwGLekbLtTHFSDgYtc2YjduZKKIHQeuIbwoPr/SA5iUJx2B5MIRN/q4AgpxrDQGdojOt467k7JZvrxc6nhmxfWJMLu1Goi+wgv10FLW6y/6fsMMDRCFI+d9SZbOlBN9p5Byh6AF5n3qPI26+wEer20ltQpon8mXb0uR42WVd4IyJV0dZMCDpSN5Itd8HX6mshzDYWHSvqP0ybIHL/IHnjQjfqdeZDeLS/D5pT9p0yihaZOWC/mlz0UWoN1ITDrl6voRXG7Rrx+yyrKD7KbjwqNRmPH65JUZ8BocntXyRoZGhC19LZYSJt+W6GwT9sIg7pXWxEeCAAk2W9lZPzfAIWd0Bpo8qd+r+ZV9SIh8FacTIHMm6qIoALisAXf/lJnqUJAWhjP4wyLaw0aFiGHkB90hwlWNcMXCKv89kJH715nE8JdBtDSTIJlYOQ0lF7bAeHYGyH/dMSNBpY+m8BrH/XNueg6TcH1KiVCFDHSgo+t2Talu7rH+qWtLh4/c8IYFFU1a1FywSL7hhwGOid3d66RaHDCbtFSwUkK2MTReAthXd8j14t2rjVBOlWgf1sc+cKyL4XhflyT9LL8vKVS++8aEtRmPuJb/5XRZpVNXEenc9KKQ6FNkwkgSVGUBnBaxngXqjGdYHGU/awA32o0tqWBZu6MIpJ5joDY0MdmQmDInDJdh4q2ye27VeUX/X7dOWFfr1WXsvQnopk5K+WcyFpMa5sG0GMqhEFV+aj7as5+fjSGl/Nx2XztJZIj6lf1/1cSNNw2UKj7oxJAfRgG8bNhi2mV6WJUdbgWi09gsD3krcuXosODzI6MZKOYaQavgKdgYL6zbcCl+7vFsKIajp3WozVALIwbYSiz+cAYSxYUWSsDW4AYnahf9zSPMs8cYoyKhZpi3gjQ10EZLyKJ9Nwe6AWVui4ILBIAM9wT6mSaic8rnDpbT+ESoMEr4BfIBQKR7WLVfrkgwxUnGqMkDkUb0xm15+oY24UF/6DD4oqdiQHPryf7OSvsugGFFmYpsGfitiPkF5JfWnK67JeodCjczlaL9L/zi/DHkztKq6Oq4NNn7ebmjSpbjYhS6uGC1ZiRjD7T1j+I67EJM4X+ZTaL2y3fg+Eg/Foy2uJOHoKI1wbACKywuiMZkOWrWZGwTUEaoDpVY6hEw2guDGUwRc77vgACpR5+W/rGh53p9CDbnyoNcp352OlMI43cUVh9gxxAXdGqrUovEKvzYyGqdQd4PU/DO10f2IYqDEhEN3qUTlB0IdQNgZ3r7RYBilbCfd5a3F+BIy+LYaHSJnwmL94bkNkUVBprBEdZ/pQr2iD25lzr8QMSh7uYF/piVf0w7Sp+kgNlRSEZASqIBzmL9LGGyaMezhCUknX/q7KhZJoPhZIlw/sWBNOvSGaWRmyJgCrKzKxLOXdzOBKcMbl/H3Mu4nN/e1HjAKxaplsfKdglyQTG0ApAO+zw+1jWfHx4ii4lCIYcEd3E5jNzg== X-OriginatorOrg: chipsnmedia.com X-MS-Exchange-CrossTenant-Network-Message-Id: 6269aab7-27a3-43fd-7c9c-08dd02bfdf46 X-MS-Exchange-CrossTenant-AuthSource: SE1P216MB1303.KORP216.PROD.OUTLOOK.COM X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 12 Nov 2024 02:15:26.5762 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 4d70c8e9-142b-4389-b7f2-fa8a3c68c467 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: lVHAAp8ZI3wR+dR4qglw2+o/U+zaHDOAl+mD7OXVgSP/k2ThKIJNdxk3DwyeScChLb/npAYiQ3TUf32tUu/3wZ86U4m6xRARXgXZhSOFLpE= X-MS-Exchange-Transport-CrossTenantHeadersStamped: SE2P216MB1900 The existing way for decoding frames was to wait until each frame was decoded after feeding a bitstream. As a result, performance was low and Wave5 could not achieve max pixel processing rate. Update driver to use an asynchronous approach for decoding and feeding a bitstream in order to achieve full capabilities of the device. Signed-off-by: Jackson.lee Signed-off-by: Nas Chung --- .../platform/chips-media/wave5/wave5-helper.c | 6 + .../chips-media/wave5/wave5-vpu-dec.c | 380 +++++++++++------- .../platform/chips-media/wave5/wave5-vpu.c | 5 +- .../platform/chips-media/wave5/wave5-vpuapi.c | 1 + .../platform/chips-media/wave5/wave5-vpuapi.h | 6 + 5 files changed, 251 insertions(+), 147 deletions(-) diff --git a/drivers/media/platform/chips-media/wave5/wave5-helper.c b/drivers/media/platform/chips-media/wave5/wave5-helper.c index 2c9d8cbca6e4..2412de290eca 100644 --- a/drivers/media/platform/chips-media/wave5/wave5-helper.c +++ b/drivers/media/platform/chips-media/wave5/wave5-helper.c @@ -62,6 +62,12 @@ int wave5_vpu_release_device(struct file *filp, struct vpu_instance *inst = wave5_to_vpu_inst(filp->private_data); int ret = 0; + if (inst->run_thread) { + kthread_stop(inst->run_thread); + up(&inst->run_sem); + inst->run_thread = NULL; + } + v4l2_m2m_ctx_release(inst->v4l2_fh.m2m_ctx); if (inst->state != VPU_INST_STATE_NONE) { u32 fail_res; diff --git a/drivers/media/platform/chips-media/wave5/wave5-vpu-dec.c b/drivers/media/platform/chips-media/wave5/wave5-vpu-dec.c index d3ff420c52ce..f0db531247ac 100644 --- a/drivers/media/platform/chips-media/wave5/wave5-vpu-dec.c +++ b/drivers/media/platform/chips-media/wave5/wave5-vpu-dec.c @@ -6,6 +6,9 @@ */ #include +#include +#include +#include #include "wave5-helper.h" #define VPU_DEC_DEV_NAME "C&M Wave5 VPU decoder" @@ -101,6 +104,24 @@ static const struct vpu_format dec_fmt_list[FMT_TYPES][MAX_FMTS] = { } }; +static int run_thread(void *data) +{ + struct vpu_instance *inst = (struct vpu_instance *)data; + struct v4l2_m2m_ctx *m2m_ctx = inst->v4l2_fh.m2m_ctx; + + while (!kthread_should_stop()) { + if (down_interruptible(&inst->run_sem)) + continue; + + if (kthread_should_stop()) + break; + + v4l2_m2m_job_finish(inst->v4l2_m2m_dev, m2m_ctx); + } + + return 0; +} + /* * Make sure that the state switch is allowed and add logging for debugging * purposes @@ -230,7 +251,6 @@ static int start_decode(struct vpu_instance *inst, u32 *fail_res) switch_state(inst, VPU_INST_STATE_STOP); dev_dbg(inst->dev->dev, "%s: pic run failed / finish job", __func__); - v4l2_m2m_job_finish(inst->v4l2_m2m_dev, m2m_ctx); } return ret; @@ -347,7 +367,6 @@ static void wave5_vpu_dec_finish_decode(struct vpu_instance *inst) struct vb2_v4l2_buffer *dec_buf = NULL; struct vb2_v4l2_buffer *disp_buf = NULL; struct vb2_queue *dst_vq = v4l2_m2m_get_dst_vq(m2m_ctx); - struct queue_status_info q_status; dev_dbg(inst->dev->dev, "%s: Fetch output info from firmware.", __func__); @@ -360,11 +379,22 @@ static void wave5_vpu_dec_finish_decode(struct vpu_instance *inst) dev_dbg(inst->dev->dev, "%s: rd_ptr %pad wr_ptr %pad", __func__, &dec_info.rd_ptr, &dec_info.wr_ptr); - wave5_handle_src_buffer(inst, dec_info.rd_ptr); dev_dbg(inst->dev->dev, "%s: dec_info dec_idx %i disp_idx %i", __func__, dec_info.index_frame_decoded, dec_info.index_frame_display); + if (inst->std == W_AVC_DEC && + dec_info.index_frame_decoded == DECODED_IDX_FLAG_SKIP && + dec_info.index_frame_display == DISPLAY_IDX_FLAG_NO_FB) { + struct vb2_v4l2_buffer *src_buf = v4l2_m2m_src_buf_remove(m2m_ctx); + + if (src_buf) + v4l2_m2m_buf_done(src_buf, VB2_BUF_STATE_ERROR); + return; + } + + wave5_handle_src_buffer(inst, dec_info.rd_ptr); + if (!vb2_is_streaming(dst_vq)) { dev_dbg(inst->dev->dev, "%s: capture is not streaming..", __func__); v4l2_m2m_job_finish(inst->v4l2_m2m_dev, m2m_ctx); @@ -441,20 +471,6 @@ static void wave5_vpu_dec_finish_decode(struct vpu_instance *inst) } spin_unlock_irqrestore(&inst->state_spinlock, flags); } - - /* - * During a resolution change and while draining, the firmware may flush - * the reorder queue regardless of having a matching decoding operation - * pending. Only terminate the job if there are no more IRQ coming. - */ - wave5_vpu_dec_give_command(inst, DEC_GET_QUEUE_STATUS, &q_status); - if (q_status.report_queue_count == 0 && - (q_status.instance_queue_count == 0 || dec_info.sequence_changed)) { - dev_dbg(inst->dev->dev, "%s: finishing job.\n", __func__); - pm_runtime_mark_last_busy(inst->dev->dev); - pm_runtime_put_autosuspend(inst->dev->dev); - v4l2_m2m_job_finish(inst->v4l2_m2m_dev, m2m_ctx); - } } static int wave5_vpu_dec_querycap(struct file *file, void *fh, struct v4l2_capability *cap) @@ -465,6 +481,142 @@ static int wave5_vpu_dec_querycap(struct file *file, void *fh, struct v4l2_capab return 0; } +static int write_to_ringbuffer(struct vpu_instance *inst, void *buffer, size_t buffer_size, + struct vpu_buf *ring_buffer, dma_addr_t wr_ptr) +{ + size_t size; + size_t offset = wr_ptr - ring_buffer->daddr; + int ret; + + if (wr_ptr + buffer_size > ring_buffer->daddr + ring_buffer->size) { + size = ring_buffer->daddr + ring_buffer->size - wr_ptr; + ret = wave5_vdi_write_memory(inst->dev, ring_buffer, offset, (u8 *)buffer, size); + if (ret < 0) + return ret; + + ret = wave5_vdi_write_memory(inst->dev, ring_buffer, 0, (u8 *)buffer + size, + buffer_size - size); + if (ret < 0) + return ret; + } else { + ret = wave5_vdi_write_memory(inst->dev, ring_buffer, offset, (u8 *)buffer, + buffer_size); + if (ret < 0) + return ret; + } + + return 0; +} + +static int fill_ringbuffer(struct vpu_instance *inst) +{ + struct v4l2_m2m_ctx *m2m_ctx = inst->v4l2_fh.m2m_ctx; + struct vpu_src_buffer *vpu_buf; + int ret = 0; + + if (m2m_ctx->last_src_buf) { + struct vpu_src_buffer *vpu_buf = wave5_to_vpu_src_buf(m2m_ctx->last_src_buf); + + if (vpu_buf->consumed) { + dev_dbg(inst->dev->dev, "last src buffer already written\n"); + return 0; + } + } + + list_for_each_entry(vpu_buf, &inst->avail_src_bufs, list) { + struct vb2_v4l2_buffer *vbuf = &vpu_buf->v4l2_m2m_buf.vb; + struct vpu_buf *ring_buffer = &inst->bitstream_vbuf; + size_t src_size = vb2_get_plane_payload(&vbuf->vb2_buf, 0); + void *src_buf = vb2_plane_vaddr(&vbuf->vb2_buf, 0); + dma_addr_t rd_ptr = 0; + dma_addr_t wr_ptr = 0; + size_t remain_size = 0; + + if (vpu_buf->consumed) { + dev_dbg(inst->dev->dev, "already copied src buf (%u) to the ring buffer\n", + vbuf->vb2_buf.index); + continue; + } + + if (!src_buf) { + dev_dbg(inst->dev->dev, + "%s: Acquiring kernel pointer to src buf (%u), fail\n", + __func__, vbuf->vb2_buf.index); + break; + } + + ret = wave5_vpu_dec_get_bitstream_buffer(inst, &rd_ptr, &wr_ptr, &remain_size); + if (ret) { + /* Unable to acquire the mutex */ + dev_err(inst->dev->dev, "Getting the bitstream buffer, fail: %d\n", + ret); + return ret; + } + + dev_dbg(inst->dev->dev, "%s: rd_ptr %pad wr_ptr %pad", __func__, &rd_ptr, &wr_ptr); + + if (remain_size < src_size) { + dev_dbg(inst->dev->dev, + "%s: remaining size: %zu < source size: %zu for src buf (%u)\n", + __func__, remain_size, src_size, vbuf->vb2_buf.index); + break; + } + + ret = write_to_ringbuffer(inst, src_buf, src_size, ring_buffer, wr_ptr); + if (ret) { + dev_err(inst->dev->dev, "Write src buf (%u) to ring buffer, fail: %d\n", + vbuf->vb2_buf.index, ret); + return ret; + } + + ret = wave5_vpu_dec_update_bitstream_buffer(inst, src_size); + if (ret) { + dev_dbg(inst->dev->dev, + "update_bitstream_buffer fail: %d for src buf (%u)\n", + ret, vbuf->vb2_buf.index); + break; + } + + vpu_buf->consumed = true; + + /* Don't write buffers passed the last one while draining. */ + if (v4l2_m2m_is_last_draining_src_buf(m2m_ctx, vbuf)) { + dev_dbg(inst->dev->dev, "last src buffer written to the ring buffer\n"); + break; + } + + inst->queuing_num++; + list_del_init(&vpu_buf->list); + break; + } + + return ret; +} + +static void wave5_vpu_dec_feed_remaining(struct vpu_instance *inst) +{ + int ret = 0; + struct v4l2_m2m_ctx *m2m_ctx = inst->v4l2_fh.m2m_ctx; + u32 fail_res = 0; + + mutex_lock(&inst->feed_lock); + ret = fill_ringbuffer(inst); + mutex_unlock(&inst->feed_lock); + if (ret) { + dev_warn(inst->dev->dev, "Filling ring buffer failed\n"); + return; + } + + ret = start_decode(inst, &fail_res); + if (ret) { + dev_err(inst->dev->dev, + "Frame decoding on m2m context (%p), fail: %d (result: %d)\n", + m2m_ctx, ret, fail_res); + } + + v4l2_m2m_job_finish(inst->v4l2_m2m_dev, m2m_ctx); +} + static int wave5_vpu_dec_enum_framesizes(struct file *f, void *fh, struct v4l2_frmsizeenum *fsize) { const struct vpu_format *vpu_fmt; @@ -794,11 +946,21 @@ static int wave5_vpu_dec_stop(struct vpu_instance *inst) } if (inst->state != VPU_INST_STATE_NONE) { + struct vb2_v4l2_buffer *vbuf; + struct vpu_src_buffer *vpu_buf; + /* * Temporarily release the state_spinlock so that subsequent * calls do not block on a mutex while inside this spinlock. */ spin_unlock_irqrestore(&inst->state_spinlock, flags); + vbuf = v4l2_m2m_last_src_buf(m2m_ctx); + if (vbuf) { + vpu_buf = wave5_to_vpu_src_buf(vbuf); + if (!vpu_buf->consumed) + wave5_vpu_dec_feed_remaining(inst); + } + ret = wave5_vpu_dec_set_eos_on_firmware(inst); if (ret) return ret; @@ -1116,115 +1278,6 @@ static int wave5_prepare_fb(struct vpu_instance *inst) return 0; } -static int write_to_ringbuffer(struct vpu_instance *inst, void *buffer, size_t buffer_size, - struct vpu_buf *ring_buffer, dma_addr_t wr_ptr) -{ - size_t size; - size_t offset = wr_ptr - ring_buffer->daddr; - int ret; - - if (wr_ptr + buffer_size > ring_buffer->daddr + ring_buffer->size) { - size = ring_buffer->daddr + ring_buffer->size - wr_ptr; - ret = wave5_vdi_write_memory(inst->dev, ring_buffer, offset, (u8 *)buffer, size); - if (ret < 0) - return ret; - - ret = wave5_vdi_write_memory(inst->dev, ring_buffer, 0, (u8 *)buffer + size, - buffer_size - size); - if (ret < 0) - return ret; - } else { - ret = wave5_vdi_write_memory(inst->dev, ring_buffer, offset, (u8 *)buffer, - buffer_size); - if (ret < 0) - return ret; - } - - return 0; -} - -static int fill_ringbuffer(struct vpu_instance *inst) -{ - struct v4l2_m2m_ctx *m2m_ctx = inst->v4l2_fh.m2m_ctx; - struct v4l2_m2m_buffer *buf, *n; - int ret; - - if (m2m_ctx->last_src_buf) { - struct vpu_src_buffer *vpu_buf = wave5_to_vpu_src_buf(m2m_ctx->last_src_buf); - - if (vpu_buf->consumed) { - dev_dbg(inst->dev->dev, "last src buffer already written\n"); - return 0; - } - } - - v4l2_m2m_for_each_src_buf_safe(m2m_ctx, buf, n) { - struct vb2_v4l2_buffer *vbuf = &buf->vb; - struct vpu_src_buffer *vpu_buf = wave5_to_vpu_src_buf(vbuf); - struct vpu_buf *ring_buffer = &inst->bitstream_vbuf; - size_t src_size = vb2_get_plane_payload(&vbuf->vb2_buf, 0); - void *src_buf = vb2_plane_vaddr(&vbuf->vb2_buf, 0); - dma_addr_t rd_ptr = 0; - dma_addr_t wr_ptr = 0; - size_t remain_size = 0; - - if (vpu_buf->consumed) { - dev_dbg(inst->dev->dev, "already copied src buf (%u) to the ring buffer\n", - vbuf->vb2_buf.index); - continue; - } - - if (!src_buf) { - dev_dbg(inst->dev->dev, - "%s: Acquiring kernel pointer to src buf (%u), fail\n", - __func__, vbuf->vb2_buf.index); - break; - } - - ret = wave5_vpu_dec_get_bitstream_buffer(inst, &rd_ptr, &wr_ptr, &remain_size); - if (ret) { - /* Unable to acquire the mutex */ - dev_err(inst->dev->dev, "Getting the bitstream buffer, fail: %d\n", - ret); - return ret; - } - - dev_dbg(inst->dev->dev, "%s: rd_ptr %pad wr_ptr %pad", __func__, &rd_ptr, &wr_ptr); - - if (remain_size < src_size) { - dev_dbg(inst->dev->dev, - "%s: remaining size: %zu < source size: %zu for src buf (%u)\n", - __func__, remain_size, src_size, vbuf->vb2_buf.index); - break; - } - - ret = write_to_ringbuffer(inst, src_buf, src_size, ring_buffer, wr_ptr); - if (ret) { - dev_err(inst->dev->dev, "Write src buf (%u) to ring buffer, fail: %d\n", - vbuf->vb2_buf.index, ret); - return ret; - } - - ret = wave5_vpu_dec_update_bitstream_buffer(inst, src_size); - if (ret) { - dev_dbg(inst->dev->dev, - "update_bitstream_buffer fail: %d for src buf (%u)\n", - ret, vbuf->vb2_buf.index); - break; - } - - vpu_buf->consumed = true; - - /* Don't write buffers passed the last one while draining. */ - if (v4l2_m2m_is_last_draining_src_buf(m2m_ctx, vbuf)) { - dev_dbg(inst->dev->dev, "last src buffer written to the ring buffer\n"); - break; - } - } - - return 0; -} - static void wave5_vpu_dec_buf_queue_src(struct vb2_buffer *vb) { struct vpu_instance *inst = vb2_get_drv_priv(vb->vb2_queue); @@ -1236,6 +1289,11 @@ static void wave5_vpu_dec_buf_queue_src(struct vb2_buffer *vb) vbuf->sequence = inst->queued_src_buf_num++; v4l2_m2m_buf_queue(m2m_ctx, vbuf); + + INIT_LIST_HEAD(&vpu_buf->list); + mutex_lock(&inst->feed_lock); + list_add_tail(&vpu_buf->list, &inst->avail_src_bufs); + mutex_unlock(&inst->feed_lock); } static void wave5_vpu_dec_buf_queue_dst(struct vb2_buffer *vb) @@ -1287,10 +1345,13 @@ static void wave5_vpu_dec_buf_queue(struct vb2_buffer *vb) __func__, vb->type, vb->index, vb2_plane_size(&vbuf->vb2_buf, 0), vb2_plane_size(&vbuf->vb2_buf, 1), vb2_plane_size(&vbuf->vb2_buf, 2)); - if (vb->type == V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE) + if (vb->type == V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE) { + if (inst->empty_queue) + inst->empty_queue = false; wave5_vpu_dec_buf_queue_src(vb); - else if (vb->type == V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE) + } else if (vb->type == V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE) { wave5_vpu_dec_buf_queue_dst(vb); + } } static int wave5_vpu_dec_allocate_ring_buffer(struct vpu_instance *inst) @@ -1369,6 +1430,13 @@ static int streamoff_output(struct vb2_queue *q) struct vb2_v4l2_buffer *buf; int ret; dma_addr_t new_rd_ptr; + struct vpu_src_buffer *vpu_buf, *tmp; + + inst->retry = false; + inst->queuing_num = 0; + + list_for_each_entry_safe(vpu_buf, tmp, &inst->avail_src_bufs, list) + list_del_init(&vpu_buf->list); while ((buf = v4l2_m2m_src_buf_remove(m2m_ctx))) { dev_dbg(inst->dev->dev, "%s: (Multiplanar) buf type %4u | index %4u\n", @@ -1445,6 +1513,7 @@ static void wave5_vpu_dec_stop_streaming(struct vb2_queue *q) dev_dbg(inst->dev->dev, "%s: type: %u\n", __func__, q->type); pm_runtime_resume_and_get(inst->dev->dev); + inst->empty_queue = false; while (check_cmd) { struct queue_status_info q_status; @@ -1452,10 +1521,8 @@ static void wave5_vpu_dec_stop_streaming(struct vb2_queue *q) wave5_vpu_dec_give_command(inst, DEC_GET_QUEUE_STATUS, &q_status); - if (q_status.report_queue_count == 0) - break; - - if (wave5_vpu_wait_interrupt(inst, VPU_DEC_TIMEOUT) < 0) + if ((inst->state == VPU_INST_STATE_STOP || q_status.instance_queue_count == 0) && + q_status.report_queue_count == 0) break; if (wave5_vpu_dec_get_output_info(inst, &dec_output_info)) @@ -1548,13 +1615,24 @@ static void wave5_vpu_dec_device_run(void *priv) struct queue_status_info q_status; u32 fail_res = 0; int ret = 0; + unsigned long flags; dev_dbg(inst->dev->dev, "%s: Fill the ring buffer with new bitstream data", __func__); pm_runtime_resume_and_get(inst->dev->dev); - ret = fill_ringbuffer(inst); - if (ret) { - dev_warn(inst->dev->dev, "Filling ring buffer failed\n"); - goto finish_job_and_return; + if (!inst->retry) { + mutex_lock(&inst->feed_lock); + ret = fill_ringbuffer(inst); + mutex_unlock(&inst->feed_lock); + if (ret < 0) { + dev_warn(inst->dev->dev, "Filling ring buffer failed\n"); + goto finish_job_and_return; + } else if (!inst->eos && + inst->queuing_num == 0 && + inst->state == VPU_INST_STATE_PIC_RUN) { + dev_dbg(inst->dev->dev, "%s: no bitstream for feeding, so skip ", __func__); + inst->empty_queue = true; + goto finish_job_and_return; + } } switch (inst->state) { @@ -1590,7 +1668,9 @@ static void wave5_vpu_dec_device_run(void *priv) * we had a chance to switch, which leads to an invalid state * change. */ + spin_lock_irqsave(&inst->state_spinlock, flags); switch_state(inst, VPU_INST_STATE_PIC_RUN); + spin_unlock_irqrestore(&inst->state_spinlock, flags); /* * During DRC, the picture decoding remains pending, so just leave the job @@ -1605,12 +1685,14 @@ static void wave5_vpu_dec_device_run(void *priv) ret = wave5_prepare_fb(inst); if (ret) { dev_warn(inst->dev->dev, "Framebuffer preparation, fail: %d\n", ret); + spin_lock_irqsave(&inst->state_spinlock, flags); switch_state(inst, VPU_INST_STATE_STOP); + spin_unlock_irqrestore(&inst->state_spinlock, flags); break; } if (q_status.instance_queue_count) { - dev_dbg(inst->dev->dev, "%s: leave with active job", __func__); + v4l2_m2m_job_finish(inst->v4l2_m2m_dev, m2m_ctx); return; } @@ -1621,11 +1703,17 @@ static void wave5_vpu_dec_device_run(void *priv) dev_err(inst->dev->dev, "Frame decoding on m2m context (%p), fail: %d (result: %d)\n", m2m_ctx, ret, fail_res); - break; + goto finish_job_and_return; } /* Return so that we leave this job active */ - dev_dbg(inst->dev->dev, "%s: leave with active job", __func__); - return; + if (fail_res == WAVE5_SYSERR_QUEUEING_FAIL) { + inst->retry = true; + } else { + inst->retry = false; + if (!inst->eos) + inst->queuing_num--; + } + break; default: WARN(1, "Execution of a job in state %s illegal.\n", state_to_str(inst->state)); break; @@ -1633,9 +1721,7 @@ static void wave5_vpu_dec_device_run(void *priv) finish_job_and_return: dev_dbg(inst->dev->dev, "%s: leave and finish job", __func__); - pm_runtime_mark_last_busy(inst->dev->dev); - pm_runtime_put_autosuspend(inst->dev->dev); - v4l2_m2m_job_finish(inst->v4l2_m2m_dev, m2m_ctx); + up(&inst->run_sem); } static void wave5_vpu_dec_job_abort(void *priv) @@ -1686,7 +1772,8 @@ static int wave5_vpu_dec_job_ready(void *priv) "No capture buffer ready to decode!\n"); break; } else if (!wave5_is_draining_or_eos(inst) && - !v4l2_m2m_num_src_bufs_ready(m2m_ctx)) { + (!v4l2_m2m_num_src_bufs_ready(m2m_ctx) || + inst->empty_queue)) { dev_dbg(inst->dev->dev, "No bitstream data to decode!\n"); break; @@ -1726,6 +1813,8 @@ static int wave5_vpu_open_dec(struct file *filp) inst->ops = &wave5_vpu_dec_inst_ops; spin_lock_init(&inst->state_spinlock); + mutex_init(&inst->feed_lock); + INIT_LIST_HEAD(&inst->avail_src_bufs); inst->codec_info = kzalloc(sizeof(*inst->codec_info), GFP_KERNEL); if (!inst->codec_info) @@ -1797,6 +1886,9 @@ static int wave5_vpu_open_dec(struct file *filp) if (inst->dev->product_code != WAVE515_CODE) wave5_vdi_allocate_sram(inst->dev); + sema_init(&inst->run_sem, 1); + inst->run_thread = kthread_run(run_thread, inst, "run thread"); + ret = mutex_lock_interruptible(&dev->dev_lock); if (ret) goto cleanup_inst; diff --git a/drivers/media/platform/chips-media/wave5/wave5-vpu.c b/drivers/media/platform/chips-media/wave5/wave5-vpu.c index 63a607d10433..a9bd96cbf9ac 100644 --- a/drivers/media/platform/chips-media/wave5/wave5-vpu.c +++ b/drivers/media/platform/chips-media/wave5/wave5-vpu.c @@ -51,7 +51,7 @@ static void wave5_vpu_handle_irq(void *dev_id) u32 seq_done; u32 cmd_done; u32 irq_reason; - struct vpu_instance *inst; + struct vpu_instance *inst, *tmp; struct vpu_device *dev = dev_id; irq_reason = wave5_vdi_read_register(dev, W5_VPU_VINT_REASON); @@ -60,8 +60,7 @@ static void wave5_vpu_handle_irq(void *dev_id) wave5_vdi_write_register(dev, W5_VPU_VINT_REASON_CLR, irq_reason); wave5_vdi_write_register(dev, W5_VPU_VINT_CLEAR, 0x1); - list_for_each_entry(inst, &dev->instances, list) { - + list_for_each_entry_safe(inst, tmp, &dev->instances, list) { if (irq_reason & BIT(INT_WAVE5_INIT_SEQ) || irq_reason & BIT(INT_WAVE5_ENC_SET_PARAM)) { if (dev->product_code == WAVE515_CODE && diff --git a/drivers/media/platform/chips-media/wave5/wave5-vpuapi.c b/drivers/media/platform/chips-media/wave5/wave5-vpuapi.c index e16b990041c2..a5b1966530c0 100644 --- a/drivers/media/platform/chips-media/wave5/wave5-vpuapi.c +++ b/drivers/media/platform/chips-media/wave5/wave5-vpuapi.c @@ -247,6 +247,7 @@ int wave5_vpu_dec_close(struct vpu_instance *inst, u32 *fail_res) unlock_and_return: mutex_unlock(&vpu_dev->hw_lock); + mutex_destroy(&inst->feed_lock); pm_runtime_put_sync(inst->dev->dev); return ret; } diff --git a/drivers/media/platform/chips-media/wave5/wave5-vpuapi.h b/drivers/media/platform/chips-media/wave5/wave5-vpuapi.h index 45615c15beca..7cdb5b5fe3e4 100644 --- a/drivers/media/platform/chips-media/wave5/wave5-vpuapi.h +++ b/drivers/media/platform/chips-media/wave5/wave5-vpuapi.h @@ -812,11 +812,17 @@ struct vpu_instance { bool cbcr_interleave; bool nv21; bool eos; + bool retry; + bool empty_queue; + int queuing_num; + struct mutex feed_lock; /* lock for feeding bitstream buffers */ struct vpu_buf bitstream_vbuf; dma_addr_t last_rd_ptr; size_t remaining_consumed_bytes; bool needs_reallocation; + struct semaphore run_sem; + struct task_struct *run_thread; unsigned int min_src_buf_count; unsigned int rot_angle; unsigned int mirror_direction; From patchwork Tue Nov 12 02:15:15 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Jackson.lee" X-Patchwork-Id: 844053 Received: from SE2P216CU007.outbound.protection.outlook.com (mail-koreacentralazon11021085.outbound.protection.outlook.com [40.107.42.85]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 374DA20A5CC; Tue, 12 Nov 2024 02:15:36 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.42.85 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1731377737; cv=fail; b=gofoDyjf+Z+v3+K1MiqaLV8ANZfdbcgL0SWZ4HKIUM6xpRr/GfvE2diRNNMuUP/Qii2Q5fb+8dWTmHSZ4eg/57DX90Ngis0ZjGJQQaDDBs8E29gHlt/Pqn035INuOLgs5hvHNPYbPqyyNoLFKhteHh6xjuk9B+5GCLSmpYFZTts= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1731377737; c=relaxed/simple; bh=LidYNCtL7KNerqloT06mzsIV2PFBI1/GqVdsAXf5ew4=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: Content-Type:MIME-Version; b=OFRZZnAKFVqrqLci7E/Vh+vRj2qHmj1kvfdJosmbpzUdfwFFaQAs2JX90rVgldALReSJw61MAoE7KltkZjVJQOdBbjdqMw/W9NBvGCG3/RJBhLUfbUMCbdFr8gfc70mMQe5o78JZb1bddKHeWwQqzQnRcBHM8YIFTKqfgPuyn9Y= ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=chipsnmedia.com; spf=fail smtp.mailfrom=chipsnmedia.com; dkim=pass (1024-bit key) header.d=chipsnmedia.com header.i=@chipsnmedia.com header.b=iRRQxQ8O; arc=fail smtp.client-ip=40.107.42.85 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=chipsnmedia.com Authentication-Results: smtp.subspace.kernel.org; spf=fail smtp.mailfrom=chipsnmedia.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=chipsnmedia.com header.i=@chipsnmedia.com header.b="iRRQxQ8O" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=a4eZXwgVePdvWUxQ+HkLvQhJ+VL2XYt053dquT0v4XALMPRsILOEf133Qn/mtnjQJrPz47yDGVePtxMx3y0jGpYUnAnNNBWZ3sluNj3+IQaXAPz6grX8uHuH4gljBT1caojE2Po7HtOE0ma4BbpEl4B7dM2CeWzWqw91vPg25u7XlUyRVLskEHUBBlLLJat+HStYfQtkAManAyXeV38W+dwP5K+YTMiakgS79B7NE/faQyu7aFk+CsrDKwyNBHLiPd483Lw1G0eHukTtAOHTIRPdZWJeFV/Vb3fc2WvdAq46zaedn/jgZ1kECf7WQiKwhZsdXv5incyfWch+orPy9A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; 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=kmpCoE44XUfD9f+gO2QHeFVCqPLDpuhGdPnk3gbc4HY=; b=X6rFAo2GHgN7J4jUMJxKhPbEsz9Yu8/nhrd1uXksSWxEXimARnlbIO1SMiNzF6CZUsnhM3TOa3Z6gSMIX9LGlhsc6pqo4RHQRIZ1VnTifdQjA7lULsCIJb8Ta4QFY519XbBoRluEu8FPobmGMvT5r6szlfNidL0x1JKwfi7m2evES5N52PWJw2mqernbDyenyzyt8qJ9KBXAd4uzhYNX838Zennk0iihgAP6ZTkVax6TZhU9o/tXsvhf76wCDe1vHMgXoA34DovpE3kfEZLheyZSqbOzECAK7JB+6Lo4ouQVmJfT/Qu09nlzWxT7wS8aNKPkzsYU10OWxkIHAYuXeA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=chipsnmedia.com; dmarc=pass action=none header.from=chipsnmedia.com; dkim=pass header.d=chipsnmedia.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chipsnmedia.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=kmpCoE44XUfD9f+gO2QHeFVCqPLDpuhGdPnk3gbc4HY=; b=iRRQxQ8OzlkuJexlnlUcDbd2o4o2ZdWDBV0ITgj73Z5630ivl2N+woj8gObJX+u/FYSGAEtH5sKyLQeQocLDR2/+bCoSKY5s95TuNntqlSeTn+PZdQnCzAqYlXaEk8rnTxC1yo4eYUZNhFywN99hzLsleU6V89DxO4iazeBwtok= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=chipsnmedia.com; Received: from SE1P216MB1303.KORP216.PROD.OUTLOOK.COM (2603:1096:101:15::5) by SE1P216MB2114.KORP216.PROD.OUTLOOK.COM (2603:1096:101:15f::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8137.29; Tue, 12 Nov 2024 02:15:27 +0000 Received: from SE1P216MB1303.KORP216.PROD.OUTLOOK.COM ([fe80::b711:5ab1:b5a4:d01b]) by SE1P216MB1303.KORP216.PROD.OUTLOOK.COM ([fe80::b711:5ab1:b5a4:d01b%6]) with mapi id 15.20.8137.027; Tue, 12 Nov 2024 02:15:26 +0000 From: "Jackson.lee" To: mchehab@kernel.org, nicolas@ndufresne.ca, sebastian.fricke@collabora.com Cc: linux-media@vger.kernel.org, linux-kernel@vger.kernel.org, hverkuil@xs4all.nl, nas.chung@chipsnmedia.com, lafley.kim@chipsnmedia.com, b-brnich@ti.com, jackson.lee@chipsnmedia.com Subject: [PATCH v0 4/6] media: chips-media: wave5: Fix Multistream Decode Hang with no IRQ Present Date: Tue, 12 Nov 2024 11:15:15 +0900 Message-Id: <20241112021517.121-5-jackson.lee@chipsnmedia.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20241112021517.121-1-jackson.lee@chipsnmedia.com> References: <20241112021517.121-1-jackson.lee@chipsnmedia.com> X-ClientProxiedBy: SE2P216CA0042.KORP216.PROD.OUTLOOK.COM (2603:1096:101:116::7) To SE1P216MB1303.KORP216.PROD.OUTLOOK.COM (2603:1096:101:15::5) Precedence: bulk X-Mailing-List: linux-media@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: SE1P216MB1303:EE_|SE1P216MB2114:EE_ X-MS-Office365-Filtering-Correlation-Id: f1676394-24e8-4640-36f3-08dd02bfdf77 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; ARA:13230040|366016|1800799024|52116014|376014|38350700014; X-Microsoft-Antispam-Message-Info: rbXb4z3ok95GTbAmNALDGqI0C22VuBt+jMDFoTRbnHgXVyImUXkUJbG1ZUdeU/jwiKAQI9bpd+qWB5eiZc50dtaAD769UrT3fc60yWUOC5/Gejo6/6vUHyZwTZ/Xb+9NDWcAu8cAqqrgByrRAx5ufB1b9DIAFli7oWZ9qUgGlrYgrPf9cNZ9w8HEZBhTMkl96qepbS+L8fwqSCqDxMp9uDZKI1hMYksAyjbqj6G/e2sHdxWjSe1Lz26jyx76WTtqdlNz/NrNBDvY16o7eahbsemyJ6RAB69dUk0cMni/8uSgv3rqrQHQYuUjRvODIwWZODDznjWM4tm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G:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:SE1P216MB1303.KORP216.PROD.OUTLOOK.COM; PTR:; CAT:NONE; SFS:(13230040)(366016)(1800799024)(52116014)(376014)(38350700014); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: RtofmjMQ9c4XKYlFykCLpnFp5lR31fs4owISAY3KXvZJeo2EMI69YZSDcIDC33MN9NP/gOm3lJCUGXDqEjO9c8fVrSBdJYLid1Q+7W7Vb6y5+JGmdtGs5PgYwt7tAtJTf/I3Rh1/gCOApF3HJH9QgzZfUfWVM7m0G71pF/SdegAVTHSgbHCl6zQUhl6WSfxNXCJlBa03NTmh8fjfAitaJxEbBdS+kchxF4aMf+cqhqLCMSIFvsJt381H3RXDgbF+7/v998+lvnR2qO4S5YCO5R5jh3uchck6xGHc2whfCGECZQYelxz8oqHF+Lrk70gBKTZ5nEDhv3W+1+yPkvcs5ti9ZkD78093PRmikqZ9cxmpbNUx+MZYflECL1z71bUP05RFZJ3x+rcpwFtpv6Zh6ZaIlPMdazuiQEhZLws4RXaItMd2JH65Z5DumSZsWBJ7RA2zp54jaFhDtB3GcENTfbNguAJUEsxNTzNBCdr2jvuMPWkrU+IjI80RsQoylCk+0qQ/eGtSRpNMIkmZkG3k/ektWtgPmR97pbYxYQGY0yUcFihp4CSTi080gHes0Y3HL7asSCoKWraTI3s+oseXrYELgnm3tH9oKWjTSW/hD9yfSGhE/zYszJLutT0uOlvVpygF2ZwGAxwJU49d9oMfJ/8/Vg9DfKI7LS+8Q6L09+MR6Bg3YBWwPsG/FMRX0HXbx3a6gU0Upp3KI/8efJO0Pru8ZHUTMw5omjv/VtwLOclB42LHk2QAYprxTHqDuax9jV7j5pmwr6/1uJ0JVlDNDPRZHoQ3xQPB3iveKRakG7sJhpAkSWqnb4dodyDaYbwYR1HUNU6mDgWnqX98vXoRGkKtoOYSCgYW72tgW5x34jrS8rpBBiIRsWUylt9wgD78T/cvdE/vmnF/lP+d/HDPRMTr9s5CDDFzCj8jpU2+yVa1RcfCJbMlAye72SpVYVidug7wa8X4EUIZq+MERPtvoxi9Nz1FVFZ9B+O4o6ou8S3sQPD4nfjz9J1Q4fVppW/T57ZYLJQtBOk///RUKSF5l+y4jW1izU1pOddJ6Hzb0XR2+ETBEwu0gHegu6ZgpmW7tSZ1bFXaRY/jLWyx/aLtL48OCTR5io1u+XkpV308JB1okb9sEnjCXO1sTERo/4/xnkofoudWG0yJSLe0L+6mJbXeh6q1ILbzX8POovs6+/622jSsFPseVTsFmTsPmA+FTB2i4aKLJIh6EkAsu3rbVoH++PkykFFZvX3hQgcG98PGSQaFWu3NlWf1R1DxgNBmxcO10RkE+g7k0Ri05sffRNiU2ygTld3/NfKeHspX+79KsO9YHlqZE7RuyeIxGHxWOX7qxI0qCb+zmtbBSE5QD+tAQSZS5bvlWHDUoooyY2PfayMPhHEfpkiZ2FOSImuIAIeUvCeVHYLV/sYskGr9uUeGoj1dmixUPIJ/7rwBER4/93XVhhcFOt9p7xoh9ZnfVo5ZvJvfs1TS/lxTPG/mWwQm92cC87iiiCSAN1ihf41CRteQW+DJhRKnx+owvyY5lw27/H+O4ThWubP8i9DK1/K4t4H8mkyQbg4tNI/2JeaBA8vQGteBK6AQBEwNmKsQgRp3cANAI9OBd5py1Fh1gA== X-OriginatorOrg: chipsnmedia.com X-MS-Exchange-CrossTenant-Network-Message-Id: f1676394-24e8-4640-36f3-08dd02bfdf77 X-MS-Exchange-CrossTenant-AuthSource: SE1P216MB1303.KORP216.PROD.OUTLOOK.COM X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 12 Nov 2024 02:15:26.8633 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 4d70c8e9-142b-4389-b7f2-fa8a3c68c467 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: 0JTKRruwI239DDt3M6r+ZKC/vCPw/QpOwNcbRAFMBo04wYlF7DPk7knJJ9c6BMwoEmZuKVOmv8UAZCX9K4rlLYKQdwg4SivaKcFNKgTxwG8= X-MS-Exchange-Transport-CrossTenantHeadersStamped: SE1P216MB2114 In multistream decode case when polling is used, a hang can occur in two different locations. Firstly, the work function that is called every 5ms to service any possible interrupts triggered by the VPU. While handling VPU IRQ, there is corner case where another decoded picture IRQ event could occur. Before marking command as handled on the VPU, make sure that another decoded picture IRQ event hasn't occurred so the event isn't lost. Secondly, during stop_streaming, there is a check in place to see if any decoded pictures remain. If there are, a call is made to wait for the interrupt to trigger in order to service the decoded picture. However, this interrupt won't be seen since polling is being used. A timeout will then occur after one minute. Remove this wait and allow work handler to keep running until last picture is serviced. Signed-off-by: Jackson.lee Signed-off-by: Nas Chung --- .../media/platform/chips-media/wave5/wave5-vpu.c | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/drivers/media/platform/chips-media/wave5/wave5-vpu.c b/drivers/media/platform/chips-media/wave5/wave5-vpu.c index a9bd96cbf9ac..9bc216052a15 100644 --- a/drivers/media/platform/chips-media/wave5/wave5-vpu.c +++ b/drivers/media/platform/chips-media/wave5/wave5-vpu.c @@ -51,6 +51,7 @@ static void wave5_vpu_handle_irq(void *dev_id) u32 seq_done; u32 cmd_done; u32 irq_reason; + u32 irq_subreason; struct vpu_instance *inst, *tmp; struct vpu_device *dev = dev_id; @@ -81,8 +82,17 @@ static void wave5_vpu_handle_irq(void *dev_id) irq_reason & BIT(INT_WAVE5_ENC_PIC)) { if (cmd_done & BIT(inst->id)) { cmd_done &= ~BIT(inst->id); - wave5_vdi_write_register(dev, W5_RET_QUEUE_CMD_DONE_INST, - cmd_done); + if (dev->irq < 0) { + irq_subreason = + wave5_vdi_read_register(dev, W5_VPU_VINT_REASON); + if (!(irq_subreason & BIT(INT_WAVE5_DEC_PIC))) + wave5_vdi_write_register(dev, + W5_RET_QUEUE_CMD_DONE_INST, + cmd_done); + } else { + wave5_vdi_write_register(dev, W5_RET_QUEUE_CMD_DONE_INST, + cmd_done); + } inst->ops->finish_process(inst); } } From patchwork Tue Nov 12 02:15:16 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Jackson.lee" X-Patchwork-Id: 842810 Received: from SE2P216CU007.outbound.protection.outlook.com (mail-koreacentralazon11021085.outbound.protection.outlook.com [40.107.42.85]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 637C9209688; Tue, 12 Nov 2024 02:15:34 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.42.85 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1731377736; cv=fail; b=Od2X1sTEAKWwTadZ4MdkTdwvyKNJPYwPHBGkPd1NEaVFp9N3QSZnUA3qrKL4PuLy6hEiQ7eD1BUngvHoXG72LHR5pFANxoJSGF29WJu4gPv9gsP6dtEaLVyujboevoGapp8xwY7irOWxigR2895Y6CxepK90zrgS4xExkVqikYM= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1731377736; c=relaxed/simple; bh=hjvBCfSifV8a1egVYj+m48lrkOVaeZlvA78XqqG2yFI=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: Content-Type:MIME-Version; b=PmunT0p1135qMmfy3Tl0cR74vtEIqXYRZfA8yJEKbR/+eE3mm9ZW2RKVCUdQZcWsMI27KbpfQaTL9kfPq/b9Wnsfm6ilUtKuZsvOXWQpCiggFaLQdVlSpz88MTsBTDavypeWcAgrm32VikpaiU3j5qeJ8NpNs30UOeNCdNmyW+s= ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=chipsnmedia.com; spf=fail smtp.mailfrom=chipsnmedia.com; dkim=pass (1024-bit key) header.d=chipsnmedia.com header.i=@chipsnmedia.com header.b=dk2RCcGU; arc=fail smtp.client-ip=40.107.42.85 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=chipsnmedia.com Authentication-Results: smtp.subspace.kernel.org; spf=fail smtp.mailfrom=chipsnmedia.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=chipsnmedia.com header.i=@chipsnmedia.com header.b="dk2RCcGU" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=cQjYEdCyPj10l3GoDWzIwE/4X07/I9+cy5HlBx1HNL57s3bAbdfweLbfudd7i6Eu8rDmaH7rxLFg1bPsKB7j9s5eaH7VYTQ19U9wUo8w5hHjbpNbfjp2UxMcsEWIBPUIvaGJ8ng/lABArGGkBkHzcXqj7NP9hD813tFPwPCTICPeRpBdI/ea1pVM3hajOiLheFJjTKlJdOgpMQ7K+v4kkO4nmi7CbqzymlmAshGzXYYEQHhM8779WCSW0l4nKuVHN9NxwJASGiAks37+0VQ80skh73o/A2OCms0YL7ManoKsFC0HoURuRm3k3VvSApvBJ29EPzNjq50V3QgiZEgxkw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; 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=Y4QWJ9BVMR+pqC3EH5zrWP1c2hRpHgUn9yRDVIG6rHU=; b=DpThYV7oysO/HkfkyvsM5kEFNDsvzb5Eyy2IH2mjXDZzC/x+B6EFd/2kRdBiyrYFv2Nr/uhQflJ0uavj3G955u+un0Zrdxj2UCP9DQ9kRaWynUy2RlsEbDMOBIu9/Bo78hTAalOltrjkV8LSc98aWA45cmJJxkRj7oIUEeFtPbkIJ49byKEcseZdRM+ZYqj8ur7ro5uuMsVW++/a8sU9dABRO8klFzb8hLHHmSONNi1Vexd0b9PcflMABNJs/UVe5/8NdAJUhiyzN7ALohlxZVdcl3d+HgOBviDG/KaT2kWnGfRZk/da/LI0QGJI+eLZyXHv4lDAlTgGtAvp7Nkb3A== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=chipsnmedia.com; dmarc=pass action=none header.from=chipsnmedia.com; dkim=pass header.d=chipsnmedia.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chipsnmedia.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=Y4QWJ9BVMR+pqC3EH5zrWP1c2hRpHgUn9yRDVIG6rHU=; b=dk2RCcGUQc6PNaOrlsSZL1lDSjsoo7o3gztzZVEzeFMdB4XnYTxprbSILftYOicQx8TZUktdAJ0+pBuieXDAGQ/wXx5g0srt65fuPgbPP9eDAO6xxYtffw9NOskpwidD5bTk5UA2mOjVsiNsNUSK4ASvc/oiBQ0KtBy+b8oT58E= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=chipsnmedia.com; Received: from SE1P216MB1303.KORP216.PROD.OUTLOOK.COM (2603:1096:101:15::5) by SE1P216MB2114.KORP216.PROD.OUTLOOK.COM (2603:1096:101:15f::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8137.29; Tue, 12 Nov 2024 02:15:27 +0000 Received: from SE1P216MB1303.KORP216.PROD.OUTLOOK.COM ([fe80::b711:5ab1:b5a4:d01b]) by SE1P216MB1303.KORP216.PROD.OUTLOOK.COM ([fe80::b711:5ab1:b5a4:d01b%6]) with mapi id 15.20.8137.027; Tue, 12 Nov 2024 02:15:27 +0000 From: "Jackson.lee" To: mchehab@kernel.org, nicolas@ndufresne.ca, sebastian.fricke@collabora.com Cc: linux-media@vger.kernel.org, linux-kernel@vger.kernel.org, hverkuil@xs4all.nl, nas.chung@chipsnmedia.com, lafley.kim@chipsnmedia.com, b-brnich@ti.com, jackson.lee@chipsnmedia.com Subject: [PATCH v0 5/6] media: chips-media: wave5: Fix hang after seeking Date: Tue, 12 Nov 2024 11:15:16 +0900 Message-Id: <20241112021517.121-6-jackson.lee@chipsnmedia.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20241112021517.121-1-jackson.lee@chipsnmedia.com> References: <20241112021517.121-1-jackson.lee@chipsnmedia.com> X-ClientProxiedBy: SE2P216CA0042.KORP216.PROD.OUTLOOK.COM (2603:1096:101:116::7) To SE1P216MB1303.KORP216.PROD.OUTLOOK.COM (2603:1096:101:15::5) Precedence: bulk X-Mailing-List: linux-media@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: SE1P216MB1303:EE_|SE1P216MB2114:EE_ X-MS-Office365-Filtering-Correlation-Id: c9b0edc3-9566-4bfe-a44e-08dd02bfdfa6 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; ARA:13230040|366016|1800799024|52116014|376014|38350700014; X-Microsoft-Antispam-Message-Info: Pu7O28/5pYOWkI+PdhbfUC9dwvvUMzVA5nsHKsH3/1pIhDLhxTaWoHDI8/QCbkkqqxu0kAFuKRs13V0DpkEDKSQnHvthBke+HEpCK/lpn9FDM8xxWV5LqYIsEVoK7MlzkLKUIEtu7xggPPkDpe9Nq7nRdAdBlqXx9tiAqU8GMxslvL7az8hyjrq8uhRbORz+wxIjjw8MshLwtTgmydJF8NLmDfaiiXBo4YJsyHNtrVn3J0hJ1i/c6+kFTFh65XotlFmnuKuY3ZRsMG7NLnvhcUQpMA8EOj5GzjQVdW5nNISUOh+fsZzLoSx7ESYd0NQyT6k4LSju6kTRSrRTt0NWSjq4VFf7G/cK/CDJkj6Qf/yJ8gAEO8NSrqXQ31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H:SE1P216MB1303.KORP216.PROD.OUTLOOK.COM; PTR:; CAT:NONE; SFS:(13230040)(366016)(1800799024)(52116014)(376014)(38350700014); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: HfPu03p/GHWl9CgDYwqoBemPrSZGZXI/nyyJUJm+1AJjapT69i1vcafmM4kBAEf51ybmOudwcbD+kw4GNl14xBDG6UUFRfYnmvis53NGagjR+35rnuD8qn8gf2bD8PtA8H9y3ZUVvjREmrXIlGedrQ/0rnyCYA632PzdjWh+h3hnk+OywzLEEXs6rhBp+PN7Jku3uMK5MQ/oonoIkgivrXOLAjyradBondzQ/XBDPECkmGrsw3JaMyLuoKApmJN2J+VhX+7yyAOCYR7psj4zWG/9vHH0cBWsnSROXnGYZLA9aFMXrtSSzVzM36ZBSHzRYUzArURJHkakV35nvltnhaUzUTKz1k5LxZBxuYJEadQt3RNpzeOm39cKZsGbaFrKSVcSoA9ZPsGY/vutuPX1vf8yhJKBSnVEwif7zRpQ532LZO+aIlcOIODwhHePQ4gg0LxpBJehDzVhTMITMQ6PVJj+OO04vkH89CG5VMcL0RtepCAC9Qwfg+54SEZqApsobdgGd4ChlZ6JPSOTZY76zALwVLZf8YUj2sXYC5Kv6mS6eSH202Z0f1fx6lP+aOWps/jvciFH+z85CdYzxKsYPA8DS+64LWEEoXs9azua7PrMft72a8gv0pEg1VGI1nQLJcBovozvzdYDsH5kw16he43HboLDyevDLMniUwHd8MCtpaD2km+BR6nQyw9nGes5w5PCCw2HTcEm8XeJhz9iNpW33hqqDpj9YsF3d78UR3+rbq+RiVkLHps3pd7dhxp4Fw9/dF62nPqSp4DoejkMF0XST86Hla6u68hhnhqoWmrP8H6jfwbuchMUL0ecAI6Ou/UNuGjhtbLRLzOmqGBxebeyQ21GAO9FNqHaWwDuXhR8lzBQEzv0CoAoG7vN4U6T3ixAn+FW799DYKEDIfLUKk3BGI7BqEZIooRYoL8/L5SimQ40KTuXWptgoVeCT4Lm8iOrlLyutjGppoFsfgJigHpS+ZmDHOdIa9IoRF21VSXmiGGdKhTFD/FdpFZkvTNJcfa3Z8d59hxE+QtkRWcb8WR85c6rWFpShngIkLYWgAZl997FVIaLqTQqGSXsd1ebouPoAkAS3po8NKS74zvAJ9U7SNdxNoxYQ2UQevJletcqGEAMhaqMzhEBCdYuC3Cn0jUdfSUXFmQP6ejkGXCVHhmz2mKzIGoessEt0jvvH7L4gwj3ti/Z9gm1LxIEj6qrWxhHnRrCzWfoUBy9QaLWYCaWuPRFUhwnq0q0j6xwzOS7AiJcABNEQNgaVISC/gQK9yueseKItzPTDm8mbdnDgSSyh+FhxD8FJn/VbPSXzo8oL2Jlg6dx7NudvkZwCmlekVHxTI5kupDZIJ1fX3R/6rNr4M/fYFILwECDDE9fvIKxbD9BqUINcp+FVyWrD3gfk8tIaCsKyLZemIQOp7IBdbnsg+Fj0216iUWgY3+g3IwgXPg5pjdaZOBxOprbHMJiGMTyfU7ivknr6D9EkABPdsqkvN7nbIOqjw71jUm9Iehvh00UVaUC/EkG3xr1/Oq5V9ivvykOa99iU6Ur6CqTdc9OcevDu/wBTupVsG0QegpHKy/b0lOCKoLRwVv3UjDrajLa5VbSvyuRWpXZKvW0HA== X-OriginatorOrg: chipsnmedia.com X-MS-Exchange-CrossTenant-Network-Message-Id: c9b0edc3-9566-4bfe-a44e-08dd02bfdfa6 X-MS-Exchange-CrossTenant-AuthSource: SE1P216MB1303.KORP216.PROD.OUTLOOK.COM X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 12 Nov 2024 02:15:27.1855 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 4d70c8e9-142b-4389-b7f2-fa8a3c68c467 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: 9w3Qjb9359uZG/Pcu/e/4XjQnB91U4lvczoEU7PSqvpIwQBndVwp12VQQuduS3/VOXSQGSjTLb34feJcujKsaWGaYizkG5ryRXg5L/ClE24= X-MS-Exchange-Transport-CrossTenantHeadersStamped: SE1P216MB2114 While seeking, driver calls flush command. Before flush command is sent to VPU, driver should handle display buffer flags and should get all decoded information from VPU if VCORE is running. Signed-off-by: Jackson.lee Signed-off-by: Nas Chung --- .../platform/chips-media/wave5/wave5-vpu-dec.c | 17 ++++++++++++++++- .../platform/chips-media/wave5/wave5-vpuapi.c | 10 ++++++++++ 2 files changed, 26 insertions(+), 1 deletion(-) diff --git a/drivers/media/platform/chips-media/wave5/wave5-vpu-dec.c b/drivers/media/platform/chips-media/wave5/wave5-vpu-dec.c index f0db531247ac..51209700b7e8 100644 --- a/drivers/media/platform/chips-media/wave5/wave5-vpu-dec.c +++ b/drivers/media/platform/chips-media/wave5/wave5-vpu-dec.c @@ -1431,6 +1431,16 @@ static int streamoff_output(struct vb2_queue *q) int ret; dma_addr_t new_rd_ptr; struct vpu_src_buffer *vpu_buf, *tmp; + struct dec_output_info dec_info; + unsigned int i; + + for (i = 0; i < v4l2_m2m_num_dst_bufs_ready(m2m_ctx); i++) { + ret = wave5_vpu_dec_set_disp_flag(inst, i); + if (ret) + dev_dbg(inst->dev->dev, + "%s: Setting display flag of buf index: %u, fail: %d\n", + __func__, i, ret); + } inst->retry = false; inst->queuing_num = 0; @@ -1444,6 +1454,11 @@ static int streamoff_output(struct vb2_queue *q) v4l2_m2m_buf_done(buf, VB2_BUF_STATE_ERROR); } + while (wave5_vpu_dec_get_output_info(inst, &dec_info) == 0) { + if (dec_info.index_frame_display >= 0) + wave5_vpu_dec_set_disp_flag(inst, dec_info.index_frame_display); + } + ret = wave5_vpu_flush_instance(inst); if (ret) return ret; @@ -1526,7 +1541,7 @@ static void wave5_vpu_dec_stop_streaming(struct vb2_queue *q) break; if (wave5_vpu_dec_get_output_info(inst, &dec_output_info)) - dev_dbg(inst->dev->dev, "Getting decoding results from fw, fail\n"); + dev_dbg(inst->dev->dev, "there is no output info\n"); } v4l2_m2m_update_stop_streaming_state(m2m_ctx, q); diff --git a/drivers/media/platform/chips-media/wave5/wave5-vpuapi.c b/drivers/media/platform/chips-media/wave5/wave5-vpuapi.c index a5b1966530c0..8a071dbd70a1 100644 --- a/drivers/media/platform/chips-media/wave5/wave5-vpuapi.c +++ b/drivers/media/platform/chips-media/wave5/wave5-vpuapi.c @@ -75,6 +75,16 @@ int wave5_vpu_flush_instance(struct vpu_instance *inst) inst->type == VPU_INST_TYPE_DEC ? "DECODER" : "ENCODER", inst->id); mutex_unlock(&inst->dev->hw_lock); return -ETIMEDOUT; + } else if (ret == -EBUSY) { + struct dec_output_info dec_info; + + mutex_unlock(&inst->dev->hw_lock); + wave5_vpu_dec_get_output_info(inst, &dec_info); + ret = mutex_lock_interruptible(&inst->dev->hw_lock); + if (ret) + return ret; + if (dec_info.index_frame_display > 0) + wave5_vpu_dec_set_disp_flag(inst, dec_info.index_frame_display); } } while (ret != 0); mutex_unlock(&inst->dev->hw_lock); From patchwork Tue Nov 12 02:15:17 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Jackson.lee" X-Patchwork-Id: 842811 Received: from SE2P216CU007.outbound.protection.outlook.com (mail-koreacentralazon11021085.outbound.protection.outlook.com [40.107.42.85]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 2A429207A34; Tue, 12 Nov 2024 02:15:31 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.42.85 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1731377734; cv=fail; b=P8w0787v3YQ60Nd1EQienqEVIR9NnTP7rIUQ55SvhpIstXhCwjN5ENE8kH6wYMFxV+hfdmWGDX0ewuSM8x6pRWjZd0ibAeNN4tN/KdASJE8mMQ/5EBSrNZ+3RUG7/kSMbfaxgNyQ61GhLxUl9nk0KeultHe+xLU0pNqKqGsRH9E= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1731377734; c=relaxed/simple; bh=4ahxejURnaVVUm4qrjYFhLkfs8QT62VN6duD2U9ywF4=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: Content-Type:MIME-Version; b=YCBfOmwX+0coQcdPrZjqqgynpca3go90o+8c8H70XqKJAnNQLJ7GO/MV18hWC5ODdTfIPpU/ufbbFKylOpKgdP5hobYFuBInPFw5pjW0RK2wW2L9eWI51AE1TVyE7ozP3+Q1y6Nqr/U+oLWYHaLMj/pHKXVe1QuQ/ywO6iGU2rU= ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=chipsnmedia.com; spf=fail smtp.mailfrom=chipsnmedia.com; dkim=pass (1024-bit key) header.d=chipsnmedia.com header.i=@chipsnmedia.com header.b=Oein6f6e; arc=fail smtp.client-ip=40.107.42.85 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=chipsnmedia.com Authentication-Results: smtp.subspace.kernel.org; spf=fail smtp.mailfrom=chipsnmedia.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=chipsnmedia.com header.i=@chipsnmedia.com header.b="Oein6f6e" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=lxoKF1+n2fGuhu+1DJy8mbPmEz+Knu4meOADeclobPCdJMcwDN5iFelilOS+QZKWd8erHGcqZstKD7aEXRO/PCc0B5rEhAlAe2+930wuA10nZsWh6CqUgdm4f7O59I0do8fbk4Stb5zdnjdht+9Q+qRNnf8cwEqSz4NpMjFrkFyKwOQMDRQ+n6EWZOWO7jx15uFbbpgaw3Cdv71hxt8WXtfVYoDTcUDzXd4+SGBbLtjR2sbpW/xPp3G3IgHzH3IBWN7kQRfeVLBV+GRXXSqxjZa6DH9ee1h2HIsSTwrYGA+KgwZogyIN8VsN01Tf1BIUhiVt1zlyyeza7QDoMxUzcQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; 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=q2tZBSgIXWvUzkd+xm2nMlCMakQ+7QZAzXx+HNbJ0AI=; b=ZPZ+Yd9qqeCtuwrmVXZzHvRUX7fQTxhThUl4+CL9+RNo5r+eN5EupGisTm/Sm4q+DHdz44lPb8+SQ2QdcC+mcumQ9HKHVwadftbNeFnSJ5OdFzezAhmt7mpO1MHgLqlddZPE7T3/BMYxM4JsMcaYMF1I+6zVLUoADJCkrqIZwtxeMADXlKLDUnnxVWE2OzxxL4s9zXdmxPHaOObjWB7rq+7AaOpiC+TH0Y6+XNNcv7zNBGS3M1Ix1jRagqLCzrvRzBeL/v3CGeAbVcwwkdxJ8/qfggn6wgwOBKsht/f5sbB5lm37b/kLZBmpL70bLrvgMiyWYKHukLJc51+7e1pn1w== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=chipsnmedia.com; dmarc=pass action=none header.from=chipsnmedia.com; dkim=pass header.d=chipsnmedia.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chipsnmedia.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=q2tZBSgIXWvUzkd+xm2nMlCMakQ+7QZAzXx+HNbJ0AI=; b=Oein6f6eMBjpD4tuW49wvQqsDzcZbrmj70CDkpLO3Ch4B2P83fmjkGB8prBpCjyTHb3lSi2F0UlI7/o/aO1E6ox2dzhCKOfLsjGHadyBjChVpsVU95ihLEP0mI8GUsKJZU3lGGKTueTG/jnfSiUjvPJfTy3sSa0YDbUAysWpIi8= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=chipsnmedia.com; Received: from SE1P216MB1303.KORP216.PROD.OUTLOOK.COM (2603:1096:101:15::5) by SE1P216MB2114.KORP216.PROD.OUTLOOK.COM (2603:1096:101:15f::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8137.29; Tue, 12 Nov 2024 02:15:27 +0000 Received: from SE1P216MB1303.KORP216.PROD.OUTLOOK.COM ([fe80::b711:5ab1:b5a4:d01b]) by SE1P216MB1303.KORP216.PROD.OUTLOOK.COM ([fe80::b711:5ab1:b5a4:d01b%6]) with mapi id 15.20.8137.027; Tue, 12 Nov 2024 02:15:27 +0000 From: "Jackson.lee" To: mchehab@kernel.org, nicolas@ndufresne.ca, sebastian.fricke@collabora.com Cc: linux-media@vger.kernel.org, linux-kernel@vger.kernel.org, hverkuil@xs4all.nl, nas.chung@chipsnmedia.com, lafley.kim@chipsnmedia.com, b-brnich@ti.com, jackson.lee@chipsnmedia.com Subject: [PATCH v0 6/6] media: chips-media: wave5: Fix timeout while testing 10bit hevc fluster Date: Tue, 12 Nov 2024 11:15:17 +0900 Message-Id: <20241112021517.121-7-jackson.lee@chipsnmedia.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20241112021517.121-1-jackson.lee@chipsnmedia.com> References: <20241112021517.121-1-jackson.lee@chipsnmedia.com> X-ClientProxiedBy: SE2P216CA0042.KORP216.PROD.OUTLOOK.COM (2603:1096:101:116::7) To SE1P216MB1303.KORP216.PROD.OUTLOOK.COM (2603:1096:101:15::5) Precedence: bulk X-Mailing-List: linux-media@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: SE1P216MB1303:EE_|SE1P216MB2114:EE_ X-MS-Office365-Filtering-Correlation-Id: 8325b71c-2a59-461a-6a0d-08dd02bfdfce X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; ARA:13230040|366016|1800799024|52116014|376014|38350700014; X-Microsoft-Antispam-Message-Info: URecvhU6bnd+vBmpvHF0/cCyXQQW1wz5EaL2rGOLQNtef5aczWsJYsmpi3INWZ7zE4qeudlMw8PWMv40Q5YdOmgY1F4v57Hz40r22F27KmxEnx+JBTaCiXkI58MJs6vyClhTLu5DovTtPyL2GOC2BupqGF1qkUL9K7HM0GzthjFhQknKnObvIq0/z4f4kUsJbNu8j8MfLtYsyn+zoSaOjtvtWAY7uq1gEcGncz5xuMQatJzCw5gte6g4d9i3reyr2Kvr7i3hu7bQxur3aHasK+8jCOpAHW+BF0YxnLo+pPxs6VIWmUCOCigXCfjaQtfVMm4vh+xDu0jdrV+/rqBueeoscNAJf8wy35+RBMe3JIiDV05rHOeXwfY+41Fs++xmXyZ7clreTSnMFL/J5ZVp47F8LVqAAA5QspI+yvsbON3A61xxGz+fFZHduZNkDUQqD1E2ikce9SkBjLzANO+fCfCWhvTj5hMXBr5j/6qEJmOjnDCu0+0QaVnFAjfAwwvREfS/8sm7YA0MlO1oatctOFGAgRf7O15a5ep17Z9ssYqw5jwkq58GXVzrxIyZ7PIXBdrk4iqGMl8CvMi2dl72PXCvjBG8fcDje4oUjizHS5wv/7BjeTcoHuUueEHGRwJ6wXyXicbW5XFUw7Q40xmSq8XkegOH3OPqwrx0x86njLAYx8855+HvtZqtr5WVcB/ohC+oB04H1GV162fe81L1KvMQ6ZXfs2T/NzJiDTjV136rP+ubs/qzXji6wUa8AkfPXqB0zBUmp1cw0dusYH70H1OOfpgSYKKc8TL/Bjjb1K/7ogRgmUuQ5ue2O0Zam7i6bdgiJVZjKTXgmDT9P1zaW2drQ+76ZO2TyMUIJasB7McmV/3FMluJ4Doc1r9Gq+OtcbBUbKulNr3g43ImknZKc3nTYaT+7EfqwkZ9t/wpd+xenJ5O73RlhhmP+OIC9d6ebBXzs72sqpdVIxz1b7Jn4n1TdPlt/7tr+5SxcCKYxbN2oKxyCEM9T50oubTxuWQZkt+aC2pgqCdOg0ajChOw/VlxjwPnMwhsaDkYW86dpxPvKhUztrgwIWopJNtSNNRdCjc8RKDQRqW3slOSzTRz2l8+6XoJl3dltuSIHk1YPbk8PD5oaWoRArdCd2wef9aWPcssNNoEG+f8aKXyQjg5bQwdI7w1FHxsu0vg2U2VeSDKoHIVN4QH7YULmBn2SuZvJ+KkNijYvE3VjeQcQt9Ds/z/AQyab2UjlC5ZMjacWNyiMYteNm130iFenYbE2wTTZt4H/UvaUglVwLJbm7uc4mA1ZEfFzVgHS2s2GegX00K0wcza4Klov4P0WTeC9psvNvzDP9Ode0KGZ2CEIfo9Ql9UReYmPgHVgdEl+mcCtms= X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:SE1P216MB1303.KORP216.PROD.OUTLOOK.COM; PTR:; CAT:NONE; SFS:(13230040)(366016)(1800799024)(52116014)(376014)(38350700014); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: xyBoFBtCLm2oVVUQOHXq5jIYryNAwpW5pWjh0eOET11RHP9xkPMKwG43RC3CA8xDjkV4vzJGB6T6ZFlmD6U3anuu+Hy9qfZz1kp3ZjU+dQ2tel+ZXIM6VPKtp5StWi5gxzrC91ekrREZLgbVauIA11C18bNCdsZTVO3w4ST+nhCTWQjBX0fHzrysL81I9ZkW+Lq21+lxxsALwn2j559Fe2Qd0f3xTqLHfD1vVUnLNo47gGZZVla54YZyTyePiXp77rtVLN+BSE4jZIsuFN140J9ErpgI9uQCe/GSMyMLHmg64Q7quP3d8vLraaElP7fmP+8jWgu7X5B/ypiLNfY+Tt6gdwijfaQTbykMjF4Sd1GiSEY23b6SWBNbKxsXmRLDv0Gi4uNSvMXPI+ieF6IbKvocbB2mI7++fSRQwM2uTJ345PW81gsuiubV7ygw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ITudSsLRzjMegyXaSzySiEaRO4UFGVx6RvAncJypKxcYvL9pZdIchaT/rAzNH13WHgEXf4dTioJqJd4d/+unU8axGWdkKUuQCcg== X-OriginatorOrg: chipsnmedia.com X-MS-Exchange-CrossTenant-Network-Message-Id: 8325b71c-2a59-461a-6a0d-08dd02bfdfce X-MS-Exchange-CrossTenant-AuthSource: SE1P216MB1303.KORP216.PROD.OUTLOOK.COM X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 12 Nov 2024 02:15:27.4809 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 4d70c8e9-142b-4389-b7f2-fa8a3c68c467 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: Kef0nEX75XN1MsBlKetopOcRpY/MCrUpYwgDNgMZjBRfrHxt/sl5ViwZZUuojaaGyFAjs/XbtQ7Dkrl/yq+g0hfCMWl7i+/FpAG3z8v03Os= X-MS-Exchange-Transport-CrossTenantHeadersStamped: SE1P216MB2114 521C Wave5 variant does not support 10 bit. When 10 bit support for 515 variant was added, the code which returns an error was removed. While testing 10bit hevc fluster on the 521C hw, timeout happened. Fixes: 143e7ab4d9a0 ("media: chips-media: wave5: support decoding HEVC Main10 profile") Signed-off-by: Jackson.lee Signed-off-by: Nas Chung --- .../platform/chips-media/wave5/wave5-vpu-dec.c | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/drivers/media/platform/chips-media/wave5/wave5-vpu-dec.c b/drivers/media/platform/chips-media/wave5/wave5-vpu-dec.c index 51209700b7e8..09b54374db61 100644 --- a/drivers/media/platform/chips-media/wave5/wave5-vpu-dec.c +++ b/drivers/media/platform/chips-media/wave5/wave5-vpu-dec.c @@ -1406,10 +1406,23 @@ static int wave5_vpu_dec_start_streaming(struct vb2_queue *q, unsigned int count if (ret) goto free_bitstream_vbuf; } else if (q->type == V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE) { + struct dec_initial_info *initial_info = + &inst->codec_info->dec_info.initial_info; + if (inst->state == VPU_INST_STATE_STOP) ret = switch_state(inst, VPU_INST_STATE_INIT_SEQ); if (ret) goto return_buffers; + + if (inst->state == VPU_INST_STATE_INIT_SEQ && + inst->dev->product_code == WAVE521C_CODE) { + if (initial_info->luma_bitdepth != 8) { + dev_info(inst->dev->dev, "%s: no support for %d bit depth", + __func__, initial_info->luma_bitdepth); + ret = -EINVAL; + goto return_buffers; + } + } } pm_runtime_mark_last_busy(inst->dev->dev); pm_runtime_put_autosuspend(inst->dev->dev);