示例#1
0
bool Config::init()
{
    // init distributed objects
    LBCHECK(registerObject(&_frameData));

    _frameData.setOrtho(_initData.getOrtho());
    _initData.setFrameDataID(_frameData.getID());

    _frameData.setAutoObsolete(getLatency());

    LBCHECK(registerObject(&_initData));

    // init config
    if (!eq::Config::init(_initData.getID()))
    {
        _deregisterData();
        return false;
    }

    const eq::Canvases& canvases = getCanvases();
    if (canvases.empty())
        _currentCanvas = 0;
    else
        _currentCanvas = canvases.front();

    _setMessage("Welcome to eVolve\nPress F1 for help");

    return true;
}
示例#2
0
void FrameData::registerObjects( )
{
    LBASSERT( _objectMap );
    LBCHECK( registerObject( _objectMap, _frameSettings, SMI_FRAME_SETTINGS ));
    LBCHECK( registerObject( _objectMap, _renderSettings, SMI_RENDER_SETTINGS ));
    LBCHECK( registerObject( _objectMap, _cameraSettings, SMI_CAMERA_SETTINGS ));
    LBCHECK( registerObject( _objectMap, _volumeSettings, SMI_VOLUME_SETTINGS ));
    LBCHECK( registerObject( _objectMap, _vrParameters, SMI_VR_PARAMETERS ));
}
示例#3
0
void FrameData::deregisterObjects( )
{
    LBASSERT( _objectMap );
    LBCHECK( deregisterObject( _objectMap, _frameSettings ));
    LBCHECK( deregisterObject( _objectMap, _renderSettings ));
    LBCHECK( deregisterObject( _objectMap, _cameraSettings ));
    LBCHECK( deregisterObject( _objectMap, _volumeSettings ));
    LBCHECK( deregisterObject( _objectMap, _vrParameters ));
}
示例#4
0
void Channel::unsetOutput()
{
    LBASSERT( _view && _segment );

    LBCHECK( _view->removeChannel( this ));
    LBCHECK( _segment->removeDestinationChannel( this ));

    _view    = 0;
    _segment = 0;
}
示例#5
0
void FrameData::unmapObjects( )
{
    if( !_objectMap )
        return;
    LBCHECK( _objectMap->unmap( _frameSettings.get( )));
    LBCHECK( _objectMap->unmap( _renderSettings.get( )));
    LBCHECK( _objectMap->unmap( _cameraSettings.get( )));
    LBCHECK( _objectMap->unmap( _volumeSettings.get( )));
    LBCHECK( _objectMap->unmap( _vrParameters.get( )));
    _objectMap->clear();
}
示例#6
0
bool Dispatcher::dispatchCommand( ICommand& command )
{
    LBASSERT( command.isValid( ));

    LBVERB << "dispatch " << command << " on " << lunchbox::className( this )
           << std::endl;

    const uint32_t which = command.getCommand();
#ifndef NDEBUG
    if( which >= _impl->qTable.size( ))
    {
        LBABORT( "ICommand " << command
                 << " higher than number of registered command handlers ("
                 << _impl->qTable.size() << ") for object of type "
                 << lunchbox::className( this ) << std::endl );
        return false;
    }
#endif

    CommandQueue* queue = _impl->qTable[ which ];
    if( queue )
    {
        command.setDispatchFunction( _impl->fTable[ which ] );
        queue->push( command );
        return true;
    }
    // else

    LBCHECK( _impl->fTable[ which ]( command ));
    return true;
}
示例#7
0
bool MasterConfig::run( co::Object* frameData )
{
    LBASSERT( _objects );
    if( frameData )
        LBCHECK( _objects->register_( frameData, OBJECTTYPE_FRAMEDATA ));
    _objects->setFrameData( frameData );

    seq::Application* const app = getApplication();
    while( isRunning( ))
    {
        startFrame();
        if( getError( ))
            LBWARN << "Error during frame start: " << getError() << std::endl;
        finishFrame();

        while( !needRedraw( )) // wait for an event requiring redraw
        {
            if( app->hasCommands( )) // execute non-critical pending commands
            {
                app->processCommand();
                handleEvents(); // non-blocking
            }
            else  // no pending commands, block on user event
            {
                const eq::EventCommand& event = getNextEvent();
                if( !handleEvent( event ))
                    LBVERB << "Unhandled " << event << std::endl;
            }
        }
        handleEvents(); // process all pending events
    }
    finishAllFrames();
    return true;
}
示例#8
0
文件: node.cpp 项目: VMML/Equalizer
bool Node::_cmdFrameDataTransmit( co::ICommand& cmd )
{
    co::ObjectICommand command( cmd );

    const co::ObjectVersion& frameDataVersion =
                                             command.read< co::ObjectVersion >();
    const PixelViewport& pvp = command.read< PixelViewport >();
    const Zoom& zoom = command.read< Zoom >();
    const uint32_t buffers = command.read< uint32_t >();
    const uint32_t frameNumber = command.read< uint32_t >();
    const bool useAlpha = command.read< bool >();
    const uint8_t* data = reinterpret_cast< const uint8_t* >(
                command.getRemainingBuffer( command.getRemainingBufferSize( )));

    LBLOG( LOG_ASSEMBLY )
        << "received image data for " << frameDataVersion << ", buffers "
        << buffers << " pvp " << pvp << std::endl;

    LBASSERT( pvp.isValid( ));

    FrameDataPtr frameData = getFrameData( frameDataVersion );
    LBASSERT( !frameData->isReady() );

    NodeStatistics event( Statistic::NODE_FRAME_DECOMPRESS, this,
                          frameNumber );

    // Note on the const_cast: since the PixelData structure stores non-const
    // pointers, we have to go non-const at some point, even though we do not
    // modify the data.
    LBCHECK( frameData->addImage( frameDataVersion, pvp, zoom, buffers,
                                  useAlpha, const_cast< uint8_t* >( data )));
    return true;
}
示例#9
0
uint32_t ObjectStore::_startSync( Object* object, NodePtr master,
                                  const uint128_t& id,
                                  const uint32_t instanceID )
{
    LB_TS_NOT_THREAD( _receiverThread );
    LBLOG( LOG_OBJECTS )
            << "Syncing " << lunchbox::className( object ) << " with id " << id
            << std::endl;
    LBASSERT( object );
    LBASSERTINFO( id.isUUID(), id );

    if( !object || !id.isUUID( ))
    {
        LBWARN << "Invalid object " << object << " or id " << id << std::endl;
        return LB_UNDEFINED_UINT32;
    }

    if( !master )
        master = _localNode->connectObjectMaster( id );

    if( !master || !master->isReachable( ))
    {
        LBWARN << "Mapping of object " << id << " failed, invalid master node"
               << std::endl;
        return LB_UNDEFINED_UINT32;
    }

    const uint32_t request =
        _localNode->registerRequest( new ObjectDataIStream );
    uint128_t minCachedVersion = VERSION_HEAD;
    uint128_t maxCachedVersion = VERSION_NONE;
    uint32_t cacheInstanceID = 0;

    bool useCache = _checkInstanceCache( id, minCachedVersion, maxCachedVersion,
                                         cacheInstanceID );
    if( useCache )
    {
        switch( instanceID )
        {
        case CO_INSTANCE_ALL:
            break;
        default:
            if( instanceID == cacheInstanceID )
                break;

            useCache = false;
            LBCHECK( _instanceCache->release( id, 1 ));
            break;
        }
    }

    // Use stream expected by MasterCMCommand
    master->send( CMD_NODE_SYNC_OBJECT )
            << VERSION_NEWEST << minCachedVersion << maxCachedVersion << id
            << uint64_t(0) /* maxVersions */ << request << instanceID
            << cacheInstanceID << useCache;
    return request;
}
示例#10
0
文件: client.cpp 项目: VMML/Equalizer
void Client::processCommand( const uint32_t timeout )
{
    co::CommandQueue* queue = getMainThreadQueue();
    LBASSERT( queue );
    co::ICommand command = queue->pop( timeout );
    if( !command.isValid( )) // wakeup() or timeout
        return;

    LBCHECK( command( ));
}
示例#11
0
文件: node.cpp 项目: VMML/Equalizer
void detail::TransmitThread::run()
{
    while( true )
    {
        co::ICommand command = _queue.pop();
        if( !command.isValid( ))
            return; // exit thread

        LBCHECK( command( ));
    }
}
示例#12
0
Frame* Pipe::getFrame( const co::ObjectVersion& frameVersion, const Eye eye,
                       const bool isOutput )
{
    LB_TS_THREAD( _pipeThread );
    Frame* frame = _impl->frames[ frameVersion.identifier ];

    if( !frame )
    {
        ClientPtr client = getClient();
        frame = new Frame();

        LBCHECK( client->mapObject( frame, frameVersion ));
        _impl->frames[ frameVersion.identifier ] = frame;
    }
    else
        frame->sync( frameVersion.version );

    const co::ObjectVersion& dataVersion = frame->getDataVersion( eye );
    LBLOG( LOG_ASSEMBLY ) << "Use " << dataVersion << std::endl;

    FrameDataPtr frameData = getNode()->getFrameData( dataVersion );
    LBASSERT( frameData );

    if( isOutput )
    {
        if( !frameData->isAttached() )
        {
            ClientPtr client = getClient();
            LBCHECK( client->mapObject( frameData.get(), dataVersion ));
        }
        else if( frameData->getVersion() < dataVersion.version )
            frameData->sync( dataVersion.version );

        _impl->outputFrameDatas[ dataVersion.identifier ] = frameData;
    }
    else
        _impl->inputFrameDatas[ dataVersion.identifier ] = frameData;

    frame->setFrameData( frameData );
    return frame;
}
示例#13
0
void Config::mapData( const eq::uint128_t& initDataID )
{
    if( !_initData.isAttached( ))
    {
        LBCHECK( mapObject( &_initData, initDataID ));
        releaseData(); // data was retrieved, unmap immediately
    }
    else  // appNode, _initData is registered already
    {
        LBASSERT( _initData.getID() == initDataID );
    }
}
示例#14
0
void FrameData::mapObjects( )
{
    LBASSERT( objectMapPtr_ );
    LBCHECK( mapObject( objectMapPtr_,
                        objectFactoryPtr_,
                        frameSettingsPtr_,
                        SMI_FRAME_SETTINGS ) );

    LBCHECK( mapObject( objectMapPtr_,
                        objectFactoryPtr_,
                        renderSettingsPtr_,
                        SMI_RENDER_SETTINGS ) );

    LBCHECK( mapObject( objectMapPtr_,
                        objectFactoryPtr_,
                        cameraSettingsPtr_,
                        SMI_CAMERA_SETTINGS ) );

    LBCHECK( mapObject( objectMapPtr_,
                        objectFactoryPtr_,
                        volumeSettingsPtr_,
                        SMI_VOLUME_SETTINGS ) );

    LBCHECK( mapObject( objectMapPtr_,
                        objectFactoryPtr_,
                        clientParametersPtr_,
                        SMI_CLIENT_PARAMETERS ) );

    LBCHECK( mapObject( objectMapPtr_,
                        objectFactoryPtr_,
                        vrParametersPtr_,
                        SMI_VR_PARAMETERS ) );
}
示例#15
0
void detail::TransmitThread::run()
{
    lunchbox::Thread::setName( std::string( "Trm " ) +
                               lunchbox::className( _node ));
    while( true )
    {
        co::ICommand command = _queue.pop();
        if( !command.isValid( ))
            return; // exit thread

        LBCHECK( command( ));
    }
}
示例#16
0
    ConnectionSet()
           : selfConnection( new EventConnection )
