コード例 #1
0
ファイル: spuoptions.c プロジェクト: boompig/chromium
/**
 * This is a cut-down version of crSPULoad() from spuload.c.  It just
 * does enough to retreive the options list from the spu, but doesn't
 * call any initialization functions from which the spu might try to
 * connect to the mothership, etc.
 */
static SPU *
SPULoadLite( SPU *child, int id, const 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;
    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 basically 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 );
    }

    /* ... and that's all
     */
    return the_spu;
}
コード例 #2
0
ファイル: icd_drv.c プロジェクト: svn2github/virtualbox
//we're not going to change icdTable at runtime, so callback is unused
PICDTABLE APIENTRY DrvSetContext(HDC hdc, HGLRC hglrc, void *callback)
{
    ContextInfo *pContext;
    WindowInfo  *pWindowInfo;
    BOOL ret = false;

    CR_DDI_PROLOGUE();

    (void) (callback);

    crHashtableLock(stub.windowTable);
    crHashtableLock(stub.contextTable);

    pContext = (ContextInfo *) crHashtableSearch(stub.contextTable, (unsigned long) hglrc);
    if (pContext)
    {
        pWindowInfo = stubGetWindowInfo(hdc);
        if (pWindowInfo)
            ret = stubMakeCurrent(pWindowInfo, pContext);
        else
            crError("no window info available.");
    }
    else
        crError("No context found.");

    crHashtableUnlock(stub.contextTable);
    crHashtableUnlock(stub.windowTable);

    return ret ? &icdTable : NULL;
}
コード例 #3
0
ファイル: fakedri_drv.c プロジェクト: tonado/vbox
static void
vboxApplyPatch(const char* psFuncName, void *pDst, const void *pSrc, unsigned long size)
{
    void *alPatch;
    int rv;

    /* Get aligned start address we're going to patch*/
    alPatch = (void*) ((uintptr_t)pDst & ~(uintptr_t)(PAGESIZE-1));

#ifndef VBOX_NO_MESA_PATCH_REPORTS
    crDebug("MProtecting: %p, %li", alPatch, pDst-alPatch+size);
#endif

    /* Get write access to mesa functions */
    rv = RTMemProtect(alPatch, pDst-alPatch+size, RTMEM_PROT_READ|RTMEM_PROT_WRITE|RTMEM_PROT_EXEC);
    if (RT_FAILURE(rv))
    {
        crError("mprotect failed with %x (%s)", rv, psFuncName);
    }

#ifndef VBOX_NO_MESA_PATCH_REPORTS
    crDebug("Writing %li bytes to %p from %p", size, pDst, pSrc);
#endif

    crMemcpy(pDst, pSrc, size);

    /*@todo Restore the protection, probably have to check what was it before us...*/
    rv = RTMemProtect(alPatch, pDst-alPatch+size, RTMEM_PROT_READ|RTMEM_PROT_EXEC);
    if (RT_FAILURE(rv))
    {
        crError("mprotect2 failed with %x (%s)", rv, psFuncName);
    }
}
コード例 #4
0
ファイル: arrayspu.c プロジェクト: L3oV1nc3/VMGL
static void ARRAYSPU_APIENTRY arrayspu_DrawElements(GLenum mode, GLsizei count,
																										GLenum type, const GLvoid *indices)
{
	int i;
	GLubyte *p = (GLubyte *)indices;
#ifdef CR_ARB_vertex_buffer_object
	CRBufferObject *elementsBuffer = array_spu.ctx->bufferobject.elementsBuffer;
#endif

	if (count < 0)
	{
		crError("array_spu.self.DrawElements passed negative count: %d", count);
	}

	if (mode > GL_POLYGON)
	{
		crError("array_spu.self.DrawElements called with invalid mode: %d", mode);
	}

	if (type != GL_UNSIGNED_BYTE && type != GL_UNSIGNED_SHORT && type != GL_UNSIGNED_INT)
	{
		crError("array_spu.self.DrawElements called with invalid type: %d", type);
	}

#ifdef CR_ARB_vertex_buffer_object
	if (elementsBuffer->data)
	{
		p = (unsigned char *)(elementsBuffer->data) + (unsigned long)p;
	}
#endif

	array_spu.self.Begin(mode);
	switch (type)
	{
		case GL_UNSIGNED_BYTE:
			for (i=0; i<count; i++)
			{
				array_spu.self.ArrayElement((GLint) *p++);
			}
			break;
		case GL_UNSIGNED_SHORT:
			for (i=0; i<count; i++)
			{
				array_spu.self.ArrayElement((GLint) * (GLushort *) p);
				p+=sizeof (GLushort);
			}
			break;
		case GL_UNSIGNED_INT:
			for (i=0; i<count; i++)
			{
				array_spu.self.ArrayElement((GLint) * (GLuint *) p);
				p+=sizeof (GLuint);
			}
			break;
		default:
			crError( "this can't happen: array_spu.self.DrawElements" );
			break;
	}
	array_spu.self.End();
}
コード例 #5
0
ファイル: net.c プロジェクト: L3oV1nc3/VMGL
/**
 * Establish a connection with a server.
 * \param server  the server to connect to, in the form
 *                "protocol://servername:port" where the port specifier
 *                is optional and if the protocol is missing it is assumed
 *                to be "tcpip".
 * \param default_port  the port to connect to, if port not specified in the
 *                      server URL string.
 * \param mtu  desired maximum transmission unit size (in bytes)
 */
