From patchwork Tue Jun 28 02:19:09 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ming Qian X-Patchwork-Id: 12897542 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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 7648AC43334 for ; Tue, 28 Jun 2022 02:19:45 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S243451AbiF1CTn (ORCPT ); Mon, 27 Jun 2022 22:19:43 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59822 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S243441AbiF1CTl (ORCPT ); Mon, 27 Jun 2022 22:19:41 -0400 Received: from EUR04-VI1-obe.outbound.protection.outlook.com (mail-eopbgr80072.outbound.protection.outlook.com [40.107.8.72]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 408D0101E5; Mon, 27 Jun 2022 19:19:40 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Snm2sCYZqxO8Jtb5262BWUxcjXtEgsPEXyuXyv1Sud/ww/Tc5M62uBoTgv98x1Hho4RQrVHzIRMHY9hk22pZCveHXajNrrA/s+N1g+vnNw/Fk3iHSqDa0bkaioGWzzP83P8rjO3xj2bo4RXGY2ilBJUGFWU0OXvSmekI98iAEU8LmPvPDewBYCLmsr/ZgmAGR4qFZSMMxxVSpFXamh/r2DYmXxP5YJapVecxyzq/SGepKjWQFP0iHjyzYJ/Z3F7WTD0DclNsh+PY1bWUP9ES2SwwCRST4jp7ZTctlqkLBi33jwqXc/RztPuv8U6AQeJ8A0vvzrvlAnEsxQLobj/GlQ== 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=Tz0Jmv1n7+1GhJk/NLHSRXGo9ktaddFePgiG5lW7Ils=; b=SbdfONL+bXKsS3T9PyFV/bs8tBtodoVg8uqykiqUBydzBCR9s2jsDYB/wWJvY3KqXFeI7eF7TrfYsujzX0kGFQ03392A+4AVI8qA3Mql0Lw+HjypBxkpuAoD6wCdZqx7LYVBEbfioy1yNWhx/OSnlqTSr83XdGmSC3pxrqE1oeccx2YtcDAFHoDl+eas3NO+577AFq+SWHwtT8mfCKGgiANBDpb58OZGfPhskSad2YJYCYS+UJHG8rFvdtbv/TKVDWWZb+FnzeP6e1/z8VvhBeRGm83klRyfSHHWbO7XvOJW2XgII4P1Xce/pT7O2ZRUhxRK7ZBWN+1IdtCNDUtdCw== 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=Tz0Jmv1n7+1GhJk/NLHSRXGo9ktaddFePgiG5lW7Ils=; b=kPKqa5Qq06kF7I9CZCvajlj7JfbCWeO41OBxILe3v5Twh0IG5ZDES7ZfyUiHyafyMOy6LTyCqJGcnz+Ukodvw61Xelw2WAZl1C4Vu8DkSsis2h8Y59PKf2eS1GnIjHvVBs3iS75S3WSYWiJikNqoic6jxpWQaPRKKdQq6DOagOQ= 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 DBBPR04MB8044.eurprd04.prod.outlook.com (2603:10a6:10:1e5::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5373.18; Tue, 28 Jun 2022 02:19:37 +0000 Received: from AM6PR04MB6341.eurprd04.prod.outlook.com ([fe80::3582:eb2f:9652:d98b]) by AM6PR04MB6341.eurprd04.prod.outlook.com ([fe80::3582:eb2f:9652:d98b%5]) with mapi id 15.20.5373.018; Tue, 28 Jun 2022 02:19:37 +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: videobuf2: add V4L2_BUF_FLAG_CODECCONFIG flag Date: Tue, 28 Jun 2022 10:19:09 +0800 Message-Id: <20220628021909.14620-1-ming.qian@nxp.com> X-Mailer: git-send-email 2.36.1 X-ClientProxiedBy: SI2PR01CA0019.apcprd01.prod.exchangelabs.com (2603:1096:4:192::12) 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: a26b6096-b4de-4d82-15da-08da58aca641 X-MS-TrafficTypeDiagnostic: DBBPR04MB8044:EE_ X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: Dny5i6WifHKEgkrDsgcApwTzReensBXfwoqfu8/Nsu/xwECeyueNgDXtV+BPfk69co4DlWwT1tBDpVxgfgjspplfMDDGcGdFxPBDITFTBOfkQru8TGEhyXrAJH/78LSPGJqBATXJ4VE624+DniAOFmw77cciJBobAvMvRkzx7KtQiU7Z+tIQr2Ypy8HRVgg/11DL7qx4BQfuQMcgURZ8mLu8+uFyIs9G5s+d+ljQeZaNE6SsYSSnSQpH7P5HpC2xNU8zb/uqxnOSnoSJUhn+HUaID3OVJIy4OR/bXt890jMJBhB10LNYDx8tc6FNeh2/vV3WXKyrB3g6FHsuTVFqFVrYeQS0l9ie9/xXNBHegaG3JKdgNgJQAQLBMGh+ibcBp/fk4JctMpIOzWipnp1Qg2TJedBcKtfux16DzguSd/ehs5FuFBn6Xdc7kBw/aCJGXi6Pb9klpxDNYpVV9DT9HxqC2Mj9OXtm80GDsVLL5DQ3FRTlcSjpe4A13j0yszsuodcY/SPtrfnWeX6bc+A3Bev4YEmNQuR+j7x5f/UCmns/3W6GlZ4STO6qZuROeMa/K23MFXsRJ/9VBUsJRZsu3fVPgJQZLsfEbYs05qrH1aUgXn6FZH2EhEEuhIqscLeCLlr8l6+a7Po9nK/H5F+wsDdtSkaHcq5MfdPiIKdp0vmAVeOe00ZDho+j9bPmpb3beaFODPS1mA48WRhzTPD2f6Q+4aTAihRhnRV0976RfKnggZZmX/9Cjr0RNdqv4E4AE3F9ETcyZb9NxDvjsGTGqdJnclpP8SxP2t3h3RMNumk= 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:(13230016)(4636009)(39860400002)(396003)(366004)(346002)(136003)(376002)(5660300002)(44832011)(7416002)(2616005)(316002)(8936002)(478600001)(1076003)(36756003)(41300700001)(83380400001)(186003)(6486002)(66556008)(26005)(86362001)(52116002)(6512007)(6506007)(66946007)(38100700002)(38350700002)(66476007)(4326008)(6666004)(2906002)(8676002);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: O+azeirNoOZDoscVR7ZEBLpXd408syxWVBqOZrdoXY3ZAR7PHxlXiyI3O50MZLqyzofZbj8YCQMKYWB46mxSqOiOPt8rUHwtssPDPkZusntbn8IkCcsiY6ccvvlZ3y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QqbBC8lMUvmZ5PtsMxRrloyXENb+gn7awRp3ZI6UyfbeolExGZAiT759gajqtUpU+XAL5rI1qpIf6AB6J302N4UXpjYehfCWdaoscgkSI9cqCgjQv7T8ZxLR97h4BdLS2S9jxnjZ3CZ8tc7KC0K6AO37G9929z4wsjndb/xh3IaTi9jptmICE+NCSsBnci4NwBLp7VF905XqpzsBnEXKiPql0Qj+Yv3SiCtTrmqSTeBXJFtJzzoAcmRJtdQMbXpoie4ex09zeVVDVNfXv/EJUiyQuYPzjTNmNmRVMx09qmpw0uTqpvOw80a7+myL8u2HkgHDfIUMF76GOwrMj9K1ffdr4nCysXPa1ITPXnIPCkSfWsm1tEWxdlZmMjGynTm4ZETuLEmK+z0 X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: a26b6096-b4de-4d82-15da-08da58aca641 X-MS-Exchange-CrossTenant-AuthSource: AM6PR04MB6341.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 28 Jun 2022 02:19:37.5123 (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: dSRjiBT3qCA/POJN8OlLVYmCdQWZKlkPkNws6+nMUmgM9AJRHp95wjgufh23guUjnEBdUvpsJ/YF7/d/G0VwfA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DBBPR04MB8044 Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org By setting the V4L2_BUF_FLAG_CODECCONFIG flag, user-space should be able to hint decoder the vb2 only contains codec config header, but does not contain any frame data. It's only used for parsing header, and can't be decoded. Current, it's usually used by android. Signed-off-by: Ming Qian Reported-by: kernel test robot --- Documentation/userspace-api/media/v4l/buffer.rst | 9 +++++++++ include/uapi/linux/videodev2.h | 2 ++ 2 files changed, 11 insertions(+) diff --git a/Documentation/userspace-api/media/v4l/buffer.rst b/Documentation/userspace-api/media/v4l/buffer.rst index 4638ec64db00..acdc4556f4f4 100644 --- a/Documentation/userspace-api/media/v4l/buffer.rst +++ b/Documentation/userspace-api/media/v4l/buffer.rst @@ -607,6 +607,15 @@ Buffer Flags the format. Any subsequent call to the :ref:`VIDIOC_DQBUF ` ioctl will not block anymore, but return an ``EPIPE`` error code. + * .. _`V4L2-BUF-FLAG-CODECCONFIG`: + + - ``V4L2_BUF_FLAG_CODECCONFIG`` + - 0x00200000 + - This flag may be set when the buffer only contains codec config + header, but does not contain any frame data. Usually the codec config + header is merged to the next idr frame, with the flag + ``V4L2_BUF_FLAG_KEYFRAME``, but there is still some scenes that will + split the header and queue it separately. * .. _`V4L2-BUF-FLAG-REQUEST-FD`: - ``V4L2_BUF_FLAG_REQUEST_FD`` diff --git a/include/uapi/linux/videodev2.h b/include/uapi/linux/videodev2.h index 5311ac4fde35..8708ef257710 100644 --- a/include/uapi/linux/videodev2.h +++ b/include/uapi/linux/videodev2.h @@ -1131,6 +1131,8 @@ static inline __u64 v4l2_timeval_to_ns(const struct timeval *tv) #define V4L2_BUF_FLAG_TSTAMP_SRC_SOE 0x00010000 /* mem2mem encoder/decoder */ #define V4L2_BUF_FLAG_LAST 0x00100000 +/* Buffer only contains codec header */ +#define V4L2_BUF_FLAG_CODECCONFIG 0x00200000 /* request_fd is valid */ #define V4L2_BUF_FLAG_REQUEST_FD 0x00800000