LCOV - code coverage report
Current view: top level - eq/client/detail - channel.ipp (source / functions) Hit Total Coverage
Test: lcov2.info Lines: 17 17 100.0 %
Date: 2014-06-18 Functions: 5 6 83.3 %

          Line data    Source code
       1             : 
       2             : /* Copyright (c) 2012, Stefan Eilemann <eile@eyescale.ch>
       3             :  *               2013, Julio Delgado Mangas <julio.delgadomangas@epfl.ch>
       4             :  *
       5             :  * This library is free software; you can redistribute it and/or modify it under
       6             :  * the terms of the GNU Lesser General Public License version 2.1 as published
       7             :  * by the Free Software Foundation.
       8             :  *
       9             :  * This library is distributed in the hope that it will be useful, but WITHOUT
      10             :  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
      11             :  * FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public License for more
      12             :  * details.
      13             :  *
      14             :  * You should have received a copy of the GNU Lesser General Public License
      15             :  * along with this library; if not, write to the Free Software Foundation, Inc.,
      16             :  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
      17             :  */
      18             : 
      19             : #include "../channel.h"
      20             : #include "fileFrameWriter.h"
      21             : 
      22             : #include <eq/fabric/drawableConfig.h>
      23             : 
      24             : #ifdef EQUALIZER_USE_DISPLAYCLUSTER
      25             : #  include "../dc/proxy.h"
      26             : #endif
      27             : 
      28             : namespace eq
      29             : {
      30             : 
      31             : namespace detail
      32             : {
      33             : enum State
      34             : {
      35             :     STATE_STOPPED,
      36             :     STATE_INITIALIZING,
      37             :     STATE_RUNNING,
      38             :     STATE_FAILED
      39             : };
      40             : 
      41             : class Channel
      42             : {
      43             : public:
      44         825 :     Channel()
      45             :             : state( STATE_STOPPED )
      46             :             , fbo( 0 )
      47         825 :             , initialSize( Vector2i::ZERO )
      48             : #ifdef EQUALIZER_USE_DISPLAYCLUSTER
      49             :             , _dcProxy( 0 )
      50             : #endif
      51             :         {
      52         825 :             lunchbox::RNG rng;
      53         825 :             color.r() = rng.get< uint8_t >();
      54         825 :             color.g() = rng.get< uint8_t >();
      55         825 :             color.b() = rng.get< uint8_t >();
      56         825 :         }
      57             : 
      58          15 :     ~Channel()
      59          15 :         {
      60          15 :             statistics->clear();
      61          15 :             LBASSERT( !fbo );
      62          15 :         }
      63             : 
      64           5 :     void frameViewFinish( eq::Channel * channel )
      65             :     {
      66           5 :         if( !channel->getSAttribute(channel->SATTR_DUMP_IMAGE).empty( ))
      67           1 :             frameWriter.write( channel );
      68             : 
      69             :     #ifdef EQUALIZER_USE_DISPLAYCLUSTER
      70             :         if( _dcProxy )
      71             :         {
      72             :             if( !_dcProxy->isRunning( ))
      73             :             {
      74             :                 delete _dcProxy;
      75             :                 _dcProxy = 0;
      76             :             }
      77             :             else
      78             :                 _dcProxy->swapBuffer();
      79             :         }
      80             :     #endif
      81           5 :     }
      82             : 
      83             :     /** The channel's drawable config (FBO). */
      84             :     DrawableConfig drawableConfig;
      85             : 
      86             :     /** The configInit/configExit state. */
      87             :     State state;
      88             : 
      89             :     /** Used as an alternate drawable. */
      90             :     util::FrameBufferObject* fbo;
      91             : 
      92             :     /** A random, unique color for this channel. */
      93             :     Vector3ub color;
      94             : 
      95             :     typedef std::vector< Statistic > Statistics;
      96          60 :     struct FrameStatistics
      97             :     {
      98             :         Statistics data; //!< all events for one frame
      99             :         eq::Viewport region; //!< from draw for equalizers
     100             :         /** reference count by pipe and transmit thread */
     101             :         lunchbox::a_int32_t used;
     102             :     };
     103             : 
     104             :     typedef std::vector< FrameStatistics > StatisticsRB;
     105             :     typedef StatisticsRB::const_iterator StatisticsRBCIter;
     106             : 
     107             :     /** Global statistics events, index per frame and channel. */
     108             :     lunchbox::Lockable< StatisticsRB, lunchbox::SpinLock > statistics;
     109             : 
     110             :     /** The initial channel size, used for view resize events. */
     111             :     Vector2i initialSize;
     112             : 
     113             :     /** The application-declared regions of interest, merged if
     114             :         necessary to be non overlapping. */
     115             :     PixelViewports regions;
     116             : 
     117             :     /** The number of the last finished frame. */
     118             :     lunchbox::Monitor< uint32_t > finishedFrame;
     119             : 
     120             : #ifdef EQUALIZER_USE_DISPLAYCLUSTER
     121             :     dc::Proxy* _dcProxy;
     122             : #endif
     123             : 
     124             :     /** Dumps images when the channel is configured to do so */
     125             :     FileFrameWriter frameWriter;
     126             : };
     127             : 
     128             : }
     129             : }

Generated by: LCOV version 1.10