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
path: root/intern
diff options
context:
space:
mode:
authorLukas Toenne <lukas.toenne@googlemail.com>2012-09-17 16:07:06 +0400
committerLukas Toenne <lukas.toenne@googlemail.com>2012-09-17 16:07:06 +0400
commitefaf512406c71606d7f05eca10c74510bd9ebc12 (patch)
treed42a01041ba165f13ad1b3c42bc118bd3c82b0c3 /intern
parentaecb2f7039f0af91bd1eb03a64957bcd532c9408 (diff)
Revert r50528: "Performance fix for Cycles: Don't wait in the main UI thread when resetting devices."
This commit leads to random freezes in Cycles rendering: https://projects.blender.org/tracker/index.php?func=detail&aid=32545&group_id=9&atid=498 The goal of this commit was to remove UI lag for OSL, but since that is not officially supported yet, better revert it until a proper fix can be implemented in 2.65.
Diffstat (limited to 'intern')
-rw-r--r--intern/cycles/blender/blender_session.cpp6
-rw-r--r--intern/cycles/device/device.h1
-rw-r--r--intern/cycles/device/device_cpu.cpp5
-rw-r--r--intern/cycles/device/device_cuda.cpp5
-rw-r--r--intern/cycles/device/device_multi.cpp8
-rw-r--r--intern/cycles/device/device_opencl.cpp5
-rw-r--r--intern/cycles/render/session.cpp19
-rw-r--r--intern/cycles/render/session.h3
-rw-r--r--intern/cycles/util/util_task.cpp33
9 files changed, 16 insertions, 69 deletions
diff --git a/intern/cycles/blender/blender_session.cpp b/intern/cycles/blender/blender_session.cpp
index 5930a2800bf..7b80c520e72 100644
--- a/intern/cycles/blender/blender_session.cpp
+++ b/intern/cycles/blender/blender_session.cpp
@@ -372,12 +372,6 @@ void BlenderSession::synchronize()
return;
}
- /* if the session is still resetting the device come back later */
- if(session->resetting()) {
- tag_update();
- return;
- }
-
/* increase samples, but never decrease */
session->set_samples(session_params.samples);
session->set_pause(BlenderSync::get_session_pause(b_scene, background));
diff --git a/intern/cycles/device/device.h b/intern/cycles/device/device.h
index 8e3bc408399..2ee2e044618 100644
--- a/intern/cycles/device/device.h
+++ b/intern/cycles/device/device.h
@@ -115,7 +115,6 @@ public:
virtual void task_add(DeviceTask& task) = 0;
virtual void task_wait() = 0;
virtual void task_cancel() = 0;
- virtual bool task_cancelled() = 0;
/* opengl drawing */
virtual void draw_pixels(device_memory& mem, int y, int w, int h,
diff --git a/intern/cycles/device/device_cpu.cpp b/intern/cycles/device/device_cpu.cpp
index e2f612ee233..4c54671b0d0 100644
--- a/intern/cycles/device/device_cpu.cpp
+++ b/intern/cycles/device/device_cpu.cpp
@@ -273,11 +273,6 @@ public:
{
task_pool.cancel();
}
-
- bool task_cancelled()
- {
- return task_pool.cancelled();
- }
};
Device *device_cpu_create(DeviceInfo& info, int threads)
diff --git a/intern/cycles/device/device_cuda.cpp b/intern/cycles/device/device_cuda.cpp
index acc1086cc35..c8dcfdc2f3d 100644
--- a/intern/cycles/device/device_cuda.cpp
+++ b/intern/cycles/device/device_cuda.cpp
@@ -892,11 +892,6 @@ public:
{
task_pool.cancel();
}
-
- bool task_cancelled()
- {
- return task_pool.cancelled();
- }
};
Device *device_cuda_create(DeviceInfo& info, bool background)
diff --git a/intern/cycles/device/device_multi.cpp b/intern/cycles/device/device_multi.cpp
index 4923e5c9e66..546ffe5e4b9 100644
--- a/intern/cycles/device/device_multi.cpp
+++ b/intern/cycles/device/device_multi.cpp
@@ -312,14 +312,6 @@ public:
foreach(SubDevice& sub, devices)
sub.device->task_cancel();
}
-
- bool task_cancelled()
- {
- foreach(SubDevice& sub, devices)
- if (sub.device->task_cancelled())
- return true;
- return false;
- }
};
Device *device_multi_create(DeviceInfo& info, bool background)
diff --git a/intern/cycles/device/device_opencl.cpp b/intern/cycles/device/device_opencl.cpp
index ed7229d49da..673ffdf79fd 100644
--- a/intern/cycles/device/device_opencl.cpp
+++ b/intern/cycles/device/device_opencl.cpp
@@ -724,11 +724,6 @@ public:
{
task_pool.cancel();
}
-
- bool task_cancelled()
- {
- return task_pool.cancelled();
- }
};
Device *device_opencl_create(DeviceInfo& info, bool background)
diff --git a/intern/cycles/render/session.cpp b/intern/cycles/render/session.cpp
index b190cdfec96..cd410e4e011 100644
--- a/intern/cycles/render/session.cpp
+++ b/intern/cycles/render/session.cpp
@@ -140,12 +140,6 @@ void Session::reset_gpu(BufferParams& buffer_params, int samples)
pause_cond.notify_all();
}
-bool Session::resetting_gpu() const
-{
- /* no need to wait for gpu device */
- return false;
-}
-
bool Session::draw_gpu(BufferParams& buffer_params)
{
/* block for buffer access */
@@ -296,11 +290,6 @@ void Session::reset_cpu(BufferParams& buffer_params, int samples)
pause_cond.notify_all();
}
-bool Session::resetting_cpu() const
-{
- return device->task_cancelled();
-}
-
bool Session::draw_cpu(BufferParams& buffer_params)
{
thread_scoped_lock display_lock(display_mutex);
@@ -595,14 +584,6 @@ void Session::reset(BufferParams& buffer_params, int samples)
reset_cpu(buffer_params, samples);
}
-bool Session::resetting() const
-{
- if(device_use_gl)
- return resetting_gpu();
- else
- return resetting_cpu();
-}
-
void Session::set_samples(int samples)
{
if(samples != params.samples) {
diff --git a/intern/cycles/render/session.h b/intern/cycles/render/session.h
index a3a2751fb23..eda8b3da60e 100644
--- a/intern/cycles/render/session.h
+++ b/intern/cycles/render/session.h
@@ -116,7 +116,6 @@ public:
bool ready_to_reset();
void reset(BufferParams& params, int samples);
- bool resetting() const;
void set_samples(int samples);
void set_pause(bool pause);
@@ -140,12 +139,10 @@ protected:
void run_cpu();
bool draw_cpu(BufferParams& params);
void reset_cpu(BufferParams& params, int samples);
- bool resetting_cpu() const;
void run_gpu();
bool draw_gpu(BufferParams& params);
void reset_gpu(BufferParams& params, int samples);
- bool resetting_gpu() const;
bool acquire_tile(Device *tile_device, RenderTile& tile);
void update_tile_sample(RenderTile& tile);
diff --git a/intern/cycles/util/util_task.cpp b/intern/cycles/util/util_task.cpp
index 2b209c135f4..ea0abd6f54f 100644
--- a/intern/cycles/util/util_task.cpp
+++ b/intern/cycles/util/util_task.cpp
@@ -38,8 +38,6 @@ TaskPool::~TaskPool()
void TaskPool::push(Task *task, bool front)
{
- thread_scoped_lock num_lock(num_mutex);
-
TaskScheduler::Entry entry;
entry.task = task;
@@ -104,17 +102,22 @@ void TaskPool::wait_work()
void TaskPool::cancel()
{
- thread_scoped_lock num_lock(num_mutex);
-
do_cancel = true;
TaskScheduler::clear(this);
+
+ {
+ thread_scoped_lock num_lock(num_mutex);
+
+ while(num)
+ num_cond.wait(num_lock);
+ }
+
+ do_cancel = false;
}
void TaskPool::stop()
{
- thread_scoped_lock num_lock(num_mutex);
-
TaskScheduler::clear(this);
assert(num == 0);
@@ -127,20 +130,20 @@ bool TaskPool::cancelled()
void TaskPool::num_decrease(int done)
{
+ num_mutex.lock();
num -= done;
+
assert(num >= 0);
-
- if(num == 0) {
- do_cancel = false;
-
+ if(num == 0)
num_cond.notify_all();
- }
+
+ num_mutex.unlock();
}
void TaskPool::num_increase()
{
+ thread_scoped_lock num_lock(num_mutex);
num++;
-
num_cond.notify_all();
}
@@ -236,11 +239,7 @@ void TaskScheduler::thread_run(int thread_id)
delete entry.task;
/* notify pool task was done */
- {
- /* not called from TaskPool, have to explicitly lock the mutex here */
- thread_scoped_lock num_lock(entry.pool->num_mutex);
- entry.pool->num_decrease(1);
- }
+ entry.pool->num_decrease(1);
}
}