Example #1
0
/**
 * Windowtracker spu init function
 * \param id
 * \param child
 * \param self
 * \param context_id
 * \param num_contexts
 */
static SPUFunctions *
windowtrackerSPUInit( int id, SPU *child, SPU *self,
								 unsigned int context_id,
								 unsigned int num_contexts )
{

	(void) self;
	(void) context_id;
	(void) num_contexts;

	windowtracker_spu.id = id;
	windowtracker_spu.has_child = 0;
	windowtracker_spu.server = NULL;
	if (child)
	{
		crSPUInitDispatchTable( &(windowtracker_spu.child) );
		crSPUCopyDispatchTable( &(windowtracker_spu.child), &(child->dispatch_table) );
		windowtracker_spu.has_child = 1;
	}
	crSPUInitDispatchTable( &(windowtracker_spu.super) );
	crSPUCopyDispatchTable( &(windowtracker_spu.super), &(self->superSPU->dispatch_table) );
	windowtrackerspuGatherConfiguration();

	return &windowtracker_functions;
}
Example #2
0
static SPUFunctions *injectorSPUInit( int id, SPU *child, SPU *self,
		unsigned int context_id,
		unsigned int num_contexts )
{

	(void) self;
	(void) context_id;
	(void) num_contexts;

	injector_spu.id = id;
	injector_spu.has_child = 0;
	injector_spu.server = NULL;
	if (child)
	{
		crSPUInitDispatchTable( &(injector_spu.child) );
		crSPUCopyDispatchTable( &(injector_spu.child), &(child->dispatch_table) );
		injector_spu.has_child = 1;
	}
	crSPUInitDispatchTable( &(injector_spu.super) );
	crSPUCopyDispatchTable( &(injector_spu.super), &(self->superSPU->dispatch_table) );
	injectorspuGatherConfiguration( &injector_spu );

	/* Don't want oob stream to pass swapbuffers */
	crSPUCopyDispatchTable( &(injector_spu.oob_dispatch), &(injector_spu.child) );
	injector_spu.oob_dispatch.SwapBuffers = (SwapBuffersFunc_t) injectorspuOOBSwapBuffers;
	injector_spu.oob_dispatch.ChromiumParameteriCR = (ChromiumParameteriCRFunc_t) injectorspuChromiumParameteri;

	injectorspuConnect() ;
	return &injector_functions;
}
Example #3
0
static SPUFunctions *feedbackSPUInit( int id, SPU *child, SPU *self,
                                      unsigned int context_id,
                                      unsigned int num_contexts )
{
    (void) context_id;
    (void) num_contexts;

#ifdef CHROMIUM_THREADSAFE
    crInitMutex(&feedback_spu.mutex);
#endif

    feedback_spu.id = id;
    feedback_spu.has_child = 0;
    if (child)
    {
        crSPUInitDispatchTable( &(feedback_spu.child) );
        crSPUCopyDispatchTable( &(feedback_spu.child), &(child->dispatch_table) );
        feedback_spu.has_child = 1;
    }
    crSPUInitDispatchTable( &(feedback_spu.super) );
    crSPUCopyDispatchTable( &(feedback_spu.super), &(self->superSPU->dispatch_table) );
    feedbackspuGatherConfiguration();

    /* create/init default state tracker */
    crStateInit();

    feedback_spu.defaultctx = crStateCreateContext(NULL, 0, NULL);
    crStateSetCurrent(feedback_spu.defaultctx);

    feedback_spu.numContexts = 0;
    crMemZero(feedback_spu.context, CR_MAX_CONTEXTS * sizeof(ContextInfo));

    return &feedback_functions;
}
Example #4
0
static SPUFunctions *
expandoSPUInit( int id, SPU *child, SPU *self,
								 unsigned int context_id,
								 unsigned int num_contexts )
{

	(void) self;
	(void) context_id;
	(void) num_contexts;

	expando_spu.id = id;
	expando_spu.has_child = 0;
	expando_spu.server = NULL;
	if (child)
	{
		crSPUInitDispatchTable( &(expando_spu.child) );
		crSPUCopyDispatchTable( &(expando_spu.child), &(child->dispatch_table) );
		expando_spu.has_child = 1;
	}
	crSPUInitDispatchTable( &(expando_spu.super) );
	crSPUCopyDispatchTable( &(expando_spu.super), &(self->superSPU->dispatch_table) );
	expandospuGatherConfiguration();

	/* Expando-specific initialization */
	expando_spu.contextTable = crAllocHashtable();

	/* We'll be using the state tracker for each context */
	crStateInit();

	return &expando_functions;
}
Example #5
0
/**
 * Matte spu init function
 * \param id
 * \param child
 * \param self
 * \param context_id
 * \param num_contexts
 */
