<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Vladimir Vukićević &#187; Mozilla</title>
	<atom:link href="http://blog.vlad1.com/category/mozilla/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.vlad1.com</link>
	<description>Words</description>
	<lastBuildDate>Thu, 06 Oct 2011 02:40:14 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.1.3</generator>
		<item>
		<title>Moving On</title>
		<link>http://blog.vlad1.com/2011/02/15/moving-on/</link>
		<comments>http://blog.vlad1.com/2011/02/15/moving-on/#comments</comments>
		<pubDate>Wed, 16 Feb 2011 04:20:05 +0000</pubDate>
		<dc:creator>vladimir</dc:creator>
				<category><![CDATA[Mozilla]]></category>

		<guid isPermaLink="false">http://blog.vlad1.com/?p=382</guid>
		<description><![CDATA[I&#8217;ve recently made the decision to leave Mozilla for various reasons, largely because I&#8217;ve been wanting to do something different. Here are some thoughts on this. I became involved in Firefox and the Mozilla community when I was suckeredtalked into fixing a bug &#8212; a bug that involved RDF, bookmarks, and the template builder. (Thankfully, [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;ve recently made the decision to leave Mozilla for various reasons, largely because I&#8217;ve been wanting to do something different.  Here are some thoughts on this.</p>
<p>I became involved in Firefox and the Mozilla community when I was <strike>suckered</strike>talked into fixing a bug &#8212; a bug that involved RDF, bookmarks, and the template builder.  (Thankfully, all three of those things &#8212; RDF, old bookmarks, template builder &#8212; have almost been completely excised from Firefox.)  Somehow I ended up sticking around to fix more bugs and get involved in bigger projects, from working with Stuart to <a href="http://blog.vlad1.com/2007/12/11/graphics-in-mozilla/">rework our graphics engine</a> up to <a href="http://blog.vlad1.com/2010/02/02/android-progress-more-pixels-edition/">getting the Android port going</a>.</p>
<p>One of the things that I had as a goal when I started at Mozilla was to bring 3D graphics to the web.  It took a bit longer than I expected (as usual), but with <a href="http://www.webgl.org/">WebGL</a>, we now have a solid foundation for doing all sorts of 3D apps via the web.  Many things had to come together to enable that: fast JavaScript, improvements to overall rendering architecture, emphasis on mobile, etc. all contributed to the viability of WebGL.  Over the years, I&#8217;ve had the opportunity to work on many projects in those areas with many talented people, and the experiences will certainly help in future efforts.</p>
<p>So, what am I doing next?  <a href="http://www.dugsw.com">Something entirely different</a>.  I&#8217;ll be doing software in a totally different industry, joining some friends in bringing some disruptive innovation there.  I&#8217;ll still be writing software, though with a much smaller team &#8212; something that I&#8217;ve come to enjoy, as being small and scrappy has a lot of advantages and is a lot of fun.  There&#8217;s a lot of interesting technical challenges, mainly related to dealing with large volumes of data (multiple terabytes not being uncommon) &#8212; processing, visualization, analysis.  You&#8217;ll also likely see me hacking various bits in my own spare time, whether in Mozilla, web apps, or mobile apps.  I plan on continuing to blog about these topics.</p>
<p>For WebGL in particular, I&#8217;ll be around to launch the initial version of the spec, and plan on continuing to be involved in the standards group.  I might not be hacking on Mozilla&#8217;s implementation as frequently, but it&#8217;ll be in good hands.</p>
<p>Thank you to all the people that I&#8217;ve had a chance to work with and learn from over the past 5 (almost 6!) years.  I&#8217;ll still be around irc and other forums so won&#8217;t be pulling a disappearing act any time soon, and I&#8217;m looking forward to seeing Firefox 4 out there!</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.vlad1.com/2011/02/15/moving-on/feed/</wfw:commentRss>
		<slash:comments>14</slash:comments>
		</item>
		<item>
		<title>WebGL in Firefox 4 Beta 8</title>
		<link>http://blog.vlad1.com/2010/12/21/webgl-in-firefox-4-beta-8/</link>
		<comments>http://blog.vlad1.com/2010/12/21/webgl-in-firefox-4-beta-8/#comments</comments>
		<pubDate>Tue, 21 Dec 2010 19:00:08 +0000</pubDate>
		<dc:creator>vladimir</dc:creator>
				<category><![CDATA[Canvas 3D]]></category>
		<category><![CDATA[Firefox]]></category>
		<category><![CDATA[Mozilla]]></category>
		<category><![CDATA[webgl]]></category>

		<guid isPermaLink="false">http://blog.vlad1.com/?p=355</guid>
		<description><![CDATA[One of the parts of Firefox 4 that I&#8217;m excited about is support for WebGL, a standard for accelerated 3D rendering on the web. We&#8217;ve been working on this for quite a while, and I&#8217;ve been doing experiments with a similar kind of 3D support for a few years now. With the upcoming release of [...]]]></description>
			<content:encoded><![CDATA[<p>One of the parts of Firefox 4 that I&#8217;m excited about is support for WebGL, a standard for accelerated 3D rendering on the web.  We&#8217;ve been working on this for quite a while, and I&#8217;ve been doing experiments with a similar kind of 3D support for a few years now.  With the upcoming release of Firefox 4 Beta 8, WebGL support is starting to firm up.</p>
<h2>What is WebGL?</h2>
<p><a href="http://webgl.org/">WebGL</a> allows web developers to take advantage of the 3D capabilities of modern video cards to add 3D displays to their web applications. Apps that would have been possible only on the desktop or with plugins become possible in any modern browser that supports WebGL: 3D games, interactive product displays, scientific and medical visualization, shared virtual environments, and 3D content creation all become possible on the web.</p>
<p>For users, this means a more interactive and visually interesting web. It means having access to a wider range of applications and experiences on any device that supports the full web, instead of being limited to specific devices or platforms.</p>
<p>WebGL is being developed within the Khronos Group, the same group responsible for OpenGL and OpenGL ES.  Members of the WebGL group include Mozilla, Google, Opera, and Apple, as well as a number of hardware vendors who are interested in making sure that WebGL content can run well on both desktop and mobile hardware.  There&#8217;s a lot of support for WebGL!</p>
<p>I recently gave a talk at NVidia&#8217;s GPU Technology Conference about WebGL.  The <a href="http://nvidia.fullviewmedia.com/gtc2010/0921-a8-2113.html">video stream is available</a> (though sadly not using HTML5 video!), and it&#8217;s a good (though technical) overview of WebGL.</p>
<h2>Let me check out some demos!</h2>
<p>Here&#8217;s a couple of demos showcasing WebGL technology by Mozilla, Google, and others.</p>
<p>Some platform-specific notes: WebGL is currently disabled on Linux due to some build issues; it should be getting re-enabled in beta 9.  For Windows users, you may need to install the <a href="http://www.microsoft.com/downloads/en/details.aspx?FamilyID=2da43d38-db71-4c1b-bc6a-9b6652cd92a3&amp;displaylang=en">DirectX Runtime</a> in case these demos don&#8217;t work for you or if they have glitches &#8212; this allows Firefox to use an alternate rendering path that might be better supported on your system, especially on systems with Intel GPUs.  We&#8217;re working on removing the need for this separate install in a future build.</p>
<table class="aligncenter" border="0">
<tbody>
<tr>
<td>
<p><div id="attachment_359" class="wp-caption alignnone" style="width: 210px"><a href="http://videos.mozilla.org/serv/mozhacks/flight-of-the-navigator/" target="_blank"><img class="size-full wp-image-359 " title="Flight of the Navigator" src="http://blog.vlad1.com/wp-content/uploads/2010/12/fotn.png" alt="Flight of the Navigator" width="200" height="200" /></a><p class="wp-caption-text">Flight of the Navigator</p></div></td>
<td>
<p><div id="attachment_360" class="wp-caption alignnone" style="width: 210px"><a href="http://bodybrowser.googlelabs.com/" target="_blank"><img class="size-full wp-image-360" title="Body Browser" src="http://blog.vlad1.com/wp-content/uploads/2010/12/bodybrowser.png" alt="Body Browser" width="200" height="200" /></a><p class="wp-caption-text">Body Browser by Google</p></div></td>
<td>
<p><div id="attachment_358" class="wp-caption alignnone" style="width: 210px"><a href="http://webglsamples.googlecode.com/hg/aquarium/aquarium.html" target="_blank"><img class="size-full wp-image-358 " title="WebGL Aquarium" src="http://blog.vlad1.com/wp-content/uploads/2010/12/aquarium.png" alt="WebGL Aquarium" width="200" height="200" /></a><p class="wp-caption-text">WebGL Aquarium</p></div></td>
</tr>
</tbody>
</table>
<p>Check out Dave&#8217;s post for more <a href="http://vocamus.net/dave/?p=1233">details about the Flight of the Navigator</a> demo.  You can find many more projects and demos using WebGL on the web and linked from <a href="http://webgl.org">webgl.org</a> &#8212; for example, some other great examples are a <a href="http://www.3dtin.com/" target="_blank">web-based 3D editor called 3DTin</a> and <a href="http://www.ibiblio.org/e-notes/webgl/waves/annihilation.html" target="_blank">a vortex/anti-vortex annihilation simulation</a>,</p>
<h2>Give me more technical details!</h2>
<p>WebGL brings the OpenGL ES 2.0 API to the HTML5 Canvas element.  3D content is confined to the canvas, but the canvas follows normal HTML compositing rules.  For example, a 2D UI can be layered on top of the 3D scene using normal CSS mechanisms, and content underneath the canvas will show through transparent portions.  In addition, CSS properties can be applied to the canvas itself, for effects like fading the entire scene in or out.</p>
<p>The WebGL API interacts well with the rest of the web platform; specifically, support is provided for loading 3D textures from HTML images or videos, and keyboard and mouse input is handled using familiar DOM events.</p>
<h2>As a developer, how do I learn more about WebGL?</h2>
<p>WebGL is based on <a href="http://www.khronos.org/opengles/2_X/">OpenGL ES 2.0</a>, which just so happens to be the same 3D API used for Android and iOS development, as well as being based on the desktop OpenGL API.  Many resources available for ES 2.0 development translate almost directly to WebGL development.</p>
<p>Unlike desktop or mobile OpenGL development, it&#8217;s very easy to get started with WebGL.  Some simple HTML and JS content lets you immediately start writing WebGL code.  A number of tutorials already exist that focus on WebGL; you can take a look at <a href="http://learningwebgl.com/blog/?p=28">Learning WebGL&#8217;s lessons</a> to help you get started.</p>
<p>Here are some web resources with more information:</p>
<ul>
<li><a href="http://webgl.org/">webgl.org</a> &#8212; official WebGL page, including specification and resource links</li>
<li><a href="http://learningwebgl.com/">learningwebgl.com</a> &#8212; blog with regular updates on WebGL happenings</li>
</ul>
<h2>Future Work</h2>
<p>WebGL focuses on OpenGL ES 2.0 feature compatibility to ensure content compatibility with mobile devices.  However, ES 2.0 is behind the latest advances on the desktop today.  In the future, various desktop features may become available in WebGL in the form of extensions.</p>
<p>There&#8217;s still some work to do on the Firefox side as well, in particular removing some performance bottlenecks on Windows when we&#8217;re using ANGLE for Direct3D compatibility.</p>
<h2>Wrap up</h2>
<p>WebGL will enable web developers to create new experiences for their users.  As with any new technology, initial experimentation will lead to developers understanding better how to fully leverage WebGL. There&#8217;s already tremendous interest in WebGL, as can be seen by the wealth of frameworks and samples, even before WebGL has been released as part of any final shipping browser version!  By including WebGL in Firefox, and along with our work on HTML5 video and audio support (including direct audio data access), Firefox supports a full set of web<br />
technologies for building rich and compelling applications on the web.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.vlad1.com/2010/12/21/webgl-in-firefox-4-beta-8/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>Building Fennec for Android under Win32</title>
		<link>http://blog.vlad1.com/2010/11/01/building-fennec-for-android-under-win32/</link>
		<comments>http://blog.vlad1.com/2010/11/01/building-fennec-for-android-under-win32/#comments</comments>
		<pubDate>Mon, 01 Nov 2010 21:50:33 +0000</pubDate>
		<dc:creator>vladimir</dc:creator>
				<category><![CDATA[Firefox]]></category>
		<category><![CDATA[Mozilla]]></category>
		<category><![CDATA[android]]></category>
		<category><![CDATA[cygwin]]></category>
		<category><![CDATA[fennec]]></category>
		<category><![CDATA[win32]]></category>

		<guid isPermaLink="false">http://blog.vlad1.com/?p=348</guid>
		<description><![CDATA[I&#8217;ve been using Windows 7 as my primary development platform for a while (don&#8217;t let the MacBook Pro fool you &#8212; it&#8217;s probably spent less than an hour total in MacOS X), but have always needed to use a virtual machine running Linux to make Android builds.  I don&#8217;t mind working in a VM, but [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;ve been using Windows 7 as my primary development platform for a while (don&#8217;t let the MacBook Pro fool you &#8212; it&#8217;s probably spent less than an hour total in MacOS X), but have always needed to use a virtual machine running Linux to make Android builds.  I don&#8217;t mind working in a VM, but it takes up a large chunk of memory, and makes it hard to share code/patches with my main source trees.</p>
<p>However, Google provides the cross-compilers for Windows as well; since the external drive that had my VM on it died a week ago, it seemed like a good opportunity to get the build working under Windows.  Because the native compilers are built using cygwin, this is a bit convoluted, but seems to work.  You&#8217;ll need some msys and cygwin tools, as well as the standard Android build prereqs (Java, SDK, NDK):</p>
<ul>
<li>mozilla-build installed</li>
<li>the <a href="http://ftp.mozilla.org/pub/mozilla.org/mozilla/source/wintools.zip">mingw moztools</a>, unpacked somewhere like c:\mozilla-build\moztools-mingw (see bug comment as to why this is required)</li>
<li>cygwin installed, including gcc/g++ and the mingw 4.5.1 compilers</li>
<li>a <a href="http://www.oracle.com/technetwork/java/javase/downloads/index.html">JDK</a> (note: I don&#8217;t know if OpenJDK supports Windows; if it does, that&#8217;s also an option)</li>
<li>the <a href="http://developer.android.com/sdk/index.html">Android SDK</a> (with at least the platform level 8 SDK)</li>
<li>the <a href="http://www.crystax.net/android/ndk-r4.php">Crystax r4 NDK</a> for Win32</li>
<li>the patches from <a href="https://bugzilla.mozilla.org/show_bug.cgi?id=607975">bug 607975</a></li>
</ul>
<p>You do the build inside the standard mozilla-build shell prompt (<em>not</em> a cygwin shell).  However, you&#8217;ll need to copy *.dll from c:/cygwin/bin (assuming you installed cygwin in c:/cygwin) into a new directory, such as c:/cygwin/bindll.  Then add that bindll directory to your msys path.  Adding the cygwin bin directory to your msys path will get you cygwin versions of various tools, and will greatly confuse things.  You just need the DLLs so that the compilers can execute; the compiler binary paths are explicitly specified.</p>
<p>There&#8217;s a sample mozconfig inside bug 607975.  You&#8217;ll need to use a relative path to run configure, e.g. &#8220;MOZCONFIG=../../fennec-config ../mozilla-central/configure&#8221;, and you must use mingw make and not pymake to build.  pymake has some weird issues, where it complains that it doesn&#8217;t know how to rebuild dependencies like &#8220;-lzlib&#8221;.  This is likely fixable, because I think this is a magic thing that gnu make special-cases, and something that our build system shouldn&#8217;t do in any case.</p>
<p>Some remaining problems with the build:</p>
<ul>
<li>It&#8217;s not clear why jemalloc hangs without the TLS patch; mwu says he has seen this in other cases, but it&#8217;s consistent here.</li>
<li>Opt builds seem to just draw white; not sure why that is, debug builds work fine.  This should be fixable.</li>
<li>Disabling automatic dependencies means you have to be extra careful if you modify a header file or something that might not get picked up; they have to be disabled because the cygwin compiler will generate paths like &#8220;/cygwin/c/&#8230;&#8221; in the deps file, which the msys make won&#8217;t ever be able to find &#8212; thus causing it to rebuild everything on every build.  This is also fixable, perhaps with a postprocessing step after each compilation.</li>
<li>Would be nice if pymake worked for building speed.</li>
</ul>
<p>This is obviously not a full solution, and VMs are still a lot more stable where builds are concerned, but it&#8217;s at least possible to build Fennec for Android under Win32.  GDB also seems to work fine, though as always, you&#8217;ll want to use the <a href="https://wiki.mozilla.org/Mobile/Fennec/Android#Using_nVidia_version_.28recommended.29">NVIDIA-provided gdb/gdbserver</a> pair, because the one that&#8217;s part of the NDK seems to continue to have issues.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.vlad1.com/2010/11/01/building-fennec-for-android-under-win32/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Getting Information from Windows Vista/7 Display Driver Resets</title>
		<link>http://blog.vlad1.com/2010/10/12/getting-information-from-windows-vista7-display-driver-resets/</link>
		<comments>http://blog.vlad1.com/2010/10/12/getting-information-from-windows-vista7-display-driver-resets/#comments</comments>
		<pubDate>Tue, 12 Oct 2010 16:41:03 +0000</pubDate>
		<dc:creator>vladimir</dc:creator>
				<category><![CDATA[Firefox]]></category>
		<category><![CDATA[Mozilla]]></category>
		<category><![CDATA[crashes]]></category>
		<category><![CDATA[graphics]]></category>
		<category><![CDATA[windows]]></category>

		<guid isPermaLink="false">http://blog.vlad1.com/?p=339</guid>
		<description><![CDATA[Now that we&#8217;re doing hardware acceleration on all platforms, we&#8217;re touching all sorts of OS components that we haven&#8217;t in the past.  One of those is much closer interaction with the graphics card drivers in your system.  Under Windows Vista and Windows 7, problems in the video driver (or in how we use DirectX/OpenGL) sometimes [...]]]></description>
			<content:encoded><![CDATA[<p>Now that we&#8217;re doing hardware acceleration on all platforms, we&#8217;re touching all sorts of OS components that we haven&#8217;t in the past.  One of those is much closer interaction with the graphics card drivers in your system.  Under Windows Vista and Windows 7, problems in the video driver (or in how we use DirectX/OpenGL) sometimes manifest themselves as a graphics driver rest: your screen flashes, and you have a little popup telling you that your video driver had a problem and was reset. If this happens to you while using one of the Firefox 4 betas or nightly builds, here&#8217;s how you can collect information to help us and the graphics hardware vendor fix the problem.  This only applies to Windows Vista and Windows 7.</p>
<h3>1. Did Firefox recover?</h3>
<p>Immediately after the driver reset, did Firefox recover?  If so, skip this step.  If, however, it&#8217;s not repainting and otherwise seems hung, forcing a crash report can help give us data that we need to figure out why recovery didn&#8217;t happen properly.  To do this, I wrote a tool that forces a hung Firefox to crash in a way that will pop up the crash reporter.  You can download it here: <a href="http://people.mozilla.com/~vladimir/misc/force-firefox-crash.zip">force-firefox-crash.zip</a>.  Just unzip and double click on the .exe, and the current running firefox.exe process will be killed, and you&#8217;ll be presented with the crash reporter.</p>
<p>Submit the report, and after restarting Firefox, type in <strong>about:crashes</strong> in the location bar.  You&#8217;ll want the ID of the top entry in this list for when you file a bug or contact support later.  (You can right click the top link and select &#8220;Copy Link Location&#8221; to grab a link for easy pasting.)</p>
<h3>2. Grab the Driver Crash information</h3>
<p>Select the start menu, and type in &#8220;problem report&#8221; in the search box.  Select <strong>View all problem reports </strong>from the list:</p>
<p style="text-align: center;"><a href="http://blog.vlad1.com/wp-content/uploads/2010/10/wer-view-problem-reports.jpg"><img class="size-full wp-image-341  aligncenter" title="View all problem reports" src="http://blog.vlad1.com/wp-content/uploads/2010/10/wer-view-problem-reports.jpg" alt="" width="409" height="321" /></a></p>
<p>In the problem reports list, scroll down to the Windows section if it&#8217;s not visible, and sort by Date &#8212; you want the latest &#8220;Video hardware error&#8221; entry:</p>
<p style="text-align: center;"><a href="http://blog.vlad1.com/wp-content/uploads/2010/10/wer-2.png"><img class="size-full wp-image-342  aligncenter" title="Video hardware error" src="http://blog.vlad1.com/wp-content/uploads/2010/10/wer-2.png" alt="" width="400" height="273" /></a></p>
<p>Double-click on the latest &#8220;Video hardware error&#8221; entry.  In the details screen, click &#8220;View a temporary copy of these files&#8221;:</p>
<p style="text-align: center;"><a href="http://blog.vlad1.com/wp-content/uploads/2010/10/wer-3.png"><img class="size-full wp-image-343  aligncenter" title="Temporary Copy" src="http://blog.vlad1.com/wp-content/uploads/2010/10/wer-3.png" alt="" width="400" height="320" /></a></p>
<p>You&#8217;ll get a new explorer window with three files.  Select all three, and compress them into a ZIP file, by right-clicking and selecting &#8220;Send To -&gt; Compressed Folder&#8221;:</p>
<p style="text-align: center;"><a href="http://blog.vlad1.com/wp-content/uploads/2010/10/wer-4.jpg"><img class="size-full wp-image-344  aligncenter" title="wer-4" src="http://blog.vlad1.com/wp-content/uploads/2010/10/wer-4.jpg" alt="" width="400" height="261" /></a></p>
<p>Copy the resulting zip file to your desktop, so that you can include it with your report.</p>
<h3>3. Create a bug</h3>
<p>Almost done! In <a href="http://bugzilla.mozilla.org">bugzilla.mozilla.org</a>, create a new bug in the Core product and the Graphics component.  Attach the zip file you created in step two to the report.  If you also created a Firefox crash dump in step one, include a link to it in your bug report.</p>
<p>This should give us and the graphics hardware vendors enough information to track down what the original problem was, so that we can fix it for Firefox 4!</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.vlad1.com/2010/10/12/getting-information-from-windows-vista7-display-driver-resets/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Fun With Fast JavaScript</title>
		<link>http://blog.vlad1.com/2010/07/30/fun-with-fast-javascript/</link>
		<comments>http://blog.vlad1.com/2010/07/30/fun-with-fast-javascript/#comments</comments>
		<pubDate>Fri, 30 Jul 2010 21:14:18 +0000</pubDate>
		<dc:creator>vladimir</dc:creator>
				<category><![CDATA[Firefox]]></category>
		<category><![CDATA[Mozilla]]></category>
		<category><![CDATA[demos]]></category>
		<category><![CDATA[javascript]]></category>
		<category><![CDATA[perf]]></category>
		<category><![CDATA[video]]></category>

		<guid isPermaLink="false">http://blog.vlad1.com/?p=315</guid>
		<description><![CDATA[Fast JavaScript is a cornerstone of the modern web. In the past, application authors had to wait for browser developers to implement any complex functionality in the browser itself, so that they could access it from script code. Today, many of those functions can move straight into JavaScript itself. This has many advantages for application [...]]]></description>
			<content:encoded><![CDATA[<p>Fast JavaScript is a cornerstone of the modern web.  In the past, application authors had to wait for browser developers to implement any complex functionality in the browser itself, so that they could access it from script code.  Today, many of those functions can move straight into JavaScript itself.  This has many advantages for application authors: there&#8217;s no need to wait for a new version of a browser before you can develop or ship your app, you can tailor the functionality to exactly what you need, and you can improve it directly (make it faster, higher quality, more precise, etc.).</p>
<p><a href="http://blog.vlad1.com/wp-content/uploads/2010/07/2010-06-24_1353.png"><img class="alignleft size-full wp-image-316" title="JavaScript Darkroom" src="http://blog.vlad1.com/wp-content/uploads/2010/07/2010-06-24_1353.png" alt="" width="300" height="238" /></a>Here are two examples that show off what can be done with the improved JS engine and capabilities that will be present in Firefox 4.  The first example shows <a href="http://people.mozilla.com/~vladimir/demos/darkroom/darkroom.html">a simple web-based Darkroom</a> that allows you to perform color correction on an image.  The HTML+JS is around 700 lines of code, not counting jQuery.  This is based on a demo that&#8217;s included with Google&#8217;s Native Client (NaCl) SDK; in that demo, the color correction work is done inside native code going through NaCl.  That demo (originally presented as &#8220;too slow to run in JavaScript&#8221;) is a few thousand lines of code, and involves downloading and installing platform-specific compilers, multiple steps to test/deploy code, and installing a plugin on the browser side.</p>
<p>I get about 15-16 frames per second with the default zoomed out image (around 5 million pixels per second &#8212; that number won&#8217;t be affected by image size) on my MacBook Pro, which is definitely fast enough for live manipulation.  The algorithm could be tightened up to make this faster still.  Further optimizations to the JS engine could help here as well; for example, I noticed that we spend a lot of time doing floating point to integer conversions for writing the computed pixels back to the display canvas, due to how the canvas API specifies image data handling.</p>
<p>The Web Darkroom tool also supports drag &amp; drop, so you can take any image from your computer and drop it onto the canvas to load it.  A long (long!) time ago, back in 2006, I wrote <a href="http://people.mozilla.com/~vladimir/corppr/">an addon called &#8220;Croppr!&#8221;</a>.  It was intended to be used with Flickr, allowing users to play around with custom crops of any image, and then leave crop suggestions in comments to be viewed using Croppr.  It almost certainly doesn&#8217;t work any more, but it would be neat to update it: this time with both cropping and color correction.  Someone with the addon (perhaps a <a href="https://jetpack.mozillalabs.com/">Jetpack</a> now!) could then visit a Flickr photo and experiment, and leave suggestions for the photographer.</p>
<p><a href="http://blog.vlad1.com/wp-content/uploads/2010/07/2010-06-24_1352.png"><img class="alignright size-full wp-image-318" title="JavaScript Video FFT" src="http://blog.vlad1.com/wp-content/uploads/2010/07/2010-06-24_1352.png" alt="" width="350" height="425" /></a>The <a href="http://people.mozilla.com/~vladimir/demos/jsfft/jsfft.html">second example</a> is based on some work that Dave Humphrey and others have been doing to bring audio manipulation to the web platform.  Originally, their spec included a pre-computed FFT with each audio frame delivered to the web app.  I suggested that there&#8217;s no need for this &#8212; while a FFT is useful for some applications, for others it would be wasted work.  Those apps that want a FFT could implement one in JS.  Some benchmark numbers backed this up &#8212; using the <a href="https://cvs.khronos.org/svn/repos/registry/trunk/public/webgl/doc/spec/TypedArray-spec.html">typed arrays</a> originally created for <a href="http://webgl.org/">WebGL</a>, computing an FFT in JS was approaching the speed of native code.  Again, both could be sped up (perhaps using SSE2 or something like Mono.Simd on the JS side), but it&#8217;s fast enough to be useful already.</p>
<p>The demo shows this in action.  A numeric benchmark isn&#8217;t really all that interesting, so instead I take a video clip, and as it&#8217;s playing, I extract a portion of the green channel of each frame and compute its 2D FFT, which is then displayed.  The original clip plays at 24 frames per second, so that&#8217;s the upper bound of this demo.  Using Float32 typed arrays, the computation and playback proceeds at around 22-24fps for me.</p>
<p>You can grab the video controls and scrub to a specific frame.  (The frame rate calculation is only correct while the video is playing normally, not while you&#8217;re scrubbing.)  The video source uses Theora, so you&#8217;ll need a browser that can play Theora content.  (I didn&#8217;t have a similar clip that uses WebM, or I could have used that.)</p>
<p>These examples are demonstrating the strength of the trace-based JIT technique that Firefox has used for accelerating JavaScript since Firefox 3.5.  However, not all code can see such dramatic speedups from that type of acceleration.  Because of that, we&#8217;ll be including a full method-based JIT for Firefox 4 (for more details, see <a href="http://www.bailopan.net/blog/?p=683">David Anderson&#8217;s blog</a>, as well as <a href="http://blog.mozilla.com/dmandelin/2010/05/10/jm-halfway/">David Mandelin&#8217;s blog</a>).  This will provide significantly faster baseline JS performance, with the trace JIT becoming a turbocharger for code that it would naturally apply to.</p>
<p>Combining fast JavaScript performance alongside new web platform technologies such as WebGL and Audio will make for some pretty exciting web apps, and I&#8217;m looking forward to seeing what developers do with them!</p>
<p><em>Edit: Made some last-minute changes to the demos, which ended up pulling in a slightly broken version of jQuery UI that wasn&#8217;t all that happy with Safari.  Should be fixed now!</em></p>
<p><em>Edit #2: This <a href="http://www.movavi.com/opensource/fun-with-fast-javascript-be">post is available in Belorussian</a>, courtesy of Jason Fragoso!</em><a href="http://www.movavi.com/opensource/fun-with-fast-javascript-be" target="_blank"></a></p>
]]></content:encoded>
			<wfw:commentRss>http://blog.vlad1.com/2010/07/30/fun-with-fast-javascript/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>EGL &amp; OpenGL ES Come to Windows</title>
		<link>http://blog.vlad1.com/2010/07/26/egl-opengl-es-come-to-windows/</link>
		<comments>http://blog.vlad1.com/2010/07/26/egl-opengl-es-come-to-windows/#comments</comments>
		<pubDate>Mon, 26 Jul 2010 21:05:48 +0000</pubDate>
		<dc:creator>vladimir</dc:creator>
				<category><![CDATA[Canvas 3D]]></category>
		<category><![CDATA[Mozilla]]></category>
		<category><![CDATA[amd]]></category>
		<category><![CDATA[drivers]]></category>
		<category><![CDATA[egl]]></category>
		<category><![CDATA[opengl]]></category>
		<category><![CDATA[webgl]]></category>

		<guid isPermaLink="false">http://blog.vlad1.com/?p=325</guid>
		<description><![CDATA[It&#8217;s SIGGRAPH time, and this means all sorts of interesting announcements in the graphics world. One of these came today from AMD, who announced that they plan on shipping both EGL and OpenGL ES drivers on Windows for their recent GPUs. One of the most challenging things in getting Firefox working with WebGL and hardware [...]]]></description>
			<content:encoded><![CDATA[<p>It&#8217;s SIGGRAPH time, and this means all sorts of interesting announcements in the graphics world.  One of these came today from AMD, who <a href="http://blogs.amd.com/developer/2010/07/26/opengl-es-2-0-coming-to-a-desktop-near-you/">announced that they plan on shipping</a> both <a href="http://www.khronos.org/egl/">EGL</a> and <a href="http://www.khronos.org/opengles/">OpenGL ES</a> drivers on Windows for their recent GPUs.</p>
<p>One of the most challenging things in getting Firefox working with WebGL and hardware graphics acceleration has been dealing with platform-specific pieces to get access to OpenGL.  In many cases similar functionality works differently (often in subtle ways), requiring both lots of testing and lots of very specific codepaths.  EGL replaces all of these with a modern system designed with portability in mind.  Until now, however, EGL has only been adopted in the mobile space.  On the desktop, the older GLX, CGL, and WGL subsystems have held this role; in the case of GLX and WGL in particular, they bring along years of accumulated cruft.  </p>
<p>Having a native EGL driver will allow us to ship one particular hardware acceleration provider that will work and be tested across various desktop and mobile platforms.  Additionally, the same provider can connect to the <a href="http://code.google.com/p/angleproject/">ANGLE project</a>, which implements EGL and OpenGL ES on top of Direct3D 9. Having OpenGL ES will allow us to test and develop truly identical code across desktop and mobile.  As mobile graphics development has become important (not just to Mozilla, but in general!), having the same API implemented on the desktop will make it easier to catch problems and portability issues in an environment that&#8217;s much more conducive to development and debugging.</p>
<p>Native OpenGL ES on the desktop will also mean that we can tie our <a href="http://webgl.org/">WebGL</a> implementation directly to it, instead of going through the desktop OpenGL driver.  Because WebGL follows the OpenGL ES specification, the native ES driver on the desktop will allow us to make a more efficient binding between WebGL and the underlying platform, potentially leading to higher performance.</p>
<p>As with any such change, it will be a while before we can depend on the presence of these APIs on the desktop.  These first steps are important to making that change happen.  I&#8217;m looking forward to seeing other vendors following AMD here, both on Windows and on other platforms.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.vlad1.com/2010/07/26/egl-opengl-es-come-to-windows/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>WinDbg Image Viewer Extension</title>
		<link>http://blog.vlad1.com/2010/07/18/windbg-image-viewer-extension/</link>
		<comments>http://blog.vlad1.com/2010/07/18/windbg-image-viewer-extension/#comments</comments>
		<pubDate>Sun, 18 Jul 2010 21:55:29 +0000</pubDate>
		<dc:creator>vladimir</dc:creator>
				<category><![CDATA[Mozilla]]></category>

		<guid isPermaLink="false">http://blog.vlad1.com/?p=323</guid>
		<description><![CDATA[Since I often work on graphics code, one of the things I frequently want to do while debugging is take a chunk of memory and view it as an image.  No standard debugger seems to do this, which is surprising given how useful it is.  I&#8217;ve made do with other tools in the past &#8212; [...]]]></description>
			<content:encoded><![CDATA[<p>Since I often work on graphics code, one of the things I frequently want to do while debugging is take a chunk of memory and view it as an image.  No standard debugger seems to do this, which is surprising given how useful it is.  I&#8217;ve made do with other tools in the past &#8212; there&#8217;s a great debugging image viewer somewhere for win32 (I can&#8217;t find it via google this time around) that lets you attach to a process and manually put in an address, dimensions, etc. to grab the data from the process and view it.  It&#8217;s somewhat buggy though, and hasn&#8217;t been udpated in a while.  There&#8217;s also <a href="http://www.billbaxter.com/projects/imdebug/">the image debugger</a>, which is handy, but requires you to link it into your program.</p>
<p>So, I finally wrote the (very simple) debug extension I wish I&#8217;d had.  You can find the <a href="http://vlad.off.net/hg/imext/">source for imext here</a> (it&#8217;s a hg repo), and a <a href="http://vlad.off.net/hg/imext/raw-file/2c619c722db5/bin/imext.dll">binary DLL built for x86 here</a>.  Rename it to imext.dll and drop it alongside your x86 WinDbg.  Use &#8220;<tt>!imext.help</tt>&#8221; to get some basic instructions.  It&#8217;s pretty rough code and only does exactly what I needed yesterday, but it can become more useful pretty quickly.  There are some weird bugs with WinDbg&#8217;s expression evaluators that make it difficult to use with actual expressions; passing addresses directly works better.  Also remember that WinDbg&#8217;s default expression evaluator is MASM, not C++ &#8212; the main thing is that this means that any bare numbers are interpreted as hex (use <tt>0n123</tt> to get decimal).</p>
<p>I&#8217;ll probably extend this quite a bit over time, including teaching it about Mozilla-specific things like gfxImageSurfaces.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.vlad1.com/2010/07/18/windbg-image-viewer-extension/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>How To Go Mad While Trying To Render To a Texture</title>
		<link>http://blog.vlad1.com/2010/07/01/how-to-go-mad-while-trying-to-render-to-a-texture/</link>
		<comments>http://blog.vlad1.com/2010/07/01/how-to-go-mad-while-trying-to-render-to-a-texture/#comments</comments>
		<pubDate>Thu, 01 Jul 2010 08:05:18 +0000</pubDate>
		<dc:creator>vladimir</dc:creator>
				<category><![CDATA[Canvas 3D]]></category>
		<category><![CDATA[Mozilla]]></category>
		<category><![CDATA[android]]></category>
		<category><![CDATA[egl]]></category>
		<category><![CDATA[opengl]]></category>
		<category><![CDATA[tears]]></category>
		<category><![CDATA[webgl]]></category>

		<guid isPermaLink="false">http://blog.vlad1.com/?p=309</guid>
		<description><![CDATA[Has that happened to you? No? It&#8217;s just me? Really? Huh. (Somewhat technical OpenGL post follows; you&#8217;ve been warned.) So over the past week, I&#8217;ve been trying to make our OpenGL stuff in Firefox be a little more coherent and easy to use, especially when it comes to doing things like rendering to a texture. [...]]]></description>
			<content:encoded><![CDATA[<p style="text-align: left;">Has that happened to you?  No?  It&#8217;s just me?  Really?  Huh.</p>
<p style="text-align: left;">(Somewhat technical OpenGL post follows; you&#8217;ve been warned.)</p>
<p style="text-align: left;">So over the past week, I&#8217;ve been trying to make our OpenGL stuff in Firefox be a little more coherent and easy to use, especially when it comes to doing things like rendering to a texture.  This is something really for WebGL, and is a key to making WebGL fast&#8230; we want it all to live in video hardware, and we want to render it straight from there, instead of doing the horrible readback that it does currently.</p>
<p style="text-align: left;">Our current implementation uses PBuffers for each WebGL context.  PBuffers are old and crufty, but they mostly work ok.  But, everyone kept telling me, &#8220;PBuffers are old and crufty!  FBOs are the new hotness!  Why do you hate unicorns?&#8221;  Problem is, WebGL really wants its own context &#8212; one of the advantages of FBOs over PBuffers is that they <em>don&#8217;t</em> need a separate context.  That&#8217;s great, if what you need is to render to a texture in your game or visualization app or whatever.  But, WebGL needs a context.</p>
<p style="text-align: left;">Ok, I thought, I can just use OpenGL&#8217;s (technically, WGL, EGL, GLX, and CGL&#8217;s) context sharing feature, have everything live in one shared global namespace, and things will just work.  This has one somewhat scary problem &#8212; if you don&#8217;t clean up any resources, they stick around forever, or at least until all the contexts in the sharing group are gone.  But, I figured we can keep track and clean up.</p>
<p style="text-align: left;">So I did all this work, set up a global context to use as a &#8220;shared&#8221; context.  Everything worked great, creating a FBO is certainly easier than creating a PBuffer and all that.</p>
<p style="text-align: left;">And then I decided to test it on Android.  One of the reasons why I wanted to do this was that on a number of mobile devices, among them Nokia&#8217;s N900 and Nvidia&#8217;s Android port, PBuffers cannot be bound as a texture; they just don&#8217;t support that.  The shared-context FBO approach worked great.  Then I plugged in a Nexus One.  Failure.</p>
<p style="text-align: left;">What gives?  It turns out, a bunch of current Android devices simply <em>don&#8217;t support GL context sharing</em>.  My plan?  Ruined.  The full table of tears actually looks like this:</p>
<table style="background-color: #ccffff; text-align: left; width: 80%;" border="0" cellpadding="5" align="center">
<thead>
<tr>
<td style="text-align: center;"><strong>Target</strong></td>
<td align="center"><strong>PBuffers</strong></td>
<td style="text-align: center;"><strong>Sharing</strong></td>
<td style="text-align: center;"><strong>Other</strong></td>
</tr>
</thead>
<tbody>
<tr>
<td>Desktop &#8211; WGL</td>
<td style="text-align: center;">YES</td>
<td style="text-align: center;">YES</td>
<td></td>
</tr>
<tr>
<td>Desktop &#8211; GLX</td>
<td style="text-align: center;">no</td>
<td style="text-align: center;">YES</td>
<td style="text-align: center;">YES</td>
</tr>
<tr>
<td>Desktop &#8211; CGL</td>
<td style="text-align: center;">YES</td>
<td style="text-align: center;">YES</td>
<td style="text-align: center;">YES</td>
</tr>
<tr>
<td>Maemo (N900 + others)</td>
<td style="text-align: center;">no</td>
<td style="text-align: center;">YES</td>
<td style="text-align: center;">YES</td>
</tr>
<tr>
<td>Android &#8211; Tegra</td>
<td style="text-align: center;">no</td>
<td style="text-align: center;">YES</td>
<td style="text-align: center;">YES</td>
</tr>
<tr>
<td>Android &#8211; Nexus One</td>
<td style="text-align: center;">YES*</td>
<td style="text-align: center;">no</td>
<td></td>
</tr>
<tr>
<td>Android &#8211; Droid</td>
<td style="text-align: center;">YES*</td>
<td style="text-align: center;">no</td>
<td></td>
</tr>
<tr>
<td>Android &#8211; EVO4G</td>
<td style="text-align: center;">YES*</td>
<td style="text-align: center;">no</td>
<td></td>
</tr>
</tbody>
</table>
<p style="text-align: left;">The &#8220;Other&#8221; category means that the platform has an alternate approach that doesn&#8217;t involve either PBuffers or context sharing. These other approaches are:</p>
<p style="text-align: left;">Desktop &#8211; GLX: X11 Pixmaps can be rendered to and used as textures via texture_from_pixmap</p>
<p style="text-align: left;">Desktop &#8211; CGL: I think there&#8217;s some CoreAnimation thing that can be used here?</p>
<p style="text-align: left;">Maemo: X11 Pixmaps, as on GLX; potentially EGL_KHR_gl_texture_2D_image</p>
<p style="text-align: left;">Android &#8211; Tegra: EGL_KHR_gl_texture_2D_image, which allows a texture to be exported as an EGLImage.  This is ideal, since it gives all the benefit of FBOs without any of the downsides of context sharing.  Unfortunately, this is the only place where it&#8217;s supported, and as best I can tell nothing like this exists on the desktop.</p>
<p style="text-align: left;">The * next to some of the Android entries indicates that while they do support pbuffers, they only support power-of-two dimensions, at least for pbuffers that can be bound as textures.  This is annoying and caused me a bunch of grief until I realized that quirk.</p>
<p style="text-align: left;">So, with that information, the new plan is to attempt to share all window contexts&#8217; resources &#8212; there are advantages here in cleanup operations and being able to do texture uploads and other things on different threads.  For WebGL and other offscreen contexts though, we want to avoid sharing if we can, so the order in which we&#8217;ll try things goes like this:</p>
<ol>
<li>EGL_KHR_texture_2d_image + GL_OES_EGL_image.  Even though it&#8217;s only supported on one target, I still want to make sure that we use this where we can &#8212; it really is exactly what we want.</li>
<li>PBuffers.  Yes, they may be old and busted and difficult to create and all that, but if supported, they still do basically exactly what&#8217;s needed.</li>
<li>X11 Pixmaps + texture_from_pixmap.  Basically like PBuffers, but even more annoying and actually supported on X11.</li>
<li>Dummy window or other drawable and a FBO, plus full sharing with the windowed contexts.  This is only possible if sharing is possible, and is a little risky from a resource management perspective, but it works.</li>
<li>Can&#8217;t share, can&#8217;t texture from any renderable target?  Then we call glReadPixels and take the slow boat through system memory.</li>
</ol>
<p>So, where I was hoping to just write one path &#8212; #4 in the list above &#8212; I now have to write 5.  On the plus side, 1-3 all don&#8217;t have the sharing problem.  On the minus side, it&#8217;s 5 separate code paths instead of just 1.</p>
<p>Hopefully the above information saves someone some pain while trying to do offscreen GL rendering on various platforms, especially mobile ones.  I wish the Android EGL implementations were higher quality; the non-Nvidia ones seem to support an identical set of extensions and report identical version strings, which makes me wonder if they&#8217;re just based on some generic code that Google provides.  If so, it would be nice to see that updated with support for texture_2d_image/EGL_image.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.vlad1.com/2010/07/01/how-to-go-mad-while-trying-to-render-to-a-texture/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Losing My Memory</title>
		<link>http://blog.vlad1.com/2010/05/10/losing-my-memory/</link>
		<comments>http://blog.vlad1.com/2010/05/10/losing-my-memory/#comments</comments>
		<pubDate>Mon, 10 May 2010 21:47:59 +0000</pubDate>
		<dc:creator>vladimir</dc:creator>
				<category><![CDATA[Firefox]]></category>
		<category><![CDATA[Mozilla]]></category>
		<category><![CDATA[jemalloc]]></category>
		<category><![CDATA[memory]]></category>

		<guid isPermaLink="false">http://blog.vlad1.com/?p=296</guid>
		<description><![CDATA[With the work going on to bring Firefox to mobile devices, and with desktop users demanding more and more from their web browser, memory usage is a concern.  Even with 4GB on desktop and laptops becoming commonplace, and 8GB, 12GB, 16GB etc. becoming not all that unusual, it&#8217;s unnerving to see a web browser eating [...]]]></description>
			<content:encoded><![CDATA[<p>With the work going on to bring Firefox to mobile devices, and with desktop users demanding more and more from their web browser, memory usage is a concern.  Even with 4GB on desktop and laptops becoming commonplace, and 8GB, 12GB, 16GB etc. becoming not all that unusual, it&#8217;s unnerving to see a web browser eating up a large chunk of that.  I&#8217;ve been spending time figuring out how we can improve our memory usage, which starts with finding out where Firefox uses memory to begin with.</p>
<p>Let&#8217;s get one thing out of the way up front.  Today&#8217;s web browser is in many ways acting like a miniature full operating system.  It runs multiple applications at once (whether in multiple windows or tabs).  It might do a lot of background processing.  It can work with large data sets, for example large images on flickr or large spreadsheets on Google Documents.  But, the final memory usage number that the user sees when they open up the Task Manager or Process Viewer is the aggregate memory usage of the entire system.  So, the goal of improving our memory usage is not to get that number to the lowest possible &#8212; doing that would be an unacceptable tradeoff in performance for users &#8212; but instead to understand where memory is being used, and then use that data to improve in those areas as possible.</p>
<p>One comment that I&#8217;ve heard is that Firefox 3.6 seems to use more memory than Firefox 3.0.  My initial tests show this to not be true; specifically, I looked at the &#8220;Private Bytes&#8221; value in the Windows 7 task manager shortly after startup with about:blank, and also after opening a number of tabs (gmail, google docs, cnn.com, front page of the boston.com big picture blog, engadget, and a few others).  Here are the results of a typical run:</p>
<p><center><br />
<table style="border: 1px solid black;">
<tr>
<th>(in kb)</th>
<th>Firefox 3.0</th>
<th>Firefox 3.6</th>
</tr>
<tr>
<th>Blank Page</th>
<td align="right">20,052</td>
<td align="right">21,740</td>
</tr>
<tr>
<th>Multiple Tabs</th>
<td align="right">115,532</td>
<td align="right">109,128</td>
</tr>
</table>
<p></center></p>
<p>The next question is figuring out where all the memory goes.  I&#8217;ve been adding some instrumentation to Firefox to figure out in more detail where memory is being used.  For a sample run with the multiple tabs shown above, here&#8217;s what some of that reporter data looks like:</p>
<p><center><br />
<table style="border: 1px solid black;">
<tr>
<th>Component</th>
<th>Memory (in kb)</th>
<tr>
<th align="left">Windows &#8211; Private Bytes</th>
<td align="right">111,616</td>
</tr>
<tr>
<th align="left">jemalloc &#8211; Commit Size</th>
<td align="right">91,684</td>
</tr>
<tr>
<th align="left">JavaScript &#8211; GC Chunks</th>
<td align="right">11,534</td>
</tr>
<tr>
<th align="left">JavaScript &#8211; NJ Trace Code</th>
<td align="right">128</td>
</tr>
<tr>
<th align="left">JavaScript &#8211; js_malloc Other</th>
<td align="right">30,142</td>
</tr>
<tr>
<th align="left">Images (uncompressed)</th>
<td align="right">53,811</td>
</tr>
<tr>
<th align="left">Graphics Surfaces (win32)</th>
<td align="right">53,967</td>
</tr>
<tr>
<th align="left">PresShell Arenas</th>
<td align="right">6,373</td>
</tr>
</table>
<p></center></p>
<p>Or, graphically:</p>
<p><center><a href="http://blog.vlad1.com/wp-content/uploads/2010/05/foo.png"><img src="http://blog.vlad1.com/wp-content/uploads/2010/05/foo.png" alt="" title="Memory Usage Sample" width="600" height="216" class="aligncenter size-full wp-image-305" /></a></center></p>
<p>There&#8217;s some overlap in those numbers &#8212; for example, the jemalloc commit size is a subset of the Windows Private Bytes number, and most of the rest is a subset of the jemalloc commit size.  Likewise, the uncompressed images number is a subset of the Win32 graphics surfaces number; that is, ~53MB is in use by win32 surfaces, and almost all of that is due to live images in pages (remember that we&#8217;ve got some image heavy sites in that tab set, including the Big Picture blog which has around 10-11 large images on it&#8230; those should account for about 20-25MB just by themselves).</p>
<p>There are some things that don&#8217;t make sense in the above, which mean that my instrumentation isn&#8217;t quite correct&#8230; for example, adding up the JS numbers, the Images number, and the PresShell arenas number brings us beyond the jemalloc commit size, which shouldn&#8217;t be true.  However, some of the Image data is allocated by GDI, likely bypassing jemalloc, so we have to take that into account.  There&#8217;s also some large other chunks of the browser that have yet to be instrumented, which should provide additional insight.</p>
<p>Two initial observations: one, keeping images compressed in memory and only decompressing them briefly when we need to draw them is a potential huge memory win.  We have the infrastructure and code to do this in place; it was disabled recently while some of the internals changed, and it needs to be reenabled.</p>
<p>Two, the 30MB or so in the &#8220;js_malloc Other&#8221; bucket is also pretty curious.  We need to do some more work to figure out what exactly is in here.  (This contains things like data structures for tracking array contents and &#8212; potentally a big one &#8212; string data.)</p>
<p>I&#8217;ll be blogging more as the instrumentation takes shape, and as it gets landed into trunk nightly builds.  Much of this information will be visible in about:memory, and eventually we&#8217;ll be able to give some per-tab memory information as well.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.vlad1.com/2010/05/10/losing-my-memory/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Fennec on Android</title>
		<link>http://blog.vlad1.com/2010/04/27/fennec-on-android-ground-zero/</link>
		<comments>http://blog.vlad1.com/2010/04/27/fennec-on-android-ground-zero/#comments</comments>
		<pubDate>Wed, 28 Apr 2010 00:39:39 +0000</pubDate>
		<dc:creator>vladimir</dc:creator>
				<category><![CDATA[Firefox]]></category>
		<category><![CDATA[Mozilla]]></category>

		<guid isPermaLink="false">http://blog.vlad1.com/?p=280</guid>
		<description><![CDATA[Over the last few months, we&#8217;ve made some great progress on bringing Firefox to Android.  Michael Wu, Brad Lassey, Alex Pakhotin and I have been focusing on getting a build ready that&#8217;s usable by a broader set of people, and we&#8217;re now ready to get that build out there.  This build should be considered &#8220;pre-alpha&#8221;, [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://blog.vlad1.com/wp-content/uploads/2010/04/fennec-n1.png"><img class="alignright size-full wp-image-286" title="fennec-n1" src="http://blog.vlad1.com/wp-content/uploads/2010/04/fennec-n1.png" alt="" width="240" height="400" /></a>Over the last few months, we&#8217;ve made some great progress on bringing Firefox to Android.  Michael Wu, Brad Lassey, Alex Pakhotin and I have been focusing on getting a build ready that&#8217;s usable by a broader set of people, and we&#8217;re now ready to get that build out there.  This build should be considered &#8220;pre-alpha&#8221;, so there are some warnings and caveats:</p>
<ul>
<li>We&#8217;ve only really tested this on the Motorola Droid and the Nexus One.</li>
<li>It will likely not eat your phone, but bugs might cause your phone to stop responding, requiring a reboot.</li>
<li>Memory usage of this build isn&#8217;t great &#8212; in many ways it&#8217;s a debug build, and we haven&#8217;t really done a lot of optimization yet.  This could cause some problems with large pages, especially on low memory devices like the Droid.</li>
<li>You&#8217;ll see the app exit and relaunch on first start, as well as on add-on installs; this is a quirk of our install process, and we&#8217;re working to get rid of it.</li>
<li>You can&#8217;t open links from other apps using Fennec; we should have this for the next build.</li>
<li>This build requires Android 2.0 or above, and likely an OpenGL ES 2.0 capable device.</li>
<li>Edit: This build must be installed to internal memory, not to a SD card.</li>
</ul>
<p>There also aren&#8217;t yet any automated nightly developer builds or automated updates to this build; it&#8217;s even more of a pre-nightly build (even earlier than pre-alpha).  But, it&#8217;s usable enough that we wanted to get some feedback on it as we continue to develop.</p>
<h3>Weave Sync</h3>
<p>There is an experimental version of Weave that is compatible with this build: from within Fennec on your phone, open the Mozilla Labs weave page at <a href="https://mozillalabs.com/weave/">https://mozillalabs.com/weave/</a> and click on &#8220;Experimental Version&#8221;.  (It&#8217;s to the right of the big <em>Download Weave now!</em> link &#8212; don&#8217;t click on that one though, it&#8217;s an older version.)  Install the add-on, then you&#8217;ll need to restart Fennec (swipe the screen left and then click on the &#8220;gear&#8221; icon to open the browser tools panel, then click on addons and click the Restart button at the top).  Follow the instructions when Fennec restarts.</p>
<h3>Troubleshooting</h3>
<p>Should you run into problems, such as the app not responding or just giving you a black screen, you can force it to quit by going into the Android Settings, selecting Applications, selecting Manage Applications, then selecting Fennec, and tapping Force Stop.  (A utility called <em>White Killer</em>, available from the Market, can do the same job with fewer clicks.)  Worst case, uninstalling and reinstalling would clear out your profile and any saved data.</p>
<h3>Installation &amp; Feedback</h3>
<p><a href="http://bit.ly/fennec-android"><img class="alignleft size-full wp-image-283" title="Fennec for Android QR" src="http://blog.vlad1.com/wp-content/uploads/2010/04/fennec-android-bitly.png" alt="" width="155" height="155" /></a>So, now that you&#8217;ve read all that, you can <a href="http://bit.ly/fennec-android">download the build here</a> &#8212; the easiest way is to download it using your phone&#8217;s browser, and then click on it in the downloads list to install it.  If you&#8217;re reading this on your desktop, you can scan the QR code here on your phone, or type in the following address in your phone&#8217;s browser: <strong>bit.ly/fennec-android</strong>.  You may need to enable installation of non-Market applications by going to Settings, Applications, and checking &#8220;Unknown Sources&#8221;.</p>
<p>We&#8217;ve created a temporary <a href="http://groups.google.com/group/fennec-android-pre-alpha">Google Group for feedback</a> about this pre-alpha build.  In the future we&#8217;ll have a more permanent way for user feedback and comments, but for now, please use the group to let us know what you think!</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.vlad1.com/2010/04/27/fennec-on-android-ground-zero/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

