Display Driver Plug-ins

group DD

Functions

void encodeLegacyName(const std::string &legacyFrameName, int legacyFrameNumber, std::string &buffer)

This is a utility function to allow the simple encoding of legacy frameNames and frame numbers to be used with the latest Render Data Protocol.

Parameters:
  • legacyFrameName[in] the frame name to be encoded.

  • legacyFrameNumber[in] the frame number to be encoded.

  • buffer[out] where the encoding can be found.

class CloseMessage : public Foundry::Katana::Message
#include <CloseMessage.h>

The CloseMessage class encapsulates the message sent to Katana instructing it that there is no more data for the specified channel.

The CloseMessage message should only be sent down the pipe when no more data is to be sent for the channel.

It is un-likely you will ever need to directly instantiate this class as it is handled for you in the closeChannel method of the KatanaPipe.

See also

KatanaPipe.

Public Functions

explicit CloseMessage(const NewChannelMessage &channel)

Create a new instance of a CloseMessage message that, when sent to Katana will let the Catalog Server know that there is no more data to be sent through for this specified channel.

Parameters:

channel[in] the channel object that will be closed

explicit CloseMessage(const uint8_t *frameID, uint16_t channelID = 0)

Create a new instance of a CloseMessage message that, when sent to Katana will let the Catalog Server know that there is no more data to be sent through for this specified channel.

Parameters:
  • frameID[in] a pointer to a 16 byte array containing a unique frameID

  • channelID[in] the channel ID for the channel that should be closed.

inline virtual ~CloseMessage()
class DataMessage : public Foundry::Katana::Message
#include <DataMessage.h>

The DataMessage class encapsulates the message sent to the Katana Catalog Server (KCS) which actually contains image data for a given channel.

The DataMessage message should be sent down the KatanaPipe after a NewFrame & NewChannel messages have been sent.

A DataMessage represents a region of pixel data within a particular channel. The region may be as small as 1 pixel or as large as the whole channel. i.e. you can send the entire channel’s data in on DataMessage.

Any chunks of data passed to the DataMessage will be copied by the instance and sent asynchronously on an I/O thread.

Public Functions

DataMessage(const NewChannelMessage &channel, uint32_t xMin = 0, uint32_t width = 0, uint32_t yMin = 0, uint32_t height = 0, uint32_t byteSkip = 0)

Create a new instance of a DataMessage message using an existing NewChannel object to obtain the unique frame ID and channel ID.

The default constructor will create a DataMessage belonging to the specified channel with all values set to 0 and an empty data buffer.

See also

setData()

Parameters:
  • channel[in] an existing NewChannel object

  • xMin[in] the starting x coordinate in the channel relative to the channel’s origin

  • width[in] the number of pixels wide this data extends for.

  • yMin[in] the starting y coordinate in the channel relative to the channel’s origin.

  • height[in] the number of pixels high this data extends for.

  • byteSkip[in] number of bytes to skip over to get to next pixel data (this is also stored in the channel data but, added here if the data packets differ for any reason).

DataMessage(const uint8_t *frameID, uint16_t channelID = 0, uint32_t xMin = 0, uint32_t width = 0, uint32_t yMin = 0, uint32_t height = 0, uint32_t byteSkip = 0)

Create a new instance of a DataMessage message using a pointer to a 16 byte array containing a unique frame ID.

The default constructor will create a DataMessage belonging to the specified channel with all values set to 0 and an empty data buffer.

See also

setData()

Parameters:
  • frameID[in] a pointer to a 16 byte array containing a unique frameID

  • channelID[in] the channel ID for the channel this data belongs to.

  • xMin[in] the starting x coordinate in the channel relative to the channel’s origin

  • width[in] the number of pixels wide this data extends for.

  • yMin[in] the starting y coordinate in the channel relative to the channel’s origin.

  • height[in] the number of pixels high this data extends for.

  • byteSkip[in] number of bytes to skip over to get to next pixel data (this is also stored in the channel data but, added here if the data packets differ for any reason).

