From patchwork Fri Jan 17 06:19:35 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ming Qian X-Patchwork-Id: 13942904 Received: from EUR05-VI1-obe.outbound.protection.outlook.com (mail-vi1eur05on2041.outbound.protection.outlook.com [40.107.21.41]) (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 0AE341F7586; Fri, 17 Jan 2025 06:20:25 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.21.41 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1737094828; cv=fail; b=HRb9I/hvoJFDKuDDYeNofrCPiEAIzXADN9/BvX3Rfgk+aEU9fKPKz9x64oK/DZFGhxEDf4pOcK4XrpIAR6l3GxKRDDU1kJjLg7COrpTxpluNMswVzVDqlIKMykMEwjeg9rmjG2xm2x2VK7z3JesoQ6Kd7F+XrlpBo8yB9GriBTk= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1737094828; c=relaxed/simple; bh=7zTdu4qCEhdKHq9n/rhoFraoqyzSoCaasNT8O7quTWY=; h=From:To:Cc:Subject:Date:Message-ID:Content-Type:MIME-Version; b=D98o9cHzvkCmW5uFciW7X3YYXo+f21xUyRvBTBmwHwpHlMbNP9gsn6y0v8q3aM5b6trTVW2Ii0n4e3Z3z9mI6vMdsFzsYzmrp4OReMIAHuFrzqiCZypJGb2ruxwVOoVEFlItPo1U7IJ3xQ54xj5GQYecDIIq5BYc5os8fx5pCk0= ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=oss.nxp.com; spf=pass smtp.mailfrom=oss.nxp.com; dkim=pass (2048-bit key) header.d=NXP1.onmicrosoft.com header.i=@NXP1.onmicrosoft.com header.b=U22YWuxy; arc=fail smtp.client-ip=40.107.21.41 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=oss.nxp.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=oss.nxp.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=NXP1.onmicrosoft.com header.i=@NXP1.onmicrosoft.com header.b="U22YWuxy" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=Huc5v9TzqnCcYapIFKlACqOUWZAdw/HLsuYiIYROKdI6voIWkAdGmeUxH7pCOyZWTLvb/U9tN6nq9m1HnD3pKaBZ0J6vjVytscKc7UELsGMtqRn/YpXhuEz9Q7KwCWB3BHMmGVp2dC7sx03hi4sAxota35TPkJoomLQ5m6mCa9UBvRkvN0S0iQ5K1/wgHX0zW4nfJySkrojUvlI7GE2KK+GJwM6Jc4ITyoO3gfnL7qk7duFhmjh+GTwvro+xuWCPBGy2rwk4mNj9TpOFeU15BzWLGPNS+XBfumySp5kNG5e++wlmnHIEVeTTo3Ltpj9aNVdDiu0rOd0o4WCjp8pNkw== 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=bquDV/bmUAb9pFD/nbqifxv3X/8ei8IhgKKoVYCEd7A=; b=G8dX7kQuJc2GgdzvTuJNLY9p0QJREgs7pOuCuFEfynwyc2YV9INiAVN/Xn4PTbxQeoxQ5lv5Q/QGqiLauaoK9+k2H9s3oo2ajwMDMfbxt5wyHMPdBWjspnh9meNWFCnuCDcHwHCTX0YEStYLx6WnJbPRt/nzLGWOlAL0lYQm8NaglHR8HRRYGtzxFbX4CMRHE7+G2gWse2XSjE+YVoroocnhjBPzbkBcNKcLZHOKBsjTWCQZT+UE0WhtNz8TMIVT36PTNEfUNPiHHt8nxUos1J9OO7BabBB5hG6CH46so7YzIeFF1Fo8UHSCd48+Dsr5DoSaGoP/Wg8agjDYQMDM2Q== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=oss.nxp.com; dmarc=pass action=none header.from=oss.nxp.com; dkim=pass header.d=oss.nxp.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=NXP1.onmicrosoft.com; s=selector1-NXP1-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=bquDV/bmUAb9pFD/nbqifxv3X/8ei8IhgKKoVYCEd7A=; b=U22YWuxyJ/mKN2OxkmRqIleUTdA4J/50Mt5mr+x5jaY0AnZvoEXwWq0OrH7g/AiUpmQdrltWDh5zcaH0V4JhzBs51iZQ2QTQgaw1/dmqjACMtBX0U/68C5VJU5G/NDEnAphsc7+Sr7hv15Eenz9KS8VZN/ZJTUq4Fw1T5t4nM4UYlaq2Vy5bpduE0lLK/3HogkakFJh5urwtHUE/mA48X5G1VjZwTx8c+f6fTspns97ihY3NjD+YHoagroRoJplhWpX0shLIwSMEbdHiH0yIUlI+grlGZse8jK7NQ0wkmiYDbLMzed1YEdrGBqlT363KyaN2IoCaPyU9jtRC+p84tw== Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=oss.nxp.com; Received: from PAXPR04MB8254.eurprd04.prod.outlook.com (2603:10a6:102:1cd::24) by AS8PR04MB8053.eurprd04.prod.outlook.com (2603:10a6:20b:2ad::12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8356.16; Fri, 17 Jan 2025 06:20:22 +0000 Received: from PAXPR04MB8254.eurprd04.prod.outlook.com ([fe80::2755:55ac:5d6f:4f87]) by PAXPR04MB8254.eurprd04.prod.outlook.com ([fe80::2755:55ac:5d6f:4f87%6]) with mapi id 15.20.8356.014; Fri, 17 Jan 2025 06:20:22 +0000 From: Ming Qian To: mchehab@kernel.org, hverkuil-cisco@xs4all.nl Cc: nicolas@ndufresne.ca, shawnguo@kernel.org, robh+dt@kernel.org, s.hauer@pengutronix.de, kernel@pengutronix.de, festevam@gmail.com, linux-imx@nxp.com, xiahong.bao@nxp.com, eagle.zhou@nxp.com, tao.jiang_2@nxp.com, ming.qian@oss.nxp.com, imx@lists.linux.dev, linux-media@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org Subject: [PATCH v2 1/4] media: v4l: dev-decoder: Add source change V4L2_EVENT_SRC_CH_COLORSPACE Date: Fri, 17 Jan 2025 15:19:35 +0900 Message-ID: <20250117061938.3923516-1-ming.qian@oss.nxp.com> X-Mailer: git-send-email 2.43.0-rc1 X-ClientProxiedBy: SI2PR01CA0034.apcprd01.prod.exchangelabs.com (2603:1096:4:192::9) To PAXPR04MB8254.eurprd04.prod.outlook.com (2603:10a6:102:1cd::24) Precedence: bulk X-Mailing-List: linux-media@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: PAXPR04MB8254:EE_|AS8PR04MB8053:EE_ X-MS-Office365-Filtering-Correlation-Id: cdcd5b1e-aaf7-415b-31ad-08dd36bf05f9 X-MS-Exchange-SharedMailbox-RoutingAgent-Processed: True X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|376014|7416014|52116014|1800799024|366016|38350700014; X-Microsoft-Antispam-Message-Info: MC9XYCgVfWV/mFR7rbxJdfdFfhH4u4XyUEvCdz6eWzi1wz7rMOlmsNAfaDXqmdFFt/3ZoO5ZZQNbYvcilwXZyI/T+JwEIIfWff3B5Pv4wad7p37fJ6ho187qGelJmZTC8lW8hVIDuASPd5QQis278+NcHD39yZyDg/mdvz93CLX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PXuxOKM2mV25SMCvfRIfVGHcmTZjqin5JxrmmNIDEelpaM/iuqjS/7KvbsMvwfOsXETcnN+2z/9IP7Ud0Bfw9Hfm2t/iRQRJ0GuFB93xhKNpauO2/Fju6If8bv9iqQ7KjXzCfvBmXlXrsNZqy/1PsyFSwD3rU1Hb8JJgYQ0lzceMkTiPeftElg0jsD+lrETsBrSd+2l0kEAlxK+t3CF6Ls0qzOJvz09 X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:PAXPR04MB8254.eurprd04.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230040)(376014)(7416014)(52116014)(1800799024)(366016)(38350700014);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: FsVUVvlWBPdSuI3tnrRFlZDQkLULAQFLcVFwUw2EpmQKx6x8uxtNbbTYTyNZ6C95ZETYNzAC6wxB1MelVLO/s5WXo8MhhDJeza984d0Mwj9sow5Zl5myPYk2UH6T0zE8PUWuWSmu93s6GxCBJJGtnvPL9BdypsQisBV0ovWItDkUSEwPC/DABku43C0TEnz6ki8w1nEvIOAYGG+lyHOffQa/YisksnOtVIJzdRbVcLDBP0Wuy3v5PfpRkmkGSJK1y/tQDXQYweVqq7dQxuv041BrCSqdcFypTfmOl7xRxbOlKyNxUSjeIesBwn1NWXXnsADNL+lb4rQIA01ai3tfLVRtq3oPk9fNcZZP1UlXOwQRuQvSBCjpEmzMJCROqR8aBl4ooaY5kN6wIs+FzO2dFiI4nk8PnMYiUEwe4f7vzxctpZZL7S68D1cXD6m0Q16cgrKDYApMVVVUKwuf4NojMB6vxeWhjQ5qSWKgADdYJMcKPzitKODmEsDce/PWsEkVS2rNyPAgDLg7yJ4WfaloAWRzGA+xghtWSw5PJX8fbHXNMfWPGqg3tpLwGs0VFD1qTvbWkpE6mPoYoSBz8qtXfZ61veexYIo9KMGXJJrib7e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-AuthSource: PAXPR04MB8254.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 17 Jan 2025 06:20:22.5374 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 686ea1d3-bc2b-4c6f-a92c-d99c5c301635 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: oiV7/4ymi9w+8OiiZb+SsKUc/9KoIQxS4AQYYvV80+X+jpPT79UM4FPducm1jmKSu+5eOFuvplbSMqLoXoETqw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AS8PR04MB8053 Add a new source change V4L2_EVENT_SRC_CH_COLORSPACE that indicates colorspace change in the stream. The change V4L2_EVENT_SRC_CH_RESOLUTION will always affect the allocation, but V4L2_EVENT_SRC_CH_COLORSPACE won't. Signed-off-by: Ming Qian --- Documentation/userspace-api/media/v4l/vidioc-dqevent.rst | 9 +++++++++ .../userspace-api/media/videodev2.h.rst.exceptions | 1 + include/uapi/linux/videodev2.h | 1 + 3 files changed, 11 insertions(+) diff --git a/Documentation/userspace-api/media/v4l/vidioc-dqevent.rst b/Documentation/userspace-api/media/v4l/vidioc-dqevent.rst index 8db103760930..91e6b86c976d 100644 --- a/Documentation/userspace-api/media/v4l/vidioc-dqevent.rst +++ b/Documentation/userspace-api/media/v4l/vidioc-dqevent.rst @@ -369,6 +369,15 @@ call. loss of signal and so restarting streaming I/O is required in order for the hardware to synchronize to the video signal. + * - ``V4L2_EVENT_SRC_CH_COLORSPACE`` + - 0x0002 + - This event gets triggered when a colorsapce change is detected at + an input. This can come from a video decoder. Applications will query + the new colorspace information (if any, the signal may also have been + lost) + + For stateful decoders follow the guidelines in :ref:`decoder`. + Return Value ============ diff --git a/Documentation/userspace-api/media/videodev2.h.rst.exceptions b/Documentation/userspace-api/media/videodev2.h.rst.exceptions index 35d3456cc812..ac47c6d9448b 100644 --- a/Documentation/userspace-api/media/videodev2.h.rst.exceptions +++ b/Documentation/userspace-api/media/videodev2.h.rst.exceptions @@ -526,6 +526,7 @@ replace define V4L2_EVENT_CTRL_CH_RANGE ctrl-changes-flags replace define V4L2_EVENT_CTRL_CH_DIMENSIONS ctrl-changes-flags replace define V4L2_EVENT_SRC_CH_RESOLUTION src-changes-flags +replace define V4L2_EVENT_SRC_CH_COLORSPACE src-changes-flags replace define V4L2_EVENT_MD_FL_HAVE_FRAME_SEQ :c:type:`v4l2_event_motion_det` diff --git a/include/uapi/linux/videodev2.h b/include/uapi/linux/videodev2.h index c8cb2796130f..242242c8e57b 100644 --- a/include/uapi/linux/videodev2.h +++ b/include/uapi/linux/videodev2.h @@ -2559,6 +2559,7 @@ struct v4l2_event_frame_sync { }; #define V4L2_EVENT_SRC_CH_RESOLUTION (1 << 0) +#define V4L2_EVENT_SRC_CH_COLORSPACE (1 << 1) struct v4l2_event_src_change { __u32 changes; From patchwork Fri Jan 17 06:19:36 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ming Qian X-Patchwork-Id: 13942905 Received: from EUR03-VI1-obe.outbound.protection.outlook.com (mail-vi1eur03on2059.outbound.protection.outlook.com [40.107.103.59]) (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 7A26F1F76DD; Fri, 17 Jan 2025 06:20:30 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.103.59 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1737094832; cv=fail; b=mNldNyOl7hEC5jxIUI5j7aVpuX8GCrnKlaJ4JOM38eaFMarbwKj6PYYwqzVd3SOORsr/IWwvFCCLosnifor95hzSwvT2Nueu2gXTR31Wv27LSfrsQT4rpoCC3TaKypCgOQ0AtfY/jOYZK/Xul07FRolA+fDKN30GsvWtvEFnE+E= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1737094832; c=relaxed/simple; bh=xqnaznQPCPvjwv5TdPgOPoC01Ev6EfHQm+N7zwOzsiY=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: Content-Type:MIME-Version; b=F+6e4HztOsF3EUipboIMSZVG3KwrI/tiGUSxmigNMw30BNhsZqc45GtM590qFVq/6aKZHWIrxEi6907JhrBxYji/YmWHz1zRI0rAKljSukzkeStbZqn1vGEgiGtmtWZMFv/uRgFYSFGXkTz/4M7ljaY+TJByj51DoDjFllSHLYo= ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=oss.nxp.com; spf=pass smtp.mailfrom=oss.nxp.com; dkim=pass (2048-bit key) header.d=NXP1.onmicrosoft.com header.i=@NXP1.onmicrosoft.com header.b=YeZRZr+g; arc=fail smtp.client-ip=40.107.103.59 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=oss.nxp.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=oss.nxp.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=NXP1.onmicrosoft.com header.i=@NXP1.onmicrosoft.com header.b="YeZRZr+g" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=d7hdLjjK2sLwiQ0U9rQcyssMrSOsNxNkqq6eqol0kwNyLjQkmAFxZCCkWhqS3KqzuCs76PheoXU2Su7FnnhtEAnL93U8D9rnwlcy2r+oRreiVfBoqgCxeNAbNuXdJpZcDRlQxyz3QGVOyUYgWAIyH421QDN7ot9w3wuPyihDU6bsIc1QGG00C2alm6G2O3gXaI1CcR68Gjflz9H/2WgkingWyvaoUHZU22ZVok12EEFPhxWWFquioCasNaJifaZ7HH3ue5fSpWxgUoGrPIdxt5SRpcnfJHNJguRTQ3JMzKhiwuh4beOUA4+53emcuBnOdC6lkqwq+mNzkFPF4li0Xw== 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=PgpWWcoUPzdfQbVJYlMyUam+CypB6AlNWYM8PMLHarA=; b=TBxGgicb3sIG1cNAWVjFwblA835b6eKh5oAQH9GZ6FKxQbPg1OMnIOcDJVq2BxhRKbJ0un4AYQgJkwj4sObxrQ6eo4xaeyobrQZJTTQ8ZDqVbN2NDQEWUy//6vgNbyck1AqT+P8dvFhphwVvISLi+YFrOyQpRWtTH4kxFMknGys6apjcg4YYsNCB639ppICusDRQGUiKHkVo7RHbdzjAhGgJh2jayRpNTgrGtfmAe2+ltkF19s90I0auB/mQxFepL0JiXJcDajFLeZiHCDarn4T4kZ/aQuUrnE5857g5TXzareIsTOx1ljthSEQEAcSeZ8gAEbb6bA2ZVLMfs4y6qQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=oss.nxp.com; dmarc=pass action=none header.from=oss.nxp.com; dkim=pass header.d=oss.nxp.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=NXP1.onmicrosoft.com; s=selector1-NXP1-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=PgpWWcoUPzdfQbVJYlMyUam+CypB6AlNWYM8PMLHarA=; b=YeZRZr+gdTtae7BN/AWDBNsPTXaAAr/Cn47D+uHIUqc2vIvX+eT29dO062dx4LSxKEhUDhjQyQAumlmNw/a4sy3IG6omW0P4QucLylZ8mieE0azMOA4MqHZaGQTdD98M27pV9X0UoiNB4yPdfSHc2nc3CQv7GmnFnGU0DvSPyOA40zI/Piur0s7KOeGNESU0SkpGUPdhpygRjiOq2hNyTt9SZ1ytpoPu1kdtjl6b0upO/Z5vfCdBwKHAtSmJktKtImjqYFeCNcgHUY/NqcyJAemSU9s8w19yHiQQ+x0wmxXw6xkm83e2j8AM2oKfeZkzX62+g+1dIvYJZ1xDXICL5Q== Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=oss.nxp.com; Received: from PAXPR04MB8254.eurprd04.prod.outlook.com (2603:10a6:102:1cd::24) by AS8PR04MB8053.eurprd04.prod.outlook.com (2603:10a6:20b:2ad::12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8356.16; Fri, 17 Jan 2025 06:20:27 +0000 Received: from PAXPR04MB8254.eurprd04.prod.outlook.com ([fe80::2755:55ac:5d6f:4f87]) by PAXPR04MB8254.eurprd04.prod.outlook.com ([fe80::2755:55ac:5d6f:4f87%6]) with mapi id 15.20.8356.014; Fri, 17 Jan 2025 06:20:27 +0000 From: Ming Qian To: mchehab@kernel.org, hverkuil-cisco@xs4all.nl Cc: nicolas@ndufresne.ca, shawnguo@kernel.org, robh+dt@kernel.org, s.hauer@pengutronix.de, kernel@pengutronix.de, festevam@gmail.com, linux-imx@nxp.com, xiahong.bao@nxp.com, eagle.zhou@nxp.com, tao.jiang_2@nxp.com, ming.qian@oss.nxp.com, imx@lists.linux.dev, linux-media@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org Subject: [PATCH v2 2/4] media: docs: dev-decoder: Trigger dynamic source change for colorspace Date: Fri, 17 Jan 2025 15:19:36 +0900 Message-ID: <20250117061938.3923516-2-ming.qian@oss.nxp.com> X-Mailer: git-send-email 2.43.0-rc1 In-Reply-To: <20250117061938.3923516-1-ming.qian@oss.nxp.com> References: <20250117061938.3923516-1-ming.qian@oss.nxp.com> X-ClientProxiedBy: SI2PR01CA0034.apcprd01.prod.exchangelabs.com (2603:1096:4:192::9) To PAXPR04MB8254.eurprd04.prod.outlook.com (2603:10a6:102:1cd::24) Precedence: bulk X-Mailing-List: linux-media@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: PAXPR04MB8254:EE_|AS8PR04MB8053:EE_ X-MS-Office365-Filtering-Correlation-Id: 33d382d9-e128-4fb7-f46b-08dd36bf08e5 X-MS-Exchange-SharedMailbox-RoutingAgent-Processed: True X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|376014|7416014|52116014|1800799024|366016|38350700014; X-Microsoft-Antispam-Message-Info: WRlqUrgThval9UEF6aadfK3juZjWe2sBA5pBVWHhKh6wGK9gWuWK0Pj7ItpwI3aVUY97P1hn4G9ZhatF/G7tQW7P9H8Cyel5TF6Y94GFVvitmNAHRvMhVItFs5aRQQe6TgAqNmZ81t4giFYpYyjhSLrFJ4H4fXaSZwzy78yXDJKEwmaoVVCscG5NT/jpSqQGNgW14M8+9F3MmpyUIpFxi4KWdQBoNw+iFx+WJCCN8Q1I2U9CzW+9NJutv0esjtV2/5gUW/3bHY1+q5GgGAyQUILcCB8rygTZEK1pVdireQ9oXNCxcptSaoYaY/eRPPflkYMU/AEpmIXf7wdXvwsoLzhE4E6a2c161yJNnSqy+5owncDnHRM5fvx6zc2eEH7IuPut9XyzFfkT7FVuPtLPCpZjxpuh/GNs8g5Iuwl/TLIGSzi5jPWRHc4hULhCdN0B/Wrt3w+7YO0l1dKylgnvQF25dLwSEGPmFQFWwZ1oMnryRacwW+t1JwvLafhIYZl8nl8U+wFYXiKgoq+LJEHtjcn0rb3eVwSe8my616jg3nMZ/Tj0RnE5Q446R+dN1aMJ74mzUZUSrORm22CTM21xbRaW+KgnzdwDcvZH2dyiL/Fgqo8wFd7m+GtPuZ7+FHwRgoNND03O7OR/OwReQ5I3M7VUMYMDRLvef8A9wacya+8ZNtG1RMTmStlzvT+z/M+nTKXHcvza6y84GRWCLuZQNd7vKL2uMoY8nXw/Ry2WWVf4WSW7UAK7p4r5bdklhm4ShBr69G284PTcJA1bSdM4vbKXHPXFHk0dVD56G83TG0di1ewqDFifVfXAvaph5lpeyAF0kvuJnYV9b2+0NvWGiyGj9YLLUOF3QPo1lLn2Dfiab1cFqTm+nTYLcPrOunvLAhXdwddd2oFM0RsBbcMDvAdZXxpWUKW1N2ClPsXFL699lcRhqKhrL3z0A5KijJ8uUFESptS/Nb3cr4UnRy50q0Q87V31UAU/j22m+gYBLA7L3hr6K3ySqMBGfhMwTLo86j58YNE1Vmi5k8Umqx6UCzQrWK5LUtCQhjv50ksC6M+yT3/tWDoy96YagKbR4X2PR38rImvoQNCPBeB7J9cvr4EhEASXQ7bpX3xrUtiPcTlnmmEAXAH8OXUr/RDdBRENgzsqTVwK+3G7PfWES58A0Q04DRLsAESdpc78lGMy+19+5z/fFnVfgUZn7CBcz8bhzgI1PfjKf9pzFpRTjHING5ZmHIqAOmA7ZZ+EsfTqTf2rG5RSIeZbTyPEE4oi3ftdPSBfYEm+ZY2hPP5JqqQMeJDOsP4lbO1KhfFH8NJ1hc+GDzaC9ECgZzK1y6NcpsU5DAL2ERSN5TMVPvWbr0WH63DFXitLBFVR9gq0bYfggdAgUtCc+8VMWEfpOtZ4vJx7q7/03DFSwTpdkPI5iDzdDg/+utsITNJn8M2j2kcSHHQCoRUIQdAsfRXV1Tsl2s4A X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:PAXPR04MB8254.eurprd04.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230040)(376014)(7416014)(52116014)(1800799024)(366016)(38350700014);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: xkE3/eo4yeX+WkSxAtfuG3uz7YjuupdGbBfOIU/wVyiEp8YLcbXom8WH/ItDklYR1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9jLMzChLsjPpNMncbyXmFLp/hi0fdMSXkyocCpMUe3lK+L6yQcWtziy0scXTCDnMgS6PMPx9rPf6ecnv5cRuZETpK7KOJtDnjgh97TxZsGjY7gerJTybUgFWdg8kOMMOzt7srcu/j+S1INGlB2aMqwGHUXNl4IRYhFGBlaUf3HFuw6mlnhIVmdxhjfBad1Y/HVBeRwmpkdRGWanfZEQSJDcJySjw0WX2rQqjncaVT2UBIM9ENTQyl0pa5pyE6jE1SE2NcYh0TOLwkmoQOxwWdq4MkfJj8TkwIrXbHZwVMcSUah+SOnsNOp4wRecMZuj4Wp45m5kWvYleHxI6Kd5jNWv9mFQBflhEqNeOhlnSYbD+Ome0me0czv0FVCZU9lO7VJt1rMQCSaq1jmUTXQSZmgVIbkmfetWouU99+/5zXq0PnN0yv2De8RkhvK+g/VW2Xnf+fveQ2lxMHe X-OriginatorOrg: oss.nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 33d382d9-e128-4fb7-f46b-08dd36bf08e5 X-MS-Exchange-CrossTenant-AuthSource: PAXPR04MB8254.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 17 Jan 2025 06:20:27.4407 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 686ea1d3-bc2b-4c6f-a92c-d99c5c301635 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: w3qRkOubz74WDFBgsoIiWzsEB7pVx/YtnL4GnegT6qtW6yawY+QMZqg7Tpp50iUOSTFWJh4BW2bHD1FqD7EtDQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AS8PR04MB8053 If colorspace changes, the client needs to renegotiate the pipeline, otherwise the decoded frame may not be displayed correctly. When a colorspace change in the stream, the decoder sends a V4L2_EVENT_SOURCE_CHANGE event with changes set to V4L2_EVENT_SRC_CH_COLORSPACE. After client receive this source change event, then client can switch to the correct stream setting. And each frame can be displayed properly. So add colorspace as a trigger parameter for dynamic resolution change. Signed-off-by: Ming Qian --- v2 - Add V4L2_EVENT_SRC_CH_COLORSPACE for colorspace source change event .../userspace-api/media/v4l/dev-decoder.rst | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/Documentation/userspace-api/media/v4l/dev-decoder.rst b/Documentation/userspace-api/media/v4l/dev-decoder.rst index ef8e8cf31f90..51d6da3eea4a 100644 --- a/Documentation/userspace-api/media/v4l/dev-decoder.rst +++ b/Documentation/userspace-api/media/v4l/dev-decoder.rst @@ -784,8 +784,8 @@ before the sequence started. Last of the buffers will have the must check if there is any pending event and: * if a ``V4L2_EVENT_SOURCE_CHANGE`` event with ``changes`` set to - ``V4L2_EVENT_SRC_CH_RESOLUTION`` is pending, the `Dynamic Resolution - Change` sequence needs to be followed, + ``V4L2_EVENT_SRC_CH_RESOLUTION`` or ``V4L2_EVENT_SRC_CH_COLORSPACE`` is pending, + the `Dynamic Resolution Change` sequence needs to be followed, * if a ``V4L2_EVENT_EOS`` event is pending, the `End of Stream` sequence needs to be followed. @@ -932,13 +932,17 @@ reflected by corresponding queries): * the minimum number of buffers needed for decoding, -* bit-depth of the bitstream has been changed. +* bit-depth of the bitstream has been changed, + +* colorspace of the bitstream has been changed. Whenever that happens, the decoder must proceed as follows: 1. After encountering a resolution change in the stream, the decoder sends a ``V4L2_EVENT_SOURCE_CHANGE`` event with ``changes`` set to - ``V4L2_EVENT_SRC_CH_RESOLUTION``. + ``V4L2_EVENT_SRC_CH_RESOLUTION``, or a colorspace change in the stream, the + decoder sends a ``V4L2_EVENT_SOURCE_CHANGE`` event with ``changes`` set to + ``V4L2_EVENT_SRC_CH_COLORSPACE``. .. important:: @@ -946,6 +950,11 @@ Whenever that happens, the decoder must proceed as follows: values applying to the stream after the resolution change, including queue formats, selection rectangles and controls. +.. note:: + A ``V4L2_EVENT_SOURCE_CHANGE`` event with ``changes`` set to + ``V4L2_EVENT_SRC_CH_RESOLUTION`` will affect the allocation, but + ``V4L2_EVENT_SRC_CH_COLORSPACE`` won't. + 2. The decoder will then process and decode all remaining buffers from before the resolution change point. From patchwork Fri Jan 17 06:19:37 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ming Qian X-Patchwork-Id: 13942906 Received: from EUR05-VI1-obe.outbound.protection.outlook.com (mail-vi1eur05on2055.outbound.protection.outlook.com [40.107.21.55]) (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 EBA331F7917; Fri, 17 Jan 2025 06:20:34 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.21.55 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1737094836; cv=fail; b=CHs14SZOx/OGwJRyL6uZKiSe7QB6+a17Vd2Ot/QukGKJ1NOBmTKWH7AB278fywQiVvPCcQo9dtoU28SY0EkniaoumLpan+ijjmoKU03g0HWKrCvSxSWDGu8klr1OscjVoLdXapzn5n4t4e+RChxMSDXishT3jwfSGgfLyBGzlPE= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1737094836; c=relaxed/simple; bh=4nC5XC7apss+mVEZFrkc3s5062uZWZZUVeFUr9CVFyE=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: Content-Type:MIME-Version; b=o+ZEtOzVow/n7yti01WD8h77jPmowvvm+nPTVTDDgCnWRU/r1Zt0RpFc39PMaTI7UCAFloI9S62YgYIqfnW/kwLE39ABSBS0CGgKEXxNDiQkrJfD1GoFuVshL9nxzopssMnmKgFBoKa6Kbv4J3lDNcnfT2VeWl/MV8bmem8Y2rI= ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=oss.nxp.com; spf=pass smtp.mailfrom=oss.nxp.com; dkim=pass (2048-bit key) header.d=NXP1.onmicrosoft.com header.i=@NXP1.onmicrosoft.com header.b=MNcbsd9T; arc=fail smtp.client-ip=40.107.21.55 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=oss.nxp.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=oss.nxp.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=NXP1.onmicrosoft.com header.i=@NXP1.onmicrosoft.com header.b="MNcbsd9T" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=YJBcBiMIynikvVru+3xS33eSyuDPwlyK2A/iWAOeCs/hu2H31FvUCccHEnn7XlBQl+AlQlz2fJPUasSwdwgmRMeC4Rd0WGj6RgVvsr7Zi1JLCAHgFZCH524qu0Od4BJnmhfUkzL+Ihjv6QzGE/enRoR6oMarOAALdW9xIyspDerWHDEUme6zeY0Y4jcaS3BtzELxOS2ZCZRc/ZXFr0Rkf3X9r65V0KrvFSNB7lc5wOSsLpggeppmJPs6e/ev2TDVlnNPXI3vgpkiLrkvEELNhlDxNAH3BZa0FuuuMfHgOtXxAZCPtjdFLQIii1QA5g7aBtN2UYJ4hsA63Kuac5yWFA== 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=pqT49cWEOwL37ri1ItN64lrYXwMnh/FwPmQ5/BC2/GY=; b=Qh/Zzd29aJGsbfiqcS/2A5tCyiqwJPR9CXyv5ZOLkyqnRyAa83p1/+brfPw7mBSZ8qFavK8wRGnvGvcQaDIIevddVjNcVDwSB4H0twit1KH0YKQB9RL+mIQFHsEfAH6ZGH2w1MC9Vkc+dDHjk4cOgxcSWCrCNOIqdCbr8SGHeNoUO3vovq3OTEn5jiPfamhuJ1w5Mi8kNS7wd6pAWXWptspnyUIhTFStPS8UndjF5Y45Lh6+lEK+Yc20t/ANkjZx8na+R12qMvlTV4ivOPabLbmENhiMMdBQt8by0NKwrUrHr5zvBAmPkgjmf5umY4J2IHdbgnJ5gwr8vS6OvjHzSg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=oss.nxp.com; dmarc=pass action=none header.from=oss.nxp.com; dkim=pass header.d=oss.nxp.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=NXP1.onmicrosoft.com; s=selector1-NXP1-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=pqT49cWEOwL37ri1ItN64lrYXwMnh/FwPmQ5/BC2/GY=; b=MNcbsd9TAAzOLzVOY5MADFeohW6+7IkYO3SrqOQxSeRjPn9JoyZy3fJM05O2qP+86EcIQ7JlaV3Io8ERdhJkMmPP500jdZND8mkj9ug3w+i0fF97lkhBv55SCbM9Xp8S6AxEaMaL5UkEQu60F4Gz1JY42KF+QuyWkM1dUohTC1/1LMzAPsMPLZ7JHpFc+2RMiUhW/rNlOIakiXTN/vZ8yJGr2KoTpGnQKe/wBVVezQcjKFya0XdHbSAcH9kWV4vXheQ+k7HaWGovnftOFeBbMc9oYN175evJNKC4b5csBCRz1expZHghnSQdccMvpkuB3oJT0yCElFYdWH+OW0ndFQ== Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=oss.nxp.com; Received: from PAXPR04MB8254.eurprd04.prod.outlook.com (2603:10a6:102:1cd::24) by AS8PR04MB8053.eurprd04.prod.outlook.com (2603:10a6:20b:2ad::12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8356.16; Fri, 17 Jan 2025 06:20:32 +0000 Received: from PAXPR04MB8254.eurprd04.prod.outlook.com ([fe80::2755:55ac:5d6f:4f87]) by PAXPR04MB8254.eurprd04.prod.outlook.com ([fe80::2755:55ac:5d6f:4f87%6]) with mapi id 15.20.8356.014; Fri, 17 Jan 2025 06:20:32 +0000 From: Ming Qian To: mchehab@kernel.org, hverkuil-cisco@xs4all.nl Cc: nicolas@ndufresne.ca, shawnguo@kernel.org, robh+dt@kernel.org, s.hauer@pengutronix.de, kernel@pengutronix.de, festevam@gmail.com, linux-imx@nxp.com, xiahong.bao@nxp.com, eagle.zhou@nxp.com, tao.jiang_2@nxp.com, ming.qian@oss.nxp.com, imx@lists.linux.dev, linux-media@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org Subject: [PATCH v2 3/4] media: amphion: Clear last_buffer_dequeued flag for DEC_CMD_START Date: Fri, 17 Jan 2025 15:19:37 +0900 Message-ID: <20250117061938.3923516-3-ming.qian@oss.nxp.com> X-Mailer: git-send-email 2.43.0-rc1 In-Reply-To: <20250117061938.3923516-1-ming.qian@oss.nxp.com> References: <20250117061938.3923516-1-ming.qian@oss.nxp.com> X-ClientProxiedBy: SI2PR01CA0034.apcprd01.prod.exchangelabs.com (2603:1096:4:192::9) To PAXPR04MB8254.eurprd04.prod.outlook.com (2603:10a6:102:1cd::24) Precedence: bulk X-Mailing-List: linux-media@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: PAXPR04MB8254:EE_|AS8PR04MB8053:EE_ X-MS-Office365-Filtering-Correlation-Id: 3a9a196f-1d33-4b7a-8a47-08dd36bf0bb2 X-MS-Exchange-SharedMailbox-RoutingAgent-Processed: True X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|376014|7416014|52116014|1800799024|366016|38350700014; X-Microsoft-Antispam-Message-Info: yOhTqmcsVQPoRrObXCLg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ckahr7kSC1Z1cmI1DWBSy0iTgIaDkRgFIvCBVavkxA1xHWxyegUtKR/8Te/o0/xxWmTyI5dwgWkEeprLlp2b97VV2tPqEynoAnMtm8HwJS/SpQICVZU3QLpXkenF3O6qKfX0HczMn5vwMGY3+JdrwAAh3hlupn3o5cWbwcUuFcq2RdzD+VQtOUDCmhng+C0PF5PT+BosoSG8Y7+BPpEJriV6htrHROKObUUVQQHPq1EODLlkK4UurbiRZEyRAE1CFHd9Wa7kUJO6DqOIOCE2MExp2ocdeNJzupPZeoAM6JMYmtLwavPfXDyL+CQcxu7CKELqApTUGNZO0MjukHjAAeXSkN7RmPUbOJa01Q1rTRyN4PPLRdOe X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:PAXPR04MB8254.eurprd04.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230040)(376014)(7416014)(52116014)(1800799024)(366016)(38350700014);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: BNBTg7yf9Zo3pAX4xWTxqf7E1usftj9Yn+/ots0elOTXooxaphrXobjhBXmQ9iBSw5ZGabe2jUwOWst+ehASbl4iIZo8Ijf7p2sENDM3yngQmUi0b/A7/WuHnwk5jqwcIFIM9WPy7hnUMw4S5bLxFs1SDAnHhsovnhOMHQ1jiDv2lbGhj014/yLqCyEM3BiW9kcHeAXQNz2DLX7Hz2YnTbhcpdMKDBguNl0IIk934i6ahmZNnTMTK8RNcWsXqeox6VIy/BNSqvKhJBSLUsdfYt8Sqa+npDYNLNVf3MDZyZ59SdNkIbToYv341koR0TSORyFnQNjhEY8wGGPBaBrMscLbF5jaRJsCMaC/VCFHSBBRLd5poWl9dO5o6ma4PqFksZV5e7K+yKSkTVad1VKbGTyQNwoHQwy5SOM2AAbwEakhIAi95tQfpQZcLkqTdvGImQnsXqebP4jw+QPcJsEsOjysKwMflAjR7zd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yz5zEEavRBcMbfu4SbwirmgqAuk3fGxG40RxFrWuG X-OriginatorOrg: oss.nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 3a9a196f-1d33-4b7a-8a47-08dd36bf0bb2 X-MS-Exchange-CrossTenant-AuthSource: PAXPR04MB8254.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 17 Jan 2025 06:20:32.2315 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 686ea1d3-bc2b-4c6f-a92c-d99c5c301635 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: 2E+HVraMRQuycwGOP2cGs0zDJsnilgBoYeKm45YOYOp4bXM9a6V9P7/f42Xk0SSkEiTjhAhge3N8QkBWVU4ITA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AS8PR04MB8053 From: Ming Qian The V4L2_DEC_CMD_START command may be used to handle the dynamic source change, which will triggers an implicit decoder drain. The last_buffer_dequeued flag is set in the implicit decoder drain, so driver need to clear it to continue the following decoding flow. Signed-off-by: Ming Qian --- drivers/media/platform/amphion/vdec.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/media/platform/amphion/vdec.c b/drivers/media/platform/amphion/vdec.c index b752afc6276f..3b848ac2cd0c 100644 --- a/drivers/media/platform/amphion/vdec.c +++ b/drivers/media/platform/amphion/vdec.c @@ -728,6 +728,7 @@ static int vdec_decoder_cmd(struct file *file, void *fh, struct v4l2_decoder_cmd switch (cmd->cmd) { case V4L2_DEC_CMD_START: vdec_cmd_start(inst); + vb2_clear_last_buffer_dequeued(v4l2_m2m_get_dst_vq(inst->fh.m2m_ctx)); break; case V4L2_DEC_CMD_STOP: vdec_cmd_stop(inst); From patchwork Fri Jan 17 06:19:38 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ming Qian X-Patchwork-Id: 13942907 Received: from EUR05-DB8-obe.outbound.protection.outlook.com (mail-db8eur05on2042.outbound.protection.outlook.com [40.107.20.42]) (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 81F9B1F8677; Fri, 17 Jan 2025 06:20:39 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.20.42 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1737094842; cv=fail; b=rOvA6gt3O8bi7NFIdEsn5raF8Gd/NaLcx1DmY/35iNU9p3mSqeedE9mFKKnEOwSiuAX1uruyYUfT9vOcV+KyqSBEcuK8mAB/3c1navBt+NdrrFoIkpWbbPuW+DG4EucGodJY2/LMpFkmauP6zns5H+pZYLUBOq2P9zhZ4Ruj46E= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1737094842; c=relaxed/simple; bh=5Qz7Uq5aQPFp53Tv/hB3WSfrqLpmg8IPHiNM+tjBjyo=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: Content-Type:MIME-Version; b=jukRn3953ZlV4dSzrUsMfEM10JcKMubrzce4OWrPzetTKg+31V2gchY4kkQWytCnRJnQm4xhhvLfKbUiIQM1PN50ZBNbVNd0lQPPUJcRrdrH6tRtv7Tr9QbT9l8FrvPcNy7c8PoxW4xeClwFp2JBKiht374xfLuBkPjvckQ0/jQ= ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=oss.nxp.com; spf=pass smtp.mailfrom=oss.nxp.com; dkim=pass (2048-bit key) header.d=NXP1.onmicrosoft.com header.i=@NXP1.onmicrosoft.com header.b=OYt87qb4; arc=fail smtp.client-ip=40.107.20.42 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=oss.nxp.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=oss.nxp.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=NXP1.onmicrosoft.com header.i=@NXP1.onmicrosoft.com header.b="OYt87qb4" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=VmFWDo0f/HaBjZSBZTuuVc/74Y5p0gZ5aExXqgGSRQ997tISS/c4fDgDTWK2wOTr0QsKr+7LhhglKloGEX5bcSXwk8v/NAxsBEW7+ZKWXcCeVd4yqsVhUWZoBi6pMB5JfgaVszZm+j8MlKtdNL7GScCNbDIik9QxPRN3KLuYqlmwjAqoHDrzqUW+vQ9csR+Cd7p3HP/WzcmUzzJ2FMUmKcEtcHvakmptqhxukqz1Fie411RQiu2yfYH/Y7iQWY6oIptzLhaFDLphcTrMPS6c0QP2Rv3A1SCnIS4LCMO4XX5ZwTWBEvEUiCXtm/gJK0h+JUMArKX+aGI2+cUYC+xJ6A== 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=5jfLRs+kKbGCHafo18mdcRDLnkBBdOhBFl/jQRcVlhM=; b=HS4QJfaTLDOEoMlcDZVDZj5xdusPd5x/OK745bWN2ZMb2luOTu4Kf70gX/9IBeiiBaZMINMs81TK/Uyse8RBmjAVLVdcBXEIs59l+C7gAj0ZcpIM1SLqYHBwhsuvYLe+be4dfsW7TUyp2EbSD9u+JVdhkfgU6P09zh2T7N6gVaal6/12F0wuX7D56WMPVm/HFqbzNaR+TloayZ8Hf2SbfwNpCsQ/AjP6xxSRBBnDixWC45/rTMuIbvayyE7917bKxjFR7TByLFx9tWwb5TrD2yFmtf6zxSg1Fb9cgarfUtxGqxp/5gw4o3QfJUR3pwhrhodgxWRDC3u8VZBxGmhAmA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=oss.nxp.com; dmarc=pass action=none header.from=oss.nxp.com; dkim=pass header.d=oss.nxp.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=NXP1.onmicrosoft.com; s=selector1-NXP1-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=5jfLRs+kKbGCHafo18mdcRDLnkBBdOhBFl/jQRcVlhM=; b=OYt87qb4lId+4d5NbxVgJBxM9mC0lEhqZsfnicfuy2orhbw46YRHPX1lb6ORPYwSFky085NxVe4I/6c8eHtD6ZmzaNMncpW4r5Nn7ZoSf8jOyVQts1Hn9fdwvZZtVlHfSuVPqWWUd9dYNuqM/zH5F3HD7bV4VtamjpRn4LgW6XdUFDH9Bc69GkuZzJ0CT1PjaRy/yzJx0KB/lrpftw+bHjcjofMWZ2yrp6+5iWCTmt+mhsl0Wg8NSmd3v8OzzkHvSlY8xRGfRmYSiBS/EqJM/kGUZ7rTPhHe1KkTaZVOEx2o9nnIr+5Qcm++Bv9bu4YauKEck/wWYFlcxb+PyIeCxw== Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=oss.nxp.com; Received: from PAXPR04MB8254.eurprd04.prod.outlook.com (2603:10a6:102:1cd::24) by AS8PR04MB8053.eurprd04.prod.outlook.com (2603:10a6:20b:2ad::12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8356.16; Fri, 17 Jan 2025 06:20:37 +0000 Received: from PAXPR04MB8254.eurprd04.prod.outlook.com ([fe80::2755:55ac:5d6f:4f87]) by PAXPR04MB8254.eurprd04.prod.outlook.com ([fe80::2755:55ac:5d6f:4f87%6]) with mapi id 15.20.8356.014; Fri, 17 Jan 2025 06:20:37 +0000 From: Ming Qian To: mchehab@kernel.org, hverkuil-cisco@xs4all.nl Cc: nicolas@ndufresne.ca, shawnguo@kernel.org, robh+dt@kernel.org, s.hauer@pengutronix.de, kernel@pengutronix.de, festevam@gmail.com, linux-imx@nxp.com, xiahong.bao@nxp.com, eagle.zhou@nxp.com, tao.jiang_2@nxp.com, ming.qian@oss.nxp.com, imx@lists.linux.dev, linux-media@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org Subject: [PATCH v2 4/4] media: amphion: Trigger source change if colorspace chagned Date: Fri, 17 Jan 2025 15:19:38 +0900 Message-ID: <20250117061938.3923516-4-ming.qian@oss.nxp.com> X-Mailer: git-send-email 2.43.0-rc1 In-Reply-To: <20250117061938.3923516-1-ming.qian@oss.nxp.com> References: <20250117061938.3923516-1-ming.qian@oss.nxp.com> X-ClientProxiedBy: SI2PR01CA0034.apcprd01.prod.exchangelabs.com (2603:1096:4:192::9) To PAXPR04MB8254.eurprd04.prod.outlook.com (2603:10a6:102:1cd::24) Precedence: bulk X-Mailing-List: linux-media@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: PAXPR04MB8254:EE_|AS8PR04MB8053:EE_ X-MS-Office365-Filtering-Correlation-Id: 769ca391-603e-4492-25c2-08dd36bf0e91 X-MS-Exchange-SharedMailbox-RoutingAgent-Processed: True X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|376014|7416014|52116014|1800799024|366016|38350700014; X-Microsoft-Antispam-Message-Info: AdxVMmI09O8XvmPwhvJMXXSlHquINo2DI4IVClvB6HRyj4tQUwunYd5ostppJLuBo4OIEU9PqAIBxiyDmBlRBPWLIKvTjY8VgXBXXiyTwP1MowWDZXb5LCrQ+RyKglJqJyN1AKUHNy9aRQtRLTXUmrnMsQsB4GAJMk2Y+JM3k22mI5LPDs3cahdUfJD3mk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Y7E5n3oPXvqbUF7vODa1IWXEsjm8+x/o2DjGR08Jze1IcFGF0jgv+Dlx1jbPCgQ27mhi3s34QYjSoLKZyJRcFFeegX53zJStzur5GMMFsw4pUwgpraBrf2kC+a4mdqeoREGfFNkkmv2DZLuoYI3eAUGSHjmkXYceGo5YeVrRRvV7t7AVfMxco7N1awvGOAMmpHyrh00IRsvR72S+7Y X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:PAXPR04MB8254.eurprd04.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230040)(376014)(7416014)(52116014)(1800799024)(366016)(38350700014);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: cK8xZngpfAS+QSMZaV5Qkh/+b0As8P9F2zYKGatxZyiRqn4jZFHnBqGIPk/6hx46TEXbyuIGAjHac+2FsP5I4CtnmAYLFByBBdsvI4ZsZYel0Yqif5PfL4Fce3BNeMnhDwm/wS6EeH0RgLOTawb5R1qQqG8Gd2WrTYjByPEaQi98MZe20DwJKeIoFJcy9G+MMEzPNnv/RkCZclutorqX+gQB8Yo/K8XGxCIBKwNOxYezeUyqK8SXxCzI74OT2Wzz5dzKkhhC6rY6l83rn06I/P2sOwp/ew4BKKbwJ+6aAj+Nj3IQ/pQ/Z0eMeLO1QEZpqNKHFPuL4gykIIMGhQ5XdkTpVV6rT+lah9P09Jzld32lXgjwj3AfvCQm0ciaDtnUvFIwr57LHaI/VLuL16pf2IBeo/a630DViuWECoDmkD6clw2s9pr6r7aNIBdqT9hvhtdy3KWFuDyxZmi4wJDGkwvtl30HsHcF18gaRHF1Qmx/gHulAq0Bgyq4tCKaFMfxxIL2gvQj2hPQ+T5H6C3IXztc10MTreHNggEmbAifAYmWHEjC7G+UeEAVoPVI05l2XCMfJLNkzzwl1PcwM3A5JNP2ci5kgfxPWRcdBUG7XiHpZBHZplFvwO0W20mUwSKypHAYPibhjAlNk/OTM2yvbm1yzWwXWipsu8/7mWaC2duRsLbbZpKzIJ+c30JgxUBbSsOFvar0u7bym7Z3JIASsKVFRYCt92FssALYsKXJ+b1cyGlNLyynR+GMNDnmpTKMO4s46MAIOyh5xCziy+lv6E0/x6VCfRSN79FelXFnuf2tyBNzJqRbVM/t4hTht2PImGEn0hvDw0mVOKeqY7JWu/9EXd4COgt8U39BdWpTcjYGC4DgxkIEUFdWIRs4qwVEduE9y/Xlxvby7NX/ZtXev+hpckaQlNwLjP6ktaiHtvoU0YtHzrsC2hFFCSLaYTkB3a72CjZVzyEx3AGvYx/NIDD8pcuTdbl4038O9CCit8HxjhhVAO1KUv633aCGtOSQL16mVfOpPx1MtKrzFNc2coY69G0kOthXePwvs1r0og+lm0EhN0XIy5EwpwRAQ64/KQxkjNhIo1ai0TTi4jVOzju2PyrstX8iYliJ5OxASCeCKIczWQiMde+5WTFoOkZYnf1LMUbB2L/CWvaTdgRRvmdo+BODEK6b5VXycuXyvISqS9NSUL5SL1iAHkykQiWPctBmKJRvlClslFmjyJAfeqpoPJaMQPjiQ2cb5i7cq1uu0PZDVSGL4WITO4fSqBuiGjRYruM/fBlW8GVoNN117/vf5SZdohquzbBYBacx1ekMXiZaWcVIwuZZAD9/YZAhf2NlVLqt00NwiD5uOncZ+zpKG7tanLVPaBGEZ1/9UXuHSbr7/cMYLsq91x9PX9HQ/o/oZgM56LMjMNvxfZmt5UOKeWB+Il+VBkCpoTbPR8GMhoMD8TSekNQ7xJ7P+juNZ/jP8vP11vkiQjqqDx7wqh4nelIM07kqgGlqMbGxO6HEfCWAlxonr8wLc2qsjQccUKqbJWry3v+ZvYFKKqDj9KRz1BosRIvHPNx6fJ60GOTOrPmVnGArouaL/FkXQZAN X-OriginatorOrg: oss.nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 769ca391-603e-4492-25c2-08dd36bf0e91 X-MS-Exchange-CrossTenant-AuthSource: PAXPR04MB8254.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 17 Jan 2025 06:20:37.0151 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 686ea1d3-bc2b-4c6f-a92c-d99c5c301635 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: 2pjn5/LBraNnClm5ieD3tSH7hEMs/6TzjM1cYm2m925/7hJUoXLzRETC2BgPyZ85rDeS2aCiHDo55jISId9qfw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AS8PR04MB8053 From: Ming Qian After encountering a colorspace change in the stream, the decoder sends a V4L2_EVENT_SOURCE_CHANGE event with changes set to V4L2_EVENT_SRC_CH_COLORSPACE. Then the client can handle the colorspace change without any buffer reallocation Signed-off-by: Ming Qian --- drivers/media/platform/amphion/vdec.c | 89 +++++++++++++++-------- drivers/media/platform/amphion/vpu.h | 1 + drivers/media/platform/amphion/vpu_v4l2.c | 7 +- 3 files changed, 63 insertions(+), 34 deletions(-) diff --git a/drivers/media/platform/amphion/vdec.c b/drivers/media/platform/amphion/vdec.c index 3b848ac2cd0c..868a96d29fac 100644 --- a/drivers/media/platform/amphion/vdec.c +++ b/drivers/media/platform/amphion/vdec.c @@ -369,12 +369,16 @@ static void vdec_handle_resolution_change(struct vpu_inst *inst) if (!vdec->source_change) return; + if (inst->changes) { + vpu_notify_source_change(inst); + inst->changes = 0; + } + q = v4l2_m2m_get_dst_vq(inst->fh.m2m_ctx); if (!list_empty(&q->done_list)) return; vdec->source_change--; - vpu_notify_source_change(inst); vpu_set_last_buffer_dequeued(inst, false); } @@ -954,10 +958,11 @@ static void vdec_stop_done(struct vpu_inst *inst) vpu_inst_unlock(inst); } -static bool vdec_check_source_change(struct vpu_inst *inst) +static bool vdec_check_source_change(struct vpu_inst *inst, struct vpu_dec_codec_info *hdr) { struct vdec_t *vdec = inst->priv; const struct vpu_format *sibling; + u32 changes = 0; if (!inst->fh.m2m_ctx) return false; @@ -966,27 +971,41 @@ static bool vdec_check_source_change(struct vpu_inst *inst) return false; sibling = vpu_helper_find_sibling(inst, inst->cap_format.type, inst->cap_format.pixfmt); - if (sibling && vdec->codec_info.pixfmt == sibling->pixfmt) - vdec->codec_info.pixfmt = inst->cap_format.pixfmt; + if (sibling && hdr->pixfmt == sibling->pixfmt) + hdr->pixfmt = inst->cap_format.pixfmt; if (!vb2_is_streaming(v4l2_m2m_get_dst_vq(inst->fh.m2m_ctx))) - return true; - if (inst->cap_format.pixfmt != vdec->codec_info.pixfmt) - return true; - if (inst->cap_format.width != vdec->codec_info.decoded_width) - return true; - if (inst->cap_format.height != vdec->codec_info.decoded_height) - return true; + changes |= V4L2_EVENT_SRC_CH_RESOLUTION; + if (inst->cap_format.pixfmt != hdr->pixfmt) + changes |= V4L2_EVENT_SRC_CH_RESOLUTION; + if (inst->cap_format.width != hdr->decoded_width) + changes |= V4L2_EVENT_SRC_CH_RESOLUTION; + if (inst->cap_format.height != hdr->decoded_height) + changes |= V4L2_EVENT_SRC_CH_RESOLUTION; if (vpu_get_num_buffers(inst, inst->cap_format.type) < inst->min_buffer_cap) + changes |= V4L2_EVENT_SRC_CH_RESOLUTION; + if (inst->crop.left != hdr->offset_x) + changes |= V4L2_EVENT_SRC_CH_RESOLUTION; + if (inst->crop.top != hdr->offset_y) + changes |= V4L2_EVENT_SRC_CH_RESOLUTION; + if (inst->crop.width != hdr->width) + changes |= V4L2_EVENT_SRC_CH_RESOLUTION; + if (inst->crop.height != hdr->height) + changes |= V4L2_EVENT_SRC_CH_RESOLUTION; + if (!hdr->progressive) + changes |= V4L2_EVENT_SRC_CH_RESOLUTION; + + if (vdec->seq_hdr_found && + (hdr->color_primaries != vdec->codec_info.color_primaries || + hdr->transfer_chars != vdec->codec_info.transfer_chars || + hdr->matrix_coeffs != vdec->codec_info.matrix_coeffs || + hdr->full_range != vdec->codec_info.full_range)) + changes |= V4L2_EVENT_SRC_CH_COLORSPACE; + + if (changes) { + inst->changes |= changes; return true; - if (inst->crop.left != vdec->codec_info.offset_x) - return true; - if (inst->crop.top != vdec->codec_info.offset_y) - return true; - if (inst->crop.width != vdec->codec_info.width) - return true; - if (inst->crop.height != vdec->codec_info.height) - return true; + } return false; } @@ -1337,20 +1356,25 @@ static void vdec_event_seq_hdr(struct vpu_inst *inst, struct vpu_dec_codec_info struct vdec_t *vdec = inst->priv; vpu_inst_lock(inst); - memcpy(&vdec->codec_info, hdr, sizeof(vdec->codec_info)); - vpu_trace(inst->dev, "[%d] %d x %d, crop : (%d, %d) %d x %d, %d, %d\n", + vpu_trace(inst->dev, + "[%d] %d x %d, crop : (%d, %d) %d x %d, %d, %d, colorspace: %d, %d, %d, %d\n", inst->id, - vdec->codec_info.decoded_width, - vdec->codec_info.decoded_height, - vdec->codec_info.offset_x, - vdec->codec_info.offset_y, - vdec->codec_info.width, - vdec->codec_info.height, + hdr->decoded_width, + hdr->decoded_height, + hdr->offset_x, + hdr->offset_y, + hdr->width, + hdr->height, hdr->num_ref_frms, - hdr->num_dpb_frms); + hdr->num_dpb_frms, + hdr->color_primaries, + hdr->transfer_chars, + hdr->matrix_coeffs, + hdr->full_range); inst->min_buffer_cap = hdr->num_ref_frms + hdr->num_dpb_frms; - vdec->is_source_changed = vdec_check_source_change(inst); + vdec->is_source_changed = vdec_check_source_change(inst, hdr); + memcpy(&vdec->codec_info, hdr, sizeof(vdec->codec_info)); vdec_init_fmt(inst); vdec_init_crop(inst); vdec_init_mbi(inst); @@ -1379,7 +1403,12 @@ static void vdec_event_resolution_change(struct vpu_inst *inst) { struct vdec_t *vdec = inst->priv; - vpu_trace(inst->dev, "[%d]\n", inst->id); + vpu_trace(inst->dev, "[%d] input : %d, decoded : %d, display : %d, sequence : %d\n", + inst->id, + vdec->params.frame_count, + vdec->decoded_frame_count, + vdec->display_frame_count, + vdec->sequence); vpu_inst_lock(inst); vdec->seq_tag = vdec->codec_info.tag; vdec_clear_fs(&vdec->mbi); diff --git a/drivers/media/platform/amphion/vpu.h b/drivers/media/platform/amphion/vpu.h index 76bfd6b26170..d8100da160d1 100644 --- a/drivers/media/platform/amphion/vpu.h +++ b/drivers/media/platform/amphion/vpu.h @@ -272,6 +272,7 @@ struct vpu_inst { u8 xfer_func; u32 sequence; u32 extra_size; + u32 changes; u32 flows[16]; u32 flow_idx; diff --git a/drivers/media/platform/amphion/vpu_v4l2.c b/drivers/media/platform/amphion/vpu_v4l2.c index 74668fa362e2..37ef706c29dd 100644 --- a/drivers/media/platform/amphion/vpu_v4l2.c +++ b/drivers/media/platform/amphion/vpu_v4l2.c @@ -96,13 +96,12 @@ int vpu_notify_eos(struct vpu_inst *inst) int vpu_notify_source_change(struct vpu_inst *inst) { - static const struct v4l2_event ev = { - .id = 0, + const struct v4l2_event ev = { .type = V4L2_EVENT_SOURCE_CHANGE, - .u.src_change.changes = V4L2_EVENT_SRC_CH_RESOLUTION + .u.src_change.changes = inst->changes }; - vpu_trace(inst->dev, "[%d]\n", inst->id); + vpu_trace(inst->dev, "[%d] source change 0x%x\n", inst->id, inst->changes); v4l2_event_queue_fh(&inst->fh, &ev); return 0; }