<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title><![CDATA[I love &quot;C&quot; memcpy(); 387 fps]]></title><description><![CDATA[<p dir="auto">Re: <a href="/topic/3050/fb_ili9341-80fps-up-to-100fps-memcpy-387-fps-minimal">FB_ILI9341 80fps up to 100fps | memcpy(); 387 fps minimal</a></p>
<h4>UPDATE 16th Aug</h4>
<ul>
<li>Compiled C binary which includes "C include file style bmp" files, shows [ <strong>387 fps</strong> ] minimal rate. memcpy() used. (Omega2+)</li>
<li>Compiled C binary, memcpy() fill_screen one color 1000 times -&gt; [ <strong>432 fps</strong> ]</li>
<li>Compiled C binary, memcpy() fill_screen 21 color 1000 times -&gt; [ <strong>439 fps</strong> ]</li>
</ul>
]]></description><link>http://community.onion.io/topic/3083/i-love-c-memcpy-387-fps</link><generator>RSS for Node</generator><lastBuildDate>Wed, 14 Oct 2026 11:35:34 GMT</lastBuildDate><atom:link href="http://community.onion.io/topic/3083.rss" rel="self" type="application/rss+xml"/><pubDate>Fri, 17 Aug 2018 00:16:31 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to I love &quot;C&quot; memcpy(); 387 fps on Fri, 17 Aug 2018 00:19:00 GMT]]></title><description><![CDATA[<p dir="auto">Re: <a href="/topic/3050/fb_ili9341-80fps-up-to-100fps-memcpy-387-fps-minimal">FB_ILI9341 80fps up to 100fps | memcpy(); 387 fps minimal</a></p>
<h4>UPDATE 16th Aug</h4>
<ul>
<li>Compiled C binary which includes "C include file style bmp" files, shows [ <strong>387 fps</strong> ] minimal rate. memcpy() used. (Omega2+)</li>
<li>Compiled C binary, memcpy() fill_screen one color 1000 times -&gt; [ <strong>432 fps</strong> ]</li>
<li>Compiled C binary, memcpy() fill_screen 21 color 1000 times -&gt; [ <strong>439 fps</strong> ]</li>
</ul>
]]></description><link>http://community.onion.io/post/17462</link><guid isPermaLink="true">http://community.onion.io/post/17462</guid><dc:creator><![CDATA[unique1984]]></dc:creator><pubDate>Fri, 17 Aug 2018 00:19:00 GMT</pubDate></item><item><title><![CDATA[Reply to I love &quot;C&quot; memcpy(); 387 fps on Fri, 17 Aug 2018 12:31:27 GMT]]></title><description><![CDATA[<p dir="auto">How do you measure the FPS? Just the time it takes for the <code>memcpy</code> to complete? The way I understand this works is that by writing into the special screen buffer memory, a page fault is generated, which is handled by the kernel / framebuffer driver. The framebuffer driver will periodically push the framebuffer contents to the display using SPI with the interval dictated by the initially given FPS in the command loading the kernel module (<code>insmod /root/modules/fbtft_device.ko custom name="fb_ili9341" busnum=32766 cs=1 speed=96666000 mode=0x06 fps=100 txbuflen=3145728 buswidth=8 bgr=1 gpios=reset:2,dc:3 width=240 height=320 verbose=3 rotate=90 debug=2 </code>). I somewhere read that the framebuffer kernel driver can also measure the FPS, maybe we should take those measurements?</p>
]]></description><link>http://community.onion.io/post/17463</link><guid isPermaLink="true">http://community.onion.io/post/17463</guid><dc:creator><![CDATA[Maximilian Gerhardt]]></dc:creator><pubDate>Fri, 17 Aug 2018 12:31:27 GMT</pubDate></item><item><title><![CDATA[Reply to I love &quot;C&quot; memcpy(); 387 fps on Sat, 18 Aug 2018 09:38:31 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="http://community.onion.io/uid/4683">@Maximilian-Gerhardt</a> yes you are right, the "fps" is limited with the spi bus speed, and that is at max 100, in the memory it works same speed with the cpu's that one is the 387 for 150Kbytes 16bit embedded bmp. It can't be showing but it is there. In the future if there is much faster spi speed then we can use these rates.</p>
<p dir="auto"><strong>fill screen function, after first line just memcpy()</strong></p>
<pre><code>void
	fillScreen ( struct fb_info *fb_info, unsigned int color )
	{
		//~ for ( int i=0; i &lt;= fb_info -&gt; screensize; i++ )
			//~ putPixelDirectToLocation( fb_info, i, color );

		for ( int i=0; i &lt; fb_info -&gt; var.xres; i++ )
		{
			putPixel( fb_info, i, 0, color );
		}
		
		for ( int i=1; i &lt; fb_info -&gt; var.yres; i++ )
		{
			memcpy( fb_info -&gt; ptr + ( fb_info -&gt; fix.line_length * i ),
					fb_info -&gt; ptr,
					( fb_info -&gt; var.xres * ( fb_info -&gt; var.bits_per_pixel / 8 ) ) );
		}

		/***********/
		//~ for ( int i = 0; i &lt; fb_info -&gt; var.yres; i++)
		//~ {
			//~ drawHorizontalLine ( fb_info, 0, i, (unsigned int)fb_info -&gt; var.xres, color );
		//~ }
	}
