Changeset 40691 in vbox for trunk/src/VBox/HostServices/SharedOpenGL/crserverlib
- Timestamp:
- Mar 28, 2012 3:48:51 PM (13 years ago)
- svn:sync-xref-src-repo-rev:
- 77147
- Location:
- trunk/src/VBox/HostServices/SharedOpenGL/crserverlib
- Files:
-
- 9 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/HostServices/SharedOpenGL/crserverlib/server.h
r39603 r40691 82 82 } CRServerProgram; 83 83 84 typedef struct {85 char *pszDpyName;86 GLint visualBits;87 int32_t internalID;88 } CRCreateInfo_t;89 90 84 void crServerSetVBoxConfiguration(); 91 85 void crServerSetVBoxConfigurationHGCM(); -
trunk/src/VBox/HostServices/SharedOpenGL/crserverlib/server_boundsinfo.c
r27889 r40691 265 265 266 266 if (!mural->viewportValidated) { 267 crServerComputeViewportBounds(&(cr_server.curClient->currentCtx ->viewport),267 crServerComputeViewportBounds(&(cr_server.curClient->currentCtxInfo->pContext->viewport), 268 268 mural); 269 269 } … … 292 292 { 293 293 mural->curExtent = p->id; 294 if (cr_server.run_queue->client->currentCtx ) {294 if (cr_server.run_queue->client->currentCtxInfo && cr_server.run_queue->client->currentCtxInfo->pContext) { 295 295 crServerSetOutputBounds( mural, mural->curExtent ); 296 296 } … … 315 315 { 316 316 mural->curExtent = i; 317 if (cr_server.run_queue->client->currentCtx ) {317 if (cr_server.run_queue->client->currentCtxInfo && cr_server.run_queue->client->currentCtxInfo->pContext) { 318 318 crServerSetOutputBounds( mural, i ); 319 319 } -
trunk/src/VBox/HostServices/SharedOpenGL/crserverlib/server_config.c
r36843 r40691 41 41 cr_server.num_overlap_intens = 0; 42 42 cr_server.overlap_intens = 0; 43 cr _server.SpuContext = 0;43 crMemset(&cr_server.MainContextInfo, 0, sizeof (cr_server.MainContextInfo)); 44 44 45 45 crMatrixInit(&cr_server.viewMatrix[0]); … … 219 219 cr_server.tcpip_port, 220 220 cr_server.mtu, 0); 221 newClient->currentCtx = cr_server.DummyContext;221 newClient->currentCtxInfo = &cr_server.MainContextInfo; 222 222 crServerAddToRunQueue(newClient); 223 223 … … 293 293 cr_server.tcpip_port, 294 294 cr_server.mtu, 0); 295 newClient->currentCtx = cr_server.DummyContext;295 newClient->currentCtxInfo = &cr_server.MainContextInfo; 296 296 crServerAddToRunQueue(newClient); 297 297 -
trunk/src/VBox/HostServices/SharedOpenGL/crserverlib/server_lists.c
r34725 r40691 80 80 list = TranslateListID( list ); 81 81 82 if (cr_server.curClient->currentCtx ->lists.mode == 0) {82 if (cr_server.curClient->currentCtxInfo->pContext->lists.mode == 0) { 83 83 /* we're not compiling, so execute the list now */ 84 84 /* Issue the list as-is */ … … 208 208 } 209 209 210 if (cr_server.curClient->currentCtx ->lists.mode == 0) {210 if (cr_server.curClient->currentCtxInfo->pContext->lists.mode == 0) { 211 211 /* we're not compiling, so execute the list now */ 212 212 /* Issue the list as-is */ -
trunk/src/VBox/HostServices/SharedOpenGL/crserverlib/server_main.c
r40318 r40691 109 109 110 110 111 static void deleteContextCallback( void *data ) 112 { 113 CRContext *c = (CRContext *) data; 114 crStateDestroyContext(c); 111 static void deleteContextInfoCallback( void *data ) 112 { 113 CRContextInfo *c = (CRContextInfo *) data; 114 crStateDestroyContext(c->pContext); 115 if (c->CreateInfo.pszDpyName) 116 crFree(c->CreateInfo.pszDpyName); 117 crFree(c); 115 118 } 116 119 … … 144 147 145 148 /* Free all context info */ 146 crFreeHashtable(cr_server.contextTable, deleteContext Callback);149 crFreeHashtable(cr_server.contextTable, deleteContextInfoCallback); 147 150 148 151 /* Free context/window creation info */ 149 crFreeHashtable(cr_server.pContextCreateInfoTable, crServerCreateInfoDeleteCB);150 152 crFreeHashtable(cr_server.pWindowCreateInfoTable, crServerCreateInfoDeleteCB); 151 153 … … 275 277 #endif 276 278 279 #ifndef DEBUG_misha 280 cr_server.bUseMultipleContexts = GL_FALSE; 281 #else 282 cr_server.bUseMultipleContexts = GL_FALSE; 283 #endif 284 285 if (cr_server.bUseMultipleContexts) 286 { 287 crInfo("Info: using multiple contexts!"); 288 crDebug("Debug: using multiple contexts!"); 289 } 290 277 291 cr_server.firstCallCreateContext = GL_TRUE; 278 292 cr_server.firstCallMakeCurrent = GL_TRUE; … … 298 312 */ 299 313 cr_server.contextTable = crAllocHashtable(); 300 cr_server. DummyContext = crStateCreateContext( &cr_server.limits,314 cr_server.MainContextInfo.pContext = crStateCreateContext( &cr_server.limits, 301 315 CR_RGB_BIT | CR_DEPTH_BIT, NULL ); 302 cr_server.curClient->currentCtx = cr_server.DummyContext;316 cr_server.curClient->currentCtxInfo = &cr_server.MainContextInfo; 303 317 304 318 crServerInitDispatch(); … … 334 348 #endif 335 349 350 #ifndef DEBUG_misha 351 cr_server.bUseMultipleContexts = GL_FALSE; 352 #else 353 cr_server.bUseMultipleContexts = GL_FALSE; 354 #endif 355 356 if (cr_server.bUseMultipleContexts) 357 { 358 crInfo("Info: using multiple contexts!"); 359 crDebug("Debug: using multiple contexts!"); 360 } 361 336 362 crNetInit(crServerRecv, crServerClose); 337 363 … … 341 367 cr_server.bIsInLoadingState = GL_FALSE; 342 368 cr_server.bIsInSavingState = GL_FALSE; 369 343 370 344 371 cr_server.pCleanupClient = NULL; … … 367 394 */ 368 395 cr_server.contextTable = crAllocHashtable(); 369 cr_server. DummyContext = crStateCreateContext( &cr_server.limits,396 cr_server.MainContextInfo.pContext = crStateCreateContext( &cr_server.limits, 370 397 CR_RGB_BIT | CR_DEPTH_BIT, NULL ); 371 cr_server.pContextCreateInfoTable = crAllocHashtable();398 // cr_server.pContextCreateInfoTable = crAllocHashtable(); 372 399 cr_server.pWindowCreateInfoTable = crAllocHashtable(); 373 400 … … 402 429 403 430 newClient->spu_id = 0; 404 newClient->currentCtx = cr_server.DummyContext;431 newClient->currentCtxInfo = &cr_server.MainContextInfo; 405 432 newClient->currentContextNumber = -1; 406 433 newClient->conn = crNetAcceptClient(cr_server.protocol, NULL, … … 686 713 static void crVBoxServerSaveCreateInfoCB(unsigned long key, void *data1, void *data2) 687 714 { 688 CRCreateInfo_t *pCreateInfo = (CRCreateInfo_t *) 715 CRCreateInfo_t *pCreateInfo = (CRCreateInfo_t *)data1; 689 716 PSSMHANDLE pSSM = (PSSMHANDLE) data2; 690 717 int32_t rc; … … 705 732 } 706 733 734 static void crVBoxServerSaveCreateInfoFromCtxInfoCB(unsigned long key, void *data1, void *data2) 735 { 736 CRContextInfo *pContextInfo = (CRContextInfo *)data1; 737 CRCreateInfo_t *pCreateInfo = &pContextInfo->CreateInfo; 738 crVBoxServerSaveCreateInfoCB(key, pCreateInfo, data2); 739 } 740 707 741 static void crVBoxServerSyncTextureCB(unsigned long key, void *data1, void *data2) 708 742 { … … 716 750 static void crVBoxServerSaveContextStateCB(unsigned long key, void *data1, void *data2) 717 751 { 718 CRContext *pContext = (CRContext *) data1; 752 CRContextInfo *pContextInfo = (CRContextInfo *) data1; 753 CRContext *pContext = pContextInfo->pContext; 719 754 PSSMHANDLE pSSM = (PSSMHANDLE) data2; 720 755 int32_t rc; … … 732 767 { 733 768 unsigned long id; 734 if (!crHashtableGetDataKey(cr_server.contextTable, pContext , &id))769 if (!crHashtableGetDataKey(cr_server.contextTable, pContextInfo, &id)) 735 770 { 736 771 crWarning("No client id for server ctx %d", pContext->id); … … 786 821 787 822 /* Save rendering contexts creation info */ 788 ui32 = crHashtableNumElements(cr_server. pContextCreateInfoTable);823 ui32 = crHashtableNumElements(cr_server.contextTable); 789 824 rc = SSMR3PutU32(pSSM, (uint32_t) ui32); 790 825 AssertRCReturn(rc, rc); 791 crHashtableWalk(cr_server. pContextCreateInfoTable, crVBoxServerSaveCreateInfoCB, pSSM);826 crHashtableWalk(cr_server.contextTable, crVBoxServerSaveCreateInfoFromCtxInfoCB, pSSM); 792 827 793 828 #ifdef CR_STATE_NO_TEXTURE_IMAGE_STORE … … 855 890 AssertRCReturn(rc, rc); 856 891 857 if (pClient->currentCtx && pClient->currentContextNumber>=0)892 if (pClient->currentCtxInfo && pClient->currentCtxInfo->pContext && pClient->currentContextNumber>=0) 858 893 { 859 b = crHashtableGetDataKey(cr_server.contextTable, pClient->currentCtx , &key);894 b = crHashtableGetDataKey(cr_server.contextTable, pClient->currentCtxInfo, &key); 860 895 CRASSERT(b); 861 896 rc = SSMR3PutMem(pSSM, &key, sizeof(key)); … … 878 913 } 879 914 915 static DECLCALLBACK(CRContext*) crVBoxServerGetContextCB(void* pvData) 916 { 917 CRContextInfo* pContextInfo = (CRContextInfo*)pvData; 918 CRASSERT(pContextInfo); 919 CRASSERT(pContextInfo->pContext); 920 return pContextInfo->pContext; 921 } 922 880 923 DECLEXPORT(int32_t) crVBoxServerLoadState(PSSMHANDLE pSSM, uint32_t version) 881 924 { … … 915 958 char psz[200]; 916 959 GLint ctxID; 960 CRContextInfo* pContextInfo; 917 961 CRContext* pContext; 918 962 … … 932 976 CRASSERT((int64_t)ctxID == (int64_t)key); 933 977 934 pContext = (CRContext*) crHashtableSearch(cr_server.contextTable, key); 935 CRASSERT(pContext); 978 pContextInfo = (CRContextInfo*) crHashtableSearch(cr_server.contextTable, key); 979 CRASSERT(pContextInfo); 980 CRASSERT(pContextInfo->pContext); 981 pContext = pContextInfo->pContext; 936 982 pContext->shared->id=-1; 937 983 } … … 940 986 for (ui=0; ui<uiNumElems; ++ui) 941 987 { 988 CRContextInfo* pContextInfo; 942 989 CRContext *pContext; 943 990 … … 945 992 AssertRCReturn(rc, rc); 946 993 947 pContext = (CRContext*) crHashtableSearch(cr_server.contextTable, key); 948 CRASSERT(pContext); 949 950 rc = crStateLoadContext(pContext, cr_server.contextTable, pSSM); 994 pContextInfo = (CRContextInfo*) crHashtableSearch(cr_server.contextTable, key); 995 CRASSERT(pContextInfo); 996 CRASSERT(pContextInfo->pContext); 997 pContext = pContextInfo->pContext; 998 999 rc = crStateLoadContext(pContext, cr_server.contextTable, crVBoxServerGetContextCB, pSSM); 951 1000 AssertRCReturn(rc, rc); 952 1001 } … … 1056 1105 1057 1106 pClient->currentContextNumber = -1; 1058 pClient->currentCtx = cr_server.DummyContext;1107 pClient->currentCtxInfo = &cr_server.MainContextInfo; 1059 1108 pClient->currentMural = NULL; 1060 1109 pClient->currentWindow = -1; … … 1062 1111 cr_server.curClient = pClient; 1063 1112 1064 if (client.currentCtx && client.currentContextNumber>=0)1113 if (client.currentCtxInfo && client.currentContextNumber>=0) 1065 1114 { 1066 1115 rc = SSMR3GetMem(pSSM, &ctxID, sizeof(ctxID)); 1067 1116 AssertRCReturn(rc, rc); 1068 client.currentCtx = (CRContext*) crHashtableSearch(cr_server.contextTable, ctxID); 1069 CRASSERT(client.currentCtx); 1117 client.currentCtxInfo = (CRContextInfo*) crHashtableSearch(cr_server.contextTable, ctxID); 1118 CRASSERT(client.currentCtxInfo); 1119 CRASSERT(client.currentCtxInfo->pContext); 1070 1120 //pClient->currentCtx = client.currentCtx; 1071 1121 //pClient->currentContextNumber = ctxID; … … 1094 1144 crServerDispatchMakeCurrent(winID, 0, ctxID); 1095 1145 1096 crHashtableWalk(client.currentCtx ->shared->textureTable, crVBoxServerSyncTextureCB, client.currentCtx);1097 1098 crStateTextureObjectDiff(client.currentCtx , NULL, NULL, &client.currentCtx->texture.base1D, GL_TRUE);1099 crStateTextureObjectDiff(client.currentCtx , NULL, NULL, &client.currentCtx->texture.base2D, GL_TRUE);1100 crStateTextureObjectDiff(client.currentCtx , NULL, NULL, &client.currentCtx->texture.base3D, GL_TRUE);1146 crHashtableWalk(client.currentCtxInfo->pContext->shared->textureTable, crVBoxServerSyncTextureCB, client.currentCtxInfo->pContext); 1147 1148 crStateTextureObjectDiff(client.currentCtxInfo->pContext, NULL, NULL, &client.currentCtxInfo->pContext->texture.base1D, GL_TRUE); 1149 crStateTextureObjectDiff(client.currentCtxInfo->pContext, NULL, NULL, &client.currentCtxInfo->pContext->texture.base2D, GL_TRUE); 1150 crStateTextureObjectDiff(client.currentCtxInfo->pContext, NULL, NULL, &client.currentCtxInfo->pContext->texture.base3D, GL_TRUE); 1101 1151 #ifdef CR_ARB_texture_cube_map 1102 crStateTextureObjectDiff(client.currentCtx , NULL, NULL, &client.currentCtx->texture.baseCubeMap, GL_TRUE);1152 crStateTextureObjectDiff(client.currentCtxInfo->pContext, NULL, NULL, &client.currentCtxInfo->pContext->texture.baseCubeMap, GL_TRUE); 1103 1153 #endif 1104 1154 #ifdef CR_NV_texture_rectangle 1105 1155 //@todo this doesn't work as expected 1106 //crStateTextureObjectDiff(client.currentCtx , NULL, NULL, &client.currentCtx->texture.baseRect, GL_TRUE);1156 //crStateTextureObjectDiff(client.currentCtxInfo->pContext, NULL, NULL, &client.currentCtxInfo->pContext->texture.baseRect, GL_TRUE); 1107 1157 #endif 1108 1158 /*cr_server.head_spu->dispatch_table.Materialfv(GL_FRONT_AND_BACK, GL_AMBIENT, amb); … … 1141 1191 tmpCtx = crStateCreateContext(NULL, createInfo->visualBits, NULL); 1142 1192 CRASSERT(tmpCtx); 1143 crStateDiffContext(tmpCtx, client.currentCtx );1193 crStateDiffContext(tmpCtx, client.currentCtxInfo->pContext); 1144 1194 crStateDestroyContext(tmpCtx);*/ 1145 1195 } … … 1264 1314 { 1265 1315 cr_server.curClient = cr_server.clients[i]; 1266 if (cr_server.curClient->currentCtx 1267 && (cr_server.curClient->currentCtx->buffer.pFrontImg || cr_server.curClient->currentCtx->buffer.pBackImg) 1316 if (cr_server.curClient->currentCtxInfo 1317 && cr_server.curClient->currentCtxInfo->pContext 1318 && (cr_server.curClient->currentCtxInfo->pContext->buffer.pFrontImg || cr_server.curClient->currentCtxInfo->pContext->buffer.pBackImg) 1268 1319 && cr_server.curClient->currentMural 1269 1320 && cr_server.curClient->currentMural->screenId == sIndex 1270 && cr_server.curClient->currentCtx ->buffer.storedHeight == h1271 && cr_server.curClient->currentCtx ->buffer.storedWidth == w)1321 && cr_server.curClient->currentCtxInfo->pContext->buffer.storedHeight == h 1322 && cr_server.curClient->currentCtxInfo->pContext->buffer.storedWidth == w) 1272 1323 { 1273 1324 int clientWindow = cr_server.curClient->currentWindow; … … 1279 1330 } 1280 1331 1281 crStateApplyFBImage(cr_server.curClient->currentCtx );1332 crStateApplyFBImage(cr_server.curClient->currentCtxInfo->pContext); 1282 1333 } 1283 1334 } -
trunk/src/VBox/HostServices/SharedOpenGL/crserverlib/server_misc.c
r33601 r40691 263 263 if (pCreateInfo->pszDpyName) 264 264 crFree(pCreateInfo->pszDpyName); 265 crFree(pCreateInfo); 265 266 } 266 267 -
trunk/src/VBox/HostServices/SharedOpenGL/crserverlib/server_projmatrix.c
r33540 r40691 32 32 else { 33 33 /* we have a quad-buffered window and we're watching glDrawBuffer */ 34 GLenum drawBuffer = cr_server.curClient->currentCtx ->buffer.drawBuffer;34 GLenum drawBuffer = cr_server.curClient->currentCtxInfo->pContext->buffer.drawBuffer; 35 35 int eye = drawBuffer == GL_BACK_RIGHT || drawBuffer == GL_FRONT_RIGHT 36 36 || drawBuffer == GL_RIGHT; … … 42 42 void SERVER_DISPATCH_APIENTRY crServerDispatchLoadMatrixf( const GLfloat *m ) 43 43 { 44 const GLenum matMode = cr_server.curClient->currentCtx ->transform.matrixMode;44 const GLenum matMode = cr_server.curClient->currentCtxInfo->pContext->transform.matrixMode; 45 45 const CRMuralInfo *mural = cr_server.curClient->currentMural; 46 46 … … 59 59 void SERVER_DISPATCH_APIENTRY crServerDispatchLoadMatrixd( const GLdouble *m ) 60 60 { 61 const GLenum matMode = cr_server.curClient->currentCtx ->transform.matrixMode;61 const GLenum matMode = cr_server.curClient->currentCtxInfo->pContext->transform.matrixMode; 62 62 const CRMuralInfo *mural = cr_server.curClient->currentMural; 63 63 … … 76 76 void SERVER_DISPATCH_APIENTRY crServerDispatchMultMatrixf( const GLfloat *m ) 77 77 { 78 const GLenum matMode = cr_server.curClient->currentCtx ->transform.matrixMode;78 const GLenum matMode = cr_server.curClient->currentCtxInfo->pContext->transform.matrixMode; 79 79 80 80 if (matMode == GL_PROJECTION && cr_server.projectionOverride) { … … 93 93 void SERVER_DISPATCH_APIENTRY crServerDispatchMultMatrixd( const GLdouble *m ) 94 94 { 95 const GLenum matMode = cr_server.curClient->currentCtx ->transform.matrixMode;95 const GLenum matMode = cr_server.curClient->currentCtxInfo->pContext->transform.matrixMode; 96 96 97 97 if (matMode == GL_PROJECTION && cr_server.projectionOverride) { … … 111 111 void SERVER_DISPATCH_APIENTRY crServerDispatchLoadIdentity( void ) 112 112 { 113 const GLenum matMode = cr_server.curClient->currentCtx ->transform.matrixMode;113 const GLenum matMode = cr_server.curClient->currentCtxInfo->pContext->transform.matrixMode; 114 114 const CRMuralInfo *mural = cr_server.curClient->currentMural; 115 115 -
trunk/src/VBox/HostServices/SharedOpenGL/crserverlib/server_stream.c
r40318 r40691 26 26 cr_server.mtu, 1 ); 27 27 28 newClient->currentCtx = cr_server.DummyContext;28 newClient->currentCtxInfo = &cr_server.MainContextInfo; 29 29 30 30 /* add to array */ … … 293 293 crServerClientInBeginEnd(const CRClient *client) 294 294 { 295 if (client->currentCtx && 296 (client->currentCtx->lists.currentIndex != 0 || 297 client->currentCtx->current.inBeginEnd || 298 client->currentCtx->occlusion.currentQueryObject)) { 295 if (client->currentCtxInfo 296 && client->currentCtxInfo->pContext 297 && (client->currentCtxInfo->pContext->lists.currentIndex != 0 || 298 client->currentCtxInfo->pContext->current.inBeginEnd || 299 client->currentCtxInfo->pContext->occlusion.currentQueryObject)) { 299 300 return GL_TRUE; 300 301 } … … 543 544 int clientWindow = cr_server.curClient->currentWindow; 544 545 int clientContext = cr_server.curClient->currentContextNumber; 545 if (clientWindow && clientWindow != cr_server.currentWindow) { 546 CRContextInfo *clientCtxInfo = cr_server.curClient->currentCtxInfo; 547 if (clientCtxInfo != cr_server.currentCtxInfo) { 546 548 crServerDispatchMakeCurrent(clientWindow, 0, clientContext); 547 549 /* … … 550 552 } 551 553 } 552 553 crStateMakeCurrent( cr_server.curClient->currentCtx );554 554 #endif 555 555 -
trunk/src/VBox/HostServices/SharedOpenGL/crserverlib/server_viewport.c
r33540 r40691 240 240 } 241 241 else 242 projMatrix = cr_server.curClient->currentCtx ->transform.projectionStack.top;242 projMatrix = cr_server.curClient->currentCtxInfo->pContext->transform.projectionStack.top; 243 243 244 244 cr_server.head_spu->dispatch_table.PushAttrib( GL_TRANSFORM_BIT ); … … 254 254 crServerApplyViewMatrix(const CRmatrix *view) 255 255 { 256 const CRmatrix *modelview = cr_server.curClient->currentCtx ->transform.modelViewStack.top;256 const CRmatrix *modelview = cr_server.curClient->currentCtxInfo->pContext->transform.modelViewStack.top; 257 257 258 258 cr_server.head_spu->dispatch_table.PushAttrib( GL_TRANSFORM_BIT );
Note:
See TracChangeset
for help on using the changeset viewer.