CRConnection *
crNetConnectToServer( const char *server, unsigned short default_port, int mtu)
{
	char hostname[4096], protocol[4096];
	unsigned short port;
	CRConnection *conn;

	crDebug( "In crNetConnectToServer( \"%s\", port=%d, mtu=%d )",
					 server, default_port, mtu );

	CRASSERT( cr_net.initialized );

	if (mtu < CR_MINIMUM_MTU)
	{
		crError( "You tried to connect to server \"%s\" with an mtu of %d, "
						 "but the minimum MTU is %d", server, mtu, CR_MINIMUM_MTU );
	}

	/* Tear the URL apart into relevant portions. */
	if ( !crParseURL( server, protocol, hostname, &port, default_port ) ) {
		 crError( "Malformed URL: \"%s\"", server );
	}

	crDebug( "Connecting to %s on port %d, with protocol %s",
					 hostname, port, protocol );

	conn = (CRConnection *) crCalloc( sizeof(*conn) );
	if (!conn)
		return NULL;

	/* init the non-zero fields */
	conn->type               = CR_NO_CONNECTION; /* we don't know yet */
	conn->recv_credits       = CR_INITIAL_RECV_CREDITS;
	conn->hostname           = crStrdup( hostname );
	conn->port               = port;
	conn->mtu                = mtu;
	conn->buffer_size        = mtu;
	conn->endianness         = crDetermineEndianness();

#ifdef CHROMIUM_THREADSAFE
	crInitMutex(&conn->messageList.lock);
	crInitCondition(&conn->messageList.nonEmpty);
#endif

	/* now, just dispatch to the appropriate protocol's initialization functions. */
	InitConnection(conn, protocol, mtu);

	if (!crNetConnect( conn ))
	{
		crDebug("crNetConnectToServer() failed, freeing the connection");
		crFree( conn );
		return NULL;
	}

	crDebug( "Done connecting to %s (swapping=%d)", server, conn->swap );
#ifndef NDEBUG
	crNetDumpConnectionInfo(conn);
#endif
	return conn;
}
コード例 #6
0
static void swapsyncConnect(void)
{
    char hostname[4096], protocol[4096];
    unsigned short port;

    crNetInit(NULL, NULL);

    if (!crParseURL( render_spu.swap_master_url, protocol, hostname,
                    &port, 9876))
        crError( "Bad URL: %s", render_spu.swap_master_url );

    if (render_spu.is_swap_master)
    {
        int a;

        render_spu.swap_conns = (CRConnection **)crAlloc(
                        render_spu.num_swap_clients*sizeof(CRConnection *));
        for (a=0; a<render_spu.num_swap_clients; a++)
        {
            render_spu.swap_conns[a] = crNetAcceptClient( protocol, hostname, port,
                                                        render_spu.swap_mtu, 1);
        }
    }
    else
    {
        render_spu.swap_conns = (CRConnection **)crAlloc(sizeof(CRConnection *));

        render_spu.swap_conns[0] = crNetConnectToServer(render_spu.swap_master_url,
                                    port, render_spu.swap_mtu, 1);
        if (!render_spu.swap_conns[0])
            crError("Failed connection");
    }
}
コード例 #7
0
GLboolean
renderspu_SystemCreateContext(VisualInfo *visual, ContextInfo *context, ContextInfo *sharedContext)
{
    AGLPixelFormat pix;

    (void) sharedContext;
    CRASSERT(visual);
    CRASSERT(context);

    context->visual = visual;

    if( !renderspuChoosePixelFormat(context, &pix) ) {
        crError( "Render SPU (renderspu_SystemCreateContext): Unable to create pixel format" );
        return GL_FALSE;
    }

    context->context = render_spu.ws.aglCreateContext( pix, NULL );
    renderspuDestroyPixelFormat( context, &pix );

    if( !context->context ) {
        crError( "Render SPU (renderspu_SystemCreateContext): Could not create rendering context" );
        return GL_FALSE;
    }

    return GL_TRUE;
}
コード例 #8
0
ファイル: net.c プロジェクト: L3oV1nc3/VMGL
/**
 * If an incoming message is not consumed by any of the connection's
 * receive callbacks, this function will get called.
 *
 * XXX Make this function static???
 */
