=?gb2312?B?tPC4tDogd2h5IG5vdCBlbXB0eSB0aGUgc2NyYXRjaCBpbWFnZSB3aGVuIGY=?= =?gb2312?B?bHVzaF9hbGxfZGlzcGxheXM=?=

XFlush will just flush the buffers, while XSync will also get a reply from server, besides flushing the buffers. XSync would cause a "round trip", and be slower over network. We use XSync before recycling Scratch images, so that we could be sure that all drawing operations on the shared XImage/Pixmap were finished. Is that right?



> -----邮件原件-----

> 发件人: Owen Taylor [mailto:otaylor redhat com]

> 发送时间: 2006年11月13 22:18

> 收件人: jianjun.yang

> 抄送: gtk-devel-list gnome org

> 主题: Re: why not empty the scratch image when flush_all_displays


> On Mon, 2006-11-13 at 20:28 +0800, jianjun.yang wrote:

> > Hi All,

> >

> >

> >

> > When gdk_window_process_all_updates, flush_all_displays is invoked.

> > Then all the drawing commands are sent to server. Meanwhile, I think

> > the contents of the scratch image corresponding current display are no

> > longer useful, and should be thrown away. Otherwise, it may increase

> > the frequency of invoking to gdk_flush while alloc_scratch_image. So I

> > add the gdk_scratch_image_reset to gdk_window_process_all_updates.


> gdk_display_flush() [what flush_all_displays() does] actually calls

> XFlush(), unlike gdk_flush(), which for weird historical reasons

> calls XSync.


> Scratch images can only be recycled after XSync(), not after XFlush().


> (To reduce the calls to XSync() used with the scratch image cache you

> *could* watch for XShmCompletionEvent, though I don't think the

> improvement would be that big.)


>                      - Owen


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]