unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Aaron Jensen <aaronjensen@gmail.com>
To: Alan Third <alan@idiocy.org>,
	Aaron Jensen <aaronjensen@gmail.com>,
	Kai Ma <justksqsf@gmail.com>,
	63187@debbugs.gnu.org, Eli Zaretskii <eliz@gnu.org>,
	Po Lu <luangruo@yahoo.com>
Subject: bug#63187: 30.0.50; Tail of longer lines painted after end of nearby lines on macOS
Date: Sat, 24 Jun 2023 12:05:45 -0400	[thread overview]
Message-ID: <CAHyO48yBuUyeKnK8VbAcuAQBDnP=7HOyNT6ZhhdSJ38=XiU5yg@mail.gmail.com> (raw)
In-Reply-To: <ZJcOqVObA9bwET9K@idiocy.org>

On Sat, Jun 24, 2023 at 11:41 AM Alan Third <alan@idiocy.org> wrote:
>
> On Sat, Jun 24, 2023 at 10:52:08AM -0400, Aaron Jensen wrote:
> > On Sat, Jun 24, 2023 at 10:14 AM Alan Third <alan@idiocy.org> 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?

It's possible we have two very different problems that only appear related:
1. The one i'm seeing, which is sort of ghosting of other lines into
the whitespace of nearby lines. The getContext call removal did not
fix this for me, I saw it happen once.
2. The one Kai is seeing, that is exacerbated by decreasing the
polling interval, but seems to be helped by removing the getContext
call.

> 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.

My problem is that at this point it happens so infrequently and I have
no idea if that's because of the patches I'm trying or some other
environmental thing or just luck. I'm going to try running without the
async getContext and without the setNeedsDisplay for a while and see
if it happens. Perhaps the setNeedsDisplay is somehow causing an issue
and that's why changing it from source to dest seemed to help but it
didn't alleviate it.

If I see it again, I'll add the sync getContext call in, though I'll
admit I do not understand your paragraph above starting with IIRC. Are
you suspecting a potential problem with reading from the surface that
is in the process of being copied to vram?

Aaron





  reply	other threads:[~2023-06-24 16:05 UTC|newest]

Thread overview: 71+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <m2fs8histt.fsf@gmail.com>
2023-04-30 10:33 ` bug#63187: 30.0.50; Tail of longer lines painted after end of nearby lines on macOS Eli Zaretskii
2023-04-30 10:46   ` Aaron Jensen
2023-04-30 13:25 ` Po Lu via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-04-30 14:25   ` Aaron Jensen
2023-04-30 14:42     ` Eli Zaretskii
2023-04-30 14:57       ` Aaron Jensen
2023-04-30 15:26         ` Eli Zaretskii
2023-04-30 16:48           ` Aaron Jensen
2023-04-30 19:04             ` Eli Zaretskii
2023-04-30 23:58     ` Po Lu via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-05-01 12:40       ` Eli Zaretskii
2023-05-01 13:18         ` Po Lu via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-05-01 13:25           ` Eli Zaretskii
2023-05-01 13:47             ` Aaron Jensen
2023-05-01 13:52               ` Eli Zaretskii
2023-05-01 13:55                 ` Aaron Jensen
2023-05-01 14:06                   ` Aaron Jensen
2023-05-09  3:07               ` Aaron Jensen
2023-05-09  5:39                 ` Eli Zaretskii
2023-05-13 13:54                   ` Eli Zaretskii
2023-05-13 14:23                     ` Aaron Jensen
2023-05-18 11:21                       ` Eli Zaretskii
2023-05-18 15:59                         ` Aaron Jensen
2023-06-08  5:40                           ` Kai Ma
2023-06-08  7:33                             ` Kai Ma
2023-06-08 12:51                               ` Alan Third
2023-06-08 13:42                                 ` Kai Ma
2023-06-08 14:57                                   ` Kai Ma
2023-06-08 17:22                                     ` Alan Third
2023-06-09  2:42                                       ` Kai Ma
2023-06-09  2:47                                         ` Aaron Jensen
2023-06-09  3:12                                           ` Kai Ma
2023-06-09 18:27                                             ` Alan Third
2023-06-09 18:46                                               ` Aaron Jensen
2023-06-09 20:00                                                 ` Alan Third
2023-06-12 13:04                                                   ` Aaron Jensen
2023-06-16  2:17                                                     ` Aaron Jensen
2023-06-19 15:46                                                       ` Aaron Jensen
2023-06-24  4:17                                                         ` Kai Ma
2023-06-24 13:34                                                           ` Aaron Jensen
2023-06-24 14:14                                                             ` Alan Third
2023-06-24 14:52                                                               ` Aaron Jensen
2023-06-24 15:08                                                                 ` Eli Zaretskii
2023-06-24 15:41                                                                 ` Alan Third
2023-06-24 16:05                                                                   ` Aaron Jensen [this message]
2023-06-24 21:29                                                                     ` Alan Third
2023-06-24 21:43                                                                       ` Aaron Jensen
2023-06-25 12:46                                                                         ` Alan Third
2023-06-25 17:07                                                                           ` Aaron Jensen
2023-06-25 18:17                                                                             ` Alan Third
2023-06-25 19:07                                                                               ` Aaron Jensen
2023-06-25 21:18                                                                                 ` Alan Third
2023-06-25 22:33                                                                                   ` Aaron Jensen
2023-06-26  7:27                                                                           ` Kai Ma
2023-06-28 19:53                                                                             ` Alan Third
2023-07-21  2:02                                                                               ` Aaron Jensen
2023-07-23 11:20                                                                                 ` Alan Third
2023-07-23 13:01                                                                                   ` Aaron Jensen
2023-07-25 14:47                                                                                     ` Aaron Jensen
2023-07-25 15:45                                                                                       ` Eli Zaretskii
2023-06-23  8:48                                                       ` Alan Third
2023-06-23 11:54                                                         ` Aaron Jensen
2023-05-01 17:26             ` Alan Third
2023-05-01 22:40               ` Aaron Jensen
2023-05-02 10:14                 ` Alan Third
2023-05-02 12:21                   ` Eli Zaretskii
2023-05-02 22:36                     ` Alan Third
2023-05-03  8:11                       ` Daniel Martín via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-05-03 13:08                       ` Eli Zaretskii
2023-05-02  0:07               ` Po Lu via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-05-02  0:32                 ` Aaron Jensen

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='CAHyO48yBuUyeKnK8VbAcuAQBDnP=7HOyNT6ZhhdSJ38=XiU5yg@mail.gmail.com' \
    --to=aaronjensen@gmail.com \
    --cc=63187@debbugs.gnu.org \
    --cc=alan@idiocy.org \
    --cc=eliz@gnu.org \
    --cc=justksqsf@gmail.com \
    --cc=luangruo@yahoo.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).