Cruisers Forum
 


Join CruisersForum Today

Reply
 
Thread Tools Rate Thread Display Modes
Old 09-01-2014, 01:32   #1
Registered User
 
boat_alexandra's Avatar

Join Date: Aug 2009
Location: Masachusetts
Boat: bristol 27
Posts: 2,803
Optimized Opencpn: Testers Needed

OpenCPN was very inefficient at rendering many things, basically emulating WxWidgets on top of OpenGL instead of a native call for lots of stuff still.

I went ahead and optimized most of the slow stuff, and greatly reduced idle cpu usage while increasing the frame rate. This helps reduce power consumption as well. OpenCPN is significantly faster on my netbook now. There are actually a lot of improvements in this fork, see the git log for details. It is really only the first pass at optimization though, many things are possible in the future. It is a rather large change (4000 lines added 3000 lines deleted) so it certain to break things in minor ways, which is why I need testers on many platforms.

I think Dave may be a bit busy, so it would be helpful to get other testers to correct issues with this fork to make it easier for him to merge.

I have no display for my raspberry Pi, I would love to hear about any testers on raspberry pi, but you would almost certainly need hardware accelerated opengl to reap much benefit. Of course all platforms need testing.

fork at:
http://github.com/seandepagnier/OpenCPN
__________________

__________________
boat_alexandra is offline   Reply With Quote
Old 09-01-2014, 06:14   #2
Registered User
 
rgleason's Avatar

Join Date: Mar 2012
Location: Boston, MA
Boat: 1981 Bristol 32 Sloop
Posts: 9,369
Re: optimized opencpn: testers needed

Sean I'll try it in a separate instance. Looks like it could be a real improvement. I was very impressed when I found out you did the OpenGL driver, which has made a big difference to many in speed.
It will be interesting to see how this is brought into the main program with all its changes, through git.

