From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Alan Third Newsgroups: gmane.emacs.bugs Subject: bug#63187: 30.0.50; Tail of longer lines painted after end of nearby lines on macOS Date: Sat, 24 Jun 2023 16:41:29 +0100 Message-ID: References: <335C856F-41F7-48B8-AF42-B2406065C7A9@gmail.com> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="16028"; mail-complaints-to="usenet@ciao.gmane.io" Cc: Po Lu , Kai Ma , Eli Zaretskii , 63187@debbugs.gnu.org To: Aaron Jensen Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Sat Jun 24 17:42:27 2023 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 1qD5P9-000400-9N for geb-bug-gnu-emacs@m.gmane-mx.org; Sat, 24 Jun 2023 17:42:27 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qD5P0-0008J9-VN; Sat, 24 Jun 2023 11:42:19 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qD5Ok-0008E5-IQ for bug-gnu-emacs@gnu.org; Sat, 24 Jun 2023 11:42:04 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qD5Ok-0001Hn-4C for bug-gnu-emacs@gnu.org; Sat, 24 Jun 2023 11:42:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1qD5Oj-0000Lu-VP for bug-gnu-emacs@gnu.org; Sat, 24 Jun 2023 11:42:01 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Alan Third Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sat, 24 Jun 2023 15:42:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 63187 X-GNU-PR-Package: emacs Original-Received: via spool by 63187-submit@debbugs.gnu.org id=B63187.16876213001321 (code B ref 63187); Sat, 24 Jun 2023 15:42:01 +0000 Original-Received: (at 63187) by debbugs.gnu.org; 24 Jun 2023 15:41:40 +0000 Original-Received: from localhost ([127.0.0.1]:41351 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qD5OO-0000LF-55 for submit@debbugs.gnu.org; Sat, 24 Jun 2023 11:41:40 -0400 Original-Received: from dane.soverin.net ([185.233.34.148]:50515) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qD5OL-0000Ky-Fk for 63187@debbugs.gnu.org; Sat, 24 Jun 2023 11:41:38 -0400 Original-Received: from smtp.soverin.net (c04smtp-lb01.int.sover.in [10.10.4.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits)) (No client certificate requested) by dane.soverin.net (Postfix) with ESMTPS id 4QpJHb3FgYz2xF7; Sat, 24 Jun 2023 15:41:31 +0000 (UTC) Original-Received: from smtp.soverin.net (smtp.soverin.net [10.10.4.99]) by soverin.net (Postfix) with ESMTPSA id 4QpJHZ4NmTzHg; Sat, 24 Jun 2023 15:41:30 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=idiocy.org; s=soverin; t=1687621291; bh=KhHuPTeyCIJdhFt5gXeI+hF6p72ek9bIHuuhsqq+Fnk=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=KJW3Lb5R4hX6z551x8np21enRYHV6010KATczDnzh4aEq6Bs5fnnqyEVCfa3MqV5e OX/d7BJH29o8P6oOTHK92i2sCRgx6/Xpda3ziPSFqOQX8latfx4S8UXncMYgNfhwN3 IT3ZiCHMFycYkQ/fGD8Z/WoicCz0qC7vaQl7ehOmYunpkeAClbkCLH93HYdYFsh02p LcdSETJP3Sl77Vi7YbHfXijzAfgSeUYI/TNSWwNchwGutw5d20PNJf6sLiI4Y97cCY M0Odx3tJYZl52LSJHm1j097EXSjfF3MT/6cUrL684C1gH3Q/S0s7ppAJ7HvjQMlUQ4 MEr6+WUqPgcUQ== Original-Received: from alan by faroe.holly.idiocy.org with local (Exim 4.95) (envelope-from ) id 1qD5OD-000Xmc-C2; Sat, 24 Jun 2023 16:41:29 +0100 X-Soverin-Authenticated: true Mail-Followup-To: Alan Third , Aaron Jensen , Kai Ma , 63187@debbugs.gnu.org, Eli Zaretskii , Po Lu Content-Disposition: inline In-Reply-To: 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-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.bugs:264002 Archived-At: On Sat, Jun 24, 2023 at 10:52:08AM -0400, Aaron Jensen wrote: > On Sat, Jun 24, 2023 at 10:14 AM Alan Third wrote: > > > > On Sat, Jun 24, 2023 at 09:34:18AM -0400, Aaron Jensen wrote: > > > > > > Could you try removing the destination lock as well and see if that > > > impacts anything? From what I can tell, locking the destination may be > > > a good idea, but I'm curious if Alan has any thoughts as to why it'd > > > be a bad idea. > > > > copyContentsTo is only called by getContext, which has already locked > > the destination, so there's no need to lock it again. > > Ah, I see. Is the kIOSurfaceLockAvoidSync flag valuable for any reason? I don't think so... Not in our use-case. IIRC it's possible to get the GPU to perform actions on the buffer once it's in VRAM. We don't do that, so we don't need to ever worry about write-backs to system RAM. I think. > If I recall correctly, there's some code in Emacs that optimizes which > areas of the screen glyphs are drawn to. Maybe it remembers what was > the background color already and doesn't clear it again... I don't > remember where I saw it, but I think it was outside of nsterm. Does > that ring a bell? I'm thinking about how this manifests. For me, it's > always whole characters that are painted, they are always painted in > what would otherwise be whitespace, and they tend to get "copied" to > the next line in the whitespace as scrolling happens. In other words, > it doesn't just seem like a fluke write during the transfer to VRAM. > It seems like something in the engine is writing them, that the state > is getting "stuck" somehow. Does any of that ring a bell/jog anything? Its quite possible. I did say before in the thread that it seems quite possible to me that something isn't clearing the whitespace correctly. But it's obviously rare, and I would expect that it's some piece of NS port code rather than somewhere else. Unless there's something that's #ifdef'd out because at some point in the past the NS port has behaved differently... But more likely if this is what's going on then it's going to be a bug in the NS port. Unfortunately I don't really understand how the glyph drawing side works, and never did. But if that's the case, why would removing the asynchronous call to getContext fix so many problems? Something perhaps worth trying... Since removing the asynchronous call to getContext fixes the problems, perhaps we need to think about the "lazy" way we get the next buffer when the current one is displayed. At the moment it just forgets about it until we want to draw to the screen, at which point we call getContext and it creates the buffer if necessary and copies the old one to the new one. Maybe we should get the new buffer and do the copy when we set the current buffer for display... IIRC I avoided that because there isn't always time for the buffer to have been sent to VRAM and unlocked before the *next* call to display, so I wanted to leave it as long as possible between display and getting the next buffer, but maybe this is just the wrong way to do it. So I suppose putting a call to getContext right after "currentSurface == NULL" in display might be a quick and dirty way to test that. -- Alan Third