From patchwork Thu Apr 4 10:00:45 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Oswald Buddenhagen X-Patchwork-Id: 13617522 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 508F8CD1292 for ; Thu, 4 Apr 2024 10:05:01 +0000 (UTC) Received: from alsa1.perex.cz (alsa1.perex.cz [207.180.221.201]) (using TLSv1.2 with cipher ADH-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by alsa0.perex.cz (Postfix) with ESMTPS id 9E7992C8B; Thu, 4 Apr 2024 12:04:49 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz 9E7992C8B DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1712225099; bh=/6bHgOjJBJyV98vE/wprMwW6DUyEX0wYBugNwx5yRmA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-Id: List-Archive:List-Help:List-Owner:List-Post:List-Subscribe: List-Unsubscribe:From; b=Qx01+yBMJSH+edWr1vL3IALfjNy8hd7Z91PHIVql53AGKukq/09hn0zfBdbZPOlTe Nc3TKSD2yv9nhoWU2eKHtB2dwT/Xv4fJR+aQRoJDNz3TlON6Ebbw3ZwcvV1xKBL8Fu uvdYEiHGrOhmAmdp7NUUldZ7SObKfx1AFQtjxlDw= Received: by alsa1.perex.cz (Postfix, from userid 50401) id 08BCDF805F2; Thu, 4 Apr 2024 12:03:29 +0200 (CEST) Received: from mailman-core.alsa-project.org (mailman-core.alsa-project.org [10.254.200.10]) by alsa1.perex.cz (Postfix) with ESMTP id E997AF8067C; Thu, 4 Apr 2024 12:03:28 +0200 (CEST) Received: by alsa1.perex.cz (Postfix, from userid 50401) id CF336F80578; Thu, 4 Apr 2024 12:03:24 +0200 (CEST) Received: from mout.gmx.net (mout.gmx.net [212.227.17.22]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (P-256) server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by alsa1.perex.cz (Postfix) with ESMTPS id 1E323F805D6 for ; Thu, 4 Apr 2024 12:03:02 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz 1E323F805D6 Authentication-Results: alsa1.perex.cz; dkim=pass (2048-bit key, unprotected) header.d=gmx.de header.i=oswald.buddenhagen@gmx.de header.a=rsa-sha256 header.s=s31663417 header.b=b8TvTxQh DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmx.de; s=s31663417; t=1712224976; x=1712829776; i=oswald.buddenhagen@gmx.de; bh=QbpXbcE+ZR9RSM7KyHuCqE1u/L252UQLp182kXonEls=; h=X-UI-Sender-Class:From:To:Cc:Subject:Date:In-Reply-To: References; b=b8TvTxQhpjTEGzmfTUShuAzbJg/IwGiP/UVfTNkrDMSOAV4nMQdbI/MZV9KNbueW JvX/B+gQRtO+/Bsf+RNoQHBRNXeBWJkBOfAKdnMZHfNuQJfAbPAcTZkj65X+pMOXb YFzfV2pRGCi8ADWwSymtEDDwyOxdeNLnScP+3AUMwo0W9mf4jh6VvJx0Zk62ed7LB vIeRrQf7YB1T4uqCN6bikzaOBXMFHyvMTYOTXo4HYHxgoDAGIsDZhPvNQx6tgylwX fjtj6N8ANMgGiElIcv+0jUY0urgm/gNPkU8w6pTmyQorvYDjpSZEGZBUwuTWkTvfk 8fmKyrJVn4g91u5RvQ== X-UI-Sender-Class: 724b4f7f-cbec-4199-ad4e-598c01a50d3a Received: from ugly.fritz.box ([89.247.162.126]) by mail.gmx.net (mrgmx105 [212.227.17.168]) with ESMTPSA (Nemesis) id 1MuUnK-1sidIw1KhG-00rcU6; Thu, 04 Apr 2024 12:02:56 +0200 Received: by ugly.fritz.box (masqmail 0.3.6-dev, from userid 1000) id 1rsJto-RG6-00; Thu, 04 Apr 2024 12:00:48 +0200 From: Oswald Buddenhagen To: alsa-devel@alsa-project.org Cc: Takashi Iwai , Jaroslav Kysela , Arthur Marsh Subject: [PATCH v2 14/17] ALSA: emu10k1: improve cache behavior documentation Date: Thu, 4 Apr 2024 12:00:45 +0200 Message-ID: <20240404100048.819674-15-oswald.buddenhagen@gmx.de> X-Mailer: git-send-email 2.42.0.419.g70bf8a5751 In-Reply-To: <20240404100048.819674-1-oswald.buddenhagen@gmx.de> References: <20240404100048.819674-1-oswald.buddenhagen@gmx.de> MIME-Version: 1.0 X-Provags-ID: V03:K1:RShzJIdSN/XlrC4KSiDVgiWyWCtZzJvQ0gURYuFuabSmrSjofsX FsugpTaIxRckDnwwYLIPee4D8UFC6jTe/srTByo+KHysrpNarJkbQNPo33IQuxo3uzuvdpf dw1Ni0rGGd6tcbIzZTEzjeIPkyE78K7QMHp9rztY+tmApKrVzdfNgd8K8LgWFoRJO2lCC+R RC/ituEkvKenSNVJ5L/ZQ== UI-OutboundReport: notjunk:1;M01:P0:Fkc+a9lB7nI=;lr4vL+bbJFahDVn2bm0KthnkRcs OgJsf27u1dvb4W/2k7EguCdl0dV5LMRDqsNqLCyFyx4XUuWS/+CEKWfwZIzr22L+aIg8hGdZO SeBGRs5qCHDSQy6vsGSwo1f3OzH81m2udyp++Uaa3VXe2yXsl4mGav4WMpHH2F+/9jlQ3xbru qmkUHEuT7nqdrHdHfThB6uB9ngyJ5DKzhZaxw1xjrExjFUZErYQTO3uvLiuandlk2cnytL38g rroTpnNOWbBBLbbBYj0cXouCP0VD+FS/TvuT5p87Kn/pCzD/qfoAs01Qz1MKe+ZgKUPPaxo7n 6JxtGOkhOBu2/5i+JmjNoccvJ23vFA8FpqtFIpY23FIdsIyGcMIUJrFAugMAxadVBvBuS9Ehc A6jxJ98L6jItdJ6F+qW7Zo0Q0oRLesWJCNQ41/iSR2VEc/t0Pv9USRAeV0tnfekuP29A6mrEB s+HpXTTPW3lp1Ohzh77DVOzDafJxM1pLKsoMNp0A1qD+c7NXMrqvKRwq0CAQDYOpXY+aXIwG9 vFwVxTDk6IWcfUW1C0PsyhzWnBChQn69/82qxyXBWUV2Y6nwtZle9alBidmHk/hXPkmm5DbIa TBS55ndbyU8+3+G+b3sUqM7bgTUD6CF7erPjHSJj5PxaXmIgEQl0HEoQlZpiNSbYl7UYmiVa0 CO7B6GeNlclSaFjfsAaorFKV8w/Q/XrgoE2KwkQ2Pf69Mw8C1ElNjHHBoxhVt8M8RUgV/tPri 8gg6tKy1Mi7dM8fx+W4HOyu/QcMRdm/nL9HutJDYy2t8h7hnBRLRjFBsTsgD6rnPvOsd4MtGd JABWuE/UkOdwPRh3Yh+p0YOVNlU/v67ZVQcLgeVrIrZKc= Message-ID-Hash: GKYF32YZCO6QDMPFPL7GQCXNNWYQUYXI X-Message-ID-Hash: GKYF32YZCO6QDMPFPL7GQCXNNWYQUYXI X-MailFrom: oswald.buddenhagen@gmx.de X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; header-match-alsa-devel.alsa-project.org-0; header-match-alsa-devel.alsa-project.org-1; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header X-Mailman-Version: 3.3.9 Precedence: list List-Id: "Alsa-devel mailing list for ALSA developers - http://www.alsa-project.org" Archived-At: List-Archive: List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: Resulting from more reverse engineering in the course of debugging. Signed-off-by: Oswald Buddenhagen --- include/sound/emu10k1.h | 28 ++++++++++++++++++---------- 1 file changed, 18 insertions(+), 10 deletions(-) -- 2.42.0.419.g70bf8a5751 diff --git a/include/sound/emu10k1.h b/include/sound/emu10k1.h index 9e3bd4f81460..12c7dc760724 100644 --- a/include/sound/emu10k1.h +++ b/include/sound/emu10k1.h @@ -598,17 +598,25 @@ SUB_REG(PEFE, FILTERAMOUNT, 0x000000ff) /* Filter envlope amount */ // In stereo mode, the two channels' caches are concatenated into one, // and hold the interleaved frames. // The cache holds 64 frames, so the upper half is not used in 8-bit mode. -// All registers mentioned below count in frames. -// The cache is a ring buffer; CCR_READADDRESS operates modulo 64. -// The cache is filled from (CCCA_CURRADDR - CCR_CACHEINVALIDSIZE) -// into (CCR_READADDRESS - CCR_CACHEINVALIDSIZE). +// All registers mentioned below count in frames. Shortcuts: +// CA = CCCA_CURRADDR, CRA = CCR_READADDRESS, +// CLA = CCR_CACHELOOPADDRHI:CLP_CACHELOOPADDR, +// CIS = CCR_CACHEINVALIDSIZE, LIS = CCR_LOOPINVALSIZE, +// CLF = CCR_CACHELOOPFLAG, LF = CCR_LOOPFLAG +// The cache is a ring buffer; CRA operates modulo 64. +// The cache is filled from (CA - CIS) into (CRA - CIS). // The engine has a fetch threshold of 32 bytes, so it tries to keep -// CCR_CACHEINVALIDSIZE below 8 (16-bit stereo), 16 (16-bit mono, -// 8-bit stereo), or 32 (8-bit mono). The actual transfers are pretty -// unpredictable, especially if several voices are running. -// Frames are consumed at CCR_READADDRESS, which is incremented afterwards, -// along with CCCA_CURRADDR and CCR_CACHEINVALIDSIZE. This implies that the -// actual playback position always lags CCCA_CURRADDR by exactly 64 frames. +// CIS below 8 (16-bit stereo), 16 (16-bit mono, 8-bit stereo), or +// 32 (8-bit mono). The actual transfers are pretty unpredictable, +// especially if several voices are running. +// Frames are consumed at CRA, which is incremented afterwards, +// along with CA and CIS. This implies that the actual playback +// position always lags CA by exactly 64 frames. +// When CA reaches DSL_LOOPENDADDR, LF is set for one frame's time. +// LF's rising edge causes the current values of CA and CIS to be +// copied into CLA and LIS, resp., and CLF to be set. +// If CLF is set, the first LIS of the CIS frames are instead +// filled from (CLA - LIS), and CLF is subsequently reset. #define CD0 0x20 /* Cache data registers 0 .. 0x1f */ #define PTB 0x40 /* Page table base register */