GNU bug report logs - #61667
29.0.60; Failure to redisplay

Previous Next

Package: emacs;

Reported by: Dmitry Gutov <dgutov <at> yandex.ru>

Date: Tue, 21 Feb 2023 02:55:01 UTC

Severity: normal

Found in version 29.0.60

Full log


View this message in rfc822 format

From: Dmitry Gutov <dgutov <at> yandex.ru>
To: Eli Zaretskii <eliz <at> gnu.org>
Cc: luangruo <at> yahoo.com, 61667 <at> debbugs.gnu.org, gregory <at> heytings.org
Subject: bug#61667: 29.0.60; Failure to redisplay
Date: Fri, 24 Feb 2023 23:03:12 +0200
On 24/02/2023 17:08, Eli Zaretskii wrote:
>> Date: Fri, 24 Feb 2023 16:12:30 +0200
>> Cc: luangruo <at> yahoo.com, 61667 <at> debbugs.gnu.org, gregory <at> heytings.org
>> From: Dmitry Gutov <dgutov <at> yandex.ru>
>>
>>>> - Before this commit: the window title doesn't change, it's always
>>>> emacs <at> hostname. But when I press 'a' (bound to 'find-file' lambda),
>>>> there never is a noticeable delay before the window contents change. The
>>>> buffer is displayed instantly.
>>> How is this consistent with your previous finding that the problem
>>> exists in Emacs 25, 26, and 27.  The change above is only present in
>>> Emacs 28.  Does this mean that the problem 100-200ms delay and the
>>> original problem are two different problems?
>>
>> Easy: my configuration contains a customization for frame-title-format.
>>
>> It's set to
>>
>>     (setq frame-title-format '(buffer-file-name "%f" ("%b")))
>>
>> All the time I spend bisecting the config I didn't think to change it
>> (it's the very first line). And this makes the problem appear with Emacs
>> 27 and 26 too.
> 
> So the hypothesis now is that changes in the frame's title, which
> cause Emacs to update the title by issuing GTK and/or X calls, somehow
> cause the problem, is that right?

I suppose so.

>>> Anyway, if the changes in the frame's title are somehow related to
>>> this, their effect is to cause Emacs to call x_set_name_internal to
>>> display the new title.  Could it be that this function takes such a
>>> long time to execute?  Or does it have some strange effect on the WM?
>>
>> My vague (and likely wrong) guess would be that the WM knows it needs
>> some update from the Emacs window, gets it from the title bar before
>> everything else, and marks the update as completed.
> 
> Can you please time that function anyway, if only to make sure the
> problem is elsewhere?  How much time does it take x_set_name_internal
> since its call till it returns, when it actually changes the frame's
> title?

Okay, done. It was a reasonable guess, that if the update is 
synchronous, it might stall for some reason. But that doesn't seem to be 
the case. It takes about the same time when the bug manifests as when it 
does not:

[x_set_name] time to x_set_name_internal: 49
[x_set_name] time to x_set_name_internal: 20

Here's the patch I used, if you want to check or modify it:

diff --git a/src/xfns.c b/src/xfns.c
index 528ae61ca32..b8ce75469c7 100644
--- a/src/xfns.c
+++ b/src/xfns.c
@@ -2238,6 +2238,13 @@ x_set_name_internal (struct frame *f, Lisp_Object 
name)
     }
 }

+int64_t now_millis() {
+  struct timespec now;
+  timespec_get(&now, TIME_UTC);
+
+  return ((int64_t) now.tv_sec) * 1000 + ((int64_t) now.tv_nsec) / 1000;
+}
+
 /* Change the name of frame F to NAME.  If NAME is nil, set F's name to
        x_id_name.

@@ -2290,7 +2297,11 @@ x_set_name (struct frame *f, Lisp_Object name, 
bool explicit)
   if (! NILP (f->title))
     name = f->title;

+  int64_t was = now_millis();
+
   x_set_name_internal (f, name);
+
+  fprintf (stderr, "[x_set_name] time to x_set_name_internal: %ld\n", 
now_millis() - was);
 }

 /* This function should be called when the user's lisp code has
@@ -2330,7 +2341,11 @@ x_set_title (struct frame *f, Lisp_Object name, 
Lisp_Object old_name)
   else
     CHECK_STRING (name);

+  int64_t was = now_millis();
+
   x_set_name_internal (f, name);
+
+  fprintf (stderr, "[x_set_title] time to x_set_name_internal: %ld\n", 
now_millis() - was);
 }




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

Previous Next


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