blender/intern/cycles/util
Lukas Toenne 31ed71cb6b Performance fix for Cycles: Don't wait in the main UI thread when resetting devices.
When the scene is updated Cycles resets the renderer device, cancelling
all existing tasks. The main thread would wait for all running tasks to
finish before continuing. This is ok when tasks can actually cancel in a
timely fashion. For OSL however, this does not work, since the OSL
shader group optimization takes quite a bit of time and can not be
easily be cancelled once running (on my crappy machine in full debug
mode: ~0.12 seconds for simple node trees). This would lead to very
laggy UI behavior and make it difficult to accurately control elements
such as sliders.

This patch removes the wait condition from the device->task_cancel
method. Instead it just sets the do_cancel flag and returns. To avoid
backlog in the task pool of the device it will return early from the
BlenderSession::sync function while the reset is going on (tested in
Session::resetting). Once all existing tasks have finished the do_cancel
flag is finally cleared again (checked in TaskPool::num_decrease).

Care has to be taken to avoid race conditions on the do_cancel flag,
since it can now be modified outside the TaskPool::cancel function
itself. For this purpose the scope of the TaskPool::num_mutex locks has
been extended, in most cases the mutex is now locked by the TaskPool
itself before calling TaskScheduler methods, instead of only locking
inside the num_increase/num_decrease functions themselves. The only
occurrence of a lock outside of the TaskPool methods is in
TaskScheduler::thread_run.

