unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Eli Zaretskii <eliz@gnu.org>
To: larsi@gnus.org
Cc: 10304@debbugs.gnu.org, schwab@linux-m68k.org
Subject: bug#10304: 24.0.92: display bug
Date: Sun, 13 Jan 2013 20:08:32 +0200	[thread overview]
Message-ID: <837gnhrm5b.fsf@gnu.org> (raw)
In-Reply-To: <83ehhw8c15.fsf@gnu.org>

> Date: Tue, 08 Jan 2013 07:43:50 +0200
> From: Eli Zaretskii <eliz@gnu.org>
> Cc: 10304@debbugs.gnu.org, schwab@linux-m68k.org
> 
> I think I do understand.  My suspicion is that we somehow fail to
> realize that the screen estate formerly occupied by the image, and
> everything that follows it, needs to be cleared in its entirety.  On
> the display engine level, the image takes just one "line" (called
> "glyph row"), and perhaps we somehow don't realize that the height of
> that "line" is large, and all of that needs to be cleared, not just
> the number of text lines of "normal" height that will replace the
> image on display.
> 
> Thanks for the details, they confirm my suspicions.  I now need to
> find whodunit in the code...

Please apply the patch below and run with it for a while.  It makes
the output of trace-redisplay more voluminous, but I don't see how
else we could catch the problem.  When the problem happens again,
please post the results.

Here's my analysis of what is involved; perhaps it will help you read
the output and make some changes on the spot, if needed.

The clearing of portions of display that no longer display anything is
done as part of dispnew.c:update_window.  It does that as part of the
call to update_window_line, when the latter is passed a screen line
(a.k.a. "row") that should be empty on display.  Such empty lines have
a single glyph (an "invented" blank character with charpos equal to
point-max), whose sole purpose is to facilitate clearing of empty
lines.  These empty lines have the enabled_p flag set, which means
they should be displayed.  (update_window ignores lines whose
enabled_p flag is reset, because these do not correspond to any part
of the displayed text.)

So, for us to fail to clear these empty lines, I see several possible
reasons:

 . the logic in update_window somehow skips the loop that starts at
   line 3495 and which displays the empty lines past the end of the
   buffer; or

 . some redisplay optimization in xdisp.c decides that those parts of
   display do not need to be updated, and thus excludes them from the
   glyph matrix it constructs in w->desired_matrix, so that those
   lines are not updated by update_window; or

 . the function x_clear_end_of_line, which is called by
   update_window_line, or its terminal-specific back-end (e.g.,
   xterm.c:x_clear_frame_area), which implements the meat of that
   function, somehow fail to clear the correct portion of the display.

The patches below are designed to report enough info for us to be able
to tell which of the above hypotheses, if any, is true.

Btw, any idea when these problems started happening?  Is it an old
problem, or did it start to appear only recently?

Thanks.

Here are the patches:

--- src/dispnew.c~0	2013-01-07 14:13:25.000000000 +0200
+++ src/dispnew.c	2013-01-13 14:22:21.549690800 +0200
@@ -3473,6 +3473,11 @@
       while (row < end && !row->enabled_p)
 	++row;
 
+      TRACE ((stderr,
+	      "update_window: first enabled: %d, last: %d, no_scrolling: %d\n",
+	      row - desired_matrix->rows, end - desired_matrix->rows - 1,
+	      desired_matrix->no_scrolling_p));
+
       /* Try reusing part of the display by copying.  */
       if (row < end && !desired_matrix->no_scrolling_p)
 	{
@@ -3481,6 +3486,7 @@
 	    {
 	      /* All rows were found to be equal.  */
 	      paused_p = 0;
+	      TRACE ((stderr, "scrolling_window found all rows equal\n"));
 	      goto set_cursor;
 	    }
 	  else if (rc > 0)
@@ -3488,10 +3494,18 @@
 	      /* We've scrolled the display.  */
 	      force_p = 1;
 	      changed_p = 1;
+	      TRACE ((stderr, "scrolling_window scrolled the display\n"));
 	    }
 	}
 
       /* Update the rest of the lines.  */
