Changeset 44196 in vbox for trunk/src/VBox/HostServices/SharedOpenGL
- Timestamp:
- Dec 21, 2012 12:02:47 PM (12 years ago)
- Location:
- trunk/src/VBox/HostServices/SharedOpenGL/crserverlib
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/HostServices/SharedOpenGL/crserverlib/server_blitter.cpp
r43980 r44196 407 407 pBlitter->pRestoreCtxInfo->SpuContext >= 0 408 408 ? pBlitter->pRestoreCtxInfo->SpuContext : cr_server.MainContextInfo.SpuContext); 409 crStateSwi chPostprocess(pBlitter->pRestoreCtxInfo->pContext, pBlitter->pRestoreCtxInfo->pContext, idDrawFBO, idReadFBO);409 crStateSwitchPostprocess(pBlitter->pRestoreCtxInfo->pContext, NULL, idDrawFBO, idReadFBO); 410 410 } 411 411 else … … 448 448 idReadFBO = 0; 449 449 } 450 crStateSwi chPrepare(NULL, pRestoreCtxInfo->pContext, idDrawFBO, idReadFBO);450 crStateSwitchPrepare(NULL, pRestoreCtxInfo->pContext, idDrawFBO, idReadFBO); 451 451 452 452 cr_server.head_spu->dispatch_table.Flush(); -
trunk/src/VBox/HostServices/SharedOpenGL/crserverlib/server_context.c
r43980 r44196 140 140 } 141 141 142 {143 /* As we're using only one host context to serve all client contexts, newly created context will still144 * hold last error value from any previous failed opengl call. Proper solution would be to redirect any145 * client glGetError calls to our state tracker, but right now it's missing quite a lot of checks and doesn't146 * reflect host driver/gpu specific issues. Thus we just reset last opengl error at context creation.147 */148 GLint err;149 150 err = cr_server.head_spu->dispatch_table.GetError();151 if (err!=GL_NO_ERROR)152 {153 #ifdef DEBUG_misha154 crDebug("Cleared gl error %#x on context creation", err);155 #else156 crWarning("Cleared gl error %#x on context creation", err);157 #endif158 }159 }160 161 142 crServerReturnValue( &retVal, sizeof(retVal) ); 162 143 … … 330 311 /* Ubuntu 11.04 hosts misbehave if context window switch is 331 312 * done with non-default framebuffer object settings. 332 * crStateSwi chPrepare & crStateSwichPostprocess are supposed to work around this problem333 * crStateSwi chPrepare restores the FBO state to its default values before the context window switch,334 * while crStateSwi chPostprocess restores it back to the original values */313 * crStateSwitchPrepare & crStateSwitchPostprocess are supposed to work around this problem 314 * crStateSwitchPrepare restores the FBO state to its default values before the context window switch, 315 * while crStateSwitchPostprocess restores it back to the original values */ 335 316 oldCtx = crStateGetCurrent(); 336 317 if (oldMural && oldMural->fUseFBO && crServerSupportRedirMuralFBO()) … … 344 325 idReadFBO = 0; 345 326 } 346 crStateSwi chPrepare(cr_server.bUseMultipleContexts ? NULL : ctx, oldCtx, idDrawFBO, idReadFBO);327 crStateSwitchPrepare(cr_server.bUseMultipleContexts ? NULL : ctx, oldCtx, idDrawFBO, idReadFBO); 347 328 348 329 /* … … 431 412 idReadFBO = 0; 432 413 } 433 crStateSwi chPostprocess(ctx, cr_server.bUseMultipleContexts ? ctx: oldCtx, idDrawFBO, idReadFBO);414 crStateSwitchPostprocess(ctx, cr_server.bUseMultipleContexts ? NULL : oldCtx, idDrawFBO, idReadFBO); 434 415 435 416 if (!ctx->framebufferobject.drawFB -
trunk/src/VBox/HostServices/SharedOpenGL/crserverlib/server_main.c
r43999 r44196 761 761 762 762 #ifdef CR_STATE_NO_TEXTURE_IMAGE_STORE 763 CRASSERT(cr_server.curClient); 763 764 if (cr_server.curClient) 764 765 { 765 unsigned long id; 766 if (!crHashtableGetDataKey(cr_server.contextTable, pContextInfo, &id)) 767 { 768 crWarning("No client id for server ctx %d", pContext->id); 769 } 770 else 771 { 772 crServerDispatchMakeCurrent(cr_server.curClient->currentWindow, 0, id); 773 } 766 # ifdef DEBUG_misha 767 { 768 unsigned long id; 769 if (!crHashtableGetDataKey(cr_server.contextTable, pContextInfo, &id)) 770 crWarning("No client id for server ctx %d", pContext->id); 771 else 772 CRASSERT(id == key); 773 } 774 # endif 775 crServerDispatchMakeCurrent(cr_server.curClient->currentWindow, 0, key); 774 776 } 775 777 #endif … … 778 780 CRASSERT(rc == VINF_SUCCESS); 779 781 } 782 783 #if 0 784 typedef struct CR_SERVER_CHECK_BUFFERS 785 { 786 CRBufferObject *obj; 787 CRContext *ctx; 788 }CR_SERVER_CHECK_BUFFERS, *PCR_SERVER_CHECK_BUFFERS; 789 790 static void crVBoxServerCheckConsistencyContextBuffersCB(unsigned long key, void *data1, void *data2) 791 { 792 CRContextInfo* pContextInfo = (CRContextInfo*)data1; 793 CRContext *ctx = pContextInfo->pContext; 794 PCR_SERVER_CHECK_BUFFERS pBuffers = (PCR_SERVER_CHECK_BUFFERS)data2; 795 CRBufferObject *obj = pBuffers->obj; 796 CRBufferObjectState *b = &(ctx->bufferobject); 797 int j, k; 798 799 if (obj == b->arrayBuffer) 800 { 801 Assert(!pBuffers->ctx || pBuffers->ctx == ctx); 802 pBuffers->ctx = ctx; 803 } 804 if (obj == b->elementsBuffer) 805 { 806 Assert(!pBuffers->ctx || pBuffers->ctx == ctx); 807 pBuffers->ctx = ctx; 808 } 809 #ifdef CR_ARB_pixel_buffer_object 810 if (obj == b->packBuffer) 811 { 812 Assert(!pBuffers->ctx || pBuffers->ctx == ctx); 813 pBuffers->ctx = ctx; 814 } 815 if (obj == b->unpackBuffer) 816 { 817 Assert(!pBuffers->ctx || pBuffers->ctx == ctx); 818 pBuffers->ctx = ctx; 819 } 820 #endif 821 822 #ifdef CR_ARB_vertex_buffer_object 823 for (j=0; j<CRSTATECLIENT_MAX_VERTEXARRAYS; ++j) 824 { 825 CRClientPointer *cp = crStateGetClientPointerByIndex(j, &ctx->client.array); 826 if (obj == cp->buffer) 827 { 828 Assert(!pBuffers->ctx || pBuffers->ctx == ctx); 829 pBuffers->ctx = ctx; 830 } 831 } 832 833 for (k=0; k<ctx->client.vertexArrayStackDepth; ++k) 834 { 835 CRVertexArrays *pArray = &ctx->client.vertexArrayStack[k]; 836 for (j=0; j<CRSTATECLIENT_MAX_VERTEXARRAYS; ++j) 837 { 838 CRClientPointer *cp = crStateGetClientPointerByIndex(j, pArray); 839 if (obj == cp->buffer) 840 { 841 Assert(!pBuffers->ctx || pBuffers->ctx == ctx); 842 pBuffers->ctx = ctx; 843 } 844 } 845 } 846 #endif 847 } 848 849 static void crVBoxServerCheckConsistencyBuffersCB(unsigned long key, void *data1, void *data2) 850 { 851 CRBufferObject *obj = (CRBufferObject *)data1; 852 CR_SERVER_CHECK_BUFFERS Buffers = {0}; 853 Buffers.obj = obj; 854 crHashtableWalk(cr_server.contextTable, crVBoxServerCheckConsistencyContextBuffersCB, (void*)&Buffers); 855 } 856 857 //static void crVBoxServerCheckConsistency2CB(unsigned long key, void *data1, void *data2) 858 //{ 859 // CRContextInfo* pContextInfo1 = (CRContextInfo*)data1; 860 // CRContextInfo* pContextInfo2 = (CRContextInfo*)data2; 861 // 862 // CRASSERT(pContextInfo1->pContext); 863 // CRASSERT(pContextInfo2->pContext); 864 // 865 // if (pContextInfo1 == pContextInfo2) 866 // { 867 // CRASSERT(pContextInfo1->pContext == pContextInfo2->pContext); 868 // return; 869 // } 870 // 871 // CRASSERT(pContextInfo1->pContext != pContextInfo2->pContext); 872 // CRASSERT(pContextInfo1->pContext->shared); 873 // CRASSERT(pContextInfo2->pContext->shared); 874 // CRASSERT(pContextInfo1->pContext->shared == pContextInfo2->pContext->shared); 875 // if (pContextInfo1->pContext->shared != pContextInfo2->pContext->shared) 876 // return; 877 // 878 // crHashtableWalk(pContextInfo1->pContext->shared->buffersTable, crVBoxServerCheckConsistencyBuffersCB, pContextInfo2); 879 //} 880 static void crVBoxServerCheckSharedCB(unsigned long key, void *data1, void *data2) 881 { 882 CRContextInfo* pContextInfo = (CRContextInfo*)data1; 883 void **ppShared = (void**)data2; 884 if (!*ppShared) 885 *ppShared = pContextInfo->pContext->shared; 886 else 887 Assert(pContextInfo->pContext->shared == *ppShared); 888 } 889 890 static void crVBoxServerCheckConsistency() 891 { 892 CRSharedState *pShared = NULL; 893 crHashtableWalk(cr_server.contextTable, crVBoxServerCheckSharedCB, (void*)&pShared); 894 Assert(pShared); 895 if (pShared) 896 { 897 crHashtableWalk(pShared->buffersTable, crVBoxServerCheckConsistencyBuffersCB, NULL); 898 } 899 } 900 #endif 780 901 781 902 static uint32_t g_hackVBoxServerSaveLoadCallsLeft = 0; … … 787 908 GLboolean b; 788 909 unsigned long key; 910 GLenum err; 789 911 #ifdef CR_STATE_NO_TEXTURE_IMAGE_STORE 790 912 unsigned long ctxID=-1, winID=-1; 913 #endif 914 915 #if 0 916 crVBoxServerCheckConsistency(); 791 917 #endif 792 918 … … 904 1030 } 905 1031 1032 /* all context gl error states should have now be synced with chromium erro states, 1033 * reset the error if any */ 1034 while ((err = cr_server.head_spu->dispatch_table.GetError()) != GL_NO_ERROR) 1035 crWarning("crServer: glGetError %d after saving snapshot", err); 1036 906 1037 cr_server.bIsInSavingState = GL_FALSE; 907 1038 … … 922 1053 uint32_t ui, uiNumElems; 923 1054 unsigned long key; 1055 GLenum err; 924 1056 925 1057 if (!cr_server.bIsInLoadingState) … … 1200 1332 cr_server.curClient = NULL; 1201 1333 1202 { 1203 GLenum err = crServerDispatchGetError(); 1204 1205 if (err != GL_NO_ERROR) 1206 { 1207 crWarning("crServer: glGetError %d after loading snapshot", err); 1208 } 1209 } 1334 while ((err = cr_server.head_spu->dispatch_table.GetError()) != GL_NO_ERROR) 1335 crWarning("crServer: glGetError %d after loading snapshot", err); 1210 1336 1211 1337 cr_server.bIsInLoadingState = GL_FALSE; 1338 1339 #if 0 1340 crVBoxServerCheckConsistency(); 1341 #endif 1212 1342 1213 1343 return VINF_SUCCESS; -
trunk/src/VBox/HostServices/SharedOpenGL/crserverlib/server_misc.c
r43980 r44196 948 948 cr_server.head_spu->dispatch_table.ReadBuffer( mode ); 949 949 } 950 951 GLenum SERVER_DISPATCH_APIENTRY crServerDispatchGetError( void ) 952 { 953 GLenum retval, err; 954 CRContext *ctx = crStateGetCurrent(); 955 retval = ctx->error; 956 957 err = cr_server.head_spu->dispatch_table.GetError(); 958 if (retval == GL_NO_ERROR) 959 retval = err; 960 else 961 ctx->error = GL_NO_ERROR; 962 963 /* our impl has a single error flag, so we just loop here to reset all error flags to no_error */ 964 while (err != GL_NO_ERROR) 965 err = cr_server.head_spu->dispatch_table.GetError(); 966 967 crServerReturnValue( &retval, sizeof(retval) ); 968 return retval; /* WILL PROBABLY BE IGNORED */ 969 } -
trunk/src/VBox/HostServices/SharedOpenGL/crserverlib/server_special
r43888 r44196 250 250 ReadBuffer 251 251 TexPresent 252 GetError
Note:
See TracChangeset
for help on using the changeset viewer.