<?xml version="1.0"?>
<rss version="2.0">
	<channel>
		<title>Allegro runs slow on Raspberry Pi</title>
		<link>http://www.allegro.cc/forums/view/613683</link>
		<description>Allegro.cc Forum Thread</description>
		<webMaster>matthew@allegro.cc (Matthew Leverton)</webMaster>
		<lastBuildDate>Sat, 28 Dec 2013 07:36:59 +0000</lastBuildDate>
	</channel>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>Hi all,<br />I know the Raspberry Pi has a low power CPU (700MHz when last I checked), but it has a really powerful GPU. I&#39;m trying to run a game I wrote on a Raspberry Pi, and it compiles and runs, but has an unacceptably low FPS. Is the allegro port able to use the Raspberry Pi&#39;s GPU yet or is it still in the works?
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (The Master)</author>
		<pubDate>Mon, 23 Dec 2013 07:08:55 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>A4 or A5?
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Elias)</author>
		<pubDate>Mon, 23 Dec 2013 20:49:17 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>The Raspberry PI is going to be ridiculously slower by design than a desktop or laptop computer. Just because it may be able to say, get into 1080p, doesn&#39;t mean it can fill the screen at 30 FPS. It&#39;s also got internal video decoding hardware to mask the fact that it&#39;s really slow, whereas a traditional GPU could do it without dedicated hardware and not even flinch.</p><p>That being said, A4 or A5 is an important question because A4 doesn&#39;t use GPU acceleration at all to start with.
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Chris Katko)</author>
		<pubDate>Mon, 23 Dec 2013 21:43:01 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>Isn&#39;t the RPI supposed to be the equivalent of a Pentium II?  The allegro.txt file used to warn about compiling for something silly like 686 (PII), because lesser computers wouldn&#39;t run it, yet some enjoyable games were made using software video buffer access.
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Arthur Kalliokoski)</author>
		<pubDate>Mon, 23 Dec 2013 21:48:27 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>I&#39;m using A. So it should be hardware accelerated. I was able to get a slight performance boost by loading images as video bitmaps. But not nearly what I was hoping for. I&#39;m looking at optimisation strategies but I think the biggest performance hog is bitmap drawing.
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (The Master)</author>
		<pubDate>Tue, 24 Dec 2013 04:59:22 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><div class="source-code snippet"><div class="inner"><pre><a href="http://www.allegro.cc/manual/al_hold_bitmap_drawing"><span class="a">al_hold_bitmap_drawing</span></a><span class="k2">(</span><span class="k1">true</span><span class="k2">)</span><span class="k2">;</span><span class="c">// cache drawing calls</span>
<span class="c">/*draw all graphics from same source texture*/</span>
<a href="http://www.allegro.cc/manual/al_hold_bitmap_drawing"><span class="a">al_hold_bitmap_drawing</span></a><span class="k2">(</span><span class="k1">false</span><span class="k2">)</span><span class="k2">;</span><span class="c">// upload to gpu and draw</span>
</pre></div></div><p>
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Edgar Reynaldo)</author>
		<pubDate>Tue, 24 Dec 2013 06:04:51 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><div class="quote_container"><div class="title"><a href="http://www.allegro.cc/forums/thread/613683/994212#target">Edgar Reynaldo</a> said:</div><div class="quote"><p>
al_hold_bitmap_drawing(true);// cache drawing calls<br /><i>*draw all graphics from same source texture*</i><br />al_hold_bitmap_drawing(false);// upload to gpu and draw
</p></div></div><p>

That didn&#39;t really help much. Thanks anyway.</p><p>Since I&#39;m running it on linux, I can use callgrind to see what function calls are consuming the most time. The weird thing is, I have set the new bitmap flags to ALLEGRO_VIDEO_BITMAP, and the program is still treating them like a memory bitmap and using al_draw_soft_triangle.</p><p>I compared it to another game I made using the same framework (I&#39;ve written a framework using Allegro 5, for my own personal use). Let&#39;s call the one I&#39;m trying to optimise &quot;Program A&quot; and the other game used for comparison &quot;Program B.&quot; B consistently uses OGL drawing calls for rendering bitmaps, while A keeps using _al_draw_soft_triangle even though I set the ALLEGRO_VIDEO_BITMAP flag.</p><p>Since they use the same framework, the only difference really is the source of the bitmaps. B gets them from files on disk, while A (due to the nature of the program) is loading them from memory chunks received from a server. So does al_load_bitmap_f not load into memory or something?</p><h5>EDIT</h5><p>

Did a check, and had Program A load from a file, and it still keeps treating it like a memory bitmap, even with the ALLEGRO_VIDEO_BITMAP. Does setting that flag even make a difference?</p><h5>EDIT</h5><p>

Evidently not. <b>Checks the manual for al_set_new_bitmap_flags</b> Ah, so it&#39;s a video bitmap by default. So I set the ALLEGRO_MEMORY_BITMAP flag, and B starts using _al_draw_soft_triangle to draw its images, and <i>down goes the FPS!</i> So clearly Program A is creating memory bitmaps regardless of the flag setting... Bizare.
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (The Master)</author>
		<pubDate>Wed, 25 Dec 2013 18:12:14 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>Are you creating your bitmaps before creating your window?
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (l j)</author>
		<pubDate>Thu, 26 Dec 2013 01:40:33 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>After I create the display.</p><p>Still not sure what the problem is. </p><h5>EDIT</h5><p>

I am still trying to figure out what the problem is. I don&#39;t know why my program is loading everything as a memory bitmap while the comparison program is doing it all in video memory.</p><p>This is really starting to drive me up the wall. Even when I put al_set_new_bitmap_flags(ALLEGRO_VIDEO_BITMAP) right before al_load_bitmap, it fails to load the file! And if I put it after creating the display, it doesn&#39;t take effect.</p><p>What is wrong with allegro?
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (The Master)</author>
		<pubDate>Thu, 26 Dec 2013 09:56:57 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>Are you running both programs simultaneously?
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (gezegond)</author>
		<pubDate>Thu, 26 Dec 2013 17:12:05 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>No.</p><p>However, I noticed that the bitmap loading is occurring in another thread separate from the one in which the display is created. Would that cause a problem for creating a video bitmap?</p><h5>EDIT</h5><p>

EPIC BRAINBLAST! That was the problem. Found the problem was the same one as in <a href="https://www.allegro.cc/forums/thread/608306">this thread</a>. So I need to make sure all video resources are secured in the same thread as the one in which the GPU was set up. OK, that problem is fixed. </p><p>Now to see if the FPS goes up on the Raspberry Pi...
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (The Master)</author>
		<pubDate>Thu, 26 Dec 2013 17:14:49 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>Glad to hear you got rid of the problem. <img src="http://www.allegro.cc/forums/smileys/grin.gif" alt=";D" />
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (gezegond)</author>
		<pubDate>Fri, 27 Dec 2013 03:38:37 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>Code works on raspberry pi, nice and virile 57fps!</p><p>Yeah I wouldn&#39;t have normally made this mistake. But I&#39;m actually downloading the images, using asynchronous TCP I/O which uses a separate thread and I didn&#39;t even realise it. So now it is fixed. Thanks for everyone&#39;s help.
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (The Master)</author>
		<pubDate>Sat, 28 Dec 2013 07:34:56 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>Good to hear it!
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Thomas Fjellstrom)</author>
		<pubDate>Sat, 28 Dec 2013 07:36:59 +0000</pubDate>
	</item>
</rss>