static SPUFunctions *
matteSPUInit( int id, SPU *child, SPU *self, unsigned int context_id, unsigned int num_contexts )
{

	(void) self;
	(void) context_id;
	(void) num_contexts;

#ifdef CHROMIUM_THREADSAFE
	crInitTSD(&matteTSD);
#endif

	matte_spu.id = id;
	matte_spu.has_child = 0;
	matte_spu.server = NULL;
	if (child)
	{
		crSPUInitDispatchTable( &(matte_spu.child) );
		crSPUCopyDispatchTable( &(matte_spu.child), &(child->dispatch_table) );
		matte_spu.has_child = 1;
	}
	crSPUInitDispatchTable( &(matte_spu.super) );
	crSPUCopyDispatchTable( &(matte_spu.super), &(self->superSPU->dispatch_table) );
	mattespuGatherConfiguration();

	matte_spu.contextTable = crAllocHashtable();

	return &matte_functions;
}
Example #6
0
static SPUFunctions *
zpixSPUInit(int id, SPU * child, SPU * self,
						unsigned int context_id, unsigned int num_contexts)
{
	int i = 0;
	(void) self;
	(void) context_id;
	(void) num_contexts;

	self->privatePtr = (void *) &zpix_spu;

	crMemZero(&zpix_spu, sizeof(zpix_spu));

	zpix_spu.id = id;
	zpix_spu.has_child = 0;
	zpix_spu.server = NULL;
	if (child)
	{
		crSPUInitDispatchTable(&(zpix_spu.child));
		crSPUCopyDispatchTable(&(zpix_spu.child), &(child->dispatch_table));
		zpix_spu.has_child = 1;
	}
	crSPUInitDispatchTable(&(zpix_spu.super));
	crSPUCopyDispatchTable(&(zpix_spu.super),
												 &(self->superSPU->dispatch_table));
	zpixspuGatherConfiguration(&zpix_spu);

	/* non-zero instance initialization values */
	crDebug("Zpix SPU - verbose = %d", zpix_spu.verbose);
	zpix_spu.rXold = -1;
	zpix_spu.rYold = -1;

	/* set up shadow buffers */
	for (i = 0; i < FBNUM; i++)
	{
		zpix_spu.b.fbWidth[i] = -1;
		zpix_spu.b.fbHeight[i] = -1;
		zpix_spu.b.fbLen[i] = 0;
		zpix_spu.b.fBuf[i] = NULL;
		zpix_spu.b.dBuf[i] = NULL;
		zpix_spu.zBuf[i] = NULL;
	}

	/* allocate some initial server shadows */

	/*XXX this is just a convenience since storage amount is trivial */
#define DEFAULT_NUMBER_SERVER_SHADOWS 8

	zpix_spu.n_sb = DEFAULT_NUMBER_SERVER_SHADOWS - 1;
	zpix_spu.sb = (SBUFS *) crAlloc((zpix_spu.n_sb + 1) * sizeof(SBUFS));

	/* set highest valid index */

	for (i = 0; i < zpix_spu.n_sb; i++)
	{
		zpix_spu.sb[i] = zpix_spu.b;
	}

	return &zpix_functions;
}
Example #7
0
static SPUFunctions *arraySPUInit( int id, SPU *child, SPU *self,
                                   unsigned int context_id,
                                   unsigned int num_contexts )
{

    (void) context_id;
    (void) num_contexts;

    array_spu.id = id;
    array_spu.has_child = 0;
    if (child)
    {
        crSPUInitDispatchTable( &(array_spu.child) );
        crSPUCopyDispatchTable( &(array_spu.child), &(child->dispatch_table) );
        array_spu.has_child = 1;
    }
    crSPUInitDispatchTable( &(array_spu.super) );
    crSPUCopyDispatchTable( &(array_spu.super), &(self->superSPU->dispatch_table) );
    arrayspuGatherConfiguration();

    crStateInit();
    array_spu.ctx = crStateCreateContext( NULL, 0, NULL );
#ifdef CR_ARB_vertex_buffer_object
    array_spu.ctx->bufferobject.retainBufferData = GL_TRUE;
#endif
    /* we call SetCurrent instead of MakeCurrent as the differencer
     * isn't setup yet anyway */
    crStateSetCurrent( array_spu.ctx );

    return &array_functions;
}
Example #8
0
static SPUFunctions *feedbackSPUInit( int id, SPU *child, SPU *self,
		unsigned int context_id,
		unsigned int num_contexts )
{
	CRContext *ctx;
	(void) context_id;
	(void) num_contexts;

	feedback_spu.id = id;
	feedback_spu.has_child = 0;
	if (child)
	{
		crSPUInitDispatchTable( &(feedback_spu.child) );
		crSPUCopyDispatchTable( &(feedback_spu.child), &(child->dispatch_table) );
		feedback_spu.has_child = 1;
	}
	crSPUInitDispatchTable( &(feedback_spu.super) );
	crSPUCopyDispatchTable( &(feedback_spu.super), &(self->superSPU->dispatch_table) );
	feedbackspuGatherConfiguration();

	/* create/init default state tracker */
	crStateInit();
	ctx = crStateGetCurrent();
	CRASSERT(ctx);
	crStateSetCurrentPointers(ctx, &feedback_spu.current);

	return &feedback_functions;
}
Example #9
0
static SPUFunctions *
readbackSPUInit( int id, SPU *child, SPU *self,
								 unsigned int context_id,
								 unsigned int num_contexts )
{
	WindowInfo *window;
	(void) context_id;
	(void) num_contexts;

#ifdef CHROMIUM_THREADSAFE
	crDebug("Readback SPU: thread-safe");
#endif

	crMemZero(&readback_spu, sizeof(readback_spu));
	readback_spu.id = id;
	readback_spu.has_child = 0;
	if (child)
	{
		crSPUInitDispatchTable( &(readback_spu.child) );
		crSPUCopyDispatchTable( &(readback_spu.child), &(child->dispatch_table) );
		readback_spu.has_child = 1;
	}
	else
	{
	   /* don't override any API functions - use the Render SPU functions */
	   static SPUNamedFunctionTable empty_table[] = {
		  { NULL, NULL }
	   };
	   readback_functions.table = empty_table;
	}
	crSPUInitDispatchTable( &(readback_spu.super) );
	crSPUCopyDispatchTable( &(readback_spu.super), &(self->superSPU->dispatch_table) );
	readbackspuGatherConfiguration( &readback_spu );

	readback_spu.contextTable = crAllocHashtable();
	readback_spu.windowTable = crAllocHashtable();

	/* create my default window (window number 0) */
	window = (WindowInfo *) crCalloc(sizeof(WindowInfo));
	CRASSERT(window);
	window->index = 0;
	window->renderWindow = 0; /* default render SPU window */
	window->childWindow = 0;  /* default child SPU window */
	readbackspuTweakVisBits(readback_spu.default_visual,
													&window->childVisBits,
													&window->superVisBits);
	crHashtableAdd(readback_spu.windowTable, 0, window);

	readback_spu.gather_conn = NULL;

	return &readback_functions;
}
Example #10
0
static void injectorSPUSelfDispatch(SPUDispatchTable *self)
{
	crSPUInitDispatchTable( &(injector_spu.self) );
	crSPUCopyDispatchTable( &(injector_spu.self), self );

	injector_spu.server = (CRServer *)(self->server);
}
Example #11
0
static void
zpixSPUSelfDispatch(SPUDispatchTable * self)
{
	crSPUInitDispatchTable(&(zpix_spu.self));
	crSPUCopyDispatchTable(&(zpix_spu.self), self);

	zpix_spu.server = (CRServer *) (self->server);
}
Example #12
0
static void
windowtrackerSPUSelfDispatch(SPUDispatchTable *self)
{
	crSPUInitDispatchTable( &(windowtracker_spu.self) );
	crSPUCopyDispatchTable( &(windowtracker_spu.self), self );

	windowtracker_spu.server = (CRServer *)(self->server);
}
Example #13
0
static void
readbackSPUSelfDispatch(SPUDispatchTable *self)
{
	crSPUInitDispatchTable( &(readback_spu.self) );
	crSPUCopyDispatchTable( &(readback_spu.self), self );

	readback_spu.server = (CRServer *)(self->server);
}
Example #14
0
static void
matteSPUSelfDispatch(SPUDispatchTable *self)
{
	crSPUInitDispatchTable( &(matte_spu.self) );
	crSPUCopyDispatchTable( &(matte_spu.self), self );

	matte_spu.server = (CRServer *)(self->server);
}
Example #15
0
static void
expandoSPUSelfDispatch(SPUDispatchTable *self)
{
	crSPUInitDispatchTable( &(expando_spu.self) );
	crSPUCopyDispatchTable( &(expando_spu.self), self );

	expando_spu.server = (CRServer *)(self->server);
}
Example #16
0
SPU * crSPULoad( SPU *child, int id, char *name, char *dir, void *server )
{
	SPU *the_spu;
	char *path;

	CRASSERT( name != NULL );

	the_spu = (SPU*)crAlloc( sizeof( *the_spu ) );
	the_spu->id = id;
	the_spu->privatePtr = NULL;
	path = __findDLL( name, dir );
	the_spu->dll = crDLLOpen( path, 0/*resolveGlobal*/ );
	the_spu->entry_point = 
		(SPULoadFunction) crDLLGetNoError( the_spu->dll, SPU_ENTRY_POINT_NAME );
	if (!the_spu->entry_point)
	{
		crError( "Couldn't load the SPU entry point \"%s\" from SPU \"%s\"!", 
				SPU_ENTRY_POINT_NAME, name );
	}

	/* This basicall calls the SPU's SPULoad() function */
	if (!the_spu->entry_point( &(the_spu->name), &(the_spu->super_name), 
				   &(the_spu->init), &(the_spu->self), 
				   &(the_spu->cleanup),
				   &(the_spu->options),
				   &(the_spu->spu_flags)) )
	{
		crError( "I found the SPU \"%s\", but loading it failed!", name );
	}
	if (crStrcmp(the_spu->name,"error"))
	{
		/* the default super/base class for an SPU is the error SPU */
		if (the_spu->super_name == NULL)
		{
			the_spu->super_name = "error";
		}
		the_spu->superSPU = crSPULoad( child, id, the_spu->super_name, dir, server );
	}
	else
	{
		the_spu->superSPU = NULL;
	}
	crDebug("Initializing %s SPU", name);
	the_spu->function_table = the_spu->init( id, child, the_spu, 0, 1 );
	__buildDispatch( the_spu );
	/*crDebug( "initializing dispatch table %p (for SPU %s)", (void*)&(the_spu->dispatch_table), name );*/
	crSPUInitDispatchTable( &(the_spu->dispatch_table) );
	/*crDebug( "Done initializing the dispatch table for SPU %s, calling the self function", name );*/

	the_spu->dispatch_table.server = server;
	the_spu->self( &(the_spu->dispatch_table) );
	/*crDebug( "Done with the self function" );*/

	return the_spu;
}
Example #17
0
static SPUFunctions *hiddenlineSPUInit( int id, SPU *child, SPU *self,
		unsigned int context_id,
		unsigned int num_contexts )
{

	(void) context_id;
	(void) num_contexts;

#ifdef CHROMIUM_THREADSAFE
	crDebug("Hiddenline SPU: thread-safe");
#endif

	hiddenline_spu.id = id;
	hiddenline_spu.has_child = 0;
	if (child)
	{
		crSPUInitDispatchTable( &(hiddenline_spu.child) );
		crSPUCopyDispatchTable( &(hiddenline_spu.child), &(child->dispatch_table) );
		hiddenline_spu.has_child = 1;
	}
	crSPUInitDispatchTable( &(hiddenline_spu.super) );
	crSPUCopyDispatchTable( &(hiddenline_spu.super), &(self->superSPU->dispatch_table) );
	hiddenlinespuGatherConfiguration( child );

	/* We need to track state so that the packer can deal with pixel data */
	crStateInit();

	hiddenlinespuCreateFunctions();

	hiddenline_spu.contextTable = crAllocHashtable();
#ifdef CHROMIUM_THREADSAFE
	crInitTSD(&_HiddenlineTSD);
#else
	hiddenline_spu.currentContext = NULL;
#endif
	crInitMutex(&(hiddenline_spu.mutex));

	return &hiddenline_functions;
}
Example #18
0
static SPUFunctions *arraySPUInit( int id, SPU *child, SPU *self,
        unsigned int context_id,
        unsigned int num_contexts )
{

    (void) context_id;
    (void) num_contexts;

#ifdef CHROMIUM_THREADSAFE
    crInitMutex(&_ArrayMutex);
#endif

    array_spu.id = id;
    array_spu.has_child = 0;
    if (child)
    {
        crSPUInitDispatchTable( &(array_spu.child) );
        crSPUCopyDispatchTable( &(array_spu.child), &(child->dispatch_table) );
        array_spu.has_child = 1;
    }
    crSPUInitDispatchTable( &(array_spu.super) );
    crSPUCopyDispatchTable( &(array_spu.super), &(self->superSPU->dispatch_table) );
    arrayspuSetVBoxConfiguration();

    crStateInit();
/*@todo seems default context ain't needed at all*/
    array_spu.defaultctx = crStateCreateContext( NULL, 0, NULL );
#ifdef CR_ARB_vertex_buffer_object
    array_spu.defaultctx->bufferobject.retainBufferData = GL_TRUE;
#endif
    /* we call SetCurrent instead of MakeCurrent as the differencer
     * isn't setup yet anyway */
    crStateSetCurrent( array_spu.defaultctx );

    array_spu.numContexts = 0;
    crMemZero(array_spu.context, CR_MAX_CONTEXTS * sizeof(ContextInfo));

    return &array_functions;
}
static void renderSPUSelfDispatch(SPUDispatchTable *self)
{
    crSPUInitDispatchTable( &(render_spu.self) );
    crSPUCopyDispatchTable( &(render_spu.self), self );

    crSPUInitDispatchTable( &(render_spu.blitterDispatch) );
    crSPUCopyDispatchTable( &(render_spu.blitterDispatch), self );

    render_spu.server = (CRServer *)(self->server);

    {
        GLfloat version;
        version = crStrToFloat((const char *) render_spu.ws.glGetString(GL_VERSION));

        if (version>=2.f || crStrstr((const char*)render_spu.ws.glGetString(GL_EXTENSIONS), "GL_ARB_vertex_shader"))
        {
            GLint mu=0;
            render_spu.self.GetIntegerv(GL_MAX_VERTEX_UNIFORM_COMPONENTS_ARB, &mu);
            crInfo("Render SPU: GL_MAX_VERTEX_UNIFORM_COMPONENTS_ARB=%i", mu);
        }
    }
}
Example #20
0
/**
 * Vnc spu init function
 * \param id
 * \param child
 * \param self
 * \param context_id
 * \param num_contexts
 */
