all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Eli Zaretskii <eliz@gnu.org>
To: Stefan <monnier@iro.umontreal.ca>
Cc: rudalics@gmx.at, christian@defun.dk, kanru@kanru.info,
	cloos@jhcloos.com, emacs-devel@gnu.org
Subject: Re: Redisplay problems?
Date: Thu, 20 Mar 2014 20:12:56 +0200	[thread overview]
Message-ID: <83siqc7n87.fsf@gnu.org> (raw)
In-Reply-To: <jwvfvmduk91.fsf-monnier+emacs@gnu.org>

> From: Stefan <monnier@iro.umontreal.ca>
> Date: Thu, 20 Mar 2014 08:45:59 -0400
> Cc: Christian Lynbech <christian@defun.dk>, James Cloos <cloos@jhcloos.com>,
> 	Kan-Ru Chen (陳侃如) <kanru@kanru.info>,
> 	emacs-devel@gnu.org
> 
> And of course, the frame's "garbaged" bit may not always be needed: if
> the frame was simply iconified+deiconified without any other change,
> there's no need to recompute matrices nor redraw anything, since it's
> pretty much the same as obscuring the frame with another and then
> exposing it again.

But exposing does require a kind of "redrawing", see below.

> I'm not 100% clear either, but my current understanding is that
> "garbaged" means that the frame needs to be fully redrawn in the
> following sense:
> 
> Normal redisplay takes place by first computing new matrices, then
> comparing the old matrices to the new matrices to discover what needs to
> be changed on screen, then redrawing the parts that have changed.

Your description is slightly inaccurate, and on top of that, you use
several keywords in confusingly overloaded senses, which makes this
discussion harder to understand.

So allow me first to set the stage by making the description more
accurate.

