From patchwork Tue Mar 12 10:58:50 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexander Gordeev X-Patchwork-Id: 19683 Return-Path: X-Original-To: parsemail@patchwork.libcamera.org Delivered-To: parsemail@patchwork.libcamera.org Received: from lancelot.ideasonboard.com (lancelot.ideasonboard.com [92.243.16.209]) by patchwork.libcamera.org (Postfix) with ESMTPS id 7321BBD1F1 for ; Tue, 12 Mar 2024 11:29:02 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 1783962C80; Tue, 12 Mar 2024 12:29:02 +0100 (CET) Authentication-Results: lancelot.ideasonboard.com; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=opensynergy.com header.i=@opensynergy.com header.b="gdZEmqKd"; dkim-atps=neutral Received: from repost01.tmes.trendmicro.eu (repost01.tmes.trendmicro.eu [18.185.115.27]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 7AA606286C for ; Tue, 12 Mar 2024 11:59:51 +0100 (CET) Received: from 104.47.11.169_.trendmicro.com (unknown [172.21.162.72]) by repost01.tmes.trendmicro.eu (Postfix) with SMTP id 1D5FE10000E3F; Tue, 12 Mar 2024 10:59:51 +0000 (UTC) X-TM-MAIL-RECEIVED-TIME: 1710241188.095000 X-TM-MAIL-UUID: da981b40-d838-41ac-96e1-632cc07132b4 Received: from DEU01-FR2-obe.outbound.protection.outlook.com (unknown [104.47.11.169]) by repre01.tmes.trendmicro.eu (Trend Micro Email Security) with ESMTPS id 177DD10002BAC; Tue, 12 Mar 2024 10:59:48 +0000 (UTC) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=d2uP+sGQB5MBhxrx/zulgxPwtiEWXaCD1QDMO8xRUqJxgKeFpCkz6555c4Fl1TXre/I9SbouUpDP2jhlL2gXEtWVz/kPhz0tB1XDhkhCIUIk+hnxgPcu26eaGgEm4GIoHXatOwGPR+pDwKuEi9Qs627EY+kjC7uOIF0QvZNMZ5P8tgs6EKuLbmfuYwu7sK7isQSFvqfDOR/EpuS73DozZ2TGEOOsl93GP2stKcPNd0nT+I77W0lX9ppgDHLvopEz9isZ1osryvKyUzIW8YywGfqOtJlHU/qnp597LyxbLnehUZgaSkKB5eETInmEofBYBri+/KHXet4fO0WTS91AgQ== 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=lFzgbUIdZz6uNcbyByJ82Rc8jbhZER0oBBcJ17XRJuw=; b=TjZ1ZP/Y3YNoxDfjEginXzPVTy7V4PvLcWbSS+wfvuh6cQV57ONcBsL7JAvywIHslNboOsady/HZvadxR6QeFUx/yGKnAfJhmLrYAfR5Js+pgnBJdoeKRldsgJ/zr7D+QlN6cZtuivnbIV627AA5Fd2oKjkoZhbO3xIq3ldHPSCcQsm82V4ejLopPKFRztlq1vytgeqFWHNJ/31quj8TvfQffsrAycpkFbhkuGxxXAagANSEYO2WMobabSH/CXJWC6Ie3O/ZikjFWEppXbxcIP+g/spKJ6KqG1XD7iJCSb8/nRQX6Lvy0n9TebG1UMTZG4/mFjX8W+UmvuUFlNg+CA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 217.66.60.4) smtp.rcpttodomain=chromium.org smtp.mailfrom=opensynergy.com; dmarc=pass (p=reject sp=reject pct=100) action=none header.from=opensynergy.com; dkim=none (message not signed); arc=none (0) X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 217.66.60.4) smtp.mailfrom=opensynergy.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=opensynergy.com; Received-SPF: Pass (protection.outlook.com: domain of opensynergy.com designates 217.66.60.4 as permitted sender) receiver=protection.outlook.com; client-ip=217.66.60.4; helo=SR-MAIL-03.open-synergy.com; pr=C From: Alexander Gordeev To: virtio-comment@lists.oasis-open.org Subject: [RFC PATCH v9 0/1] Virtio video device specification Date: Tue, 12 Mar 2024 11:58:50 +0100 Message-Id: <20240312105851.243780-1-alexander.gordeev@opensynergy.com> X-Mailer: git-send-email 2.40.1 MIME-Version: 1.0 X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: AM3PEPF0000A798:EE_|BEYP281MB3812:EE_ X-MS-Office365-Filtering-Correlation-Id: da3edb60-2f49-4793-d02c-08dc42838775 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: P4OC/rYxyOvmbLbDuYY0SLjN86qoQrCRbxU5baTDFzR2SUGdTA6LevWih1/4A4ntkBmUrhYBiDdNKXcI24kgWH70foQW0FDdx2z3ltJpWXBCJoTVRfMZCWfNnc19SX5XVzItwCc2/Ithmh/3XoFZpSKbngfJep9wBEkM/U7HmTVB4fBOfeQjVB+ubyGTpdQTXSZQYvO5nrvLs24zZGy9+pYsM07uzI9Et2kcCQv5KzsyVRVff0pmugh9MG+I062P8xSdaAJAR3mbLXOPS8dKoxE0cSD+7wb7S65LZ+8NcDre7aeY6enUCV+6u5iA2ODpUvAKHB5SFBysbXLQidgKiCGWMMQT8X+cAki5XMvswroHbC/rt86DC7c4g+0yl5tpXsjZu12TNqA+hTCqM0J+WeDbClSKdFwzGQYWnotAZ/93kCfk10E7EetoQFNKADiP00dzD05dwHAwei3Mo5YpWIIkTbSgJfeSj9fzElS7b7nMo1PrQ0/YBOq40Zr8Spw2PLzi2fE2gj2CEaDN3arcMYjqfmemhCwjOOijFtlCKvpT6E7PP9TH7MhlUvHaLd92ae3PVYOPdeXXpE0dl1XJIWxOFtTelr5b5QQm7zBSe/OsWikshbDMhpLF28I2wjmgQu+A7CRgaK07GU++1mwYTqv7S3T/JZVDYJcPdxIRwrOeXStDcAKfwPJl3ALvskUBcbX5wmBaJkxwT+toHqPP/g== X-Forefront-Antispam-Report: CIP:217.66.60.4; CTRY:DE; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:SR-MAIL-03.open-synergy.com; PTR:InfoDomainNonexistent; CAT:NONE; SFS:(13230031)(1800799015)(7416005)(376005)(82310400014)(36860700004); DIR:OUT; SFP:1102; X-OriginatorOrg: opensynergy.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 12 Mar 2024 10:59:45.9936 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: da3edb60-2f49-4793-d02c-08dc42838775 X-MS-Exchange-CrossTenant-Id: 800fae25-9b1b-4edc-993d-c939c4e84a64 X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=800fae25-9b1b-4edc-993d-c939c4e84a64; Ip=[217.66.60.4]; Helo=[SR-MAIL-03.open-synergy.com] X-MS-Exchange-CrossTenant-AuthSource: AM3PEPF0000A798.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: BEYP281MB3812 X-TM-AS-ERS: 104.47.11.169-0.0.0.0 X-TMASE-Version: StarCloud-1.3-9.1.1015-28246.006 X-TMASE-Result: 10--17.288200-4.000000 X-TMASE-MatchedRID: KlGK0EfpKrtKqT77NMMyNxZu3Ax5Ngq859KGlOljPvuQEjOZZEyhAras XTFkoEYAhYNEGrSdk3jcBYoN9IgCH+7cQoOH30eiquZVB+P8J0YAf7GEWnsTRGSVHUW5n9Lh9NF KrIIXgXyHl7GO9ptPH77GcxyzvMofQlotKdXOGlGK7q7iyFn58ee6+kao1dvdkvRBElnsHbOIV9 dyzzz/jqyFqPcqKs/nN5KkjJKvdUstHkTd8If/QVhkmCjWYvWlusBvtbk1teAugFBQy+58BQZIL dGsDavCr3RRr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fD86+yQ+bTIANU mc77W0cppOnjY0p6EiaELgm/XjS6g5ibZpwzHsAxSixsw4AQIItsSErCDI2NKia98iGr4aTGiWk lDKHh/TPl5EPsOL/3NHXRYFSbFjYDVpnLRGZUr7n9840BI81CLmgPDZE+TB4bC5RVyXBwbTw1vz ERQA== X-TM-Addin-ProductCode: EMS DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=opensynergy.com; s=TM-DKIM-20210503141657; t=1710241191; bh=vxxP2+iaKewLGClE3Fzeah/djsRIX/5doINiMRwSrgI=; l=4690; h=From:To:Date; b=gdZEmqKdprTyhWZxCrZeQrFiOq8paJ66xAdZQrkAZ90Ji/dpgDHR7aCN2c7QhJpxu dGp4vVZMQ7Mg5A3ltKCZMsRgsNYsdjIFp+cBqBG6qtgDgWnQAxuh4Tt/4gk21vIODx Ebx115D64SXkW0o3ydmgNZuCWnEOYV+E3qv4jQhCaM/54CIB43POetieZkeVSw2aXJ OjYF5mljx1ZUb44jqKT/lR8VzfPzNRlN9EMrbeNCmvRzdTNvX8jibIv5f0gnrvboTa XyxTsB89n9hbsy3P0d9nLzlgaBT6ttMdle1fZFZddcNwWdkMVBkjDXgike9pRGz47+ wjY4Uw91Jmlyg== X-Mailman-Approved-At: Tue, 12 Mar 2024 12:29:00 +0100 X-BeenThere: libcamera-devel@lists.libcamera.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Albert Esteve , hmazur@google.com, "Michael S . Tsirkin" , Daniel Almeida , Marcin Wojtas , Andrii Cherniavskyi , libcamera-devel@lists.libcamera.org, bgrzesik@google.com, Andrew Gazizov , Enric Balletbo i Serra , Gustavo Padovan , Keiichi Watanabe , zyta@google.com, linux-media@vger.kernel.org, Alexander Gordeev , alex.bennee@linaro.org, mikrawczyk@google.com, Matti.Moell@opensynergy.com, Alexandre Courbot , Cornelia Huck , bag@semihalf.com, srosek@google.com, Nicolas Dufresne , Enrico Granata Errors-To: libcamera-devel-bounces@lists.libcamera.org Sender: "libcamera-devel" Hi, This is the 9th version of virtio-video device patch. Hopefully it is the last RFC version. There are some major changes and now I think it is good enough conceptually, but may need a few minor changes, when the driver gets updated. Sorry, it took way longer, than I expected. There are a lot of details to care about and also a lot of distractions. Please review. Changelog v8 -> v9: 1. Chenged representation of device capabilities/parameters to Type-Length-Value (TLV). TLV representation is already used in the kernel, see [1][2]. It is mentioned in the virtio sound device specification. It is also compatible with struct v4l2_ext_control, that is used to set V4L2 controls in batches. Here I'm trying to extend the approach onto many other things: device capabilities, formats, buffers/resources, crop settings. This way it is possible to get all the device capabilities in one call, then set all the parameters/controls in one call. For us this is important due to significant hypercall delays. I hope this might be applicable in the V4L2 core as well in the future, so I'm very interested in comments from linux-media community. 2. Changed back the representation of capabilities to pre v7 model. Video decoders and encoders are basically converters between multidimensional shapes of all supported encoded formats and all supported raw formats. This was roughly the way the capabilities were represented in v1-v6 (excluding the controls), then in v7 and v8 I tried to do it closer to the V4L2 discovery process. Now I think this was a mistake, the previously used method may look more complex, but it fits better. This approach is similar to the way the capabilities are described in gstreamer (they don't seem to have explicit links between the sets though). 3. Replaced the internal device's per stream resource queues with virtqueues. The idea briefly: we had to avoid blocking the descriptors for a long time, so I implemented delayed responses in v8. Then there is no natural limit for the number of elements in the resource queues anymore. What to do if the queue becomes full? So there are a bunch of things to define in the spec. I decided to replace these queues with virtqueues, because the virtqueues are already defined well enough. There are of course some upsides and downsides. I think upsides are overwhelming and I'd be happy to discuss this if anyone is interested. 4. Renamed commandq to mainq since commands can be queued to per stream queues as well. 5. Renamed STREAM_CREATE -> STREAM_OPEN, STREAM_DESTROY -> STREAM_CLOSE. Now the per stream virtqueues are opened rather than created. 6. Enabled RESET on the output queue too. I didn't know how to handle a VIDIOC_STREAMOFF on the capture queue coming from guest user-space otherwise. 7. Merged ATTACH_BACKING command into SET_PARAMS. I felt, that it really belongs to the parameters alongside the num_resources, it allows the driver to see if the resources are detached after a SET_PARAMS or not, also might be helpful during debugging. Still there is an issue: SG lists can be quite large. If it is large and the results are returned on the eventq, then this significantly increases the eventq's descriptor sizes. Avoided this by adding a requirement for the device to cap the TLV length to 8. 8. Added DRM format modifiers. 9. Added FWHT codec. 10. Addressed review comments. 11. The spec size went down from 24 pages to 19 pages. Full PDF: https://drive.google.com/file/d/1gj-kOBp1uvCB5IzrtOTjf-zunP3f-EFq/view?usp=sharing PDF with the video section only: https://drive.google.com/file/d/1fH8XaSYkwkb2beB9thS7FOvFysUM22Q5/view?usp=sharing Please note, that external links are broken in the short version. [1] https://docs.kernel.org/userspace-api/netlink/intro.html?highlight=tlv [2] https://docs.kernel.org/sound/kernel-api/writing-an-alsa-driver.html?highlight=tlv [3] https://lore.kernel.org/linux-media/20230922100303.GF19112@pendragon.ideasonboard.com/ Alexander Gordeev (1): virtio-video: Add virtio video device specification conformance.tex | 4 + content.tex | 1 + device-types/video/description.tex | 1607 +++++++++++++++++++++ device-types/video/device-conformance.tex | 22 + device-types/video/driver-conformance.tex | 20 + introduction.tex | 21 + 6 files changed, 1675 insertions(+) create mode 100644 device-types/video/description.tex create mode 100644 device-types/video/device-conformance.tex create mode 100644 device-types/video/driver-conformance.tex