static SPUFunctions *
vncSPUInit( int id, SPU *child, SPU *self,
								 unsigned int context_id,
								 unsigned int num_contexts )
{

	(void) self;
	(void) context_id;
	(void) num_contexts;

	vnc_spu.id = id;
	vnc_spu.has_child = 0;
	vnc_spu.server = NULL;
	/* We should always have a child (next) SPU since we're derived from
	 * the Passthrough SPU which requires a child/next SPU.
	 */
	if (child)
	{
		crSPUInitDispatchTable( &(vnc_spu.child) );
		crSPUCopyDispatchTable( &(vnc_spu.child), &(child->dispatch_table) );
		vnc_spu.has_child = 1;
	}
	crSPUInitDispatchTable( &(vnc_spu.super) );
	crSPUCopyDispatchTable( &(vnc_spu.super), &(self->superSPU->dispatch_table) );
	vncspuGatherConfiguration();

	vnc_spu.windowTable = crAllocHashtable();

	vncspuNetLoggerInit();

	vncspuInitialize();

	vncspuStartServerThread();

	return &vnc_functions;
}
Example #21
0
File: load.c Project: OSLL/vboxhsm
static void stubInitNativeDispatch( void )
{
#define MAX_FUNCS 1000
    SPUNamedFunctionTable gl_funcs[MAX_FUNCS];
    int numFuncs;

    numFuncs = crLoadOpenGL( &stub.wsInterface, gl_funcs );

    stub.haveNativeOpenGL = (numFuncs > 0);

    /* XXX call this after context binding */
    numFuncs += crLoadOpenGLExtensions( &stub.wsInterface, gl_funcs + numFuncs );

    CRASSERT(numFuncs < MAX_FUNCS);

    crSPUInitDispatchTable( &stub.nativeDispatch );
    crSPUInitDispatch( &stub.nativeDispatch, gl_funcs );
    crSPUInitDispatchNops( &stub.nativeDispatch );
#undef MAX_FUNCS
}
Example #22
0
/**
 * Use the GL function pointers in <spu> to initialize the static glim
 * dispatch table.
 */
