Received: by 2002:a05:6a10:a0d1:0:0:0:0 with SMTP id j17csp137706pxa; Tue, 11 Aug 2020 20:11:45 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzK6vQO7Il27FbQq9Sj5NTJC+y3EBkvDdguCCcBbZhEfsx4IYu+U2dQqs4cXPV8KTr6HrX6 X-Received: by 2002:a17:906:a209:: with SMTP id r9mr30443076ejy.413.1597201905206; Tue, 11 Aug 2020 20:11:45 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1597201905; cv=none; d=google.com; s=arc-20160816; b=IGYcJkXi79aPW6kUgWQPDLRvBh0ZXUhz+pHLCSv1SOLFHcuqcHcY3P95CX8tvQcnYU W6RF8YVtWYbMxQY6Tik0CeAz09/ArKR8tCQPbJWetM7oVx43shu7exUusB2wlRDSEkbc 6wABc56vmeYH90gw+aUEpFsk/4suAJU5xOUncGuZS0MNBjcR0I1mkqeIPSx5/CvvHX9j XbI1py5FZIowsElhxfNv4DPovovuX4nNVo/F3Q5tGCzHFGH6D+i1FHv9JtIvbV4oy0uR gOUXmBd4nArSna292UmE4/IbkKiluDeCSgcevxasc9EzSghhnSRXG61pBGA7lqahBezQ mSpQ== 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=3hkg0qu6P9KQ5oYfn7DTQjSamGImaGuetOUyRL9DWkY=; b=C8biajZwCTj53DTuZ/BkLcJJW7V/xjVPe8TnWpy4DtdMpd/V0kTVPt26X/4MEgIsyy XXzpifdyaqv6b0/GNeYOgMbNvf5HYjzrJLMN6pxqClzOYSjckp2eKIp0UP7tZRYJmQb2 w/GqquCHXv/vdbeHAgGZGGhp4abCR0MA1lNQWh1stW7ceLBDzGJsCJVp6j/ZTJ6nsyCY ZRVL1ULseThPsBesl5ZQ+SXUro4bC8iq/QDHn4V6zZkacI7pbNhGETwt45YY+csKorZE ZCoBuWC3VhlQC+6ODmilQcfdJ7Dq34ReHAlv05DZ1u9TNGC0drtTzgB/ApsgAGniOwqa VdOA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=ngSRzlum; 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=chromium.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id n11si458513edy.433.2020.08.11.20.11.05; Tue, 11 Aug 2020 20:11:45 -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=@chromium.org header.s=google header.b=ngSRzlum; 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=chromium.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726457AbgHLDKM (ORCPT + 99 others); Tue, 11 Aug 2020 23:10:12 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55140 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726255AbgHLDKL (ORCPT ); Tue, 11 Aug 2020 23:10:11 -0400 Received: from mail-wm1-x342.google.com (mail-wm1-x342.google.com [IPv6:2a00:1450:4864:20::342]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 243DFC06174A for ; Tue, 11 Aug 2020 20:10:11 -0700 (PDT) Received: by mail-wm1-x342.google.com with SMTP id c19so3300271wmd.1 for ; Tue, 11 Aug 2020 20:10:11 -0700 (PDT) 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=3hkg0qu6P9KQ5oYfn7DTQjSamGImaGuetOUyRL9DWkY=; b=ngSRzlumHkb0IDY4Pr87hg0ZwDwyroTE0Ld40lvNSNKIijgNhqQpnM6zRj84dIcXj4 qQ0YIrqSSAk94RpkV98/z5snP7OuL/YSL97sskrxvMAJUeecU/LwDCYHJLTkNbYY6y4S ag4+ErdhG3PO6Aaz/J7vZZktVSkGJgZVvQCYE= 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=3hkg0qu6P9KQ5oYfn7DTQjSamGImaGuetOUyRL9DWkY=; b=WheSNRy1JvbXqd5voy3/q++qkeKWR2ATAdXfr6bCa47KEx9aGAOzw/pW28wiOfLU7v MlOG+tzCpSHouzbd6niYtWiGH+MTVUO0GPPwWQYttwYrhuBSgk1vS6bMQrwDQXzaClsd 2di6dv5RhxMm3YVarBSngDe219sGuzLa/38ejEGjkCX/vb5vev02CKMgrDYGGmePO5m/ dng3cnyokxU5e3kyqv4qJbj9jQvy7u9l6LUMfPQ9gcGsniKn7aN8idipFizPRephFMMM iUUH1re/fC1UhYJcCE/wFc8z71/IVx/SCRojHRo3BB+wpylC25hEskQhfkjBa0TPtY62 WVog== X-Gm-Message-State: AOAM53065SMXbA+ocuZq/QZjMGWGTSQUmXmzglbwlOUmsca6W6+sZApG GtWYgSG5IJqFvwdePaaqynvB29MRUELo179JJ5wqfg== X-Received: by 2002:a7b:c7c6:: with SMTP id z6mr6825647wmk.17.1597201809730; Tue, 11 Aug 2020 20:10:09 -0700 (PDT) MIME-Version: 1.0 References: <3f3baf5e-f73d-9cd6-cbfb-36746071e126@linux.intel.com> <20200811145353.GG6967@sirena.org.uk> <20200811172209.GM6967@sirena.org.uk> In-Reply-To: <20200811172209.GM6967@sirena.org.uk> From: Yu-Hsuan Hsu Date: Wed, 12 Aug 2020 11:09:58 +0800 Message-ID: Subject: Re: [PATCH v3 2/2] ASoC: Intel: Add period size constraint on strago board To: Mark Brown Cc: Pierre-Louis Bossart , Guennadi Liakhovetski , "alsa-devel@alsa-project.org" , Kai Vehmanen , Kuninori Morimoto , Takashi Iwai , "Rojewski, Cezary" , Takashi Iwai , Jie Yang , "linux-kernel@vger.kernel.org" , Liam Girdwood , Sam McNally , "yuhsuan@google.com" , Ranjani Sridharan , Daniel Stuart , Andy Shevchenko , "Lu, Brent" , Damian van Soelen 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 Mark Brown =E6=96=BC 2020=E5=B9=B48=E6=9C=8812=E6=97= =A5 =E9=80=B1=E4=B8=89 =E4=B8=8A=E5=8D=881:22=E5=AF=AB=E9=81=93=EF=BC=9A > > On Tue, Aug 11, 2020 at 11:54:38AM -0500, Pierre-Louis Bossart wrote: > > > > constraint logic needs to know about this DSP limitation - it seems l= ike > > > none of this is going to change without something new going into the > > > mix? We at least need a new question to ask about the DSP firmware I > > > think. > > > I just tested aplay -Dhw: on a Cyan Chromebook with the Ubuntu kernel 5= .4, > > and I see no issues with the 240 sample period. Same with 432, 960, 960= 0, > > etc. > > > I also tried just for fun what happens with 256 samples, and I don't se= e any > > underflows thrown either, so I am wondering what exactly the problem is= ? > > Something's not adding up. I would definitively favor multiple of 1ms > > periods, since it's the only case that was productized, but there's got= to > > me something a side effect of how CRAS programs the hw_params. > > Is it something that goes wrong with longer playbacks possibly (eg, > someone watching a feature film or something)? Thanks for testing! After doing some experiments, I think I can identify the problem more preci= sely. 1. aplay can not reproduce this issue because it writes samples immediately when there are some space in the buffer. However, you can add --test-position to see how the delay grows with period size 256. > aplay -Dhw:1,0 --period-size=3D256 --buffer-size=3D480 /dev/zero -d 1 -f = dat --test-position Playing raw data '/dev/zero' : Signed 16 bit Little Endian, Rate 48000 Hz, Stereo Suspicious buffer position (1 total): avail =3D 0, delay =3D 2064, buffer = =3D 512 Suspicious buffer position (2 total): avail =3D 0, delay =3D 2064, buffer = =3D 512 Suspicious buffer position (3 total): avail =3D 0, delay =3D 2096, buffer = =3D 512 ... 2. Since many samples are moved to DSP(delay), the measured rate of the ring-buffer is high. (I measured it by alsa_conformance_test, which only test the sampling rate in the ring buffer of kernel not DSP) 3. Since CRAS writes samples with a fixed frequency, this behavior will take all samples from the ring buffer, which is seen as underrun by CRAS. (It seems that it is not a real underrun because that avail does not larger than buffer size. Maybe CRAS should also take dalay into account.) 4. In spite of it is not a real underrun, the large delay is still a big problem. Can we apply the constraint to fix it? Or any better idea? Thanks, Yu-Hsuan