Equalizer  1.6.1
include/eq/client/pipe.h
1 
2 /* Copyright (c) 2005-2013, Stefan Eilemann <eile@equalizergraphics.com>
3  * 2010, Cedric Stalder <cedric.stalder@gmail.com>
4  * 2010-2011, Daniel Nachbaur <danielnachbaur@gmail.com>
5  *
6  * This library is free software; you can redistribute it and/or modify it under
7  * the terms of the GNU Lesser General Public License version 2.1 as published
8  * by the Free Software Foundation.
9  *
10  * This library is distributed in the hope that it will be useful, but WITHOUT
11  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
12  * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
13  * details.
14  *
15  * You should have received a copy of the GNU Lesser General Public License
16  * along with this library; if not, write to the Free Software Foundation, Inc.,
17  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
18  */
19 
20 #ifndef EQ_PIPE_H
21 #define EQ_PIPE_H
22 
23 #include <eq/client/api.h>
24 #include <eq/client/eye.h> // Eye enum
25 #include <eq/client/types.h>
26 #include <eq/client/visitorResult.h> // enum
27 
28 #include <eq/fabric/pipe.h> // base class
29 #include <co/objectVersion.h>
30 
31 namespace eq
32 {
33 namespace detail { class Pipe; class RenderThread; class ThreadAffinityVisitor; }
34 
45  class Pipe : public fabric::Pipe< Node, Pipe, eq::Window, PipeVisitor >
46  {
47  public:
49  EQ_API Pipe( Node* parent );
50 
52  EQ_API virtual ~Pipe();
53 
56  EQ_API co::CommandQueue* getPipeThreadQueue();
57  co::CommandQueue* getMainThreadQueue();
58  co::CommandQueue* getCommandThreadQueue();
59  co::CommandQueue* getTransferThreadQueue();
60 
61 
63  EQ_API Config* getConfig();
65  EQ_API const Config* getConfig() const;
66 
68  EQ_API ClientPtr getClient();
69 
71  EQ_API ServerPtr getServer();
72 
77  bool isRunning() const;
78 
83  EQ_API bool isStopped() const;
84 
92  EQ_API uint32_t getCurrentFrame() const;
93  EQ_API uint32_t getFinishedFrame() const;
94 
105  EQ_API WindowSystem getWindowSystem() const;
107 
121  Frame* getFrame( const co::ObjectVersion& frameVersion,
122  const Eye eye, const bool output );
123 
125  co::QueueSlave* getQueue( const UUID& queueID );
126 
128  void flushFrames( ObjectManager* om );
129 
131  const View* getView( const co::ObjectVersion& viewVersion ) const;
132 
134  View* getView( const co::ObjectVersion& viewVersion );
136 
137  void waitExited() const;
138  void notifyMapped();
139 
147  EQ_API void waitFrameFinished( const uint32_t frameNumber ) const;
148 
156  EQ_API void waitFrameLocal( const uint32_t frameNumber ) const;
157 
169  EQ_API virtual bool processEvent( const Event& event );
170 
172  void startThread();
173 
175  void exitThread();
176 
177  void cancelThread();
178 
180  bool startTransferThread();
181 
183  bool hasTransferThread() const;
184 
197  EQ_API void setSystemPipe( SystemPipe* pipe );
198 
200  EQ_API SystemPipe* getSystemPipe();
201 
203  EQ_API const SystemPipe* getSystemPipe() const;
205 
212  EQ_API void setComputeContext( ComputeContext* ctx );
213 
215  EQ_API const ComputeContext* getComputeContext() const;
216 
220 
235  EQ_API virtual MessagePump* createMessagePump();
236 
240 
242  EQ_API virtual void setDirty( const uint64_t bits );
243 
244  protected:
253  EQ_API void startFrame( const uint32_t frameNumber );
254 
261  EQ_API void releaseFrame( const uint32_t frameNumber );
262 
269  EQ_API void releaseFrameLocal( const uint32_t frameNumber );
271 
279 #ifndef EQ_2_0_API
280 
291  EQ_API virtual bool supportsWindowSystem( const WindowSystem ws ) const;
292 #endif
293 
302  EQ_API virtual WindowSystem selectWindowSystem() const;
303 
310  EQ_API virtual bool configInit( const uint128_t& initID );
311 
318  EQ_API virtual bool configInitSystemPipe( const uint128_t& initID );
319 
324  EQ_API virtual bool configExit();
325 
343  EQ_API virtual void frameStart( const uint128_t& frameID,
344  const uint32_t frameNumber );
345 
360  EQ_API virtual void frameFinish( const uint128_t& frameID,
361  const uint32_t frameNumber );
362 
373  EQ_API virtual void frameDrawFinish( const uint128_t& frameID,
374  const uint32_t frameNumber );
375 
377  EQ_API virtual void attach( const UUID& id, const uint32_t instanceID );
378 
379  private:
380  detail::Pipe* const _impl;
381  friend class detail::RenderThread;
382 
383  //-------------------- Methods --------------------
384  void _setupCommandQueue();
385  void _setupAffinity();
386  void _exitCommandQueue();
387 
389  EQ_API int32_t _getAutoAffinity() const;
390  friend class detail::ThreadAffinityVisitor;
391 
392  //friend class Window;
393 
394  void _stopTransferThread();
395 
397  void _releaseViews();
398 
400  void _flushViews();
401 
403  void _flushQueues();
404 
405  /* The command functions. */
406  bool _cmdCreateWindow( co::ICommand& command );
407  bool _cmdDestroyWindow( co::ICommand& command );
408  bool _cmdConfigInit( co::ICommand& command );
409  bool _cmdConfigExit( co::ICommand& command );
410  bool _cmdFrameStartClock( co::ICommand& command );
411  bool _cmdFrameStart( co::ICommand& command );
412  bool _cmdFrameFinish( co::ICommand& command );
413  bool _cmdFrameDrawFinish( co::ICommand& command );
414  bool _cmdExitThread( co::ICommand& command );
415  bool _cmdDetachView( co::ICommand& command );
416  bool _cmdExitTransferThread( co::ICommand& command );
417 
418  LB_TS_VAR( _pipeThread );
419  };
420 }
421 
422 #endif // EQ_PIPE_H
A configuration is a visualization session driven by an application.
Event structure to report window system and other events.
Definition: event.h:171
Base data transport class for pipes.
void startFrame(const uint32_t frameNumber)
Start a frame by unlocking all child resources.
void setSystemPipe(SystemPipe *pipe)
Set the system-specific pipe implementation.
virtual void frameStart(const uint128_t &frameID, const uint32_t frameNumber)
Start rendering a frame.
SystemPipe * getSystemPipe()
A View is a 2D area of a Layout.
virtual void frameFinish(const uint128_t &frameID, const uint32_t frameNumber)
Finish rendering a frame.
ServerPtr getServer()
A Node represents a single computer in the cluster.
A facility class to manage OpenGL objects across shared contexts.
A Pipe represents a graphics card (GPU) on a Node.
Config * getConfig()
lunchbox::RefPtr< Server > ServerPtr
A reference-counted pointer to an eq::Server.
void setComputeContext(ComputeContext *ctx)
Set the compute-specific context.
virtual WindowSystem selectWindowSystem() const
Choose the window system to be used by this pipe.
MessagePump * getMessagePump()
void releaseFrameLocal(const uint32_t frameNumber)
Release the local synchronization of the parent for a frame.
ClientPtr getClient()
A holder for a frame data and related parameters.
Definition: client/frame.h:42
lunchbox::RefPtr< Client > ClientPtr
A reference-counted pointer to an eq::Client.
The interface definition for system-specific GPU handling.
Definition: systemPipe.h:37
virtual bool supportsWindowSystem(const WindowSystem ws) const
Tests wether a particular windowing system is supported by this pipe and all its windows.
void releaseFrame(const uint32_t frameNumber)
Signal the completion of a frame to the parent.
virtual bool configInitSystemPipe(const uint128_t &initID)
Initialize the OS-specific pipe.
virtual bool configInit(const uint128_t &initID)
Initialize this pipe.
bool isRunning() const
Pipe(Node *parent)
Construct a new pipe.
virtual MessagePump * createMessagePump()
Create a new MessagePump for this pipe.
An interface to process system messages or events.
Definition: messagePump.h:26
WindowSystem getWindowSystem() const
Return the window system used by this pipe.
virtual void frameDrawFinish(const uint128_t &frameID, const uint32_t frameNumber)
Finish drawing.
virtual bool processEvent(const Event &event)
Process a received event.
bool isStopped() const
uint32_t getCurrentFrame() const
Return the current frame number.
virtual bool configExit()
De-initialize this pipe.
virtual ~Pipe()
Destruct the pipe.
const ComputeContext * getComputeContext() const
The interface definition for API-specific GPGPU handling.
The list of possible window systems.
Definition: windowSystem.h:68