static void stubInitSPUDispatch(SPU *spu)
{
    crSPUInitDispatchTable( &stub.spuDispatch );
    crSPUCopyDispatchTable( &stub.spuDispatch, &(spu->dispatch_table) );

    if (stub.trackWindowSize || stub.trackWindowPos || stub.trackWindowVisibleRgn) {
        /* patch-in special glClear/Viewport function to track window sizing */
        origClear = stub.spuDispatch.Clear;
        origViewport = stub.spuDispatch.Viewport;
        origSwapBuffers = stub.spuDispatch.SwapBuffers;
        origDrawBuffer = stub.spuDispatch.DrawBuffer;
        origScissor = stub.spuDispatch.Scissor;
        stub.spuDispatch.Clear = trapClear;
        stub.spuDispatch.Viewport = trapViewport;

        /*stub.spuDispatch.SwapBuffers = trapSwapBuffers;
        stub.spuDispatch.DrawBuffer = trapDrawBuffer;*/
    }

    crSPUCopyDispatchTable( &glim, &stub.spuDispatch );
}
Example #23
0
static SPUFunctions *
printSPUInit( int id, SPU *child, SPU *self,
							unsigned int context_id,
							unsigned int num_contexts )
{
	(void) context_id;
	(void) num_contexts;
	(void) child;

	print_spu.id = id;
	printspuGatherConfiguration( child );

	crSPUInitDispatchTable( &(print_spu.passthrough) );
	crSPUCopyDispatchTable( &(print_spu.passthrough), &(self->superSPU->dispatch_table) );

#ifndef WINDOWS
	/* If we were given a marker signal, install our signal handler. */
	if (print_spu.marker_signal) {
		print_spu.old_signal_handler = signal(print_spu.marker_signal, printspu_signal_handler);
	}
#endif
	return &print_functions;
}
static void
packSPUSelfDispatch(SPUDispatchTable *self)
{
    crSPUInitDispatchTable( &(pack_spu.self) );
    crSPUCopyDispatchTable( &(pack_spu.self), self );
}
Example #25
0
static SPUFunctions *
tilesortSPUInit( int id, SPU *child, SPU *self,
                 unsigned int context_id,
                 unsigned int num_contexts )
{
    ThreadInfo *thread0 = &(tilesort_spu.thread[0]);

    (void) context_id;
    (void) num_contexts;
    (void) child;
    (void) self;

#if DEBUG_FP_EXCEPTIONS
    {
        fpu_control_t mask;
        _FPU_GETCW(mask);
        mask &= ~(_FPU_MASK_IM | _FPU_MASK_DM | _FPU_MASK_ZM
                  | _FPU_MASK_OM | _FPU_MASK_UM);
        _FPU_SETCW(mask);
    }
#endif

    crRandSeed(id);

    crMemZero( &tilesort_spu, sizeof(TileSortSPU) );

#ifdef CHROMIUM_THREADSAFE
    crInitTSD(&_ThreadTSD);
    crSetTSD(&_ThreadTSD, thread0);
    crInitMutex(&_TileSortMutex);
#endif

    thread0->state_server_index = -1;	 /* one-time init for thread */

    tilesortspuInitEvaluators();

    /* Init window, context hash tables */
    tilesort_spu.windowTable = crAllocHashtable();
    tilesort_spu.contextTable = crAllocHashtable();
    tilesort_spu.listTable = crAllocHashtable();

    tilesort_spu.id = id;
    tilesort_spu.glassesType = RED_BLUE;
    tilesortspuSetAnaglyphMask(&tilesort_spu);

    tilesortspuGatherConfiguration( child );
    tilesortspuConnectToServers(); /* set up thread0's server connection */

    tilesort_spu.geom_buffer_size = tilesort_spu.buffer_size;

    /* geom_buffer_mtu must fit in data's part of our buffers */
    tilesort_spu.geom_buffer_mtu = crPackMaxData(tilesort_spu.buffer_size)
                                   /* 24 is the size of the bounds info packet
                                    * END_FLUFF is the size of data of the extra End opcode if needed
                                    * 4 since BoundsInfo opcode may take a whole 4 bytes
                                    * and 4 to let room for extra End's opcode, if needed
                                    */
                                   - (24+END_FLUFF+4+4);

    /* the geometry must also fit in the mtu */
    if (tilesort_spu.geom_buffer_mtu >
            tilesort_spu.MTU - sizeof(CRMessageOpcodes) - (24+END_FLUFF+4+4))
        tilesort_spu.geom_buffer_mtu =
            tilesort_spu.MTU - sizeof(CRMessageOpcodes) - (24+END_FLUFF+4+4);

    tilesort_spu.swap = thread0->netServer[0].conn->swap;

    tilesortspuInitThreadPacking( thread0 );

    tilesortspuCreateFunctions();

    crStateInit();
    tilesortspuCreateDiffAPI();

    /* special dispatch tables for display lists */
    if (tilesort_spu.listTrack || tilesort_spu.lazySendDLists) {
        crMemZero((void *)&tilesort_spu.packerDispatch, sizeof tilesort_spu.packerDispatch);
        crSPUInitDispatchTable(&tilesort_spu.packerDispatch);
        tilesortspuLoadPackTable(&tilesort_spu.packerDispatch);

        crSPUInitDispatchTable(&tilesort_spu.stateDispatch);
        tilesortspuLoadStateTable(&tilesort_spu.stateDispatch);
    }

    if (tilesort_spu.useDMX) {
        /* load OpenGL */
        int n;
        crDebug("Tilesort SPU: Using DMX");
        n = crLoadOpenGL( &tilesort_spu.ws, NULL);
        if (!n) {
            crWarning("Tilesort SPU: Unable to load OpenGL, disabling DMX");
            tilesort_spu.useDMX = 0;
        }
    }
    else {
        crDebug("Tilesort SPU: Not using DMX");
    }

    crDebug("Tilesort SPU: ---------- End of Init -------------");

    return &tilesort_functions;
}
Example #26
0
static void hiddenlineSPUSelfDispatch(SPUDispatchTable *self)
{
	crSPUInitDispatchTable( &(hiddenline_spu.self) );
	crSPUCopyDispatchTable( &(hiddenline_spu.self), self );
}
Example #27
0
File: load.c Project: OSLL/vboxhsm
/**
 * Do one-time initializations for the faker.
 * Returns TRUE on success, FALSE otherwise.
 */
