GNU bug report logs - #63187
30.0.50; Tail of longer lines painted after end of nearby lines on macOS

Previous Next

Package: emacs;

Reported by: Aaron Jensen <aaronjensen <at> gmail.com>

Date: Sun, 30 Apr 2023 10:11:01 UTC

Severity: normal

Found in version 30.0.50

Done: Eli Zaretskii <eliz <at> gnu.org>

Bug is archived. No further changes may be made.

Full log


Message #163 received at 63187 <at> debbugs.gnu.org (full text, mbox):

From: Kai Ma <justksqsf <at> gmail.com>
To: Aaron Jensen <aaronjensen <at> gmail.com>
Cc: Po Lu <luangruo <at> yahoo.com>, Alan Third <alan <at> idiocy.org>,
 Eli Zaretskii <eliz <at> gnu.org>, 63187 <at> debbugs.gnu.org
Subject: Re: bug#63187: 30.0.50; Tail of longer lines painted after end of
 nearby lines on macOS
Date: Sat, 24 Jun 2023 12:17:56 +0800
[Message part 1 (text/plain, inline)]

> On Jun 19, 2023, at 23:46, Aaron Jensen <aaronjensen <at> gmail.com> wrote:
> 
> Kai, could you try this patch out. It's a total guess, but let me know
> if it does any better for you.

Thanks. I have been running this for several days.  It does not fix the problem completely, but it’s possible to set polling-period to a very small value now.

> 
> diff --git a/src/nsterm.h b/src/nsterm.h
> index b6e5a813a6d..4f6c6f7c28b 100644
> --- a/src/nsterm.h
> +++ b/src/nsterm.h
> @@ -1384,3 +1384,11 @@ #define NSButtonTypeMomentaryPushIn
> NSMomentaryPushInButton
> extern void mark_nsterm (void);
> 
> #endif /* HAVE_NS */
> +
> +#define AJTRACE(...)                                          \
> +  do                                                                      \
> +    {                                                                     \
> +        fprintf (stderr, __VA_ARGS__);                                    \
> +        putc ('\n', stderr);     \
> +    }                                                                     \
> +  while(0)
> diff --git a/src/nsterm.m b/src/nsterm.m
> index 3e089cc1ff1..5a92f4cda0b 100644
> --- a/src/nsterm.m
> +++ b/src/nsterm.m
> @@ -2708,9 +2708,9 @@ Hide the window (X11 semantics)
>     EmacsView *view = FRAME_NS_VIEW (f);
> 
>     [view copyRect:srcRect to:dest];
> -#ifdef NS_IMPL_COCOA
> -    [view setNeedsDisplayInRect:destRect];
> -#endif
> +// #ifdef NS_IMPL_COCOA
> +//     [view setNeedsDisplayInRect:destRect];
> +// #endif
>   }
> 
>   unblock_input ();
> @@ -10636,9 +10636,9 @@ - (void) display
> 
>       /* Schedule a run of getContext so that if Emacs is idle it will
>          perform the buffer copy, etc.  */
> -      [self performSelectorOnMainThread:@selector (getContext)
> -                             withObject:nil
> -                          waitUntilDone:NO];
> +      // [self performSelectorOnMainThread:@selector (getContext)
> +      //                        withObject:nil
> +      //                     waitUntilDone:NO];
>     }
> }
> 
> @@ -10651,6 +10651,7 @@ - (void) copyContentsTo: (IOSurfaceRef) destination
>   IOReturn lockStatus;
>   IOSurfaceRef source = (IOSurfaceRef)[self contents];
>   void *sourceData, *destinationData;
> +  int seed1 = 0, seed2 = 1;
>   int numBytes = IOSurfaceGetAllocSize (destination);
> 
>   NSTRACE_WHEN (NSTRACE_GROUP_FOCUS, "[EmacsLayer copyContentsTo:]");
> @@ -10662,14 +10663,31 @@ - (void) copyContentsTo: (IOSurfaceRef) destination
>   if (lockStatus != kIOReturnSuccess)
>     NSLog (@"Failed to lock source surface: %x", lockStatus);
> 
> +  lockStatus = IOSurfaceLock (destination, kIOSurfaceLockAvoidSync, nil);
> +  if (lockStatus != kIOReturnSuccess)
> +    NSLog (@"Failed to lock destination surface: %x", lockStatus);
> +
>   sourceData = IOSurfaceGetBaseAddress (source);
>   destinationData = IOSurfaceGetBaseAddress (destination);
> 
> -  /* Since every IOSurface should have the exact same settings, a
> -     memcpy seems like the fastest way to copy the data from one to
> -     the other.  */
> -  memcpy (destinationData, sourceData, numBytes);
> +  while (seed1 != seed2)
> +    {
> +      seed1 = IOSurfaceGetSeed (source);
> +
> +      /* Since every IOSurface should have the exact same settings, a
> +        memcpy seems like the fastest way to copy the data from one to
> +        the other.  */
> +      memcpy (destinationData, sourceData, numBytes);
> 
> +      seed2 = IOSurfaceGetSeed (source);
> +      if (seed1 != seed2) {
> +        AJTRACE ("SEED DO NOT MATCH");

I haven't seen this message so far. So probably it is removing performSelectorOnMainThread that is effective.

> +      }
> +    }
> +
> +  lockStatus = IOSurfaceUnlock (destination, kIOSurfaceLockAvoidSync, nil);
> +  if (lockStatus != kIOReturnSuccess)
> +    NSLog (@"Failed to unlock destination surface: %x", lockStatus);
>   lockStatus = IOSurfaceUnlock (source, kIOSurfaceLockReadOnly, nil);
>   if (lockStatus != kIOReturnSuccess)
>     NSLog (@"Failed to unlock source surface: %x", lockStatus);

[Message part 2 (text/html, inline)]

This bug report was last modified 1 year and 364 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.