inline virtual ~DataMessage()

Destroy the DataMessage instance and free any resources it holds.

void setData(const void *data, uint32_t size, FnPixelDataDeleter pixelDataDeleter = NULL)

Set the data payload for this DataMessage.

Sets the data payload for this message to the buffer pointed to by data by copying it into an internal buffer.

Data pointed to by data will remain under the control of the caller unless the user provides an FnPixelDataDeleter. In which case, the DataMessage will take ownership of the buffer and call the free function when the buffer is no longer required. If using an FnPixelDataDeleter it is not safe to access the data buffer once KatanaPipe::send() has been called.

Note: 4-channel color data is expected to be encoded as ARGB unless modified by the NewChannelMessage.

Parameters:
  • data[in] - pointer to the array data

  • size[in] - size of the data to be sent.

  • pixelDataDeleter[in] - function that if specified .

void setStartCoordinates(uint32_t x, uint32_t y)
void setDataDimensions(uint32_t width, uint32_t height)
void setByteSkip(uint32_t byteSkip)
const uint8_t *frameUUID() const

Get the unique 128 bit identifier that is assigned to the frame this data message is a member of.

Returns:

a pointer to the start of the 16 byte array that contains the unique frame ID.

uint16_t channelID() const
uint32_t xMin() const
uint32_t width() const
uint32_t yMin() const
uint32_t height() const
uint32_t bufferSize() const
const void *dataBuffer() const

Returns the data buffer that will be sent when KatanaPipe::send() is called.

Note

If setData() was called with an FnPixelDataDeleter function this method will return NULL after a call to KatanaPipe::send().

uint32_t byteSkip() const
class EndOfRenderMessage : public Foundry::Katana::Message
#include <EndOfRenderMessage.h>

The EndOfRenderMessage class encapsulates the message sent to Katana instructing it that there is no more data for the specified channel and it can clear up any data structures that it maintains for this channel.

The EndOfRender message should only be sent down the pipe when no more data is to be sent for the channel.

See also

KatanaPipe.

Public Functions

explicit EndOfRenderMessage(const NewChannelMessage &channel)

Create a new instance of a EndOfRenderMessage message that, when sent to Katana will let the Catalog Server know that there is no more data to be sent through for this specified channel.

Parameters:

channel[in] the channel object that will be closed

explicit EndOfRenderMessage(const uint8_t *frameID, uint16_t channelID = 0)

Create a new instance of a EndOfRenderMessage message that, when sent to Katana will let the Catalog Server know that there is no more data to be sent through for this specified channel.

Parameters:
  • frameID[in] a pointer to a 16 byte array containing a unique frameID

  • channelID[in] the channel ID for the channel that should be closed.

inline virtual ~EndOfRenderMessage()
class KatanaPipe
#include <KatanaPipe.h>

The KatanaPipe is used to send messages to the specified Katana Catalog Server.

It is a uni-directional communication pipe that allows a message to be sent to the end-point specified in the constructor. The end-point will usually be Katana however any process implementing the Render Data Protocol could serve as the end-point.

Very important The pipe is not thread safe. If you require communication capabilities from more than a single thread you should create an instance of the KatanaPipe for each thread however you should find this is not necessary.

Public Functions

KatanaPipe(const std::string &hostName, unsigned int portNumber, size_t maxQueueSize, int linger = -1)

Create a new instance of the KatanaPipe which will be connected to the specified host name and port number.

The constructor will not attempt to create the actual connection to the specified host name and port number. To do this you must call connect()

See also

connect()

Parameters:
  • hostName[in] a host name that specifies the end point to be connected to. This must be network visible from the host you are connecting from.

  • portNumber[in] the TCP port which the end-point on the specified hostName is listening for messages on.

  • maxQueueSize[in] the maximum number of messages we can store in the outgoing thread safe queue and control queue.

  • linger[in] the linger period (in milliseconds) for socket shutdown. Default is -1 (infinite).

~KatanaPipe()

