Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp46674imu; Thu, 24 Jan 2019 19:28:31 -0800 (PST) X-Google-Smtp-Source: ALg8bN7JQqwLd6H10v2T0ud7GipTxku8Hz1Yf6EDNV3PZeN9TrZ6oW05fwYpwj1ZPrcpAcMfO7fj X-Received: by 2002:a62:345:: with SMTP id 66mr9199400pfd.189.1548386911606; Thu, 24 Jan 2019 19:28:31 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1548386911; cv=none; d=google.com; s=arc-20160816; b=sz3cuKj6XSDDdL8odEh6SBeL64SpxinDChlOozrKwl6nKdTUfQYnbH19jesj2XpDlH Sh36NWTzpJ5fx86/2i8eJmUm3rOYo1UCme8ebY9cSrprn0BFEqPvEvJF9q5JpYzksYp9 +c97zqzNRqX5g0EbZ1ANzZb03qzjqKfsdPeqjuyFynztYlB672kW2az0td8cmbax0ZuR kSZiLLasLUeEpDDfh/syJJcwYlFsiPRvfErEk9+gKCGSzz4VwJYuNOYlEepRR36np7rO lGWUOkr/wpHZHmmFH6Jiq2dwfUXwGMdGyuiITbdUhVNjpWu5J+i+sIadTKLyyF9iGJz5 moZQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:cc:to:subject :message-id:date:from:in-reply-to:references:mime-version :dkim-signature; bh=Qsc9q74JTnTMEkINAi3mNMqG0l7CnnnP36GPHL0KDdc=; b=J8sLfndNqsVlKTec2saB8LLaVXiv7hG8fXEaX+DbFJNiVcZ2n8/e0jb7/9mfWMmn9E t/F9YA8YKksvjwDdYhDH79NExyYcjWopEeeDHaS/n0PRdyX/gnP1cfmJTCiF/griNsqr 9cOhnkL5nEpP/IKHR7M4CaS3VsZCnaXqGUOKKI8TUrSkWv2r/N88XLh/cdXNwQ3fmuHL X3u82R/r/A2iwPG2wuUAmpGtEHSwv6j08ZCOi7fvPWsYQOB9LNB1FDPNQ4RWsb8yalEI fJhXAxUMAtfUYFO3vfUYkswNIMKoZZYm1RqW/vUsWFirYtFr/MlrRTRoxS4PvesaIjoY FQyg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=duzGE7In; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id i5si23021889pfo.189.2019.01.24.19.28.14; Thu, 24 Jan 2019 19:28:31 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=duzGE7In; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728048AbfAYD2J (ORCPT + 99 others); Thu, 24 Jan 2019 22:28:09 -0500 Received: from mail-oi1-f193.google.com ([209.85.167.193]:46194 "EHLO mail-oi1-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726259AbfAYD2J (ORCPT ); Thu, 24 Jan 2019 22:28:09 -0500 Received: by mail-oi1-f193.google.com with SMTP id x202so6675575oif.13 for ; Thu, 24 Jan 2019 19:28:08 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc:content-transfer-encoding; bh=Qsc9q74JTnTMEkINAi3mNMqG0l7CnnnP36GPHL0KDdc=; b=duzGE7InW77eiL4+Ivtvk9p+lwQMfuLk51gKZbkiVA8qByrVANKQl/jcSouC2pKQoZ T116IehUsIYmRfXDdriXTMD/iQGZSfkncUA4HPNw1WpY9GSGgyj39/wKwFY6MNm4xZ4l Lv9Zl0/3XdM5CsAAxJfB+S6pc9vtgkeBKk77s= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc:content-transfer-encoding; bh=Qsc9q74JTnTMEkINAi3mNMqG0l7CnnnP36GPHL0KDdc=; b=rBu/58ZlAmeXUmpb0xkJMrUIMmeA4J0qIngn8/IWS0RU5le1rGc+Blb/E4pMdlZwB2 frdnMTmtyUu6jhaOu5hGEbRUReKao/kVJ0pdE/igHOzL9VuQY4nTSgDpYyhKM1tqs0ns AAR4MsKPclCmlsp8NQCND+QqMBNNcTV9jiVnx9YXFkiY7s+b93OoQuDke9zLr487Juzp OWm5pCNyh8vstsSaY6jWQQ4EUA/p6tjP4oicsdUOTlnliCiG42QSa5bCBq7srCgWv/pp WLp/cfRFAULp2JHxsTdy0Tf9t4H5ID9VB1ivZZyAeDOz9p36I6c05F2OqT9Omld12Oq4 QNbg== X-Gm-Message-State: AJcUuke3V8DrbnDUz2cSNkq1qga6lDWL1ea2jkxcWziYFT4B7sodrNVA iPygg9LdKJVdAf6CGAmiJPMyK3V+r6H92w== X-Received: by 2002:aca:2ccc:: with SMTP id s195mr252959ois.282.1548386887653; Thu, 24 Jan 2019 19:28:07 -0800 (PST) Received: from mail-oi1-f173.google.com (mail-oi1-f173.google.com. [209.85.167.173]) by smtp.gmail.com with ESMTPSA id c132sm768758oia.41.2019.01.24.19.28.05 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 24 Jan 2019 19:28:06 -0800 (PST) Received: by mail-oi1-f173.google.com with SMTP id u18so6685534oie.10 for ; Thu, 24 Jan 2019 19:28:05 -0800 (PST) X-Received: by 2002:aca:4586:: with SMTP id s128mr256649oia.182.1548386884807; Thu, 24 Jan 2019 19:28:04 -0800 (PST) MIME-Version: 1.0 References: <20181022144901.113852-1-tfiga@chromium.org> <20181022144901.113852-2-tfiga@chromium.org> <9b7c1385-d482-6e92-2222-2daa835dbc91@xs4all.nl> <3ea3bf5bf9904ce877142c41f595207752172d27.camel@ndufresne.ca> In-Reply-To: <3ea3bf5bf9904ce877142c41f595207752172d27.camel@ndufresne.ca> From: Tomasz Figa Date: Fri, 25 Jan 2019 12:27:52 +0900 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH v2 1/2] media: docs-rst: Document memory-to-memory video decoder interface To: Nicolas Dufresne Cc: Hans Verkuil , Linux Media Mailing List , Linux Kernel Mailing List , Mauro Carvalho Chehab , Pawel Osciak , Alexandre Courbot , Kamil Debski , Andrzej Hajda , Kyungmin Park , Jeongtae Park , Philipp Zabel , =?UTF-8?B?VGlmZmFueSBMaW4gKOael+aFp+ePiik=?= , =?UTF-8?B?QW5kcmV3LUNUIENoZW4gKOmZs+aZuui/qik=?= , Stanimir Varbanov , Todor Tomov , Paul Kocialkowski , Laurent Pinchart , dave.stevenson@raspberrypi.org, Ezequiel Garcia , Maxime Jourdan Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Jan 25, 2019 at 4:55 AM Nicolas Dufresne wro= te: > > Le jeudi 24 janvier 2019 =C3=A0 18:06 +0900, Tomasz Figa a =C3=A9crit : > > > Actually I just realized the last point might not even be achievable > > > for some of the decoders (s5p-mfc, mtk-vcodec), as they don't report > > > which frame originates from which bitstream buffer and the driver jus= t > > > picks the most recently consumed OUTPUT buffer to copy the timestamp > > > from. (s5p-mfc actually "forgets" to set the timestamp in some cases > > > too...) > > > > > > I need to think a bit more about this. > > > > Actually I misread the code. Both s5p-mfc and mtk-vcodec seem to > > correctly match the buffers. > > Ok good, since otherwise it would have been a regression in MFC driver. > This timestamp passing thing could in theory be made optional though, > it lives under some COPY_TIMESTAMP kind of flag. What that means though > is that a driver without such a capability would need to signal dropped > frames using some other mean. > > In userspace, the main use is to match the produced frame against a > userspace specific list of frames. At least this seems to be the case > in Gst and Chromium, since the userspace list contains a superset of > the metadata found in the v4l2_buffer. > > Now, using the produced timestamp, userspace can deduce frame that the > driver should have produced but didn't (could be a deadline case codec, > or simply the frames where corrupted). It's quite normal for a codec to > just keep parsing until it finally find something it can decode. > > That's at least one way to do it, but there is other possible > mechanism. The sequence number could be used, or even producing buffers > with the ERROR flag set. What matters is just to give userspace a way > to clear these frames, which would simply grow userspace memory usage > over time. Is it just me or we were missing some consistent error handling then? I feel like the drivers should definitely return the bitstream buffers with the ERROR flag, if there is a decode failure of data in the buffer. Still, that could become more complicated if there is more than 1 frame in that piece of bitstream, but only 1 frame is corrupted (or whatever). Another case is when the bitstream, even if corrupted, is still enough to produce some output. My intuition tells me that such CAPTURE buffer should be then returned with the ERROR flag. That wouldn't still be enough for any more sophisticated userspace error concealment, but could still let the userspace know to perhaps drop the frame. Best regards, Tomasz