Cruisers Forum
 


Join CruisersForum Today

Reply
 
Thread Tools Rate Thread Display Modes
Old 26-02-2015, 15:27   #1
Registered User

Join Date: Feb 2015
Location: Swedish westcoast
Boat: Beneteau First 40.7, Skippi 650
Posts: 10
Has anyone managed to get hardware supported OpenGL on Rasperry Pi2 to work?

Dear all. A few days ago a got my new Pi2 wih the ambition to try out running OpenCPN on it. Getting the Raspbian image onto the SD card and boot the Pi was, as allways, easy. I then downloaded the readymade OpenCPN build 4.0.0 from A. Gurney. I had it up and running without any problems, including access to the GPS puck. So, my installation is as "pure" as it can get.

I then loaded my old raster charts to the Pi. However, I soon discovered that I had no hardware support for OpenGL. Without OpenGL activated in the OCPN application, I get acceptable performance (barely), but with the OpenGL box ticked, I get more or less no performance at all. The OCPN logfile also states that the OpenGL support is software driven.

When searching the web, I get a few hits on OpenGL and hardware support, but I haven´t actually found anyone that clearly confirms that they have it functioning on a Raspi2. The closest I get is a reference to "Building and installing on CubieTruck with Hardware Acceleration" on opencpn.org. I do manage to run the test programme glxgears and that seems to confirm that I do have hardware support available, but I cant get it to work with OpenCPN. I would appreciate any comments from you!

Best regards,
Gunnar
__________________

__________________
Gunnar1 is offline   Reply With Quote
Old 26-02-2015, 18:07   #2
Registered User
 
NahanniV's Avatar

Join Date: Mar 2011
Location: On the Boat
Boat: Finnsailer 38
Posts: 1,143
Re: Has anyone managed to get hardware supported OpenGL on Rasperry Pi2 to work?

Quote:
Originally Posted by Gunnar1 View Post
Dear all. A few days ago a got my new Pi2 wih the ambition to try out running OpenCPN on it. Getting the Raspbian image onto the SD card and boot the Pi was, as allways, easy. I then downloaded the readymade OpenCPN build 4.0.0 from A. Gurney. I had it up and running without any problems, including access to the GPS puck. So, my installation is as "pure" as it can get.

I then loaded my old raster charts to the Pi. However, I soon discovered that I had no hardware support for OpenGL. Without OpenGL activated in the OCPN application, I get acceptable performance (barely), but with the OpenGL box ticked, I get more or less no performance at all. The OCPN logfile also states that the OpenGL support is software driven.

When searching the web, I get a few hits on OpenGL and hardware support, but I haven´t actually found anyone that clearly confirms that they have it functioning on a Raspi2. The closest I get is a reference to "Building and installing on CubieTruck with Hardware Acceleration" on opencpn.org. I do manage to run the test programme glxgears and that seems to confirm that I do have hardware support available, but I cant get it to work with OpenCPN. I would appreciate any comments from you!

Best regards,
Gunnar
glxgears is for desktop OpenGL so it will run with the slow software OpenGL support on your Pi2. The fact that it runs isn't telling you anything; It's the reported framerate that is of interest.

Note that if you get something like 60FPS your system may be set to cap the framerate, you will need to set vblank_mode to see the true frame rate. If you are under 60fps just ignore this.

I don't know if it will work or not, but on the other ARM boards people are using glshim to convert between the desktop OpenGL that OpenCPN uses and the Embedded OpenGLes that the ARM boards support.

Follow the instructions in the CubieTruck tutorial, except you may need different switches to compile for the Pi.

If you get glshim built and installed properly glxgears should report a much higher framerate with lower CPU usage.

Once you get glxgears running with the higher frame rate OpenCPN should work faster in OpenGL mode. Note that this works best with raster charts and there will be a delay each time you open a new chart as it is being compressed.

Good Luck,
JM.

P.S. The main developer of OpenCPN is currently working to incorporate glshim into OpenCPN. So you could just wait for that to be completed.
__________________

__________________
NahanniV is online now   Reply With Quote
Old 27-02-2015, 05:10   #3
Registered User

Join Date: Feb 2015
Location: Swedish westcoast
Boat: Beneteau First 40.7, Skippi 650
Posts: 10
Re: Has anyone managed to get hardware supported OpenGL on Rasperry Pi2 to work?

Thank you for your quick reply JM! This was my first post on this forum and it this was more than I could expect.

