Received: by 2002:a05:6902:102b:0:0:0:0 with SMTP id x11csp3487646ybt; Tue, 30 Jun 2020 04:10:49 -0700 (PDT) X-Google-Smtp-Source: ABdhPJygaQdSWUAXEWmapbvsmk2uZf4kDxddigOgT8QHV2b+ZZLQk8+5WfcSiWW5sOTCYkl8GwNX X-Received: by 2002:a17:906:57c6:: with SMTP id u6mr17419218ejr.194.1593515449018; Tue, 30 Jun 2020 04:10:49 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1593515449; cv=none; d=google.com; s=arc-20160816; b=T6OmBC8whGCHrgL+ujAOTKgDBTxYHp+LbuHEbseTJTuTYwLKvxOWUTUtwalZ3dQADz B+HCgiyVd2pcke0HWs2iWDuDurEPlehSMoFYu8qF121cpopYM5xAD5fdraA1pLYuIlUk myyB00nxKSSAcIKmGS7q4FboYghMwiRLcN3GKV98YMLdLdxIzGxg5gVMg0yCMGg8epMV BwOarHvTpzx7eYP83ajZLVc8wEb2uepI07+McR0dsXgSiMidAm4PcKkjn7WS+Fz8S7WK L0J6Qe5EiVhIuhBrn+bXbAJGQfmdtJbdfFQuXems1quVHg1IMzawn6AB5Pyx+wPnERGq bpDA== 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 :user-agent:references:in-reply-to:date:cc:to:from:subject :message-id:dkim-signature; bh=T93SLtnPb6wB9FBMjQial71KQSEtfSKw0717TcvmAh8=; b=B/wSZzn9o9qeYVEFVpoZu6ws3mhi0qSLmvEsYs/qjqKF6C25sj40/WjMb8BBKPAVjb gfWVT78wBe9num+pCXmJvkpGN5KN5XRZ6CKgRaUMFGChwvfS656eGcNDsmH4NOmdDqA9 KxS7DU6FPPnw9bGcIEjafOgVNQPG3WSKP1svjmzhAAeU0Ry44VqXUFa0UPyiS3p2Ha6l Spy/SdyFdrLybdGRLmy7aEClvpdthhD5CMDCJC0W22+ymr8GD3DTgp0VCQ0kkJC55+j5 YySn5omaaA/x8aq3PQungR1oDSDba7RDMzMl+g6R/V1hmo9PBp3CMZ0v+ZUJqLewPZRq dvmw== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@tsoy.me header.s=mymail header.b=J6WB1C5p; 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=fail (p=NONE sp=QUARANTINE dis=NONE) header.from=tsoy.me Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id g10si1563076ejf.424.2020.06.30.04.10.25; Tue, 30 Jun 2020 04:10:49 -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=fail header.i=@tsoy.me header.s=mymail header.b=J6WB1C5p; 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=fail (p=NONE sp=QUARANTINE dis=NONE) header.from=tsoy.me Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1732846AbgF3LIL (ORCPT + 99 others); Tue, 30 Jun 2020 07:08:11 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50790 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728534AbgF3LIL (ORCPT ); Tue, 30 Jun 2020 07:08:11 -0400 X-Greylist: delayed 1084 seconds by postgrey-1.37 at lindbergh.monkeyblade.net; Tue, 30 Jun 2020 04:08:09 PDT Received: from puleglot.ru (puleglot.ru [IPv6:2a01:4f8:1c0c:58e8::2]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D591CC061755; Tue, 30 Jun 2020 04:08:09 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=tsoy.me; s=mymail; h=Sender:Content-Transfer-Encoding:MIME-Version:Content-Type: References:In-Reply-To:Date:Cc:To:From:Subject:Message-ID:Reply-To:Content-ID :Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To: Resent-Cc:Resent-Message-ID:List-Id:List-Help:List-Unsubscribe:List-Subscribe :List-Post:List-Owner:List-Archive; bh=T93SLtnPb6wB9FBMjQial71KQSEtfSKw0717TcvmAh8=; b=J6WB1C5pQWATN7nSRT+Efii6bO /7JzRtqiraqSjFjAoUfaqK5gRtm6EBsnDXGXUfonkqWpP0c6zCp9eQr7FvYI/Zf73a5Y+2LwYhlJF ACFyPz7hGf8YX5FBxCcosVyPS0QAihfj1L8KXw2ATSGF2XQnUXmNBlOr97O8ELdlxT6E=; Received: from [10.8.10.223] (helo=work) by puleglot.ru with esmtpsa (TLS1.3) tls TLS_AES_256_GCM_SHA384 (Exim 4.93.0.4) (envelope-from ) id 1jqDpx-001PGV-MF; Tue, 30 Jun 2020 13:50:01 +0300 Message-ID: Subject: Re: [PATCH 4.9 026/191] ALSA: usb-audio: Improve frames size computation From: Alexander Tsoy To: Sasha Levin , linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Takashi Iwai Date: Tue, 30 Jun 2020 13:49:50 +0300 In-Reply-To: <20200629154007.2495120-27-sashal@kernel.org> References: <20200629154007.2495120-1-sashal@kernel.org> <20200629154007.2495120-27-sashal@kernel.org> Content-Type: text/plain; charset="UTF-8" User-Agent: Evolution 3.36.3 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org В Пн, 29/06/2020 в 11:37 -0400, Sasha Levin пишет: > From: Alexander Tsoy > > [ Upstream commit f0bd62b64016508938df9babe47f65c2c727d25c ] > > For computation of the the next frame size current value of fs/fps > and > accumulated fractional parts of fs/fps are used, where values are > stored > in Q16.16 format. This is quite natural for computing frame size for > asynchronous endpoints driven by explicit feedback, since in this > case > fs/fps is a value provided by the feedback endpoint and it's already > in > the Q format. If an error is accumulated over time, the device can > adjust fs/fps value to prevent buffer overruns/underruns. > > But for synchronous endpoints the accuracy provided by these > computations > is not enough. Due to accumulated error the driver periodically > produces > frames with incorrect size (+/- 1 audio sample). > > This patch fixes this issue by implementing a different algorithm for > frame size computation. It is based on accumulating of the remainders > from division fs/fps and it doesn't accumulate errors over time. This > new method is enabled for synchronous and adaptive playback > endpoints. > > Signed-off-by: Alexander Tsoy > Link: > https://lore.kernel.org/r/20200424022449.14972-1-alexander@tsoy.me > Signed-off-by: Takashi Iwai > Signed-off-by: Sasha Levin > --- > sound/usb/card.h | 4 ++++ > sound/usb/endpoint.c | 43 ++++++++++++++++++++++++++++++++++++++-- > --- > sound/usb/endpoint.h | 1 + > sound/usb/pcm.c | 2 ++ > 4 files changed, 45 insertions(+), 5 deletions(-) Please drop this patch from the queue for now (and for 4.4 as well). It introduced a regression for some devices. The fix is available, but not accepted yet.