Received: by 2002:a25:4158:0:0:0:0:0 with SMTP id o85csp347197yba; Thu, 16 May 2019 01:39:44 -0700 (PDT) X-Google-Smtp-Source: APXvYqyV9AAUWtzOSI6aHP/UgxnqwWh1Bdek6XjGTlf9+96ZBS31gNm+sgdOgwaS/bedcjfPSayh X-Received: by 2002:a63:42:: with SMTP id 63mr49283674pga.337.1557995984428; Thu, 16 May 2019 01:39:44 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1557995984; cv=none; d=google.com; s=arc-20160816; b=uwwN+IjsIQiP/gw7j9KPOg5CyIOZue5SUrFPNo5INlhacUCYxGtEPJDQS/1myUqk/H l10uZBOS2HmxeYZl9MAhFOXnQ9NpF1y5BIL02XGhZ67LKR4dOmOb3AEUYcmxVq/pQ6p8 uAKNfXPpYsiA8W4poJvAdpc7a4K3HYHryyXLIJyljZkHI1RpNTub604BCOunJ1n8qOti 3zBs0ff4ih8bkjyKT3KUFopDSWlYwnTF6G5FjPAsk+D26mqEf/2q0/5KpHQrlvjhksIV 5+JtijFYNQVFaHj8Z+Pa2DtIAF3FYtxaVMRp6xm52iTs8WOtiOKB1rqkWvCnvxcpU/9c Kd4g== 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:mime-version :organization:references:in-reply-to:message-id:subject:cc:to:from :date; bh=dUCmEYC6L5nVVTaNnISULizQW4UspM8aRec9M6URkqo=; b=YOd4h2MECcUlkH6jIT2/R/Kl4jYby1IQxRYbQKV/V3FGz9O/d1vDS4U4mMcNfV9Qam I9Z/Y3HKyfL+5HaVMl5acHTi5OjNmeVcmngZ01s17Zu5yr2O0R53oYrglcW9DMu/4VPQ aElQiWKQ0W2QGr4j8mfMGjA3ioq5itGHJDELZE1OAdGvdsdEPRle/kHrNTAlcduobsZg hOmdSWoAjdFHBh0mmcV7PzNOT2UPEUBUl431eIyZ4XvHPLMPdYuCGTGOBflNucO921cf VNnvx4eiiyNdqS60Q2Ut61UAuZGFpTTnaBL0XvrIU4R5fX/NTPUY7uU1ezdg1hUeDRYD m0WQ== ARC-Authentication-Results: i=1; mx.google.com; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id d186si4166459pga.484.2019.05.16.01.39.29; Thu, 16 May 2019 01:39:44 -0700 (PDT) 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; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726739AbfEPIhX (ORCPT + 99 others); Thu, 16 May 2019 04:37:23 -0400 Received: from metis.ext.pengutronix.de ([85.220.165.71]:47111 "EHLO metis.ext.pengutronix.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726537AbfEPIhW (ORCPT ); Thu, 16 May 2019 04:37:22 -0400 Received: from litschi.hi.pengutronix.de ([2001:67c:670:100:feaa:14ff:fe6a:8db5]) by metis.ext.pengutronix.de with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.89) (envelope-from ) id 1hRBtA-0003B4-8Q; Thu, 16 May 2019 10:37:20 +0200 Date: Thu, 16 May 2019 10:37:15 +0200 From: Michael Tretter To: Tomasz Figa Cc: linux-media@vger.kernel.org, linux-kernel@vger.kernel.org, Hans Verkuil , Mauro Carvalho Chehab , Pawel Osciak , Alexandre Courbot , Kamil Debski , Andrzej Hajda , Kyungmin Park , Jeongtae Park , Philipp Zabel , "Tiffany Lin (=?UTF-8?B?5p6X5oWn54+K?=)" , "Andrew-CT Chen (=?UTF-8?B?6Zmz5pm66L+q?=)" , Stanimir Varbanov , Todor Tomov , Nicolas Dufresne , Paul Kocialkowski , Laurent Pinchart , dave.stevenson@raspberrypi.org, Ezequiel Garcia , Maxime Jourdan Subject: Re: [PATCH v3 2/2] media: docs-rst: Document memory-to-memory video encoder interface Message-ID: <20190516103715.283face8@litschi.hi.pengutronix.de> In-Reply-To: <20190514081204.GA132745@chromium.org> References: <20190124100419.26492-1-tfiga@chromium.org> <20190124100419.26492-3-tfiga@chromium.org> <20190430193412.4291fca8@litschi.hi.pengutronix.de> <20190514081204.GA132745@chromium.org> Organization: Pengutronix X-Mailer: Claws Mail 3.14.1 (GTK+ 2.24.31; x86_64-pc-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-SA-Exim-Connect-IP: 2001:67c:670:100:feaa:14ff:fe6a:8db5 X-SA-Exim-Mail-From: m.tretter@pengutronix.de X-SA-Exim-Scanned: No (on metis.ext.pengutronix.de); SAEximRunCond expanded to false X-PTX-Original-Recipient: linux-kernel@vger.kernel.org Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, 14 May 2019 17:12:04 +0900, Tomasz Figa wrote: > Hi Michael, > > On Tue, Apr 30, 2019 at 07:34:12PM +0200, Michael Tretter wrote: > > On Thu, 24 Jan 2019 19:04:19 +0900, Tomasz Figa wrote: > > [snip] > > > > +State machine > > > +============= > > > + > > > +.. kernel-render:: DOT > > > + :alt: DOT digraph of encoder state machine > > > + :caption: Encoder state machine > > > + > > > + digraph encoder_state_machine { > > > + node [shape = doublecircle, label="Encoding"] Encoding; > > > + > > > + node [shape = circle, label="Initialization"] Initialization; > > > + node [shape = circle, label="Stopped"] Stopped; > > > + node [shape = circle, label="Drain"] Drain; > > > + node [shape = circle, label="Reset"] Reset; > > > + > > > + node [shape = point]; qi > > > + qi -> Initialization [ label = "open()" ]; > > > + > > > + Initialization -> Encoding [ label = "Both queues streaming" ]; > > > + > > > + Encoding -> Drain [ label = "V4L2_DEC_CMD_STOP" ]; > > > + Encoding -> Reset [ label = "VIDIOC_STREAMOFF(CAPTURE)" ]; > > > + Encoding -> Stopped [ label = "VIDIOC_STREAMOFF(OUTPUT)" ]; > > > + Encoding -> Encoding; > > > + > > > + Drain -> Stopped [ label = "All CAPTURE\nbuffers dequeued\nor\nVIDIOC_STREAMOFF(CAPTURE)" ]; > > > > Shouldn't this be > > > > Drain -> Stopped [ label = "All OUTPUT\nbuffers dequeued\nor\nVIDIOC_STREAMOFF(OUTPUT)" ]; > > > > ? While draining, the encoder continues encoding until all source > > buffers, i.e., buffers in the OUTPUT queue, are encoded or STREAMOFF > > happens on the OUTPUT queue. At the same time, the client continues to > > queue and dequeue buffers on the CAPTURE queue and there might be > > buffers queued on the CAPTURE queue even if the driver returned the > > buffer with the FLAG_LAST set and returns -EPIPE on further DQBUF > > requests. > > > > The STREAMOFF should be on OUTPUT indeed, because that immediately > removes any OUTPUT buffers from the queue, so there is nothing to be > encoded to wait for anymore. > > The "All OUTPUT buffers dequeued" part is correct, though. The last > OUTPUT buffer in the flush sequence is considered encoded after the > application dequeues the corresponding CAPTURE buffer is dequeued and > that buffer is marked with the V4L2_BUF_FLAG_LAST flag. I understand. As the application continues to queue and dequeue buffers on the CAPTURE queue until it received the last CAPTURE buffer and cannot dequeue further CAPTURE buffers, "All CAPTURE buffers dequeued" is correct. Thanks for the clarification. Michael > > Best regards, > Tomasz >