Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBrecht Van Lommel <brechtvanlommel@gmail.com>2019-05-07 17:51:33 +0300
committerBrecht Van Lommel <brechtvanlommel@gmail.com>2019-05-07 18:26:27 +0300
commit109ef278cc294b9f4068a7fc0fb65fada54012b6 (patch)
tree4a091fa76766380ee05fb378da44da9b64ad68fa /intern/cycles/render/colorspace.cpp
parent0d29a4fa7a87a81d6a1cef17b5f4e81a41beca7c (diff)
Fix deadlock in recent Cycles colorspace changes
This code is not used yet so didn't affect anyone.
Diffstat (limited to 'intern/cycles/render/colorspace.cpp')
-rw-r--r--intern/cycles/render/colorspace.cpp9
1 files changed, 5 insertions, 4 deletions
diff --git a/intern/cycles/render/colorspace.cpp b/intern/cycles/render/colorspace.cpp
index 265a0d90b2a..cdce1f70188 100644
--- a/intern/cycles/render/colorspace.cpp
+++ b/intern/cycles/render/colorspace.cpp
@@ -38,7 +38,8 @@ ustring u_colorspace_srgb("__builtin_srgb");
/* Cached data. */
#ifdef WITH_OCIO
-static thread_mutex cache_mutex;
+static thread_mutex cache_colorspaces_mutex;
+static thread_mutex cache_processors_mutex;
static unordered_map<ustring, ustring, ustringHash> cached_colorspaces;
static unordered_map<ustring, OCIO::ConstProcessorRcPtr, ustringHash> cached_processors;
#endif
@@ -60,7 +61,7 @@ ColorSpaceProcessor *ColorSpaceManager::get_processor(ustring colorspace)
/* Cache processor until free_memory(), memory overhead is expected to be
* small and the processor is likely to be reused. */
- thread_scoped_lock cache_lock(cache_mutex);
+ thread_scoped_lock cache_processors_lock(cache_processors_mutex);
if (cached_processors.find(colorspace) == cached_processors.end()) {
try {
cached_processors[colorspace] = config->getProcessor(colorspace.c_str(), "scene_linear");
@@ -106,7 +107,7 @@ ustring ColorSpaceManager::detect_known_colorspace(ustring colorspace,
/* Use OpenColorIO. */
#ifdef WITH_OCIO
{
- thread_scoped_lock cache_lock(cache_mutex);
+ thread_scoped_lock cache_lock(cache_colorspaces_mutex);
/* Cached lookup. */
if (cached_colorspaces.find(colorspace) != cached_colorspaces.end()) {
return cached_colorspaces[colorspace];
@@ -117,7 +118,7 @@ ustring ColorSpaceManager::detect_known_colorspace(ustring colorspace,
bool is_scene_linear, is_srgb;
is_builtin_colorspace(colorspace, is_scene_linear, is_srgb);
- thread_scoped_lock cache_lock(cache_mutex);
+ thread_scoped_lock cache_lock(cache_colorspaces_mutex);
if (is_scene_linear) {
VLOG(1) << "Colorspace " << colorspace.string() << " is no-op";
cached_colorspaces[colorspace] = u_colorspace_raw;