MPKConfig - MPKConfig functional interface.| MPKConfig* | mpkConfigNew(void ); |
| void | mpkConfigDelete(MPKConfig* config); |
| MPKConfig* | mpkConfigLoad(const char* fileName); |
| void | mpkConfigOutput(MPKConfig* config, int tab); |
| void | mpkConfigSetName(MPKConfig* config, const char* name); |
| const char* | mpkConfigGetName(MPKConfig* config); |
| void | mpkConfigSetRunon(MPKConfig* config, int cpu); |
| int | mpkConfigGetRunon(MPKConfig* config); |
| void | mpkConfigSetMode(MPKConfig* config, int mode); |
| int | mpkConfigGetMode(MPKConfig* config); |
| void | mpkConfigSetMonitor(MPKConfig* config, int mode, const char* cmd); |
| const char* | mpkConfigGetMonitor(MPKConfig* config, int mode); |
| void | mpkConfigSetUserData(MPKConfig* config, void* data); |
| void* | mpkConfigGetUserData(MPKConfig* config); |
| int | mpkConfigNPipes(MPKConfig* config); |
| MPKPipe* | mpkConfigGetPipe(MPKConfig* config, int i); |
| void | mpkConfigAddPipe(MPKConfig* config, MPKPipe* p); |
| int | mpkConfigRemovePipe(MPKConfig* config, MPKPipe* p); |
| int | mpkConfigNCompounds(MPKConfig* config); |
| MPKCompound* | mpkConfigGetCompound(MPKConfig* config, int i); |
| void | mpkConfigAddCompound(MPKConfig* config, MPKCompound* c); |
| int | mpkConfigRemoveCompound(MPKConfig* config, MPKCompound* c); |
| MPKCompound* | mpkConfigFindCompound(MPKConfig* config, const char* name); |
| MPKPipe* | mpkConfigFindPipe(MPKConfig* config, const char* name); |
| MPKWindow* | mpkConfigFindWindow(MPKConfig* config, const char* name); |
| MPKChannel* | mpkConfigFindChannel(MPKConfig* config, const char* name); |
| MPKWindow* | mpkConfigMatchWindow(MPKConfig* config, XID drawable); |
| void | mpkConfigSetPipeInitCB(MPKConfig* config, MPKConfigPipeCB cb); |
| void | mpkConfigSetPipeExitCB(MPKConfig* config, MPKConfigPipeCB cb); |
| void | mpkConfigSetWindowInitCB(MPKConfig* config, MPKConfigWindowCB cb); |
| void | mpkConfigSetWindowExitCB(MPKConfig* config, MPKConfigWindowCB cb); |
| void | mpkConfigSetChannelInitCB(MPKConfig* config, MPKConfigChannelCB cb); |
| void | mpkConfigSetChannelExitCB(MPKConfig* config, MPKConfigChannelCB cb); |
| void | mpkConfigSetDataFreeCB(MPKConfig* config, MPKConfigDataCB cb); |
| void | mpkConfigSetFrameDataRefCB(MPKConfig* config, MPKConfigFrameDataCB cb); |
| void | mpkConfigSetFrameDataUnrefCB(MPKConfig* config, MPKConfigFrameDataCB cb); |
| void | mpkConfigSetIdleCB(MPKConfig* config, MPKConfigIdleCB cb); |
| void | mpkConfigSetEventCB(MPKConfig* config, MPKConfigEventCB cb); |
| void | mpkConfigSetCompoundPreAssembleCB(MPKConfig* config, MPKCompoundAssembleCB cb); |
| void | mpkConfigSetCompoundPostAssembleCB(MPKConfig* config, MPKCompoundAssembleCB cb); |
| void | mpkConfigSetCompoundReadOutputCB(MPKConfig* config, MPKCompoundReadOutputCB cb); |
| void | mpkConfigSetCompoundClearCB(MPKConfig* config, MPKCompoundClearCB cb); |
| MPKConfigPipeCB | mpkConfigGetPipeInitCB(MPKConfig* config); |
| MPKConfigPipeCB | mpkConfigGetPipeExitCB(MPKConfig* config); |
| MPKConfigWindowCB | mpkConfigGetWindowInitCB(MPKConfig* config); |
| MPKConfigWindowCB | mpkConfigGetWindowExitCB(MPKConfig* config); |
| MPKConfigChannelCB | mpkConfigGetChannelInitCB(MPKConfig* config); |
| MPKConfigChannelCB | mpkConfigGetChannelExitCB(MPKConfig* config); |
| MPKConfigDataCB | mpkConfigGetDataFreeCB(MPKConfig* config); |
| MPKConfigFrameDataCB | mpkConfigGetFrameDataRefCB(MPKConfig* config); |
| MPKConfigFrameDataCB | mpkConfigGetFrameDataUnrefCB(MPKConfig* config); |
| MPKConfigIdleCB | mpkConfigGetIdleCB(MPKConfig* config); |
| MPKConfigEventCB | mpkConfigGetEventCB(MPKConfig* config); |
| MPKCompoundAssembleCB | mpkConfigGetCompoundPreAssembleCB(MPKConfig* config); |
| MPKCompoundAssembleCB | mpkConfigGetCompoundPostAssembleCB(MPKConfig* config); |
| MPKCompoundReadOutputCB | mpkConfigGetCompoundReadOutputCB(MPKConfig* config); |
| MPKCompoundClearCB | mpkConfigGetCompoundClearCB(MPKConfig* config); |
| int | mpkConfigInit(MPKConfig* config, int setmon); |
| void | mpkConfigExit(MPKConfig* config); |
| void | mpkConfigFreeze(MPKConfig* config, int freeze); |
| void | mpkConfigFrame(MPKConfig* config, void* framedata); |
| void | mpkConfigFrameBegin(MPKConfig* config, void* framedata); |
| void | mpkConfigFrameEnd(MPKConfig* config); |
| int | mpkConfigChangeMode(MPKConfig* config, int mode); |
| int | mpkConfigGetLatency(MPKConfig* config); |
| int | mpkConfigIsIdle(MPKConfig* config); |
| void | mpkConfigSetViewPosition(MPKConfig* config, const float* pos); |
| void | mpkConfigSetViewOrientation(MPKConfig* config, const float* hpr); |
| void | mpkConfigSetViewMatrix(MPKConfig* config, const float* matrix); |
| void | mpkConfigSetHeadPosition(MPKConfig* config, const float* pos); |
| void | mpkConfigSetHeadOrientation(MPKConfig* config, const float* hpr); |
| void | mpkConfigSetHeadMatrix(MPKConfig* config, const float* matrix); |
| void | mpkConfigSetEyeOffset(MPKConfig* config, float offset); |
| float | mpkConfigGetEyeOffset(MPKConfig* config); |
| void | mpkConfigEyeUpdate(MPKConfig* config); |
| void | mpkConfigTimerEnable(MPKConfig* config, int mode); |
| void | mpkConfigTimerDisable(MPKConfig* config, int mode); |
| void | mpkConfigTimerSetTime(MPKConfig* config, int mode, double t); |
| double | mpkConfigTimerGetTime(MPKConfig* config, int mode); |
| void | mpkConfigSelectInput(MPKConfig* config, long event_mask); |
| MPKEvent* | mpkConfigNextEvent(MPKConfig* config, double time); |
| int | mpkConfigCheckEvent(MPKConfig* config); |
| void | mpkConfigHandleEvents(MPKConfig* config); |
| void | mpkConfigFrameData(MPKConfig* config, void* data); |
| void | mpkConfigFrameFlush(MPKConfig* config); |
MPKPipe)MPKWindow)MPKChannel)MPKCompound) of the rendering across channels, in order to scale performances.
main( int argc, char *argv[] )
{
mpkInit();
MPKConfig *config = mpkConfigLoad( "1-window" );
mpkConfigSetPipeInitCB( config, ... );
mpkConfigSetWindowInitCB( config, ... );
mpkConfigSetChannelInitCB( config, ... );
mpkConfigSetDataFreeCB( config, ... );
mpkConfigInit( config );
while ( !exit ) {
...
// update database
...
framedata = newFrameData( db );
mpkConfigFrame( config, framedata );
}
mpkConfigSetPipeExitCB( config, ... );
mpkConfigSetWindowExitCB( config, ... );
mpkConfigSetChannelExitCB( config, ... );
mpkConfigExit( config );
}
static FrameData *frameDataBuffer = NULL;
FrameData *newFrameData( Database *db )
{
FrameData *framedata;
if ( frameDataBuffer == NULL ) {
framedata = (FrameData *) mpkMalloc( sizeof(FrameData) );
}
else {
framedata = frameDataBuffer;
frameDataBuffer = framedata->next;
}
framedata->next = NULL;
// copy relevant information from database into framedata
...
return framedata;
}
void freeFrameData( MPKConfig *config, void *data )
{
FrameData *framedata = (FrameData *)data;
framedata->next = frameDataBuffer;
frameDataBuffer = framedata;
}
|
file, or NULL upon any parsing error. The environment variable MPK_PARSER_CMD can be used in order to specify a pre-processing command to be applied to the file, typically /usr/lib/cpp. The environment variable MPK_CONFIG_PATH can be used to describe a search path for file.tab tabulations.name. This is done by copy and not by reference.cpu, unless specified otherwise by mpkWindowSetRunon(). In addition, the following symbolic values can be used: | MPK_RUNON_AUTO | The window threads will be automatically placed on a CPU close to their respective graphics pipe, if possible. |
| MPK_RUNON_FREE | All threads are free to execute on whatever processor the system deems suitable. |
| MPK_UNDEFINED | The thread placement is defined by the MPK_DEFAULT_RUNON_POLICY, set using mpkGlobalSetAttributei() |
mode. Valid values for mode are MPK_STEREO and MPK_MONO.MPK_STEREO or MPK_MONO.cmd to be executed when switching to the specified stereo mode. Valid values for mode are MPK_STEREO and MPK_MONO.cmd specified with mpkConfigGetMonitor() or NULL. Accepted modes are MPK_STEREO and MPK_MONO.data to be transported within the config structure. Transport is done by reference and not by copy.MPKPipe in passed config.ith MPKPipe in passed config.MPKPipe p to list of pipes for passed config.p in list of MPKPipe for passed config and removes it from the list if it is found.MPKCompound in config.ith top-level MPKCompound in config.MPKCompound c to config.c in the list of top-level MPKCompound for the passed config and removes it from the list if found.MPKCompound with specified name in the passed MPKConfig and returns the match if found or NULL otherwise.MPKPipe with specified name in the passed MPKConfig and returns the match if found or NULL otherwise.MPKWindow with specified name in the passed MPKConfig and returns the match if found or NULL otherwise.MPKChannel with specified name in the passed MPKConfig and returns the match if found or NULL otherwise.MPKWindow with the same drawable in the passed MPKConfig and returns the match if found or NULL otherwise.
Application MPKWindow 1 MPKWindow 2 ________________________________________________________________ mpkConfigFrameBegin . . Update channels Update channels mpkConfigFrameEnd Update channels Update channels update non-threaded windows Update channels Update channels idle callback Update channels Update channels idle callback . Update channels idle callback . . . mpkWindowSwapBuffers mpkWindowSwapBuffers |
config's compounds pre assemble callback to the passed function, of type :config's compounds post assemble callback to the passed function, of type :config's compounds read output callback to the passed function, of type :config's compounds clear callback to the passed function, of type :config's pipes init callback.config's pipes exit callback.config's windows init callback. Default setting is to invoke mpkWindowCreate().config's windows exit callback. Default setting is to invoke mpkWindowDestroy().config's channels init callback.config's channels exit callback.config's de-allocation callback.config's frame data referenciation callback.config's frame data dereferenciation callback.config's idle callback.config's event callback.config's compounds pre-assemble callback. Default setting is to invoke mpkCompoundPreAssemble().config's compounds post-assemble callback. Default setting is to invoke mpkCompoundPostAssemble().config's compounds read output callback. Default setting is to invoke mpkCompoundReadOutputFrame().config's compounds clear callback. Default setting is to invoke mpkCompoundClear().MPKWindow loop threads. The config's initialization callbacks are invoked in the order described by the pseudo-code below :
for each MPKPipe in the config
invoke config's pipes initialization callback
for each MPKWindow in the pipe
launch the window thread, which :
invoke config's windows initialization callback
for each MPKChannel in the window
invoke config's channels initialization callback
end for
enter lifelong loop
end for
end for
|
MPKWindow threads have entered their lifelong loop. It then returns the number of threads launched.setmon is set, then the shell commands will be invoked that have been specified via mpkConfigSetMonitor(), if any. Note that the config's windows initialization callback is set by default to mpkWindowCreate().config, according to the pseudo-code below:
for each MPKPipe in the config
for each MPKWindow in the pipe
exit the window thread, which :
for each MPKChannel in the window
invoke config's channels exit callback
end for
invoke config's windows exit callback
exit window thread
end for
invoke config's pipes exit callback
end for
|
freeze argument causes subsequent mpkConfigFrame() to perform without invoking any rendering callback, ie. the windows will be "frozen". Otherwise, frames will be rendered as usual.
mpkConfigFrameBegin( config, framedata );
mpkConfigFrameEnd( config );
|
framedata de-allocation should be done via a de-allocation callback function, to be specified prior to mpkConfigInit() via mpkConfigSetDataFreeCB().framedata will be propagated to the config's channels rendering callbacks appropriately to the config's compounds latency.framedata de-allocation should be done via a de-allocation callback function, to be specified prior to mpkConfigInit() via MPKConfigFreeDataCB().config.config. This value represents the maximum frame-delay between the config's compound source- and destination- channels updates. It also characterizes the maximum frame-delay between a user-input and the corresponding final composited frame. This function should be called on a running configuration, that is, after mpkConfigInit() has been called.
void configIdle( MPKConfig *config )
{
while( mpkConfigIsIdle( config ))
{
// do some processing
}
}
|
hpr angles, hence "hpr" specify the Euler angles of the head.config.hpr angles of the line-of-sight, in degrees. "hpr" stands for head-pitch-roll, and describes the Euler angles of the head in the World Coordinates System used to describe the config with respect to the OpenGL convention, ie. the counter-clockwise rotation around the Y axis [head], X axis [pitch] and Z axis [roll] viewed from the positive side of the axis.matrix in the arbitrary World Coordinates System used to describe the config :
head.matrix = TRANSLATE( head.position ) x
ROTATE( head.hpr[0], 'y' ) x
ROTATE( head.hpr[1], 'x' ) x
ROTATE( head.hpr[2], 'z' )
where "hpr" stands for head, pitch, roll.
|
offset from each eye to the "head" position, ie. half the interoccular distance, to be used by config.config.mode set to MPK_TIMER_AUTO activates automatic load-balancing. This mode is enabled by default for DPLEX MPKCompound. If mode is set to MPK_TIMER_FRAME then MPK will measure the duration of subsequent frames, which can be retrieved via mpkConfigTimerGetTime(). This mode is disabled by default.mode for config. Valid values for mode are MPK_TIMER_AUTO and MPK_TIMER_FRAME.mode set to MPK_TIMER_FRAME specifies the desired minimal duration in milliseconds for the subsequent config frames. Default value is 0., ie. no time constraint.mode is MPK_TIMER_FRAME and this mode is enabled, or, if mode is MPK_TIMER_AUTO, it returns MPK recommended minimal duration for next frame, which will be applied if config involves DPLEX MPKCompound.config, and sets the window's event mask if this window has an input display and an X window drawable. Note that the window's input display is set via mpkWindowOpenDisplay() or mpkWindowSetInputDisplay().MPKEvent on the event queue. If there is no MPKEvent queued, this function blocks until a MPKEvent is received.time is non-zero, it specifies a maximum interval in milliseconds to wait. If time is zero, mpkConfigNextEvent blocks indefinitely.MPKEvent is valid until the next call to mpkConfigNextEvent.data to the cull and draw callbacks, as defined in the given config.data can be done via frame data referenciation and dereferenciation callbacks, to be specified prior to mpkConfigInit() via MPKConfigSetFrameDataRefCB() and MPKConfigSetFrameDataUnrefCB().
int main(...)
{
...
while ( !exit ) {
...
// update database
...
framedata = newFrameData( db );
mpkConfigFrameBegin( config, framedata );
mpkConfigFrameData( config, data1 );
...
mpkConfigFrameData( config, dataN );
mpkConfigFrameEnd( config );
}
...
}
void cullChannel( MPKChannel *c, void *data )
{
...
while( (data = mpkChannelNextData( c )) != NULL )
{
if( isVisible( data ))
{
mpkChannelPassData( c, data )
}
}
}
void updateChannel( MPKChannel *c, void *data )
{
...
while( (data = mpkChannelNextData( c )) != NULL )
{
render( data );
}
}
|
| # config FIELDS description | |
| name | "config-name" |
| runon | processor-id |
| mode | stereo-mode |
| mono | "shell-command" |
| stereo | "shell-command" |
| # config PIPES description | |
| pipe { pipe-1 description } | |
| pipe { pipe-2 description } | |
| ... | |
| # config COMPOUNDS description | |
| compound { compound-1 description } | |
| compound { compound-2 description } | |
| ... |
stereo-mode description accepts only the following File Format identifiers : mono [default] and stereo.MPKChannel, MPKCompound, MPKEvent, MPKPipe, MPKWindow