Are you moving you plugin developments (weatherfax, weather_routing, celestial, trimplot, watchman etc into the optimized opencpn git?

Thankyou! Where are you now? We're interested in your journey.


Sent from my SCH-I545 using Cruisers Sailing Forum mobile app
__________________

__________________
rgleason is offline   Reply With Quote
Old 09-01-2014, 06:38   #3
Registered User

Join Date: Dec 2013
Posts: 22
Re: optimized opencpn: testers needed

Tried it on a Samsung S2 mobilphone (arm, no acc. opengl):
No gps/compass display.
No nmea (net) feed.
No AIS (net) feed.
__________________
curl is offline   Reply With Quote
Old 09-01-2014, 08:59   #4
Registered User
 
jonasaberg's Avatar

Join Date: Jul 2008
Location: Kristiansand, Norway
Boat: Wasa 410
Posts: 305
Re: optimized opencpn: testers needed

This sounds very good, specifically for low spec systems.

Maybe it would be good with compiled executable's for different environments for testing?
__________________
jonasaberg is offline   Reply With Quote
Old 09-01-2014, 09:37   #5
Registered User

Join Date: Dec 2005
Location: WNA
Boat: Dufour 35
Posts: 3,247
Re: optimized opencpn: testers needed

Testing on Kubuntu 13.10 Amd 64.
Directly after starting.
Click image for larger version

Name:	OPTI.png
Views:	391
Size:	55.5 KB
ID:	73612

Thomas
__________________
cagney is offline   Reply With Quote
Old 09-01-2014, 16:37   #6
Registered User

Join Date: Apr 2009
Location: Marina Del Rey
Boat: Hylas 44
Posts: 387
Re: optimized opencpn: testers needed

Building with visual C++ required the following fixes.
Code:
diff --git a/src/Route.cpp b/src/Route.cpp
index 772343c..aa819d8 100644
--- a/src/Route.cpp
+++ b/src/Route.cpp
@@ -615,7 +615,7 @@ void Route::RenderSegmentArrowsGL( int xa, int ya, int xb, int yb, ViewPort &VP)
         icon_scale_factor = ( lpp * max_arrow_to_leg )
             / nom_arrow_size;
 
-    double theta = atan2( yb - ya, xb - xa );
+    double theta = atan2((double)(yb - ya), (double)(xb - xa));
     theta -= PI / 2;
 
     glPushMatrix();
diff --git a/src/options.cpp b/src/options.cpp
index dfc2a3b..93bfd04 100644
--- a/src/options.cpp
+++ b/src/options.cpp
@@ -4562,7 +4562,7 @@ void SentenceListDlg::OnOkClick( wxCommandEvent& event ) { event.Skip(); }
 //OpenGLOptionsDlg
 
 OpenGLOptionsDlg::OpenGLOptionsDlg( wxWindow* parent ) :
-    wxDialog( parent, wxID_ANY, _T("OpenGL Options") )
+    wxDialog( parent, wxID_ANY, _T("OpenGL Options"), wxDefaultPosition )
 {
     m_bSizer1 = new wxGridSizer( 2, -1 );
     m_bSizer2 = new wxBoxSizer( wxHORIZONTAL );
diff --git a/src/pluginmanager.cpp b/src/pluginmanager.cpp
index 88cc404..5cb2b74 100644
--- a/src/pluginmanager.cpp
+++ b/src/pluginmanager.cpp
@@ -2751,7 +2751,7 @@ PluginPanel::PluginPanel(PluginListPanel *parent, wxWindowID id, const wxPoint &
     SetSizer(itemBoxSizer01);
     Connect(wxEVT_LEFT_DOWN, wxMouseEventHandler(PluginPanel::OnPluginSelected), NULL, this);
 
-    wxStaticBitmap *itemStaticBitmap = new wxStaticBitmap( this, wxID_ANY, m_pPlugin->m_bitmap->ConvertToImage().Copy());
+    wxStaticBitmap *itemStaticBitmap = new wxStaticBitmap( this, wxID_ANY, *m_pPlugin->m_bitmap);
     itemBoxSizer01->Add(itemStaticBitmap, 0, wxEXPAND|wxALL, 5);
     itemStaticBitmap->Connect(wxEVT_LEFT_DOWN, wxMouseEventHandler( PluginPanel::OnPluginSelected ), NULL, this);
     wxBoxSizer* itemBoxSizer02 = new wxBoxSizer(wxVERTICAL);
OpenCPN started up with no problems. Panning is much faster now. The only problem seen so far is that the compass window is no longer moveable.

Chuck
__________________
ChuckSK is offline   Reply With Quote
Old 09-01-2014, 17:32   #7
Registered User
 
rgleason's Avatar

Join Date: Mar 2012
Location: Boston, MA
Boat: 1981 Bristol 32 Sloop
Posts: 9,369
Re: optimized opencpn: testers needed

From: https://github.com/seandepagnier/Ope...6622cf96c02a17

Sean's notes:

Optimizations for OpenCPN Implemented
optimize fbo caching by adding more overlay objects which are on the cached texture, which rarely update and move with the chart. optimize ownship drawing optimize chart bounding box logic use textures for waypoint rendering and eliminate a few glitches. remove glDrawPixels calls (these are very inefficient) improve speed of s52plib text rendering by using texture based fonts improve smooth zooming/panning/rotation integration and remove use of timers, and improve the use of keyboard input add keyboard control of viewport rotation to make setting configurations such as: south/up. route/up, wind/up possible. fix a few initial issues with rotation... rotated viewports are still not well tested in opencpn, more bugs are likely, but it seems to work well now allow hiding compass window eliminate events generated in the frame timer which consume extra cpu at little advantage. delay loading of disabled plugins to improve startup speed consolidate optimize and improve clipping regions eliminate builtin projection code in gshhs and use our projection to allow the world map, on any projection (eventually many projections possible), and also more efficiently support panning by using bounding boxes on the subregions of the world map. use std::string instead of wxString in nmea parsing to avoid slow character type conversions notify plugins of cursor lat/lon change when map pans These optimizations are mainly targeted at opengl, and slow processors. but in some cases, the changes should give noticable improvements in many cases.

Future plans are commented in glChartCanvas.cpp

TO DO list
bugs:
vector chart display lists, build fonts for all text, with optional display list for strings, review patch

oversized fbo -- to allow quick panning, zooming and rotation without lag or delay because it only queues commands for worker thread(s) to upload the texture or to render to the fbo so there is no blocking or data manipulation in the render code, and high frame rate is guaranteed.

If the user zooms or rotates, the fbo _eventually_ must be updated to keep
the text level and avoid distortions, but in the mean time we can take the last fbo and simply rotate, scale and pan it as needed to extrapolate the desired view. In the background thread, the fbo is rendered to a viewpoint "most" likely where we will be when it is completed. eventually with alpha blending, we may combine two or more fbo views for better interpolated imagery.

If the user pans, the fbo may _never_ update as long as they don't stray too far, but if they do, then the update will have much wider rectangles and not occur very often. This is much more efficient than the current way which has skinny rects to update each frame.

If the user pans or zooms out too fast (overshooting edge of fbo) then we can render black or possibly some tessellation or message to make this obvious.
textures will "arrive" into place, and when they do, they can set a dirty rectangle in the fbo, and update it. In any case, this is unlikely unless there is extreme slowness loading the image.

The bounding box to test if we should upload a texture can also be expanded to give a similar effect with and without the fbo.

The textures are in a priority queue based on their distance from the center of
the screen and possibly scale factor difference from current. Can also factor
in rate of change of center of screen and scale factor as derivative terms
(so we prioritize texture loads off center, in the direction we are panning)
using past measurements of the time it takes to upload a texture cell.

move ais to plugin, and optimize opengl rendering move console canvas to a plugin and optimize opengl rendering anchor watch and other watchdogs merge into watchdog plugin?

longer term-
multi projection mode to allow better navigation especially for high latitudes
with polar and spherical projections
this also corrects the whole transverse mercator problem since we can
"remap" the chart into simple meractor, or any other projection which
corrects the image to make all the charts the same projection.

In immediate mode from a grid of points and texture coordinates.

Eventually glsl fragment shaders real-time raytrace raster charts as
needed to give any projection with per pixel accuracy (no polygons)
and also offloadthe trig for converting coordinates to and from mercator
the gpu which speeds up the software.

floating overlay objects to a framebuffer object so that they do not update very often with dirty rectangles for things like scale-bar, emboss, overlay images, compass, toolbar chart. selection window, status bar.. can all be rendered this etc..

This fbo can be blended in a single operation if it does not need to update that frame for more efficient rendering.

plugin routines to allow plugins to take advantage of the acceleration in the
fbo from grounded and floating overlay objects.

opencpn made to work with egl and opengles to allow running opencpn
without x11 and using the most efficient hardware acceleration for arm processors.
__________________
rgleason is offline   Reply With Quote
Old 09-01-2014, 17:41   #8
Registered User

Join Date: Jun 2008
Posts: 105
Re: optimized opencpn: testers needed

I would be happy to play with this on my Raspberry pi, but I am far from a linux guru. Is there a recipe somewhere as to how to install it in a seperate instance on my pi?

Thanks,
Guy
:-)
__________________
Aikiguy is offline   Reply With Quote
Old 09-01-2014, 17:44   #9
Registered User

Join Date: Jun 2008
Posts: 105
Re: optimized opencpn: testers needed

OK I guess remedial recipe, because I can't find it even in the link...

Thanks,
Guy
:-)
__________________
Aikiguy is offline   Reply With Quote
Old 09-01-2014, 17:53   #10
Marine Service Provider
 
bdbcat's Avatar

Join Date: Mar 2008
Posts: 4,883
Re: optimized opencpn: testers needed

Sean....

Wow! An ambitious undertaking, for which I am very grateful. There is no substitute for a tightly focused, fresh look at very old-fashioned code in light of newer hardware and software APIs.

I encourage all who can build from source to git and try this fork, report faults to Sean, and shape it up for a merge into the mainstream as soon as it is ready. Makes a good target for the next Release, planned for the spring.

I'm especially excited by the proposed rework of the fbo logic, for those systems that support fbo. Also opengles, for the future. OpenGL classic is getting pretty long in the tooth....

Thanks again
Dave
__________________
bdbcat is offline   Reply With Quote
Old 09-01-2014, 18:01   #11
Registered User

Join Date: Jun 2008
Posts: 105
Re: optimized opencpn: testers needed

Ok now I really want to try it...

especially after the glowing bdbcat review.

I am good at writing up bugs and bug reports.. Just not at figuring out how to compile and install it...

GUy
:-)
__________________
Aikiguy is offline   Reply With Quote
Old 09-01-2014, 18:21   #12
Registered User