This patch is most useful in combination with the OSL renderer mode, so
it can probably wait until after the 2.64 release. SVM tasks tend to be
cancelled quickly, so the effect is less noticeable.
2012-09-11 11:41:51 +00:00
..
CMakeLists.txt Fix for Cycles (CUDA) compilation (again ...). Moved the AttributeStandard enum typedef and the attribute_standard_name mapping function to util_attribute/util_types headers, so they can properly be used by kernel and render files alike. This should avoid any std C includes which are not available in CUDA. Thanks to Sergey for help! 2012-09-07 11:06:45 +00:00
util_algorithm.h Cycles render engine, initial commit. This is the engine itself, blender modifications and build instructions will follow later. 2011-04-27 11:58:34 +00:00
util_args.h Cycles render engine, initial commit. This is the engine itself, blender modifications and build instructions will follow later. 2011-04-27 11:58:34 +00:00
util_attribute.cpp Fix for Cycles (CUDA) compilation (again ...). Moved the AttributeStandard enum typedef and the attribute_standard_name mapping function to util_attribute/util_types headers, so they can properly be used by kernel and render files alike. This should avoid any std C includes which are not available in CUDA. Thanks to Sergey for help! 2012-09-07 11:06:45 +00:00
util_attribute.h Fix for Cycles (CUDA) compilation (again ...). Moved the AttributeStandard enum typedef and the attribute_standard_name mapping function to util_attribute/util_types headers, so they can properly be used by kernel and render files alike. This should avoid any std C includes which are not available in CUDA. Thanks to Sergey for help! 2012-09-07 11:06:45 +00:00
util_boundbox.h Fix visual studio debug build issue with BVH boundbox, pointed out by Agustin Benavidez. 2012-04-30 10:00:55 +00:00
util_cache.cpp Additional fix #32074, by Sven-Hendrik Haase (svenstaro). Boost version header must be included in cycles in order to expand the version check macro. 2012-07-29 13:52:38 +00:00
util_cache.h Cycles: add option to cache BVH's between subsequent renders, storing the BVH on 2012-01-16 13:13:37 +00:00
util_color.h code cleanup: quiet all warnings about double promotion (either by changing the type or explicitly casting). 2012-06-09 17:45:22 +00:00
util_cuda.cpp style cleanup: block comments 2012-06-09 17:22:52 +00:00
util_cuda.h style cleanup: assignment & indentation. 2012-06-09 18:56:12 +00:00
util_debug.h Cycles render engine, initial commit. This is the engine itself, blender modifications and build instructions will follow later. 2011-04-27 11:58:34 +00:00
util_dynlib.cpp Cycles render engine, initial commit. This is the engine itself, blender modifications and build instructions will follow later. 2011-04-27 11:58:34 +00:00
util_dynlib.h Cycles render engine, initial commit. This is the engine itself, blender modifications and build instructions will follow later. 2011-04-27 11:58:34 +00:00
util_foreach.h Cycles render engine, initial commit. This is the engine itself, blender modifications and build instructions will follow later. 2011-04-27 11:58:34 +00:00
util_function.h Cycles render engine, initial commit. This is the engine itself, blender modifications and build instructions will follow later. 2011-04-27 11:58:34 +00:00
util_hash.h style cleanup: assignment & indentation. 2012-06-09 18:56:12 +00:00
util_image.h Cycles render engine, initial commit. This is the engine itself, blender modifications and build instructions will follow later. 2011-04-27 11:58:34 +00:00
util_list.h Cycles render engine, initial commit. This is the engine itself, blender modifications and build instructions will follow later. 2011-04-27 11:58:34 +00:00
util_map.h Cycles: first batch of windows build fixes, not quite there yet. 2011-05-03 18:29:11 +00:00
util_math.h Cycles: merge of changes from tomato branch. 2012-09-04 13:29:07 +00:00
util_md5.cpp style cleanup: assignment & indentation. 2012-06-09 18:56:12 +00:00
util_md5.h style cleanup: assignment & indentation. 2012-06-09 18:56:12 +00:00
util_memarena.cpp Cycles: remove deprecated strict aliasing flag for opencl, fix missing update 2011-09-19 11:57:31 +00:00
util_memarena.h Cycles: remove deprecated strict aliasing flag for opencl, fix missing update 2011-09-19 11:57:31 +00:00
util_opencl.cpp style cleanup: assignment & indentation. 2012-06-09 18:56:12 +00:00
util_opencl.h style cleanup: assignment & indentation. 2012-06-09 18:56:12 +00:00
util_opengl.h Cycles: build without GLUT test app by default. 2011-05-01 10:00:21 +00:00
util_param.h Cycles render engine, initial commit. This is the engine itself, blender modifications and build instructions will follow later. 2011-04-27 11:58:34 +00:00
util_path.cpp Additional fix #32074, by Sven-Hendrik Haase (svenstaro). Boost version header must be included in cycles in order to expand the version check macro. 2012-07-29 13:52:38 +00:00
util_path.h Fix #29274: problem compiling cycles opencl kernel from directory with spaces. 2011-11-22 16:38:58 +00:00
util_progress.h Cycles: merge of changes from tomato branch. 2012-09-04 13:29:07 +00:00
util_set.h Cycles: first batch of windows build fixes, not quite there yet. 2011-05-03 18:29:11 +00:00
util_string.cpp Cycles: compile opencl kernels in non-blocking thread, and don't crash on 2011-09-02 00:10:03 +00:00
util_string.h Cycles: compile opencl kernels in non-blocking thread, and don't crash on 2011-09-02 00:10:03 +00:00
util_system.cpp style cleanup: block comments 2012-06-09 17:22:52 +00:00
util_system.h Fix #29259: cycles issues on certain processors. Now two versions of the kernel 2011-11-15 15:13:38 +00:00
util_task.cpp Performance fix for Cycles: Don't wait in the main UI thread when resetting devices. 2012-09-11 11:41:51 +00:00
util_task.h Cycles: reviewed the task scheduler code and fixed (hopefully all) windows threading problems. 2012-05-10 22:31:16 +00:00
util_thread.h style cleanup: block comments 2012-06-09 17:22:52 +00:00
util_time.cpp Cycles render engine, initial commit. This is the engine itself, blender modifications and build instructions will follow later. 2011-04-27 11:58:34 +00:00
util_time.h Cycles render engine, initial commit. This is the engine itself, blender modifications and build instructions will follow later. 2011-04-27 11:58:34 +00:00
util_transform.cpp code cleanup: quiet all warnings about double promotion (either by changing the type or explicitly casting). 2012-06-09 17:45:22 +00:00
util_transform.h style cleanup: block comments 2012-06-09 17:22:52 +00:00
util_types.h Fix for Cycles (CUDA) compilation (again ...). Moved the AttributeStandard enum typedef and the attribute_standard_name mapping function to util_attribute/util_types headers, so they can properly be used by kernel and render files alike. This should avoid any std C includes which are not available in CUDA. Thanks to Sergey for help! 2012-09-07 11:06:45 +00:00
util_vector.h Cycles: clang build fixes. 2011-08-10 19:45:08 +00:00
util_view.cpp style cleanup: assignment & indentation. 2012-06-09 18:56:12 +00:00
util_view.h Cycles render engine, initial commit. This is the engine itself, blender modifications and build instructions will follow later. 2011-04-27 11:58:34 +00:00
util_xml.h Cycles render engine, initial commit. This is the engine itself, blender modifications and build instructions will follow later. 2011-04-27 11:58:34 +00:00