[Bf-blender-cvs] [1cb5c28] blender-tiles: TILES: started with the Tile class. made sure that the tile class is used during scheduling and execution. For planning it is not used yet. idea is to move the class creation to the front and make sure it stays correct

Jeroen Bakker noreply at git.blender.org
Mon May 26 22:19:14 CEST 2014


Commit: 1cb5c286531add9de5b0a623e4534eda9f86e07b
Author: Jeroen Bakker
Date:   Mon May 26 22:17:08 2014 +0200
https://developer.blender.org/rB1cb5c286531add9de5b0a623e4534eda9f86e07b

TILES: started with the Tile class.
made sure that the tile class is used during scheduling and execution. For planning it is not used yet.
idea is to move the class creation to the front and make sure it stays correct

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

M	source/blender/compositor/CMakeLists.txt
M	source/blender/compositor/COM_defines.h
M	source/blender/compositor/intern/COM_CPUDevice.cpp
M	source/blender/compositor/intern/COM_CPUDevice.h
M	source/blender/compositor/intern/COM_Device.h
M	source/blender/compositor/intern/COM_ExecutionGroup.cpp
M	source/blender/compositor/intern/COM_NodeOperation.h
M	source/blender/compositor/intern/COM_OpenCLDevice.cpp
M	source/blender/compositor/intern/COM_OpenCLDevice.h
A	source/blender/compositor/intern/COM_Tile.cpp
A	source/blender/compositor/intern/COM_Tile.h
M	source/blender/compositor/intern/COM_WorkPackage.cpp
M	source/blender/compositor/intern/COM_WorkPackage.h
M	source/blender/compositor/intern/COM_WorkScheduler.cpp
M	source/blender/compositor/intern/COM_WorkScheduler.h
M	source/blender/compositor/operations/COM_CompositorOperation.cpp
M	source/blender/compositor/operations/COM_CompositorOperation.h
M	source/blender/compositor/operations/COM_OutputFileOperation.cpp
M	source/blender/compositor/operations/COM_OutputFileOperation.h
M	source/blender/compositor/operations/COM_PreviewOperation.cpp
M	source/blender/compositor/operations/COM_PreviewOperation.h
M	source/blender/compositor/operations/COM_ViewerOperation.cpp
M	source/blender/compositor/operations/COM_ViewerOperation.h
M	source/blender/compositor/operations/COM_WriteBufferOperation.cpp
M	source/blender/compositor/operations/COM_WriteBufferOperation.h

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

