From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751327AbeCLMdI (ORCPT ); Mon, 12 Mar 2018 08:33:08 -0400 Received: from mail-io0-f182.google.com ([209.85.223.182]:38133 "EHLO mail-io0-f182.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751229AbeCLMdF (ORCPT ); Mon, 12 Mar 2018 08:33:05 -0400 X-Google-Smtp-Source: AG47ELtTXWp/TxJyjSgBKumdEViCw6fmpf55iCzaPgDAjzQAnXbYwB0WyfLoTJy3aM2jCQ4wkBvksA== MIME-Version: 1.0 In-Reply-To: References: <20180220044425.169493-20-acourbot@chromium.org> <1520440654.1092.15.camel@bootlin.com> <6470b45d-e9dc-0a22-febc-cd18ae1092be@gmail.com> <1520842245.1513.5.camel@bootlin.com> From: Alexandre Courbot Date: Mon, 12 Mar 2018 21:32:42 +0900 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [RFCv4,19/21] media: vim2m: add request support To: Tomasz Figa Cc: Paul Kocialkowski , Dmitry Osipenko , Mauro Carvalho Chehab , Hans Verkuil , Laurent Pinchart , Pawel Osciak , Marek Szyprowski , Sakari Ailus , Gustavo Padovan , Linux Media Mailing List , Linux Kernel Mailing List , Maxime Ripard Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Mar 12, 2018 at 5:15 PM, Tomasz Figa wrote: > Hi Paul, Dmitry, > > On Mon, Mar 12, 2018 at 5:10 PM, Paul Kocialkowski > wrote: >> Hi, >> >> On Sun, 2018-03-11 at 22:42 +0300, Dmitry Osipenko wrote: >>> Hello, >>> >>> On 07.03.2018 19:37, Paul Kocialkowski wrote: >>> > Hi, >>> > >>> > First off, I'd like to take the occasion to say thank-you for your >>> > work. >>> > This is a major piece of plumbing that is required for me to add >>> > support >>> > for the Allwinner CedarX VPU hardware in upstream Linux. Other >>> > drivers, >>> > such as tegra-vde (that was recently merged in staging) are also >>> > badly >>> > in need of this API. >>> >>> Certainly it would be good to have a common UAPI. Yet I haven't got my >>> hands on >>> trying to implement the V4L interface for the tegra-vde driver, but >>> I've taken a >>> look at Cedrus driver and for now I've one question: >>> >>> Would it be possible (or maybe already is) to have a single IOCTL that >>> takes input/output buffers with codec parameters, processes the >>> request(s) and returns to userspace when everything is done? Having 5 >>> context switches for a single frame decode (like Cedrus VAAPI driver >>> does) looks like a bit of overhead. >> >> The V4L2 interface exposes ioctls for differents actions and I don't >> think there's a combined ioctl for this. The request API was introduced >> precisely because we need to have consistency between the various ioctls >> needed for each frame. Maybe one single (atomic) ioctl would have worked >> too, but that's apparently not how the V4L2 API was designed. >> >> I don't think there is any particular overhead caused by having n ioctls >> instead of a single one. At least that would be very surprising IMHO. > > Well, there is small syscall overhead, which normally shouldn't be > very painful, although with all the speculative execution hardening, > can't be sure of anything anymore. :) > > Hans and Alex can correct me if I'm wrong, but I believe there is a > more atomic-like API being planned, which would only need one IOCTL to > do everything. However, that would be a more serious change to the > V4L2 interfaces, so should be decoupled from Request API itself. Indeed, we discussed the possibility to setup and submit requests in one syscall, similarly (at least in spirit) to the DRM atomic API. This has only been discussed though, and as a feature to consider *after* the request API is merged for codecs (as the more complex camera use-cases would benefit more from it). As Tomasz mentioned, the overhead of ioctls is somehow negligible compared to the workload of the encoding/decoding itself, although I suppose it can still add up. The main advantage I can see for this is a simpler and less error-prone setup of requests for user-space.