void
crNetDefaultRecv( CRConnection *conn, CRMessage *msg, unsigned int len )
{
	switch (msg->header.type)
	{
		case CR_MESSAGE_GATHER:
			break;
		case CR_MESSAGE_MULTI_BODY:
		case CR_MESSAGE_MULTI_TAIL:
			crNetRecvMulti( conn, &(msg->multi), len );
			return;
		case CR_MESSAGE_FLOW_CONTROL:
			crNetRecvFlowControl( conn, &(msg->flowControl), len );
			return;
		case CR_MESSAGE_OPCODES:
		case CR_MESSAGE_OOB:
			{
				/*CRMessageOpcodes *ops = (CRMessageOpcodes *) msg;
				 *unsigned char *data_ptr = (unsigned char *) ops + sizeof( *ops) + ((ops->numOpcodes + 3 ) & ~0x03);
				 *crDebugOpcodes( stdout, data_ptr-1, ops->numOpcodes ); */
			}
			break;
		case CR_MESSAGE_READ_PIXELS:
			crError( "Can't handle read pixels" );
			return;
		case CR_MESSAGE_WRITEBACK:
			crNetRecvWriteback( &(msg->writeback) );
			return;
		case CR_MESSAGE_READBACK:
			crNetRecvReadback( &(msg->readback), len );
			return;
		case CR_MESSAGE_CRUT:
			/* nothing */
			break;
		default:
			/* We can end up here if anything strange happens in
			 * the GM layer.  In particular, if the user tries to
			 * send unpinned memory over GM it gets sent as all
			 * 0xAA instead.  This can happen when a program exits
			 * ungracefully, so the GM is still DMAing memory as
			 * it is disappearing out from under it.  We can also
			 * end up here if somebody adds a message type, and
			 * doesn't put it in the above case block.  That has
			 * an obvious fix. */
			{
				char string[128];
				crBytesToString( string, sizeof(string), msg, len );
				crError("crNetDefaultRecv: received a bad message: type=%d buf=[%s]\n"
								"Did you add a new message type and forget to tell "
								"crNetDefaultRecv() about it?\n",
								msg->header.type, string );
			}
	}

	/* If we make it this far, it's not a special message, so append it to
	 * the end of the connection's list of received messages.
	 */
	crEnqueueMessage(&conn->messageList, msg, len, conn);
}
コード例 #9
0
ファイル: spuload.c プロジェクト: boompig/chromium
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;
}
コード例 #10
0
ファイル: dlm_state.c プロジェクト: miguelinux/vbox
static bool
crDLMLoadListInstance(PSSMHANDLE pSSM, DLMListInfo *pListInfo, SPUDispatchTable *dispatchTable)
{
    uint32_t         cbInstance = 0;
    DLMInstanceList *pInstance;
    int32_t          rc;

    /* Get Display List item size. */
    rc = SSMR3GetU32(pSSM, &cbInstance);
    if (RT_SUCCESS(rc))
    {
        /* Allocate memory for the item, initialize it and put into the list. */
        pInstance = crCalloc(cbInstance);
        if (pInstance)
        {
            crMemset(pInstance, 0, cbInstance);

            rc = SSMR3GetMem(pSSM, pInstance, cbInstance); AssertRCReturn(rc, rc);
            if (RT_SUCCESS(rc))
            {
                pInstance->execute = crDLMGetExecuteRoutine(pInstance->iVBoxOpCode);
                if (pInstance->execute)
                {
                    pInstance->execute(pInstance, dispatchTable);

                    pInstance->next         = NULL;
                    pInstance->stateNext    = NULL;
                    pInstance->cbInstance   = cbInstance;

                    pListInfo->numInstances++;

                    if (!pListInfo->first)
                        pListInfo->first = pInstance;

                    if (pListInfo->last)
                        pListInfo->last->next = pInstance;

                    pListInfo->last = pInstance;

                    return true;
                }
                else
                    crError("Restoring Display Lists: unknown list item (opcode=%u).", pInstance->iVBoxOpCode);
            }
            else
                crError("Restoring Display Lists: can't read list element size.");
        }
        else
            crError("Restoring Display Lists: not enough memory, aborting.");
    }
    else
        crError("Restoring Display Lists: saved state file might be corrupted.");

    return false;
}
コード例 #11
0
ファイル: dlm_state.c プロジェクト: miguelinux/vbox
static void crDLMSaveListsCb(unsigned long key, void *pData1, void *pData2)
{
    DLMListInfo         *pListInfo      = (DLMListInfo*)pData1;
    CRDLMSaveListsCbArg *pArg           = (CRDLMSaveListsCbArg *)pData2;
    PSSMHANDLE           pSSM           = pArg->pSSM;
    DLMInstanceList     *pInstance      = pListInfo->first;
    uint32_t             cInstanceCheck = 0;
    int32_t              rc;

    crDebug("Saving Display Lists: found ID=%u, numInstances=%d.", key, pListInfo->numInstances);

    /* Store Display List length. */
    rc = SSMR3PutU32(pSSM, pListInfo->numInstances);
    if (RT_SUCCESS(rc))
    {
        /* Store Display List (guest) ID. */
        rc = SSMR3PutU32(pSSM, (uint32_t)key);
        if (RT_SUCCESS(rc))
        {
            /* Store each Display List item one by one. */
            while (pInstance)
            {
                /* Let's count each list item and compare total number with pListInfo->numInstances.
                 * This is simple consistency check. */
                cInstanceCheck++;

                /* Store instance data size. */
                rc = SSMR3PutU32(pSSM, (uint32_t)pInstance->cbInstance);
                if (RT_SUCCESS(rc))
                {
                    rc = SSMR3PutMem(pSSM, pInstance, pInstance->cbInstance);
                    if (RT_SUCCESS(rc))
                    {
                        /* We just stored all we need. Let's move on to the next list element. */
                        pInstance = pInstance->next;
                        continue;
                    }
                }

                crError("Saving Display Lists: can't store data.");

                pArg->err = 1;
                return;
            }

            if (cInstanceCheck == pListInfo->numInstances)
                return;

            crError("Saving Display Lists: list currupted.");
        }
    }

    pArg->err = 1;
}
コード例 #12
0
ファイル: binaryswapspu_config.c プロジェクト: alown/chromium
static void set_node( void *spu, const char *response )
{
	(void) spu;
	if (*response) {
		binaryswap_spu.node_num = crStrToInt( response );
		if(binaryswap_spu.node_num == -1)
		     crError( "FATAL: No node number specified for the binaryswap SPU?" );     
	}
	else {
		crError( "FATAL: No node number specified for the binaryswap SPU?" );
	}
}
コード例 #13
0
void PACK_APIENTRY 
crPackDeleteRenderbuffersEXTSWAP(GLsizei n, const GLuint * renderbuffers)
{
    (void) n;
    (void) renderbuffers;
    crError ("No swap version");
}
コード例 #14
0
ファイル: packspu_glsl.c プロジェクト: jbremer/virtualbox
static GLint packspu_GetUniformLocationUncached(GLuint program, const char * name)
{
    GET_THREAD(thread);
    int writeback = 1;
    GLint return_val = (GLint) 0;
    if (!CRPACKSPU_IS_WDDM_CRHGSMI() && !(pack_spu.thread[pack_spu.idxThreadInUse].netServer.conn->actual_network))
    {
        crError("packspu_GetUniformLocation doesn't work when there's no actual network involved!\nTry using the simplequery SPU in your chain!");
    }
    if (pack_spu.swap)
    {
        crPackGetUniformLocationSWAP(program, name, &return_val, &writeback);
    }
    else
    {
        crPackGetUniformLocation(program, name, &return_val, &writeback);
    }
    packspuFlush((void *) thread);
    CRPACKSPU_WRITEBACK_WAIT(thread, writeback);
    if (pack_spu.swap)
    {
        return_val = (GLint) SWAP32(return_val);
    }
    return return_val;
}
コード例 #15
0
ファイル: packspu_glsl.c プロジェクト: jbremer/virtualbox
GLuint PACKSPU_APIENTRY packspu_CreateProgram(void)
{
    GET_THREAD(thread);
    int writeback = 1;
    GLuint return_val = (GLuint) 0;
    if (!CRPACKSPU_IS_WDDM_CRHGSMI() && !(pack_spu.thread[pack_spu.idxThreadInUse].netServer.conn->actual_network))
    {
        crError("packspu_CreateProgram doesn't work when there's no actual network involved!\nTry using the simplequery SPU in your chain!");
    }
    if (pack_spu.swap)
    {
        crPackCreateProgramSWAP(&return_val, &writeback);
    }
    else
    {
        crPackCreateProgram(&return_val, &writeback);
    }
    packspuFlush((void *) thread);
    CRPACKSPU_WRITEBACK_WAIT(thread, writeback);
    if (pack_spu.swap)
    {
        return_val = (GLuint) SWAP32(return_val);
    }

    crStateCreateProgram(return_val);

    return return_val;
}
コード例 #16
0
GLuint PACKSPU_APIENTRY packspu_VBoxPackGetInjectID(GLint con)
{
    GLuint ret;

    crLockMutex(&_PackMutex);
    {
        ThreadInfo *thread = NULL;
        if (CRPACKSPU_IS_WDDM_CRHGSMI())
        {
            if (!con)
            {
                crError("connection expected!");
                return 0;
            }
            thread = GET_THREAD_VAL_ID(con);
        }
        else
        {
            CRASSERT(!con);
            thread = GET_THREAD_VAL();
        }
        CRASSERT(thread && thread->netServer.conn && thread->netServer.conn->type==CR_VBOXHGCM);
        ret = thread->netServer.conn->u32ClientID;
    }
    crUnlockMutex(&_PackMutex);

    return ret;
}
コード例 #17
0
ファイル: main.c プロジェクト: hanzhaogang/chromium-1
static void
buildMenu(void)
{
    /* XML parsing is done using expat */
    int done = 1;
    int len = strlen(crut_api.menuBuffer);

    XML_Parser p = XML_ParserCreate(NULL);

    if (! p) 
    {
	fprintf(stderr, "Couldn't allocate memory for parser\n");
	exit(-1);
    }
    
    XML_UseParserAsHandlerArg(p);
    XML_SetElementHandler(p, start_hndl, end_hndl);

    if (! XML_Parse(p, crut_api.menuBuffer, len, done)) 
    {
	crError("Parse error at line %d:\n%s\n",
	      XML_GetCurrentLineNumber(p),
	      XML_ErrorString(XML_GetErrorCode(p)));
    }

    buildGLUTMenu( crut_server.stack );

    buildValueArray();
}
コード例 #18
0
ファイル: net.c プロジェクト: L3oV1nc3/VMGL
/**
 * Send a set of commands on a connection.  Pretty straightforward, just
 * error checking, byte counting, and a dispatch to the protocol's
 * "send" implementation.
 * The payload will be prefixed by a 4-byte length field.
 *
 * \param conn  the network connection
 * \param bufp  if non-null the buffer was provided by the network layer
 *              and will be returned to the 'free' pool after it's sent.
 * \param start  points to first byte to send, which must point to a CRMessage
 *               object!
 * \param len  number of bytes to send
 */
