Received: by 2002:a05:6902:102b:0:0:0:0 with SMTP id x11csp3075909ybt; Mon, 29 Jun 2020 14:41:05 -0700 (PDT) X-Google-Smtp-Source: ABdhPJy6ng9vApnxLAdRDfFsKhHK4eu7Ppt0lNKJOvfUc2S/kltzlXJFs8P277KEYt4xErFlY4DJ X-Received: by 2002:a50:e04e:: with SMTP id g14mr15347811edl.352.1593466865188; Mon, 29 Jun 2020 14:41:05 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1593466865; cv=none; d=google.com; s=arc-20160816; b=aQiwyw51AF726XdT2JeLTAxZxMS7V7xpVBA+4ToPSZ4Uac5dPdU4VJlLmowJdf48Nk zrIE6QH2lMope/5wO+H1NovaqZ6j0Fgd1NnSWJnTN94QaOK74B3nszcIRWUB+mMoQwRX b1jqu67B+udk5RZYcO135DVrHVU6RCRU9uA0efylBFNLSFDNGVc5AGwAdYZCOwO96jYh PxAB786toZ7Z8CCQw+1/Dkiw5cZiwcKUA6PrsfI6/jO/uUqbO7axpf1cfiYcjiJlDIDQ Pi+H01HgDSrLD09p2V7ZDT47KO91zPW6eEdMSoocHhwvnmhfsIL4Z7abIojMwkmuv8Jr H6Hw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:in-reply-to:content-transfer-encoding :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature; bh=jR+P7oFrxcc/BIP8mv9NfUTE4Duh9wUF5U0M5vlGe9I=; b=BCrIedFwXuUpwRN+wmomCaJqXUB/qGgdDL1kaD4Lwnrt/WhC85zNwpnfG69KG9N8v3 gw2wk021GacKTFXyHo0cf4L2EncifJSbdvp7+0nhOp7zMZYHUQzkUCYL0pDBKM6HTjCf sisByD0WgMHGrBqhfY59pJfJxJqkBiLvWyXIlC869v4znkeJFI0k2LU5uZ3hjxhKwNoc Ade8LghglmQDJmKWn1V7g6CbZeBlUEH3308b9k1vh6WB2zAj40YH1u3XgIbeQ6yUqBdw GMl3ShXf/U5Ivg69MKEImMMxAZgJA23lYJYoHLhdAKGIzzBXDMzplJytlcwH/ZhLrZbA eZJQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=profOf+O; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id m1si497291ejj.160.2020.06.29.14.40.42; Mon, 29 Jun 2020 14:41:05 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=profOf+O; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728388AbgF2VkX (ORCPT + 99 others); Mon, 29 Jun 2020 17:40:23 -0400 Received: from mail.kernel.org ([198.145.29.99]:60642 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728262AbgF2Sk2 (ORCPT ); Mon, 29 Jun 2020 14:40:28 -0400 Received: from localhost (unknown [122.182.251.219]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id CF13820857; Mon, 29 Jun 2020 09:34:33 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1593423274; bh=00blYSw4H3we8f6YNcADktzYDOCPmayZbfhVhGUiz6o=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=profOf+OjR7WE03HKWGRwyP+LXIRgPlX8syXRo/3NQJ8Cr9hQPWee9UDxZACi3WCF ONI2Zny5nkvY3b1m12zOrx6cBSzw69Dv+tVQDZ/PKSubTsWPxVS6ATnMHH7swTNwlL vSa10APt2UUDEq5Qh4vgF2mM7T2ZQMh2/ocuIec4= Date: Mon, 29 Jun 2020 15:04:29 +0530 From: Vinod Koul To: Amadeusz =?utf-8?B?U8WCYXdpxYRza2k=?= Cc: Takashi Iwai , Jaroslav Kysela , alsa-devel@alsa-project.org, Charles Keepax , Pierre-Louis Bossart , linux-kernel@vger.kernel.org, Srinivas Kandagatla Subject: Re: [PATCH v4 1/3] ALSA: compress: document the compress audio state machine Message-ID: <20200629093429.GA2599@vkoul-mobl> References: <20200629075002.11436-1-vkoul@kernel.org> <20200629075002.11436-2-vkoul@kernel.org> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Amadeusz, On 29-06-20, 11:05, Amadeusz Sławiński wrote: > > > On 6/29/2020 9:50 AM, Vinod Koul wrote: > > So we had some discussions of the stream states, so I thought it is a > > good idea to document the state transitions, so add it documentation > > > > Reviewed-by: Charles Keepax > > Signed-off-by: Vinod Koul > > --- > > .../sound/designs/compress-offload.rst | 51 +++++++++++++++++++ > > 1 file changed, 51 insertions(+) > > > > diff --git a/Documentation/sound/designs/compress-offload.rst b/Documentation/sound/designs/compress-offload.rst > > index ad4bfbdacc83..b6e9025ae105 100644 > > --- a/Documentation/sound/designs/compress-offload.rst > > +++ b/Documentation/sound/designs/compress-offload.rst > > @@ -151,6 +151,57 @@ Modifications include: > > - Addition of encoding options when required (derived from OpenMAX IL) > > - Addition of rateControlSupported (missing in OpenMAX AL) > > +State Machine > > +============= > > + > > +The compressed audio stream state machine is described below :: > > + > > + +----------+ > > + | | > > + | OPEN | > > + | | > > + +----------+ > > + | > > + | > > + | compr_set_params() > > + | > > + v > > + compr_free() +----------+ > > + +------------------------------------| | > > + | | SETUP | > > + | +------------------------>| |<-------------------------+ > > + | | compr_drain_notify() +----------+ | > > + | | or ^ | > > + | | compr_stop() | | > > + | | | compr_write() | > > + | | | | > > + | | | | Not sure, this is not in the version I posted, arrow is from setup -> prepare. See https://lore.kernel.org/alsa-devel/20200629075002.11436-2-vkoul@kernel.org/ I don't know how it got reversed in your version, maybe the MUA messed up?? > > + | | +----------+ | > > + | | | | compr_free() | > > + | | | PREPARE |---------------> A | > > + | | | | | > > + | | +----------+ | > > + | | | | > > + | | | | > > + | | | compr_start() | > > + | | | | > > + | | v | > > + | +----------+ +----------+ | > > + | | | compr_drain() | | compr_stop() | > > + | | DRAIN |<-------------------| RUNNING |--------------------------+ > > + | | | | | | > > + | +----------+ +----------+ | > > + | | ^ | > > + | A | | | > > + | | compr_pause() | | compr_resume() | > > + | | | | | > > + | v v | | > > + | +----------+ +----------+ | > > + | | | | | compr_stop() | > > + +--->| FREE | | PAUSE |---------------------------+ > > + | | | | > > + +----------+ +----------+ > > + > > Gapless Playback > > ================ > > > > Line containing compr_free (between SETUP and FREE) seems to be misaligned? not in the version I posted and see on lore > If you move prepare to the left and drain in place of drain, it feels like > you won't need this weird indirection with A yeah that was a compromise to make it bit neater to me than adding overlapping arrows... > Something like: > > >> + v > > > + compr_free() +----------+ > > > + +------------------------------------| | > > > + | | SETUP | > > > + | +------------------------>| |<-------------------------+ > > > + | | compr_write() +----------+ | > > > + | | ^ | > > > + | | | compr_drain_notify() or | > > > + | | | compr_stop() | > > > + | | | | > > > + | | | | > > > + | | +----------+ | > > > + | | | | | > > > + | | | DRAIN | | > > > + | | | | | > > > + | | +----------+ | > > > + | | ^ | > > > + | | | | > > > + | | | compr_drain() | > > > + | | | | > > > + | | | | > > > + | +----------+ +----------+ | > > > + | | | compr_start() | | compr_stop() | > > > + | | PREPARE |------------------->| RUNNING |--------------------------+ > > > + | | | | | | > > > + | +----------+ +----------+ | > > > + | | | ^ | > > > + | | compr_free() | | | > > > + | | compr_pause() | | compr_resume() | > > > + | | | | | > > > + | v v | | > > > + | +----------+ +----------+ | > > > + | | | | | compr_stop() | > > > + +--->| FREE | | PAUSE |---------------------------+ > > > + | | | | > > > + +----------+ +----------+ > > > + > > but this makes me question PREPARE state, how do you enter it? a compr_write() moves from SETUP -> PREPARE. Fixing that above looks better version of mine.. -- ~Vinod