#ifdef _WIN32
           , thread( 0 )
#endif
           , error( 0 )
           , dirty( true )
    {
        // Whenever another threads modifies the connection list while the
        // connection set is waiting in a select, the select is interrupted
        // using this connection.
        LBCHECK( selfConnection->connect( ));
    }
示例#17
0
bool Config::mapData( const eq::uint128_t& initDataID )
{
    if( !_initData.isAttached( ))
    {
        LBCHECK( mapObject( &_initData, initDataID ) );
        unmapObject( &_initData );
    }
    else
    {
        LBASSERT( _initData.getID() == initDataID );
    }
    return true;
}
示例#18
0
bool MasterConfig::init()
{
    LBASSERT( !_objects );
    _objects = new ObjectMap( *this, *getApplication( ));

    co::Object* initData = getInitData();
    if( initData )
        LBCHECK( _objects->register_( initData, OBJECTTYPE_INITDATA ));
    _objects->setInitData( initData );

    LBCHECK( registerObject( _objects ));

    if( !eq::Config::init( _objects->getID( )))
    {
        LBWARN << "Error during initialization" << std::endl;
        exit();
        return false;
    }

    _redraw = true;
    return true;
}
示例#19
0
void Window::_enterBarrier( co::ObjectVersion barrier )
{
    LBLOG( co::LOG_BARRIER ) << "swap barrier " << barrier << " " << getName()
                             << std::endl;
    Node* node = getNode();
    co::Barrier* netBarrier = node->getBarrier( barrier );
    if( !netBarrier )
        return;

    WindowStatistics stat( Statistic::WINDOW_SWAP_BARRIER, this );
    Config* config = getConfig();
    const uint32_t timeout = config->getTimeout()/2;
    LBCHECK( netBarrier->enter( timeout ));
}
示例#20
0
void Node::TransmitThread::run()
{
    lunchbox::Thread::setName( std::string( "Trm " ) +
                               lunchbox::className( _node ));
    while( true )
    {
        co::Command* command = _queue.pop();
        if( !command )
            return; // exit thread

        LBCHECK( (*command)( ));
        command->release();
    }
}
示例#21
0
void BufferConnection::sendBuffer( ConnectionPtr connection )
{
    if( _impl->buffer.isEmpty( ))
        return;

    if( !connection )
    {
        LBWARN << "NULL connection during buffer write" << std::endl;
        return;
    }

    LBCHECK( connection->send( _impl->buffer.getData(),
                               _impl->buffer.getSize() ));
    _impl->buffer.setSize( 0 );
}
示例#22
0
文件: Window.cpp 项目: rdumusc/Livre
    void startUploadProcessors()
    {
#ifdef _MSC_VER
        // https://www.opengl.org/discussion_boards/showthread.php/152648-wglShareLists-failing
        LBCHECK( wglMakeCurrent( 0,0 ));
#endif
        if( !_textureUploader->isRunning( ))
            _textureUploader->start();

        if( !_dataUploader->isRunning( ))
            _dataUploader->start();
#ifdef _MSC_VER
        _window->makeCurrent( false );
#endif
    }
