From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Stefan Monnier Newsgroups: gmane.emacs.devel Subject: Re: [Emacs-diffs] master 5c9304e: Disable some display optimizations when frames need redisplay Date: Sat, 03 Oct 2015 22:33:06 -0400 Message-ID: References: <20150930193450.11644.62040@vcs.savannah.gnu.org> <831tdd75i3.fsf@gnu.org> <83eghd5ff2.fsf@gnu.org> <83vbap3qxb.fsf@gnu.org> <83r3lc4du9.fsf@gnu.org> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: ger.gmane.org 1443926009 29169 80.91.229.3 (4 Oct 2015 02:33:29 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Sun, 4 Oct 2015 02:33:29 +0000 (UTC) Cc: emacs-devel@gnu.org To: Eli Zaretskii Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Sun Oct 04 04:33:20 2015 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1ZiZ6z-0001sr-Tq for ged-emacs-devel@m.gmane.org; Sun, 04 Oct 2015 04:33:18 +0200 Original-Received: from localhost ([::1]:40858 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZiZ6y-0003I7-Ov for ged-emacs-devel@m.gmane.org; Sat, 03 Oct 2015 22:33:16 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:58628) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZiZ6v-0003Hv-Di for emacs-devel@gnu.org; Sat, 03 Oct 2015 22:33:14 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ZiZ6u-0005cJ-0Z for emacs-devel@gnu.org; Sat, 03 Oct 2015 22:33:13 -0400 Original-Received: from ironport2-out.teksavvy.com ([206.248.154.181]:6889) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZiZ6p-0005YM-CM; Sat, 03 Oct 2015 22:33:07 -0400 X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: A0CaDQA731xV/3aQs2tcgxCEAsYTgk0EAgKBPDwRAQEBAQEBAYEKQQWDXQEBAwFWIwULCzQSFBgNJIg3CM8jAQEBAQEFAQEBAR6LOoUFB4QtBYUJlluZICOBZlWBWSKCeAEBAQ X-IPAS-Result: A0CaDQA731xV/3aQs2tcgxCEAsYTgk0EAgKBPDwRAQEBAQEBAYEKQQWDXQEBAwFWIwULCzQSFBgNJIg3CM8jAQEBAQEFAQEBAR6LOoUFB4QtBYUJlluZICOBZlWBWSKCeAEBAQ X-IronPort-AV: E=Sophos;i="5.13,465,1427774400"; d="scan'208";a="167296069" Original-Received: from 107-179-144-118.cpe.teksavvy.com (HELO fmsmemgm.homelinux.net) ([107.179.144.118]) by ironport2-out.teksavvy.com with ESMTP/TLS/DHE-RSA-AES256-SHA; 03 Oct 2015 22:33:06 -0400 Original-Received: by fmsmemgm.homelinux.net (Postfix, from userid 20848) id 7FD89AECF3; Sat, 3 Oct 2015 22:33:06 -0400 (EDT) In-Reply-To: <83r3lc4du9.fsf@gnu.org> (Eli Zaretskii's message of "Sat, 03 Oct 2015 10:21:18 +0300") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/25.0.50 (gnu/linux) X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 206.248.154.181 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:190838 Archived-At: > Tell you what: if you add commentary that describes the logic of using > these two variables, the window's and frame's 'redisplay' flags, and > how all those are used to decide which parts need to be redisplayed, > and if that commentary makes it clear that the code I added is > redundant, I will remove the code I added, and see if some alternative > design would be better. Deal? How do you like the patch below? Stefan diff --git a/src/xdisp.c b/src/xdisp.c index 1524783..439d9cb 100644 --- a/src/xdisp.c +++ b/src/xdisp.c @@ -434,22 +434,47 @@ static Lisp_Object Vmessage_stack; static bool message_enable_multibyte; -/* Nonzero if we should redraw the mode lines on the next redisplay. - If it has value REDISPLAY_SOME, then only redisplay the mode lines where - the `redisplay' bit has been set. Otherwise, redisplay all mode lines - (the number used is then only used to track down the cause for this - full-redisplay). */ +/* At each redisplay cycle, we should refresh everything there is to refresh. + To do that efficiently, we use many optimizations that try to make sure we + don't waste too much time updating things that haven't changed. + The coarsest such optimization is that, in the most common cases, we only + look at the selected-window. + + To know whether other windows should be considered for redisplay, we use the + variable windows_or_buffers_changed: as long as it is 0, it means that we + have not noticed anything that should require updating anything else than + the selected-window. If it is set to REDISPLAY_SOME, it means that since + last redisplay, some changes have been made which could impact other + windows. To know which ones need redisplay, every buffer, window, and frame + has a `redisplay' bit, which (if true) means that this object needs to be + redisplayed. If windows_or_buffers_changed is 0, we know there's no point + looking for those `redisplay' bits (actually, there might be some such bits + set, but then only on objects which aren't displayed anyway). + + Mostly for historical reasons, windows_or_buffers_changed can also take + other non-zero values. In that case, the precise value doesn't matter (it + encodes the cause of the setting but is only used for debugging purposes), + and what it means is that we shouldn't pay attention to any `redisplay' bits + and we should simply try and redisplay every since window out there. */ -int update_mode_lines; +int windows_or_buffers_changed; -/* Nonzero if window sizes or contents other than selected-window have changed - since last redisplay that finished. - If it has value REDISPLAY_SOME, then only redisplay the windows where - the `redisplay' bit has been set. Otherwise, redisplay all windows - (the number used is then only used to track down the cause for this - full-redisplay). */ +/* Nonzero if we should redraw the mode lines on the next redisplay. + Similarly to `windows_or_buffers_changed', If it has value REDISPLAY_SOME, + then only redisplay the mode lines in those buffers/windows/frames where the + `redisplay' bit has been set. + For any other value, redisplay all mode lines (the number used is then only + used to track down the cause for this full-redisplay). + + The `redisplay' bits are the same as those used for + windows_or_buffers_changed, and setting windows_or_buffers_changed also + causes recomputation of the mode lines of all those windows. IOW this + variable only has an effect if windows_or_buffers_changed is zero, in which + case we should only need to redisplay the mode-line of those objects with + a `redisplay' bit set but not the window's text content (tho we may still + need to refresh the text content of the selected-window). */ -int windows_or_buffers_changed; +int update_mode_lines; /* True after display_mode_line if %l was used and it displayed a line number. */