<?xml version="1.0" encoding="iso-8859-1"?><!-- generator="b2evolution/2.4.6" -->
<rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:admin="http://webns.net/mvcb/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:content="http://purl.org/rss/1.0/modules/content/">
	<channel>
		<title>Bas Schouten</title>
		<link>http://www.basschouten.com/blog1.php</link>
		<description></description>
		<language>en-EU</language>
		<docs>http://blogs.law.harvard.edu/tech/rss</docs>
		<admin:generatorAgent rdf:resource="http://b2evolution.net/?v=2.4.6"/>
		<ttl>60</ttl>
				<item>
			<title>Direct2D: Investigating Cached Tessellations</title>
			<link>http://www.basschouten.com/blog1.php/2010/04/22/direct2d-investigating-cached-tessellati</link>
			<pubDate>Thu, 22 Apr 2010 18:36:52 +0000</pubDate>			<dc:creator>Bas</dc:creator>
			<category domain="main">Uncategorized</category>			<guid isPermaLink="false">8@http://www.basschouten.com/</guid>
						<description>&lt;p&gt;So, at Mozilla we've been looking into more ways to improve our performance in the area of complex graphics. One area where Direct2D is currently not giving us the kind of improvements we'd like, is in the case of drawing complex paths. The problem is that drawing paths will re-analyze the path on every frame using the CPU, causing these scenarios to be bound mainly by the speed of the CPU. This is something we'd like to address in order to improve performance of for example dynamic SVG images, after all once you have analyzed a certain path once, you want to retain as much as you can from that analysis, and re-use it when drawing a new frame with only small changes.&lt;/p&gt;

&lt;p&gt;&lt;b&gt;Path Retention Support in Cairo&lt;/b&gt;&lt;/p&gt;