+      if (!(row < end && (force_p || !input_pending)))
+	{
+	  TRACE ((stderr,
+		  "NOT updating rest of lines; row = %d end = %d fp = %d ip = %d\n",
+		  row - desired_matrix->rows, end - desired_matrix->rows - 1,
+		  force_p, input_pending));
+	}
       for (; row < end && (force_p || !input_pending); ++row)
 	/* scrolling_window resets the enabled_p flag of the rows it
 	   reuses from current_matrix.  */
@@ -3533,12 +3547,17 @@
 	       tempted to optimize redisplay based on lines displayed
 	       in the first redisplay.  */
 	    if (MATRIX_ROW_BOTTOM_Y (row) >= yb)
-	      for (i = vpos + 1; i < w->current_matrix->nrows - 1; ++i)
-		MATRIX_ROW (w->current_matrix, i)->enabled_p = 0;
+	      {
+		TRACE ((stderr, "update_window marks rows %d - %d invalid\n",
+			vpos + 1, w->current_matrix->nrows - 2));
+		for (i = vpos + 1; i < w->current_matrix->nrows - 1; ++i)
+		  MATRIX_ROW (w->current_matrix, i)->enabled_p = 0;
+	      }
 	  }
 
       /* Was display preempted?  */
       paused_p = row < end;
+      TRACE ((stderr, "update_window %spreempted\n", paused_p ? "" : "NOT "));
 
     set_cursor:
 


--- src/xdisp.c~0	2013-01-07 14:13:25.000000000 +0200
+++ src/xdisp.c	2013-01-13 16:14:15.697145600 +0200
@@ -25568,6 +25568,9 @@
   from_y = WINDOW_TO_FRAME_PIXEL_Y (w, max (min_y, output_cursor.y));
   to_y = WINDOW_TO_FRAME_PIXEL_Y (w, to_y);
 
