Subject: Re: bug#32932: 27.0.50; render bugs on macOS Mojave

From: Alan Third <[email-masked]>
Date: Wed, 29 Jan 2020 20:04:14 +0000

On Wed, Jan 29, 2020 at 08:32:25AM -0800, Aaron Jensen wrote:
> On Wed, Jan 29, 2020 at 2:08 AM Alan Third <[email-masked]> wrote:
> >
> > Hi Aaron, just as a test can you try disabling powerline?
> 
> Hi Alan, I don't use powerline, I use doom-modeline and disabling it
> has no effect.
> 
> I actually have worse news. My original test was actually with an
> unoptimized 27, as I forgot to actually run make (sigh). With 28, on
> my 4k display, Emacs is unusable even with the modeline disabled. My
> frame is only on about 3/5s of the screen, so it's not even taking up
> the entire 4k. The latency on every paint is probably in the 200-400ms
> range. I haven't measured it, but that's what it feels like.

Really it shouldn’t be slow for updating relatively small areas, so if
every paint is that slow then we’ve got real trouble.

Do you use a transparent background in Emacs?

Can you try applying these three changes, and see if they make any
difference. I’d like you to try the first two both with and without
the third.

modified   src/nsterm.m
@@ -1141,7 +1141,7 @@ static NSRect constrain_frame_rect(NSRect frameRect, bool isFullscreen)
 
 #ifdef NS_IMPL_COCOA
   [NSGraphicsContext setCurrentContext:nil];
-  [view display];
+  //[view display];
 #else
   block_input ();
 
@@ -2853,7 +2853,7 @@ so some key presses (TAB) are swallowed by the system.  */
   ns_unfocus (f);
 
   /* as of 2006/11 or so this is now needed */
-  ns_redraw_scroll_bars (f);
+  //ns_redraw_scroll_bars (f);
   unblock_input ();
 }
 
@@ -8313,12 +8313,19 @@ - (void)drawRect: (NSRect)rect
     return;
 
 #ifdef NS_IMPL_COCOA
-  [drawingBuffer drawInRect:rect
-                   fromRect:rect
-                  operation:NSCompositingOperationSourceOver
-                   fraction:1
-             respectFlipped:NO
-                      hints:nil];
+  const NSRect *r;
+  NSInteger count;
+  int i;
+
+  [self getRectsBeingDrawn:&r count:&count];
+
+  for (i = 0 ; i < count ; i++)
+    [drawingBuffer drawInRect:r[i]
+                     fromRect:r[i]
+                    operation:NSCompositingOperationSourceOver
+                     fraction:1
+               respectFlipped:NO
+                        hints:nil];
 #else
   int x = NSMinX (rect), y = NSMinY (rect);
   int width = NSWidth (rect), height = NSHeight (rect);

-- 
Alan Third