void
crNetSend(CRConnection *conn, void **bufp, const void *start, unsigned int len)
{
	CRASSERT( conn );
	CRASSERT( len > 0 );
	if ( bufp ) {
		/* The region from [start .. start + len - 1] must lie inside the
		 * buffer pointed to by *bufp.
		 */
		CRASSERT( start >= *bufp );
		CRASSERT( (unsigned char *) start + len <=
							(unsigned char *) *bufp + conn->buffer_size );
	}

#ifndef NDEBUG
	if ( conn->send_credits > CR_INITIAL_RECV_CREDITS )
	{
		crError( "crNetSend: send_credits=%u, looks like there is a leak (max=%u)",
						 conn->send_credits, CR_INITIAL_RECV_CREDITS );
	}
#endif

	conn->total_bytes_sent += len;

	conn->Send( conn, bufp, start, len );
}
コード例 #19
0
void packspuConnectToServer( CRNetServer *server
#if defined(VBOX_WITH_CRHGSMI) && defined(IN_GUEST)
                , struct VBOXUHGSMI *pHgsmi
#endif
        )
{
    if (pack_spu.numThreads == 0) {
        packspuFirstConnectToServer( server
#if defined(VBOX_WITH_CRHGSMI) && defined(IN_GUEST)
                , pHgsmi
#endif
                );
        if (!server->conn) {
            crError("packspuConnectToServer: no connection on first create!");
            return;
        }
    }
    else {
        /* a new pthread */
        crNetNewClient(server
#if defined(VBOX_WITH_CRHGSMI) && defined(IN_GUEST)
                , pHgsmi
#endif
        );
    }
}
コード例 #20
0
ファイル: client.c プロジェクト: alown/chromium
/* Send reset message to the mothership */
void crMothershipReset( CRConnection *conn )
{
	if (!crMothershipSendString( conn, NULL, "reset" ))
	{
		crError( "Couldn't reset the server!" );
	}
}
コード例 #21
0
static const char* crGlslGetFsStringNoAlpha(CR_GLSL_CACHE *pCache, GLenum enmTexTarget)
{
    if (!CrGlslIsSupported(pCache))
    {
        crWarning("CrGlslIsSupported is false");
        return NULL;
    }

    if (pCache->iGlVersion >= CR_GLVERSION_COMPOSE(2, 1, 0))
    {
        if (enmTexTarget == GL_TEXTURE_2D)
            return CR_GLSL_PATTERN_FS_NOALPHA(CR_GLSL_STR_V_120, "", CR_GLSL_STR_2D);
        else if (enmTexTarget == GL_TEXTURE_RECTANGLE_ARB)
            return CR_GLSL_PATTERN_FS_NOALPHA(CR_GLSL_STR_V_120, CR_GLSL_STR_EXT_TR, CR_GLSL_STR_2DRECT);

        crWarning("invalid enmTexTarget %#x", enmTexTarget);
        return NULL;
    }
    else if (pCache->iGlVersion >= CR_GLVERSION_COMPOSE(2, 0, 0))
    {
        if (enmTexTarget == GL_TEXTURE_2D)
            return CR_GLSL_PATTERN_FS_NOALPHA("", "", CR_GLSL_STR_2D);
        else if (enmTexTarget == GL_TEXTURE_RECTANGLE_ARB)
            return CR_GLSL_PATTERN_FS_NOALPHA("", CR_GLSL_STR_EXT_TR, CR_GLSL_STR_2DRECT);

        crWarning("invalid enmTexTarget %#x", enmTexTarget);
        return NULL;
    }

    crError("crGlslGetFsStringNoAlpha: we should not be here!");
    return NULL;
}
コード例 #22
0
ファイル: crutapi.c プロジェクト: alown/chromium
void
CRUT_APIENTRY
crutGetMenuXML( CRUTAPI *crut_api )
{
    char response[8096];
    
    if (!crut_api->mothershipConn)
	crError("Checking for Menu XML but no connection!"); 
    
    crMothershipGetParam( crut_api->mothershipConn, "crut_menu_xml", response );
    
    if (crStrlen(response) < MENU_MAX_SIZE)
		crMemcpy(crut_api->menuBuffer, response, crStrlen(response));
    else
		crError("Menu XML is too long for buffer");
}
コード例 #23
0
GLboolean stubCtxCreate(ContextInfo *context)
{
    /*
     * Create a Chromium context.
     */
#if defined(GLX) || defined(DARWIN)
    GLint spuShareCtx = context->share ? context->share->spuContext : 0;
#else
    GLint spuShareCtx = 0;
#endif
    GLint spuConnection = 0;
    CRASSERT(stub.spu);
    CRASSERT(stub.spu->dispatch_table.CreateContext);
    context->type = CHROMIUM;

#if defined(VBOX_WITH_CRHGSMI) && defined(IN_GUEST)
    if (context->pHgsmi)
    {
        spuConnection = stub.spu->dispatch_table.VBoxConCreate(context->pHgsmi);
        if (!spuConnection)
        {
            crError("VBoxConCreate failed");
            return GL_FALSE;
        }
        context->spuConnection = spuConnection;
    }
#endif

    context->spuContext
        = stub.spu->dispatch_table.VBoxCreateContext(spuConnection, context->dpyName,
                                            context->visBits,
                                            spuShareCtx);

    return GL_TRUE;
}
コード例 #24
0
void PACK_APIENTRY 
crPackDeleteFramebuffersEXTSWAP(GLsizei n, const GLuint * framebuffers)
{
    (void) n;
    (void) framebuffers;
    crError ("No swap version");
}
コード例 #25
0
void PACKSPU_APIENTRY packspu_GenTextures( GLsizei n, GLuint * textures )
{
    GET_THREAD(thread);
    int writeback = 1;
    unsigned int i;
    if (!CRPACKSPU_IS_WDDM_CRHGSMI() && !(pack_spu.thread[pack_spu.idxThreadInUse].netServer.conn->actual_network))
    {
        crError( "packspu_GenTextures doesn't work when there's no actual network involved!\nTry using the simplequery SPU in your chain!" );
    }
    if (pack_spu.swap)
    {
        crPackGenTexturesSWAP( n, textures, &writeback );
    }
    else
    {
        crPackGenTextures( n, textures, &writeback );
    }
    packspuFlush( (void *) thread );
    CRPACKSPU_WRITEBACK_WAIT(thread, writeback);
    if (pack_spu.swap)
    {
        for (i = 0 ; i < (unsigned int) n ; i++)
        {
            textures[i] = SWAP32(textures[i]);
        }
    }

    crStateRegTextures(n, textures);
}
コード例 #26
0
ファイル: sdp.c プロジェクト: boompig/chromium
static void
crSDPFree( CRConnection *conn, void *buf )
{
	CRSDPBuffer *sdp_buffer = (CRSDPBuffer *) buf - 1;

	CRASSERT( sdp_buffer->magic == CR_SDP_BUFFER_MAGIC );
	conn->recv_credits += sdp_buffer->len;

	switch ( sdp_buffer->kind )
	{
	case CRSDPMemory:
#ifdef CHROMIUM_THREADSAFE
		crLockMutex(&cr_sdp.mutex);
#endif
		if (cr_sdp.bufpool) {
			/* pool may have been deallocated just a bit earlier in response
			 * to a SIGPIPE (Broken Pipe) signal.
			 */
			crBufferPoolPush( cr_sdp.bufpool, sdp_buffer, sdp_buffer->allocated );
		}
#ifdef CHROMIUM_THREADSAFE
		crUnlockMutex(&cr_sdp.mutex);
#endif
		break;

	case CRSDPMemoryBig:
		crFree( sdp_buffer );
		break;

	default:
		crError( "Weird buffer kind trying to free in crSDPFree: %d", sdp_buffer->kind );
	}
}
コード例 #27
0
ファイル: net.c プロジェクト: L3oV1nc3/VMGL
/**
 * Like crNetSend(), but the network layer is free to discard the data
 * if something goes wrong.  In particular, the UDP layer might discard
 * the data in the event of transmission errors.
 */
