Sometimes during a lengthy render, you want to specifically see how a particular part of the image is turning out. Currently you have to wait for the tile rendering sequence to work its way out from the centre until it gets to the location of interest. With this patch you can simply click to quickly move the tiling sequence to another point. All the tiles still get rendered, of course, just in a different, user-selectable order.
Overview: previously the threaded_tile_processor routine (pipeline.c) would queue up all the tiles in the workqueue before starting the render threads. Now it queues up just a minimum of tiles to try to ensure the queue will not prematurely empty, and the rest get added one by one as each previously-queued tile completes. This way it can respond to mouse clicks which alter the priority for choosing subsequent unprocessed tiles.
I had to make a couple of API changes to get this to work: add a new routine RE_SetPreferTile to RE_pipeline.h/pipeline.c, and change internal routine wm_job_find (in wm_jobs.c) to exported routine WM_job_find. Also I had to use a more roundabout way than I would like to find the image display region in screen_render_modal, because the obvious CTX_wm_region call kept returning NULL (at least most of the time).
If there is a cleaner way of doing what I’m doing here, please advise, and I will resubmit.
This currently only works for Blender Internal; if all goes well, I might look at how to do it for Cycles. :)