</code></pre>
<p dir="auto">this is the embedded bmp push code</p>
<pre><code>	for (int i=0; i&lt;1000; i++)
	{
		/* memcpy() bmp show */
		memcpy( fb_info.ptr, &amp;logo_bmp[0], logo_bmp_len );
	}
</code></pre>
<p dir="auto">and this is the simple test code</p>
<p dir="auto"><em>date nanoseconds enabled from menuconfig "%N" and bc installed</em></p>
<pre><code>#!/usr/bin/env sh

count=1000
first=$(date +"%s.%N")
echo -e "started\t"$first
#for i in `seq $count`; do ./fb-test; done;
./fb-test
last=$(date +"%s.%N")
echo -e "ended\t"$last
echo $(echo "$count/($last-$first)" | bc)" fps"
</code></pre>
<p dir="auto"><img src="/assets/uploads/files/1534511362650-c07bb612-aa57-4443-b4be-f918e2596e5a-image.png" alt="0_1534511196640_c07bb612-aa57-4443-b4be-f918e2596e5a-image.png" class="img-responsive img-markdown" /></p>
<p dir="auto">Last one the built in debug, <s>i think it has some kind of bug or it is not an optimized code</s>  ( ~3000Kb * ~5 = ~15.000 Kb ) i think this is the equation:</p>
<p dir="auto">when you use <code>debug=$((1&lt;&lt;5))</code> it shows, (~ 3000Kb) * ( ~5 )<br />
or<br />
<code>echo -e $((1&lt;&lt;5)) &gt; /sys/class/graphics/fb0/debug</code><br />
then, for cancle<br />
<code>echo -e 0 &gt; /sys/class/graphics/fb0/debug</code></p>
<p dir="auto"><img src="/assets/uploads/files/1534512166110-b69ef583-17f7-47ad-8f66-c4c118795c96-image.png" alt="0_1534511998105_b69ef583-17f7-47ad-8f66-c4c118795c96-image.png" class="img-responsive img-markdown" /></p>
<hr />
<p dir="auto"><strong>Extras</strong></p>
<p dir="auto">I wrote something similar Adafruit_GFX, it capable of draw lines, draw triangles, draw squares, draw circles, push 16bit bmps ... but the code has a lots of issue, there is a long way to go for stable. When i clean things up I will push the code to gitlab.</p>
<p dir="auto"><img src="/assets/uploads/files/1534513534097-4eff00b9-f5e1-4200-8755-dd4aae253c96-image.png" alt="0_1534513367477_4eff00b9-f5e1-4200-8755-dd4aae253c96-image.png" class="img-responsive img-markdown" /></p>
<p dir="auto">if you compile modules builtin, below script activates the display in 10 seconds or so when power up the omega2, i am trying to activate with uboot but no luck for now.</p>
<p dir="auto">display init script <code>init.d</code></p>
<pre><code>#!/bin/sh /etc/rc.common

START=01
STOP=99

DEFAULT_ROTATION=3
ROTATE_ANGLE=270

EXTRA_COMMANDS="rotate"
EXTRA_HELP="
        rotate Change the display direction to one of the [0 1 2 3] values 0:0, 1:90, 2:180, 3:270
"

start() {
        insmod fbtft_device custom name="fb_ili9341" busnum=32766 cs=1 speed=96666000 mode=3 fps=100 txbuflen=3145728 buswidth=8 bgr=1 gpios=reset:2,dc:3 width=240 height=320 verbose=0 rotate=$ROTATE_ANGLE debug=0
}

stop() {
        rmmod fbtft_device
}

rotate() {
        if [ ! -z $1 ]; then
        stop
                if [ $1 -eq 0 ]; then
                        ROTATE_ANGLE=0
                        echo "$1 0"
                elif [ $1 -eq 1 ]; then
                        ROTATE_ANGLE=90
                        echo "$1 90"
                elif [ $1 -eq 2 ]; then
                        ROTATE_ANGLE=180
                        echo "$1 180"
                elif [ $1 -eq 3 ]; then
                        ROTATE_ANGLE=270
                        echo "$1 270"
                else
                        ROTATE_ANGLE=270
                        echo "$1 270"
                fi
        start
        fi
}

boot() {
        start
}
</code></pre>
]]></description><link>http://community.onion.io/post/17464</link><guid isPermaLink="true">http://community.onion.io/post/17464</guid><dc:creator><![CDATA[unique1984]]></dc:creator><pubDate>Sat, 18 Aug 2018 09:38:31 GMT</pubDate></item></channel></rss>