I guess I will wait for the OCPN team then and explore other features meanwhile. The AIS receiver many talk about sounds interesting.

Best regards,
Gunnar
__________________
Gunnar1 is offline   Reply With Quote
Old 27-02-2015, 05:36   #4
Registered User
 
NahanniV's Avatar

Join Date: Mar 2011
Location: On the Boat
Boat: Finnsailer 38
Posts: 1,143
Re: Has anyone managed to get hardware supported OpenGL on Rasperry Pi2 to work?

Quote:
Originally Posted by Gunnar1 View Post
Thank you for your quick reply JM! This was my first post on this forum and it this was more than I could expect.

I guess I will wait for the OCPN team then and explore other features meanwhile. The AIS receiver many talk about sounds interesting.

Best regards,
Gunnar
I'd be interested to know what frame rate glxgears was reporting ?

Did the gears display correctly ?

Thanks,
JM.
__________________
NahanniV is online now   Reply With Quote
Old 27-02-2015, 08:37   #5
Registered User

Join Date: Feb 2015
Location: Swedish westcoast
Boat: Beneteau First 40.7, Skippi 650
Posts: 10
Re: Has anyone managed to get hardware supported OpenGL on Rasperry Pi2 to work?

When I run glxgears with the default sized window, I get around 55 fps and the gears run smoothly. When I maximize the window to full screen, I get 8-9 fps, with the gears running sort of smoothly. In both cases the CPU had approx 25% load.

/Gunnar
__________________
Gunnar1 is offline   Reply With Quote
Old 27-02-2015, 10:07   #6
Registered User
 
NahanniV's Avatar

Join Date: Mar 2011
Location: On the Boat
Boat: Finnsailer 38
Posts: 1,143
Re: Has anyone managed to get hardware supported OpenGL on Rasperry Pi2 to work?

These are the steps I would try. If you want to experiment:

Code:
-- Download the forked version of glshim:

$ git clone https://github.com/seandepagnier/glshim.git

-- Build glshim library and copy the results to a suitable location:

$ cd glshim
$ cmake . -DBCMHOST=1
$ make GL

-- find location of libraries used by glxgears

$ ldd /usr/bin/glxgears

-- look for location of libGL.so.1 and libGLU.so.1
-- in my case: /usr/lib/arm-linux-gnueabihf/
-- Overwrite with the ones we just made
$ sudo cp lib/libGL.so.1 /usr/lib/arm-linux-gnueabihf/
$ sudo cp -r include/GLES/ /usr/local/include/
Then try glxgears again and see what the frame rate and CPU usage is.
Frame rate should go up and CPU usage down, but it may be capped at 60FPS. If capped at 60FPS the fullscreen test should show a bigger difference.

Then you can try OpenCPN with OpenGL and texture compression caching.
Cheers,
JM.
__________________
NahanniV is online now   Reply With Quote
Old 28-02-2015, 02:57   #7
Registered User

Join Date: Feb 2015
Location: Swedish westcoast
Boat: Beneteau First 40.7, Skippi 650
Posts: 10
Re: Has anyone managed to get hardware supported OpenGL on Rasperry Pi2 to work?

Ok, thanks, I will. IT will take a couple of days, since I am on a trip over the weekend.
Best regards,
Gunnar


Sent from my iPhone using Cruisers Sailing Forum
__________________
Gunnar1 is offline   Reply With Quote
Old 28-02-2015, 05:33   #8
Registered User

Join Date: Oct 2014
Location: Netherlands
Boat: Halmatic 30
Posts: 403
Re: Has anyone managed to get hardware supported OpenGL on Rasperry Pi2 to work?

Quote:
Originally Posted by NahanniV View Post
These are the steps I would try. If you want to experiment:

Code:
-- Download the forked version of glshim:

$ git clone https://github.com/seandepagnier/glshim.git

-- Build glshim library and copy the results to a suitable location:

$ cd glshim
$ cmake . -DBCMHOST=1
$ make GL

-- find location of libraries used by glxgears

$ ldd /usr/bin/glxgears

-- look for location of libGL.so.1 and libGLU.so.1
-- in my case: /usr/lib/arm-linux-gnueabihf/
-- Overwrite with the ones we just made
$ sudo cp lib/libGL.so.1 /usr/lib/arm-linux-gnueabihf/
$ sudo cp -r include/GLES/ /usr/local/include/
Then try glxgears again and see what the frame rate and CPU usage is.
Frame rate should go up and CPU usage down, but it may be capped at 60FPS. If capped at 60FPS the fullscreen test should show a bigger difference.