Join Date: Dec 2013
Posts: 22
Re: optimized opencpn: testers needed

raspberry debian:

As root:
apt-get update
apt-get install -y libgtk2.0-dev gettext git-core cmake gpsd gpsd-clients \
libgps-dev build-essential wx-common libwxgtk2.8-dev \
libglu1-mesa-dev libgtk2.0-dev wx2.8-headers \
libbz2-dev libtinyxml-dev libsdl1.2debian xcalib

git clone https://github.com/seandepagnier/OpenCPN.git
cd OpenCPN/
mkdir build
build
cmake ../
make;make install
__________________
curl is offline   Reply With Quote
Old 09-01-2014, 18:43   #13
Registered User

Join Date: Jun 2008
Posts: 105
Re: optimized opencpn: testers needed

curl you rock!
Trying it now.. Question, do I have to have a git hub user name and password to make this work?
Thanks,
Guy
:-)
__________________
Aikiguy is offline   Reply With Quote
Old 09-01-2014, 23:52   #14
Registered User

Join Date: Jun 2008
Posts: 105
Re: optimized opencpn: testers needed

OK I have it running. But I can't get OPENGL to work on the raspberry pi. I just get a grey block instead of the chart.

Notes so Far: It installed and worked once I figured out curls directions..

1> It is measurably faster in both Vector and Raster charts in panning and making a route. Just about usable range. (It was just under it before this more efficient code).

Anything specific you want me to test?

Thanks,
Guy
:-)
__________________
Aikiguy is offline   Reply With Quote
Old 10-01-2014, 02:39   #15
bcn
Registered User

Join Date: May 2011
Location: underway whenever possible
Boat: Rangeboat 39
Posts: 2,758
Re: Optimized Opencpn: Testers Needed

Sean,

what about multiple viewports? With individual settings?

This is done right now running portable versions in parallel.
Not so elegant and more resource hungry.

Just an idea...

Hubert
__________________

__________________
bcn is offline   Reply With Quote
Reply

Tags
opencpn, enc

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




Copyright 2002- Social Knowledge, LLC All Rights Reserved.

All times are GMT -7. The time now is 19:57.


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.