+  TRACE ((stderr, "clear_frame_area: [%d - %d] [%d - %d]\n",
+	  from_x, to_x, from_y, to_y));
+
   /* Prevent inadvertently clearing to end of the X window.  */
   if (to_x > from_x && to_y > from_y)
     {





  parent reply	other threads:[~2013-01-13 18:08 UTC|newest]

Thread overview: 79+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-06-24 15:30 bug#14704: 24.3.50; cl-lib breaks built-in Emacs version Sebastian Wiesner
2013-06-24 15:48 ` Juanma Barranquero
2013-06-24 17:51   ` Sebastian Wiesner
2013-06-24 17:56     ` Juanma Barranquero
2013-06-24 18:26       ` Sebastian Wiesner
2013-06-24 18:38         ` Eli Zaretskii
2013-06-24 18:57           ` Sebastian Wiesner
2013-06-24 19:20             ` Eli Zaretskii
2013-06-24 20:02               ` Glenn Morris
2013-06-24 20:08                 ` Eli Zaretskii
2013-06-24 20:21                   ` Dmitry Gutov
2013-06-24 20:25                     ` Eli Zaretskii
2013-06-24 20:30                       ` Juanma Barranquero
2013-06-25 14:43                         ` Eli Zaretskii
2013-06-24 21:19                       ` Jambunathan K
2013-06-25  2:43                         ` Eli Zaretskii
2013-06-25  2:35                       ` Stefan Monnier
2013-06-25 14:39                         ` Eli Zaretskii
2013-06-25 15:50                           ` Stefan Monnier
2013-06-25  6:17                   ` Michael Albinus
2013-06-25 15:00                     ` Eli Zaretskii
2013-06-25 15:24                       ` Michael Albinus
2013-06-25 16:03                         ` bug#10304: " Eli Zaretskii
2013-06-25 18:27                           ` bug#10304: display bug (was: bug#14704: 24.3.50; cl-lib breaks built-in Emacs version) Michael Albinus
2013-06-25 18:58                             ` Eli Zaretskii
2013-06-25 19:13                               ` bug#10304: display bug Michael Albinus
2011-12-15 13:51                                 ` bug#10304: 24.0.92: display but Yagnesh Raghava Yakkala
2011-12-15 13:58                                   ` Yagnesh Raghava Yakkala
2012-01-07  1:20                                   ` Lars Magne Ingebrigtsen
2012-01-07  8:48                                     ` Eli Zaretskii
2012-01-26  0:09                                       ` Lars Ingebrigtsen
2013-01-02  2:36                                       ` bug#10304: 24.0.92: display bug Lars Magne Ingebrigtsen
2013-01-02 18:23                                         ` Eli Zaretskii
2013-01-02 18:42                                           ` Lars Magne Ingebrigtsen
2013-01-02 21:42                                             ` Andreas Schwab
2013-01-05  8:38                                         ` Lars Magne Ingebrigtsen
2013-01-05  8:51                                           ` Eli Zaretskii
2013-01-05  9:16                                             ` Lars Magne Ingebrigtsen
2013-01-05  9:17                                             ` Lars Magne Ingebrigtsen
2013-01-05  9:49                                               ` Eli Zaretskii
2013-01-05 10:11                                                 ` Lars Magne Ingebrigtsen
2013-01-05 11:29                                           ` Eli Zaretskii
2013-01-05 11:38                                             ` Lars Magne Ingebrigtsen
2013-01-05 13:43                                               ` Eli Zaretskii
2013-01-05 17:36                                               ` Eli Zaretskii
2013-01-08  5:11                                                 ` Lars Magne Ingebrigtsen
2013-01-08  5:43                                                   ` Eli Zaretskii
2013-01-08 11:19                                                     ` Michael Albinus
2013-01-08 21:21                                                       ` Eli Zaretskii
2013-01-08 21:29                                                         ` Michael Albinus
2013-01-08 21:39                                                           ` Eli Zaretskii
2013-01-13 18:08                                                     ` Eli Zaretskii [this message]
2013-01-16 15:06                                                       ` Michael Albinus
2014-11-14 15:45                                                     ` Lars Magne Ingebrigtsen
2014-11-14 15:56                                                       ` Eli Zaretskii
2014-11-14 15:57                                                         ` Lars Magne Ingebrigtsen
2014-11-15 15:35                                                           ` Lars Magne Ingebrigtsen
2014-11-15 15:41                                                           ` Lars Magne Ingebrigtsen
2014-11-29 15:42                                                             ` Eli Zaretskii
     [not found]                                                               ` <m3oarmyoiz.fsf@stories.gnus.org>
2014-12-27 14:20                                                                 ` Eli Zaretskii
2015-01-15 23:50                                                                   ` Lars Magne Ingebrigtsen
2015-01-17 11:34                                                                     ` Eli Zaretskii
2015-05-07  4:31                                                                       ` Eli Zaretskii
2015-05-11 13:06                                                                         ` Lars Magne Ingebrigtsen
2015-05-11 15:18                                                                           ` Eli Zaretskii
2013-06-27 13:20                                   ` bug#10304: " Michael Albinus
2013-06-27 17:11                                     ` Eli Zaretskii
2013-06-27 18:25                                       ` Michael Albinus
2013-07-09 10:39                                       ` Michael Albinus
2013-07-09 17:16                                         ` Eli Zaretskii
2013-07-10 17:04                                         ` Eli Zaretskii
2013-07-10 18:03                                           ` Michael Albinus
2013-06-24 20:18         ` bug#14704: 24.3.50; cl-lib breaks built-in Emacs version Juanma Barranquero
2013-06-25  2:11         ` Stefan Monnier
2013-06-24 18:16     ` Eli Zaretskii
2013-06-24 18:40       ` Sebastian Wiesner
2013-06-24 17:39 ` Glenn Morris
2013-06-24 17:52   ` Sebastian Wiesner
2013-06-25 16:27 ` Stefan Monnier

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=837gnhrm5b.fsf@gnu.org \
    --to=eliz@gnu.org \
    --cc=10304@debbugs.gnu.org \
    --cc=larsi@gnus.org \
    --cc=schwab@linux-m68k.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).