Destroy this Katana Pipe.

This will close the connection to the end-point, any unsent messages in the buffer will be sent.

int connect()

Initiate the connection to the end-point specified by the host name and port number provided at construction.

connect() must be called before any messages are sent. Calling connect() after the pipe has been connected will not have any effect.

Returns:

0 if the pipe connects successfully to the end-point otherwise nonzero.

int send(const Message &message)

Send a message to the end-point this pipe is connected to.

send() pushes a message down the pipe to the end-point this pipe is connected to. send() ensures the message is either sent in its entirety or not at all.

Parameters:

message[in] the message to be send.

Returns:

0 if the message is sent successfully - otherwise nonzero.

void flushPipe(const NewChannelMessage &channel)

This is an important synchronisation function that you should called when your renderer has sent all image data to the driver for a given channel.

It will block until all data has been cleared from this end of the pipe.

void closeChannel(const NewChannelMessage &channel)

This is an important function that you should call from your driver when there is no more data to be sent for this channel, ever.

Once this message has been sent Katana will ignore any further image data.

Public Static Functions

static FnPlugStatus setHost(FnPluginHost *host)

Set the Display Driver Host to delegate all communication details to the suite.

The KatanaPipeSingleton bootstraps and sets the host suite, and is recommended to initialize a communication pipe.

static void setSuite(const FnDisplayDriverHostSuite_v1 *suite)
static const FnDisplayDriverHostSuite_v1 *getSuite()

Get the Display Driver host suite for communication pipes. If invalid, an error message is output to the standard error stream.

Returns:

the Display Driver host suite.

class PipeSingleton
#include <KatanaPipeSingleton.h>

The PipeSingleton provides a singleton wrapper around the KatanaPipe.

See also

KatanaPipe

Public Static Functions

static KatanaPipe *Instance(const std::string &hostName, unsigned int portNumber, const std::string &katanaPath = std::string())

Return the KatanaPipe connected to the given hostName and portNumber

Currently, we only support the connection back to one KCD i.e. the first call to this function will define the hostName/portnumber combination that will be connected to. Subsequent calls to this function with different hostname portnumber combinations will continue to return the original pipe.

Parameters:
  • hostName[in] the hostName to be connected to as a fully qualified domain name.

  • portNumber[in] the TCP port number to the Catalog Server is listening on.

  • katanaPath[in] the path where Katana was installed to bootstrap the Display Driver host library. By default it looks for the KATANA_ROOT environment variable set by a Katana interactive or render session.

Returns:

the KatanaPipe connected to the specified end point.

static size_t GetQueueSize()

Returns the maximum number of messages that will be queued before calls to KatanaPipe::send() will begin to block. The environment variable KATANA_PIPE_MAX_QUEUE_SIZE, if set to a non-zero positive value can be used to configure this setting.

Returns:

the maximum number of messages that will be queued before calls to KatanaPipe::send() will begin to block.

class Message
#include <Message.h>

This is the base class against which all Messages sent to Katana should inherit from.

Subclassed by Foundry::Katana::CloseMessage, Foundry::Katana::DataMessage, Foundry::Katana::EndOfRenderMessage, Foundry::Katana::NewChannelMessage, Foundry::Katana::NewFrameMessage

Public Functions

inline Message()
inline explicit Message(FnMessageHandle handle)
virtual ~Message()
inline bool isValid() const

Check if the message has a valid handle to the host suite.

Returns:

true if the message handle can be used to get/set data and send through the communication pipe.

Public Static Functions

static FnPlugStatus setHost(FnPluginHost *host)

Set the Display Driver Host to delegate message initialization and protocol details to the suite.

The KatanaPipeSingleton bootstraps and sets the host suite, and is recommended to initialize the message suite.

static void setSuite(const FnDisplayDriverHostSuite_v1 *suite)
static const FnDisplayDriverHostSuite_v1 *getSuite()

Get the Display Driver host suite for messages. If invalid, an error message is output to the standard error stream.

