[Bf-blender-cvs] [f7c18df4f59] temp-tbb-task-scheduler: Tasks: move priority from task to task pool

Brecht Van Lommel noreply at git.blender.org
Tue Nov 5 15:10:45 CET 2019


Commit: f7c18df4f599fe39ffc914e645e504fcdbee8636
Author: Brecht Van Lommel
Date:   Sat Oct 12 17:11:36 2019 +0200
Branches: temp-tbb-task-scheduler
https://developer.blender.org/rBf7c18df4f599fe39ffc914e645e504fcdbee8636

Tasks: move priority from task to task pool

===================================================================

M	source/blender/blenkernel/intern/editmesh_tangent.c
M	source/blender/blenkernel/intern/mesh_evaluate.c
M	source/blender/blenkernel/intern/mesh_tangent.c
M	source/blender/blenkernel/intern/ocean.c
M	source/blender/blenkernel/intern/particle.c
M	source/blender/blenkernel/intern/particle_distribute.c
M	source/blender/blenlib/BLI_task.h
M	source/blender/blenlib/intern/task.c
M	source/blender/depsgraph/intern/eval/deg_eval.cc
M	source/blender/draw/intern/draw_cache_extract_mesh.c
M	source/blender/editors/mesh/editmesh_undo.c
M	source/blender/editors/render/render_opengl.c
M	source/blender/editors/sculpt_paint/paint_image_proj.c
M	source/blender/editors/space_clip/clip_editor.c
M	source/blender/editors/space_clip/clip_ops.c
M	source/blender/editors/space_file/filelist.c
M	source/blender/imbuf/intern/imageprocess.c
M	tests/gtests/blenlib/BLI_linklist_lockfree_test.cc

===================================================================

