OpenGL and Workbench Canvas News

Recently, a bug that caused excessive memory usage and slowness (specially in large models) in Workbench has been fixed in its canvas. From the testing I’ve done, the speed for displaying diagrams seems to scale much better and dragging around tables in large models is doable in an acceptable speed. This fix is in the upcoming releases of the 5.0 and 5.1 alpha versions of Workbench.

Apart from that, we’ve been doing some work on reintroducing OpenGL support to the Workbench canvas. Unlike the initial implementation, this time OpenGL is used directly instead of going through Cairo’s experimental (and not quite reliable) support through the Glitz layer. This means that in machines with a recent graphics card, hardware acceleration will be used and working with large diagrams will be a lot smoother and faster. Of course, software rendering backends (GDI+, Quartz and Xlib) will still be supported and used in case OpenGL is not the best option.

We still use Cairo to render everything (or most things) as before, but now the pre-rendered object bitmaps are uploaded to the video card and displayed through textures. Although the “software” rendering we were using was also hardware accelerated in most cases (because GDI+ et al are implemented with acceleration by the OS), using OpenGL textures seems much faster than blitting these bitmaps to screen in the old way. Naturally, this also opens the door for some totally useless and cool eye candy 🙂 But that’s for after we get the essentials done…

There are still problems to be worked out (some of the transparencies are not working well and there are some refreshing glitches), but you can try it with the --force-opengl-render option.

On the Workbench Canvas Performance

Some people might have noticed that Workbench runs very slowly and flickers a lot in their machines. Other people will be able to work without noticing any significant sluggishness with the diagram graphics. The difference is because Workbench’s custom canvas may use hardware accelerated OpenGL graphics or non-accelerated software rendering, depending on the system (ie, whether or not a 3D accelerated graphics card is available or not). We were expecting that the most reasonably recent machines (maybe 5 years old or less) would have at least some basic graphics acceleration, but for some reason, that seems to not always be the case. Apparently, some people that have decent systems with ATI or Intel cards seem to get the fallback software rendered canvas, which will result in sluggish graphics.

We are still not sure why Cairo/Glitz (the underlying graphics library used by our drawing canvas) is not working as intended for everyone, but we are working on getting this performance problem solved in at least two fronts:

  • one is to add support for the Windows GDI backend of Cairo, which seems to be faster than the software based OpenGL rendering provided by Mesa. We already use that for Windows printing, so we get that for almost free;
  • another thing that’s being worked on is general drawing optimization, so that the number of redundant drawing operations is minimized. Those changes should make Workbench work much faster and smoother for everyone, as we intended to have from the beginning.

So expect future versions to have an improved canvas and Workbench will be much faster when you work on larger models.