Then you can try OpenCPN with OpenGL and texture compression caching.
Cheers,
JM.
Dear JM,

tried the above instructions on my Banana Pi.

I had to install git and cmake.

However I got the following error:

After:

-- Detecting C compiler ABI info - done

Error:

CMake Error: your CXX compiler: "CMAKE_CXX_COMPILER-NOTFOUND" was not found. Please set CMAKE_CXX_COMPILER to a valid compiler path or name.

Any Idea how the resolve this error. Is it only a matter of changing the path ?

I'am very interested to see how OpenCPN is running with hardware accellerated rendering on.

Bram
__________________
verkerkbr is offline   Reply With Quote
Old 28-02-2015, 06:45   #9
Registered User

Join Date: Oct 2014
Location: Netherlands
Boat: Halmatic 30
Posts: 403
Re: Has anyone managed to get hardware supported OpenGL on Rasperry Pi2 to work?

found the Problem:
CXX compiler not installed
__________________
verkerkbr is offline   Reply With Quote
Old 28-02-2015, 06:52   #10
Registered User

Join Date: Oct 2014
Location: Netherlands
Boat: Halmatic 30
Posts: 403
Re: Has anyone managed to get hardware supported OpenGL on Rasperry Pi2 to work?

But now I got this error:

[ 94%] Building C object src/CMakeFiles/GL.dir/glx/glx.c.o
In file included from /home/bram/glshim/src/glx/glx.c:9:0:
/home/bram/glshim/src/glx/glx.h:2:22: fatal error: bcm_host.h: No such file or directory
#include "bcm_host.h"
^
compilation terminated.
make[3]: *** [src/CMakeFiles/GL.dir/glx/glx.c.o] Error 1
make[2]: *** [src/CMakeFiles/GL.dir/all] Error 2
make[1]: *** [src/CMakeFiles/GL.dir/rule] Error 2
make: *** [GL] Error 2
__________________
verkerkbr is offline   Reply With Quote
Old 28-02-2015, 07:04   #11
Registered User
 
NahanniV's Avatar

Join Date: Mar 2011
Location: On the Boat
Boat: Finnsailer 38
Posts: 1,143
Re: Has anyone managed to get hardware supported OpenGL on Rasperry Pi2 to work?

Quote:
Originally Posted by verkerkbr View Post
But now I got this error:

[ 94%] Building C object src/CMakeFiles/GL.dir/glx/glx.c.o
In file included from /home/bram/glshim/src/glx/glx.c:9:0:
/home/bram/glshim/src/glx/glx.h:2:22: fatal error: bcm_host.h: No such file or directory
#include "bcm_host.h"
^
compilation terminated.
make[3]: *** [src/CMakeFiles/GL.dir/glx/glx.c.o] Error 1
make[2]: *** [src/CMakeFiles/GL.dir/all] Error 2
make[1]: *** [src/CMakeFiles/GL.dir/rule] Error 2
make: *** [GL] Error 2
The cmake . -DBCMHOST=1
is experimental for the Raspberry Pi (I don't know what it's for).

On the bananaPi you should follow the cubietruck instructions:
$ cmake .
$ make GL

Cheers,
JM.
__________________
NahanniV is online now   Reply With Quote
Old 28-02-2015, 13:42   #12
Registered User

Join Date: Oct 2014
Location: Netherlands
Boat: Halmatic 30
Posts: 403
Re: Has anyone managed to get hardware supported OpenGL on Rasperry Pi2 to work?

Quote:
Originally Posted by NahanniV View Post
The cmake . -DBCMHOST=1
is experimental for the Raspberry Pi (I don't know what it's for).

On the bananaPi you should follow the cubietruck instructions:
$ cmake .
$ make GL

Cheers,
JM.
Allo Jim,

tried this (the Cubie setup) on my Banana. Again a compiler/linking error.

