From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org [79.124.17.100]) by master.gitmailbox.com (Postfix) with ESMTP id F2AB142323 for ; Mon, 4 Apr 2022 12:14:49 +0000 (UTC) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 8472B68B251; Mon, 4 Apr 2022 15:14:47 +0300 (EEST) Received: from EUR03-AM5-obe.outbound.protection.outlook.com (mail-eopbgr30076.outbound.protection.outlook.com [40.107.3.76]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 10BDF68ACAB for ; Mon, 4 Apr 2022 15:14:41 +0300 (EEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=X6UwDfBEwf4HPMaBkoalCvebQoEPsOxXp1PSD72cet3PHG8J9eoJ7wi2aL9NDSD5chTVGV1JtI49Eo3o4+vhR8rOm/fdpYISqD9nol3qYz+/o/nsKBF1ggja1ltlM7PDGXhyoay8ddtEXAyNBzsgTFSjUQwuM4ZNV6BlYxwZ/kVuZhEluY6trV4mlK5f+CvfvzGbj4J+Iyqfbm4d2+1Sg6sxzj2Mam1ZNjVpCRXAroMdox6kfS7tar2ZCMo0RzRpg9U474I17T5nvTxdfUlzPee9rkN48TpRLv0CGNTOSpenrBZhW8oI21C2izGVGrueefiz2Afn96eLqGBe0zHeew== 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=OVUPkGxRsDxNBmz3oh+p2cCQdzP8dPyoSjiIh9+gjag=; b=ggAjVIxaF0JP/iHBpFQuIwvSQTU+um0lFJ7m/g+EVnfZsYX1OO5BwWE7+4ztkgIqIXewddgK88Cg5N4ZsKdis5AdUbOBxJVoZ/6lol+kR+UdlzQp4Z9B8J+T+UXweaE6bwX1Ype9roqfDpSKvc7hj2Cic9t/adu9JeG4Z064YDK6Hldlx88CQeaQOzBFhIgYPEkuyJxCy0UN6f4yMRm+dDfzWPwRYEfKCAqucYix1KoGX7lPSscXNTpuI7zQhQhrtHz35hahn5CukeHlhJNfmMjucxsDMvCwzpyn6lUT82Z9IO0ggnpcwL4LdjwQMYSHjOgUFzk2qHu0q/rPyCrvSg== 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=OVUPkGxRsDxNBmz3oh+p2cCQdzP8dPyoSjiIh9+gjag=; b=X88aOgSLE+QMBr/NN3KyLpFlvKyt+SDcRl0JLjrk3McEVms7J7EhWKgMmhnCYFXOaB9AlkujfgBcd1vYttSUBg1CU918IYaOE+8jzh7zWrIX4x05j6Yjj1R2bCb9/CWheR0MmOX6cRbsNK16P3RmGt5kgV1voG9HPNYa8BNu3EM= Received: from AM6PR04MB6341.eurprd04.prod.outlook.com (2603:10a6:20b:d8::14) by DB3PR0402MB3723.eurprd04.prod.outlook.com (2603:10a6:8:10::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5123.31; Mon, 4 Apr 2022 12:14:38 +0000 Received: from AM6PR04MB6341.eurprd04.prod.outlook.com ([fe80::6881:df46:ac23:1bc3]) by AM6PR04MB6341.eurprd04.prod.outlook.com ([fe80::6881:df46:ac23:1bc3%7]) with mapi id 15.20.5123.031; Mon, 4 Apr 2022 12:14:38 +0000 From: Ming Qian To: Andriy Gelman Thread-Topic: [FFmpeg-devel] [EXT] [PATCH v5 7/7] avcodec/v4l2_m2m_dec: setup capture queue before enqueue the first frame Thread-Index: AQHYQSgmOmqMxYmBBUyFNpBgKQDarKzV1yrQgAj7DQCAAOYqgA== Date: Mon, 4 Apr 2022 12:14:37 +0000 Message-ID: References: <20220104090836.31660-1-ming.qian@nxp.com> <20220104090836.31660-7-ming.qian@nxp.com> <20220326154245.oy4usrr2fvymk2xx@jackie> <20220403222922.ae5dxqaz3mt25myd@jackie> In-Reply-To: <20220403222922.ae5dxqaz3mt25myd@jackie> Accept-Language: zh-CN, en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nxp.com; x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: acf3bb59-5aac-48c2-5325-08da1634b078 x-ms-traffictypediagnostic: DB3PR0402MB3723: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: R+HdSj+yjTeZ66Oou5MH2PSgaX4BOniGPYH7urYNrfLdNLwpKPXeb8wTVDruo45yqpGGwr0rGxw3VsMFiIU3ufiU4swYP9U/GFSOEow4O9Xd3LLsAM9gpxCVSwohYMIdvtm6uOTH0WrFNgpXJ2cJIUzsPbwDZWrD9YL6cX6LoqDe3zaLLwJY2+t7VTVgUdCD8XhVkkZIpwP5D7dO33QawuPmIrBSVvNSlDVY0m50Bn8S62ypYnT0DiHjr6zQi/sqWnW3tIxf2ZsWH93FFlTTKqWo1tcOfJhbKviRdZi4GoCKaTgXs2JNpP6P1sYe7hEdEOpQtqpC7vXRKebZ7yGynnYiBQwNMt2t3w/jYUef0R92rcPuyeYb12i1Jwi/HdiLnSwlICIIODxSg8yEypiowAyUb5SKSJCekWCyLRQ6EF7kfpwX3PpeVoJJBbBoUtBuBVu6pghl6qQJfV5tYaFTjwYXS4tHNZirX3BRWQqGH1bp50rPevPxBpLsk7oyAbjRnnUHg09eZ3JA8C0E/0EQ1jaHzTjUs7P1lZ/qpxCenq5cBFmD7kXHSVC2yyqsYp+Jdkxl4ZfCK82NDxE0etZ8lLjclUa9FHEaCTHICuGQZ8SNKPDUArjROdPHorkvflGZYVpzowebqFHcC7xQR2GUpT8fayUR1mGPkx3RYrj1wVb0DLWfA19PH8sCAAbTwTDDJECanBbfa6Uufe7nouBGPDuJn+uWXcxwv+epNKll/Ld5PO+jVsIex/kY9ClrOSfcq/VtbYY0x8v3P/QIL/4KJTL/HFNXsy1LyiPCzOyZRP8LRrVX55Q2XDpz40gQ9cLA 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)(508600001)(4326008)(5660300002)(66476007)(66556008)(66946007)(7696005)(8676002)(64756008)(66446008)(45080400002)(33656002)(52536014)(44832011)(6506007)(38100700002)(9686003)(76116006)(53546011)(2906002)(8936002)(122000001)(83380400001)(186003)(26005)(316002)(6916009)(55016003)(38070700005)(71200400001)(86362001)(966005)(70780200001); DIR:OUT; SFP:1101; x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?us-ascii?Q?d9RG9yMjfH0ldmrbpnY2U6NM5wAyDgkHe2TOTwuHQrQj9XSYdbMrHUpro+AW?= =?us-ascii?Q?ZsTzyNWScIIfzasIz3tnPAVQaQvUoLXs6cpiDKpHhuSxMJcoW1rn8iglI14o?= =?us-ascii?Q?GmwjS35MXq1GVNdm8yv/jhlV8MhB8bzSZWL82VD0ayYeH1MvJgDH6Orwmrp9?= =?us-ascii?Q?UNNwR9PLRqG/pqMHH3nFrnGoycdM3A6czXGy4SwoJZY+2PIdO3Sxd0Tu1zqH?= =?us-ascii?Q?6egmkIAPnM9XaOpXamtjpQbq3mb/dBIiYSTt4pj40a5fguJ6zdzXinU7xf1s?= =?us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JPzF7mfLCO3c?= =?us-ascii?Q?zugNCzPFUkBEeR/g8+hBx5r7UrbW4z7TuMcv/CANcLAjaFUgXzUJb5wHNoIY?= =?us-ascii?Q?UkxPmJaxA1faqHpGiWe92kkgskQj4FigqPBQfOgrk7A1lS5JcpBXx4ll1yWy?= =?us-ascii?Q?qul6H9EeoHdjJyF50HcaKEVI7SCGgU9tGC5DZgU4vYTRvEWgwpf/t47RcHBU?= =?us-ascii?Q?toeZzd4XxIHG5YLiXC8Xj2+UQrqyze5nCODcGkj6oske9WzH8CTum+A+2ylW?= =?us-ascii?Q?OQBSDG+Dj2fjmcP2KAh3hOLd5PYCQkYsDeUr+uH4TCUVq2375gYKzpqU7Ae7?= =?us-ascii?Q?iSV9MWvKQyHWMzyUAdSWLmwt/A3BwxpbNbDEiF1eBoJiZWNCuRYPLWhf3NnZ?= =?us-ascii?Q?TEdG8a1zXeujKj/Vr8iGPxr0UaZuXaJdF0qEcWHclmJOW7f1ip0vMuF7XwhR?= =?us-ascii?Q?X0/N1bRM4cHiGcP4GAXHo1JYuiB0FFvS46759RrxUf9dg0cyFzekKlq4+i+E?= =?us-ascii?Q?Si29wbPud1SEY4GX/8Bo2CKQKvcCDLyXXrJDyCGJmOgYIRJZ?= MIME-Version: 1.0 X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-AuthSource: AM6PR04MB6341.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: acf3bb59-5aac-48c2-5325-08da1634b078 X-MS-Exchange-CrossTenant-originalarrivaltime: 04 Apr 2022 12:14:38.0195 (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: KIyhTq8KbZrzSIq1HCNs2BK9x0rD0UXk2jAFH6VlWXBvH3jFOS7o4VFJY7p2rYdysZ0PjTuV27r1qLXLchEHNg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB3PR0402MB3723 Subject: Re: [FFmpeg-devel] [EXT] [PATCH v5 7/7] avcodec/v4l2_m2m_dec: setup capture queue before enqueue the first frame X-BeenThere: ffmpeg-devel@ffmpeg.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: FFmpeg development discussions and patches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: FFmpeg development discussions and patches Cc: FFmpeg development discussions and patches Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" Archived-At: List-Archive: List-Post: > From: Andriy Gelman > Sent: Monday, April 4, 2022 6:29 AM > To: Ming Qian > Cc: FFmpeg development discussions and patches devel@ffmpeg.org> > Subject: Re: [FFmpeg-devel] [EXT] [PATCH v5 7/7] avcodec/v4l2_m2m_dec: > setup capture queue before enqueue the first frame > > Caution: EXT Email > > Hi Ming, > > Sorry for the late reply. > > On Tue, 29. Mar 06:51, Ming Qian wrote: > > > From: Andriy Gelman [mailto:andriy.gelman@gmail.com] > > > Sent: Saturday, March 26, 2022 11:43 PM > > > To: FFmpeg development discussions and patches > > > > > > Cc: Ming Qian > > > Subject: Re: [FFmpeg-devel] [EXT] [PATCH v5 7/7] > avcodec/v4l2_m2m_dec: > > > setup capture queue before enqueue the first frame > > > > > > Caution: EXT Email > > > > > > Hi Ming, > > > > > > On Mon, 21. Mar 07:27, Ming Qian wrote: > > > > Hi Andriy, > > > > > > > > What do you think of this patch? > > > > > > > > The Initialization flow defined in > > > linux/Documentation/userspace-api/media/v4l/dev-decoder.rst > > > > 1. Set the coded format on OUTPUT via VIDIOC_S_FMT(). > > > > 2. Allocate source (bytestream) buffers via VIDIOC_REQBUFS() on > OUTPUT. > > > > 3. Start streaming on the OUTPUT queue via VIDIOC_STREAMON(). > > > > 4. This step only applies to coded formats that contain resolution > > > information in the stream. Continue queuing/dequeuing bytestream > > > buffers to/from the OUTPUT queue via VIDIOC_QBUF() and > > > VIDIOC_DQBUF(). The buffers will be processed and returned to the > > > client in order, until required metadata to configure the CAPTURE > > > queue are found. This is indicated by the decoder sending a > > > V4L2_EVENT_SOURCE_CHANGE event with changes set to > V4L2_EVENT_SRC_CH_RESOLUTION. > > > > Note: A client capable of acquiring stream parameters from > > > > the > > > bytestream on its own may attempt to set the width and height of the > > > OUTPUT format to non-zero values matching the coded size of the > > > stream, skip this step and continue with the Capture Setup sequence. > > > > > > > > 5. Continue with the Capture Setup sequence. > > > > > > > > In ffmpeg's implementation, ffmpeg will set non-zero width and > > > > height > > > on output queue, so the step 4 should be skipped, and setup the > > > capture queue directly. > > > > So the flow should be: > > > > 1. Set the coded format and valid resolution on OUTPUT via > VIDIOC_S_FMT(). > > > > 2. Allocate source (bytestream) buffers via VIDIOC_REQBUFS() on > OUTPUT. > > > > 3. Start streaming on the OUTPUT queue via VIDIOC_STREAMON(). > > > > 5. Continue with the Capture Setup sequence. > > > > > > > > And this patch is just following the above flow. > > > > > > > > Ming > > > > > > The v4 version didn't work for me on odroid xu4 > > > > https://eur01.safelinks.protection.outlook.com/?url=http%3A%2F%2Fffm > > > > peg.o%2F&data=04%7C01%7Cming.qian%40nxp.com%7Cfa858e4a13434 > ee727 > > > > 3508da15c1695b%7C686ea1d3bc2b4c6fa92cd99c5c301635%7C0%7C1%7C6378 > 4621 > > > > 7684591813%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIj > oiV2luM > > > > zIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000&sdata=wl%2BZaEBNIPZ > TOyv > > > 7dgmnHhSQyAs37PjZCkvhwPL%2B6xg%3D&reserved=0 > > > rg%2Fpipermail%2Fffmpeg-devel%2F2022- > January%2F290679.html&dat > > > > a=04%7C01%7Cming.qian%40nxp.com%7Cca988d592253473cbac408da0f3f4 > > > 801%7C686ea1d3bc2b4c6fa92cd99c5c301635%7C0%7C0%7C637839061704 > > > > 093567%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2 > l > > > > uMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000&sdata=I80bpE70S6JI > > > 8A%2BaXQGq4JyxL0eBbtLN58p5SpqlA6s%3D&reserved=0 > > > > > > I haven't had time retest but don't think anything has changed. > > > > > > -- > > > Andriy > > > > Hi Andriy, > > I check the S5P MFC Video Codec driver, and indeed it requires the client > enqueue the output buffer which contains the sequence header. And in > vidioc_g_fmt(), driver will block and wait until the header is parsed. > > And indeed my patch will not work on it. > > But it seems don't meet the specification. > > For S5P MFC, the step 4 can't be skipped, and the client should wait the > V4L2_EVENT_SOURCE_CHANGE event before the step 5 setting up capture > queue. > > The ffmpeg v4l2 decoder don't skip step 4, but also doesn't wait the > V4L2_EVENT_SOURCE_CHANGE event. > > > > > So in current, we should make it work on more devices instead of more > spec? > > Personally I'd prefer not to break users. Odroid xu4 is a popular board afaik. > But I'm also not the maintainer of v4l2m2m. > > IMO it would be better the fix the problem in the driver first. > Hi Andriy, Thanks for your reply. Maybe I can try to work on the driver first. Ming. > > > > The Initialization flow defined in linux/Documentation/userspace- > api/media/v4l/dev-decoder.rst > > 1. Set the coded format on OUTPUT via VIDIOC_S_FMT(). > > 2. Allocate source (bytestream) buffers via VIDIOC_REQBUFS() on > OUTPUT. > > 3. Start streaming on the OUTPUT queue via VIDIOC_STREAMON(). > > 4. This step only applies to coded formats that contain resolution > information in the stream. Continue queuing/dequeuing bytestream buffers > to/from the OUTPUT queue via VIDIOC_QBUF() and VIDIOC_DQBUF(). The > buffers will be processed and returned to the client in order, until required > metadata to configure the CAPTURE queue are found. This is indicated by the > decoder sending a V4L2_EVENT_SOURCE_CHANGE event with changes set > to V4L2_EVENT_SRC_CH_RESOLUTION. > > Note: A client capable of acquiring stream parameters from the > bytestream on its own may attempt to set the width and height of the > OUTPUT format to non-zero values matching the coded size of the stream, > skip this step and continue with the Capture Setup sequence. > > 5. Continue with the Capture Setup sequence. > > > -- > Andriy _______________________________________________ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".