From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: YAMAMOTO Mitsuharu Newsgroups: gmane.emacs.devel Subject: Re: redisplay and expose_frame Date: Wed, 25 Jul 2018 18:33:35 +0900 Organization: Faculty of Science, Chiba University Message-ID: References: <20180722124418.GA8674@breton.holly.idiocy.org> <20180724204220.GA9687@breton.holly.idiocy.org> NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 (generated by SEMI-EPG 1.14.7 - "Harue") Content-Type: text/plain; charset=ISO-8859-7 Content-Transfer-Encoding: quoted-printable X-Trace: blaine.gmane.org 1532511187 15645 195.159.176.226 (25 Jul 2018 09:33:07 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Wed, 25 Jul 2018 09:33:07 +0000 (UTC) User-Agent: Wanderlust/2.15.9 (Almost Unreal) SEMI-EPG/1.14.7 (Harue) FLIM/1.14.9 (=?ISO-8859-4?Q?Goj=F2?=) APEL/10.8 EasyPG/1.0.0 Emacs/25.3 (x86_64-pc-linux-gnu) MULE/6.0 (HANACHIRUSATO) To: emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Wed Jul 25 11:33:02 2018 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by blaine.gmane.org with esmtp (Exim 4.84_2) (envelope-from ) id 1fiGAI-0003xs-N5 for ged-emacs-devel@m.gmane.org; Wed, 25 Jul 2018 11:33:02 +0200 Original-Received: from localhost ([::1]:47075 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fiGCM-00079U-AO for ged-emacs-devel@m.gmane.org; Wed, 25 Jul 2018 05:35:10 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:60274) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fiGCD-00078x-5w for emacs-devel@gnu.org; Wed, 25 Jul 2018 05:35:04 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fiGCA-0003Q5-6k for emacs-devel@gnu.org; Wed, 25 Jul 2018 05:35:01 -0400 Original-Received: from mathmail.math.s.chiba-u.ac.jp ([133.82.132.2]:59743) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fiGC9-0003Ij-Mr for emacs-devel@gnu.org; Wed, 25 Jul 2018 05:34:58 -0400 Original-Received: from mathent.math.s.chiba-u.ac.jp (mathent [192.168.32.5]) by mathmail.math.s.chiba-u.ac.jp (Postfix) with ESMTP id D5447F0906 for ; Wed, 25 Jul 2018 18:34:49 +0900 (JST) (envelope-from mituharu@math.s.chiba-u.ac.jp) In-Reply-To: <20180724204220.GA9687@breton.holly.idiocy.org> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 133.82.132.2 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.21 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" Xref: news.gmane.org gmane.emacs.devel:227794 Archived-At: On Wed, 25 Jul 2018 05:42:20 +0900, Alan Third wrote: > > > The background here is that I=A2m working on splitting the NS port=A2= s GUI > > > code into its own thread, and while working on that I noticed that > > > Apple have deprecated the method we use to draw, so I thought that > > > since I=A2m working with the code anyway, I may as well try to > > > =A1modernise=A2 it. > >=20 > > A related thread can be found around > > http://lists.gnu.org/archive/html/emacs-devel/2010-07/msg00821.html . >=20 > That=A2s interesting, and confirms some of what I=A2d thought. I take it > nothing ever came of it, though? AFAIK, nothing public. It's been difficult for me to tell how important the "expose" handler is to developers on other platforms (e.g., the thread starting from http://lists.gnu.org/archive/html/emacs-devel/2013-04/msg00392.html). > > Mojave, the next version of macOS, already prohibits drawing outside > > "drawRect:" by default if the executable was linked on that version. > > An attempt to draw outside "drawRect:" triggers invalidation of all > > the contents instead, and it is completely redrawn (even for a single > > cursor movement) via "drawRect:" at the next cycle of the event loop. > > This is kinda usable for small frames on recent machines, but not > > efficient of course, especially for full screen frames. >=20 > This doesn=A2t sound good, and I wonder if bug#31904 is related, > although it doesn=A2t sound like it should be. >=20 > Is the Mac port affected by this, or does it avoid this Cocoa stuff? There were several problems, but non-performance issues are mostly solved in the "work" branch of the Mac port repository (https://bitbucket.org/mituharu/emacs-mac). It now works as in a "kinda usable" way with the whole invalidation mentioned above. > I suppose, to avoid changes in redisplay code, I could make the NS > drawing functions detect whether they are running in the main thread > (or perhaps they can just ask whether they=A2re able to draw or not), > and if they=A2re not then invalidate the relevant rectangle, and if they > are then do the actual drawing task. >=20 > Then call display for each frame to force an expose =A1event=A2 at the end > of redisplay. Back in early 2007, I privately experimented something like that (without threading) with "modern Carbon" (HIWindow), where drawing outside the "expose" callback was deprecated like the current situation for Cocoa. I could actually find a platform-independent bug that was otherwise difficult to find/reproduce (http://lists.gnu.org/archive/html/emacs-devel/2007-04/msg01279.html) by this experiment, but the overall performance was not quite satisfactory then. So, I was surprised to see that (the "work" branch of) the Mac port with the whole invalidation was "kinda usable" on recent machines running Mojave. YAMAMOTO Mitsuharu mituharu@math.s.chiba-u.ac.jp