[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
bug#63187: 30.0.50; Tail of longer lines painted after end of nearby lin
From: |
Alan Third |
Subject: |
bug#63187: 30.0.50; Tail of longer lines painted after end of nearby lines on macOS |
Date: |
Sat, 24 Jun 2023 22:29:54 +0100 |
On Sat, Jun 24, 2023 at 12:05:45PM -0400, Aaron Jensen wrote:
> > 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.
Yes, it might be two different things.
> > 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.
OK
> 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?
Maybe... I'm really not sure what might be going on.
My suspicion is that if we try to swap between the buffers too fast,
something is going wrong between the process of flushing the drawing
to the pixel buffer and copying the pixel buffer to the next one.
So, we have two buffers, A and B. We draw to A, but before we're done
the system calls display. We send off the incomplete buffer A to VRAM,
and then take a copy of that incomplete buffer for B. At some point
the system decides to flush the graphics context to the buffer, but
it's flushing to A, and we've *already* copied A to B.
This would possibly explain why Kai lowering the polling interval
induces the issue, as it may increase the frequency at which the
screen is updated beyond the point where we're able to keep up.
To be honest though, I feel it should all be pretty linear and this
idea implies things are happening out-of-order. So I'm not convinced
I'm right.
Who knows. Maybe all we need to do is make sure we don't try to draw
to the screen while emacs is drawing to the buffer... Something like
this:
modified src/nsterm.m @@ -10622,7 +10622,7 @@ - (void) display
{
NSTRACE_WHEN (NSTRACE_GROUP_FOCUS, "[EmacsLayer display]");
- if (context)
+ if (context && context != [NSGraphicsContext currentContext])
{
[self releaseContext];
...
Actually...
That change should probably be made anyway. If the NS run loop kicks
in between an ns_focus call and an ns_unfocus call, it could call
display and our display function will happily destroy the existing
context without creating a new one, so any *subsequent* drawing
operations, up until ns_unfocus, will be lost.
I'm not sure if that's a legitimate concern... 😕
I've got too many ideas about how to fix it and no way to actually try
them out, never mind the difficulty of inducing the issue if I did.
--
Alan Third
- bug#63187: 30.0.50; Tail of longer lines painted after end of nearby lines on macOS, (continued)
- bug#63187: 30.0.50; Tail of longer lines painted after end of nearby lines on macOS, Aaron Jensen, 2023/06/12
- bug#63187: 30.0.50; Tail of longer lines painted after end of nearby lines on macOS, Aaron Jensen, 2023/06/15
- bug#63187: 30.0.50; Tail of longer lines painted after end of nearby lines on macOS, Aaron Jensen, 2023/06/19
- bug#63187: 30.0.50; Tail of longer lines painted after end of nearby lines on macOS, Kai Ma, 2023/06/24
- bug#63187: 30.0.50; Tail of longer lines painted after end of nearby lines on macOS, Aaron Jensen, 2023/06/24
- bug#63187: 30.0.50; Tail of longer lines painted after end of nearby lines on macOS, Alan Third, 2023/06/24
- bug#63187: 30.0.50; Tail of longer lines painted after end of nearby lines on macOS, Aaron Jensen, 2023/06/24
- bug#63187: 30.0.50; Tail of longer lines painted after end of nearby lines on macOS, Eli Zaretskii, 2023/06/24
- bug#63187: 30.0.50; Tail of longer lines painted after end of nearby lines on macOS, Alan Third, 2023/06/24
- bug#63187: 30.0.50; Tail of longer lines painted after end of nearby lines on macOS, Aaron Jensen, 2023/06/24
- bug#63187: 30.0.50; Tail of longer lines painted after end of nearby lines on macOS,
Alan Third <=
- bug#63187: 30.0.50; Tail of longer lines painted after end of nearby lines on macOS, Aaron Jensen, 2023/06/24
- bug#63187: 30.0.50; Tail of longer lines painted after end of nearby lines on macOS, Alan Third, 2023/06/25
- bug#63187: 30.0.50; Tail of longer lines painted after end of nearby lines on macOS, Aaron Jensen, 2023/06/25
- bug#63187: 30.0.50; Tail of longer lines painted after end of nearby lines on macOS, Alan Third, 2023/06/25
- bug#63187: 30.0.50; Tail of longer lines painted after end of nearby lines on macOS, Aaron Jensen, 2023/06/25
- bug#63187: 30.0.50; Tail of longer lines painted after end of nearby lines on macOS, Alan Third, 2023/06/25
- bug#63187: 30.0.50; Tail of longer lines painted after end of nearby lines on macOS, Aaron Jensen, 2023/06/25
- bug#63187: 30.0.50; Tail of longer lines painted after end of nearby lines on macOS, Kai Ma, 2023/06/26
- bug#63187: 30.0.50; Tail of longer lines painted after end of nearby lines on macOS, Alan Third, 2023/06/28
- bug#63187: 30.0.50; Tail of longer lines painted after end of nearby lines on macOS, Alan Third, 2023/06/23