From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Gerd =?UTF-8?Q?M=C3=B6llmann?= Newsgroups: gmane.emacs.bugs Subject: bug#57434: 28.1.91; Terminal Emacs Mac OS flickering. Date: Thu, 01 Sep 2022 07:44:52 +0200 Message-ID: References: <83ler7vx3o.fsf@gnu.org> <838rn6x4h2.fsf@gnu.org> <834jxux3kd.fsf@gnu.org> <831qsyx2lr.fsf@gnu.org> <142be6aa-f25f-fad2-5597-6e02b0e3e4f6@gmail.com> <8335dcu0sg.fsf@gnu.org> <83mtbks7mo.fsf@gnu.org> Mime-Version: 1.0 Content-Type: text/plain Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="26957"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/29.0.50 (darwin) Cc: Dmitrii Kuragin , 57434@debbugs.gnu.org To: Eli Zaretskii Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Thu Sep 01 07:46:27 2022 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1oTd22-0006ny-J4 for geb-bug-gnu-emacs@m.gmane-mx.org; Thu, 01 Sep 2022 07:46:26 +0200 Original-Received: from localhost ([::1]:46934 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oTd20-0006bK-8I for geb-bug-gnu-emacs@m.gmane-mx.org; Thu, 01 Sep 2022 01:46:25 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:43974) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oTd1e-0006b9-Rq for bug-gnu-emacs@gnu.org; Thu, 01 Sep 2022 01:46:03 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:51154) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1oTd1e-0002Ed-IS for bug-gnu-emacs@gnu.org; Thu, 01 Sep 2022 01:46:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1oTd1e-0000zY-5H for bug-gnu-emacs@gnu.org; Thu, 01 Sep 2022 01:46:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Gerd =?UTF-8?Q?M=C3=B6llmann?= Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Thu, 01 Sep 2022 05:46:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 57434 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: moreinfo Original-Received: via spool by 57434-submit@debbugs.gnu.org id=B57434.16620111073743 (code B ref 57434); Thu, 01 Sep 2022 05:46:02 +0000 Original-Received: (at 57434) by debbugs.gnu.org; 1 Sep 2022 05:45:07 +0000 Original-Received: from localhost ([127.0.0.1]:40903 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1oTd0k-0000yI-RW for submit@debbugs.gnu.org; Thu, 01 Sep 2022 01:45:07 -0400 Original-Received: from mail-ej1-f51.google.com ([209.85.218.51]:46840) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1oTd0f-0000xQ-Oy for 57434@debbugs.gnu.org; Thu, 01 Sep 2022 01:45:05 -0400 Original-Received: by mail-ej1-f51.google.com with SMTP id bj12so32396465ejb.13 for <57434@debbugs.gnu.org>; Wed, 31 Aug 2022 22:45:01 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=mime-version:user-agent:message-id:date:references:in-reply-to :subject:cc:to:from:from:to:cc; bh=4ACi1aNXddSfGFyc5tpaHtcx5hKhOZjRTgHB1qPCaXc=; b=nWL5vjusLJZLxmgjYpmYN7I25hplEZJjZCPD8iUvdq0jsawzdmpOrEomKXiU1UwOje e31OAPgVbQYbf1JXDW+bKFD9L6RXDnBDrkerOEY4DUy4Pj7huBjVaAegP7683PPe2Fnc WkF7FHOrFOptDHbq7gCWDfIofbGFtZ3VcLN97mWvCxFPvVize8MRVWsdEoIT4PzerkXJ HflCcx7uQpfmzj/8ny2D6qwyLUYznyM4BBEg+x5mF9LumFawgT/PZUnLScRKv7d7JOSz +kSBW98JAgm6fEWyJ8ETiuClMJwMThS7TGkv0zr5vdytoSMWHztsrTXxc0zppKryOYoN sRhg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=mime-version:user-agent:message-id:date:references:in-reply-to :subject:cc:to:from:x-gm-message-state:from:to:cc; bh=4ACi1aNXddSfGFyc5tpaHtcx5hKhOZjRTgHB1qPCaXc=; b=Y41uDpTqd0X1tZYiOUybyKkWSstohlM871LZ7CfOzGhmd/O+965xGdboJggtn/LelO z8wsHwuuRhbDuju8eGUJSGQxByis5Bk5BeCbinO6KcrR0poacDoO6pHMCPfrp8OnVJtm PLW6kRZcPmR7S2VF52hdrtvuiowlmz1XaFhMlqRRsOXXa/BbM4zjy3VM0T1jGyfG3MCk VEAZk61xj1SHhfDUXHsawWL1UOcSrVwHj9kgKE/tfsyTEUUv2TmfOVAvcYPrqnmGUUay AY+gu9PtShj9fdBm4okMLw/+Y4Si4dzv/vAMR3msSglo5oI8DgIfdXeDXLZBSm6ouJjz Ezfg== X-Gm-Message-State: ACgBeo0zKvJL7mY/kxZs3zJTHCw5Sgq9QSX2uJ7BUxSE2Oq6Etu4Uzyt JPO1JCceaL/N2d+rgtNZEgAy/NYOk1Q= X-Google-Smtp-Source: AA6agR5cUDFFL3Aap2syEby1k/PfQPILfhSKOIfu5S7hj2gp1AabHfXtA9TyJALTFEtrdnKGxRNK2Q== X-Received: by 2002:a17:907:6089:b0:734:be0c:e0cd with SMTP id ht9-20020a170907608900b00734be0ce0cdmr23137446ejc.474.1662011095110; Wed, 31 Aug 2022 22:44:55 -0700 (PDT) Original-Received: from Mini.fritz.box (pd9e365e6.dip0.t-ipconnect.de. [217.227.101.230]) by smtp.gmail.com with ESMTPSA id r1-20020a1709061ba100b00731745a7e62sm7924563ejg.28.2022.08.31.22.44.53 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 31 Aug 2022 22:44:53 -0700 (PDT) In-Reply-To: <83mtbks7mo.fsf@gnu.org> (Eli Zaretskii's message of "Wed, 31 Aug 2022 19:25:03 +0300") X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.io gmane.emacs.bugs:241228 Archived-At: Eli Zaretskii writes: > Given our inability to pinpoint the root cause of the problem, and the > unsolved mystery why on some macOS systems the problem is much more > prominent than on other macOS systems, I tend to introduce a variable > that users could set from Lisp to tell Emacs not to use the optimized > insert/delete-lines algorithm in scroll.c. Unless some significant > new ideas or facts emerge in the next day or two, that is. I guess I've found these facts today, while rummaging in alacritty's Github project. Let me mention first that there's quite some flushing and flickering going on in alacritty's Github issues with all sorts of terminal applications (tmux, vim, neovim, ...), and on all platforms it runs on (MS-Windows, GNU/Linux, macOS, ...). Alacritty is one of a number of terminal emulators using OpenGL with GPU accelerated framebuffer display. I must admit that I didn't realize up to now that such a thing exists. Framebuffer updates depend on monitor refresh rates, among other things. One can only update at some given points in time (vsync, vblank, and so on, I'm not an expert). That's the typical N frames/second thing one can find in various contexts. (And note the different behavior Dmitrii mentioned on his second monitor.) Very simplified, what happens is that Alacritty seems to put framebuffer contents on the screen in the middle of updates sent from terminal clients. Which leads to flickering. For a longer story, see for instance https://github.com/karlstav/cava/issues/453 https://bytemeta.vip/repo/karlstav/cava/issues/453 https://github.com/alacritty/alacritty/issues/598 https://github.com/kovidgoyal/kitty/issues/4817 and also follow links there. One screencast there shows vim flickering in 100% the exact same way (even the colors) that Dmitrii showed with Emacs :-). The terminal emulators' proposed solution for this flickering seems to be that clients support "synchronized updates" as they call it. That is, a client sends the terminal emulator begin-update/end-update control sequences, which the emulator uses to avoid framebuffer updates in the middle of the update. Proposed specification: https://gitlab.com/gnachman/iterm2/-/wikis/synchronized-updates-spec A number of terminal clients seem to have added this. Tmux seems to do it. Vim I don't know but I'd wager it does when I see the screencast mentioned above and what Dmitrii showed. I think other applications do too, but I haven't digged deeper. I couldn't find information which terminfo capabilties are supposed to be used for this, and I don't think it's part of any official specification. And I'd like to add that alacritty.org says about itself "The software is considered to be at a beta level of readiness", so I'm a bit wary how stable this all is. In summary, this is for me a very likely candidate for "the root cause". Someone (tm) should probably take a deeper look at this. Maybe Dmitrii is up for it?