From 77066ee3cee0fa495d81bd11df870723fb1a2fbf Mon Sep 17 00:00:00 2001 From: Ichthyostega Date: Mon, 3 Jun 2013 05:25:13 +0200 Subject: [PATCH] WIP: how to start the actual calculation streams within EngineService this draft fills in the structure how to get from an invocation of the engine service to the starting of actual CalcStream instances. Basically the EngineService implementation is repsonsile to instruct the Segmentation to provide a suitable Dispatcher. --- src/include/play-facade.h | 9 +-- src/proc/engine/calc-stream.hpp | 8 +++ src/proc/engine/engine-service-mock.cpp | 2 +- src/proc/engine/engine-service-mock.hpp | 2 +- src/proc/engine/engine-service.cpp | 57 +++++++++++++------ src/proc/engine/engine-service.hpp | 7 +-- src/proc/play/play-service.cpp | 25 ++++++-- src/proc/play/render-configurator.cpp | 2 +- .../proc/play/dummy-play-connection-test.cpp | 2 +- wiki/renderengine.html | 4 +- 10 files changed, 83 insertions(+), 35 deletions(-) diff --git a/src/include/play-facade.h b/src/include/play-facade.h index 480a1d6fd..0e9126f0f 100644 --- a/src/include/play-facade.h +++ b/src/include/play-facade.h @@ -127,12 +127,9 @@ namespace lumiera { typedef proc::asset::PTimeline Timeline; typedef proc::asset::PViewer Viewer; - /** core operation: create a new playback process - * outputting to the given viewer/display */ - virtual Controller connect(ModelPorts, Output) =0; - /* ==== convenience shortcuts for common use cases ==== */ + Controller perform(ModelPorts, Output); Controller perform(Pipes, Output); Controller perform(Timeline); Controller perform(Viewer); @@ -141,6 +138,10 @@ namespace lumiera { protected: virtual ~Play(); + + /** core operation: create a new playback process + * outputting to the given viewer/display */ + virtual Controller connect(ModelPorts, Output) =0; }; diff --git a/src/proc/engine/calc-stream.hpp b/src/proc/engine/calc-stream.hpp index 985c63a90..e7c134774 100644 --- a/src/proc/engine/calc-stream.hpp +++ b/src/proc/engine/calc-stream.hpp @@ -28,6 +28,7 @@ #include "lib/error.hpp" #include "proc/play/timings.hpp" +#include "proc/play/output-slot.hpp" #include "proc/engine/calc-plan-continuation.hpp" //#include "include/dummy-player-facade.h" //#include "include/display-facade.h" @@ -108,6 +109,13 @@ namespace engine{ ~CalcStream() { } // using standard copy operations + + CalcStream + sendToOutput (play::DataSink) + { + UNIMPLEMENTED ("set up dispatcher to start calculating and feeding to the given output sink"); + return *this; + } }; diff --git a/src/proc/engine/engine-service-mock.cpp b/src/proc/engine/engine-service-mock.cpp index 5cb7e8ed2..f5a6a2958 100644 --- a/src/proc/engine/engine-service-mock.cpp +++ b/src/proc/engine/engine-service-mock.cpp @@ -64,7 +64,7 @@ namespace engine{ /** special engine configuration for mock/testing operation. */ RenderEnvironmentClosure& - EngineServiceMock::configureCalculation () + EngineServiceMock::configureCalculation (ModelPort,Timings,Quality) { UNIMPLEMENTED ("represent *this as RenderEnvironmentClosure)"); RenderEnvironmentClosure* todo_fake(0); ////KABOOOM diff --git a/src/proc/engine/engine-service-mock.hpp b/src/proc/engine/engine-service-mock.hpp index 16990cab9..33b0c5e2b 100644 --- a/src/proc/engine/engine-service-mock.hpp +++ b/src/proc/engine/engine-service-mock.hpp @@ -95,7 +95,7 @@ namespace engine{ protected: - virtual RenderEnvironmentClosure& configureCalculation (); + virtual RenderEnvironmentClosure& configureCalculation (ModelPort,Timings,Quality); }; diff --git a/src/proc/engine/engine-service.cpp b/src/proc/engine/engine-service.cpp index bffada11e..c3be5f8e8 100644 --- a/src/proc/engine/engine-service.cpp +++ b/src/proc/engine/engine-service.cpp @@ -22,6 +22,7 @@ #include "proc/engine/engine-service.hpp" +#include "lib/itertools.hpp" //#include //#include @@ -37,15 +38,34 @@ namespace engine{ // using lumiera::Subsys; // using std::auto_ptr; // using boost::scoped_ptr; -// using std::tr1::bind; - + using std::function; + using std::tr1::bind; + using lib::transform; + using lib::append_all; + namespace { // hidden local details of the service implementation.... + /** @internal build a representation of a single, ongoing calculation effort. + * This "CalcStream" is tied to the actual engine implementation, but only + * through an opaque link, representing this concrete engine as an + * RenderEnvironmentClosure. This enables the created CalcStream to be + * re-configured and adjusted while running. + */ + CalcStream + activateCalculation (play::DataSink sink, RenderEnvironmentClosure& engineCallback) + { + CalcStream calcStream(engineCallback); + calcStream.sendToOutput (sink); + return calcStream; + } + } // (End) hidden service impl details + + /** storage for the EngineService interface object */ lib::Singleton EngineService::instance; @@ -72,7 +92,19 @@ namespace engine{ OutputConnection& output, Quality serviceQuality) { - UNIMPLEMENTED ("build a list of standard calculation streams"); + RenderEnvironmentClosure& renderConfig = configureCalculation (mPort,nominalTimings,serviceQuality); + function triggerRenderStart = bind (activateCalculation, renderConfig, _1); + + CalcStreams runningCalculations; + append_all (transform (output.getOpenedSinks() + ,triggerRenderStart + ) + ,runningCalculations); + return runningCalculations; +/////////////////////////////////////////////////////////////////////////////////////////////TICKET #874 : use a pipeline builder to write it as follows: +// treat_all(output.getOpenedSinks()) +// .apply (activateCalculation, renderConfig, _1) +// .buildVector(); } @@ -87,17 +119,6 @@ namespace engine{ } - /** @internal build a representation of a single, ongoing calculation effort. - * This "CalcStream" is tied to the actual engine implementation, but only - * through an opaque link, representing this concrete engine as an - * RenderEnvironmentClosure. This enables the created CalcStream to be - * re-configured and adjusted while running. - */ - CalcStream - EngineService::activateCalculation (RenderEnvironmentClosure& engineCallback) - { - return CalcStream (engineCallback); - } /** @internal extension point @@ -113,9 +134,13 @@ namespace engine{ * created render activity */ RenderEnvironmentClosure& - EngineService::configureCalculation () + EngineService::configureCalculation (ModelPort mPort, + Timings nominalTimings, + Quality serviceQuality) { - UNIMPLEMENTED ("represent *this as RenderEnvironmentClosure)"); + UNIMPLEMENTED ("Access and wire to the Scheduler-frontend. " + "Then access the Segmentation and invoke a builder function for a suitable dispatcher table. " + "Package all of this into a suitable RenderEnvironementClosure subclass."); RenderEnvironmentClosure* todo_fake(0); ////KABOOOM return *todo_fake; diff --git a/src/proc/engine/engine-service.hpp b/src/proc/engine/engine-service.hpp index 1ce427b11..223404e3a 100644 --- a/src/proc/engine/engine-service.hpp +++ b/src/proc/engine/engine-service.hpp @@ -64,6 +64,7 @@ // #include //#include +#include //#include @@ -74,6 +75,7 @@ namespace engine{ // using lumiera::Subsys; // using lumiera::Display; // using lumiera::DummyPlayer; +// using std::tr1::function; using mobject::ModelPort; using proc::play::Timings; @@ -153,11 +155,8 @@ namespace engine{ Quality serviceQuality =QoS_BACKGROUND); - private: - CalcStream activateCalculation (RenderEnvironmentClosure&); - protected: - virtual RenderEnvironmentClosure& configureCalculation (); + virtual RenderEnvironmentClosure& configureCalculation (ModelPort,Timings,Quality); void activateTracing(); void disableTracing(); ///< EX_FREE diff --git a/src/proc/play/play-service.cpp b/src/proc/play/play-service.cpp index 580b0e6a4..a7a6f3b56 100644 --- a/src/proc/play/play-service.cpp +++ b/src/proc/play/play-service.cpp @@ -211,11 +211,26 @@ namespace lumiera { /* ==== convenience shortcuts for creating a PlayProcess ==== */ + /** + * Generic point-of-Service for starting playback. + * Activating this service will "perform" the given exit points + * of the model, by "pulling" calculated data from these ports and + * feeding the results into suitable external outputs. + * @return a state machine front-end to control the ongoing + * play/render process. + */ + Play::Controller + Play::perform (ModelPorts ports, Output output) + { + return this->connect (ports, output); + } + + /** * */ Play::Controller - Play::perform(Pipes, Output) + Play::perform (Pipes, Output) { UNIMPLEMENTED ("build PlayProcess based on a set of pipes"); } @@ -225,7 +240,7 @@ namespace lumiera { * */ Play::Controller - Play::perform(Timeline) + Play::perform (Timeline) { UNIMPLEMENTED ("build PlayProcess for a Timeline"); } @@ -235,7 +250,7 @@ namespace lumiera { * */ Play::Controller - Play::perform(Viewer) + Play::perform (Viewer) { UNIMPLEMENTED ("build PlayProcess directly for a Viewer element"); } @@ -245,7 +260,7 @@ namespace lumiera { * */ Play::Controller - Play::perform(Track) + Play::perform (Track) { UNIMPLEMENTED ("build PlayProcess for a single Track"); } @@ -255,7 +270,7 @@ namespace lumiera { * */ Play::Controller - Play::perform(Clip) + Play::perform (Clip) { UNIMPLEMENTED ("build virtual Timeline and PlayProcess to show a single Clip"); } diff --git a/src/proc/play/render-configurator.cpp b/src/proc/play/render-configurator.cpp index 0edb8b070..9af8d71a2 100644 --- a/src/proc/play/render-configurator.cpp +++ b/src/proc/play/render-configurator.cpp @@ -109,7 +109,7 @@ namespace play { /** @internal decision point about how to configure the rendering. - * This would be the point to switch the render engine used. */ + * This would be the point for possibly switching the concrete render engine used. */ inline RenderConfigurator* how_to_render (POutputManager outputPossibilities, Timings playTimings) { diff --git a/tests/core/proc/play/dummy-play-connection-test.cpp b/tests/core/proc/play/dummy-play-connection-test.cpp index 8f2350c11..18143a563 100644 --- a/tests/core/proc/play/dummy-play-connection-test.cpp +++ b/tests/core/proc/play/dummy-play-connection-test.cpp @@ -71,7 +71,7 @@ namespace test { CHECK (!dummy.isWired()); Play::Controller player - = Play::facade().connect ( dummy.provide_testModelPorts() + = Play::facade().perform ( dummy.provide_testModelPorts() , dummy.provide_testOutputSlot()); CHECK ( dummy.isWired()); diff --git a/wiki/renderengine.html b/wiki/renderengine.html index d6cb3eea7..abb580349 100644 --- a/wiki/renderengine.html +++ b/wiki/renderengine.html @@ -4453,9 +4453,9 @@ We need a way of addressing existing [[pipes|Pipe]]. Besides, as the Pipes and T <<tasksum end>> -
+
With //play process//&nbsp; we denote an ongoing effort to calculate a stream of frames for playback or rendering.
-The play process is an conceptual entity linking together several activities in the [[Backend]] and the RenderEngine. Creating a play process is the central service provided by the [[player subsystem|Player]]: it maintains a registration entry for the process to keep track of associated entities, resources allocated and calls [[dispatched|FrameDispatcher]] as a consequence, and it wires and exposes a PlayController to serve as an interface and information hub.
+The play process is an conceptual entity linking together several activities in the [[Backend]] and the RenderEngine. Creating a play process is the central service provided by the [[player subsystem|Player]]: it maintains a registration entry for the process to keep track of associated entities, resources allocated and calls [[planned|FrameDispatcher]] and [[invoked|RenderJob]] as a consequence, and it wires and exposes a PlayController to serve as an interface and information hub.
 
 ''Note'': the player is in no way engaged in any of the actual calculation and management tasks necessary to make this [[stream of calculations|CalcStream]] happen. The play process code contained within the player subsystem is largely comprised of organisational concerns and not especially performance critical.
 * the [[engine backbone|RenderBackbone]] is responsible for [[dispatching|FrameDispatcher]] the [[calculation stream|CalcStream]] and preparing individual calculation jobs