diff --git a/source/blender/blenkernel/intern/editmesh_tangent.c b/source/blender/blenkernel/intern/editmesh_tangent.c
index df2fb8c8348..377acb7882a 100644
--- a/source/blender/blenkernel/intern/editmesh_tangent.c
+++ b/source/blender/blenkernel/intern/editmesh_tangent.c
@@ -364,7 +364,7 @@ void BKE_editmesh_loop_tangent_calc(BMEditMesh *em,
     if (em->tottri != 0) {
       TaskScheduler *scheduler = BLI_task_scheduler_get();
       TaskPool *task_pool;
-      task_pool = BLI_task_pool_create(scheduler, NULL);
+      task_pool = BLI_task_pool_create(scheduler, NULL, TASK_PRIORITY_HIGH);
 
       tangent_mask_curr = 0;
       /* Calculate tangent layers */
@@ -417,8 +417,7 @@ void BKE_editmesh_loop_tangent_calc(BMEditMesh *em,
         mesh2tangent->looptris = (const BMLoop *(*)[3])em->looptris;
         mesh2tangent->tangent = loopdata_out->layers[index].data;
 
-        BLI_task_pool_push(
-            task_pool, emDM_calc_loop_tangents_thread, mesh2tangent, false, TASK_PRIORITY_LOW);
+        BLI_task_pool_push(task_pool, emDM_calc_loop_tangents_thread, mesh2tangent, false, NULL);
       }
 
       BLI_assert(tangent_mask_curr == tangent_mask);
diff --git a/source/blender/blenkernel/intern/mesh_evaluate.c b/source/blender/blenkernel/intern/mesh_evaluate.c
index 7a1dcb4a5fd..b16bcf0dbe8 100644
--- a/source/blender/blenkernel/intern/mesh_evaluate.c
+++ b/source/blender/blenkernel/intern/mesh_evaluate.c
@@ -1554,7 +1554,7 @@ static void loop_split_generator(TaskPool *pool, LoopSplitTaskDataCommon *common
         if (pool) {
           data_idx++;
           if (data_idx == LOOP_SPLIT_TASK_BLOCK_SIZE) {
-            BLI_task_pool_push(pool, loop_split_worker, data_buff, true, TASK_PRIORITY_LOW);
+            BLI_task_pool_push(pool, loop_split_worker, data_buff, true, NULL);
             data_idx = 0;
           }
         }
@@ -1571,7 +1571,7 @@ static void loop_split_generator(TaskPool *pool, LoopSplitTaskDataCommon *common
   /* Last block of data... Since it is calloc'ed and we use first NULL item as stopper,
    * everything is fine. */
   if (pool && data_idx) {
-    BLI_task_pool_push(pool, loop_split_worker, data_buff, true, TASK_PRIORITY_LOW);
+    BLI_task_pool_push(pool, loop_split_worker, data_buff, true, NULL);
   }
 
   if (edge_vectors) {
@@ -1707,7 +1707,7 @@ void BKE_mesh_normals_loop_split(const MVert *mverts,
     TaskPool *task_pool;
 
     task_scheduler = BLI_task_scheduler_get();
-    task_pool = BLI_task_pool_create(task_scheduler, &common_data);
+    task_pool = BLI_task_pool_create(task_scheduler, &common_data, TASK_PRIORITY_HIGH);
 
     loop_split_generator(task_pool, &common_data);
 
diff --git a/source/blender/blenkernel/intern/mesh_tangent.c b/source/blender/blenkernel/intern/mesh_tangent.c
index 19d94be9b6e..9e0f92377e8 100644
--- a/source/blender/blenkernel/intern/mesh_tangent.c
+++ b/source/blender/blenkernel/intern/mesh_tangent.c
@@ -660,7 +660,7 @@ void BKE_mesh_calc_loop_tangent_ex(const MVert *mvert,
     if (looptri_len != 0) {
       TaskScheduler *scheduler = BLI_task_scheduler_get();
       TaskPool *task_pool;
-      task_pool = BLI_task_pool_create(scheduler, NULL);
+      task_pool = BLI_task_pool_create(scheduler, NULL, TASK_PRIORITY_HIGH);
 
       tangent_mask_curr = 0;
       /* Calculate tangent layers */
@@ -707,8 +707,7 @@ void BKE_mesh_calc_loop_tangent_ex(const MVert *mvert,
         }
 
         mesh2tangent->tangent = loopdata_out->layers[index].data;
-        BLI_task_pool_push(
-            task_pool, DM_calc_loop_tangents_thread, mesh2tangent, false, TASK_PRIORITY_LOW);
+        BLI_task_pool_push(task_pool, DM_calc_loop_tangents_thread, mesh2tangent, false, NULL);
       }
 
       BLI_assert(tangent_mask_curr == tangent_mask);
diff --git a/source/blender/blenkernel/intern/ocean.c b/source/blender/blenkernel/intern/ocean.c
index 9faa61f986d..63bbf58481f 100644
--- a/source/blender/blenkernel/intern/ocean.c
+++ b/source/blender/blenkernel/intern/ocean.c
@@ -767,7 +767,7 @@ void BKE_ocean_simulate(struct Ocean *o, float t, float scale, float chop_amount
   osd.scale = scale;
   osd.chop_amount = chop_amount;
 
-  pool = BLI_task_pool_create(scheduler, &osd);
+  pool = BLI_task_pool_create(scheduler, &osd, TASK_PRIORITY_HIGH);
 
   BLI_rw_mutex_lock(&o->oceanmutex, THREAD_LOCK_WRITE);
 
@@ -785,23 +785,23 @@ void BKE_ocean_simulate(struct Ocean *o, float t, float scale, float chop_amount
   BLI_task_parallel_range(0, o->_M, &osd, ocean_compute_htilda, &settings);
 
   if (o->_do_disp_y) {
-    BLI_task_pool_push(pool, ocean_compute_displacement_y, NULL, false, TASK_PRIORITY_HIGH);
+    BLI_task_pool_push(pool, ocean_compute_displacement_y, NULL, false, NULL);
   }
 
   if (o->_do_chop) {
-    BLI_task_pool_push(pool, ocean_compute_displacement_x, NULL, false, TASK_PRIORITY_HIGH);
-    BLI_task_pool_push(pool, ocean_compute_displacement_z, NULL, false, TASK_PRIORITY_HIGH);
+    BLI_task_pool_push(pool, ocean_compute_displacement_x, NULL, false, NULL);
+    BLI_task_pool_push(pool, ocean_compute_displacement_z, NULL, false, NULL);
   }
 
   if (o->_do_jacobian) {
-    BLI_task_pool_push(pool, ocean_compute_jacobian_jxx, NULL, false, TASK_PRIORITY_HIGH);
-    BLI_task_pool_push(pool, ocean_compute_jacobian_jzz, NULL, false, TASK_PRIORITY_HIGH);
-    BLI_task_pool_push(pool, ocean_compute_jacobian_jxz, NULL, false, TASK_PRIORITY_HIGH);
+    BLI_task_pool_push(pool, ocean_compute_jacobian_jxx, NULL, false, NULL);
+    BLI_task_pool_push(pool, ocean_compute_jacobian_jzz, NULL, false, NULL);
+    BLI_task_pool_push(pool, ocean_compute_jacobian_jxz, NULL, false, NULL);
   }
 
   if (o->_do_normals) {
-    BLI_task_pool_push(pool, ocean_compute_normal_x, NULL, false, TASK_PRIORITY_HIGH);
-    BLI_task_pool_push(pool, ocean_compute_normal_z, NULL, false, TASK_PRIORITY_HIGH);
+    BLI_task_pool_push(pool, ocean_compute_normal_x, NULL, false, NULL);
+    BLI_task_pool_push(pool, ocean_compute_normal_z, NULL, false, NULL);
     o->_N_y = 1.0f / scale;
   }
 
diff --git a/source/blender/blenkernel/intern/particle.c b/source/blender/blenkernel/intern/particle.c
index 74fbfc318a8..e87bd5f320d 100644
--- a/source/blender/blenkernel/intern/particle.c
+++ b/source/blender/blenkernel/intern/particle.c
@@ -2775,7 +2775,7 @@ void psys_cache_child_paths(ParticleSimulationData *sim,
   }
 
   task_scheduler = BLI_task_scheduler_get();
-  task_pool = BLI_task_pool_create(task_scheduler, &ctx);
+  task_pool = BLI_task_pool_create(task_scheduler, &ctx, TASK_PRIORITY_HIGH);
   totchild = ctx.totchild;
   totparent = ctx.totparent;
 
@@ -2798,7 +2798,7 @@ void psys_cache_child_paths(ParticleSimulationData *sim,
     ParticleTask *task = &tasks_parent[i];
 
     psys_task_init_path(task, sim);
-    BLI_task_pool_push(task_pool, exec_child_path_cache, task, false, TASK_PRIORITY_LOW);
+    BLI_task_pool_push(task_pool, exec_child_path_cache, task, false, NULL);
   }
   BLI_task_pool_work_and_wait(task_pool);
 
@@ -2809,7 +2809,7 @@ void psys_cache_child_paths(ParticleSimulationData *sim,
     ParticleTask *task = &tasks_child[i];
 
     psys_task_init_path(task, sim);
-    BLI_task_pool_push(task_pool, exec_child_path_cache, task, false, TASK_PRIORITY_LOW);
+    BLI_task_pool_push(task_pool, exec_child_path_cache, task, false, NULL);
   }
   BLI_task_pool_work_and_wait(task_pool);
 
diff --git a/source/blender/blenkernel/intern/particle_distribute.c b/source/blender/blenkernel/intern/particle_distribute.c
index 1189785ce0f..493c7ddaf36 100644
--- a/source/blender/blenkernel/intern/particle_distribute.c
+++ b/source/blender/blenkernel/intern/particle_distribute.c
@@ -1337,7 +1337,7 @@ static void distribute_particles_on_dm(ParticleSimulationData *sim, int from)
   }
 
   task_scheduler = BLI_task_scheduler_get();
-  task_pool = BLI_task_pool_create(task_scheduler, &ctx);
+  task_pool = BLI_task_pool_create(task_scheduler, &ctx, TASK_PRIORITY_HIGH);
 
   totpart = (from == PART_FROM_CHILD ? sim->psys->totchild : sim->psys->totpart);
   psys_tasks_create(&ctx, 0, totpart, &tasks, &numtasks);
@@ -1346,10 +1346,10 @@ static void distribute_particles_on_dm(ParticleSimulationData *sim, int from)
 
     psys_task_init_distribute(task, sim);
     if (from == PART_FROM_CHILD) {
-      BLI_task_pool_push(task_pool, exec_distribute_child, task, false, TASK_PRIORITY_LOW);
+      BLI_task_pool_push(task_pool, exec_distribute_child, task, false, NULL);
     }
     else {
-      BLI_task_pool_push(task_pool, exec_distribute_parent, task, false, TASK_PRIORITY_LOW);
+      BLI_task_pool_push(task_pool, exec_distribute_parent, task, false, NULL);
     }
   }
   BLI_task_pool_work_and_wait(task_pool);
diff --git a/source/blender/blenlib/BLI_task.h b/source/blender/blenlib/BLI_task.h
index 7ef5e518cc8..9832bf9a0f2 100644
--- a/source/blender/blenlib/BLI_task.h
+++ b/source/blender/blenlib/BLI_task.h
@@ -79,27 +79,25 @@ typedef struct TaskPool TaskPool;
 typedef void (*TaskRunFunction)(TaskPool *__restrict pool, void *taskdata, int threadid);
 typedef void (*TaskFreeFunction)(TaskPool *__restrict pool, void *taskdata, int threadid);
 
-TaskPool *BLI_task_pool_create(TaskScheduler *scheduler, void *userdata);
-TaskPool *BLI_task_pool_create_background(TaskScheduler *scheduler, void *userdata);
-TaskPool *BLI_task_pool_create_suspended(TaskScheduler *scheduler, void *userdata);
+TaskPool *BLI_task_pool_create(TaskScheduler *scheduler, void *userdata, TaskPriority priority);
+TaskPool *BLI_task_pool_create_background(TaskScheduler *scheduler,
+                                          void *userdata,
+                                          TaskPriority priority);
+TaskPool *BLI_task_pool_create_suspended(TaskScheduler *scheduler,
+                                         void *userdata,
+                                         TaskPriority priority);
 void BLI_task_pool_free(TaskPool *pool);
 
-void BLI_task_pool_push_ex(TaskPool *pool,
-                           TaskRunFunction run,
-                           void *taskdata,
-                           bool free_taskdata,
-                           TaskFreeFunction freedata,
-                           TaskPriority priority);
 void BLI_task_pool_push(TaskPool *pool,
                  

@@ Diff output truncated at 10240 characters. @@



More information about the Bf-blender-cvs mailing list