From patchwork Thu May 19 08:43:46 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ming Qian X-Patchwork-Id: 12854678 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id B52DBC433EF for ; Thu, 19 May 2022 08:45:22 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:Message-Id:Date:Subject:Cc :To:From:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References: List-Owner; bh=oQ23DZV44u3D5gaWIhh76Sl3KyaZqtAtoE7HdsaUI8E=; b=pPm2doFZ39ssdJ ktg5mzqVFmv7Dz1FHLx+508fm/Z5CSzWPJxtHPT1snHFSKouXarl3mmJubthTWkSXX7A9auK19NZS RvQubUwP/rHEvM0of0VX2jPhxsg0IwVPfQUNanzcjKLoI4lfMpNAomZgbaX8hT0SVbjDMpnaFCrJc LyJiQg7qPjDUrPVIMiCsjoWGUkCvLXWvz501OypydubLuGpGSJsHh+A6FeiWGoLV4BU4cm/AaOhWl OTX+YnkczIhKSH902Af3O3+ekPZtI7m5Pq0hCyKEnmM3ttDbWtPASwGV88/1DrTkN36qFPnDL/Kn5 zzVwV2A53g+fQHeo01gQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1nrblW-005wKG-8X; Thu, 19 May 2022 08:44:14 +0000 Received: from mail-dbaeur03on20613.outbound.protection.outlook.com ([2a01:111:f400:fe1a::613] helo=EUR03-DBA-obe.outbound.protection.outlook.com) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1nrblR-005wH7-GC for linux-arm-kernel@lists.infradead.org; Thu, 19 May 2022 08:44:11 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=ZTtd2IImCoDev7s5ooJ3mLX2CXQsr17J4zO4NZF4ti8c3gNMf6ZTwOmcRxsupkyLTkFSrlipYjKE5hhhP90d2+s2A676fKAqomUhch+PVqxHy/HE53IpwqOtLnQ2JAcmVPUXwHi/WBy3l+MdvV+5Jgd6BCJj0RqVHPdCPP6eg5w87c4GVxzduGH94r8aJGOqQ1RPFqzStAeFkmLn30ZAxgnSAV5SKvXoCMrPNxGZcy1Stsr6yLPoB3lP5LSUodYP8G+OICSL3xoq8GhCFHOE1M8Vjt9y94Pd2nyur8Aj5f1afNzG0I3cqfb7/c3F1CwQnwXdmE6ANRRq8I66O3LWzQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=iUjaLxzVVdtL+fuLrmbxhQnlpb3XPb7ukNFYwYUJjQg=; b=jelf5yvO2KuNzzWcbIN/RuTuhfhO/RKWhDjaXvOJdZDwHKZ7MEq0VmbLZE+FXaaQFDo8dOru7TaFYEEHTbR+5bHhV6pNu0QTtCnOswZUVR1ocJPTCg+mZ+3fSAoHPThsSkmvm1yqwy2m+jVIzYZyxrHMknOng/Ipc6Z355tYcETpPEXgPLaneX9IJteTr6UVD2wzubJkDb/96wwwt2DPx3eZbEds+sxdX0ki4PAh2VGtdwY+jWsAIX9wDut+wKBS+rtO1TwIvEv5U7yoV4Dr5qeu8e9OAurO5ns8Gb/giYt7XAT4w+XP2+LXVUnRHUggx/dbP4zXzZOfwqoC4x4PLw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=nxp.com; dmarc=pass action=none header.from=nxp.com; dkim=pass header.d=nxp.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nxp.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=iUjaLxzVVdtL+fuLrmbxhQnlpb3XPb7ukNFYwYUJjQg=; b=XqT+GXlVfMZ92QBW001a0ykPY5ONXJ1zDQ6JivAHbrV1MTF4AonuxlRu7lIc/4wBxXmZ9iJmYQS5EVdCCEd7KfV2POWGxPHPLlt7sF//tUQNsjEGX6320oT5S2KHEQw2uhVtRB54IF5TR0SNZ4vRjKrZ2ho+jwVNNF6INeXUIPw= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nxp.com; Received: from AM6PR04MB6341.eurprd04.prod.outlook.com (2603:10a6:20b:d8::14) by DB3PR0402MB3740.eurprd04.prod.outlook.com (2603:10a6:8:e::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5250.18; Thu, 19 May 2022 08:44:04 +0000 Received: from AM6PR04MB6341.eurprd04.prod.outlook.com ([fe80::bc48:7565:c619:62c3]) by AM6PR04MB6341.eurprd04.prod.outlook.com ([fe80::bc48:7565:c619:62c3%7]) with mapi id 15.20.5273.015; Thu, 19 May 2022 08:44:04 +0000 From: Ming Qian To: mchehab@kernel.org, hverkuil-cisco@xs4all.nl Cc: shawnguo@kernel.org, robh+dt@kernel.org, s.hauer@pengutronix.de, kernel@pengutronix.de, festevam@gmail.com, linux-imx@nxp.com, linux-media@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org Subject: [PATCH] media: amphion: vdec check format in enum_fmt Date: Thu, 19 May 2022 16:43:46 +0800 Message-Id: <20220519084346.10538-1-ming.qian@nxp.com> X-Mailer: git-send-email 2.36.1 X-ClientProxiedBy: SG2P153CA0021.APCP153.PROD.OUTLOOK.COM (2603:1096:4:c7::8) To AM6PR04MB6341.eurprd04.prod.outlook.com (2603:10a6:20b:d8::14) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: be8bc8b7-8499-498f-cb8a-08da3973ba84 X-MS-TrafficTypeDiagnostic: DB3PR0402MB3740:EE_ X-Microsoft-Antispam-PRVS: X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: ZqPlS+yZSdqt9SG0HXdgeOm/V8pxK+0IA6bordoI+/QVeLuEkCrnsRrfcEcSQ3ZP1Mw2NYCvwEc+FUSthOxWysJS1FblwBVbirw6+cSIKi98O9ZN9WCQtfu9eZwackK+2CYOBRdoGbh2Z4+YvkzEhRJz+PC5YmrKVTrxhuFjio8QVQTZixVorlaNVEt5fcSFcpWpxmGd8ob+PsW791MdgEGqb2d7rsqGeYjnv9Ehe80t1Oyxg6lUkTfIAGV+aZhxNRTTzfh0D6Y8ASYJK1yrQZAMwuGQXUPqfYEU4rHwHlfiHJu8W/PvVTaFu0j7K62g63Q4bQIkoYVvfIlNfW91nFiqCAz0CDlshsCx7wN4TkkRWxN0buWI6rVCxX37gZz6tWlAQIWoAdFB3yorj0Yy2jr0tnNsgpr8+/oZ23Tx20BFT3VPrCYUiLsefKgKCowOR/nQALyVS0rRspeZb7m0XbyG3s/JDG3xrFFopr+qdNeijq3ECs83YEdy8hoz8fHxquG0EL5Nlu8Qa9Y8pHGOgSNi5JzgpEIEqzAfcRabHRIGq9NM8snbKBBqcgCO9UEetHW5zrKtLcFY6lCtVqtIy7IymWctOU/b7lcCL8MghZkGBsNE6imBlE5/TkKWL28C+rxTLZlVfvrL8vUiOmesuZUoCtlT76txl1iwaN/A7NtPPWlTlhrN/RCU/iPAKa1EsqluElOViIZLc++SDs8E1w== X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:AM6PR04MB6341.eurprd04.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230001)(4636009)(366004)(66946007)(186003)(2616005)(7416002)(38100700002)(26005)(66556008)(52116002)(316002)(508600001)(86362001)(36756003)(8936002)(66476007)(1076003)(6486002)(4326008)(8676002)(5660300002)(2906002)(38350700002)(44832011)(6512007)(83380400001)(6506007)(6666004); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: Q16XCYR8PAMv55IiPc0JyBW1YycKMtfpOdvQ2Q2Q8+9rTI63KpCPh3fb701ENj6pwuw0Rg/GjP++HM9PjQRy14RhxSdiO6fXfKRgpEyX67w3eZv0iYKypr6yz6Q2v3w/6/RNGfy9zKwL9TXz3efYxk5qeMNX2bu+xeX1B4oZIetYiSgSFkHsBPG+GZiwvxKbqYYCFYS+di6wxfwdZppMo9Ics2ljT77HPjbQb3DTB3mI0FFEzsddgjACnEKt4tCRj1uVnRjAAc1kh3FVbnROSUL+0nlRnZ7/9HYdBabFa4pju18HSv5GcCgr5SBZ4Jd+2YS/AlCwzFCvCcK3t9Rz4ptMWx0+vW1rC1nz7JtOoNrISPVpxuuvdcyWbGOf16EKIG7zucKK7X6Y/QxVm+s+iZOkE+hKnM0Y0rtYdyaOU6YvGxUu2QxMCwlni0XeMNy2ZC209mzLR1k6YOx4Yq9q8K2PJURTe4suFujistuqhhkF2C10rNw2zYracx92TQkftNHbgtkv9pO6ygdevjulKHMtemBZpHi9gNqCqbTgZpWFSjME6km0JQsBwi/bZi3NizwMf2DHPNb2ee2uZzQEDWYDc9cHPpeAW+g9k/ilf0mIcP4X63uODeMjDcvQ1hUeLq6Yctvu0/fG+Sd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+hrHaj0w== X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: be8bc8b7-8499-498f-cb8a-08da3973ba84 X-MS-Exchange-CrossTenant-AuthSource: AM6PR04MB6341.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 19 May 2022 08:44:04.2133 (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: EA2dQ1bld+6azlQzqfz9gTRsFL7yQYG2cVlndim5JwtCBafnHdAvlc8N3z+7Qg5MEbhUmIEZcx4lY8vNDaxipQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB3PR0402MB3740 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220519_014409_801794_5263759F X-CRM114-Status: GOOD ( 15.02 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org vdec check the pixel format is supported by vpu, or is it disabled. And don't report it if the result is false Signed-off-by: Ming Qian --- drivers/media/platform/amphion/vpu_malone.c | 16 ++++++++++++++++ drivers/media/platform/amphion/vpu_malone.h | 1 + drivers/media/platform/amphion/vpu_rpc.c | 2 +- 3 files changed, 18 insertions(+), 1 deletion(-) diff --git a/drivers/media/platform/amphion/vpu_malone.c b/drivers/media/platform/amphion/vpu_malone.c index 0930b6ba8c42..ec4cd9db3076 100644 --- a/drivers/media/platform/amphion/vpu_malone.c +++ b/drivers/media/platform/amphion/vpu_malone.c @@ -309,6 +309,7 @@ struct malone_padding_scode { struct malone_fmt_mapping { u32 pixelformat; enum vpu_malone_format malone_format; + u32 is_disabled; }; struct malone_scode_t { @@ -568,6 +569,8 @@ static enum vpu_malone_format vpu_malone_format_remap(u32 pixelformat) u32 i; for (i = 0; i < ARRAY_SIZE(fmt_mappings); i++) { + if (fmt_mappings[i].is_disabled) + continue; if (pixelformat == fmt_mappings[i].pixelformat) return fmt_mappings[i].malone_format; } @@ -575,6 +578,19 @@ static enum vpu_malone_format vpu_malone_format_remap(u32 pixelformat) return MALONE_FMT_NULL; } +bool vpu_malone_check_fmt(enum vpu_core_type type, u32 pixelfmt) +{ + if (!vpu_imx8q_check_fmt(type, pixelfmt)) + return false; + + if (pixelfmt == V4L2_PIX_FMT_NV12M_8L128 || pixelfmt == V4L2_PIX_FMT_NV12M_10BE_8L128) + return true; + if (vpu_malone_format_remap(pixelfmt) == MALONE_FMT_NULL) + return false; + + return true; +} + static void vpu_malone_set_stream_cfg(struct vpu_shared_addr *shared, u32 instance, enum vpu_malone_format malone_format) diff --git a/drivers/media/platform/amphion/vpu_malone.h b/drivers/media/platform/amphion/vpu_malone.h index e5a5cbe9843e..02a9d9530970 100644 --- a/drivers/media/platform/amphion/vpu_malone.h +++ b/drivers/media/platform/amphion/vpu_malone.h @@ -40,5 +40,6 @@ int vpu_malone_pre_cmd(struct vpu_shared_addr *shared, u32 instance); int vpu_malone_post_cmd(struct vpu_shared_addr *shared, u32 instance); int vpu_malone_init_instance(struct vpu_shared_addr *shared, u32 instance); u32 vpu_malone_get_max_instance_count(struct vpu_shared_addr *shared); +bool vpu_malone_check_fmt(enum vpu_core_type type, u32 pixelfmt); #endif diff --git a/drivers/media/platform/amphion/vpu_rpc.c b/drivers/media/platform/amphion/vpu_rpc.c index 18a164766409..676f7da041bd 100644 --- a/drivers/media/platform/amphion/vpu_rpc.c +++ b/drivers/media/platform/amphion/vpu_rpc.c @@ -195,7 +195,7 @@ static struct vpu_iface_ops imx8q_rpc_ops[] = { }, [VPU_CORE_TYPE_DEC] = { .check_codec = vpu_imx8q_check_codec, - .check_fmt = vpu_imx8q_check_fmt, + .check_fmt = vpu_malone_check_fmt, .boot_core = vpu_imx8q_boot_core, .get_power_state = vpu_imx8q_get_power_state, .on_firmware_loaded = vpu_imx8q_on_firmware_loaded,