Returns:

the Display Driver host suite.

class NewChannelMessage : public Foundry::Katana::Message
#include <NewChannelMessage.h>

The NewChannelMessage class encapsulates the message sent to the Katana Catalog Server (KCS) to specify that a new channel should be reserved in the Catalog for a given frame.

The NewChannelMessage message should be sent down the KatanaPipe after a NewFrame message has been sent as the NewFrame message will reserve the frame in the Catalog.

A channel represents a given output pass by a renderer, such as the primary colour pass, id pass, depth pass P pass etc.

Each NewChannelMessage object must be created with with reference to a valid unique frame ID so Katana will know which frame the channel belongs to.

Subclassed by Foundry::Katana::NewChannelMessage_v2

Public Functions

NewChannelMessage(const NewFrameMessage &frame, uint16_t channelID = 0, uint32_t height = 0, uint32_t width = 0, int xorigin = 0, int yorigin = 0, float sampleRate1 = 0.0, float sampleRate2 = 0.0, uint32_t dataSize = 0)

Create a new instance of NewChannelMessage message using an existing NewFrame object to obtain the unique frame ID.

The default constructor will create a new channel belonging to the specified frame with all values set to 0 and an empty string for the channel name.

Note: the NewChannelMessage object will NOT maintain a reference to NewFrameMessage or assume ownership of it.

See also

setChannelName()

Parameters:
  • frame[in] an existing NewFrameMessage object

  • channelID[in] an ID number to identify this channel within the frame. (This can just be sequential from zero). The most significant bit in this field is reserved for internal use, providing a maximum channel ID of 32767.

  • height[in] the height of this channel in pixels.

  • width[in] the width of this channel in pixels.

  • xorigin[in] the x origin of this channel relative to the frame’s x origin

  • yorigin[in] the y origin of this channel relative to the frame’s y origin.

  • sampleRate1[in] sampleRate1

  • sampleRate2[in] sampleRate2

  • dataSize[in] the size - in bytes - of a single pixel of data for this channel.

NewChannelMessage(const uint8_t *frameID, uint16_t channelID = 0, uint32_t height = 0, uint32_t width = 0, int xorigin = 0, int yorigin = 0, float sampleRate1 = 0.0, float sampleRate2 = 0.0, uint32_t dataSize = 0)

Create a new instance of a NewChannelMessage specifying a pointer to a 16 byte array that will contain a unique frame ID.

The default for other values will create a new channel belonging to the specified frame with all values set to 0 and an empty string for the channel name.

See also

setChannelName()

Parameters:
  • frameID[in] a pointer to a 16 byte array containing a unique 128 bit frame ID.

  • channelID[in] an ID number to identify this channel within the frame. (This can just be sequential from zero). The most significant bit in this field is reserved for internal use. Provding a maximum channel ID of 32767.

  • height[in] the height of this channel in pixels.

  • width[in] the width of this channel in pixels.

  • xorigin[in] the x origin of this channel relative to the frame’s x origin

  • yorigin[in] the y origin of this channel relative to the frame’s y origin.

  • sampleRate1[in] sampleRate1

  • sampleRate2[in] sampleRate2

  • dataSize[in] the size - in bytes - of a single pixel of data for this channel.

inline virtual ~NewChannelMessage()

Destroy the NewChannelMessage instance.

int setChannelName(const std::string &name)

Set the human readable name that will be seen in the Monitor.

The maximum number of characters that can be specified in name is 8000.

Parameters:

name[in] the name that will be sent to the KCS and appear in the Monitor

Returns:

0 if the name was set successfully, otherwise nonzero, if nonzero is returned the existing name will remain unchanged.

void setChannelDimensions(uint32_t width, uint32_t height)

Set the width and height of this channel.

Parameters:
  • width[in] the width of this channel in pixels

  • height[in] the height of this channel in pixels

void setChannelOrigin(int ox, int oy)

Set the origin of this channel.