&lt;p&gt;One of the things that needs to happen is we need to support retaining paths in cairo, in such a way that a cairo surface can choose to associate and retain backend specific data related to that path. Much like is already possible in cairo for surface structures. That is a task which has been taken up by Matt Woodrow and has been coming along nicely (see &lt;a href=&quot;https://bugzilla.mozilla.org/show_bug.cgi?id=555877&quot;&gt;bug 555877&lt;/a&gt;) and I'm not going to spend a lot of time talking about this. What I am going to talk about is my investigation into how to put this to good use from a Direct2D perspective.&lt;/p&gt;

&lt;p&gt;&lt;b&gt;Tessellation Caching in Direct2D&lt;/b&gt;&lt;/p&gt;

&lt;p&gt;When I started my investigation, I was hoping that perhaps ID2D1Geometry would have some level of internal caching. In other words, if I'd just fill the same ID2D1Geometry every frame, this would be significantly faster than re-creating the geometry each frame. For testing this I chose the following geometry, the geometry I chose here is fairly simple, but it has some intersections and some nice big curves, so tessellation should be non-trivial:&lt;/p&gt;

&lt;p&gt;&lt;code&gt;   sink-&gt;BeginFigure(D2D1::Point2F(600, 200), D2D1_FIGURE_BEGIN_FILLED);&lt;br /&gt;
   D2D1_BEZIER_SEGMENT seg[3];&lt;br /&gt;
   seg[0].point1 = D2D1::Point2F(1100, 200);&lt;br /&gt;
   seg[0].point2 = D2D1::Point2F(1100, 700);&lt;br /&gt;
   seg[0].point3 = D2D1::Point2F(600, 700);&lt;br /&gt;
   seg[1].point1 = D2D1::Point2F(100, 700);&lt;br /&gt;
   seg[1].point2 = D2D1::Point2F(100, 200);&lt;br /&gt;
   seg[1].point3 = D2D1::Point2F(600, 200);&lt;br /&gt;
   seg[2].point1 = D2D1::Point2F(1400, 300);&lt;br /&gt;
   seg[2].point2 = D2D1::Point2F(1400, 1400);&lt;br /&gt;
   seg[2].point3 = D2D1::Point2F(600, 1000);&lt;br /&gt;
   sink-&gt;AddBeziers(seg, 3);            &lt;br /&gt;
   sink-&gt;AddLine(D2D1::Point2F(30, 130));&lt;br /&gt;
   sink-&gt;EndFigure(D2D1_FIGURE_END_CLOSED);&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;Sadly there seemed to be no caching going on, the only speed improvement I could see was from not creating the geometry, the actual rendering showed no performance benefits. However, as we are determined to see if it is possible to do something else to get the desired effect, our eye was caught by another D2D interface.&lt;/p&gt;

&lt;p&gt;&lt;b&gt;The ID2D1Mesh and its limitations&lt;/b&gt;&lt;/p&gt;

&lt;p&gt;So Direct2D has a Mesh object, this is a device dependent object which can be created on a render target, and then filled with the tessellation of an existing geometry (with a certain transformation applied). I should note here that since this Mesh is a collection of triangles, the level of detail is determined by the transformation passed into Tessellate. This means that if you simply zoom in on the mesh, at some point curves will no longer be curves. This is the first limitation of Meshes, however for the purposes of this investigation I'm going to assume we will not scale and I'm simply going to be drawing the same untransformed geometry over and over again. In any case, more often than not we won't be scaling up significantly, and this isn't really a limitation, it just means we have to re-tessellate in some cases.&lt;/p&gt;

&lt;p&gt;Now there's another limitation which is more problematic, Meshes only work with Direct2D render targets which have Per Primitive Anti-Aliasing disabled (From here on PPAA). PPAA is an analytical anti-aliasing routine, which is most likely part of the reason why tessellations are not cached by Geometries internally. Anti-Aliasing is important to us, non-AA drawing in Mozilla is rare, and without it things would truly not look so good! There is another option though, when drawing to DXGI surfaces, as we do, you can set the GPU to use Multi-Sample Anti-Aliasing(From here on MSAA) to do anti-aliasing.&lt;/p&gt;

&lt;p&gt;&lt;b&gt;MSAA vs. PPAA&lt;/b&gt;&lt;/p&gt;

&lt;p&gt;So, quality of MSAA is worse than that of PPAA, however it is also faster than PPAA on decent graphics hardware. But we'll get to analyzing the performance of several different solutions later, let's see about the quality. First of all, with no scaling:&lt;/p&gt;
&lt;center&gt;&lt;table&gt;&lt;tr&gt;&lt;td&gt;&lt;img src=&quot;http://www.basschouten.com/media/blogs/blog/pathretention/MSAANoScale.png&quot; alt=&quot;&quot; title=&quot;&quot; width=&quot;180&quot; height=&quot;220&quot; /&gt;&lt;br /&gt;&lt;center&gt;MSAA 8x&lt;/center&gt;&lt;/td&gt;&lt;td&gt;&lt;img src=&quot;http://www.basschouten.com/media/blogs/blog/pathretention/PPAANoScale.png&quot; alt=&quot;&quot; title=&quot;&quot; width=&quot;180&quot; height=&quot;220&quot; /&gt;&lt;br /&gt;&lt;center&gt;PPAA&lt;/center&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;&lt;/center&gt;&lt;p&gt;&lt;/p&gt;

&lt;p&gt;Now for a bit more detail:&lt;/p&gt;

&lt;center&gt;&lt;table&gt;&lt;tr&gt;&lt;td&gt;&lt;img src=&quot;http://www.basschouten.com/media/blogs/blog/pathretention/MSAA Detailed.png&quot; alt=&quot;&quot; title=&quot;&quot; width=&quot;180&quot; height=&quot;220&quot; /&gt;&lt;br /&gt;&lt;center&gt;MSAA 8x&lt;/center&gt;&lt;/td&gt;&lt;td&gt;&lt;img src=&quot;http://www.basschouten.com/media/blogs/blog/pathretention/PPAA Detailed.png&quot; alt=&quot;&quot; title=&quot;&quot; width=&quot;180&quot; height=&quot;220&quot; /&gt;&lt;br /&gt;&lt;center&gt;PPAA&lt;/center&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;&lt;/center&gt;&lt;p&gt;&lt;/p&gt;

&lt;p&gt;Notice the smoother transition from white to red on the left edge in the PPAA version. So there's most certainly a difference in quality, although MSAA isn't that bad either! (On some hardware it may be higher or lower quality due to hardware MSAA capabilities)&lt;/p&gt;

&lt;p&gt;&lt;b&gt;Another Limitation of MSAA&lt;/b&gt;&lt;/p&gt;

&lt;p&gt;So at this point, we would be about ready to see about performance differences, except for one thing: MSAA is no longer used when you use PushLayer! The intermediate surface that gets created with PushLayer appears to not inherit the original surface's MSAA settings. Since we use Layers in order to do geometric clipping this poses another problem. We need to be able to do geometric clipping, while continuing to use our retained mesh, and with MSAA. To overcome this method in my investigation I've optionally used another method of clipping, I've created a texture with MSAA enabled (much like CreateLayer), and then I've created a non-MSAA texture, around which a SharedBitmap was created (so that it can be drawn to the main render target). When clipping, the geometry would be drawn to the MSAA texture, which could then be resolved to the non-MSAA texture, which was drawn into the clipping area using FillGeometry. The clipping area was chosen to be a single triangle, non-rectangular as to prevent any optimizations using scissor rects, but also to be trivial to tessellate so that the FillGeometry call for the clipping would not poison the measurement (optionally we could use FillMesh for the clipping area as well using this approach if we had a complex clipping path!)&lt;/p&gt;

&lt;p&gt;&lt;b&gt;Testing Conditions&lt;/b&gt;&lt;/p&gt;

&lt;p&gt;- Core i7 920&lt;br /&gt;
- ATI Radeon HD5850&lt;br /&gt;
- Stand-alone skeleton D2D application&lt;br /&gt;
- MSAA x8 where MSAA is specified&lt;br /&gt;
- Surface 1460x760 pixels&lt;br /&gt;
- Drawn 100 times per frame&lt;br /&gt;
- 10 draws per clip where clipping is enabled&lt;br /&gt;
- All D3D multithreaded optimizations disabled&lt;br /&gt;
- Rendering as often as possible, no VSync, clearing once per frame&lt;br /&gt;
- No Mesh Measurements with PPAA (since it doesn't work)&lt;/p&gt;

&lt;p&gt;&lt;b&gt;CPU Usage&lt;/b&gt;&lt;/p&gt;

&lt;div&gt;&lt;a href=&quot;http://www.basschouten.com/media/blogs/blog/pathretention/CPUUsage.png&quot;&gt;&lt;img src=&quot;http://www.basschouten.com/media/blogs/blog/pathretention/CPUUsage.png&quot; alt=&quot;&quot; title=&quot;&quot; width=&quot;450&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;p&gt; &lt;/p&gt;

&lt;p&gt;As we can see there's a very consistent pattern: The CPU is consistently saturated for drawing the Geometry without cached tessellation. When we draw our existing Mesh, we can see a significant reduction in CPU usage and we supposedly become GPU bound.&lt;/p&gt;

&lt;p&gt;&lt;b&gt;Rendering Speed&lt;/b&gt;&lt;/p&gt;

&lt;div&gt;&lt;a href=&quot;http://www.basschouten.com/media/blogs/blog/pathretention/RenderingSpeed.png&quot;&gt;&lt;img src=&quot;http://www.basschouten.com/media/blogs/blog/pathretention/RenderingSpeed.png&quot; alt=&quot;&quot; title=&quot;&quot; width=&quot;450&quot; /&gt;&lt;/a&gt;&lt;/div&gt;

&lt;p&gt;We can see that using the retained tessellation through a ID2D1Mesh can offer a significant performance benefit over using an ID2D1Geometry. Also note that drawing to a clipping layer appears to be somewhat faster than drawing to the backbuffer surface directly.&lt;/p&gt;

&lt;p&gt;&lt;b&gt;What do we see?&lt;/b&gt;&lt;/p&gt;

&lt;p&gt;So these are the numbers. The cause of drawing to a clipping layer being slightly faster is most likely that a DXGI surface render target needs to do some degree of syncing that an internal D2D render target (created by PushLayer) does not.&lt;/p&gt;

&lt;p&gt;We can clearly see that we can free up a lot of CPU when retaining tessellations of some complexity, even while we produce higher framerates.&lt;/p&gt;

&lt;p&gt;One thing I've noticed is that BeginDraw and EndDraw take a lot of CPU, not doing these calls when using the intermediate clipping render target seemed to significantly reduce CPU usage (although of course the results are no longer guaranteed to be correct since EndDraw ensures that all rendering commands are flushed, hence this method wasn't used). Additionally using Flush on the render target rather than EndDraw before resolving the MSAA surface (which should in theory produce correct results) seemed to also lower the CPU usage by some degree, however due to the correctness being hard to judge in these cases I chose not to do the latter either. However there is room for further analysis here and perhaps an even further decrease of CPU usage in the Mesh rendering with manual clipping approach.&lt;/p&gt;

&lt;p&gt;&lt;b&gt;Any Conclusion?&lt;/b&gt;&lt;/p&gt;

&lt;p&gt;Well, I can't really draw any conclusions from this at this point, there's a clear trade-off between performance and quality. It's certainly worth investigating further and possibly a 'mixed' approach could be used depending on the complexity of the path and quality requirements of the user. I realize this was a pretty long and technical post &lt;img src=&quot;http://www.basschouten.com/rsc/smilies/icon_smile.gif&quot; alt=&quot;&amp;#58;&amp;#41;&quot; class=&quot;middle&quot; /&gt; But I hope that for those of you interested in this sort of stuff I've been able to provide some interesting initial measurements in the area of complex geometry rendering in Direct2D. I'm looking forward to any opinions, criticisms, hints or other form of input on my methods and ideas!&lt;/p&gt;&lt;div class=&quot;item_footer&quot;&gt;&lt;p&gt;&lt;small&gt;&lt;a href=&quot;http://www.basschouten.com/blog1.php/2010/04/22/direct2d-investigating-cached-tessellati&quot;&gt;Original post&lt;/a&gt; blogged on &lt;a href=&quot;http://b2evolution.net/&quot;&gt;b2evolution&lt;/a&gt;.&lt;/small&gt;&lt;/p&gt;&lt;/div&gt;</description>
			<content:encoded><![CDATA[<p>So, at Mozilla we've been looking into more ways to improve our performance in the area of complex graphics. One area where Direct2D is currently not giving us the kind of improvements we'd like, is in the case of drawing complex paths. The problem is that drawing paths will re-analyze the path on every frame using the CPU, causing these scenarios to be bound mainly by the speed of the CPU. This is something we'd like to address in order to improve performance of for example dynamic SVG images, after all once you have analyzed a certain path once, you want to retain as much as you can from that analysis, and re-use it when drawing a new frame with only small changes.</p>

<p><b>Path Retention Support in Cairo</b></p>

<p>One of the things that needs to happen is we need to support retaining paths in cairo, in such a way that a cairo surface can choose to associate and retain backend specific data related to that path. Much like is already possible in cairo for surface structures. That is a task which has been taken up by Matt Woodrow and has been coming along nicely (see <a href="https://bugzilla.mozilla.org/show_bug.cgi?id=555877">bug 555877</a>) and I'm not going to spend a lot of time talking about this. What I am going to talk about is my investigation into how to put this to good use from a Direct2D perspective.</p>

<p><b>Tessellation Caching in Direct2D</b></p>

<p>When I started my investigation, I was hoping that perhaps ID2D1Geometry would have some level of internal caching. In other words, if I'd just fill the same ID2D1Geometry every frame, this would be significantly faster than re-creating the geometry each frame. For testing this I chose the following geometry, the geometry I chose here is fairly simple, but it has some intersections and some nice big curves, so tessellation should be non-trivial:</p>

<p><code>   sink->BeginFigure(D2D1::Point2F(600, 200), D2D1_FIGURE_BEGIN_FILLED);<br />
   D2D1_BEZIER_SEGMENT seg[3];<br />
   seg[0].point1 = D2D1::Point2F(1100, 200);<br />
   seg[0].point2 = D2D1::Point2F(1100, 700);<br />
   seg[0].point3 = D2D1::Point2F(600, 700);<br />
   seg[1].point1 = D2D1::Point2F(100, 700);<br />
   seg[1].point2 = D2D1::Point2F(100, 200);<br />
   seg[1].point3 = D2D1::Point2F(600, 200);<br />
   seg[2].point1 = D2D1::Point2F(1400, 300);<br />
   seg[2].point2 = D2D1::Point2F(1400, 1400);<br />
   seg[2].point3 = D2D1::Point2F(600, 1000);<br />
   sink->AddBeziers(seg, 3);            <br />
   sink->AddLine(D2D1::Point2F(30, 130));<br />
   sink->EndFigure(D2D1_FIGURE_END_CLOSED);</code></p>

<p>Sadly there seemed to be no caching going on, the only speed improvement I could see was from not creating the geometry, the actual rendering showed no performance benefits. However, as we are determined to see if it is possible to do something else to get the desired effect, our eye was caught by another D2D interface.</p>

<p><b>The ID2D1Mesh and its limitations</b></p>

<p>So Direct2D has a Mesh object, this is a device dependent object which can be created on a render target, and then filled with the tessellation of an existing geometry (with a certain transformation applied). I should note here that since this Mesh is a collection of triangles, the level of detail is determined by the transformation passed into Tessellate. This means that if you simply zoom in on the mesh, at some point curves will no longer be curves. This is the first limitation of Meshes, however for the purposes of this investigation I'm going to assume we will not scale and I'm simply going to be drawing the same untransformed geometry over and over again. In any case, more often than not we won't be scaling up significantly, and this isn't really a limitation, it just means we have to re-tessellate in some cases.</p>

<p>Now there's another limitation which is more problematic, Meshes only work with Direct2D render targets which have Per Primitive Anti-Aliasing disabled (From here on PPAA). PPAA is an analytical anti-aliasing routine, which is most likely part of the reason why tessellations are not cached by Geometries internally. Anti-Aliasing is important to us, non-AA drawing in Mozilla is rare, and without it things would truly not look so good! There is another option though, when drawing to DXGI surfaces, as we do, you can set the GPU to use Multi-Sample Anti-Aliasing(From here on MSAA) to do anti-aliasing.</p>

<p><b>MSAA vs. PPAA</b></p>

<p>So, quality of MSAA is worse than that of PPAA, however it is also faster than PPAA on decent graphics hardware. But we'll get to analyzing the performance of several different solutions later, let's see about the quality. First of all, with no scaling:</p>
<center><table><tr><td><img src="http://www.basschouten.com/media/blogs/blog/pathretention/MSAANoScale.png" alt="" title="" width="180" height="220" /><br /><center>MSAA 8x</center></td><td><img src="http://www.basschouten.com/media/blogs/blog/pathretention/PPAANoScale.png" alt="" title="" width="180" height="220" /><br /><center>PPAA</center></td></tr></table></center><p></p>

<p>Now for a bit more detail:</p>

<center><table><tr><td><img src="http://www.basschouten.com/media/blogs/blog/pathretention/MSAA Detailed.png" alt="" title="" width="180" height="220" /><br /><center>MSAA 8x</center></td><td><img src="http://www.basschouten.com/media/blogs/blog/pathretention/PPAA Detailed.png" alt="" title="" width="180" height="220" /><br /><center>PPAA</center></td></tr></table></center><p></p>

<p>Notice the smoother transition from white to red on the left edge in the PPAA version. So there's most certainly a difference in quality, although MSAA isn't that bad either! (On some hardware it may be higher or lower quality due to hardware MSAA capabilities)</p>

<p><b>Another Limitation of MSAA</b></p>

<p>So at this point, we would be about ready to see about performance differences, except for one thing: MSAA is no longer used when you use PushLayer! The intermediate surface that gets created with PushLayer appears to not inherit the original surface's MSAA settings. Since we use Layers in order to do geometric clipping this poses another problem. We need to be able to do geometric clipping, while continuing to use our retained mesh, and with MSAA. To overcome this method in my investigation I've optionally used another method of clipping, I've created a texture with MSAA enabled (much like CreateLayer), and then I've created a non-MSAA texture, around which a SharedBitmap was created (so that it can be drawn to the main render target). When clipping, the geometry would be drawn to the MSAA texture, which could then be resolved to the non-MSAA texture, which was drawn into the clipping area using FillGeometry. The clipping area was chosen to be a single triangle, non-rectangular as to prevent any optimizations using scissor rects, but also to be trivial to tessellate so that the FillGeometry call for the clipping would not poison the measurement (optionally we could use FillMesh for the clipping area as well using this approach if we had a complex clipping path!)</p>

<p><b>Testing Conditions</b></p>

<p>- Core i7 920<br />
- ATI Radeon HD5850<br />
- Stand-alone skeleton D2D application<br />
- MSAA x8 where MSAA is specified<br />
- Surface 1460x760 pixels<br />
- Drawn 100 times per frame<br />
- 10 draws per clip where clipping is enabled<br />
- All D3D multithreaded optimizations disabled<br />
- Rendering as often as possible, no VSync, clearing once per frame<br />
- No Mesh Measurements with PPAA (since it doesn't work)</p>

<p><b>CPU Usage</b></p>

<div><a href="http://www.basschouten.com/media/blogs/blog/pathretention/CPUUsage.png"><img src="http://www.basschouten.com/media/blogs/blog/pathretention/CPUUsage.png" alt="" title="" width="450" /></a></div><p> </p>

<p>As we can see there's a very consistent pattern: The CPU is consistently saturated for drawing the Geometry without cached tessellation. When we draw our existing Mesh, we can see a significant reduction in CPU usage and we supposedly become GPU bound.</p>

<p><b>Rendering Speed</b></p>

<div><a href="http://www.basschouten.com/media/blogs/blog/pathretention/RenderingSpeed.png"><img src="http://www.basschouten.com/media/blogs/blog/pathretention/RenderingSpeed.png" alt="" title="" width="450" /></a></div>

<p>We can see that using the retained tessellation through a ID2D1Mesh can offer a significant performance benefit over using an ID2D1Geometry. Also note that drawing to a clipping layer appears to be somewhat faster than drawing to the backbuffer surface directly.</p>

<p><b>What do we see?</b></p>

<p>So these are the numbers. The cause of drawing to a clipping layer being slightly faster is most likely that a DXGI surface render target needs to do some degree of syncing that an internal D2D render target (created by PushLayer) does not.</p>

<p>We can clearly see that we can free up a lot of CPU when retaining tessellations of some complexity, even while we produce higher framerates.</p>

<p>One thing I've noticed is that BeginDraw and EndDraw take a lot of CPU, not doing these calls when using the intermediate clipping render target seemed to significantly reduce CPU usage (although of course the results are no longer guaranteed to be correct since EndDraw ensures that all rendering commands are flushed, hence this method wasn't used). Additionally using Flush on the render target rather than EndDraw before resolving the MSAA surface (which should in theory produce correct results) seemed to also lower the CPU usage by some degree, however due to the correctness being hard to judge in these cases I chose not to do the latter either. However there is room for further analysis here and perhaps an even further decrease of CPU usage in the Mesh rendering with manual clipping approach.</p>

<p><b>Any Conclusion?</b></p>

<p>Well, I can't really draw any conclusions from this at this point, there's a clear trade-off between performance and quality. It's certainly worth investigating further and possibly a 'mixed' approach could be used depending on the complexity of the path and quality requirements of the user. I realize this was a pretty long and technical post <img src="http://www.basschouten.com/rsc/smilies/icon_smile.gif" alt="&#58;&#41;" class="middle" /> But I hope that for those of you interested in this sort of stuff I've been able to provide some interesting initial measurements in the area of complex geometry rendering in Direct2D. I'm looking forward to any opinions, criticisms, hints or other form of input on my methods and ideas!</p><div class="item_footer"><p><small><a href="http://www.basschouten.com/blog1.php/2010/04/22/direct2d-investigating-cached-tessellati">Original post</a> blogged on <a href="http://b2evolution.net/">b2evolution</a>.</small></p></div>]]></content:encoded>
								<comments>http://www.basschouten.com/blog1.php/2010/04/22/direct2d-investigating-cached-tessellati#comments</comments>
		</item>
				<item>
			<title>Firefox Video Goes Up To 11</title>
			<link>http://www.basschouten.com/blog1.php/2010/04/07/firefox-video-goes-up-to-11</link>
			<pubDate>Wed, 07 Apr 2010 18:26:00 +0000</pubDate>			<dc:creator>Bas</dc:creator>
			<category domain="main">Uncategorized</category>			<guid isPermaLink="false">7@http://www.basschouten.com/</guid>
						<description>&lt;p&gt;So, I talked to you all a while ago about &lt;a href=&quot;http://www.basschouten.com/blog1.php/2010/01/18/layers-cross-platform-acceleration&quot;&gt;layers&lt;/a&gt;, and how we are going to be using it to accelerate composition of web pages across all platforms. There's more news on that front! Recently we landed a first version of the OpenGL layers backend onto trunk (See bug 546517). That backend included all the necessary code to use OpenGL for both image upscaling and YUV to RGB color space conversion.&lt;/p&gt;

&lt;p&gt;Currently in general the code using layers is not at a point yet where it can benefit from the hardware layers backend for all rendering. For this reason the OpenGL backend is not used yet for your normal browsing. However as many of you may know the performance of fullscreen HTML5 video is not fantastic at the moment for lesser CPUs. Since fullscreen video in particular needs that extra push over the cliff, we decided to enable the OpenGL layers backend by default specifically for the fullscreen video case. What that means is that we upload the Y, Cb and Cr planes to your GPU, draw them to a fullscreen quad and then combine them to create the RGB image on your monitor. Ultimately what matters is that for those of you using compatible hardware and software it should lead to a big improvement in fullscreen video performance when using our latest Nightlies (get them &lt;a href=&quot;http://nightly.mozilla.org&quot;&gt;here&lt;/a&gt;) and the upcoming Alpha!&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Compatible Hardware And Software?&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;So, currently there's a little bit of work that still needs to be done to make OpenGL layers work on Mac OS X and Linux, so first of all you'll need Windows. Second of all you will need OpenGL 2 compatible drivers for your graphics hardware. Performance may vary across both hardware and drivers.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Eep! I'm running into issues&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;If you do run into issues with fullscreen video, do go to &lt;a href=&quot;http://bugzilla.mozilla.org/&quot;&gt;http://bugzilla.mozilla.org/&lt;/a&gt; and check if your issue has already been reported. If it hasn't, we're very interested in hearing from you so we can address it as quickly as possible. Don't forget to note your graphics hardware and driver version, as this is invaluable information when trying to diagnose issues.&lt;/p&gt;

&lt;p&gt;If you're interested in hearing more about layers, Robert O'Callahan has a very informative blogpost &lt;a href=&quot;http://weblogs.mozillazine.org/roc/&quot;&gt;here&lt;/a&gt;.&lt;/p&gt;&lt;div class=&quot;item_footer&quot;&gt;&lt;p&gt;&lt;small&gt;&lt;a href=&quot;http://www.basschouten.com/blog1.php/2010/04/07/firefox-video-goes-up-to-11&quot;&gt;Original post&lt;/a&gt; blogged on &lt;a href=&quot;http://b2evolution.net/&quot;&gt;b2evolution&lt;/a&gt;.&lt;/small&gt;&lt;/p&gt;&lt;/div&gt;</description>
			<content:encoded><![CDATA[<p>So, I talked to you all a while ago about <a href="http://www.basschouten.com/blog1.php/2010/01/18/layers-cross-platform-acceleration">layers</a>, and how we are going to be using it to accelerate composition of web pages across all platforms. There's more news on that front! Recently we landed a first version of the OpenGL layers backend onto trunk (See bug 546517). That backend included all the necessary code to use OpenGL for both image upscaling and YUV to RGB color space conversion.</p>

<p>Currently in general the code using layers is not at a point yet where it can benefit from the hardware layers backend for all rendering. For this reason the OpenGL backend is not used yet for your normal browsing. However as many of you may know the performance of fullscreen HTML5 video is not fantastic at the moment for lesser CPUs. Since fullscreen video in particular needs that extra push over the cliff, we decided to enable the OpenGL layers backend by default specifically for the fullscreen video case. What that means is that we upload the Y, Cb and Cr planes to your GPU, draw them to a fullscreen quad and then combine them to create the RGB image on your monitor. Ultimately what matters is that for those of you using compatible hardware and software it should lead to a big improvement in fullscreen video performance when using our latest Nightlies (get them <a href="http://nightly.mozilla.org">here</a>) and the upcoming Alpha!</p>

<p><strong>Compatible Hardware And Software?</strong></p>

<p>So, currently there's a little bit of work that still needs to be done to make OpenGL layers work on Mac OS X and Linux, so first of all you'll need Windows. Second of all you will need OpenGL 2 compatible drivers for your graphics hardware. Performance may vary across both hardware and drivers.</p>

<p><strong>Eep! I'm running into issues</strong></p>

<p>If you do run into issues with fullscreen video, do go to <a href="http://bugzilla.mozilla.org/">http://bugzilla.mozilla.org/</a> and check if your issue has already been reported. If it hasn't, we're very interested in hearing from you so we can address it as quickly as possible. Don't forget to note your graphics hardware and driver version, as this is invaluable information when trying to diagnose issues.</p>

<p>If you're interested in hearing more about layers, Robert O'Callahan has a very informative blogpost <a href="http://weblogs.mozillazine.org/roc/">here</a>.</p><div class="item_footer"><p><small><a href="http://www.basschouten.com/blog1.php/2010/04/07/firefox-video-goes-up-to-11">Original post</a> blogged on <a href="http://b2evolution.net/">b2evolution</a>.</small></p></div>]]></content:encoded>
								<comments>http://www.basschouten.com/blog1.php/2010/04/07/firefox-video-goes-up-to-11#comments</comments>
		</item>
				<item>
			<title>Presenting: Direct2D Hardware Acceleration In Firefox Nightlies</title>
			<link>http://www.basschouten.com/blog1.php/2010/03/02/presenting-direct2d-hardware-acceleratio</link>
			<pubDate>Tue, 02 Mar 2010 15:42:58 +0000</pubDate>			<dc:creator>Bas</dc:creator>
			<category domain="main">Uncategorized</category>			<guid isPermaLink="false">6@http://www.basschouten.com/</guid>
						<description>&lt;p&gt;So, the moment is finally there! I realize I've not posted on here for a while, my main reason being I wanted to be able to actually have something to tell you guys the next time I would talk about Direct2D. And it seems that now I do! After a lot of hard work from myself and many others at Mozilla who have been assisting me in getting Direct2D and particularly DirectWrite stable and functional enough for people to start trying it out, I believe our Direct2D support is now ready for the world to try their hands at!&lt;/p&gt;

&lt;p&gt;If you download the latest nightly &lt;a href=&quot;http://nightly.mozilla.org/&quot;&gt;here&lt;/a&gt; you will be the proud owner of an official experimental build that has support for Direct2D. This build will automatically update to our new experimental nightly builds, giving you all the bugfixes we're working on for various problems that are still around.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Does that mean if I download the latest nightly I get Direct2D support?&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Well, no. Since we don't want to regress any functionality in our browser for the majority of our users, by default your build will not use DirectWrite. There's a couple of steps you'll need to execute to get it working:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Go to about:config&lt;/li&gt;
&lt;li&gt;Click through the warning, if necessary&lt;/li&gt;
&lt;li&gt;Enter 'render' in the 'Filter' box&lt;/li&gt;
&lt;li&gt;Double-click on 'gfx.font_rendering.directwrite.enabled' to set it to true&lt;/li&gt;
&lt;li&gt;Double click on 'mozilla.widget.render-mode', set the value to 6&lt;/li&gt;
&lt;li&gt;Restart&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;strong&gt;So once I've done this, surely I have this Direct2D support going!&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Erm... sorry here folks, but no. There's several reasons why you could still not be having Direct2D support. First of all it's possible you have an extension interfering with Direct2D. Several extensions are known to somewhat disrupt our initialization order, meaning the preferences you've just set are not accessible during initialization of the render mode, which will cause GDI default render-mode.&lt;/p&gt;

&lt;p&gt;Then there is another issue, if you're actually on Windows XP and not on Windows Vista or Windows 7, Windows XP actually has no support for Direct2D or DirectWrite, so it will fallback to being just a normal build. I suggest you upgrade &lt;img src=&quot;http://www.basschouten.com/rsc/smilies/icon_biggrin.gif&quot; alt=&quot;&amp;#58;&amp;#68;&quot; class=&quot;middle&quot; /&gt;.&lt;/p&gt;

&lt;p&gt;Finally, if you do not have a high-end DirectX 9 graphics card, or a DirectX 10 graphics card, insufficient hardware support will be detected. This will cause the renderer to fallback to using GDI as well, in order to prevent you from suffering a slow browser, or even worse, a crash!&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Now, all this reading, by now I must have Direct2D support?!&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Right, if you satisfy all the above conditions, you're probably there! We don't have any way to verify at the moment (we're working on something), but one way is to go &lt;a href=&quot;http://people.mozilla.com/~vladimir/demos/photos.svg&quot;&gt;here&lt;/a&gt;. If it runs nice and smooth when you size photos up to fullscreen, it's working!&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;It is working! Now what?&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;You should enjoy your new browsing experience, in most cases you should have a noticeably faster and more responsive browser, particularly when using graphically intensive websites (not using flash, which will still be slow). If you find any bugs, please use our traditional reporting method of going to &lt;a href=&quot;http://bugzilla.mozilla.org/&quot;&gt;bugzilla&lt;/a&gt; and see if they've already been filed. If they haven't, file it, and we'll try to get to it and fix it as soon as possible!&lt;/p&gt;

&lt;p&gt;There's a very cool forum thread that tracks the currently known issues, you should have a look &lt;a href=&quot;http://forums.mozillazine.org/viewtopic.php?f=23&amp;amp;t=1775755&quot;&gt;there&lt;/a&gt; as well.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Well, that's about it!&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;I apologize to everyone for taking so long to get this ready for putting it out there, and for not providing experimental builds over the last months. The fact is its surprising how much you can do on the web that at least I didn't know about! And in how many interesting ways it can break &lt;img src=&quot;http://www.basschouten.com/rsc/smilies/icon_wink.gif&quot; alt=&quot;&amp;#59;&amp;#41;&quot; class=&quot;middle&quot; /&gt;. But I hope you can now all enjoy the latest and greatest of Direct2D builds. And no longer suffer any manual updating of your build! Happy Browsing!&lt;/p&gt;&lt;div class=&quot;item_footer&quot;&gt;&lt;p&gt;&lt;small&gt;&lt;a href=&quot;http://www.basschouten.com/blog1.php/2010/03/02/presenting-direct2d-hardware-acceleratio&quot;&gt;Original post&lt;/a&gt; blogged on &lt;a href=&quot;http://b2evolution.net/&quot;&gt;b2evolution&lt;/a&gt;.&lt;/small&gt;&lt;/p&gt;&lt;/div&gt;</description>
			<content:encoded><![CDATA[<p>So, the moment is finally there! I realize I've not posted on here for a while, my main reason being I wanted to be able to actually have something to tell you guys the next time I would talk about Direct2D. And it seems that now I do! After a lot of hard work from myself and many others at Mozilla who have been assisting me in getting Direct2D and particularly DirectWrite stable and functional enough for people to start trying it out, I believe our Direct2D support is now ready for the world to try their hands at!</p>

<p>If you download the latest nightly <a href="http://nightly.mozilla.org/">here</a> you will be the proud owner of an official experimental build that has support for Direct2D. This build will automatically update to our new experimental nightly builds, giving you all the bugfixes we're working on for various problems that are still around.</p>

<p><strong>Does that mean if I download the latest nightly I get Direct2D support?</strong></p>

<p>Well, no. Since we don't want to regress any functionality in our browser for the majority of our users, by default your build will not use DirectWrite. There's a couple of steps you'll need to execute to get it working:</p>

<ol>
<li>Go to about:config</li>
<li>Click through the warning, if necessary</li>
<li>Enter 'render' in the 'Filter' box</li>
<li>Double-click on 'gfx.font_rendering.directwrite.enabled' to set it to true</li>
<li>Double click on 'mozilla.widget.render-mode', set the value to 6</li>
<li>Restart</li>
</ol>

<p><strong>So once I've done this, surely I have this Direct2D support going!</strong></p>

<p>Erm... sorry here folks, but no. There's several reasons why you could still not be having Direct2D support. First of all it's possible you have an extension interfering with Direct2D. Several extensions are known to somewhat disrupt our initialization order, meaning the preferences you've just set are not accessible during initialization of the render mode, which will cause GDI default render-mode.</p>

<p>Then there is another issue, if you're actually on Windows XP and not on Windows Vista or Windows 7, Windows XP actually has no support for Direct2D or DirectWrite, so it will fallback to being just a normal build. I suggest you upgrade <img src="http://www.basschouten.com/rsc/smilies/icon_biggrin.gif" alt="&#58;&#68;" class="middle" />.</p>

<p>Finally, if you do not have a high-end DirectX 9 graphics card, or a DirectX 10 graphics card, insufficient hardware support will be detected. This will cause the renderer to fallback to using GDI as well, in order to prevent you from suffering a slow browser, or even worse, a crash!</p>

<p><strong>Now, all this reading, by now I must have Direct2D support?!</strong></p>

<p>Right, if you satisfy all the above conditions, you're probably there! We don't have any way to verify at the moment (we're working on something), but one way is to go <a href="http://people.mozilla.com/~vladimir/demos/photos.svg">here</a>. If it runs nice and smooth when you size photos up to fullscreen, it's working!</p>

<p><strong>It is working! Now what?</strong></p>

<p>You should enjoy your new browsing experience, in most cases you should have a noticeably faster and more responsive browser, particularly when using graphically intensive websites (not using flash, which will still be slow). If you find any bugs, please use our traditional reporting method of going to <a href="http://bugzilla.mozilla.org/">bugzilla</a> and see if they've already been filed. If they haven't, file it, and we'll try to get to it and fix it as soon as possible!</p>

<p>There's a very cool forum thread that tracks the currently known issues, you should have a look <a href="http://forums.mozillazine.org/viewtopic.php?f=23&amp;t=1775755">there</a> as well.</p>

<p><strong>Well, that's about it!</strong></p>

<p>I apologize to everyone for taking so long to get this ready for putting it out there, and for not providing experimental builds over the last months. The fact is its surprising how much you can do on the web that at least I didn't know about! And in how many interesting ways it can break <img src="http://www.basschouten.com/rsc/smilies/icon_wink.gif" alt="&#59;&#41;" class="middle" />. But I hope you can now all enjoy the latest and greatest of Direct2D builds. And no longer suffer any manual updating of your build! Happy Browsing!</p><div class="item_footer"><p><small><a href="http://www.basschouten.com/blog1.php/2010/03/02/presenting-direct2d-hardware-acceleratio">Original post</a> blogged on <a href="http://b2evolution.net/">b2evolution</a>.</small></p></div>]]></content:encoded>
								<comments>http://www.basschouten.com/blog1.php/2010/03/02/presenting-direct2d-hardware-acceleratio#comments</comments>
		</item>
				<item>
			<title>Layers: Cross-Platform Acceleration</title>
			<link>http://www.basschouten.com/blog1.php/2010/01/18/layers-cross-platform-acceleration</link>
			<pubDate>Mon, 18 Jan 2010 15:19:20 +0000</pubDate>			<dc:creator>Bas</dc:creator>
			<category domain="main">Uncategorized</category>			<guid isPermaLink="false">5@http://www.basschouten.com/</guid>
						<description>&lt;p&gt;So, it's been a while since I've given everyone here an update, and for that I do apologize. First of all, Direct2D support is coming well, we're working hard to land it on trunk. I've been getting swift reviews on all my code from a lot of different people, which is great, but it will still take some time since the code is complex and touches a lot of the Mozilla tree. Once it lands it will be disabled by default, but people will be able to easily enable it in their firefox nightly builds! Ofcourse you can follow the status of this work by keeping track of &lt;a href=&quot;https://bugzilla.mozilla.org/show_bug.cgi?id=527707&quot;&gt;bug 527707&lt;/a&gt;. It's not perfect yet, but once again, thanks to all who've given me all the great feedback to get this to a point where it's quite usable!&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Layers&lt;/strong&gt;&lt;br /&gt;
So, now to the actual title of this post. Layers. Layers are another API we are designing for Mozilla, which can be used to hardware accelerate certain parts of website rendering. Normally this is where I would start a long rant on why hardware acceleration is such a good thing, but since I've already done that 2 posts ago, I'll just refer you there.&lt;/p&gt;

&lt;p&gt;First of all it is important to point out that Layers is by no means a replacement for Direct2D. Direct2D accelerates all rendering, from fonts to paths and all such things, layers is intended to allow accelerated rendering and blending of surfaces. A layer could be accessible as many different type of cairo surfaces, possible D2D, but also any other. What this means if the layer system is designed to be easily implemented on top of different APIs, Direct3D (9 or 10) but also OpenGL. This means that we hope this to provide a performance increase for users on Mac and Linux as well.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;So what are these layers?&lt;/strong&gt;&lt;br /&gt;
Essentially, they're just that, layers. Normally a website will directly be rendered, as a whole, to a surface (say a window in most cases). This single surface means that unless the surface itself accelerates certain operations internally, it is hard to apply any hardware acceleration there. The layer system starts out with a LayerManager, this layermanager will be responsible for managing the layers in a certain part of screen real estate(say a window). Rather than providing a surface, the layer manager will provide layers to someone who wants to draw, and the API user (in this case our layout system) can then structure those in an ordered tree. By effectively rendering specific parts of a website (for example transformed or transparent areas) into their own layer, the layermanager can use hardware acceleration to composite those areas together effectively. There can be several types of layers, but two layers really form the core of the system: ThebesLayers and ContainerLayers.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;ContainerLayers&lt;/strong&gt;&lt;br /&gt;
So, container layers also live up to their name. They are a type of layer which may contain other layers, their children. These types of layers basically form the backbone of our tree. They do not themselves contain any graphical data, but they have children which are rendered into their area. It can for example be used to transform a set of children in a single transformation.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;ThebesLayers&lt;/strong&gt;&lt;br /&gt;
Now, these sound a bit more exotic. Thebes is our graphics library which wraps cairo. A thebes surface is a surface which can be drawn to using a thebes context. ThebesLayers are layers which are accessible as a thebes surface, and can therefor be easily used to render content to. This could for example also be a Direct2D surface. ThebesLayers form leafs of our tree, they contain content directly, and do not have any children. However, like any other layer, they may have transformations or blending effects applied to them.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Other types of layers&lt;/strong&gt;&lt;br /&gt;
Why would we have other types of layers you might ask? Well, there's actually several reasons. One of the layers we will be having are video layers, the reason is that video data is generally stored not in the normal RGB color space, but rather as YUV data(luminescence and chromatic information, not necessarily at the same resolution). As with any pixel operation, our graphics hardware is especially good at converting this to the RGB type of pixels we need on the screen, therefor this layer can be used specifically for video data. Another layer we will have is a hardware layer, this type of layer contains a surface which exists, and is accessible, solely on the hardware. These would be useful for example for WebGL, where we currently have to do an expensive readback from the graphics hardware to get a frame back into software. Using the hardware layer could then blend that WebGL content directly on the graphics hardware, skipping the intermediate copy to the normal memory.&lt;/p&gt;

&lt;p&gt;So, now that we know that, a layer tree for a website with a div in it, in which there's a video and some other content, may look like this:&lt;/p&gt;
&lt;div align=center&gt;&lt;img src=&quot;http://www.basschouten.com/media/blogs/blog/layers/LayerExample.png&quot; alt=&quot;&quot; title=&quot;&quot; width=&quot;430&quot; /&gt;&lt;br /&gt;&lt;em&gt;Simple example(actual results may differ)&lt;/em&gt;&lt;/div&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Other advantages&lt;/strong&gt;&lt;br /&gt;
There is a long list of other advantages we hope to achieve with this system. One of them is that the rendering of the layer tree could occur off the main thread. This means that if we integrate animations into the system, the main thread could be busy doing something(for example processing JavaScript), but the animations will proceed smoothly. Another advantage is that it offers us a system to retain part of our rendered websites, also, for example, parts which aren't in the currently viewed area. This could bring advantages especially where the CPU speed is low (for example mobile hardware), but we still want smooth scrolling and zooming.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Conclusions&lt;/strong&gt;&lt;br /&gt;
Well, that explains the very basics of the layers system we're working on. Robert O'Callahan has already been doing all the hard work of writing the very first API for layers, as well as a preliminary integration into our layout system! See &lt;a href=&quot;https://bugzilla.mozilla.org/show_bug.cgi?id=534425&quot;&gt;bug 534425&lt;/a&gt; for our progress there. Additionally I've been working on an OpenGL 2.1 and D3D10 implementation of the API so far. I had a lot of feedback of people who were disappointed we were not offering something like Direct2D on other platforms. We've not given up on bringing something like that to other platforms. Layers should however, with less risk and work, bring a significant amount of hardware acceleration to other platforms already! I hope you enjoyed reading this and I've informed you a little more about our latest work in this area, and ofcourse reassured you that we're doing everything we can to bring performance improvements to as many users as possible.&lt;/p&gt;&lt;div class=&quot;item_footer&quot;&gt;&lt;p&gt;&lt;small&gt;&lt;a href=&quot;http://www.basschouten.com/blog1.php/2010/01/18/layers-cross-platform-acceleration&quot;&gt;Original post&lt;/a&gt; blogged on &lt;a href=&quot;http://b2evolution.net/&quot;&gt;b2evolution&lt;/a&gt;.&lt;/small&gt;&lt;/p&gt;&lt;/div&gt;</description>
			<content:encoded><![CDATA[<p>So, it's been a while since I've given everyone here an update, and for that I do apologize. First of all, Direct2D support is coming well, we're working hard to land it on trunk. I've been getting swift reviews on all my code from a lot of different people, which is great, but it will still take some time since the code is complex and touches a lot of the Mozilla tree. Once it lands it will be disabled by default, but people will be able to easily enable it in their firefox nightly builds! Ofcourse you can follow the status of this work by keeping track of <a href="https://bugzilla.mozilla.org/show_bug.cgi?id=527707">bug 527707</a>. It's not perfect yet, but once again, thanks to all who've given me all the great feedback to get this to a point where it's quite usable!</p>

<p><strong>Layers</strong><br />
So, now to the actual title of this post. Layers. Layers are another API we are designing for Mozilla, which can be used to hardware accelerate certain parts of website rendering. Normally this is where I would start a long rant on why hardware acceleration is such a good thing, but since I've already done that 2 posts ago, I'll just refer you there.</p>

<p>First of all it is important to point out that Layers is by no means a replacement for Direct2D. Direct2D accelerates all rendering, from fonts to paths and all such things, layers is intended to allow accelerated rendering and blending of surfaces. A layer could be accessible as many different type of cairo surfaces, possible D2D, but also any other. What this means if the layer system is designed to be easily implemented on top of different APIs, Direct3D (9 or 10) but also OpenGL. This means that we hope this to provide a performance increase for users on Mac and Linux as well.</p>

<p><strong>So what are these layers?</strong><br />
Essentially, they're just that, layers. Normally a website will directly be rendered, as a whole, to a surface (say a window in most cases). This single surface means that unless the surface itself accelerates certain operations internally, it is hard to apply any hardware acceleration there. The layer system starts out with a LayerManager, this layermanager will be responsible for managing the layers in a certain part of screen real estate(say a window). Rather than providing a surface, the layer manager will provide layers to someone who wants to draw, and the API user (in this case our layout system) can then structure those in an ordered tree. By effectively rendering specific parts of a website (for example transformed or transparent areas) into their own layer, the layermanager can use hardware acceleration to composite those areas together effectively. There can be several types of layers, but two layers really form the core of the system: ThebesLayers and ContainerLayers.</p>

<p><strong>ContainerLayers</strong><br />
So, container layers also live up to their name. They are a type of layer which may contain other layers, their children. These types of layers basically form the backbone of our tree. They do not themselves contain any graphical data, but they have children which are rendered into their area. It can for example be used to transform a set of children in a single transformation.</p>

<p><strong>ThebesLayers</strong><br />
Now, these sound a bit more exotic. Thebes is our graphics library which wraps cairo. A thebes surface is a surface which can be drawn to using a thebes context. ThebesLayers are layers which are accessible as a thebes surface, and can therefor be easily used to render content to. This could for example also be a Direct2D surface. ThebesLayers form leafs of our tree, they contain content directly, and do not have any children. However, like any other layer, they may have transformations or blending effects applied to them.</p>

<p><strong>Other types of layers</strong><br />
Why would we have other types of layers you might ask? Well, there's actually several reasons. One of the layers we will be having are video layers, the reason is that video data is generally stored not in the normal RGB color space, but rather as YUV data(luminescence and chromatic information, not necessarily at the same resolution). As with any pixel operation, our graphics hardware is especially good at converting this to the RGB type of pixels we need on the screen, therefor this layer can be used specifically for video data. Another layer we will have is a hardware layer, this type of layer contains a surface which exists, and is accessible, solely on the hardware. These would be useful for example for WebGL, where we currently have to do an expensive readback from the graphics hardware to get a frame back into software. Using the hardware layer could then blend that WebGL content directly on the graphics hardware, skipping the intermediate copy to the normal memory.</p>

<p>So, now that we know that, a layer tree for a website with a div in it, in which there's a video and some other content, may look like this:</p>
<div align=center><img src="http://www.basschouten.com/media/blogs/blog/layers/LayerExample.png" alt="" title="" width="430" /><br /><em>Simple example(actual results may differ)</em></div><p><br /></p>

<p><strong>Other advantages</strong><br />
There is a long list of other advantages we hope to achieve with this system. One of them is that the rendering of the layer tree could occur off the main thread. This means that if we integrate animations into the system, the main thread could be busy doing something(for example processing JavaScript), but the animations will proceed smoothly. Another advantage is that it offers us a system to retain part of our rendered websites, also, for example, parts which aren't in the currently viewed area. This could bring advantages especially where the CPU speed is low (for example mobile hardware), but we still want smooth scrolling and zooming.</p>

<p><strong>Conclusions</strong><br />
Well, that explains the very basics of the layers system we're working on. Robert O'Callahan has already been doing all the hard work of writing the very first API for layers, as well as a preliminary integration into our layout system! See <a href="https://bugzilla.mozilla.org/show_bug.cgi?id=534425">bug 534425</a> for our progress there. Additionally I've been working on an OpenGL 2.1 and D3D10 implementation of the API so far. I had a lot of feedback of people who were disappointed we were not offering something like Direct2D on other platforms. We've not given up on bringing something like that to other platforms. Layers should however, with less risk and work, bring a significant amount of hardware acceleration to other platforms already! I hope you enjoyed reading this and I've informed you a little more about our latest work in this area, and ofcourse reassured you that we're doing everything we can to bring performance improvements to as many users as possible.</p><div class="item_footer"><p><small><a href="http://www.basschouten.com/blog1.php/2010/01/18/layers-cross-platform-acceleration">Original post</a> blogged on <a href="http://b2evolution.net/">b2evolution</a>.</small></p></div>]]></content:encoded>
								<comments>http://www.basschouten.com/blog1.php/2010/01/18/layers-cross-platform-acceleration#comments</comments>
		</item>
				<item>
			<title>Firefox and Direct2D: Performance Analysis</title>
			<link>http://www.basschouten.com/blog1.php/2009/11/25/firefox-and-direct2d-performance-analysi</link>
			<pubDate>Wed, 25 Nov 2009 18:11:29 +0000</pubDate>			<dc:creator>Bas</dc:creator>
			<category domain="main">Uncategorized</category>			<guid isPermaLink="false">4@http://www.basschouten.com/</guid>
						<description>&lt;p&gt;So, it seems my &lt;a href=&quot;http://www.basschouten.com/blog1.php/2009/11/22/direct2d-hardware-rendering-a-browser&quot;&gt;little demo&lt;/a&gt; of a pre-alpha firefox build with Direct2D support has generated quite some attention! This is good, in many ways. Already users trying out the builds have helped us fix many bugs in it. So I'm already raking in some of the benefits. It has also, understandably, led to a lot of people running their own tests, some more useful than others, some perhaps wrong, or inaccurate. In any case, first of all I wanted to discuss a little on how to analyze D2D performance with a simple firefox build.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Use the same build&lt;/strong&gt;&lt;br /&gt;
Don't compare a random nightly to this build in performance. The nightly builds contain updates, no two nightly builds will be the same, and therefor perform the same. I don't continuously keep my D2D builds up with the latest repository head. Additionally the build flags used may very well not be the same, for example some builds(like the nightlies) may be built with something called Profile Guided Optimization, which means the compiler analyzes hotspots, and optimizes them. This significantly improves their JavaScript performance. My test build is not build with PGO, although I might release a build using PGO as it gets more stable. This is probably causing some of the differences some people testing have been seeing. Please keep in mind that because this is not a final, complete build, it should probably not be compared too enthusiastically to other browsers either.&lt;/p&gt;

&lt;p&gt;If you want to properly compare performance, use my build, and switch on the forcegdi pref. Go to 'about:config' and look for the font.engine.forcegdi pref, and set that to true. After that, you will have a build using GDI only. &lt;/p&gt;

&lt;p&gt;Obviously I should have mentioned this in my previous post, so people would not have wasted their time on inaccurate performance analysis. I apologize for that, it is partially because I had not expected so much publicity.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Focus on what (should be) different&lt;/strong&gt;&lt;br /&gt;
When you do run tests, it is of course always valuable to get measurements on the overall performance of the browser. If there's some other part of the browser than rendering showing performance decreases, I'm doing something wrong and please do let me know! There is however, a lot of more involved with displaying and parsing a webpage than just the rendering. If you want to get a really good idea on what it does to your rendering speed, you'll want to measure solely the time it takes to do the actual drawing. We have a non-cross-browser tool in Mozilla in my build that will allow you to do this. You can add a 'bookmarklet' that runs this test, just add a bookmark, and make it point to 'javascript:var r = window.QueryInterface(Components.interfaces.nsIInterfaceRequestor).getInterface(Components.interfaces.nsIDOMWindowUtils).redraw(500); alert(r + &quot; ms&quot;); where the number inside 'redraw' is the number of rendering runs you want to time. It will then pop up an alert box which will tell you the time in milliseconds it took to execute the redraws. Keep in mind this still only analyzes static rendering performance.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Know what you're measuring, and how you're doing it&lt;/strong&gt;&lt;br /&gt;
If you are using an independent measurement benchmark. Be sure you understand well exactly what it measures, and how it does it. This is a very important step. Something spewing out a number and then listing 'higher is better' for a certain part of functionality is great, but it only becomes useful information when you know how the measurement is executed, what it's margin of error is, and what the overhead is it adds to the whatever it is testing. For a lot of all-round browser benchmarks, rendering is only a small part of what's tested. And the total test result differences between D2D enabled and disabled, may not reflect the actual difference in user experience.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Considerations on static page-loading measurements&lt;/strong&gt;&lt;br /&gt;
Since obviously just a rendering improvement if it doesn't actually function better for the end user is practically useless, keep in mind that when you're timing how long it takes to load a page, you're timing all the aforementioned overhead. When interacting with the page without switching to another page, a lot of this overhead does not occur, and a large part of time might be spent in actual rendering. This means that during dynamic interaction (like scrolling), improvements may be more noticeable, although harder to measure.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;And finally, thanks!&lt;/strong&gt;&lt;br /&gt;
It's been great to see how many people are trying this, and as I mentioned earlier in this post, it has already greatly assisted us. It's also great that people are working on their own tests of performance and such things, it is always a good thing to have independent performance tests ran. And this too, will help us improve on the build in areas where our own testing may have been lacking. So, thanks, to everyone who is directly or indirectly helping to hopefully provide a great new feature!&lt;/p&gt;&lt;div class=&quot;item_footer&quot;&gt;&lt;p&gt;&lt;small&gt;&lt;a href=&quot;http://www.basschouten.com/blog1.php/2009/11/25/firefox-and-direct2d-performance-analysi&quot;&gt;Original post&lt;/a&gt; blogged on &lt;a href=&quot;http://b2evolution.net/&quot;&gt;b2evolution&lt;/a&gt;.&lt;/small&gt;&lt;/p&gt;&lt;/div&gt;</description>
			<content:encoded><![CDATA[<p>So, it seems my <a href="http://www.basschouten.com/blog1.php/2009/11/22/direct2d-hardware-rendering-a-browser">little demo</a> of a pre-alpha firefox build with Direct2D support has generated quite some attention! This is good, in many ways. Already users trying out the builds have helped us fix many bugs in it. So I'm already raking in some of the benefits. It has also, understandably, led to a lot of people running their own tests, some more useful than others, some perhaps wrong, or inaccurate. In any case, first of all I wanted to discuss a little on how to analyze D2D performance with a simple firefox build.</p>

<p><strong>Use the same build</strong><br />
Don't compare a random nightly to this build in performance. The nightly builds contain updates, no two nightly builds will be the same, and therefor perform the same. I don't continuously keep my D2D builds up with the latest repository head. Additionally the build flags used may very well not be the same, for example some builds(like the nightlies) may be built with something called Profile Guided Optimization, which means the compiler analyzes hotspots, and optimizes them. This significantly improves their JavaScript performance. My test build is not build with PGO, although I might release a build using PGO as it gets more stable. This is probably causing some of the differences some people testing have been seeing. Please keep in mind that because this is not a final, complete build, it should probably not be compared too enthusiastically to other browsers either.</p>

<p>If you want to properly compare performance, use my build, and switch on the forcegdi pref. Go to 'about:config' and look for the font.engine.forcegdi pref, and set that to true. After that, you will have a build using GDI only. </p>

<p>Obviously I should have mentioned this in my previous post, so people would not have wasted their time on inaccurate performance analysis. I apologize for that, it is partially because I had not expected so much publicity.</p>

<p><strong>Focus on what (should be) different</strong><br />
When you do run tests, it is of course always valuable to get measurements on the overall performance of the browser. If there's some other part of the browser than rendering showing performance decreases, I'm doing something wrong and please do let me know! There is however, a lot of more involved with displaying and parsing a webpage than just the rendering. If you want to get a really good idea on what it does to your rendering speed, you'll want to measure solely the time it takes to do the actual drawing. We have a non-cross-browser tool in Mozilla in my build that will allow you to do this. You can add a 'bookmarklet' that runs this test, just add a bookmark, and make it point to 'javascript:var r = window.QueryInterface(Components.interfaces.nsIInterfaceRequestor).getInterface(Components.interfaces.nsIDOMWindowUtils).redraw(500); alert(r + " ms"); where the number inside 'redraw' is the number of rendering runs you want to time. It will then pop up an alert box which will tell you the time in milliseconds it took to execute the redraws. Keep in mind this still only analyzes static rendering performance.</p>

<p><strong>Know what you're measuring, and how you're doing it</strong><br />
If you are using an independent measurement benchmark. Be sure you understand well exactly what it measures, and how it does it. This is a very important step. Something spewing out a number and then listing 'higher is better' for a certain part of functionality is great, but it only becomes useful information when you know how the measurement is executed, what it's margin of error is, and what the overhead is it adds to the whatever it is testing. For a lot of all-round browser benchmarks, rendering is only a small part of what's tested. And the total test result differences between D2D enabled and disabled, may not reflect the actual difference in user experience.</p>

<p><strong>Considerations on static page-loading measurements</strong><br />
Since obviously just a rendering improvement if it doesn't actually function better for the end user is practically useless, keep in mind that when you're timing how long it takes to load a page, you're timing all the aforementioned overhead. When interacting with the page without switching to another page, a lot of this overhead does not occur, and a large part of time might be spent in actual rendering. This means that during dynamic interaction (like scrolling), improvements may be more noticeable, although harder to measure.</p>

<p><strong>And finally, thanks!</strong><br />
It's been great to see how many people are trying this, and as I mentioned earlier in this post, it has already greatly assisted us. It's also great that people are working on their own tests of performance and such things, it is always a good thing to have independent performance tests ran. And this too, will help us improve on the build in areas where our own testing may have been lacking. So, thanks, to everyone who is directly or indirectly helping to hopefully provide a great new feature!</p><div class="item_footer"><p><small><a href="http://www.basschouten.com/blog1.php/2009/11/25/firefox-and-direct2d-performance-analysi">Original post</a> blogged on <a href="http://b2evolution.net/">b2evolution</a>.</small></p></div>]]></content:encoded>
								<comments>http://www.basschouten.com/blog1.php/2009/11/25/firefox-and-direct2d-performance-analysi#comments</comments>
		</item>
				<item>
			<title>Direct2D: Hardware Rendering a Browser</title>
			<link>http://www.basschouten.com/blog1.php/2009/11/22/direct2d-hardware-rendering-a-browser</link>
			<pubDate>Sun, 22 Nov 2009 21:49:49 +0000</pubDate>			<dc:creator>Bas</dc:creator>
			<category domain="main">Uncategorized</category>			<guid isPermaLink="false">3@http://www.basschouten.com/</guid>
						<description>&lt;p&gt;A short while ago I wrote about my work on DirectWrite usage in Firefox. Next to DirectWrite, Microsoft also published another new API with Windows 7 (and the Vista Platform Update), called &lt;a href=&quot;http://en.wikipedia.org/wiki/Direct2D&quot;&gt;Direct2D&lt;/a&gt;. Direct2D is designed as a replacement for GDI and functions as a vector graphics rendering engine, using GPU acceleration to give large performance boosts to transformations and blending operations.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Why GPU acceleration?&lt;/strong&gt;&lt;br /&gt;
First of all why is GPU acceleration important? Well, in modern day computers, it's pretty common to have a relatively powerful GPU. Since the GPU can specialize in very specific operations (namely vertex transformations and pixel operations), it is much faster than the CPU for those specific operations. Where the fastest desktop CPUs clock in the hundreds of GFLOPS(billion floating point operations per second), the fastest GPUs clock in the TFLOPS(trillion floating point operations per second). Currently the GPU is mainly used in video games, and its usage in desktop rendering is limited. Direct2D signifies an important step towards a future where more and more desktop software will use the GPU where available to provide better quality and better performance rendering.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Direct2D usage in Firefox&lt;/strong&gt;&lt;br /&gt;
A while ago I started my investigation into Direct2D usage in firefox (see &lt;a href=&quot;https://bugzilla.mozilla.org/show_bug.cgi?id=527707&quot;&gt;bug 527707&lt;/a&gt;). Since then we've made significant progress and are now able to present a Firefox browser completely rendered using Direct2D, making intensive usage of the GPU (this includes the UI, menu bars, etc.). I won't be showing any screenshots, since it is not supposed to look much different. But I will be sharing some technical details, first performance indications and a test build for those of you running Windows 7 or an updated version of Vista!&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Implementation&lt;/strong&gt;&lt;br /&gt;
Direct2D has been implemented as a Cairo backend, meaning our work can eventually be used to facilitate Direct2D usage by all Cairo based software. We use Direct3D textures as backing store for all surfaces. This allows us to implement operations not supported by Direct2D using Direct3D, this will prevent software fallbacks being needed, which will require readbacks. Since a readback forces the GPU to transfer memory to the CPU before the CPU can read it, readbacks have significant performance penalties because of GPU-CPU synchronization being required. On Direct3D10+ hardware this should not negatively impact performance, it does mean it is harder to implement effective D2D software fallback. Although in that scenario we could continue using Cairo with GDI as our vector graphics rendering system.&lt;/p&gt;

&lt;p&gt;Internally here's a rough mapping of cairo concepts to D2D concepts:&lt;/p&gt;

&lt;p&gt;cairo_surface_t - ID2D1RenderTarget&lt;br /&gt;
cairo_pattern_t - ID2D1Brush&lt;br /&gt;
cairo clip path - ID2D1Layer with GeometryMask&lt;br /&gt;
cairo_path_t - ID2D1PathGeometry&lt;br /&gt;
cairo_stroke_style_t - ID2D1StrokeStyle&lt;/p&gt;

&lt;p&gt;More about the implementation can be learned by looking at the patches included on the bug! Now to look at how well it works.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Website Benchmarks&lt;/strong&gt;&lt;br /&gt;
First of all let's look at the page rendering times. I've graphed the rendering time for several common websites together with the error margin of my measurements. The used testing hardware was a Core i7 920 with a Radeon HD4850 Graphics card:&lt;br /&gt;
&lt;img src=&quot;http://www.basschouten.com/media/blogs/blog/direct2d/D2DGDIPerf1.png&quot; alt=&quot;&quot; title=&quot;&quot; width=&quot;100%&quot; /&gt;&lt;/p&gt;

&lt;p&gt;There's some interesting conclusions to be drawn from this graph. First of all it can be seen that Direct2D, on this hardware, performance significantly better or similarly on all tested website. What can also be seen is that on complexly structured websites the performance advantages are significantly less, and the error margin in the measurements can be seen to be larger (i.e. different rendering runs of the same site deviated more strongly). The exact reasons for this I am still unsure of. One reason could be is that the websites contain significant amounts of text or complex polygons as well, for those scenarios with few transformations and blending operations the GPU will show smaller advantages over the CPU. Additionally the CPU will be spending more time processing the actual items to be displayed, which might decrease the significance of the actual drawing operations somewhat.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Other Performance Considerations&lt;/strong&gt;&lt;br /&gt;
Although the static website rendering is an interesting benchmarks. There are other, atleast as important considerations to the performance. As websites become more graphically intense dynamic graphics will start playing a larger role. Especially in user interfaces. If we look at some interesting sites using fancy opacity and transformation effects(take for example &lt;a href=&quot;http://people.mozilla.com/~vladimir/demos/photos.svg&quot;&gt;photos.svg&lt;/a&gt;), we can see that D2D provides a much better experience on the test system. Where on sizing up photos GDI will quickly drop in framerate to a jittery experience, Direct2D will remain completely smooth.&lt;/p&gt;

&lt;p&gt;Another interesting consideration is scrolling. Since on scrolling only small parts of the website need to be re-drawn, it has the potential of creating a much smoother scrolling experience when using Direct2D. This is also the feedback we've received from people utilizing the test builds.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Conclusions&lt;/strong&gt;&lt;br /&gt;
Although the investigation and implementation are still in an early stage, we can conclude that things are looking very promising for Direct2D. Though older PCs with pre-D3D10 graphics cards and WDDM 1.0 drivers will not show significant improvements, going into the future most PCs will support DirectX 10+. PCs in the future could allow providing extremely smooth graphical experiences for web-content like SVG or transformed CSS. Interestingly, Microsoft has also &lt;a href=&quot;http://blogs.msdn.com/ie/archive/2009/11/18/an-early-look-at-ie9-for-developers.aspx&quot;&gt;announced&lt;/a&gt; IE9 will feature Direct2D support as well only shortly ago. Feel free to download and try a build of Firefox with Direct2D support &lt;a href=&quot;http://www.bassified.nl/firefox-3.7a1pre.en-US.win32.d2d.2009.12.20.zip&quot; title=&quot;&quot;&gt;here&lt;/a&gt;. There are several known issues and in some cases some rendering artifacts may appear. In general it should be quite usable on D3D10 graphics cards. It may or may not work on D3D9 graphic cards, depending on exact graphics card specifications.&lt;/p&gt;

&lt;p&gt;Well, that's it for now, I hope I've given you an interesting first glance into the future of desktop graphics.&lt;/p&gt;

&lt;p&gt;NOTE: If you want to do your own performance analysis, please see my other blogpost about the subject &lt;a href=&quot;http://www.basschouten.com/blog1.php/2009/11/25/firefox-and-direct2d-performance-analysi&quot;&gt;here&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;NOTE2: For those not used to running experimental builds. If you would just execute this .exe while having normal firefox running. You will get another window of your normal firefox. You need to either close your normal firefox, or run it from the command line on a different profile, using: 'firefox -no-remote -P d2d'.&lt;/p&gt;&lt;div class=&quot;item_footer&quot;&gt;&lt;p&gt;&lt;small&gt;&lt;a href=&quot;http://www.basschouten.com/blog1.php/2009/11/22/direct2d-hardware-rendering-a-browser&quot;&gt;Original post&lt;/a&gt; blogged on &lt;a href=&quot;http://b2evolution.net/&quot;&gt;b2evolution&lt;/a&gt;.&lt;/small&gt;&lt;/p&gt;&lt;/div&gt;</description>
			<content:encoded><![CDATA[<p>A short while ago I wrote about my work on DirectWrite usage in Firefox. Next to DirectWrite, Microsoft also published another new API with Windows 7 (and the Vista Platform Update), called <a href="http://en.wikipedia.org/wiki/Direct2D">Direct2D</a>. Direct2D is designed as a replacement for GDI and functions as a vector graphics rendering engine, using GPU acceleration to give large performance boosts to transformations and blending operations.</p>

<p><strong>Why GPU acceleration?</strong><br />
First of all why is GPU acceleration important? Well, in modern day computers, it's pretty common to have a relatively powerful GPU. Since the GPU can specialize in very specific operations (namely vertex transformations and pixel operations), it is much faster than the CPU for those specific operations. Where the fastest desktop CPUs clock in the hundreds of GFLOPS(billion floating point operations per second), the fastest GPUs clock in the TFLOPS(trillion floating point operations per second). Currently the GPU is mainly used in video games, and its usage in desktop rendering is limited. Direct2D signifies an important step towards a future where more and more desktop software will use the GPU where available to provide better quality and better performance rendering.</p>

<p><strong>Direct2D usage in Firefox</strong><br />
A while ago I started my investigation into Direct2D usage in firefox (see <a href="https://bugzilla.mozilla.org/show_bug.cgi?id=527707">bug 527707</a>). Since then we've made significant progress and are now able to present a Firefox browser completely rendered using Direct2D, making intensive usage of the GPU (this includes the UI, menu bars, etc.). I won't be showing any screenshots, since it is not supposed to look much different. But I will be sharing some technical details, first performance indications and a test build for those of you running Windows 7 or an updated version of Vista!</p>

<p><strong>Implementation</strong><br />
Direct2D has been implemented as a Cairo backend, meaning our work can eventually be used to facilitate Direct2D usage by all Cairo based software. We use Direct3D textures as backing store for all surfaces. This allows us to implement operations not supported by Direct2D using Direct3D, this will prevent software fallbacks being needed, which will require readbacks. Since a readback forces the GPU to transfer memory to the CPU before the CPU can read it, readbacks have significant performance penalties because of GPU-CPU synchronization being required. On Direct3D10+ hardware this should not negatively impact performance, it does mean it is harder to implement effective D2D software fallback. Although in that scenario we could continue using Cairo with GDI as our vector graphics rendering system.</p>

<p>Internally here's a rough mapping of cairo concepts to D2D concepts:</p>

<p>cairo_surface_t - ID2D1RenderTarget<br />
cairo_pattern_t - ID2D1Brush<br />
cairo clip path - ID2D1Layer with GeometryMask<br />
cairo_path_t - ID2D1PathGeometry<br />
cairo_stroke_style_t - ID2D1StrokeStyle</p>

<p>More about the implementation can be learned by looking at the patches included on the bug! Now to look at how well it works.</p>

<p><strong>Website Benchmarks</strong><br />
First of all let's look at the page rendering times. I've graphed the rendering time for several common websites together with the error margin of my measurements. The used testing hardware was a Core i7 920 with a Radeon HD4850 Graphics card:<br />
<img src="http://www.basschouten.com/media/blogs/blog/direct2d/D2DGDIPerf1.png" alt="" title="" width="100%" /></p>

<p>There's some interesting conclusions to be drawn from this graph. First of all it can be seen that Direct2D, on this hardware, performance significantly better or similarly on all tested website. What can also be seen is that on complexly structured websites the performance advantages are significantly less, and the error margin in the measurements can be seen to be larger (i.e. different rendering runs of the same site deviated more strongly). The exact reasons for this I am still unsure of. One reason could be is that the websites contain significant amounts of text or complex polygons as well, for those scenarios with few transformations and blending operations the GPU will show smaller advantages over the CPU. Additionally the CPU will be spending more time processing the actual items to be displayed, which might decrease the significance of the actual drawing operations somewhat.</p>

<p><strong>Other Performance Considerations</strong><br />
Although the static website rendering is an interesting benchmarks. There are other, atleast as important considerations to the performance. As websites become more graphically intense dynamic graphics will start playing a larger role. Especially in user interfaces. If we look at some interesting sites using fancy opacity and transformation effects(take for example <a href="http://people.mozilla.com/~vladimir/demos/photos.svg">photos.svg</a>), we can see that D2D provides a much better experience on the test system. Where on sizing up photos GDI will quickly drop in framerate to a jittery experience, Direct2D will remain completely smooth.</p>

<p>Another interesting consideration is scrolling. Since on scrolling only small parts of the website need to be re-drawn, it has the potential of creating a much smoother scrolling experience when using Direct2D. This is also the feedback we've received from people utilizing the test builds.</p>

<p><strong>Conclusions</strong><br />
Although the investigation and implementation are still in an early stage, we can conclude that things are looking very promising for Direct2D. Though older PCs with pre-D3D10 graphics cards and WDDM 1.0 drivers will not show significant improvements, going into the future most PCs will support DirectX 10+. PCs in the future could allow providing extremely smooth graphical experiences for web-content like SVG or transformed CSS. Interestingly, Microsoft has also <a href="http://blogs.msdn.com/ie/archive/2009/11/18/an-early-look-at-ie9-for-developers.aspx">announced</a> IE9 will feature Direct2D support as well only shortly ago. Feel free to download and try a build of Firefox with Direct2D support <a href="http://www.bassified.nl/firefox-3.7a1pre.en-US.win32.d2d.2009.12.20.zip" title="">here</a>. There are several known issues and in some cases some rendering artifacts may appear. In general it should be quite usable on D3D10 graphics cards. It may or may not work on D3D9 graphic cards, depending on exact graphics card specifications.</p>

<p>Well, that's it for now, I hope I've given you an interesting first glance into the future of desktop graphics.</p>

<p>NOTE: If you want to do your own performance analysis, please see my other blogpost about the subject <a href="http://www.basschouten.com/blog1.php/2009/11/25/firefox-and-direct2d-performance-analysi">here</a></p>

<p>NOTE2: For those not used to running experimental builds. If you would just execute this .exe while having normal firefox running. You will get another window of your normal firefox. You need to either close your normal firefox, or run it from the command line on a different profile, using: 'firefox -no-remote -P d2d'.</p><div class="item_footer"><p><small><a href="http://www.basschouten.com/blog1.php/2009/11/22/direct2d-hardware-rendering-a-browser">Original post</a> blogged on <a href="http://b2evolution.net/">b2evolution</a>.</small></p></div>]]></content:encoded>
								<comments>http://www.basschouten.com/blog1.php/2009/11/22/direct2d-hardware-rendering-a-browser#comments</comments>
		</item>
				<item>
			<title>Font Rendering: GDI versus DirectWrite</title>
			<link>http://www.basschouten.com/blog1.php/2009/10/27/font-rendering-gdi-versus-directwrite</link>
			<pubDate>Tue, 27 Oct 2009 20:16:00 +0000</pubDate>			<dc:creator>Bas</dc:creator>
			<category domain="main">Uncategorized</category>			<guid isPermaLink="false">2@http://www.basschouten.com/</guid>
						<description>&lt;p&gt;So, this is where I give my first blog post a shot. Let's see how it goes. So, I've been working for Mozilla on implementing DirectWrite as a Cairo and gfxFont backend, in order to investigate the differences, see &lt;a href=&quot;https://bugzilla.mozilla.org/show_bug.cgi?id=517642&quot;&gt;bug 51642&lt;/a&gt;. &lt;a href=&quot;http://en.wikipedia.org/wiki/DirectWrite&quot;&gt;DirectWrite&lt;/a&gt; is a new font rendering API that was released with Windows 7, and will be included in the Vista platform update for Windows Vista SP2. It offers a number of advantages over the old GDI font rendering system, which I will attempt to elaborate on. The main advantages that it has over GDI are:&lt;br /&gt;
  &lt;/p&gt;&lt;ul&gt;
&lt;li&gt;Sub-pixel shaping and rendering&lt;/li&gt;&lt;li&gt;Bi-directional anti-aliasing. (GDI only supported horizontal anti-aliasing)&lt;/li&gt;&lt;/ul&gt;
&lt;p&gt;JDagget already has a nice post on CFF font rendering &lt;a href=&quot;http://blog.mozilla.com/nattokirai/2009/10/22/better-postscript-cff-font-rendering-with-directwrite/&quot;&gt;here&lt;/a&gt;. I'm hoping to give some additional information here.&lt;br /&gt;
 &lt;br /&gt;
First of all let's look at the W as found on the front page of the Mozilla Minefield start page:&lt;/p&gt;
&lt;center&gt;&lt;table&gt;&lt;tr&gt;&lt;td align=center&gt;&lt;strong&gt;GDI&lt;/strong&gt;&lt;/td&gt;&lt;td align=center&gt;&lt;strong&gt;DirectWrite&lt;/strong&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td align=center&gt;&lt;img src=&quot;http://www.basschouten.com/media/blogs/blog/directwrite/SerifsGDI.png&quot; alt=&quot;&quot; title=&quot;&quot; /&gt;&lt;/td&gt;&lt;td align=center&gt;&lt;img src=&quot;http://www.basschouten.com/media/blogs/blog/directwrite/SerifsDWrite.png&quot; alt=&quot;&quot; title=&quot;&quot; /&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td align=center&gt;&lt;img src=&quot;http://www.basschouten.com/media/blogs/blog/directwrite/SerifsDetailGDI.png&quot; alt=&quot;&quot; title=&quot;&quot; width=200 /&gt;&lt;/td&gt;&lt;td align=center&gt;&lt;img src=&quot;http://www.basschouten.com/media/blogs/blog/directwrite/SerifsDetailDWrite.png&quot; alt=&quot;&quot; title=&quot;&quot; width=200 /&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;&lt;/center&gt;
&lt;p&gt;First of all it can be seen that the subpixel anti-aliasing is 'softer' in the DirectWrite version. Where in GDI the cleartype anti-aliasing introduces a fairly strong colorization (the left edge is clearly yellowish, the right side is clearly purple-ish), the DirectWrite version introduces a more natural color transition with the sub-pixel anti-aliasing.&lt;br /&gt;
Another difference that can be seen are the serifs at the top of the W, there the advantage of vertical anti-aliasing can clearly be seen, where in the GDI version the serif is really mostly a block of 2 pixels high, the vertical anti-aliasing in the DirectWrite version introduces the actual curve expected in a serif.&lt;/p&gt;

&lt;p&gt;Another big advantage of using DirectWrite can clearly be seen when we look at transformed texts. The following are different transformation situations, comparing the results between DirectWrite and GDI:&lt;/p&gt;
&lt;center&gt;&lt;table&gt;&lt;tr&gt;&lt;td align=center&gt;&lt;strong&gt;GDI&lt;/strong&gt;&lt;/td&gt;&lt;td align=center&gt;&lt;strong&gt;DirectWrite&lt;/strong&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td align=center&gt;&lt;img src=&quot;http://www.basschouten.com/media/blogs/blog/directwrite/Transform1GDI.png&quot; alt=&quot;&quot; title=&quot;&quot; /&gt;&lt;/td&gt;&lt;td align=center&gt;&lt;img src=&quot;http://www.basschouten.com/media/blogs/blog/directwrite/Transform1DWrite.png&quot; alt=&quot;&quot; title=&quot;&quot; /&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td align=center&gt;&lt;img src=&quot;http://www.basschouten.com/media/blogs/blog/directwrite/Transform2GDI.png&quot; alt=&quot;&quot; title=&quot;&quot; /&gt;&lt;/td&gt;&lt;td align=center&gt;&lt;img src=&quot;http://www.basschouten.com/media/blogs/blog/directwrite/Transform2DWrite.png&quot; alt=&quot;&quot; title=&quot;&quot; /&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td align=center&gt;&lt;img src=&quot;http://www.basschouten.com/media/blogs/blog/directwrite/Transform3GDI.png&quot; alt=&quot;&quot; title=&quot;&quot; /&gt;&lt;/td&gt;&lt;td align=center&gt;&lt;img src=&quot;http://www.basschouten.com/media/blogs/blog/directwrite/Transform3DWrite.png&quot; alt=&quot;&quot; title=&quot;&quot; /&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;&lt;/center&gt;
&lt;p&gt;In the first example it can clearly be seen that GDI has clear aliasing and placement issues when rendering transformed fonts which DirectWrite doesn't suffer from. A displacement in the line of the 'B' from button can clearly be seen. Also the lack of vertical anti-aliasing is clearly visible in the transformed setting where the main lines of the font are diagonally placed.&lt;/p&gt;

&lt;p&gt;The second image again illustrates the improved subpixel anti-aliasing performance in DirectWrite. The DirectWrite case looks quite good, whereas in the GDI case the text is barely legible. The anti-aliasing issues GDI has here are clearly visible in the i in 'becoming' where it actually shows as a red letter because of inaccurate sub-pixel usage. Additionally several lines and curves of the letters are simply not visible in the GDI case.&lt;/p&gt;

&lt;p&gt;The last image in this series shows another interesting property. The most notable effect in this image is the pixel snapping occuring on the letters by GDI. It can clearly be seen that the letters are snapped to whole pixels on the circle. Where in the case of untransformed text the baseline is completely aligned on pixels, this is not a big issue. In the case of the circular baseline, this means the 'O' of the second case of 'round' actually floats above the line, and the 'e' in the first 'We' is actually floating above the baseline. In the DirectWrite version the benefit of the subpixel positioning can clearly be seen as the text is nicely aligned along the circle.&lt;/p&gt;

&lt;p&gt;The advantages of subpixel positioning are not limited to transformed text though, below is an example of how subpixel positioning can improve the kerning of text.&lt;/p&gt;

&lt;center&gt;&lt;table&gt;&lt;tr&gt;&lt;td align=center&gt;&lt;strong&gt;GDI&lt;/strong&gt;&lt;/td&gt;&lt;td align=center&gt;&lt;strong&gt;DirectWrite&lt;/strong&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td align=center&gt;&lt;img src=&quot;http://www.basschouten.com/media/blogs/blog/directwrite/KerningGDI.png&quot; alt=&quot;&quot; title=&quot;&quot; /&gt;&lt;/td&gt;&lt;td align=center&gt;&lt;img src=&quot;http://www.basschouten.com/media/blogs/blog/directwrite/KerningDWrite.png&quot; alt=&quot;&quot; title=&quot;&quot; /&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;&lt;/center&gt;&lt;p&gt;&lt;/p&gt;

&lt;p&gt;In the GDI example it is clear that the spacing between the E and the V is rather odd. You can see this effect if you go to the &lt;a href=&quot;http://www.mozilla.org/&quot;&gt;Mozilla website&lt;/a&gt; and slowly, pixel by pixel, decrease the horizontal size of the window. You can see the letters 'dance around' with respect to eachother as each individual glyph's origin gets snapped to a vertical pixel row. When using DirectWrite, subpixel placement means the glyphs are spaced identically at all window sizes.&lt;/p&gt;

&lt;p&gt;The final screenshots I'd like to show are a general look at the browser UI:&lt;br /&gt;
&lt;center&gt;&lt;strong&gt;GDI&lt;/strong&gt;&lt;/center&gt;&lt;br /&gt;
&lt;img src=&quot;http://www.basschouten.com/media/blogs/blog/directwrite/MenuGDI.png&quot; alt=&quot;&quot; title=&quot;&quot; /&gt;&lt;br /&gt;
&lt;center&gt;&lt;strong&gt;DWrite&lt;/strong&gt;&lt;/center&gt;&lt;br /&gt;
&lt;img src=&quot;http://www.basschouten.com/media/blogs/blog/directwrite/MenuDWrite.png&quot; alt=&quot;&quot; title=&quot;&quot; /&gt;&lt;/p&gt;

&lt;p&gt;Now this is where DirectWrite arguably does not perform better. The DirectWrite UI clearly looks 'lighter' than the GDI UI. And although the curves and letters are smoother. At the font size and DPI in the situation of the screenshots it is likely very personal as to which one you feel is better. One advantage that DirectWrite does have is the superior subpixel anti-aliasing again. In the GDI example there's clear colorization at the horizontal boundaries of the lines. DirectWrite does not suffer from this, a final image illustrates this:&lt;br /&gt;
&lt;center&gt;&lt;strong&gt;GDI&lt;/strong&gt;&lt;/center&gt;&lt;br /&gt;
&lt;center&gt;&lt;img src=&quot;http://www.basschouten.com/media/blogs/blog/directwrite/MenuDetailGDI.png&quot; alt=&quot;&quot; title=&quot;&quot; /&gt;&lt;/center&gt;&lt;br /&gt;
&lt;center&gt;&lt;strong&gt;DWrite&lt;/strong&gt;&lt;/center&gt;&lt;br /&gt;
&lt;center&gt;&lt;img src=&quot;http://www.basschouten.com/media/blogs/blog/directwrite/MenuDetailDWrite.png&quot; alt=&quot;&quot; title=&quot;&quot; /&gt;&lt;/center&gt;&lt;/p&gt;

&lt;p&gt;I hope I've given everybody reading this a bit of an idea of the quality differences between GDI and DirectWrite. The last point I'd like to mention briefly is performance. The current implementation primarily uses draws to a Direct2D surface created using CreateDCRenderTarget, this means that for every font operation, Direct2D will rebind the DC render target to a GDI surface. For a DCRenderTarget Direct2D internally does as much hardware acceleration as possible, and then blits that surface to the software GDI surface when done. As a fallback it can draw to a DirectWrite GDI interop surface. But this codepath should usually not be used.&lt;/p&gt;

&lt;p&gt;When using the Direct2D method performance at the moment is slightly worse than in GDI. Interestingly enough CPU usage does not saturate when actively continuously re-rendering fonts, this is most likely due to the font rendering blocking waiting for hardware rendering operations to finish. Making the rendering thread regularly relinguish some of its time slice as it starts waiting for the display hardware. Part of the decrease in performance can probably be attributed to the fact DirectWrite simply does more work that GDI does. Should certain features be disabled it will probably perform better. Additionally a more clever way should be devised to manage the D2D surfaces, in theory each gfxWindowsSurface could have a D2D DCRenderTarget, and keep hold of that, preventing the surface binding currently needed on every single font drawing operation.&lt;/p&gt;

&lt;p&gt;Well, that's about it for this post. I hope my first attempt at this sort of post is an interesting read for everyone! I hope to be able to share more information in the near future. Oh, and before I forget! There's a &lt;a href=&quot;http://www.basschouten.com/media/blogs/blog/directwrite/dwrite-win32.zip&quot; title=&quot;&quot;&gt;try-server build&lt;/a&gt; that will use DirectWrite on Windows 7, feel free to try it on your favourite font stress-test!&lt;/p&gt;&lt;div class=&quot;item_footer&quot;&gt;&lt;p&gt;&lt;small&gt;&lt;a href=&quot;http://www.basschouten.com/blog1.php/2009/10/27/font-rendering-gdi-versus-directwrite&quot;&gt;Original post&lt;/a&gt; blogged on &lt;a href=&quot;http://b2evolution.net/&quot;&gt;b2evolution&lt;/a&gt;.&lt;/small&gt;&lt;/p&gt;&lt;/div&gt;</description>
			<content:encoded><![CDATA[<p>So, this is where I give my first blog post a shot. Let's see how it goes. So, I've been working for Mozilla on implementing DirectWrite as a Cairo and gfxFont backend, in order to investigate the differences, see <a href="https://bugzilla.mozilla.org/show_bug.cgi?id=517642">bug 51642</a>. <a href="http://en.wikipedia.org/wiki/DirectWrite">DirectWrite</a> is a new font rendering API that was released with Windows 7, and will be included in the Vista platform update for Windows Vista SP2. It offers a number of advantages over the old GDI font rendering system, which I will attempt to elaborate on. The main advantages that it has over GDI are:<br />
  </p><ul>
<li>Sub-pixel shaping and rendering</li><li>Bi-directional anti-aliasing. (GDI only supported horizontal anti-aliasing)</li></ul>
<p>JDagget already has a nice post on CFF font rendering <a href="http://blog.mozilla.com/nattokirai/2009/10/22/better-postscript-cff-font-rendering-with-directwrite/">here</a>. I'm hoping to give some additional information here.<br />
 <br />
First of all let's look at the W as found on the front page of the Mozilla Minefield start page:</p>
<center><table><tr><td align=center><strong>GDI</strong></td><td align=center><strong>DirectWrite</strong></td></tr><tr><td align=center><img src="http://www.basschouten.com/media/blogs/blog/directwrite/SerifsGDI.png" alt="" title="" /></td><td align=center><img src="http://www.basschouten.com/media/blogs/blog/directwrite/SerifsDWrite.png" alt="" title="" /></td></tr><tr><td align=center><img src="http://www.basschouten.com/media/blogs/blog/directwrite/SerifsDetailGDI.png" alt="" title="" width=200 /></td><td align=center><img src="http://www.basschouten.com/media/blogs/blog/directwrite/SerifsDetailDWrite.png" alt="" title="" width=200 /></td></tr></table></center>
<p>First of all it can be seen that the subpixel anti-aliasing is 'softer' in the DirectWrite version. Where in GDI the cleartype anti-aliasing introduces a fairly strong colorization (the left edge is clearly yellowish, the right side is clearly purple-ish), the DirectWrite version introduces a more natural color transition with the sub-pixel anti-aliasing.<br />
Another difference that can be seen are the serifs at the top of the W, there the advantage of vertical anti-aliasing can clearly be seen, where in the GDI version the serif is really mostly a block of 2 pixels high, the vertical anti-aliasing in the DirectWrite version introduces the actual curve expected in a serif.</p>

<p>Another big advantage of using DirectWrite can clearly be seen when we look at transformed texts. The following are different transformation situations, comparing the results between DirectWrite and GDI:</p>
<center><table><tr><td align=center><strong>GDI</strong></td><td align=center><strong>DirectWrite</strong></td></tr><tr><td align=center><img src="http://www.basschouten.com/media/blogs/blog/directwrite/Transform1GDI.png" alt="" title="" /></td><td align=center><img src="http://www.basschouten.com/media/blogs/blog/directwrite/Transform1DWrite.png" alt="" title="" /></td></tr><tr><td align=center><img src="http://www.basschouten.com/media/blogs/blog/directwrite/Transform2GDI.png" alt="" title="" /></td><td align=center><img src="http://www.basschouten.com/media/blogs/blog/directwrite/Transform2DWrite.png" alt="" title="" /></td></tr><tr><td align=center><img src="http://www.basschouten.com/media/blogs/blog/directwrite/Transform3GDI.png" alt="" title="" /></td><td align=center><img src="http://www.basschouten.com/media/blogs/blog/directwrite/Transform3DWrite.png" alt="" title="" /></td></tr></table></center>
<p>In the first example it can clearly be seen that GDI has clear aliasing and placement issues when rendering transformed fonts which DirectWrite doesn't suffer from. A displacement in the line of the 'B' from button can clearly be seen. Also the lack of vertical anti-aliasing is clearly visible in the transformed setting where the main lines of the font are diagonally placed.</p>

<p>The second image again illustrates the improved subpixel anti-aliasing performance in DirectWrite. The DirectWrite case looks quite good, whereas in the GDI case the text is barely legible. The anti-aliasing issues GDI has here are clearly visible in the i in 'becoming' where it actually shows as a red letter because of inaccurate sub-pixel usage. Additionally several lines and curves of the letters are simply not visible in the GDI case.</p>

<p>The last image in this series shows another interesting property. The most notable effect in this image is the pixel snapping occuring on the letters by GDI. It can clearly be seen that the letters are snapped to whole pixels on the circle. Where in the case of untransformed text the baseline is completely aligned on pixels, this is not a big issue. In the case of the circular baseline, this means the 'O' of the second case of 'round' actually floats above the line, and the 'e' in the first 'We' is actually floating above the baseline. In the DirectWrite version the benefit of the subpixel positioning can clearly be seen as the text is nicely aligned along the circle.</p>

<p>The advantages of subpixel positioning are not limited to transformed text though, below is an example of how subpixel positioning can improve the kerning of text.</p>

<center><table><tr><td align=center><strong>GDI</strong></td><td align=center><strong>DirectWrite</strong></td></tr><tr><td align=center><img src="http://www.basschouten.com/media/blogs/blog/directwrite/KerningGDI.png" alt="" title="" /></td><td align=center><img src="http://www.basschouten.com/media/blogs/blog/directwrite/KerningDWrite.png" alt="" title="" /></td></tr></table></center><p></p>

<p>In the GDI example it is clear that the spacing between the E and the V is rather odd. You can see this effect if you go to the <a href="http://www.mozilla.org/">Mozilla website</a> and slowly, pixel by pixel, decrease the horizontal size of the window. You can see the letters 'dance around' with respect to eachother as each individual glyph's origin gets snapped to a vertical pixel row. When using DirectWrite, subpixel placement means the glyphs are spaced identically at all window sizes.</p>

<p>The final screenshots I'd like to show are a general look at the browser UI:<br />
<center><strong>GDI</strong></center><br />
<img src="http://www.basschouten.com/media/blogs/blog/directwrite/MenuGDI.png" alt="" title="" /><br />
<center><strong>DWrite</strong></center><br />
<img src="http://www.basschouten.com/media/blogs/blog/directwrite/MenuDWrite.png" alt="" title="" /></p>

<p>Now this is where DirectWrite arguably does not perform better. The DirectWrite UI clearly looks 'lighter' than the GDI UI. And although the curves and letters are smoother. At the font size and DPI in the situation of the screenshots it is likely very personal as to which one you feel is better. One advantage that DirectWrite does have is the superior subpixel anti-aliasing again. In the GDI example there's clear colorization at the horizontal boundaries of the lines. DirectWrite does not suffer from this, a final image illustrates this:<br />
<center><strong>GDI</strong></center><br />
<center><img src="http://www.basschouten.com/media/blogs/blog/directwrite/MenuDetailGDI.png" alt="" title="" /></center><br />
<center><strong>DWrite</strong></center><br />
<center><img src="http://www.basschouten.com/media/blogs/blog/directwrite/MenuDetailDWrite.png" alt="" title="" /></center></p>

<p>I hope I've given everybody reading this a bit of an idea of the quality differences between GDI and DirectWrite. The last point I'd like to mention briefly is performance. The current implementation primarily uses draws to a Direct2D surface created using CreateDCRenderTarget, this means that for every font operation, Direct2D will rebind the DC render target to a GDI surface. For a DCRenderTarget Direct2D internally does as much hardware acceleration as possible, and then blits that surface to the software GDI surface when done. As a fallback it can draw to a DirectWrite GDI interop surface. But this codepath should usually not be used.</p>

<p>When using the Direct2D method performance at the moment is slightly worse than in GDI. Interestingly enough CPU usage does not saturate when actively continuously re-rendering fonts, this is most likely due to the font rendering blocking waiting for hardware rendering operations to finish. Making the rendering thread regularly relinguish some of its time slice as it starts waiting for the display hardware. Part of the decrease in performance can probably be attributed to the fact DirectWrite simply does more work that GDI does. Should certain features be disabled it will probably perform better. Additionally a more clever way should be devised to manage the D2D surfaces, in theory each gfxWindowsSurface could have a D2D DCRenderTarget, and keep hold of that, preventing the surface binding currently needed on every single font drawing operation.</p>

<p>Well, that's about it for this post. I hope my first attempt at this sort of post is an interesting read for everyone! I hope to be able to share more information in the near future. Oh, and before I forget! There's a <a href="http://www.basschouten.com/media/blogs/blog/directwrite/dwrite-win32.zip" title="">try-server build</a> that will use DirectWrite on Windows 7, feel free to try it on your favourite font stress-test!</p><div class="item_footer"><p><small><a href="http://www.basschouten.com/blog1.php/2009/10/27/font-rendering-gdi-versus-directwrite">Original post</a> blogged on <a href="http://b2evolution.net/">b2evolution</a>.</small></p></div>]]></content:encoded>
								<comments>http://www.basschouten.com/blog1.php/2009/10/27/font-rendering-gdi-versus-directwrite#comments</comments>
		</item>
				<item>
			<title>Starting a blog ...</title>
			<link>http://www.basschouten.com/blog1.php/2009/10/23/starting-a-blog</link>
			<pubDate>Fri, 23 Oct 2009 17:39:21 +0000</pubDate>			<dc:creator>Bas</dc:creator>
			<category domain="main">Uncategorized</category>			<guid isPermaLink="false">1@http://www.basschouten.com/</guid>
						<description>&lt;p&gt;So, it seems it's finally happened, I've decided to start a blog. Interestingly enough I've never really taken a lot of interest in things like blogging, microblogging, social networking or any other one of those popular internet activities. I don't have a facebook account, I've probably seen the twitter website about 3 or 4 times in my entire life. To be honest, if a year or so ago anyone would have asked me what the 10 things were I'd be least likely to do, starting a blog would probably rank somewhere high up in that list. So the question is, what brought about that amazing turnaround.&lt;/p&gt;

&lt;p&gt;Well, interestingly enough, people who know me personally know I have strong opinions on nearly everything conceivable. From politics to social interaction, I'm always up for a good discussion, and usually I'll be quite convinced I'm right as well. So, in theory that would mean I'd be quite inclined to start a blog, after all, no better way to vent your opinion to a large group of people! The problem is, opinions change, and the internet has a tremendous memory, I'm really not so sure I want the world to remember my current opinions and thoughts 20 years from now.&lt;/p&gt;

&lt;p&gt;This brings me to one of the reasons I'm not into a lot of these social internet activities. Normal social interaction, odd behavior, stupid actios, etcetera, exists in one point in time. You can get completely wasted and behave like a total idiot, but unless you do something stupid enough to hit the newspapers, the only record of this will be in the minds of people. You can then later say things like 'it wasn't that bad' or 'that's not how it happened', and noone would ever be able to fundamentally prove what you really did. The internet is a completely different world! Pretty much anything you do, no matter how silly, impulsive or stupid will be recorded and distributed to countless data storage devices. Yes, you better be real careful with what you do out there!&lt;/p&gt;

&lt;p&gt;The second reason is much more simple. I'm not actually that interested in what other people do in their social lives, that is not to say I don't care about other people, but if they want to share their social life and possibly hear my opinion I'm sure they'll tell me about what they did last week face-to-face. One of the few twitter messages I ever read was from a friend and contained the following information: 'drinking a good glass of red wine while cooking'. Although ofcourse that information is very interesting, considering the limited amount of time one has in life, there really is more interesting information out there.&lt;/p&gt;

&lt;p&gt;Finally I don't think people are that interested in what &lt;strong&gt;I&lt;/strong&gt; do. My life isn't, and has never been that interesting, I do a lot of fun things, but I don't see how anyone else would benefit by reading about them.&lt;/p&gt;

&lt;p&gt;So, the question asked remains, why a blog then? Well, the first point stands, but I suppose I'll just have to make sure I don't post too radical thoughts, and try not to post anything too stupid. Althought this is a hard task for me I think I'll manage that. As to the second point, I've noticed that although I'm still not interested in specifically what wine someone is drinking, or the tricks they can make their dog do, there's actually a fair deal of people posting much more informative and interesting things on their blogs. Making it actually an interesting way to keep up to date with the latest technical innovations people are working on.&lt;/p&gt;

&lt;p&gt;This brings us to the last point, and with that the reason I myself decided to start this blog. I recently started working as a contractor for the Mozilla Corporation. Very quickly after I started I got asked 'Let me know if you do a blog post, I'd love to see some screenshots...' And I concluded that I was doing things people would like to read about, evaluate and give useful feedback on.&lt;/p&gt;

&lt;p&gt;And there's the reason, I hope that this way I can publish about technical innovations that I'm working on. Hopefully that way I can make use of the collective knowledge of people reading about my work and get feedback where I could improve on the things I'm doing or what alternative directions should be explored. Why this long rant then about &lt;strong&gt;why&lt;/strong&gt; I'm starting a blog? Well, I guess I just wanted to justify things as not to look a fool to all those people I've always told I'd NEVER start a blog. &lt;img src=&quot;http://www.basschouten.com/rsc/smilies/icon_smile.gif&quot; alt=&quot;&amp;#58;&amp;#41;&quot; class=&quot;middle&quot; /&gt;&lt;/p&gt;&lt;div class=&quot;item_footer&quot;&gt;&lt;p&gt;&lt;small&gt;&lt;a href=&quot;http://www.basschouten.com/blog1.php/2009/10/23/starting-a-blog&quot;&gt;Original post&lt;/a&gt; blogged on &lt;a href=&quot;http://b2evolution.net/&quot;&gt;b2evolution&lt;/a&gt;.&lt;/small&gt;&lt;/p&gt;&lt;/div&gt;</description>
			<content:encoded><![CDATA[<p>So, it seems it's finally happened, I've decided to start a blog. Interestingly enough I've never really taken a lot of interest in things like blogging, microblogging, social networking or any other one of those popular internet activities. I don't have a facebook account, I've probably seen the twitter website about 3 or 4 times in my entire life. To be honest, if a year or so ago anyone would have asked me what the 10 things were I'd be least likely to do, starting a blog would probably rank somewhere high up in that list. So the question is, what brought about that amazing turnaround.</p>

<p>Well, interestingly enough, people who know me personally know I have strong opinions on nearly everything conceivable. From politics to social interaction, I'm always up for a good discussion, and usually I'll be quite convinced I'm right as well. So, in theory that would mean I'd be quite inclined to start a blog, after all, no better way to vent your opinion to a large group of people! The problem is, opinions change, and the internet has a tremendous memory, I'm really not so sure I want the world to remember my current opinions and thoughts 20 years from now.</p>

<p>This brings me to one of the reasons I'm not into a lot of these social internet activities. Normal social interaction, odd behavior, stupid actios, etcetera, exists in one point in time. You can get completely wasted and behave like a total idiot, but unless you do something stupid enough to hit the newspapers, the only record of this will be in the minds of people. You can then later say things like 'it wasn't that bad' or 'that's not how it happened', and noone would ever be able to fundamentally prove what you really did. The internet is a completely different world! Pretty much anything you do, no matter how silly, impulsive or stupid will be recorded and distributed to countless data storage devices. Yes, you better be real careful with what you do out there!</p>

<p>The second reason is much more simple. I'm not actually that interested in what other people do in their social lives, that is not to say I don't care about other people, but if they want to share their social life and possibly hear my opinion I'm sure they'll tell me about what they did last week face-to-face. One of the few twitter messages I ever read was from a friend and contained the following information: 'drinking a good glass of red wine while cooking'. Although ofcourse that information is very interesting, considering the limited amount of time one has in life, there really is more interesting information out there.</p>

<p>Finally I don't think people are that interested in what <strong>I</strong> do. My life isn't, and has never been that interesting, I do a lot of fun things, but I don't see how anyone else would benefit by reading about them.</p>

<p>So, the question asked remains, why a blog then? Well, the first point stands, but I suppose I'll just have to make sure I don't post too radical thoughts, and try not to post anything too stupid. Althought this is a hard task for me I think I'll manage that. As to the second point, I've noticed that although I'm still not interested in specifically what wine someone is drinking, or the tricks they can make their dog do, there's actually a fair deal of people posting much more informative and interesting things on their blogs. Making it actually an interesting way to keep up to date with the latest technical innovations people are working on.</p>

<p>This brings us to the last point, and with that the reason I myself decided to start this blog. I recently started working as a contractor for the Mozilla Corporation. Very quickly after I started I got asked 'Let me know if you do a blog post, I'd love to see some screenshots...' And I concluded that I was doing things people would like to read about, evaluate and give useful feedback on.</p>

<p>And there's the reason, I hope that this way I can publish about technical innovations that I'm working on. Hopefully that way I can make use of the collective knowledge of people reading about my work and get feedback where I could improve on the things I'm doing or what alternative directions should be explored. Why this long rant then about <strong>why</strong> I'm starting a blog? Well, I guess I just wanted to justify things as not to look a fool to all those people I've always told I'd NEVER start a blog. <img src="http://www.basschouten.com/rsc/smilies/icon_smile.gif" alt="&#58;&#41;" class="middle" /></p><div class="item_footer"><p><small><a href="http://www.basschouten.com/blog1.php/2009/10/23/starting-a-blog">Original post</a> blogged on <a href="http://b2evolution.net/">b2evolution</a>.</small></p></div>]]></content:encoded>
								<comments>http://www.basschouten.com/blog1.php/2009/10/23/starting-a-blog#comments</comments>
		</item>
			</channel>
</rss>
