<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	xmlns:georss="http://www.georss.org/georss" xmlns:geo="http://www.w3.org/2003/01/geo/wgs84_pos#" xmlns:media="http://search.yahoo.com/mrss/"
	>

<channel>
	<title>Tiago Vignatti &#187; x11</title>
	<atom:link href="http://vignatti.wordpress.com/tag/x11/feed/" rel="self" type="application/rss+xml" />
	<link>http://vignatti.wordpress.com</link>
	<description>In The Eyes Of The World</description>
	<lastBuildDate>Mon, 09 Nov 2009 01:47:17 +0000</lastBuildDate>
	<generator>http://wordpress.com/</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<cloud domain='vignatti.wordpress.com' port='80' path='/?rsscloud=notify' registerProcedure='' protocol='http-post' />
<image>
		<url>http://www.gravatar.com/blavatar/33cb7ca85d43793f113cab97fc6c2cd1?s=96&#038;d=http://s.wordpress.com/i/buttonw-com.png</url>
		<title>Tiago Vignatti &#187; x11</title>
		<link>http://vignatti.wordpress.com</link>
	</image>
	<atom:link rel="search" type="application/opensearchdescription+xml" href="http://vignatti.wordpress.com/osd.xml" title="Tiago Vignatti" />
		<item>
		<title>multiseat with multiple X servers (or &#8220;the right way&#8221;)</title>
		<link>http://vignatti.wordpress.com/2009/07/24/multiseat-with-multiple-x-servers-or-the-right-way/</link>
		<comments>http://vignatti.wordpress.com/2009/07/24/multiseat-with-multiple-x-servers-or-the-right-way/#comments</comments>
		<pubDate>Fri, 24 Jul 2009 13:56:33 +0000</pubDate>
		<dc:creator>vignatti</dc:creator>
				<category><![CDATA[Computing]]></category>
		<category><![CDATA[arbiter]]></category>
		<category><![CDATA[multiseat]]></category>
		<category><![CDATA[multiterminal]]></category>
		<category><![CDATA[rac]]></category>
		<category><![CDATA[vga]]></category>
		<category><![CDATA[vignatti]]></category>
		<category><![CDATA[x11]]></category>
		<category><![CDATA[xorg]]></category>
		<category><![CDATA[xserver]]></category>

		<guid isPermaLink="false">http://vignatti.wordpress.com/?p=80</guid>
		<description><![CDATA[So last week I posted on lkml an old patch that we were carrying for a long time in the Linux community. It basically brings the multiple (old) video cards functionally again on Linux and X server (and this time doing on the right and beauty way). For the people that was following multiseat implementations, [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=vignatti.wordpress.com&blog=769537&post=80&subd=vignatti&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p>So last week I <a href="http://lkml.org/lkml/2009/7/16/243">posted</a> on lkml an old patch that we were carrying for a long time in the Linux community. It basically brings the multiple (old) video cards functionally again on Linux and X server (and this time doing on the right and beauty way). For the people that was following multiseat implementations, this is a HUGE step: we will finally be able to discard the old and ugly hack (a mix of Xorg, several Xephyr servers + evdev) and and go to a clean way, starting multiple X servers in parallel. Cool! Well, not that much, because it might take some time to be in your beloved distribution :)</p>
<p>It&#8217;s too early and I don&#8217;t know if it&#8217;s recommended to say this, but if you want to give a try basically you have to get all X components, this <a href="http://people.freedesktop.org/~vignatti/vgaarb/">X server patches</a>, my <a href="http://cgit.freedesktop.org/~vignatti/libpciaccess/">libpciaccess</a> and Dave&#8217;s <a href="http://people.freedesktop.org/~airlied/vgaarb/">kernel patchset</a>. Again: it&#8217;s a <strong>very</strong> unstable work!</p>
<p>If you&#8217;re concerned with the technical explanations then you can follow the <a href="http://airlied.livejournal.com/67628.html">nice memo</a> that Dave wrote about this.</p>
  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/vignatti.wordpress.com/80/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/vignatti.wordpress.com/80/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/vignatti.wordpress.com/80/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/vignatti.wordpress.com/80/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/vignatti.wordpress.com/80/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/vignatti.wordpress.com/80/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/vignatti.wordpress.com/80/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/vignatti.wordpress.com/80/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/vignatti.wordpress.com/80/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/vignatti.wordpress.com/80/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=vignatti.wordpress.com&blog=769537&post=80&subd=vignatti&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://vignatti.wordpress.com/2009/07/24/multiseat-with-multiple-x-servers-or-the-right-way/feed/</wfw:commentRss>
		<slash:comments>9</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/c80e0b79eb21bbd134add2362d74f4ce?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">vignatti</media:title>
		</media:content>
	</item>
		<item>
		<title>Parallel events (panic) with X</title>
		<link>http://vignatti.wordpress.com/2008/08/18/parallel-events-panic-with-x/</link>
		<comments>http://vignatti.wordpress.com/2008/08/18/parallel-events-panic-with-x/#comments</comments>
		<pubDate>Mon, 18 Aug 2008 22:02:16 +0000</pubDate>
		<dc:creator>vignatti</dc:creator>
				<category><![CDATA[Computing]]></category>
		<category><![CDATA[SoC2008]]></category>
		<category><![CDATA[event]]></category>
		<category><![CDATA[gdb sucks]]></category>
		<category><![CDATA[input]]></category>
		<category><![CDATA[thread]]></category>
		<category><![CDATA[x11]]></category>
		<category><![CDATA[xorg]]></category>

		<guid isPermaLink="false">http://vignatti.wordpress.com/?p=49</guid>
		<description><![CDATA[Unfortunately that model which I described some weeks ago to put the input event delivery of the X server in a separate thread wouldn&#8217;t be an advantage. I precipitated myself thinking that it could be feasible. Sorry :(
I started to implement all this but it showed a very boring task to grab all the globals [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=vignatti.wordpress.com&blog=769537&post=49&subd=vignatti&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p>Unfortunately that model which I <a href="http://vignatti.wordpress.com/2008/08/07/keep-it-going/">described some weeks ago</a> to put the input event delivery of the X server in a separate thread wouldn&#8217;t be an advantage. I precipitated myself thinking that it could be feasible. Sorry :(</p>
<p>I started to implement all this but it showed a very boring task to grab all the globals variables which both threads touch and to lock it. So I decided to stop going in this way. It&#8217;s hard to program thinking in parallel. It&#8217;s even harder to debug a program with severals flows. More, the tools don&#8217;t help you (if you have lucky, gdb will work).</p>
<p>But the main reason I can argue to stop with this model is that the &#8220;main&#8221; event flow of execution (i.e. basically all the functions in {Swapped,}ProcVector) and the input delivery flow (ProcessInputEvents()) are very very tied. Both deal a lot with clients and we&#8217;d need to lock several globals, thus spending a lot of time in the management of the threads. It&#8217;s easy to see this acting: just put a breakpoint in TryClientEvents(). Every single request to deliver a given event to a given client involves this function. And both input and main event flow will call TryClientEvents(). So you will see a zillion of times this function being called. The contention of the eventual processing and main threads would be even greater if the client choose to receive MotionNotify event.</p>
<p>So yeah, it&#8217;s far from be clear how to put processing of input events inside another thread.</p>
<p>== Next ==</p>
<p>In the next days I&#8217;ll be traveling to <a href="http://www.cesol.ufc.br/">CESol</a>, Fortaleza here in Brazil. I was invited to talk about my work in X land. Latin America has a lot of promising countries concerning FOSS development however for some reason no one actively participate and contribute for the X development (why?). I&#8217;ll try to motivate people there somehow :)</p>
<p>In the next week I&#8217;ll put the generation thread in a shape good enough to eventually push this to upstream. Also I&#8217;ll try to write a good sumary of all my work given that GSoC is in the end.</p>
<img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/vignatti.wordpress.com/49/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/vignatti.wordpress.com/49/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/vignatti.wordpress.com/49/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/vignatti.wordpress.com/49/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/vignatti.wordpress.com/49/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/vignatti.wordpress.com/49/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/vignatti.wordpress.com/49/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/vignatti.wordpress.com/49/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/vignatti.wordpress.com/49/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/vignatti.wordpress.com/49/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/vignatti.wordpress.com/49/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/vignatti.wordpress.com/49/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=vignatti.wordpress.com&blog=769537&post=49&subd=vignatti&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://vignatti.wordpress.com/2008/08/18/parallel-events-panic-with-x/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/c80e0b79eb21bbd134add2362d74f4ce?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">vignatti</media:title>
		</media:content>
	</item>
		<item>
		<title>Priorities and scheduling hints for X server threads</title>
		<link>http://vignatti.wordpress.com/2008/08/07/priorities-and-scheduling-hints-for-x-server-threads/</link>
		<comments>http://vignatti.wordpress.com/2008/08/07/priorities-and-scheduling-hints-for-x-server-threads/#comments</comments>
		<pubDate>Thu, 07 Aug 2008 23:33:57 +0000</pubDate>
		<dc:creator>vignatti</dc:creator>
				<category><![CDATA[Computing]]></category>
		<category><![CDATA[input]]></category>
		<category><![CDATA[policy]]></category>
		<category><![CDATA[priority]]></category>
		<category><![CDATA[scheduler]]></category>
		<category><![CDATA[SoC2008]]></category>
		<category><![CDATA[thread]]></category>
		<category><![CDATA[vignatti]]></category>
		<category><![CDATA[x11]]></category>
		<category><![CDATA[xorg]]></category>
		<category><![CDATA[xserver]]></category>

		<guid isPermaLink="false">http://vignatti.wordpress.com/?p=44</guid>
		<description><![CDATA[Input events routed through another thread/process can have bad effects on latency because we can&#8217;t guarantee that it will get scheduled at the right moment. Although this is hard to see happening with the current X server threaded implementation, we must design something to avoid it. One way to improve the responsiveness is to give [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=vignatti.wordpress.com&blog=769537&post=44&subd=vignatti&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p>Input events routed through another thread/process can have bad effects on latency because we can&#8217;t guarantee that it will get scheduled at the right moment. Although this is hard to see happening with the current X server threaded implementation, we must design something to avoid it. One way to improve the responsiveness is to give a high priority to the input thread and also adjust the CPU scheduling. (Note that this will not avoid problems related with <a href="http://vignatti.wordpress.com/2007/08/10/mlocking-adventure/">page faults</a> which usually happen in the X input flow.)</p>
<p>Linux uses 1:1 thread model and the scheduler handles every thread as a process. For now I don&#8217;t care about others systems. Both input generation and processing threads was designed to sleep after a relatively short CPU run. So we can give a priority to processes that are trusted to not hog the CPU. And given they are special time-critical applications I have no doubt in what policy to use: I set both input threads to use the real-time FIFO policy and to get the maximum priority (sched_get_priority_max()).</p>
<p>&#8212;</p>
<p>I&#8217;m sure that someone will complain telling that this would decrease a bit the main thread when used together with both input threads. In GUI we&#8217;re talking about better user experience. Latency variability must be avoided whenever possible in interactive situations. What the user <strong><em>see</em></strong> is what matters. For non-interactive processes (server scheduling workloads) the situation is totally different.</p>
<p>Xorg&#8217;s philosophy is to be portable so we have to take care when setting this kind of parameters. It is a complex issue and different systems do it in wildly different ways. I was using my Linux box (2.6.24) to design it all.</p>
<img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/vignatti.wordpress.com/44/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/vignatti.wordpress.com/44/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/vignatti.wordpress.com/44/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/vignatti.wordpress.com/44/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/vignatti.wordpress.com/44/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/vignatti.wordpress.com/44/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/vignatti.wordpress.com/44/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/vignatti.wordpress.com/44/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/vignatti.wordpress.com/44/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/vignatti.wordpress.com/44/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/vignatti.wordpress.com/44/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/vignatti.wordpress.com/44/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=vignatti.wordpress.com&blog=769537&post=44&subd=vignatti&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://vignatti.wordpress.com/2008/08/07/priorities-and-scheduling-hints-for-x-server-threads/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/c80e0b79eb21bbd134add2362d74f4ce?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">vignatti</media:title>
		</media:content>
	</item>
		<item>
		<title>keep it going&#8230;</title>
		<link>http://vignatti.wordpress.com/2008/08/07/keep-it-going/</link>
		<comments>http://vignatti.wordpress.com/2008/08/07/keep-it-going/#comments</comments>
		<pubDate>Thu, 07 Aug 2008 23:22:27 +0000</pubDate>
		<dc:creator>vignatti</dc:creator>
				<category><![CDATA[Computing]]></category>
		<category><![CDATA[SoC2008]]></category>
		<category><![CDATA[google]]></category>
		<category><![CDATA[input]]></category>
		<category><![CDATA[soc]]></category>
		<category><![CDATA[thread]]></category>
		<category><![CDATA[vignatti]]></category>
		<category><![CDATA[x11]]></category>
		<category><![CDATA[xorg]]></category>

		<guid isPermaLink="false">http://vignatti.wordpress.com/?p=40</guid>
		<description><![CDATA[Given that GSoC &#8216;08 is getting close to the end, strategy number 2 showed more feasible to proceed my work. Strategy #3 would be a lot of fun but would imply a hell massive codification as well (also a little out of our scope). Unfortunately no-no for now.
       <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=vignatti.wordpress.com&blog=769537&post=40&subd=vignatti&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p>Given that GSoC &#8216;08 is getting close to the end, <a href="http://vignatti.wordpress.com/2008/07/29/improving-input-latency/">strategy number 2</a> showed more feasible to proceed my work. Strategy #3 would be a lot of fun but would imply a hell massive codification as well (also a little out of <a href="http://vignatti.wordpress.com/2008/04/29/google-summer-of-code-2008/">our scope</a>). Unfortunately no-no for now.</p>
<img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/vignatti.wordpress.com/40/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/vignatti.wordpress.com/40/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/vignatti.wordpress.com/40/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/vignatti.wordpress.com/40/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/vignatti.wordpress.com/40/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/vignatti.wordpress.com/40/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/vignatti.wordpress.com/40/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/vignatti.wordpress.com/40/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/vignatti.wordpress.com/40/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/vignatti.wordpress.com/40/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/vignatti.wordpress.com/40/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/vignatti.wordpress.com/40/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=vignatti.wordpress.com&blog=769537&post=40&subd=vignatti&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://vignatti.wordpress.com/2008/08/07/keep-it-going/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/c80e0b79eb21bbd134add2362d74f4ce?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">vignatti</media:title>
		</media:content>
	</item>
		<item>
		<title>Improving input latency</title>
		<link>http://vignatti.wordpress.com/2008/07/29/improving-input-latency/</link>
		<comments>http://vignatti.wordpress.com/2008/07/29/improving-input-latency/#comments</comments>
		<pubDate>Wed, 30 Jul 2008 01:09:31 +0000</pubDate>
		<dc:creator>vignatti</dc:creator>
				<category><![CDATA[Computing]]></category>
		<category><![CDATA[SoC2008]]></category>
		<category><![CDATA[evdev]]></category>
		<category><![CDATA[GUI]]></category>
		<category><![CDATA[input]]></category>
		<category><![CDATA[kernel]]></category>
		<category><![CDATA[latency]]></category>
		<category><![CDATA[linux]]></category>
		<category><![CDATA[mouse]]></category>
		<category><![CDATA[thread]]></category>
		<category><![CDATA[vignatti]]></category>
		<category><![CDATA[x]]></category>
		<category><![CDATA[x11]]></category>
		<category><![CDATA[xorg]]></category>

		<guid isPermaLink="false">http://vignatti.wordpress.com/?p=33</guid>
		<description><![CDATA[GSoC summary #1 &#8211; July 29
The current implementation of X Window System relies in a signal scheme  to manage the input event coming from hardware devices. This scheme  frequently get blocked when lot of IO is occurring (for instance, when  the process is swapping in/out). Get blocked means for instance a  [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=vignatti.wordpress.com&blog=769537&post=33&subd=vignatti&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p>GSoC summary #1 &#8211; July 29</p>
<p>The current implementation of X Window System relies in a signal scheme  to manage the input event coming from hardware devices. This scheme  frequently get blocked when lot of IO is occurring (for instance, when  the process is swapping in/out). Get blocked means for instance a  jumping cursor on the screen and in GUI is always desirable to  prioritize the system responsiveness for end users. The human/computer  interface should be smooth and this is the most user visible aspect of a  system.</p>
<p>Besides the need for improvement in system responsiveness, the current  design of the event stream has some oddities, probably due historical  reasons, such as the cursor update done in user-space or the huge path  that takes to draw the cursor instead just connect the mouse hardware  directly with the cursor position update in-kernel. Moreover there is no  fundamental reason to input drivers be dependent of DDX part of the X  server. Therefore a design of the input subsystem must be carefully  redone to improve such issues.</p>
<p>Our project try to solve all this problems. In summary the goal is: to  get a path from hardware input event to client delivery that cannot be  blocked by rendering or IO operations, meaning we always have very low  latency on input events. Moreover, a redesign of such event stream could  improve the overall X graphics stack, which must be considered as well.</p>
<p>So far three strategies were explored to achieve the goal:</p>
<p>1. put X input generation stage in a separate thread</p>
<p>2. put X input generation and processing stages others threads</p>
<p>3. shortcut the kernel input layer with drm to decrease the cursor  update latency</p>
<p>Basically 1. and 2. tries to solve the issue of blocking signals and 3.  would be a completely redesign in input infrastructure. Anyway, the 3.  strategy would impact in 1. and 2. but these could be implemented in  parallel with the third strategy. The following sections details each  strategy.</p>
<p>== strategy #1 ==</p>
<p>Strategy 1 does not uses a signal handler anymore to wake up the event generation code. It simply poll for device&#8217;s socket and giving that this  code is under a separate thread this is a win for the CPUs.</p>
<p>With the separate thread taking care only the input code, it was  expected that the cursor footprint always lived on resident memory when  the mouse stills in movement. Unfortunately this was not true. For some  reason it swaps back to disk. Maybe some scheduler adjusts would help  here. A memory lock scheme was tried to do lock the cursor footprint  always in physical memory without success.</p>
<p>This strategy is basically what we&#8217;ve been done is the first GSoC. This  is pretty much implemented. It would not require much trouble to push it  to X server from upstream. The code is here:<br />
<a class="moz-txt-link-freetext" href="http://cgit.freedesktop.org/%7Evignatti/xserver/">http://cgit.freedesktop.org/~vignatti/xserver/</a></p>
<p>== strategy #2 ==</p>
<p>This strategy can be thought as an improvement of #1. It can be  separated in two models of implementation:</p>
<p>Model one:</p>
<p>thread #1 deals with<br />
- injection and processing of input events<br />
thread #2 deals with<br />
- requests from known clients<br />
- new client that tries to connect</p>
<p>It would be very very nice to let both threads totally independents. But  we cannot. The event delivery depends on window structure and the first  thread must always wake up the second. Also, sometimes the processing of  events take a while and the injection of events stays stucked in this  model. So we came with this another:</p>
<p>Model two:</p>
<p>thread #1 deals with<br />
- injection of input events from devices<br />
thread #2 deals with<br />
- processing of input events to clients<br />
thread #3 deals with<br />
- requests from known clients<br />
- new client that tries to connect</p>
<p>With this model the first and the second thread become not so tied and  given that we&#8217;re using non blocking fds to wake up each thread (through  a pipe), CPU &#8220;enjoys&#8221; the effect of threads. For instance, under heavy  drawing primitives only thread #3 would wake up.</p>
<p>We had a proof-of-concept of this last model and it workish  (occasionally seeing some segfaults probably due of some critical  regions we forgot to lock &#8211; now the only mutex that exists is inside the  server queue of events).</p>
<p>It&#8217;s hard to imagine other threaded models mainly because the way X  deals with clients are very tied in every piece of the server and it  would require a lot of mutexes.</p>
<p>== strategy #3 ==</p>
<p>For sure this strategy is the most shocking one :) The idea is to  connect the mouse hardware directly to the cursor position update  function, all inside kernel. We&#8217;d then rewrite the event stream from the  pointer device to an absolute position. Transform the relative mouse  motion into an absolute screen position seems to be not that  complicated, but this strategy would involve acceleration and cursor  limits inside kernel as well (the current implementation of accel deals  with floats, so we would have to adapt it to live in kernel).</p>
<p>It is a <span class="moz-txt-underscore"><span class="moz-txt-tag">_</span>very<span class="moz-txt-tag">_</span></span> <span class="moz-txt-underscore"><span class="moz-txt-tag">_</span>large<span class="moz-txt-tag">_</span></span> amount of codification. It would require changes  to the X server, DDX driver and its corresponding kernel DRM drivers,  drm library and kernel input drivers. A mini-input driver <strong class="moz-txt-star"><span class="moz-txt-tag">*</span>inside<span class="moz-txt-tag">*</span></strong> drm  is also needed. We would add complexities of the connection between  input device and output device to the kernel (in my proof-of-concept  implementation evdev is dependent of drm. Yeah, really weird world).  Moreover, we would have to avoid somehow two differents sets of the  exact same code in different contexts in the case of sw cursors (think  MPX). It&#8217;s a completely redesign. Things would have to go incrementally.</p>
<p>But why this strategy? Well, this would solve all the current issues  with input latency. For instance with the current design of the kernel  modesetting &#8211; which seems the future &#8211; the cursor is jumping a lot, much  more than with current implementation. Try to call a xrandr instance and  move the mouse with kernel modesetting. xrandr will do DDC communication  which will blocked X in the kernel. So with the handling and update of  the cursor inside the kernel all would work fine (and my  proof-of-concept already showed this).</p>
<p>Moreover, I believe the current implementation remained until now due historical reasons. Ultrix systems placed the entire input subsystem in  the kernel. What is the problem to do this in Linux (and others) as well (besides massive codification)?</p>
<p>and non-dri drivers? Should we forget them?</p>
<p>EOF</p>
<img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/vignatti.wordpress.com/33/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/vignatti.wordpress.com/33/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/vignatti.wordpress.com/33/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/vignatti.wordpress.com/33/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/vignatti.wordpress.com/33/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/vignatti.wordpress.com/33/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/vignatti.wordpress.com/33/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/vignatti.wordpress.com/33/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/vignatti.wordpress.com/33/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/vignatti.wordpress.com/33/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/vignatti.wordpress.com/33/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/vignatti.wordpress.com/33/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=vignatti.wordpress.com&blog=769537&post=33&subd=vignatti&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://vignatti.wordpress.com/2008/07/29/improving-input-latency/feed/</wfw:commentRss>
		<slash:comments>10</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/c80e0b79eb21bbd134add2362d74f4ce?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">vignatti</media:title>
		</media:content>
	</item>
		<item>
		<title>cursor handling and updates inside DRM</title>
		<link>http://vignatti.wordpress.com/2008/07/10/cursor-handling-and-updates-inside-drm/</link>
		<comments>http://vignatti.wordpress.com/2008/07/10/cursor-handling-and-updates-inside-drm/#comments</comments>
		<pubDate>Thu, 10 Jul 2008 07:03:49 +0000</pubDate>
		<dc:creator>vignatti</dc:creator>
				<category><![CDATA[Computing]]></category>
		<category><![CDATA[SoC2008]]></category>
		<category><![CDATA[cursor]]></category>
		<category><![CDATA[drm]]></category>
		<category><![CDATA[handling]]></category>
		<category><![CDATA[kernel]]></category>
		<category><![CDATA[mouse]]></category>
		<category><![CDATA[update]]></category>
		<category><![CDATA[x server]]></category>
		<category><![CDATA[x11]]></category>

		<guid isPermaLink="false">http://vignatti.wordpress.com/?p=31</guid>
		<description><![CDATA[The current DRM kernel modesetting tree is already taking care to update the cursor registers and paint it to the screen. Very cool [0].
What I&#8217;ve done today is a shortcut between the kernel input layer and DRM to update the cursor directly on screen without the X server be notified always. Of course, a lot [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=vignatti.wordpress.com&blog=769537&post=31&subd=vignatti&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p>The current DRM kernel modesetting tree is already taking care to update the cursor registers and paint it to the screen. Very cool [0].</p>
<p>What I&#8217;ve done today is a shortcut between the kernel input layer and DRM to update the cursor directly on screen without the X server be notified always. Of course, a lot of issues raised up together. So let&#8217;s try to delegates the tasks again.</p>
<p><strong>userspace app (X server):</strong><br />
- starts all this mechanism telling which is the device responsible for the cursor (input ddx drv)<br />
- responsible for loading new cursor images and push to the DRM (video ddx drv)</p>
<p><strong>kernel input layer (evdev driver):</strong><br />
- notify and send its relative coordinates events to DRM</p>
<p><strong>DRM:</strong><br />
- transform relative motion into absolute<br />
- takes care the cursor limits<br />
- responsible for the acceleration computation<br />
- responsible for the input transformation as well?<br />
- touch the gfx registers.</p>
<p>Seems that a reasonable amount of code in ddx input drv (mainly ReadInput) and dix (mainly GetPointerEvents) would be &#8220;swallowed&#8221; by the DRM. The &#8220;event generation stage&#8221; of the server would deal with the event itself + xkb + Xi things (which eventually could be done in a dedicated thread) and will let to DRM the responsibility of paint the cursor on screen.</p>
<p>The communication between kernel input drv can be directly, calling a DRM function; the DRM and userspace can communicate basically using ioctls. Complains?</p>
<p>This would only works with DRM supporting OSes. What about the others?</p>
<p>[0]  Not so much. Seems this method to update the cursor is sending _a lot of_ ioctls and sometimes doing cursor jumps. But I have to double check to see if the problem is for sure with context switches.</p>
<img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/vignatti.wordpress.com/31/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/vignatti.wordpress.com/31/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/vignatti.wordpress.com/31/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/vignatti.wordpress.com/31/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/vignatti.wordpress.com/31/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/vignatti.wordpress.com/31/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/vignatti.wordpress.com/31/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/vignatti.wordpress.com/31/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/vignatti.wordpress.com/31/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/vignatti.wordpress.com/31/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/vignatti.wordpress.com/31/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/vignatti.wordpress.com/31/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=vignatti.wordpress.com&blog=769537&post=31&subd=vignatti&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://vignatti.wordpress.com/2008/07/10/cursor-handling-and-updates-inside-drm/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/c80e0b79eb21bbd134add2362d74f4ce?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">vignatti</media:title>
		</media:content>
	</item>
		<item>
		<title>to thread the X server (?)</title>
		<link>http://vignatti.wordpress.com/2008/06/17/to-thread-the-x-server/</link>
		<comments>http://vignatti.wordpress.com/2008/06/17/to-thread-the-x-server/#comments</comments>
		<pubDate>Tue, 17 Jun 2008 23:39:53 +0000</pubDate>
		<dc:creator>vignatti</dc:creator>
				<category><![CDATA[Computing]]></category>
		<category><![CDATA[SoC2008]]></category>
		<category><![CDATA[gdb]]></category>
		<category><![CDATA[multi-thread]]></category>
		<category><![CDATA[server]]></category>
		<category><![CDATA[thread]]></category>
		<category><![CDATA[x11]]></category>
		<category><![CDATA[xorg]]></category>

		<guid isPermaLink="false">http://vignatti.wordpress.com/?p=30</guid>
		<description><![CDATA[I really don&#8217;t like to read large blog posts. Anyway&#8230;
What I did so far is a separated thread that takes care only the injection stage on the X server queue. Who is interested with the results, please read some past posts in my blog. It is currently in a very good shape (synced with post-mpx [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=vignatti.wordpress.com&blog=769537&post=30&subd=vignatti&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p>I really don&#8217;t like to read large blog posts. Anyway&#8230;</p>
<p>What I did so far is a separated thread that takes care only the injection stage on the X server queue. Who is interested with the results, please read some past posts in my blog. It is currently in a very good shape (synced with post-mpx merge, all input devices are inside the thread and etc). The implementation looks like this:<br />
<code><br />
thread #1 deals with<br />
    - injection of input events from devices<br />
thread #2 deals with<br />
    - processing of input events to clients<br />
    - requests from known clients (rendering things)<br />
    - new client that tries to connect (pretty easy to do)<br />
</code></p>
<p>Now I am pondering the following:<br />
Model one:<br />
<code><br />
thread #1 deals with<br />
    - injection and processing of input events<br />
thread #2 deals with<br />
    - requests from known clients<br />
    - new client that tries to connect<br />
</code></p>
<p>It would be very very nice to let both threads totally independents. But we cannot. The event delivery depends on the window structure and the first thread must always wake up the second. Also, sometimes the processing of events take a while and the injection of events stays stucked in this model. So I came with this another:</p>
<p>Model two:<br />
<code><br />
thread #1 deals with<br />
    - injection of input events from devices<br />
thread #2 deals with<br />
    - processing of input events to clients<br />
thread #3 deals with<br />
    - requests from known clients<br />
    - new client that tries to connect<br />
</code></p>
<p>With this way the first and the second thread become not so tied and given that I&#8217;m using non blocking fds to wake up each thread (through a pipe), the server &#8220;enjoys&#8221; the effect of threads. For instance, under heavy drawing primitives only thread #3 would wake up.</p>
<p>Well, I had implemented both models here and it workish (occasionally seeing some segfaults probably due of some critical regions I forgot to lock &#8212; now the only mutex that exists is inside the server queue of events).</p>
<p>It&#8217;s hard to imagine other models mainly because the way X deals with clients are very tied in every piece of the server and it would require a lot of mutexes. But I&#8217;d love to hear anyone disagreeing with this and proposing something here!</p>
<p>=== What make things so hard ===</p>
<p>Debug a multi-thread program is really tedious, consequentially work in this kind of environment as well. And that could be a great argument to not accept an X server multi-threaded in upstream some day.</p>
<p>The thing that most pissing me off is how gdb sucks to debug the server. I&#8217;m using the last version of gdb (6.8 version and from <a href="ftp://sourceware.org/pub/gdb/snapshots/current/gdb-weekly-6.8.50.20080617.tar.bz2"> today&#8217;s snapshot</a>) and it often hard lock my machine (I&#8217;m sure I had to reboot my machine a least 20 times today&#8230;sigh.) Sometimes it consumes 99% of CPU and sometimes it completely hangs my machine. Yes, this is really boring. Anyone knows some magic parameters in gdb to avoid this hard lock up? Anyway, the goal for long term is to let an option &#8212; at compilation time &#8212; to not use the input thread.</p>
<p>Comments?</p>
<img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/vignatti.wordpress.com/30/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/vignatti.wordpress.com/30/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/vignatti.wordpress.com/30/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/vignatti.wordpress.com/30/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/vignatti.wordpress.com/30/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/vignatti.wordpress.com/30/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/vignatti.wordpress.com/30/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/vignatti.wordpress.com/30/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/vignatti.wordpress.com/30/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/vignatti.wordpress.com/30/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/vignatti.wordpress.com/30/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/vignatti.wordpress.com/30/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=vignatti.wordpress.com&blog=769537&post=30&subd=vignatti&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://vignatti.wordpress.com/2008/06/17/to-thread-the-x-server/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/c80e0b79eb21bbd134add2362d74f4ce?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">vignatti</media:title>
		</media:content>
	</item>
		<item>
		<title>Traversing X11 clients behind NAT (or X11 end-to-end connectivity)</title>
		<link>http://vignatti.wordpress.com/2008/03/21/traversing-x11-clients-behind-nat-or-x11-end-to-end-connectivity/</link>
		<comments>http://vignatti.wordpress.com/2008/03/21/traversing-x11-clients-behind-nat-or-x11-end-to-end-connectivity/#comments</comments>
		<pubDate>Fri, 21 Mar 2008 20:29:33 +0000</pubDate>
		<dc:creator>vignatti</dc:creator>
				<category><![CDATA[Computing]]></category>
		<category><![CDATA[firewall]]></category>
		<category><![CDATA[nat]]></category>
		<category><![CDATA[p2p]]></category>
		<category><![CDATA[traversing]]></category>
		<category><![CDATA[x11]]></category>
		<category><![CDATA[xorg]]></category>

		<guid isPermaLink="false">http://vignatti.wordpress.com/?p=27</guid>
		<description><![CDATA[I was thinking how we could make remotely X clients totally connective with the server when both are behind a NAT/firewall.
We can imagine one big motivation to do this: a scenario where someone using his thin and poor machine wants to use the resources of some &#8220;fat&#8221; machines which he simply doesn&#8217;t know where they [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=vignatti.wordpress.com&blog=769537&post=27&subd=vignatti&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p>I was thinking how we could make remotely X clients totally connective with the server when <b>both</b> are behind a NAT/firewall.</p>
<p>We can imagine one big motivation to do this: a scenario where someone using his thin and poor machine wants to use the resources of some &#8220;fat&#8221; machines which he simply doesn&#8217;t know where they are seated. Those fat machines could be arranged through a P2P network of &#8220;X11 pool of resources&#8221; and the list of machines displayed to the user select his desired one (e.g. with minor lag/load). Someone more capitalist than me could go further and imagine a provider selling X11 resources to mobile devices. Or just open your home machine&#8217;s web browser in any place of the world. Well, the field of applications would be huge.</p>
<p>Maybe this would be a kick in the a** of the so called web-based applications. Now you have to learn how to program in html, php, ajax or another boring language to build something in this kind of environment. Instead, we could see this P2P network also as a web-based environment letting people to program apps in their preferred toolkit (and yes, I&#8217;m betting that the data transfer rates in the various networks will increase significantly in the next years).</p>
<p>- How?</p>
<p>There&#8217;s a technique to create TCP connections between machines behind NAT/firewall called &#8220;hole punching&#8217; [0, 1]. With the help of a server (called rendezvous) two machines behind NAT/firewall open a &#8216;hole&#8217; in their NAT/firewall to establish a connection. A similar technique &#8212; using UDP &#8212; is what Skype and others are relaying today.</p>
<p>Someone already mentioned [2] to wrap X11 protocol with jabber (or other protocol). It would be also an idea. But I don&#8217;t know how much the latency would increase in this case.</p>
<p>Certainly there are others techniques to achieve the X11 end-to-end transparency among machines that I&#8217;m missing.</p>
<p>- Why ssh -X and xfwp is not the way?</p>
<p>Simply because it doesn&#8217;t let end-to-end connectivity.</p>
<p>I didn&#8217;t thought what would be the impact in both client and server side. Probably all this will touch some aspects of authentication and<br />
security. I don&#8217;t know.</p>
<p>So I would like to hear from you what do you think about this all (and eventually find a mentor to apply this in GSoC  ;)  )</p>
<p>Cheers,</p>
<p>[0]</p>
<p>http://www.usenix.org/event/imc05/tech/full_papers/guha/guha_html/index.html</p>
<p>[1] http://www.bford.info/pub/net/p2pnat/<br />
[2] http://butterfeet.org/?p=23</p>
<img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/vignatti.wordpress.com/27/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/vignatti.wordpress.com/27/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/vignatti.wordpress.com/27/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/vignatti.wordpress.com/27/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/vignatti.wordpress.com/27/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/vignatti.wordpress.com/27/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/vignatti.wordpress.com/27/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/vignatti.wordpress.com/27/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/vignatti.wordpress.com/27/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/vignatti.wordpress.com/27/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/vignatti.wordpress.com/27/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/vignatti.wordpress.com/27/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=vignatti.wordpress.com&blog=769537&post=27&subd=vignatti&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://vignatti.wordpress.com/2008/03/21/traversing-x11-clients-behind-nat-or-x11-end-to-end-connectivity/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/c80e0b79eb21bbd134add2362d74f4ce?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">vignatti</media:title>
		</media:content>
	</item>
	</channel>
</rss>