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: 13871654 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/yJ8gAEO8NSrqXQ31hRO1AAWu5ePOEH9OUSFfazD7Rme+2GtcJu0jo+3W7IOaL6TAw9jTp1b1kekgwJim2c6ttcuQzQz2+dDoR6STvVFJJpiucfqor027dI0q1DD0z8y4rzg80LWobnrUlPIkgnj5eEhebhDhoqfUffIlW4Cd3SF3EjnMGpI2F8bgbeEJ9yntu0FNU8i3NeOpbxvWEjAoQ31RQZ8UAArfCxUIOxNBlVWAZSeB441lsN7xwUQPVc7bgZQESXRfjSIFbpAwIG8ytiWGbeGb5wHL81/aN2mtXJwsUIQ6nvfMxMQt7w3EK5VB9jiZaQ+6nTxQiL3jn/thEKOpTpqawAwuBR/20GHD2trPDMHov5qjIOhYEhBYUqL+oPAdzAWPDdmGNBzNVnwf5X/cR8j8/V5m+puCZ03jXFcN7CcFd1bSXoEXEqEvp2H/ZVPx5dVBqboutjU0/nekLdjmigmXfWfqLir1FCa4/zZI9zV7KvPkO9KcAHnrHzeRrQqXJbzgG7ycfbZECjXu8MkWB2yS7z5aojPvKiFIlCNFhlCbZ+Lx12T0KM0z1UNnfIqNjSJt2c5zAGNH1/iVXHTxl08p2LC3tinmvTPCFdqwsB/7cVJGcRMNl84gYXT5nyRXrGxj2snIMwvOtCWdfo7WAmSjcAcX6hDos70zP6FwQOyrNjzf3YzIIbY2b9mZVq+182GYGIqSll93ogY2RTVZqaVS5hJSpxhGpBNdlF5TFRl/9FjtM56l2+CrgZSZlNsvZ7SdFx5Qdphe8dqZBNCc6lPgxPDKUDJhho9I3c9/LB0Xl192jVfcfbfWaXsQKvcf/8BVELSEmHpDV41DXJwgCuFNq1l1qALC7e4jSGO9QIxshCFr409biUD8byaot9YC96S4HHAzzhuCt/+h6zv6hzHWefa4TqLn1SQov5YN74PfX3hcPwx2tQabNkzjuNkCXCCFNpwWWhok24Yarf+wd3VmGmYfH/ArLe5x4Li90RVyZmXNVdZ6y67RG+BQo= 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: 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);