Subject: Re: bug#41187: 28.0.50; Flipped text

From: Alan Third <[email-masked]>
Date: Thu, 14 May 2020 22:05:57 +0100

On Mon, May 11, 2020 at 06:23:24PM +0300, Eli Zaretskii wrote:
> > From: Wasim Abbas <[email-masked]>
> > Date: Mon, 11 May 2020 13:00:57 +0100
> > 
> > I am seeing this issue on emacs head. The text randomly flips vertically. Very hard to reproduce. But if you open a very long C/C++ file like https://github.com/KhronosGroup/Vulkan-Headers/blob/master/include/vulkan/vulkan_core.h <https://github.com/KhronosGroup/Vulkan-Headers/blob/master/include/vulkan/vulkan_core.h> and keep moving around the buffer, cut 100ish lines and paste in another location and then move around again. You might hit the issue.
> > 
> > Here is a screenshot of it. I haven’t tried with emacs -Q yet but happy to try if required. 
> 
> Wow!  That's got to be some weird problem with you video driver or the
> display hardware.  Emacs never does anything like that.

It's almost definitely related to the fact that the NS port now draws
to an offscreen buffer on macOS 10.14 and above. Unfortunately the macOS
GUI toolkit has a reversed y axis as compared to what the Emacs code
expects. This means there are a number of places where we have to
invert the offscreen buffer, but I can't imagine a situation where
we're failing to invert it that wouldn't show up in normal usage.

There must be some specific situation that's catching it out.
-- 
Alan Third