示例#23
0
//---------------------------------------------------------------------------
// command handlers
//---------------------------------------------------------------------------
bool Window::_cmdCreateChannel( co::Command& command )
{
    const WindowCreateChannelPacket* packet =
        command.get<WindowCreateChannelPacket>();
    LBLOG( LOG_INIT ) << "Create channel " << packet << std::endl;

    Channel* channel = Global::getNodeFactory()->createChannel( this );
    channel->init(); // not in ctor, virtual method

    Config* config = getConfig();
    LBCHECK( config->mapObject( channel, packet->channelID ));
    LBASSERT( channel->getSerial() != EQ_INSTANCE_INVALID );

    return true;
}
示例#24
0
void FrameData::deregisterObjects( )
{
    LBASSERT( objectMapPtr_ );
    LBCHECK( deregisterObject( objectMapPtr_, frameSettingsPtr_ ) );
    LBCHECK( deregisterObject( objectMapPtr_, renderSettingsPtr_ ) );
    LBCHECK( deregisterObject( objectMapPtr_, cameraSettingsPtr_ ) );
    LBCHECK( deregisterObject( objectMapPtr_, volumeSettingsPtr_ ) );
    LBCHECK( deregisterObject( objectMapPtr_, clientParametersPtr_ ) );
    LBCHECK( deregisterObject( objectMapPtr_, vrParametersPtr_ ) );
}
示例#25
0
//---------------------------------------------------------------------------
// command handlers
//---------------------------------------------------------------------------
bool Pipe::_cmdCreateWindow( co::ICommand& cmd )
{
    co::ObjectICommand command( cmd );
    const UUID windowID = command.get< UUID >();

    LBLOG( LOG_INIT ) << "Create window " << command << " id " << windowID
                      << std::endl;

    Window* window = Global::getNodeFactory()->createWindow( this );
    window->init(); // not in ctor, virtual method

    Config* config = getConfig();
    LBCHECK( config->mapObject( window, windowID ));

    return true;
}
示例#26
0
//---------------------------------------------------------------------------
// command handlers
//---------------------------------------------------------------------------
bool Window::_cmdCreateChannel( co::ICommand& cmd )
{
    co::ObjectICommand command( cmd );
    const uint128_t& channelID = command.read< uint128_t >();

    LBLOG( LOG_INIT ) << "Create channel " << command  << " id " << channelID
                      << std::endl;

    Channel* channel = Global::getNodeFactory()->createChannel( this );
    channel->init(); // not in ctor, virtual method

    Config* config = getConfig();
    LBCHECK( config->mapObject( channel, channelID ));
    LBASSERT( channel->getSerial() != CO_INSTANCE_INVALID );

    return true;
}
示例#27
0
void FrameData::unmapObjects( )
{
    if( !objectMapPtr_ )
        return;
    LBCHECK( objectMapPtr_->unmap( frameSettingsPtr_.get() ) );
    LBCHECK( objectMapPtr_->unmap( renderSettingsPtr_.get() ) );
    LBCHECK( objectMapPtr_->unmap( cameraSettingsPtr_.get() ) );
    LBCHECK( objectMapPtr_->unmap( volumeSettingsPtr_.get() ) );
    LBCHECK( objectMapPtr_->unmap( clientParametersPtr_.get() ) );
    LBCHECK( objectMapPtr_->unmap( vrParametersPtr_.get() ) );
    objectMapPtr_->clear();
}
示例#28
0
//---------------------------------------------------------------------------
// command handlers
//---------------------------------------------------------------------------
bool Node::_cmdCreatePipe( co::Command& command )
{
    const NodeCreatePipePacket* packet = 
        command.get<NodeCreatePipePacket>();
    LBLOG( LOG_INIT ) << "Create pipe " << packet << std::endl;
    LB_TS_THREAD( _nodeThread );
    LBASSERT( _state >= STATE_INIT_FAILED );

    Pipe* pipe = Global::getNodeFactory()->createPipe( this );
    if( packet->threaded )
        pipe->startThread();

    Config* config = getConfig();
    LBCHECK( config->mapObject( pipe, packet->pipeID ));
    pipe->notifyMapped();

    return true;
}
示例#29
0
bool EventConnection::connect()
{
    if( !isClosed( ))
        return false;

    _setState( STATE_CONNECTING );

#ifdef _WIN32
    _event = CreateEvent( 0, TRUE, FALSE, 0 );
#else
    _connection = new PipeConnection;
    LBCHECK( _connection->connect( ));
    _set = false;
#endif

    _setState( STATE_CONNECTED );
    return true;
}
示例#30
0
co::QueueSlave* Pipe::getQueue( const UUID& queueID )
{
    LB_TS_THREAD( _pipeThread );
    if( queueID == 0 )
        return 0;

    co::QueueSlave* queue = _impl->queues[ queueID ];
    if( !queue )
    {
        queue = new co::QueueSlave;
        ClientPtr client = getClient();
        LBCHECK( client->mapObject( queue, queueID ));

        _impl->queues[ queueID ] = queue;
    }

    return queue;
}