[Bf-blender-cvs] [109ef278cc2] master: Fix deadlock in recent Cycles colorspace changes
Brecht Van Lommel
noreply at git.blender.org
Tue May 7 17:26:34 CEST 2019
Commit: 109ef278cc294b9f4068a7fc0fb65fada54012b6
Author: Brecht Van Lommel
Date: Tue May 7 16:51:33 2019 +0200
Branches: master
https://developer.blender.org/rB109ef278cc294b9f4068a7fc0fb65fada54012b6
Fix deadlock in recent Cycles colorspace changes
This code is not used yet so didn't affect anyone.
===================================================================
M intern/cycles/render/colorspace.cpp
===================================================================
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;
More information about the Bf-blender-cvs
mailing list