[Qgis-developer] QGIS Multi-threaded Rendering

Tim Sutton lists at linfiniti.com
Fri Dec 13 02:30:56 PST 2013


On Thu, Dec 12, 2013 at 5:50 PM, Martin Dobias <wonder.sk at gmail.com> wrote:

> Hi Tim!
> > That all sounds absolutely brilliant! Thanks for such a nice clear
> > description of how it all fits together. I know you are only considering
> > layer-by-layer rendering but does your design accommodate further future
> > optimisations easily? I'm thinking of things like:
> >
> > * predictive / off screen  rendering of 3x3 canvas dimensions after the
> > initial render so that any pan is near instantaneous (and would trigger a
> > new off-screen render)
> I have had this idea in my mind while working on the project. In
> theory map canvas can spawn several renderer jobs (instead of just
> one) and let them render just one tile of the map. Some special
> handling of the labeling would be necessary if we wanted labels that
> are allowed to cross the border of tiles.
> Yeah - Larry and I had chatted before about using the AOI extents as a
fake line feature with a 'may not be covered' rule in labelling - same for
map viewframe when printing. I don't know if that is still on his agenda
but it would be very nice to have.

> > * on zoom, resample first then over render the resampled image (like open
> > layers and other web toolkits do so you see a resampled version of the
> old
> > render which gets overpainted as the new render comes in)
> Actually that's already there :-)
> When you change the extent, the old map will be still present, just
> scaled. It will be there until the first update of the preview (now
> the default is set to 250ms). So, first quarter of the second you will
> be looking at the older resampled map (of course if your new map is
> rendered under 250ms, it will be shown as soon as it is done).
> Cool. And if you have the 3x3 AOI buffer you could resample the whole
thing when zooming out and the user would have something quite pleasant to
look at while waiting for a redraw.

> > * symbol layer render in threads - I believe even single layer draws can
> > benefit greatly from the render-then-composite approach you are taking -
> > rendering each feature into a buffer when symbol layers are enabled (and
> > then compositing the buffers after rendering them) means that no feature
> > should need to be retrieved more than once when rendering.
> This could be quite interesting thing to do. I guess the vector layer
> renderer class could actually spawn further rendering tasks for each
> symbol level after initial load of features and their division into
> groups based on their symbol.
> > * render caching of symbol layers (so that if only one layer gets changed
> > not all others need to be re-rendered)
> So you mean render caching not only the whole map layers, but also
> levels within layers? I am not sure how big the benefit of introducing
> that would be - if the added code complexity wouldn't outweigh the
> benefit of optimizing such case (i.e. how much of user's total time in
> QGIS does he/she spend waiting for update after a change to a symbol
> layer?)
Yeah this admittedly the weakest of the ideas I listed :-)

>  > * progressive rendering (e.g. rendering in a generalised way ala A
> Huarte's
> > patches and then update the display and the start a second pass render
> with
> > full detail) - that way you get a very fast first render but if you stick
> > around at that AOI the render quality improves as the second pass happens
> I haven't really thought about that so far. We would probably need to
> employ some guessing to know when does it make sense to actually do
> the progressive rendering and when to render just once...
> This 'progressive' thing reminds me of another thing worth trying: by
> default we could try to cache all reasonably sized vector datasets
> upon their load into memory. Then we would render the layers without
> actually querying the backend. When the rendering is done, we could
> then optionally run the query on backend to check whether our cache
> needs updating.

Yeah that would be awesome.

> Also, it may be interesting to build some temporary overviews for
> raster layers (if not present) and do the progressive rendering there
> - first a low quality render from the overview, then a real rendered
> image.
Yeah that also sounds good!

Thanks again for making all this threading stuff happen!



> > I know there are possible issues with memory consumption with some of the
> > above ideas,  and they are definitely not on your current roadmap, but it
> > would be good to at least play a little mental soccer with the above
> ideas
> > and see if the architecture you have devised can accommodate such further
> > optimisations cleanly in the future.
> Sure, it is always good to think ahead about possible improvements!
> Cheers
> Martin

Tim Sutton - QGIS Project Steering Committee Member
Please do not email me off-list with technical
support questions. Using the lists will gain
more exposure for your issues and the knowledge
surrounding your issue will be shared with all.

Irc: timlinux on #qgis at freenode.net
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/qgis-developer/attachments/20131213/3ffd710f/attachment.html>

More information about the Qgis-developer mailing list