Parameters:
  • ox[in] the x origin relative to the x origin of the frame to which this channel belongs to.

  • oy[in] the y origin relative to the y origin of the frame to which this channel belongs to.

void setDataSize(uint32_t dataSize)

Set the size - in bytes - of a pixels worth of data in this channel.

For example - if for each pixel this channel contains 4-channel color values stored as float values the size would be 4 * sizeof(float) and thus setDataSize(16).

Parameters:

dataSize[in] the size in bytes of a pixel of data.

void setChannelID(uint16_t channelID)

Set the channel ID to identify this channel within a frame.

The most significant bit in this field is reserved for internal use. Provding a maximum channel ID of 32767.

Parameters:

channelID[in] the channel ID for this channel.

void setSampleRate(const float *sampleRate)
const uint8_t *frameUUID() const

Get the unique 128 bit identifier that is assigned to the frame this channel is a member of.

Returns:

a pointer to the start of the 16 uint8_t array that contains the unique frame ID.

uint16_t channelID() const
uint32_t channelHeight() const
uint32_t channelWidth() const
int channelXOrigin() const
int channelYOrigin() const
uint32_t channelDataSize() const
const std::string &channelName() const
uint32_t channelNameLength() const
const float *sampleRate() const
bool isIdPass() const
class NewChannelMessage_v2 : public Foundry::Katana::NewChannelMessage
#include <NewChannelMessage.h>

The NewChannelMessage_v2 class encapsulates the message sent to Katana indicating that a new channel should be reserved in the Catalog for a given frame.

The NewChannelMessage message should be sent down the KatanaPipe after a NewFrame message has been sent as the NewFrame message will reserve the frame in the Catalog.

A channel represents a given output pass by a renderer, such as the primary colour pass, id pass, depth pass P pass etc. The channel also defines the pixel layout of subsequent DataMessages.

Each NewChannelMessage object must be created with with reference to a valid unique frame ID so Katana will know which frame the channel belongs to.

Public Types

enum PixelLayout

Values:

enumerator ARGB
enumerator RGBA
enumerator UNDEFINED

Public Functions

NewChannelMessage_v2(const uint8_t *frameID, uint16_t channelID = 0, PixelLayout pixelLayout = ARGB, uint32_t height = 0, uint32_t width = 0, int xorigin = 0, int yorigin = 0, float sampleRate1 = 0.0, float sampleRate2 = 0.0, uint32_t dataSize = 0)

Create a new instance of a NewChannelMessage specifying a pointer to a 16 byte array that will contain a unique frame ID.

The default for other values will create a new channel belonging to the specified frame with all values set to 0 and an empty string for the channel name.

See also

setChannelName()

Parameters:
  • frameID[in] a pointer to a 16 byte array containing a unique 128 bit frame ID.

  • channelID[in] an ID number to identify this channel within the frame. (This can just be sequential from zero).

  • pixelLayout[in] the order of components for all pixels.

  • height[in] the height of this channel in pixels.

  • width[in] the width of this channel in pixels.

  • xorigin[in] the x origin of this channel relative to the frame’s x origin

  • yorigin[in] the y origin of this channel relative to the frame’s y origin.

  • sampleRate1[in] sampleRate1

  • sampleRate2[in] sampleRate2

  • dataSize[in] the size - in bytes - of a single pixel of data for this channel.

NewChannelMessage_v2(const NewFrameMessage &frame, uint16_t channelID = 0, PixelLayout pixelLayout = ARGB, uint32_t height = 0, uint32_t width = 0, int xorigin = 0, int yorigin = 0, float sampleRate1 = 0.0, float sampleRate2 = 0.0, uint32_t dataSize = 0)

Create a new instance of NewChannelMessage_v2 message using an existing NewFrame object to obtain the unique frame ID.

The default constructor will create a new channel belonging to the specified frame with all values set to 0 and an empty string for the channel name.

Note: the NewChannelMessage_v2 object will NOT maintain a reference to NewFrameMessage or assume ownership of it.

See also

setChannelName()

