server_main.c revision 2609df5222cfcceb51ec536b2e3173b7227a232a
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync/* Copyright (c) 2001, Stanford University
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync * All rights reserved
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync * See the file LICENSE.txt for information on redistributing this software.
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsyncPFNCRHGSMICMDCOMPLETION g_pfnCrHgsmiCompletion = NULL;
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync * \mainpage CrServerLib
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync * \section CrServerLibIntroduction Introduction
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync * Chromium consists of all the top-level files in the cr
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync * directory. The core module basically takes care of API dispatch,
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync * and OpenGL state management.
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync * CRServer global data
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsyncDECLINLINE(int32_t) crVBoxServerClientGet(uint32_t u32ClientID, CRClient **ppClient)
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync if (cr_server.clients[i] && cr_server.clients[i]->conn
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync && cr_server.clients[i]->conn->u32ClientID==u32ClientID)
return VERR_NOT_SUPPORTED;
return VINF_SUCCESS;
SPU*
crServerHeadSPU(void)
static void crServerTearDown( void )
GLint i;
if (tearingdown)
while (pNode)
(void) id;
tearingdown = 0;
crPrintHelp(void)
crPrintHelp();
exit(0);
#ifndef WINDOWS
crStateInit();
void crVBoxServerTearDown(void)
crStateInit();
return GL_FALSE;
return GL_TRUE;
return VERR_MAX_THRDS_REACHED;
return VINF_SUCCESS;
int32_t i;
if (!pClient)
#ifdef VBOX_WITH_CRHGSMI
#ifdef VBOXCR_LOGFPS
#ifdef VBOXCR_LOGFPS
#ifdef VBOX_WITH_CRHGSMI
#ifdef VBOX_WITH_CRHGSMI
crNetRecv();
#ifndef VBOX_WITH_CRHGSMI
#ifdef VBOXCR_LOGFPS
return VINF_SUCCESS;
return rc;
#ifdef VBOX_WITH_CRHGSMI
return VERR_BUFFER_OVERFLOW;
if (*pcbBuffer)
return VINF_SUCCESS;
return rc;
#ifdef VBOX_WITH_CRHGSMI
int32_t i;
return VERR_NOT_SUPPORTED;
else return VINF_SUCCESS;
int32_t i;
return VINF_SUCCESS;
tearingdown = 0;
if (!key) return;
unsigned long id;
GLboolean b;
unsigned long key;
return VINF_SUCCESS;
CRASSERT(b);
CRASSERT(b);
return VINF_SUCCESS;
unsigned long key;
/* AssertRCReturn(...) will leave us in loading state, but it doesn't matter as we'd be failing anyway */
return VINF_SUCCESS;
ctxID = crServerDispatchCreateContextEx(createInfo.pszDpyName, createInfo.visualBits, 0, key, createInfo.internalID);
unsigned long key;
return VERR_NO_MEMORY;
/* Same workaround as described in stub.c:stubUpdateWindowVisibileRegions for compiz on a freshly booted VM*/
//pClient->currentCtx = client.currentCtx;
//pClient->currentMural = client.currentMural;
crHashtableWalk(client.currentCtx->shared->textureTable, crVBoxServerSyncTextureCB, client.currentCtx);
crStateTextureObjectDiff(client.currentCtx, NULL, NULL, &client.currentCtx->texture.base1D, GL_TRUE);
crStateTextureObjectDiff(client.currentCtx, NULL, NULL, &client.currentCtx->texture.base2D, GL_TRUE);
crStateTextureObjectDiff(client.currentCtx, NULL, NULL, &client.currentCtx->texture.base3D, GL_TRUE);
#ifdef CR_ARB_texture_cube_map
crStateTextureObjectDiff(client.currentCtx, NULL, NULL, &client.currentCtx->texture.baseCubeMap, GL_TRUE);
#ifdef CR_NV_texture_rectangle
//crStateTextureObjectDiff(client.currentCtx, NULL, NULL, &client.currentCtx->texture.baseRect, GL_TRUE);
/*cr_server.head_spu->dispatch_table.Materialfv(GL_FRONT_AND_BACK, GL_AMBIENT, amb);
cr_server.head_spu->dispatch_table.LightModelfv(GL_LIGHT_MODEL_AMBIENT, amb);
cr_server.head_spu->dispatch_table.Lightfv(GL_LIGHT1, GL_DIFFUSE, one);
cr_server.head_spu->dispatch_table.Enable(GL_LIGHTING);
cr_server.head_spu->dispatch_table.Enable(GL_LIGHT0);
cr_server.head_spu->dispatch_table.Enable(GL_LIGHT1);
cr_server.head_spu->dispatch_table.Enable(GL_CULL_FACE);
cr_server.head_spu->dispatch_table.Enable(GL_TEXTURE_2D);*/
//cr_server.head_spu->dispatch_table.Viewport( 0, 0, 600, 600 );
//cr_server.head_spu->dispatch_table.MatrixMode(GL_PROJECTION);
//cr_server.head_spu->dispatch_table.LoadIdentity();
//cr_server.head_spu->dispatch_table.Frustum(-0.5, 0.5, -0.5, 0.5, 1.5, 150.0);
//cr_server.head_spu->dispatch_table.MatrixMode(GL_MODELVIEW);
//cr_server.head_spu->dispatch_table.Frustum(-0.5, 0.5, -0.5, 0.5, 1.5, 150.0);
crStateDiffContext(tmpCtx, client.currentCtx);
return VINF_SUCCESS;
(void) data2;
return VERR_INVALID_PARAMETER;
return VERR_NOT_IMPLEMENTED;
for (i=0; i<sCount; ++i)
return VINF_SUCCESS;
return VERR_INVALID_PARAMETER;
return VINF_SUCCESS;
DECLEXPORT(int32_t) crVBoxServerMapScreen(int sIndex, int32_t x, int32_t y, uint32_t w, uint32_t h, uint64_t winID)
return VERR_INVALID_PARAMETER;
#ifndef WINDOWS
GLint i;
&& (cr_server.curClient->currentCtx->buffer.pFrontImg || cr_server.curClient->currentCtx->buffer.pBackImg)
return VINF_SUCCESS;
return VINF_SUCCESS;
return VINF_SUCCESS;
return VERR_NOT_SUPPORTED;
return VINF_SUCCESS;
if (pCallbacks)
return VINF_SUCCESS;
#ifdef VBOX_WITH_CRHGSMI
/* We moved all CrHgsmi command processing to crserverlib to keep the logic of dealing with CrHgsmi commands in one place.
* For now we need the notion of CrHgdmi commands in the crserver_lib to be able to complete it asynchronously once it is really processed.
* This help avoiding the "blocked-client" issues. The client is blocked if another client is doing begin-end stuff.
* For now we eliminated polling that could occur on block, which caused a higher-priority thread (in guest) polling for the blocked command complition
* In the future we will extend CrHgsmi functionality to maintain texture data directly in CrHgsmi allocation to avoid extra memcpy-ing with PBO,
* implement command completion and stuff necessary for GPU scheduling to work properly for WDDM Windows guests, etc.
if (!g_pvVRamBase)
CRASSERT(0);
return VINF_SUCCESS;
if (!cBuffers)
CRASSERT(0);
return VINF_SUCCESS;
switch (u32Function)
case SHCRGL_GUEST_FN_WRITE:
return rc;
case SHCRGL_GUEST_FN_INJECT:
return rc;
case SHCRGL_GUEST_FN_READ:
return VINF_SUCCESS;
return rc;
CRVBOXHGSMI_CMDDATA_SETWB(&pClient->conn->CmdData, pCmd, pHdr, pWriteback, cbWriteback, &pFnCmd->cbWriteback);
return rc;
case SHCRGL_GUEST_FN_SET_PID:
return rc;
PVBOXVDMACMD_CHROMIUM_CTL_CRHGSMI_SETUP_COMPLETION pSetup = (PVBOXVDMACMD_CHROMIUM_CTL_CRHGSMI_SETUP_COMPLETION)pCtl;
* E.g. ctl commands can be both Hgcm Host synchronous commands that do not require completion at all,
return rc;