void crNetBarf( CRConnection *conn, void **bufp,
		            const void *start, unsigned int len )
{
	CRASSERT( conn );
	CRASSERT( len > 0 );
	CRASSERT( conn->Barf );
	if ( bufp ) {
		CRASSERT( start >= *bufp );
		CRASSERT( (unsigned char *) start + len <=
				(unsigned char *) *bufp + conn->buffer_size );
	}

#ifndef NDEBUG
	if ( conn->send_credits > CR_INITIAL_RECV_CREDITS )
	{
		crError( "crNetBarf: send_credits=%u, looks like there is a "
				"leak (max=%u)", conn->send_credits,
				CR_INITIAL_RECV_CREDITS );
	}
#endif

	conn->total_bytes_sent += len;

	conn->Barf( conn, bufp, start, len );
}
コード例 #28
0
ファイル: dlm_state.c プロジェクト: miguelinux/vbox
bool DLM_APIENTRY
crDLMLoadState(CRDLM *dlm, PSSMHANDLE pSSM, SPUDispatchTable *dispatchTable)
{
    uint32_t cLists = 0;
    uint32_t i;
    int32_t  rc;
    bool     fSuccess = true;

    /* Get number of Display Lists assigned to current DLM context. */
    rc = SSMR3GetU32(pSSM, &cLists);
    if (RT_SUCCESS(rc))
    {
        crDebug("Restoring Display Lists: %u lists to restore.", cLists);

        for (i = 0; i < cLists; i++)
        {
            fSuccess = crDLMLoadList(dlm, pSSM, dispatchTable);
            if (!fSuccess)
                break;
        }
    }
    else
        crError("Restoring Display Lists: can't get number of lists.");

    return fSuccess;
}
コード例 #29
0
ファイル: filenet.c プロジェクト: alown/chromium
static void
crFileFree( CRConnection *conn, void *buf )
{
	CRFileBuffer *file_buffer = (CRFileBuffer *) buf - 1;

	CRASSERT( file_buffer->magic == CR_FILE_BUFFER_MAGIC );
	conn->recv_credits += file_buffer->len;

	switch ( file_buffer->kind )
	{
		case CRFileMemory:
#ifdef CHROMIUM_THREADSAFE
			crLockMutex(&cr_file.mutex);
#endif
			crBufferPoolPush( cr_file.bufpool, file_buffer, conn->buffer_size );
#ifdef CHROMIUM_THREADSAFE
			crUnlockMutex(&cr_file.mutex);
#endif
			break;

		case CRFileMemoryBig:
			crFree( file_buffer );
			break;

		default:
			crError( "Weird buffer kind trying to free in crFileFree: %d", file_buffer->kind );
	}
}
コード例 #30
0
void stubConFlush(GLint con)
{
    if (con)
        stub.spu->dispatch_table.VBoxConFlush(con);
    else
        crError("stubConFlush called with null connection");
}