Parameters:
  • frame[in] an existing NewFrameMessage object

  • channelID[in] an ID number to identify this channel within the frame. (This can just be sequential from zero).

  • pixelLayout[in] the order of components for all pixels.

  • height[in] the height of this channel in pixels.

  • width[in] the width of this channel in pixels.

  • xorigin[in] the x origin of this channel relative to the frame’s x origin

  • yorigin[in] the y origin of this channel relative to the frame’s y origin.

  • sampleRate1[in] sampleRate1

  • sampleRate2[in] sampleRate2

  • dataSize[in] the size - in bytes - of a single pixel of data for this channel.

inline virtual ~NewChannelMessage_v2()

Destroy the NewChannelMessage_v2 instance.

void setPixelLayout(PixelLayout pixelLayout)

Sets the pixel layout for all DataMessages that will be sent by the renderer for this channel/AOV.

Parameters:

pixelLayout – the pixel layout that will be sent.

PixelLayout pixelLayout() const
class NewFrameMessage : public Foundry::Katana::Message
#include <NewFrameMessage.h>

The NewFrameMessage class encapsulates the message sent to the Katana Catalog Server (KCS) to specify that a new frame should be reserved in the Catalog.

The NewFrameMessage should be sent down the KatanaPipe first to reserve a frame in the Catalog. A frame may contain zero or more channels. Channels then contain the actual data output by the renderer.

A frame represents the collection of these channels at a point in time.

Each NewFrameMessage object will be created with a unique 128 bit identifier that will identify the frame being rendered to Katana.

Public Functions

NewFrameMessage(float frameTime = 0.0, uint32_t height = 0, uint32_t width = 0, int xorigin = 0, int yorigin = 0)

Create a new NewFrameMessage.

The default constructor will create a NewFrameMessage object with a unique frame id and all other values initialised to 0.

The frame’s name will be initialised to an empty string.

See also

setFrameName()

Parameters:
  • frameTime[in] the point in time this frame represents

  • height[in] the height in pixels of this frame

  • width[in] the width in pixels of this frame

  • xorigin[in] the xorigin relative to the lower left corner of the screen

  • yorigin[in] the yorigin relative to the lower left corner of the screen.

inline virtual ~NewFrameMessage()

Destroy the NewFrameMessage object.

int setFrameName(const std::string &name)

Set the human readable name that will appear in the name column of the Katana Catalog.

The maximum number of characters that can be specified in name is 8000.

Parameters:

name[in] the name that will be sent to the KCS and appear in the Catalog

Returns:

0 if the name was set successfully, otherwise nonzero, if nonzero is returned the existing name will remain unchanged.

void setFrameTime(float time)

Set the frame time.

Parameters:

time[in] the point in time this frame represents.

void setFrameDimensions(uint32_t width, uint32_t height)

Set the width and height of this frame.

Parameters:
  • width[in] the width of this frame in pixels

  • height[in] the height of this frame in pixels

void setFrameOrigin(int ox, int oy)

Set the origin of this frame.

Parameters:
  • ox[in] the x origin relative to the lower left corner of the screen

  • oy[in] the y origin relative to the lower left corner of the screen.

const uint8_t *frameUUID() const

Get the unique identifier for this frame.

Returns:

a pointer to the start of the 16 byte array that contains the unique frame ID.

uint32_t frameHeight() const
uint32_t frameWidth() const
int frameXOrigin() const
int frameYOrigin() const
float frameTime() const
const std::string &frameName() const
uint32_t frameNameLength() const
namespace FnDisplayDriver

Functions

bool Bootstrap(const std::string &katanaPath)

The Display Driver Host API allows to initialize the host.

Bootstraps the API without having to link against the internal libraries that implement the Display Driver host. This can be useful when implementing an executable that needs to use the Display Driver API via the plug-in system, without having to link against any internal library.

Returns true if the bootstrap succeeds.

void Initialize(const FnDisplayDriverHostSuite_v1*)

Initializes the API with the given Display Driver Host suite.