[ 94%] Building C object src/CMakeFiles/GL.dir/glx/glx.c.o
/home/bram/glshim/src/glx/glx.c: In function ‘xrefresh’:
/home/bram/glshim/src/glx/glx.c:158:11: warning: ignoring return value of ‘system’, declared with attribute warn_unused_result [-Wunused-result]
system("xrefresh");
^
[100%] Building C object src/CMakeFiles/GL.dir/glx/lookup.c.o
Linking C shared library ../lib/libGL.so.1
/usr/bin/ld: cannot find -lEGL
collect2: error: ld returned 1 exit status
make[3]: *** [lib/libGL.so.1] Error 1
make[2]: *** [src/CMakeFiles/GL.dir/all] Error 2
make[1]: *** [src/CMakeFiles/GL.dir/rule] Error 2
make: *** [GL] Error 2

Any Idea how to proceed ?

It is a bit off-topic because it is not on a Raspy 2.

Regards,


Bram
__________________
verkerkbr is offline   Reply With Quote
Old 28-02-2015, 18:33   #13
Registered User
 
NahanniV's Avatar

Join Date: Mar 2011
Location: On the Boat
Boat: Finnsailer 38
Posts: 1,143
Re: Has anyone managed to get hardware supported OpenGL on Rasperry Pi2 to work?

Quote:
Originally Posted by verkerkbr View Post
Allo Jim,

tried this (the Cubie setup) on my Banana. Again a compiler/linking error.

[ 94%] Building C object src/CMakeFiles/GL.dir/glx/glx.c.o
/home/bram/glshim/src/glx/glx.c: In function ‘xrefresh’:
/home/bram/glshim/src/glx/glx.c:158:11: warning: ignoring return value of ‘system’, declared with attribute warn_unused_result [-Wunused-result]
system("xrefresh");
^
[100%] Building C object src/CMakeFiles/GL.dir/glx/lookup.c.o
Linking C shared library ../lib/libGL.so.1
/usr/bin/ld: cannot find -lEGL
collect2: error: ld returned 1 exit status
make[3]: *** [lib/libGL.so.1] Error 1
make[2]: *** [src/CMakeFiles/GL.dir/all] Error 2
make[1]: *** [src/CMakeFiles/GL.dir/rule] Error 2
make: *** [GL] Error 2

Any Idea how to proceed ?

It is a bit off-topic because it is not on a Raspy 2.

Regards,


Bram

The blind leading the blind here, but I would try doing this:

$ sudo apt-get install mesa-utils build-essential git cmake libx11-dev

Then try to make GLshim again.

Cheers,
JM.
__________________
NahanniV is online now   Reply With Quote
Old 01-03-2015, 02:25   #14
Registered User

Join Date: Oct 2014
Location: Netherlands
Boat: Halmatic 30
Posts: 403
Re: Has anyone managed to get hardware supported OpenGL on Rasperry Pi2 to work?

Allo Jim,

I have allready installed the Items in your comment. Still no progress. It looks if something is missing, but what ? Somethin in a different file ?

Linux version is Lubuntu. Kernel is 3.4.103.

Thanks for your help,

Bram
__________________
verkerkbr is offline   Reply With Quote
Old 01-03-2015, 09:09   #15
bcn
Registered User

Join Date: May 2011
Location: underway whenever possible
Boat: Rangeboat 39
Posts: 2,758
Re: Has anyone managed to get hardware supported OpenGL on Rasperry Pi2 to work?

I do remember Error 1 messages when compiling on the Olimex A20 Arm board.
Were indicators of running out of memory while compiling. Closing all other applications did help.

Hubert
__________________

__________________
bcn is online now   Reply With Quote
Reply

Tags
hardware

Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
OpenCPN on Raspberry PI2 starnakel OpenCPN 284 16-03-2017 14:58
How to calculate the load capacity supported a catamaran and a sailboat? lasiemartins Construction, Maintenance & Refit 23 22-01-2017 12:44
Windows Phone - OpenCPN file type not supported zstine OpenCPN 4 01-04-2014 09:36
Anyone managed to do PSK31 with the new P4dragon modem from SCS? svlamorocha Marine Electronics 0 23-11-2013 10:44
has anyone managed to connect GPS2IP on windows? Mattsav OpenCPN 4 25-03-2013 15:37



Copyright 2002- Social Knowledge, LLC All Rights Reserved.

All times are GMT -7. The time now is 00:06.


Google+
Powered by vBulletin® Version 3.8.8 Beta 1
Copyright ©2000 - 2017, vBulletin Solutions, Inc.
Social Knowledge Networks
Powered by vBulletin® Version 3.8.8 Beta 1
Copyright ©2000 - 2017, vBulletin Solutions, Inc.

ShowCase vBulletin Plugins by Drive Thru Online, Inc.