diff --git a/.gitsubprojects b/.gitsubprojects index 55239a65e4..92bbe07c0f 100644 --- a/.gitsubprojects +++ b/.gitsubprojects @@ -6,4 +6,4 @@ git_subproject(Pression https://github.com/Eyescale/Pression.git 6d3b6ed) git_subproject(hwsd https://github.com/Eyescale/hwsd.git 6211d53) git_subproject(Collage https://github.com/Eyescale/Collage.git 3f2ed88) git_subproject(GLStats https://github.com/Eyescale/GLStats.git 2ba6dbc) -git_subproject(Deflect https://github.com/BlueBrain/Deflect.git 04a99f3) +git_subproject(Deflect https://github.com/BlueBrain/Deflect.git 1cb94bc) diff --git a/doc/Changelog.md b/doc/Changelog.md index 30022c744d..6cd8bde719 100644 --- a/doc/Changelog.md +++ b/doc/Changelog.md @@ -3,6 +3,12 @@ Changelog {#Changelog} # git master +* [561](https://github.com/Eyescale/Equalizer/pull/561): + Change Deflect streaming activation + + * Use environment variable from + [Deflect#98](https://github.com/BlueBrain/Deflect/pull/98) + * Obsolete DisplayCluster view attributes, use deflect_host attribute now * [560](https://github.com/Eyescale/Equalizer/pull/560): Add seq::Renderer::bindDrawFrameBuffer() * [554](https://github.com/Eyescale/Equalizer/pull/554): diff --git a/eq/CMakeLists.txt b/eq/CMakeLists.txt index 2d6eef028b..240da556cf 100644 --- a/eq/CMakeLists.txt +++ b/eq/CMakeLists.txt @@ -177,7 +177,7 @@ set(EQUALIZER_LINK_LIBRARIES ${Boost_PROGRAM_OPTIONS_LIBRARY} ${Boost_FILESYSTEM_LIBRARY} ${Boost_SYSTEM_LIBRARY} ${Boost_THREAD_LIBRARY}) -if(DEFLECT_FOUND) +if(TARGET Deflect) list(APPEND EQUALIZER_SOURCES deflect/connection.h deflect/eventHandler.cpp diff --git a/eq/channel.cpp b/eq/channel.cpp index 439be4ef01..1549095f41 100644 --- a/eq/channel.cpp +++ b/eq/channel.cpp @@ -244,11 +244,16 @@ bool Channel::configExit() bool Channel::configInit( const uint128_t& ) { #ifdef EQUALIZER_USE_DEFLECT - if( getView() && - !getView()->getSAttribute( View::SATTR_DISPLAYCLUSTER ).empty( )) + if( getView( )) { LBASSERT( !_impl->_deflectProxy ); - _impl->_deflectProxy = new deflect::Proxy( this ); + try + { + // Try to create Deflect proxy from env vars or + // config values, silently ignore failure + _impl->_deflectProxy = new deflect::Proxy( *this ); + } + catch( ... ) {} } #endif return true; diff --git a/eq/deflect/eventHandler.cpp b/eq/deflect/eventHandler.cpp index 27f0e484e3..e1740163ee 100644 --- a/eq/deflect/eventHandler.cpp +++ b/eq/deflect/eventHandler.cpp @@ -98,7 +98,7 @@ EventHandler::EventHandler( Proxy* proxy ) _eventHandlers = new EventHandlers; _eventHandlers->push_back( this ); - Pipe* pipe = proxy->getChannel()->getPipe(); + Pipe* pipe = proxy->getChannel().getPipe(); MessagePump* messagePump = pipe->isThreaded() ? pipe->getMessagePump() : pipe->getConfig()->getMessagePump(); if( messagePump ) @@ -110,7 +110,7 @@ EventHandler::EventHandler( Proxy* proxy ) EventHandler::~EventHandler() { - Pipe* pipe = _proxy->getChannel()->getPipe(); + Pipe* pipe = _proxy->getChannel().getPipe(); MessagePump* messagePump = dynamic_cast( pipe->isThreaded() ? pipe->getMessagePump() : @@ -146,9 +146,9 @@ void EventHandler::_processEvents( const Proxy* proxy ) if( !_proxy || (proxy && _proxy != proxy )) return; - const PixelViewport& pvp = _proxy->getChannel()->getPixelViewport(); - Channel* channel = _proxy->getChannel(); - Window* window = channel->getWindow(); + Channel& channel = _proxy->getChannel(); + const PixelViewport& pvp = channel.getPixelViewport(); + Window* window = channel.getWindow(); while( _proxy->hasNewEvent( )) { @@ -164,8 +164,8 @@ void EventHandler::_processEvents( const Proxy* proxy ) } Event event; - event.originator = channel->getID(); - event.serial = channel->getSerial(); + event.originator = channel.getID(); + event.serial = channel.getSerial(); event.type = Event::UNKNOWN; const float x = deflectEvent.mouseX * pvp.w; @@ -250,7 +250,7 @@ void EventHandler::_processEvents( const Proxy* proxy ) if( !window->getRenderContext( x, y, event.context )) LBVERB << "No rendering context for pointer event at " << x << ", " << y << std::endl; - channel->processEvent( event ); + channel.processEvent( event ); } } } diff --git a/eq/deflect/proxy.cpp b/eq/deflect/proxy.cpp index f0786849b1..375a28f6a2 100644 --- a/eq/deflect/proxy.cpp +++ b/eq/deflect/proxy.cpp @@ -49,15 +49,13 @@ ::deflect::Stream::Future make_ready_future( const bool value ) class Proxy::Impl : public boost::noncopyable { public: - explicit Impl( Channel* channel ) - : _stream( 0 ) - , _eventHandler( 0 ) - , _channel( channel ) + explicit Impl( Channel& channel ) + : _channel( channel ) , _sendFuture( make_ready_future( false )) , _running( false ) , _navigationMode( Proxy::MODE_ROTATE ) { - const DrawableConfig& dc = _channel->getDrawableConfig(); + const DrawableConfig& dc = _channel.getDrawableConfig(); if( dc.colorBits != 8 ) { LBWARN << "Can only stream 8-bit RGB(A) framebuffers to " @@ -67,10 +65,10 @@ class Proxy::Impl : public boost::noncopyable } const std::string& deflectHost = - _channel->getView()->getSAttribute( View::SATTR_DISPLAYCLUSTER ); + _channel.getView()->getSAttribute( View::SATTR_DEFLECT_HOST ); const std::string& name = - _channel->getView()->getSAttribute( View::SATTR_PIXELSTREAM_NAME ); - _stream = new ::deflect::Stream( name, deflectHost ); + _channel.getView()->getSAttribute( View::SATTR_DEFLECT_ID ); + _stream.reset( new ::deflect::Stream( name, deflectHost )); if( !_stream->isConnected( )) { LBWARN << "Could not connect to Deflect host: " << deflectHost @@ -86,14 +84,11 @@ class Proxy::Impl : public boost::noncopyable { // wait for completion of previous send _sendFuture.wait(); - - delete _eventHandler; - delete _stream; } - void notifyNewImage( Channel& channel LB_UNUSED, const Image& image ) + void notifyNewImage( Channel& channel, const Image& image ) { - LBASSERT( &channel == _channel ); + LBASSERT( &channel == &_channel ); // wait for completion of previous send _running = _sendFuture.get(); @@ -106,7 +101,7 @@ class Proxy::Impl : public boost::noncopyable image.getPixelSize( Frame::BUFFER_COLOR )); // determine image offset wrt global view - const Viewport& vp = _channel->getViewport(); + const Viewport& vp = channel.getViewport(); const int32_t width = pvp.w / vp.w; const int32_t height = pvp.h / vp.h; const int32_t offsX = vp.x * width; @@ -120,25 +115,25 @@ class Proxy::Impl : public boost::noncopyable _sendFuture = _stream->asyncSend( imageWrapper ); } - ::deflect::Stream* _stream; - EventHandler* _eventHandler; - Channel* _channel; + std::unique_ptr< ::deflect::Stream > _stream; + std::unique_ptr< EventHandler > _eventHandler; + Channel& _channel; lunchbox::Bufferb _buffer; ::deflect::Stream::Future _sendFuture; bool _running; Proxy::NavigationMode _navigationMode; }; -Proxy::Proxy( Channel* channel ) +Proxy::Proxy( Channel& channel ) : ResultImageListener() , _impl( new Impl( channel )) { - channel->addResultImageListener( this ); + channel.addResultImageListener( this ); } Proxy::~Proxy() { - _impl->_channel->removeResultImageListener( this ); + _impl->_channel.removeResultImageListener( this ); } void Proxy::notifyNewImage( Channel& channel, const Image& image ) @@ -147,12 +142,12 @@ void Proxy::notifyNewImage( Channel& channel, const Image& image ) if( !_impl->_eventHandler && _impl->_stream->registerForEvents( true )) { - _impl->_eventHandler = new EventHandler( this ); + _impl->_eventHandler.reset( new EventHandler( this )); LBDEBUG << "Installed event handler for Deflect proxy" << std::endl; } } -Channel* Proxy::getChannel() +Channel& Proxy::getChannel() { return _impl->_channel; } diff --git a/eq/deflect/proxy.h b/eq/deflect/proxy.h index ff0f3a9e40..1adbe159de 100644 --- a/eq/deflect/proxy.h +++ b/eq/deflect/proxy.h @@ -31,7 +31,7 @@ class Proxy : public ResultImageListener { public: /** Construct a Deflect proxy associated to a destination channel. */ - explicit Proxy( Channel* channel ); + explicit Proxy( Channel& channel ); /** Destruct the Deflect proxy. */ ~Proxy(); @@ -40,7 +40,7 @@ class Proxy : public ResultImageListener void notifyNewImage( Channel& channel, const Image& image ) final; /** @return the associated destination channel. */ - Channel* getChannel(); + Channel& getChannel(); /** @return the underlying socket descriptor. */ int getSocketDescriptor() const; diff --git a/eq/fabric/view.h b/eq/fabric/view.h index df9c12b2d8..925d59566d 100644 --- a/eq/fabric/view.h +++ b/eq/fabric/view.h @@ -238,8 +238,8 @@ class View : public Object, public Frustum /** String attributes. */ enum SAttribute { - SATTR_DISPLAYCLUSTER, - SATTR_PIXELSTREAM_NAME, + SATTR_DEFLECT_HOST, + SATTR_DEFLECT_ID, SATTR_LAST, SATTR_ALL = SATTR_LAST + 5 }; diff --git a/eq/fabric/view.ipp b/eq/fabric/view.ipp index 95cf9bd676..7f0d1e1682 100644 --- a/eq/fabric/view.ipp +++ b/eq/fabric/view.ipp @@ -35,8 +35,8 @@ namespace { #define _MAKE_ATTR_STRING( attr ) ( std::string("EQ_VIEW_") + #attr ) static std::string _sAttributeStrings[] = { - _MAKE_ATTR_STRING( SATTR_DISPLAYCLUSTER ), - _MAKE_ATTR_STRING( SATTR_PIXELSTREAM_NAME ) + _MAKE_ATTR_STRING( SATTR_DEFLECT_HOST ), + _MAKE_ATTR_STRING( SATTR_DEFLECT_ID ) }; } diff --git a/eq/server/config.cpp b/eq/server/config.cpp index dda8f02eb5..5af039de5b 100644 --- a/eq/server/config.cpp +++ b/eq/server/config.cpp @@ -785,16 +785,22 @@ bool Config::_init( const uint128_t& initID ) _finishedFrame = 0; _initID = initID; - for( CompoundsCIter i = _compounds.begin(); i != _compounds.end(); ++i ) - (*i)->init(); + for( auto compound : _compounds ) + compound->init(); - const Observers& observers = getObservers(); - for( ObserversCIter i = observers.begin(); i != observers.end(); ++i ) - (*i)->init(); + for( auto observer : getObservers( )) + observer->init(); - const Canvases& canvases = getCanvases(); - for( CanvasesCIter i = canvases.begin(); i != canvases.end(); ++i ) - (*i)->init(); + for( auto canvas : getCanvases( )) + canvas->init(); + + const auto& layouts = getLayouts(); + for( auto layout : layouts ) + for( auto view : layout->getViews( )) + view->init(); + + // any of the above entities might have been updated + commit(); if( !_updateRunning( false )) return false; diff --git a/eq/server/loader.l b/eq/server/loader.l index 378c3faf87..bb795eade5 100644 --- a/eq/server/loader.l +++ b/eq/server/loader.l @@ -108,7 +108,7 @@ EQ_NODE_IATTR_HINT_STATISTICS { return EQTOKEN_NODE_IATTR_HINT_STATISTICS; } EQ_PIPE_IATTR_HINT_THREAD { return EQTOKEN_PIPE_IATTR_HINT_THREAD; } EQ_PIPE_IATTR_HINT_AFFINITY { return EQTOKEN_PIPE_IATTR_HINT_AFFINITY; } EQ_PIPE_IATTR_HINT_CUDA_GL_INTEROP { return EQTOKEN_PIPE_IATTR_HINT_CUDA_GL_INTEROP; } -EQ_VIEW_SATTR_DISPLAYCLUSTER { return EQTOKEN_VIEW_SATTR_DISPLAYCLUSTER; } +EQ_VIEW_SATTR_DEFLECT_HOST { return EQTOKEN_VIEW_SATTR_DEFLECT_HOST; } EQ_WINDOW_IATTR_HINT_CORE_PROFILE { return EQTOKEN_WINDOW_IATTR_HINT_CORE_PROFILE; } EQ_WINDOW_IATTR_HINT_OPENGL_MAJOR { return EQTOKEN_WINDOW_IATTR_HINT_OPENGL_MAJOR; } EQ_WINDOW_IATTR_HINT_OPENGL_MINOR { return EQTOKEN_WINDOW_IATTR_HINT_OPENGL_MINOR; } @@ -294,7 +294,7 @@ zoom { return EQTOKEN_ZOOM; } MONO { return EQTOKEN_MONO; } STEREO { return EQTOKEN_STEREO; } size { return EQTOKEN_SIZE; } -DisplayCluster { return EQTOKEN_DISPLAYCLUSTER; } +deflect_host { return EQTOKEN_DEFLECT_HOST; } dump_image { return EQTOKEN_DUMP_IMAGE; } [+-]?[0-9]+[\.][0-9]* { return EQTOKEN_FLOAT; } diff --git a/eq/server/loader.y b/eq/server/loader.y index d3e5f83f6b..bdeb7e470d 100644 --- a/eq/server/loader.y +++ b/eq/server/loader.y @@ -123,7 +123,7 @@ %token EQTOKEN_PIPE_IATTR_HINT_CUDA_GL_INTEROP %token EQTOKEN_PIPE_IATTR_HINT_THREAD %token EQTOKEN_PIPE_IATTR_HINT_AFFINITY -%token EQTOKEN_VIEW_SATTR_DISPLAYCLUSTER +%token EQTOKEN_VIEW_SATTR_DEFLECT_HOST %token EQTOKEN_WINDOW_IATTR_HINT_CORE_PROFILE %token EQTOKEN_WINDOW_IATTR_HINT_OPENGL_MAJOR %token EQTOKEN_WINDOW_IATTR_HINT_OPENGL_MINOR @@ -298,7 +298,7 @@ %token EQTOKEN_SIZE %token EQTOKEN_CORE %token EQTOKEN_SOCKET -%token EQTOKEN_DISPLAYCLUSTER +%token EQTOKEN_DEFLECT_HOST %token EQTOKEN_DUMP_IMAGE %union{ @@ -550,10 +550,10 @@ global: eq::server::Global::instance()->setChannelSAttribute( eq::server::Channel::SATTR_DUMP_IMAGE, $2 ); } - | EQTOKEN_VIEW_SATTR_DISPLAYCLUSTER STRING + | EQTOKEN_VIEW_SATTR_DEFLECT_HOST STRING { eq::server::Global::instance()->setViewSAttribute( - eq::server::View::SATTR_DISPLAYCLUSTER, $2 ); + eq::server::View::SATTR_DEFLECT_HOST, $2 ); } connectionType: @@ -834,10 +834,6 @@ viewFields: /*null*/ | viewFields viewField viewField: EQTOKEN_ATTRIBUTES '{' viewAttributes '}' | EQTOKEN_NAME STRING { view->setName( $2 ); } - | EQTOKEN_DISPLAYCLUSTER STRING /* backward compat */ - { - view->setSAttribute( eq::server::View::SATTR_DISPLAYCLUSTER, $2 ); - } | EQTOKEN_MODE { view->changeMode( eq::server::View::MODE_MONO ); } viewMode | EQTOKEN_VIEWPORT viewport @@ -875,9 +871,9 @@ viewMode: viewAttributes: /*null*/ | viewAttributes viewAttribute viewAttribute: - EQTOKEN_DISPLAYCLUSTER STRING + EQTOKEN_DEFLECT_HOST STRING { - view->setSAttribute( eq::server::View::SATTR_DISPLAYCLUSTER, $2 ); + view->setSAttribute( eq::server::View::SATTR_DEFLECT_HOST, $2 ); } canvas: EQTOKEN_CANVAS '{' { canvas = new eq::server::Canvas( config ); } diff --git a/eq/server/view.cpp b/eq/server/view.cpp index 948ff37529..01f325fce3 100644 --- a/eq/server/view.cpp +++ b/eq/server/view.cpp @@ -57,14 +57,6 @@ View::View( Layout* parent ) const SAttribute attr = static_cast< SAttribute >( i ); setSAttribute( attr, global->getViewSAttribute( attr )); } - - // All processes must share a common, unique pixelstream name - if( getSAttribute( View::SATTR_PIXELSTREAM_NAME ).empty( )) - { - const std::string name = "Equalizer_" + - lunchbox::make_UUID().getShortString(); - setSAttribute( View::SATTR_PIXELSTREAM_NAME, name); - } } View::~View() @@ -314,6 +306,15 @@ ViewPath View::getPath() const return path; } +void View::init() +{ + // All contributors to the same view must share the same Deflect ID for + // streaming to the same target. + if( getSAttribute( View::SATTR_DEFLECT_ID ).empty( )) + setSAttribute( View::SATTR_DEFLECT_ID, getName().empty() + ? "View " + getID().getShortString() : getName( )); +} + void View::trigger( const Canvas* canvas, const bool active ) { const Mode mode = getMode(); diff --git a/eq/server/view.h b/eq/server/view.h index 7ae31c1b89..7b22a5ebf7 100644 --- a/eq/server/view.h +++ b/eq/server/view.h @@ -72,6 +72,9 @@ class View : public fabric::View< Layout, View, Observer > /** @name Operations */ //@{ + /** Initialize the view parameters. */ + void init(); + /** * Trigger a view (de)activation. * @@ -86,9 +89,9 @@ class View : public fabric::View< Layout, View, Observer > * * @param mode the new rendering mode */ - virtual void activateMode( const Mode mode ); + void activateMode( const Mode mode ) override; - virtual void updateCapabilities(); + void updateCapabilities() override; /** Update all segment frusta based on the current settings. */ void updateFrusta(); @@ -96,13 +99,13 @@ class View : public fabric::View< Layout, View, Observer > void setSAttribute( const SAttribute attr, const std::string& value ) { fabric::View< Layout, View, Observer >::setSAttribute( attr, value ); } - virtual void setDirty( const uint64_t bits ); //!< @internal + void setDirty( const uint64_t bits ) override; //!< @internal //@} protected: /** @internal */ - virtual void deserialize( co::DataIStream&, const uint64_t ); - virtual void notifyAttached() { _updateChannels(); } + void deserialize( co::DataIStream&, const uint64_t ) override; + void notifyAttached() override { _updateChannels(); } private: /** The list of channels. */ diff --git a/examples/configs/1-pipe.DC.eqc b/examples/configs/1-pipe.Tide.eqc similarity index 83% rename from examples/configs/1-pipe.DC.eqc rename to examples/configs/1-pipe.Tide.eqc index 48733fdc16..df1ff203ae 100644 --- a/examples/configs/1-pipe.DC.eqc +++ b/examples/configs/1-pipe.Tide.eqc @@ -1,6 +1,6 @@ #Equalizer 1.1 ascii -# one-pipe configuration that streams its output to DisplayCluster +# one-pipe configuration that streams its output to a local Deflect host (Tide) server { @@ -26,7 +26,7 @@ server observer 0 attributes { - DisplayCluster "localhost" + deflect_host "localhost" } } } diff --git a/seq/types.h b/seq/types.h index 0a08c379e8..0b04998078 100644 --- a/seq/types.h +++ b/seq/types.h @@ -31,6 +31,7 @@ using eq::Matrix4f; using eq::PixelViewport; using eq::uint128_t; using eq::util::ObjectManager; +using eq::Vector2i; using eq::Vector2f; using eq::Vector3f; using eq::Vector4f;