Equalizer logo
Collage logo
GPU-SD logo

Interruptible Rendering

Author: Stefan Eilemann

State: Design

Overview

This feature adds the capability for an application to interrupt its current rendering operations, without waiting for them to be finished.

Requirements

API

void Config::stopFrames(); // callable from any application thread
/** called from command thread */
virtual void Channel::notifyStopFrame( const uint32_t lastFrameNumber )

Implementation

Modification Library and Server

The application decide to do a frames stop. The Config send the command to the config server.

 Add new Command CMD_CONFIG_STOP_FRAMES
  Add new PACKET ConfigStopFramesPacket
       uint32_t lastFrameNumber
  void Config::stopFrames
       send stopFrames Packet to the config server

The server receive a command to stop the current working frame. Each activated channel must be send to all node the stop Frame.

 void server::Config::_cmdStopFrames
  for Each Compound
     if it's destination compound
       if compound->channel->isActive()
          send packet stopFrame
  Add new Command CMD_CHANNEL_STOP_FRAME
  Add new PACKET ChannelStopFramePacket

All node Channel receive the command to stop the current working frame.

Add client::channel::_cmdStopFrames
   call channel::notifyStopFrame( lastFrameNumber );
virtual channel::notifyStopFrame( const uint32_t lastFrameNumber )
   do nothing;

EqPly

modify eqPly::Channel for stop the current rendering until the frame id = lastFrameNumber

init frameStartRendering = 0;
Add virtual channel::notifyStopFrames( const uint32_t lastFrameNumber )
   set frameStartRendering = lastFrameNumber + 1
Add bool _stopRendering( const uint32_t frameID ) const
    return frameID < frameStartRendering
In frameClear, frameDraw, frameAssemble, frameStart, frameViewStart,
   frameFinsh and frameViewFinish we start with the following test code
     if( _stopRendering( ))
        return;
In _drawModel:
   Add new method VertexBufferState::stopRendering
   Implement in VertexBufferStateSimple (true) and
   VertexBufferStateEq( ask channel)
   use stopRendering in VertexBufferNode/Leaf::render()

in eqPly::config add the trigger with the space bar command

Issues

Q1: Is the stop on the Channel side done using a flag or a notification?

Resolved: Use a notification:

A flag forces a poll-based implementation where the application regularly polls the state of the flag. A notification leaves this to the application, which can set a flag if it wishes this type of implementation, or use another mechanism, e.g., a signal.

The reset of the flag is difficult for the application to implement, since it should be reset by the next frame started from the application. The client can't distinguish between queued frames (before the stop) and new frames (after the stop). This is solved by passing the last frame already started (before the stop) as a parameter for the notification.

Q2: What happens to blocked tasks, e.g., frameAssemble or swapBarrier?

Resolved: All pending tasks are executed.

The frameReadback on the sources will either readback and transmit a partial result, or preferably transmit no image data (application dependent). This unblocks the destination after the transmit (typically <100ms) or immediately.

The application has to make sure to not render in queued but stopped frames.

The swap task will be executed by Equalizer, but has little runtime overhead.

Q3: Is the rendering pipeline flushed by stopFrames?

Resolved: No.

The application calls interrupt from any thread, and can call finishAllFrames when it regains control of its main loop. Even if finishAllFrames is not called operations will function properly.