static bool
stubInitLocked(void)
{
    /* Here is where we contact the mothership to find out what we're supposed
     * to  be doing.  Networking code in a DLL initializer.  I sure hope this
     * works :)
     *
     * HOW can I pass the mothership address to this if I already know it?
     */

    CRConnection *conn = NULL;
    char response[1024];
    char **spuchain;
    int num_spus;
    int *spu_ids;
    char **spu_names;
    const char *app_id;
    int i;
    int disable_sync = 0;

    stubInitVars();

    crGetProcName(response, 1024);
    crDebug("Stub launched for %s", response);

#if defined(CR_NEWWINTRACK) && !defined(WINDOWS)
    /*@todo when vm boots with compiz turned on, new code causes hang in xcb_wait_for_reply in the sync thread
     * as at the start compiz runs our code under XGrabServer.
     */
    if (!crStrcmp(response, "compiz") || !crStrcmp(response, "compiz_real") || !crStrcmp(response, "compiz.real")
	|| !crStrcmp(response, "compiz-bin"))
    {
        disable_sync = 1;
    }
#elif defined(WINDOWS) && defined(VBOX_WITH_WDDM) && defined(VBOX_WDDM_MINIPORT_WITH_VISIBLE_RECTS)
    if (GetModuleHandle(VBOX_MODNAME_DISPD3D))
    {
        disable_sync = 1;
        crDebug("running with " VBOX_MODNAME_DISPD3D);
        stub.trackWindowVisibleRgn = 0;
        stub.bRunningUnderWDDM = true;
    }
#endif

    /* @todo check if it'd be of any use on other than guests, no use for windows */
    app_id = crGetenv( "CR_APPLICATION_ID_NUMBER" );

    crNetInit( NULL, NULL );

#ifndef WINDOWS
    {
        CRNetServer ns;

        ns.name = "vboxhgcm://host:0";
        ns.buffer_size = 1024;
        crNetServerConnect(&ns
#if defined(VBOX_WITH_CRHGSMI) && defined(IN_GUEST)
                , NULL
#endif
                );
        if (!ns.conn)
        {
            crWarning("Failed to connect to host. Make sure 3D acceleration is enabled for this VM.");
            return false;
        }
        else
        {
            crNetFreeConnection(ns.conn);
        }
#if 0 && defined(CR_NEWWINTRACK)
        {
            Status st = XInitThreads();
            if (st==0)
            {
                crWarning("XInitThreads returned %i", (int)st);
            }
        }
#endif
    }
#endif

    strcpy(response, "2 0 feedback 1 pack");
    spuchain = crStrSplit( response, " " );
    num_spus = crStrToInt( spuchain[0] );
    spu_ids = (int *) crAlloc( num_spus * sizeof( *spu_ids ) );
    spu_names = (char **) crAlloc( num_spus * sizeof( *spu_names ) );
    for (i = 0 ; i < num_spus ; i++)
    {
        spu_ids[i] = crStrToInt( spuchain[2*i+1] );
        spu_names[i] = crStrdup( spuchain[2*i+2] );
        crDebug( "SPU %d/%d: (%d) \"%s\"", i+1, num_spus, spu_ids[i], spu_names[i] );
    }

    stubSetDefaultConfigurationOptions();

    stub.spu = crSPULoadChain( num_spus, spu_ids, spu_names, stub.spu_dir, NULL );

    crFree( spuchain );
    crFree( spu_ids );
    for (i = 0; i < num_spus; ++i)
        crFree(spu_names[i]);
    crFree( spu_names );

    // spu chain load failed somewhere
    if (!stub.spu) {
        return false;
    }

    crSPUInitDispatchTable( &glim );

    /* This is unlikely to change -- We still want to initialize our dispatch
     * table with the functions of the first SPU in the chain. */
    stubInitSPUDispatch( stub.spu );

    /* we need to plug one special stub function into the dispatch table */
    glim.GetChromiumParametervCR = stub_GetChromiumParametervCR;

#if !defined(VBOX_NO_NATIVEGL)
    /* Load pointers to native OpenGL functions into stub.nativeDispatch */
    stubInitNativeDispatch();
#endif

/*crDebug("stub init");
raise(SIGINT);*/

#ifdef WINDOWS
# ifndef CR_NEWWINTRACK
    stubInstallWindowMessageHook();
# endif
#endif

#ifdef CR_NEWWINTRACK
    {
        int rc;

        RTR3InitDll(RTR3INIT_FLAGS_UNOBTRUSIVE);

        if (!disable_sync)
        {
            crDebug("Starting sync thread");

            rc = RTThreadCreate(&stub.hSyncThread, stubSyncThreadProc, NULL, 0, RTTHREADTYPE_DEFAULT, RTTHREADFLAGS_WAITABLE, "Sync");
            if (RT_FAILURE(rc))
            {
                crError("Failed to start sync thread! (%x)", rc);
            }
            RTThreadUserWait(stub.hSyncThread, 60 * 1000);
            RTThreadUserReset(stub.hSyncThread);

            crDebug("Going on");
        }
    }
#endif

#ifdef GLX
    stub.xshmSI.shmid = -1;
    stub.bShmInitFailed = GL_FALSE;
    stub.pGLXPixmapsHash = crAllocHashtable();

    stub.bXExtensionsChecked = GL_FALSE;
    stub.bHaveXComposite = GL_FALSE;
    stub.bHaveXFixes = GL_FALSE;
#endif

    return true;
}
Example #28
0
static void
tilesortSPUSelfDispatch(SPUDispatchTable *self)
{
    crSPUInitDispatchTable( &(tilesort_spu.self) );
    crSPUCopyDispatchTable( &(tilesort_spu.self), self );
}
Example #29
0
static void arraySPUSelfDispatch(SPUDispatchTable *self)
{
    crSPUInitDispatchTable( &(array_spu.self) );
    crSPUCopyDispatchTable( &(array_spu.self), self );
}