From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Aaron Jensen Newsgroups: gmane.emacs.bugs Subject: bug#63187: 30.0.50; Tail of longer lines painted after end of nearby lines on macOS Date: Sat, 24 Jun 2023 09:34:18 -0400 Message-ID: References: <50104E0C-A861-4762-8081-55F2CF2390AD@gmail.com> <76A3A6C3-CD32-4731-927C-349471F21801@gmail.com> <2A505E20-55E2-4788-A21C-B94068299E50@gmail.com> <29949E40-D5D5-4DE1-BD81-93D1BA3D4F51@gmail.com> <335C856F-41F7-48B8-AF42-B2406065C7A9@gmail.com> Mime-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="10877"; mail-complaints-to="usenet@ciao.gmane.io" Cc: Po Lu , Alan Third , Eli Zaretskii , 63187@debbugs.gnu.org To: Kai Ma Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Sat Jun 24 15:35:45 2023 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1qD3QX-0002hc-46 for geb-bug-gnu-emacs@m.gmane-mx.org; Sat, 24 Jun 2023 15:35:45 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qD3Q5-0001cm-8O; Sat, 24 Jun 2023 09:35:17 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qD3Q4-0001ca-Jb for bug-gnu-emacs@gnu.org; Sat, 24 Jun 2023 09:35:16 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qD3Pq-0004ZQ-OR for bug-gnu-emacs@gnu.org; Sat, 24 Jun 2023 09:35:08 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1qD3Pq-0008Gi-4T for bug-gnu-emacs@gnu.org; Sat, 24 Jun 2023 09:35:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Aaron Jensen Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sat, 24 Jun 2023 13:35:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 63187 X-GNU-PR-Package: emacs Original-Received: via spool by 63187-submit@debbugs.gnu.org id=B63187.168761368131751 (code B ref 63187); Sat, 24 Jun 2023 13:35:02 +0000 Original-Received: (at 63187) by debbugs.gnu.org; 24 Jun 2023 13:34:41 +0000 Original-Received: from localhost ([127.0.0.1]:40099 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qD3PU-0008G3-HO for submit@debbugs.gnu.org; Sat, 24 Jun 2023 09:34:40 -0400 Original-Received: from mail-ej1-f54.google.com ([209.85.218.54]:60878) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qD3PP-0008Fn-Sj for 63187@debbugs.gnu.org; Sat, 24 Jun 2023 09:34:39 -0400 Original-Received: by mail-ej1-f54.google.com with SMTP id a640c23a62f3a-98df69cacd1so29404166b.1 for <63187@debbugs.gnu.org>; Sat, 24 Jun 2023 06:34:35 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1687613670; x=1690205670; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=PrUpdr3+BrVcWlEHSMW1InZ3NbZJpmP7J+zM0XnbpPE=; b=Yx+hkbYqSkS+yGH0bpse+Leqns+AjxdvNR0PNvgOw3ChaR63EeberD+akO+agcDkXt d+6lX7h2za91yeC8kIQm7zH7DIjwUq7h2rfIpeSQl8rRXRZ9Gx/V19qG/1PcGdSjiTWJ rsO7JZkLl7R0A5gMS5uVzQdbgxOREybEYVHX8wexPhjJodP/A+Pd9uI1IadJowVOv6CM P7cAoXn1jWN7OdCunifjQth/nIQvz3lIjVMtN+oCXVMIHp+W9hnuXDUCi64KbPrchFUH XUc2uA0GVt73PKcbIR1cuhnKQT23RKg5zumwl4oAWQxl6sxyEp6c9y2kYH4rPUVxAQ9Y dj9w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1687613670; x=1690205670; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=PrUpdr3+BrVcWlEHSMW1InZ3NbZJpmP7J+zM0XnbpPE=; b=IFkFZzvNjcugu52bI7zYhL6q9wX7st7em56OZ9kgHZpEM6wXHolmu7zj0RObHBFqKq EvBn4ZWebSMzdclELLVblvQcwA18SvnAUttzwT/wfVAldBTECTRaTjfZkAOKMQZq2GSo bYsHtbCfeX8A1bQ4LpIk3mvWBe62PtFPDgJq3VGYIG02XztnVU7+4m0F7pjIF7tu5eMR Sc6itR5iiaVtcVuwRB9/QL2rEFcPCJ+pb9JgQWJeX5fixJWoEaFgF7m8MalcRQSuQ8ze zBiVFitm2qU5qUcWa1nyl1c6wl796rGThxfen8XYWhT2MBIg/JaxyQHPL+f5hvy3zgYy PCow== X-Gm-Message-State: AC+VfDxXeJnEAd+dOJoeWGESQsgV5VHYZNGbRAsIg9/1QO/8zjnE41rR USDFWLBsDrpa21knL/ZcanEwtGyQALA8iIfQrWM= X-Google-Smtp-Source: ACHHUZ7bs3dIHJe8+udWZnJl7N8XOfhDpWIGWhvpKH7ZK9QAifMGxHAMpsed6ivis4n/uPxmZBJCVogQfseCxsZBP1k= X-Received: by 2002:a17:907:a0a:b0:982:9daf:9fcf with SMTP id bb10-20020a1709070a0a00b009829daf9fcfmr22026608ejc.66.1687613669716; Sat, 24 Jun 2023 06:34:29 -0700 (PDT) In-Reply-To: <335C856F-41F7-48B8-AF42-B2406065C7A9@gmail.com> X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.bugs:263991 Archived-At: On Sat, Jun 24, 2023 at 12:18=E2=80=AFAM Kai Ma wrote= : > > > > On Jun 19, 2023, at 23:46, Aaron Jensen 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 p= roblem completely, but it=E2=80=99s possible to set polling-period to a ver= y small value now. Hmm, do you see any of the artifacts w/o changing the polling period? > 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 =3D 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) destinati= on > IOReturn lockStatus; > IOSurfaceRef source =3D (IOSurfaceRef)[self contents]; > void *sourceData, *destinationData; > + int seed1 =3D 0, seed2 =3D 1; > int numBytes =3D IOSurfaceGetAllocSize (destination); > > NSTRACE_WHEN (NSTRACE_GROUP_FOCUS, "[EmacsLayer copyContentsTo:]"); > @@ -10662,14 +10663,31 @@ - (void) copyContentsTo: (IOSurfaceRef) destina= tion > if (lockStatus !=3D kIOReturnSuccess) > NSLog (@"Failed to lock source surface: %x", lockStatus); > > + lockStatus =3D IOSurfaceLock (destination, kIOSurfaceLockAvoidSync, ni= l); > + if (lockStatus !=3D kIOReturnSuccess) > + NSLog (@"Failed to lock destination surface: %x", lockStatus); > + > sourceData =3D IOSurfaceGetBaseAddress (source); > destinationData =3D 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 !=3D seed2) > + { > + seed1 =3D 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 =3D IOSurfaceGetSeed (source); > + if (seed1 !=3D seed2) { > + AJTRACE ("SEED DO NOT MATCH"); > > > I haven't seen this message so far. So probably it is removing performSel= ectorOnMainThread that is effective. 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. Thanks, Aaron