VirtualBox

Changeset 50277 in vbox for trunk


Ignore:
Timestamp:
Jan 29, 2014 8:23:21 PM (11 years ago)
Author:
vboxsync
Message:

crOpenGL: correct way of dealing with CreateInfo

Location:
trunk/src/VBox
Files:
8 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/GuestHost/OpenGL/include/cr_server.h

    r50217 r50277  
    9292} CRCreateInfo_t;
    9393
     94typedef struct {
     95    char   *pszDpyName;
     96    int32_t externalID;
     97    GLint   requestedVisualBits;
     98    GLint   realVisualBits;
     99} CRCreateInfoEx_t;
    94100
    95101/* VRAM->RAM worker thread */
     
    242248    void *pvReserved;
    243249
    244     CRCreateInfo_t CreateInfo;
     250    CRCreateInfoEx_t CreateInfo;
    245251
    246252    /* to avoid saved state breakage we need to keep RT_OFFSETOF(CRMuralInfo, CreateInfo) intact
     
    274280    CRContext *pContext;
    275281    int SpuContext;
    276     CRCreateInfo_t CreateInfo;
     282    CRCreateInfoEx_t CreateInfo;
    277283    CRMuralInfo * currentMural;
    278284} CRContextInfo;
  • trunk/src/VBox/HostServices/SharedOpenGL/crserverlib/server.h

    r50276 r50277  
    177177{
    178178    win->Base.id = mural->spuWindow;
    179     win->Base.visualBits = mural->CreateInfo.visualBits;
     179    win->Base.visualBits = mural->CreateInfo.realVisualBits;
    180180    win->width = mural->width;
    181181    win->height = mural->height;
     
    187187    if (ctx->Base.id < 0)
    188188        ctx->Base.id = cr_server.MainContextInfo.SpuContext;
    189     ctx->Base.visualBits = cr_server.curClient->currentCtxInfo->CreateInfo.visualBits;
     189    ctx->Base.visualBits = cr_server.curClient->currentCtxInfo->CreateInfo.realVisualBits;
    190190}
    191191
  • trunk/src/VBox/HostServices/SharedOpenGL/crserverlib/server_context.c

    r50095 r50277  
    2929
    3030    dpyName = "";
    31     if (cr_server.fVisualBitsDefault)
    32         visualBits = cr_server.fVisualBitsDefault;
    3331
    3432    if (shareCtx > 0) {
     
    4644    pContextInfo->currentMural = NULL;
    4745
    48     pContextInfo->CreateInfo.visualBits = visualBits;
     46    pContextInfo->CreateInfo.requestedVisualBits = visualBits;
     47
     48    if (cr_server.fVisualBitsDefault)
     49        visualBits = cr_server.fVisualBitsDefault;
     50
     51    pContextInfo->CreateInfo.realVisualBits = visualBits;
    4952
    5053    /* Since the Cr server serialized all incoming clients/contexts into
     
    5356     */
    5457    if (cr_server.firstCallCreateContext) {
    55         cr_server.MainContextInfo.CreateInfo.visualBits = visualBits;
     58        cr_server.MainContextInfo.CreateInfo.realVisualBits = visualBits;
    5659        cr_server.MainContextInfo.SpuContext = cr_server.head_spu->dispatch_table.
    57             CreateContext(dpyName, cr_server.MainContextInfo.CreateInfo.visualBits, shareCtx);
     60            CreateContext(dpyName, cr_server.MainContextInfo.CreateInfo.realVisualBits, shareCtx);
    5861        if (cr_server.MainContextInfo.SpuContext < 0) {
    5962            crWarning("crServerDispatchCreateContext() failed.");
     
    7073    else {
    7174        /* second or third or ... context */
    72         if (!cr_server.bUseMultipleContexts && ((visualBits & cr_server.MainContextInfo.CreateInfo.visualBits) != visualBits)) {
     75        if (!cr_server.bUseMultipleContexts && ((visualBits & cr_server.MainContextInfo.CreateInfo.realVisualBits) != visualBits)) {
    7376            int oldSpuContext;
    74 
     77            /* should never be here */
     78            CRASSERT(0);
    7579            /* the new context needs new visual attributes */
    76             cr_server.MainContextInfo.CreateInfo.visualBits |= visualBits;
     80            cr_server.MainContextInfo.CreateInfo.realVisualBits |= visualBits;
    7781            crWarning("crServerDispatchCreateContext requires new visual (0x%x).",
    78                     cr_server.MainContextInfo.CreateInfo.visualBits);
     82                    cr_server.MainContextInfo.CreateInfo.realVisualBits);
    7983
    8084            /* Here, we used to just destroy the old rendering context.
     
    9195            oldSpuContext = cr_server.MainContextInfo.SpuContext;
    9296            cr_server.MainContextInfo.SpuContext = cr_server.head_spu->dispatch_table.
    93                 CreateContext(dpyName, cr_server.MainContextInfo.CreateInfo.visualBits, cr_server.MainContextInfo.SpuContext);
     97                CreateContext(dpyName, cr_server.MainContextInfo.CreateInfo.realVisualBits, cr_server.MainContextInfo.SpuContext);
    9498            /* destroy old rendering context */
    9599            cr_server.head_spu->dispatch_table.DestroyContext(oldSpuContext);
     
    108112    if (cr_server.bUseMultipleContexts) {
    109113        pContextInfo->SpuContext = cr_server.head_spu->dispatch_table.
    110                 CreateContext(dpyName, cr_server.MainContextInfo.CreateInfo.visualBits, cr_server.MainContextInfo.SpuContext);
     114                CreateContext(dpyName, cr_server.MainContextInfo.CreateInfo.realVisualBits, cr_server.MainContextInfo.SpuContext);
    111115        if (pContextInfo->SpuContext < 0) {
    112116            crWarning("crServerDispatchCreateContext() failed.");
     
    136140
    137141        pContextInfo->pContext = newCtx;
    138         pContextInfo->CreateInfo.visualBits = visualBits;
     142        Assert(pContextInfo->CreateInfo.realVisualBits == visualBits);
    139143        pContextInfo->CreateInfo.externalID = retVal;
    140144        pContextInfo->CreateInfo.pszDpyName = dpyName ? crStrdup(dpyName) : NULL;
     
    202206    if (cr_server.currentCtxInfo == crCtxInfo)
    203207    {
    204         CRMuralInfo *dummyMural = crServerGetDummyMural(cr_server.MainContextInfo.CreateInfo.visualBits);
     208        CRMuralInfo *dummyMural = crServerGetDummyMural(cr_server.MainContextInfo.CreateInfo.realVisualBits);
    205209        crServerPerformMakeCurrent(dummyMural, &cr_server.MainContextInfo);
    206210        CRASSERT(cr_server.currentCtxInfo == &cr_server.MainContextInfo);
  • trunk/src/VBox/HostServices/SharedOpenGL/crserverlib/server_main.c

    r50258 r50277  
    854854{
    855855    CRMuralInfo *pMural = (CRMuralInfo *)data1;
    856     CRCreateInfo_t *pCreateInfo = &pMural->CreateInfo;
    857     crVBoxServerSaveCreateInfoCB(key, pCreateInfo, data2);
     856    CRCreateInfo_t CreateInfo;
     857    CreateInfo.pszDpyName = pMural->CreateInfo.pszDpyName;
     858    CreateInfo.visualBits = pMural->CreateInfo.requestedVisualBits;
     859    CreateInfo.externalID = pMural->CreateInfo.externalID;
     860    crVBoxServerSaveCreateInfoCB(key, &CreateInfo, data2);
    858861}
    859862
     
    861864{
    862865    CRContextInfo *pContextInfo = (CRContextInfo *)data1;
    863     CRCreateInfo_t CreateInfo = pContextInfo->CreateInfo;
     866    CRCreateInfo_t CreateInfo;
     867    CreateInfo.pszDpyName = pContextInfo->CreateInfo.pszDpyName;
     868    CreateInfo.visualBits = pContextInfo->CreateInfo.requestedVisualBits;
    864869    /* saved state contains internal id */
    865870    CreateInfo.externalID = pContextInfo->pContext->id;
     
    920925    Assert(!crHashtableGetDataKey(pData->pGlobal->contextMuralTable, pMural, NULL));
    921926
    922     if (cr_server.MainContextInfo.CreateInfo.visualBits == pMural->CreateInfo.visualBits)
     927    if (cr_server.MainContextInfo.CreateInfo.realVisualBits == pMural->CreateInfo.realVisualBits)
    923928    {
    924929        pContextInfo = &cr_server.MainContextInfo;
     
    965970        return;
    966971
    967     CRASSERT(pMural->CreateInfo.visualBits == pData->pContextInfo->CreateInfo.visualBits);
     972    CRASSERT(pMural->CreateInfo.realVisualBits == pData->pContextInfo->CreateInfo.realVisualBits);
    968973    pData->pMural = pMural;
    969974}
     
    10331038    if (!pMural)
    10341039    {
    1035         pMural = crServerGetDummyMural(pContextInfo->CreateInfo.visualBits);
     1040        pMural = crServerGetDummyMural(pContextInfo->CreateInfo.realVisualBits);
    10361041        if (!pMural)
    10371042        {
     
    11571162    /* there is a lot of code that assumes we have double buffering, just assert here to print a warning in the log
    11581163     * so that we know that something irregular is going on */
    1159     CRASSERT(pCtxInfo->CreateInfo.visualBits & CR_DOUBLE_BIT);
    1160     if ((pCtxInfo->CreateInfo.visualBits & CR_DOUBLE_BIT)
     1164    CRASSERT(pCtxInfo->CreateInfo.requestedVisualBits & CR_DOUBLE_BIT);
     1165    if ((pCtxInfo->CreateInfo.requestedVisualBits & CR_DOUBLE_BIT)
    11611166                || version < SHCROGL_SSM_VERSION_WITH_SINGLE_DEPTH_STENCIL /* <- older version had a typo which lead to back always being used,
    11621167                                                                                                                                        * no matter what the visual bits are */
     
    11891194    if (version < SHCROGL_SSM_VERSION_WITH_SINGLE_DEPTH_STENCIL)
    11901195    {
    1191 /*        if (pCtxInfo->CreateInfo.visualBits & CR_DEPTH_BIT) */ /* <- older version had a typo which lead to back always being used,
     1196/*        if (pCtxInfo->CreateInfo.requestedVisualBits & CR_DEPTH_BIT) */ /* <- older version had a typo which lead to back always being used,
    11921197                                                                                                                                  * no matter what the visual bits are */
    11931198        {
     
    12201225        }
    12211226
    1222  /*       if (pCtxInfo->CreateInfo.visualBits & CR_STENCIL_BIT) */ /* <- older version had a typo which lead to back always being used,
     1227 /*       if (pCtxInfo->CreateInfo.requestedVisualBits & CR_STENCIL_BIT) */ /* <- older version had a typo which lead to back always being used,
    12231228                                                                                                                                        * no matter what the visual bits are */
    12241229        {
     
    12461251    }
    12471252
    1248     if ((pCtxInfo->CreateInfo.visualBits & CR_STENCIL_BIT)
    1249                 || (pCtxInfo->CreateInfo.visualBits & CR_DEPTH_BIT))
     1253    if ((pCtxInfo->CreateInfo.requestedVisualBits & CR_STENCIL_BIT)
     1254                || (pCtxInfo->CreateInfo.requestedVisualBits & CR_DEPTH_BIT))
    12501255    {
    12511256        pEl = &pData->aElements[pData->cElements];
     
    23472352        CRASSERT(!cr_server.currentCtxInfo);
    23482353        CRASSERT(!cr_server.currentMural);
    2349         pMural = crServerGetDummyMural(cr_server.MainContextInfo.CreateInfo.visualBits);
     2354        pMural = crServerGetDummyMural(cr_server.MainContextInfo.CreateInfo.realVisualBits);
    23502355        CRASSERT(pMural);
    23512356        crServerPerformMakeCurrent(pMural, &cr_server.MainContextInfo);
     
    23812386            {
    23822387                /* null winId means a dummy mural, get it */
    2383                 pMural = crServerGetDummyMural(pContextInfo->CreateInfo.visualBits);
     2388                pMural = crServerGetDummyMural(pContextInfo->CreateInfo.realVisualBits);
    23842389                CRASSERT(pMural);
    23852390            }
  • trunk/src/VBox/HostServices/SharedOpenGL/crserverlib/server_misc.c

    r50184 r50277  
    676676        CRASSERT(cr_server.MainContextInfo.SpuContext);
    677677        Ctx.Base.id = cr_server.MainContextInfo.SpuContext;
    678         Ctx.Base.visualBits = cr_server.MainContextInfo.CreateInfo.visualBits;
     678        Ctx.Base.visualBits = cr_server.MainContextInfo.CreateInfo.realVisualBits;
    679679        rc = CrBltInit(&cr_server.Blitter, &Ctx, true, true, NULL, &cr_server.TmpCtxDispatch);
    680680        if (RT_SUCCESS(rc))
     
    692692    if (!CrBltMuralGetCurrentInfo(&cr_server.Blitter)->Base.id)
    693693    {
    694         CRMuralInfo *dummy = crServerGetDummyMural(cr_server.MainContextInfo.CreateInfo.visualBits);
     694        CRMuralInfo *dummy = crServerGetDummyMural(cr_server.MainContextInfo.CreateInfo.realVisualBits);
    695695        CR_BLITTER_WINDOW DummyInfo;
    696696        CRASSERT(dummy);
     
    13781378                CRMuralInfo * pDummy;
    13791379                Assert(!cr_server.currentCtxInfo);
    1380                 pDummy = crServerGetDummyMural(cr_server.MainContextInfo.CreateInfo.visualBits);
     1380                pDummy = crServerGetDummyMural(cr_server.MainContextInfo.CreateInfo.realVisualBits);
    13811381                context = cr_server.MainContextInfo.SpuContext;
    13821382                window = pDummy->spuWindow;
     
    15121512    if (!CrBltIsInitialized(&cr_server.RecorderBlitter))
    15131513    {
    1514         pBlitterMural = crServerGetDummyMural(cr_server.MainContextInfo.CreateInfo.visualBits);
     1514        pBlitterMural = crServerGetDummyMural(cr_server.MainContextInfo.CreateInfo.realVisualBits);
    15151515        if (!pBlitterMural)
    15161516        {
  • trunk/src/VBox/HostServices/SharedOpenGL/crserverlib/server_muralfbo.cpp

    r50178 r50277  
    524524    }
    525525
    526     if (pMuralContextInfo->CreateInfo.visualBits != mural->CreateInfo.visualBits)
     526    if (pMuralContextInfo->CreateInfo.realVisualBits != mural->CreateInfo.realVisualBits)
    527527    {
    528528        WARN(("mural visual bits do not match with current context visual bits!"));
  • trunk/src/VBox/HostServices/SharedOpenGL/crserverlib/server_rpw.cpp

    r46343 r50277  
    351351            if (RT_SUCCESS(rc))
    352352            {
    353                 CRASSERT(cr_server.MainContextInfo.CreateInfo.visualBits);
     353                CRASSERT(cr_server.MainContextInfo.CreateInfo.realVisualBits);
    354354                CRASSERT(cr_server.MainContextInfo.SpuContext);
    355355
    356                 pWorker->ctxId = cr_server.head_spu->dispatch_table.CreateContext("", cr_server.MainContextInfo.CreateInfo.visualBits, cr_server.MainContextInfo.SpuContext);
     356                pWorker->ctxId = cr_server.head_spu->dispatch_table.CreateContext("", cr_server.MainContextInfo.CreateInfo.realVisualBits, cr_server.MainContextInfo.SpuContext);
    357357                if (pWorker->ctxId)
    358358                {
    359359                    CRMuralInfo *pDummyMural;
    360                     pWorker->ctxVisBits = cr_server.MainContextInfo.CreateInfo.visualBits;
     360                    pWorker->ctxVisBits = cr_server.MainContextInfo.CreateInfo.realVisualBits;
    361361                    pDummyMural = crServerGetDummyMural(pWorker->ctxVisBits);
    362362                    if (pDummyMural)
     
    448448    if (!cr_server.currentCtxInfo)
    449449    {
    450         CRMuralInfo *pDummy = crServerGetDummyMural(cr_server.MainContextInfo.CreateInfo.visualBits);
     450        CRMuralInfo *pDummy = crServerGetDummyMural(cr_server.MainContextInfo.CreateInfo.realVisualBits);
    451451        if (!pDummy)
    452452        {
     
    536536    if (!cr_server.currentCtxInfo)
    537537    {
    538         CRMuralInfo *pDummy = crServerGetDummyMural(cr_server.MainContextInfo.CreateInfo.visualBits);
     538        CRMuralInfo *pDummy = crServerGetDummyMural(cr_server.MainContextInfo.CreateInfo.realVisualBits);
    539539        if (!pDummy)
    540540        {
  • trunk/src/VBox/HostServices/SharedOpenGL/crserverlib/server_window.c

    r50274 r50277  
    2626    GLint spuWindow;
    2727    int rc;
     28    GLint realVisBits = visBits;
    2829
    2930    crMemset(mural, 0, sizeof (*mural));
     31
     32    if (cr_server.fVisualBitsDefault)
     33        realVisBits = cr_server.fVisualBitsDefault;
    3034
    3135    /*
    3236     * Have first SPU make a new window.
    3337     */
    34     spuWindow = cr_server.head_spu->dispatch_table.WindowCreate( dpyName, visBits );
     38    spuWindow = cr_server.head_spu->dispatch_table.WindowCreate( dpyName, realVisBits );
    3539    if (spuWindow < 0) {
    3640        return spuWindow;
     
    6266        windowID = preloadWinID<0 ? (GLint)crHashtableAllocKeys( cr_server.muralTable, 1 ) : preloadWinID;
    6367
    64     mural->CreateInfo.visualBits = visBits;
     68    mural->CreateInfo.realVisualBits = realVisBits;
     69    mural->CreateInfo.requestedVisualBits = visBits;
    6570    mural->CreateInfo.externalID = windowID;
    6671    mural->CreateInfo.pszDpyName = dpyName ? crStrdup(dpyName) : NULL;
     
    7782
    7883    dpyName = "";
    79 
    80     if (cr_server.fVisualBitsDefault)
    81         visBits = cr_server.fVisualBitsDefault;
    8284
    8385    if (cr_server.sharedWindows) {
     
    145147
    146148    /* ensure we have a dummy mural created right away to avoid potential deadlocks on VM shutdown */
    147     crServerGetDummyMural(mural->CreateInfo.visualBits);
     149    crServerGetDummyMural(mural->CreateInfo.realVisualBits);
    148150
    149151    crServerReturnValue( &windowID, sizeof(windowID) );
     
    175177    if (cr_server.currentMural == mural)
    176178    {
    177         CRMuralInfo *dummyMural = crServerGetDummyMural(cr_server.MainContextInfo.CreateInfo.visualBits);
     179        CRMuralInfo *dummyMural = crServerGetDummyMural(cr_server.MainContextInfo.CreateInfo.realVisualBits);
    178180        /* reset the current context to some dummy values to ensure render spu does not switch to a default "0" context,
    179181         * which might lead to muralFBO (offscreen rendering) gl entities being created in a scope of that context */
     
    193195        if (pWindow && pWindow->Base.id == mural->spuWindow)
    194196        {
    195                 CRMuralInfo *dummy = crServerGetDummyMural(mural->CreateInfo.visualBits);
     197                CRMuralInfo *dummy = crServerGetDummyMural(mural->CreateInfo.realVisualBits);
    196198                CR_BLITTER_WINDOW DummyInfo;
    197199                CRASSERT(dummy);
Note: See TracChangeset for help on using the changeset viewer.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette