[cig-commits] commit: Merge in Underworld 1.4.1
Mercurial
hg at geodynamics.org
Tue Mar 23 10:36:27 PDT 2010
changeset: 226:5c40ed10fbe5
tag: tip
parent: 215:6f05d8c665b0
parent: 225:7a902fa5fda2
user: Walter Landry <wlandry at caltech.edu>
date: Tue Mar 23 09:53:01 2010 -0700
files: Base/src/Window.c OutputFormats/src/EncoderLibfame.c Windowing/src/X11Window.c
description:
Merge in Underworld 1.4.1
diff -r 6f05d8c665b0 -r 5c40ed10fbe5 .hgtags
--- a/.hgtags Fri Feb 05 12:57:55 2010 -0800
+++ b/.hgtags Tue Mar 23 09:53:01 2010 -0700
@@ -1,1 +1,7 @@ c116bfc9b9dbab7305ace69ed864af70189310fd
c116bfc9b9dbab7305ace69ed864af70189310fd v1.2.0
+98e47db9485987cc582047329d5e30fcffcc5117 1.4.0
+e6d27a4e11c140f6a34b0fd12c126b82c28c1162 1.4.1
+e6d27a4e11c140f6a34b0fd12c126b82c28c1162 1.4.1
+0000000000000000000000000000000000000000 1.4.1
+0000000000000000000000000000000000000000 1.4.1
+c2e156d1777561957e5aec6521a93dece7bbc2ca 1.4.1
diff -r 6f05d8c665b0 -r 5c40ed10fbe5 Base/src/Window.c
--- a/Base/src/Window.c Fri Feb 05 12:57:55 2010 -0800
+++ b/Base/src/Window.c Tue Mar 23 09:53:01 2010 -0700
@@ -745,8 +745,8 @@ lucViewportInfo* lucWindow_ConstructView
lucViewportInfo* viewportInfoList = Memory_Alloc_Array( lucViewportInfo, 1, "viewportInfoArray" );
lucViewportInfo* currViewportInfo;
Dictionary* dictionary = Dictionary_GetDictionary( cf->componentDict, self->name );
- Name viewportName;
- char* bufferPtr;
+ Name viewportName[16];
+ char* savePtr;
*viewportCount = 0;
@@ -762,11 +762,19 @@ lucViewportInfo* lucWindow_ConstructView
horizontalVP_String = StG_Strdup( Dictionary_Entry_Value_AsString( Dictionary_Entry_Value_GetElement( list, vertical_I ) ) );
/* Find number of horizontal layers */
- horizontalCount = 1;
- charPtr = strpbrk( horizontalVP_String, breakChars );
+ horizontalCount = 0;
+ char* horizVPstr_ptr = horizontalVP_String;
+ charPtr = strtok_r( horizVPstr_ptr , breakChars, &savePtr);
while ( charPtr != NULL ) {
- charPtr = strpbrk( charPtr + 1 , breakChars );
+ viewportName[horizontalCount] = StG_Strdup( charPtr );
horizontalCount++;
+ charPtr = strtok_r( NULL , breakChars, &savePtr);
+ if (horizontalCount == 16) {
+ /* Maximum 8 viewports across in single window */
+ if (charPtr != NULL)
+ Journal_Printf( lucError, "Error in func '%s' - too many viewports in window %s, maximum = 16 wide.\n", __func__, self->name);
+ break;
+ }
}
/* Sum up total number of viewports */
@@ -779,22 +787,18 @@ lucViewportInfo* lucWindow_ConstructView
viewportWidth = div( width, horizontalCount ).quot;
/* Read String to get colour map */
- charPtr = strtok_r( horizontalVP_String, breakChars, &bufferPtr );
for ( horizontal_I = 0 ; horizontal_I < horizontalCount ; horizontal_I++ ) {
currViewportInfo = &viewportInfoList[ total_I ];
/* Find viewport */
- viewportName = StG_Strdup( charPtr );
- currViewportInfo->viewport = Stg_ComponentFactory_ConstructByName( cf, (Name)viewportName, lucViewport, True, data ) ;
- Memory_Free( viewportName );
+ currViewportInfo->viewport = Stg_ComponentFactory_ConstructByName( cf, viewportName[horizontal_I], lucViewport, True, data ) ;
+ Memory_Free( viewportName[horizontal_I] );
/* Setup viewport dimensions */
currViewportInfo->startx = horizontal_I * viewportWidth;
currViewportInfo->starty = (self->verticalCount - 1 - vertical_I ) * viewportHeight;
currViewportInfo->width = viewportWidth;
currViewportInfo->height = viewportHeight;
-
- charPtr = strtok_r( NULL, breakChars, &bufferPtr );
total_I++;
}
diff -r 6f05d8c665b0 -r 5c40ed10fbe5 OutputFormats/src/EncoderLibfame.c
--- a/OutputFormats/src/EncoderLibfame.c Fri Feb 05 12:57:55 2010 -0800
+++ b/OutputFormats/src/EncoderLibfame.c Tue Mar 23 09:53:01 2010 -0700
@@ -59,6 +59,10 @@
#include <assert.h>
#include <string.h>
+
+#ifndef MASTER
+ #define MASTER 0
+#endif
/* Textual name of this class - This is a global pointer which is used for times when you need to refer to class and not a particular instance of a class */
const Type lucEncoderLibfame_Type = "lucEncoderLibfame";
@@ -97,6 +101,9 @@ void _lucEncoderLibfame_Init(
fame_yuv_t* fameyuv;
Name filename;
Index i;
+
+ /* Output should only run on root node */
+ if (self->context->rank != MASTER) return;
/* Initialise the inlcudeFrame0 parameter */
self->includeFrame0 = includeFrame0;
@@ -151,7 +158,6 @@ void _lucEncoderLibfame_Init(
fameparameters->total_frames = 0;
/* Open Output File */
-
Stg_asprintf( &filename, "%s/%s.mpeg", outputPath, window->name );
if(!loadFromCheckPoint )
@@ -172,25 +178,27 @@ void _lucEncoderLibfame_Delete( void* ou
lucEncoderLibfame* self = (lucEncoderLibfame*)outputFormat;
unsigned int framebytes;
+ /* Output should only run on root node */
+ if (self->context->rank == MASTER) {
+ /* Finish writing mpeg and close file*/
+ framebytes = fame_close(self->famecontext);
+ fwrite(self->buffer, framebytes, 1, self->stream);
+ fflush(self->stream);
+ fclose(self->stream);
- /* Finish writing mpeg and close file*/
- framebytes = fame_close(self->famecontext);
- fwrite(self->buffer, framebytes, 1, self->stream);
- fflush(self->stream);
- fclose(self->stream);
+ /* Free Memory */
+ Memory_Free( self->fameyuv->y );
+ Memory_Free( self->fameyuv->u );
+ Memory_Free( self->fameyuv->v );
- /* Free Memory */
- Memory_Free( self->fameyuv->y );
- Memory_Free( self->fameyuv->u );
- Memory_Free( self->fameyuv->v );
-
- Memory_Free( self->fameyuv );
- Memory_Free( self->famestatistics );
- Memory_Free( self->fameparameters );
- Memory_Free( self->buffer );
-
- Memory_Free( self->coding );
- Memory_Free( self->profile );
+ Memory_Free( self->fameyuv );
+ Memory_Free( self->famestatistics );
+ Memory_Free( self->fameparameters );
+ Memory_Free( self->buffer );
+
+ Memory_Free( self->coding );
+ Memory_Free( self->profile );
+ }
_lucOutputFormat_Delete( self );
}
@@ -241,6 +249,7 @@ void _lucEncoderLibfame_AssignFromXML( v
AbstractContext* context;
/* Construct Parent */
+ _lucOutputFormat_AssignFromXML( outputFormat, cf, data);
lucOutputFormat_InitAll( self, "mpeg" );
window = Stg_ComponentFactory_ConstructByKey( cf, self->name, (Dictionary_Entry_Key)"Window", lucWindow, True, data ) ;
diff -r 6f05d8c665b0 -r 5c40ed10fbe5 Windowing/src/X11Window.c
--- a/Windowing/src/X11Window.c Fri Feb 05 12:57:55 2010 -0800
+++ b/Windowing/src/X11Window.c Tue Mar 23 09:53:01 2010 -0700
@@ -196,7 +196,7 @@ void _lucX11Window_Execute( void* window
if (self->interactive && self->isMaster)
{
glXMakeCurrent( self->display, self->win, self->glxcontext);
- XSetInputFocus(self->display, self->win, RevertToParent, CurrentTime);
+ //XSetInputFocus(self->display, self->win, RevertToParent, CurrentTime);
}
else
glXMakeCurrent( self->display, self->glxpmap, self->glxcontext);
@@ -220,7 +220,8 @@ void _lucX11Window_Destroy( void* window
XFree( self->vi );
self->vi = 0;
- glXDestroyContext( self->display, self->glxcontext);
+ if (self->glxcontext)
+ glXDestroyContext( self->display, self->glxcontext);
self->glxcontext = 0;
XSetCloseDownMode( self->display, DestroyAll);
@@ -318,15 +319,15 @@ void _lucX11Window_Resize( void* window
/* Master window resized? Create new background pixmap of required size */
if (self->interactive && !self->isMaster)
{
- lucX11Window_CloseBackgroundWindow( self );
- lucX11Window_CreateBackgroundWindow( self );
+ lucX11Window_CloseBackgroundWindow( self );
+ lucX11Window_CreateBackgroundWindow( self );
}
/* Close window and create background window if switched out of interactive mode */
if (!self->interactive)
{
- lucX11Window_CloseInteractiveWindow( self );
- lucX11Window_CreateBackgroundWindow( self );
+ lucX11Window_CloseInteractiveWindow( self );
+ lucX11Window_CreateBackgroundWindow( self );
self->quitEventLoop = True;
}
@@ -339,8 +340,9 @@ Bool lucX11Window_CreateDisplay( void* w
static int configuration[] = { GLX_DOUBLEBUFFER, GLX_RGBA, GLX_DEPTH_SIZE, 16,
GLX_STENCIL_SIZE, 1, GLX_RED_SIZE, 1, GLX_GREEN_SIZE, 1, GLX_BLUE_SIZE, 1, None};
static int alphaConfiguration[] = { GLX_DOUBLEBUFFER, GLX_RGBA, GLX_DEPTH_SIZE, 16,
- GLX_STENCIL_SIZE, 1, GLX_RED_SIZE, 1, GLX_GREEN_SIZE, 1, GLX_BLUE_SIZE, 1, GLX_ALPHA_SIZE, 1, None};
-
+ GLX_STENCIL_SIZE, 1, GLX_RED_SIZE, 1, GLX_GREEN_SIZE, 1, GLX_BLUE_SIZE, 1, GLX_ALPHA_SIZE, 1, None};
+ int* config = alphaConfiguration;
+
/*********************** Create Display ******************************/
self->display = XOpenDisplay(NULL);
if (self->display == NULL) {
@@ -368,14 +370,17 @@ Bool lucX11Window_CreateDisplay( void* w
}
/* find an OpenGL-capable display - trying different configurations if nessesary */
- self->vi = glXChooseVisual(self->display, DefaultScreen(self->display), &alphaConfiguration[0]);
+ /* Note: only attempt to get double buffered visuals when in interactive mode */
+ self->vi = NULL;
+ if (self->interactive)
+ self->vi = glXChooseVisual(self->display, DefaultScreen(self->display), config);
self->doubleBuffer = True;
if (self->vi == NULL) {
Journal_Printf( lucError, "In func %s: Couldn't open RGBA Double Buffer display\n", __func__);
- self->vi = glXChooseVisual( self->display, DefaultScreen( self->display), &alphaConfiguration[1]);
+ self->vi = glXChooseVisual( self->display, DefaultScreen( self->display), config + 1);
self->doubleBuffer = False;
}
- if (self->vi == NULL) {
+ if (self->interactive && self->vi == NULL) {
Journal_Printf( lucError, "In func %s: Couldn't open RGBA display\n", __func__);
self->vi = glXChooseVisual(self->display, DefaultScreen(self->display), &configuration[0]);
self->doubleBuffer = True;
@@ -392,7 +397,6 @@ Bool lucX11Window_CreateDisplay( void* w
return True;
}
-
Bool lucX11Window_CreateContext( void* window, Bool direct ) {
lucX11Window* self = (lucX11Window*)window;
@@ -564,7 +568,6 @@ void lucX11Window_CloseInteractiveWindow
XDestroyWindow( self->display , self->win );
self->win = 0;
- self->glxcontext = NULL;
lucDebug_PrintFunctionEnd( self, 1 );
}
@@ -577,7 +580,6 @@ void lucX11Window_CloseBackgroundWindow(
self->glxpmap = 0;
XFreePixmap(self->display, self->pmap);
self->pmap = 0;
- self->glxcontext = NULL;
lucDebug_PrintFunctionEnd( self, 1 );
}
More information about the CIG-COMMITS
mailing list