Redisplay includes 2 phases.  In the first phase, Emacs computes, for
every window, the desired glyph matrix, which describes what should be
on the display.  This stage includes some redisplay optimizations,
which can decide that certain portions of the display couldn't
possibly have changed, in which case the corresponding parts ("glyph
rows") of the desired matrix are marked "disabled".

In the second phase of redisplay, Emacs compares the desired matrix
with the "current matrix" (which was the desired matrix during the
previous redisplay cycle).  This stage also includes optimizations,
but of a different kind.  For each screen line, which corresponds to a
glyph row, Emacs redraws only the parts of that glyph row that are
different from the corresponding row of the current matrix, and it
also reuses what's on display as much as possible, even if they don't
match exactly.

Crucially, if the current matrix' glyph row is "disabled", the
corresponding screen line is redrawn in its entirety.  (If the desired
matrix' glyph row is "disabled", it is simply copied to the current
matrix without redrawing the line.)

When Emacs decides that some part of a glyph row needs to be redrawn,
it calls a function named draw_glyphs, which actually delivers the
glyphs to the glass by calling the display-specific back-end (xterm.c
etc.), after arranging the row's glyphs in "glyph strings", which make
the job easier for the back end.

> So "garbaged" means that we should not try to only redraw the parts that
> have changed.

When redisplay finds that a frame is "garbaged", it marks all of its
glyph matrix rows "disabled".  This will force their complete
redrawing, as described above.

> Note that the drawing that takes place in response to Expose events is
> not a "redraw": "redraw" is when a change inside Emacs causes a need to
> change the display, whereas expose events are due to changes outside
> of Emacs.

An expose event calls expose_frame, which walks the frame's window
tree, and redraws the part of each window that belongs to the exposed
rectangle.  This doesn't compute the glyph matrices at all, but just
calls draw_glyphs directly to redraw the portions of the glyph rows
that were exposed.  IOW, the existing current glyph matrix is used
without recomputing it.

> Part of the reason it's still fuzzy is that xdisp.c seems to recompute
> the matrices when it finds a "garbaged" frame, so it seems that it
> doesn't just cause it to "redraw".  I have the impression that this is
> a mistake in that it's more work than needed, and also in that some code
> relies on that behavior (i.e. it sets the bit to cause a complete
> redisplay+redraw).

I don't think I understand what you meant to say here.  But if you
were talking about what to do about a frame that was deiconified, I
think you need to call expose_frame, and arrange for the exposed
rectangle to cover the entire frame.  That should do what you want, no
more, no less.




  parent reply	other threads:[~2014-03-20 18:12 UTC|newest]

Thread overview: 90+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-03-10 20:37 Redisplay problems? Christian Lynbech
2014-03-13 20:34 ` Eli Zaretskii
2014-03-15 18:10 ` James Cloos
2014-03-18 10:48   ` Kan-Ru Chen (陳侃如)
2014-03-18 16:06     ` Eli Zaretskii
2014-03-18 16:17     ` Óscar Fuentes
2014-03-18 16:46       ` Eli Zaretskii
2014-03-18 16:53         ` Óscar Fuentes
2014-03-18 17:00           ` Christian Lynbech
2014-03-18 17:09           ` Eli Zaretskii
2014-03-18 21:18         ` Óscar Fuentes
2014-03-19  0:55           ` Kan-Ru Chen (陳侃如)
2014-03-20 17:59           ` Stefan
2014-03-20 19:37             ` Óscar Fuentes
2014-03-18 18:46     ` James Cloos
2014-03-19 16:26     ` martin rudalics
2014-03-19 18:04       ` Óscar Fuentes
2014-03-20  0:54         ` Stefan
2014-03-20  9:52           ` martin rudalics
2014-03-20 16:07             ` Glenn Morris
2014-03-20 19:23               ` martin rudalics
2014-03-20  4:46       ` Stefan
2014-03-20  9:52         ` martin rudalics
2014-03-20 12:45           ` Stefan
2014-03-20 14:01             ` Stefan
2014-03-20 17:22               ` Eli Zaretskii
2014-03-20 18:00                 ` Stefan
2014-03-20 18:19                   ` Eli Zaretskii
2014-03-20 18:12             ` Eli Zaretskii [this message]
2014-03-20 20:55               ` Stefan Monnier
2014-03-21  7:37                 ` Eli Zaretskii
2014-03-21 12:59                   ` Stefan
2014-03-21 16:12                     ` Eli Zaretskii
2014-03-21 19:31                       ` Stefan Monnier
2014-03-22  7:43                         ` Eli Zaretskii
2014-03-22 13:48                           ` Stefan
2014-03-22 13:53                             ` martin rudalics
2014-03-22 15:37                               ` Stefan
2014-03-22 14:29                             ` Eli Zaretskii
2014-03-22 15:42                               ` Stefan
2014-03-22 16:07                                 ` Eli Zaretskii
2014-03-22 18:43                                   ` Stefan
2014-03-22 19:08                                     ` Eli Zaretskii
2014-03-24  1:58                                       ` Stefan
2014-03-24  3:55                                         ` Eli Zaretskii
2014-03-24  8:32                                           ` David Kastrup
2014-03-24 16:58                                             ` Eli Zaretskii
2014-03-24 18:15                                               ` Stefan
2014-03-24 19:34                                                 ` Eli Zaretskii
2014-03-24 12:33                                           ` Stefan
2014-03-24 17:36                                             ` Eli Zaretskii
2014-03-24 18:07                                               ` Stefan
2014-03-24 19:30                                                 ` Eli Zaretskii
2014-03-24 20:43                                                   ` Stefan
2014-03-25  3:52                                                     ` Eli Zaretskii
2014-03-25 13:10                                                       ` Stefan Monnier
2014-03-26 15:28                                                         ` Eli Zaretskii
2014-03-27 13:55                                                           ` Stefan Monnier
2014-03-27 17:33                                                             ` Eli Zaretskii
2014-03-27 21:13                                                               ` Stefan Monnier
2014-03-28  7:15                                                                 ` Eli Zaretskii
     [not found]                                                       ` <<jwvzjkeqvcg.fsf-monnier+emacs@gnu.org>
     [not found]                                                         ` <<83d2h9yo5m.fsf@gnu.org>
2014-03-26 15:37                                                           ` Drew Adams
2014-03-22 19:13                                     ` Eli Zaretskii
2014-03-24  1:56                                       ` Stefan
2014-03-20 19:22             ` martin rudalics
2014-03-20 20:36               ` Eli Zaretskii
2014-03-21  8:03                 ` martin rudalics
2014-03-21  8:36                   ` Eli Zaretskii
2014-03-21  9:51                     ` martin rudalics
2014-03-21 10:29                       ` Eli Zaretskii
2014-03-22  2:00                         ` Kan-Ru Chen (陳侃如)
2014-03-22  2:37                           ` Stefan Monnier
2014-03-22  3:38                             ` Kan-Ru Chen (陳侃如)
2014-03-22  7:28                           ` Eli Zaretskii
2014-03-21 13:08                     ` Stefan
2014-03-21 16:19                       ` Eli Zaretskii
2014-03-21 19:42                         ` Stefan Monnier
2014-03-22  7:49                           ` Eli Zaretskii
2014-03-22 13:56                             ` Stefan
2014-03-22 14:50                               ` Eli Zaretskii
2014-03-20 21:00               ` Stefan Monnier
2014-03-21  7:41                 ` Eli Zaretskii
2014-03-21 13:02                   ` Stefan
2014-03-21 16:13                     ` Eli Zaretskii
2014-03-21 19:39                       ` Stefan Monnier
2014-03-22  7:47                         ` Eli Zaretskii
2014-03-22 13:49                           ` Stefan
2014-03-22 14:29                             ` Eli Zaretskii
2014-03-20 16:19         ` Eli Zaretskii
2014-03-27 21:17 ` Christian Lynbech
     [not found] <<m2bnxdg58p.fsf@defun.dk>

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

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

  git send-email \
    --in-reply-to=83siqc7n87.fsf@gnu.org \
    --to=eliz@gnu.org \
    --cc=christian@defun.dk \
    --cc=cloos@jhcloos.com \
    --cc=emacs-devel@gnu.org \
    --cc=kanru@kanru.info \
    --cc=monnier@iro.umontreal.ca \
    --cc=rudalics@gmx.at \
    /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 external index

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

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.