diff --git a/source/blender/compositor/CMakeLists.txt b/source/blender/compositor/CMakeLists.txt
index abd2bf7..35dbc4c 100644
--- a/source/blender/compositor/CMakeLists.txt
+++ b/source/blender/compositor/CMakeLists.txt
@@ -84,6 +84,8 @@ set(SRC
 	intern/COM_WorkScheduler.h
 	intern/COM_WorkPackage.cpp
 	intern/COM_WorkPackage.h
+	intern/COM_Tile.cpp
+	intern/COM_Tile.h
 	intern/COM_ChunkOrder.cpp
 	intern/COM_ChunkOrder.h
 	intern/COM_ChunkOrderHotspot.cpp
diff --git a/source/blender/compositor/COM_defines.h b/source/blender/compositor/COM_defines.h
index f8211cd..eb95887 100644
--- a/source/blender/compositor/COM_defines.h
+++ b/source/blender/compositor/COM_defines.h
@@ -67,7 +67,7 @@ typedef enum CompositorPriority {
 
 // chunk size determination
 #define COM_PREVIEW_SIZE 140.0f
-#define COM_OPENCL_ENABLED
+//#define COM_OPENCL_ENABLED
 //#define COM_DEBUG
 
 // workscheduler threading models
diff --git a/source/blender/compositor/intern/COM_CPUDevice.cpp b/source/blender/compositor/intern/COM_CPUDevice.cpp
index c7c3f77..cb3cc11 100644
--- a/source/blender/compositor/intern/COM_CPUDevice.cpp
+++ b/source/blender/compositor/intern/COM_CPUDevice.cpp
@@ -22,16 +22,11 @@
 
 #include "COM_CPUDevice.h"
 
-void CPUDevice::execute(WorkPackage *work)
+void CPUDevice::execute(Tile *tile)
 {
-	const unsigned int chunkNumber = work->getChunkNumber();
-	ExecutionGroup *executionGroup = work->getExecutionGroup();
-	rcti rect;
-
-	executionGroup->determineChunkRect(&rect, chunkNumber);
-
-	executionGroup->getOutputOperation()->executeRegion(&rect, chunkNumber);
-
-	executionGroup->finalizeChunkExecution(chunkNumber, NULL);
+	ExecutionGroup *executionGroup = tile->getExecutionGroup();
+	NodeOperation * operation = executionGroup->getOutputOperation();
+	operation->executeRegion(tile);
+	executionGroup->finalizeChunkExecution(tile->get_tile_number(), NULL);
 }
 
diff --git a/source/blender/compositor/intern/COM_CPUDevice.h b/source/blender/compositor/intern/COM_CPUDevice.h
index 3dc8fff..e77fad1 100644
--- a/source/blender/compositor/intern/COM_CPUDevice.h
+++ b/source/blender/compositor/intern/COM_CPUDevice.h
@@ -35,7 +35,7 @@ public:
 	 * @brief execute a WorkPackage
 	 * @param work the WorkPackage to execute
 	 */
-	void execute(WorkPackage *work);
+	void execute(Tile *work);
 };
 
 #endif
diff --git a/source/blender/compositor/intern/COM_Device.h b/source/blender/compositor/intern/COM_Device.h
index dc39b2b..b3b0137 100644
--- a/source/blender/compositor/intern/COM_Device.h
+++ b/source/blender/compositor/intern/COM_Device.h
@@ -23,7 +23,7 @@
 #ifndef _COM_Device_h
 #define _COM_Device_h
 
-#include "COM_WorkPackage.h"
+#include "COM_Tile.h"
 
 /**
  * @brief Abstract class for device implementations to be used by the Compositor.
@@ -53,7 +53,7 @@ public:
 	 * @brief execute a WorkPackage
 	 * @param work the WorkPackage to execute
 	 */
-	virtual void execute(WorkPackage *work) = 0;
+	virtual void execute(Tile *work) = 0;
 
 #ifdef WITH_CXX_GUARDEDALLOC
 	MEM_CXX_CLASS_ALLOC_FUNCS("COM:Device")
diff --git a/source/blender/compositor/intern/COM_ExecutionGroup.cpp b/source/blender/compositor/intern/COM_ExecutionGroup.cpp
index 4ed8cc3..c5f2f95 100644
--- a/source/blender/compositor/intern/COM_ExecutionGroup.cpp
+++ b/source/blender/compositor/intern/COM_ExecutionGroup.cpp
@@ -510,7 +510,10 @@ bool ExecutionGroup::scheduleChunk(unsigned int chunkNumber)
 {
 	if (this->m_chunkExecutionStates[chunkNumber] == COM_ES_NOT_SCHEDULED) {
 		this->m_chunkExecutionStates[chunkNumber] = COM_ES_SCHEDULED;
-		WorkScheduler::schedule(this, chunkNumber);
+		rcti *rect = new rcti();
+		this->determineChunkRect(rect, chunkNumber);
+		Tile * tile = new Tile(this, rect, chunkNumber);
+		WorkScheduler::schedule(tile);
 		return true;
 	}
 	return false;
diff --git a/source/blender/compositor/intern/COM_NodeOperation.h b/source/blender/compositor/intern/COM_NodeOperation.h
index 3f636df..82c1bc6 100644
--- a/source/blender/compositor/intern/COM_NodeOperation.h
+++ b/source/blender/compositor/intern/COM_NodeOperation.h
@@ -47,6 +47,7 @@ using std::max;
 class OpenCLDevice;
 class ReadBufferOperation;
 class WriteBufferOperation;
+class Tile;
 
 class NodeOperationInput;
 class NodeOperationOutput;
@@ -175,7 +176,7 @@ public:
 	 * @param chunkNumber the chunkNumber to be calculated
 	 * @param memoryBuffers all input MemoryBuffer's needed
 	 */
-	virtual void executeRegion(rcti *rect, unsigned int chunkNumber) {}
+	virtual void executeRegion(Tile* tile) {}
 
 	/**
 	 * @brief when a chunk is executed by an OpenCLDevice, this method is called
diff --git a/source/blender/compositor/intern/COM_OpenCLDevice.cpp b/source/blender/compositor/intern/COM_OpenCLDevice.cpp
index 9f3d6ed..5976f0c 100644
--- a/source/blender/compositor/intern/COM_OpenCLDevice.cpp
+++ b/source/blender/compositor/intern/COM_OpenCLDevice.cpp
@@ -60,21 +60,19 @@ void OpenCLDevice::deinitialize()
 	}
 }
 
-void OpenCLDevice::execute(WorkPackage *work)
+void OpenCLDevice::execute(Tile *tile)
 {
-	const unsigned int chunkNumber = work->getChunkNumber();
-	ExecutionGroup *executionGroup = work->getExecutionGroup();
-	rcti rect;
+	const unsigned int chunkNumber = tile->get_tile_number();
+	ExecutionGroup *executionGroup = tile->getExecutionGroup();
+	rcti *rect = tile->get_rect();
 
-	executionGroup->determineChunkRect(&rect, chunkNumber);
 	MemoryBuffer **inputBuffers = executionGroup->getInputBuffersOpenCL(chunkNumber);
-	MemoryBuffer *outputBuffer = executionGroup->allocateOutputBuffer(chunkNumber, &rect);
+	MemoryBuffer *outputBuffer = executionGroup->allocateOutputBuffer(chunkNumber, rect);
 
-	executionGroup->getOutputOperation()->executeOpenCLRegion(this, &rect,
+	executionGroup->getOutputOperation()->executeOpenCLRegion(this, rect,
 	                                                              chunkNumber, inputBuffers, outputBuffer);
 
 	delete outputBuffer;
-	
 	executionGroup->finalizeChunkExecution(chunkNumber, inputBuffers);
 }
 cl_mem OpenCLDevice::COM_clAttachMemoryBufferToKernelParameter(cl_kernel kernel, int parameterIndex, int offsetIndex,
diff --git a/source/blender/compositor/intern/COM_OpenCLDevice.h b/source/blender/compositor/intern/COM_OpenCLDevice.h
index e3fd900..8885537 100644
--- a/source/blender/compositor/intern/COM_OpenCLDevice.h
+++ b/source/blender/compositor/intern/COM_OpenCLDevice.h
@@ -92,7 +92,7 @@ public:
 	 * @brief execute a WorkPackage
 	 * @param work the WorkPackage to execute
 	 */
-	void execute(WorkPackage *work);
+	void execute(Tile *work);
 
 	/**
 	 * @brief determine an image format
diff --git a/source/blender/compositor/intern/COM_WorkPackage.cpp b/source/blender/compositor/intern/COM_Tile.cpp
similarity index 61%
copy from source/blender/compositor/intern/COM_WorkPackage.cpp
copy to source/blender/compositor/intern/COM_Tile.cpp
index fa332ff..ecfc4bb 100644
--- a/source/blender/compositor/intern/COM_WorkPackage.cpp
+++ b/source/blender/compositor/intern/COM_Tile.cpp
@@ -20,10 +20,33 @@
  *		Monique Dewanchand
  */
 
-#include "COM_WorkPackage.h"
+#include "COM_Tile.h"
+#include "COM_WorkScheduler.h"
 
-WorkPackage::WorkPackage(ExecutionGroup *group, unsigned int chunkNumber)
+Tile::Tile(ExecutionGroup *group, rcti *rect, unsigned int tile_number)
 {
 	this->m_executionGroup = group;
-	this->m_chunkNumber = chunkNumber;
+	this->m_rect = rect;
+	this->m_state = CREATED;
+	this->m_tile_number = tile_number;
+}
+
+Tile::~Tile() {
+	delete this->m_rect;
+}
+
+void Tile::schedule() {
+	/// @TODO: Still needs implementation
+}
+
+void Tile::add_dependent(Tile *tile) {
+	/// @TODO: Still needs implementation
+}
+
+void Tile::add_depends_on(Tile *tile) {
+	/// @TODO: Still needs implementation
+}
+
+void Tile::execute() {
+	/// @TODO: Still needs implementation
 }
diff --git a/source/blender/compositor/intern/COM_Tile.h b/source/blender/compositor/intern/COM_Tile.h
new file mode 100644
index 0000000..b7e8f84
--- /dev/null
+++ b/source/blender/compositor/intern/COM_Tile.h
@@ -0,0 +1,127 @@
+/*
+ * Copyright 2011, Blender Foundation.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ * Contributor: 
+ *		Jeroen Bakker 
+ *		Monique Dewanchand
+ */
+
+class Tile;
+
+#ifndef _COM_Tile_h_
+#define _COM_Tile_h_
+class ExecutionGroup;
+#include "COM_ExecutionGroup.h"
+class WorkScheduler;
+#include <vector>
+
+typedef std::vector<Tile*> Tiles;
+
+typedef enum TileExecutionState{
+	CREATED = 0,
+	SCHEDULED = 1,
+	FINISHED = 2
+} TileExecutionState;
+
+/**
+ * @brief A tile is the work that can be scheduled.
+ *
+ * @see WorkScheduler
+ */
+class Tile {
+private:
+	/**
+	 * @brief executionGroup with the operations-setup to be evaluated
+	 */
+	ExecutionGroup *m_executionGroup;
+
+	/**
+	 * @brief rcti that this tile calculates from an ExecutionGroup
+	 */
+	rcti *m_rect;
+
+	/**
+	 * @brief a list of tiles that needs to be calculated, before this tile can be scheduled
+	 */
+	Tiles m_depends_on;
+
+	/**
+	 * @brief Number of unfinished tiles in the m_depends_on.
+	 */
+	int m_no_unfinished_tiles;
+
+	/**
+	 * @brief a list of tiles that are waiting for me to be finished
+	 */
+	Tiles m_dependents;
+
+	/**
+	 * @brief m_state execution state of this tile.
+	 */
+	TileExecutionState m_state;
+
+	unsigned int m_tile_number;
+public:
+	/**
+	 * constructor
+	 */
+	Tile(ExecutionGroup *group, rcti *rect, unsigned int tile_number);
+	~Tile();
+	/**
+	 * @brief get the ExecutionGroup
+	 */
+	ExecutionGroup *getExecutionGroup() const { return this->m_executionGroup; }
+
+	/**
+	 * @brief schedule Schedule th

@@ Diff output truncated at 10240 characters. @@




More information about the Bf-blender-cvs mailing list