<?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>dougt&#039;s blog &#187; npapi</title>
	<atom:link href="http://dougt.org/wordpress/tag/npapi/feed/" rel="self" type="application/rss+xml" />
	<link>http://dougt.org/wordpress</link>
	<description>best. tagline. ever.</description>
	<lastBuildDate>Mon, 26 Jul 2010 03:18:35 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	
		<item>
		<title>Fast Flash in Fennec</title>
		<link>http://dougt.org/wordpress/2009/11/fast-flash-fennec/</link>
		<comments>http://dougt.org/wordpress/2009/11/fast-flash-fennec/#comments</comments>
		<pubDate>Sun, 29 Nov 2009 20:14:47 +0000</pubDate>
		<dc:creator>dougt</dc:creator>
				<category><![CDATA[General]]></category>
		<category><![CDATA[mozilla]]></category>
		<category><![CDATA[fennec]]></category>
		<category><![CDATA[flash]]></category>
		<category><![CDATA[mobile]]></category>
		<category><![CDATA[npapi]]></category>
		<category><![CDATA[plugins]]></category>

		<guid isPermaLink="false">http://dougt.org/wordpress/?p=506</guid>
		<description><![CDATA[For the last few days, we have been making Flash fast in Fennec. Our situation in Fennec is that we have a hidden browser element that contains the flash object/embed element. When a paint needs to happen, we draw whatever the plugin wants to draw into a canvas or sent of canvas elements. These canvas [...]]]></description>
			<content:encoded><![CDATA[<p>For the last few days, we have been making Flash fast in Fennec.</p>
<p>Our situation in Fennec is that we have a hidden browser element that contains the flash object/embed element.  When a paint needs to happen, we draw whatever the plugin wants to draw into a canvas or sent of canvas elements.  These canvas elements are what the user sees on the screen &#8212; they are part of Fennec&#8217;s tile manager.  Now these draws to the tile manager consistent of a 16bpp to 24bpp conversion (I am told that the flash is optimized for 16bpp), then a copy to a gfxXLibSurface, then a final blit to the screen.  This final bit also contains a 24bpp-&gt;16bpp conversion because the screen is 16bpp.  To make matters much worse, many plugins intersect multiple canvases in the tile manager which causes this drawing path to happen multiple times per video frame.  The end result is that we were getting no more than 4-5 fps.</p>
<p>We took some incremental steps to improvement performance, but we were no where close to double digit fps.</p>
<p>At this point, we decided to just draw directly to the screen avoiding the tile manager completely.  This allowed us to render without any conversions and only one copy &#8212; the plugin could write directly to X11 shared memory.</p>
<p>In making this decision, we would lose a bunch of information that Gecko provides such as where the plugin should be position relative to other elements, and how it should be clipped.  The solution we came up with was to let Fennec tell each of the object and embed elements where they should be drawn.  The frame painting code would honor the position and clip that the front end set.  In this way, we could have plugins do the right thing during pans and when content is below the Fennec sidebars/urlbar.</p>
<p>You can check out how Fennec positions elements here:</p>
<p><a href="http://mxr.mozilla.org/mobile-browser/source/chrome/content/browser.js#2937">http://mxr.mozilla.org/mobile-browser/source/chrome/content/browser.js#2937</a></p>
<p>The end result in this work is that we get over 25fps when <a href="http://en.wikipedia.org/wiki/Sorenson_codec">Sorenson</a> encoded videos.  Over the next weeks and months, I hope to see more video content honoring Fennec&#8217;s user agent and provide optimized content.  (YouTube and other sites do not recognized Fennec&#8217;s UA, yet).</p>
<p>This fast path is only implemented on Maemo, but it can be implemented on any platform assuming the plugin has support to draw directly into a memory buffer.</p>
<p>You also can check out the details in bug <a href="https://bugzilla.mozilla.org/show_bug.cgi?id=528551">528551</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://dougt.org/wordpress/2009/11/fast-flash-fennec/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
	</channel>
</rss>
