2012-02-13 00:37:57 +01:00
|
|
|
/*
|
|
|
|
|
JOB.hpp - render job closure
|
|
|
|
|
|
|
|
|
|
Copyright (C) Lumiera.org
|
|
|
|
|
2012, Hermann Vosseler <Ichthyostega@web.de>
|
|
|
|
|
|
|
|
|
|
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., 675 Mass Ave, Cambridge, MA 02139, USA.
|
|
|
|
|
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#ifndef PROC_ENGINE_JOB_H
|
|
|
|
|
#define PROC_ENGINE_JOB_H
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#include <gavl/gavl.h>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
typedef void* LList; ////////////////////////////////////TODO
|
2012-02-17 01:54:51 +01:00
|
|
|
typedef uint64_t InvocationInstanceID; /////////////////TODO
|
2012-02-13 00:37:57 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
|
enum JobState
|
|
|
|
|
{
|
|
|
|
|
DONE, ///< already done, nothing to do
|
|
|
|
|
RUNNING, ///< job is currently running
|
|
|
|
|
WAITING, ///< waits for some prerequisite resource
|
|
|
|
|
REJECTED, ///< sorry, can't do that Dave
|
|
|
|
|
EXPIRED, ///< deadline expired
|
|
|
|
|
ABORTED ///< got aborted
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
2012-02-17 01:54:51 +01:00
|
|
|
/**
|
|
|
|
|
* closure representing the execution context of a job.
|
|
|
|
|
* The information reachable through this closure is specific
|
|
|
|
|
* for this kind of job, but static and typically shared among
|
|
|
|
|
* all jobs for a given feed and segment of the timeline
|
|
|
|
|
*/
|
|
|
|
|
struct lumiera_jobClosure { /* placeholder */ };
|
|
|
|
|
typedef struct lumiera_jobClosure* LumieraJobClosure;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* invocation parameter for the individual
|
|
|
|
|
* frame calculation job. Embedded into the job descriptor
|
|
|
|
|
* and passed to #lumiera_job_invoke when triggering
|
|
|
|
|
*/
|
|
|
|
|
struct lumiera_jobParameter_struct
|
|
|
|
|
{
|
|
|
|
|
InvocationInstanceID invoKey;
|
|
|
|
|
gavl_time_t nominalTime;
|
|
|
|
|
//////////////////////////////////////////////////////////////TODO: place a parameter value here, or make the instanceID globally unique?
|
|
|
|
|
};
|
|
|
|
|
typedef struct lumiera_jobParameter_struct lumiera_jobParameter;
|
|
|
|
|
typedef lumiera_jobParameter* LumieraJobParameter;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* descriptor record used by the scheduler to organise job invocation.
|
|
|
|
|
* The invocation parameter and job closure necessary to invoke this
|
|
|
|
|
* job as a function is embedded into this descriptor.
|
|
|
|
|
*/
|
2012-02-13 00:37:57 +01:00
|
|
|
struct lumiera_jobDescriptor_struct
|
|
|
|
|
{
|
|
|
|
|
gavl_time_t when;
|
|
|
|
|
|
|
|
|
|
/* == Job prerequisites == */
|
|
|
|
|
LList waiting;
|
|
|
|
|
LList failed;
|
|
|
|
|
LList completed;
|
|
|
|
|
|
|
|
|
|
JobState jobstate;
|
|
|
|
|
|
2012-02-17 01:54:51 +01:00
|
|
|
LumieraJobClosure jobClosure;
|
|
|
|
|
lumiera_jobParameter parameter;
|
2012-02-13 00:37:57 +01:00
|
|
|
};
|
2012-02-17 01:54:51 +01:00
|
|
|
typedef struct lumiera_jobDescriptor_struct lumiera_jobDescriptor;
|
2012-02-13 00:37:57 +01:00
|
|
|
typedef lumiera_jobDescriptor* LumieraJobDescriptor;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#ifdef __cplusplus /* ============== C++ Interface ================= */
|
|
|
|
|
|
|
|
|
|
#include "proc/common.hpp"
|
|
|
|
|
//#include "proc/state.hpp"
|
|
|
|
|
//#include "lib/time/timevalue.hpp"
|
|
|
|
|
//#include "lib/time/timequant.hpp"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
namespace proc {
|
|
|
|
|
namespace engine {
|
|
|
|
|
|
|
|
|
|
//using lib::time::TimeSpan;
|
|
|
|
|
//using lib::time::Duration;
|
|
|
|
|
//using lib::time::FSecs;
|
|
|
|
|
//using lib::time::Time;
|
|
|
|
|
//
|
|
|
|
|
//class ExitNode;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Frame rendering task, represented as closure.
|
2012-02-17 01:54:51 +01:00
|
|
|
* This functor encodes all information necessary to actually
|
2012-02-13 00:37:57 +01:00
|
|
|
* trigger and invoke the rendering operation. It will be embedded
|
|
|
|
|
* into a job descriptor and then enqueued with the scheduler for
|
|
|
|
|
* invocation just in time.
|
|
|
|
|
*
|
|
|
|
|
* @todo 1/12 WIP-WIP-WIP defining the invocation sequence and render jobs
|
|
|
|
|
*/
|
|
|
|
|
class Job
|
2012-02-17 01:54:51 +01:00
|
|
|
: public lumiera_jobClosure
|
2012-02-13 00:37:57 +01:00
|
|
|
{
|
|
|
|
|
|
|
|
|
|
public:
|
2012-02-17 01:54:51 +01:00
|
|
|
//////////////////////////////TODO: value semantics or turn this into an interface?
|
2012-02-13 00:37:57 +01:00
|
|
|
|
|
|
|
|
Job()
|
|
|
|
|
{
|
|
|
|
|
UNIMPLEMENTED ("job representation, planning and scheduling");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// using standard copy operations
|
|
|
|
|
|
|
|
|
|
|
2012-02-17 01:54:51 +01:00
|
|
|
void triggerJob (lumiera_jobParameter) const;
|
|
|
|
|
void signalFailure (lumiera_jobParameter) const;
|
|
|
|
|
|
|
|
|
|
|
2012-02-13 00:37:57 +01:00
|
|
|
bool
|
|
|
|
|
isValid() const
|
|
|
|
|
{
|
|
|
|
|
UNIMPLEMENTED ("validity self check");
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}} // namespace proc::engine
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
extern "C" {
|
|
|
|
|
#endif /* =========================== CL Interface ===================== */
|
|
|
|
|
|
|
|
|
|
|
2012-02-17 01:54:51 +01:00
|
|
|
/** trigger execution of a specific job,
|
|
|
|
|
* assuming availability of all prerequisites */
|
|
|
|
|
void lumiera_job_invoke (LumieraJobClosure, lumiera_jobParameter);
|
|
|
|
|
|
|
|
|
|
/** signal inability to invoke this job
|
|
|
|
|
* @todo decide what and how to communicate details of the failure
|
|
|
|
|
* @remarks the purpose of this function is to allow for reliable checkpoints
|
|
|
|
|
* within the network of dependent jobs invocations, even after
|
|
|
|
|
* missing deadlines or aborting a sequence of jobs */
|
|
|
|
|
void lumiera_job_failure (LumieraJobClosure, lumiera_jobParameter);
|
|
|
|
|
|
2012-02-13 00:37:57 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
|
#ifdef __cplusplus
|
|
|
|
|
}
|
|
|
|
|
#endif
|
|
|
|
|
#endif
|