VirtualBox

Changeset 51559 in vbox for trunk/src/VBox


Ignore:
Timestamp:
Jun 5, 2014 9:18:41 PM (11 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
94217
Message:

crOpenGL: wglShareLists support

Location:
trunk/src/VBox
Files:
13 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Additions/common/crOpenGL/context.c

    r49214 r51559  
    110110void stubConChromiumParameteriCR(GLint con, GLenum param, GLint value)
    111111{
    112     if (con)
     112//    if (con)
    113113        stub.spu->dispatch_table.VBoxConChromiumParameteriCR(con, param, value);
    114     else
    115         crError("VBoxConChromiumParameteriCR called with null connection");
     114//    else
     115//        crError("VBoxConChromiumParameteriCR called with null connection");
     116}
     117
     118void stubConChromiumParametervCR(GLint con, GLenum target, GLenum type, GLsizei count, const GLvoid *values)
     119{
     120//    if (con)
     121        stub.spu->dispatch_table.VBoxConChromiumParametervCR(con, target, type, count, values);
     122//    else
     123//        crError("VBoxConChromiumParameteriCR called with null connection");
    116124}
    117125
  • trunk/src/VBox/Additions/common/crOpenGL/icd_drv.c

    r44528 r51559  
    308308}
    309309
     310DECLEXPORT(BOOL) WINAPI wglShareLists_prox( HGLRC hglrc1, HGLRC hglrc2 );
     311
    310312BOOL APIENTRY DrvShareLists(HGLRC hglrc1, HGLRC hglrc2)
    311313{
    312     CR_DDI_PROLOGUE();
    313     crWarning( "DrvShareLists: unsupported" );
    314     return 1;
     314    return wglShareLists_prox(hglrc1, hglrc2);
    315315}
    316316
  • trunk/src/VBox/Additions/common/crOpenGL/pack/packspu.h

    r51313 r51559  
    158158extern ThreadInfo *packspuNewCtxThread( struct VBOXUHGSMI *pHgsmi );
    159159
     160
     161
     162#define MAGIC_OFFSET 3000
     163
    160164#endif /* CR_PACKSPU_H */
  • trunk/src/VBox/Additions/common/crOpenGL/pack/packspu_context.c

    r51319 r51559  
    1010#include "cr_string.h"
    1111#include "packspu_proto.h"
    12 
    13 #define MAGIC_OFFSET 3000
    1412
    1513/*
     
    231229
    232230    packspu_ChromiumParameteriCR(param, value);
     231
     232#ifdef CHROMIUM_THREADSAFE
     233    crUnlockMutex(&_PackMutex);
     234#endif
     235
     236    if (CRPACKSPU_IS_WDDM_CRHGSMI())
     237    {
     238        /* restore the packer context to the tls */
     239        crPackSetContext(curPacker);
     240    }
     241}
     242
     243GLvoid PACKSPU_APIENTRY
     244packspu_VBoxConChromiumParametervCR(GLint con, GLenum target, GLenum type, GLsizei count, const GLvoid *values)
     245{
     246    GET_THREAD(thread);
     247    CRPackContext * curPacker = crPackGetContext();
     248    ThreadInfo *curThread = thread;
     249    int writeback = 1;
     250    GLint serverCtx = (GLint) -1;
     251
     252    CRASSERT(!curThread == !curPacker);
     253    CRASSERT(!curThread || !curPacker || curThread->packer == curPacker);
     254#ifdef CHROMIUM_THREADSAFE
     255    crLockMutex(&_PackMutex);
     256#endif
     257
     258#if defined(VBOX_WITH_CRHGSMI) && defined(IN_GUEST)
     259    CRASSERT(!con == !CRPACKSPU_IS_WDDM_CRHGSMI());
     260#endif
     261
     262    if (CRPACKSPU_IS_WDDM_CRHGSMI())
     263    {
     264        if (!con)
     265        {
     266            crError("connection should be specified!");
     267            return;
     268        }
     269        thread = GET_THREAD_VAL_ID(con);
     270    }
     271    else
     272    {
     273        CRASSERT(!con);
     274        if (!thread)
     275        {
     276            thread = packspuNewThread(
     277#if defined(VBOX_WITH_CRHGSMI) && defined(IN_GUEST)
     278                NULL
     279#endif
     280                );
     281        }
     282    }
     283    CRASSERT(thread);
     284    CRASSERT(thread->packer);
     285
     286    crPackSetContext( thread->packer );
     287
     288    packspu_ChromiumParametervCR(target, type, count, values);
    233289
    234290#ifdef CHROMIUM_THREADSAFE
  • trunk/src/VBox/Additions/common/crOpenGL/pack/packspu_misc.c

    r51313 r51559  
    1515    CRMessage msg;
    1616    int len;
    17    
     17    GLint ai32ServerValues[2];
     18    GLboolean fFlush = GL_FALSE;
    1819    GET_THREAD(thread);
    1920
     
    3031            len = sizeof(CRMessageGather);
    3132            crNetSend(thread->netServer.conn, NULL, &msg, len);
    32             break;
    33            
     33            return;
     34
     35        case GL_SHARE_LISTS_CR:
     36        {
     37            ContextInfo *pCtx[2];
     38            GLint *ai32Values;
     39            int i;
     40            if (count != 2)
     41            {
     42                WARN(("GL_SHARE_LISTS_CR invalid cound %d", count));
     43                return;
     44            }
     45
     46            if (type != GL_UNSIGNED_INT && type != GL_INT)
     47            {
     48                WARN(("GL_SHARE_LISTS_CR invalid type %d", type));
     49                return;
     50            }
     51
     52            ai32Values = (GLint*)values;
     53
     54            for (i = 0; i < 2; ++i)
     55            {
     56                const int slot = ai32Values[i] - MAGIC_OFFSET;
     57
     58                if (slot < 0 || slot >= pack_spu.numContexts)
     59                {
     60                    WARN(("GL_SHARE_LISTS_CR invalid value[%d] %d", i, ai32Values[i]));
     61                    return;
     62                }
     63
     64                pCtx[i] = &pack_spu.context[slot];
     65                if (!pCtx[i]->clientState)
     66                {
     67                    WARN(("GL_SHARE_LISTS_CR invalid pCtx1 for value[%d] %d", i, ai32Values[i]));
     68                    return;
     69                }
     70
     71                ai32ServerValues[i] = pCtx[i]->serverCtx;
     72            }
     73
     74            crStateShareLists(pCtx[0]->clientState, pCtx[1]->clientState);
     75
     76            values = ai32ServerValues;
     77
     78            fFlush = GL_TRUE;
     79
     80            break;
     81        }
     82
    3483        default:
    35             if (pack_spu.swap)
    36                 crPackChromiumParametervCRSWAP(target, type, count, values);
    37             else
    38                 crPackChromiumParametervCR(target, type, count, values);
    39     }
    40 
    41 
     84            break;
     85    }
     86
     87    if (pack_spu.swap)
     88        crPackChromiumParametervCRSWAP(target, type, count, values);
     89    else
     90        crPackChromiumParametervCR(target, type, count, values);
     91
     92    if (fFlush)
     93        packspuFlush( (void *) thread );
    4294}
    4395
  • trunk/src/VBox/Additions/common/crOpenGL/pack/packspu_special

    r51200 r51559  
    111111VBoxCreateContext
    112112VBoxConChromiumParameteriCR
     113VBoxConChromiumParametervCR
    113114VBoxWindowCreate
    114115VBoxWindowDestroy
  • trunk/src/VBox/Additions/common/crOpenGL/stub.h

    r49214 r51559  
    343343        );
    344344extern void stubConChromiumParameteriCR(GLint con, GLenum param, GLint value);
     345extern void stubConChromiumParametervCR(GLint con, GLenum target, GLenum type, GLsizei count, const GLvoid *values);
    345346extern GLboolean stubCtxCreate(ContextInfo *context);
    346347extern GLboolean stubCtxCheckCreate(ContextInfo *context);
  • trunk/src/VBox/Additions/common/crOpenGL/wgl.c

    r48999 r51559  
    289289}
    290290
    291 DECLEXPORT(BOOL) WINAPI wglShareLists_prox( HGLRC hglrc1, HGLRC hglrc2 )
    292 {
    293     CR_DDI_PROLOGUE();
    294     crWarning( "wglShareLists: unsupported" );
    295     return 0;
    296 }
    297 
    298291DECLEXPORT(void) WINAPI VBoxCtxChromiumParameteriCR(HGLRC hglrc, GLenum param, GLint value)
    299292{
     
    317310    crHashtableUnlock(stub.contextTable);
    318311//    crHashtableUnlock(stub.windowTable);
     312}
     313
     314DECLEXPORT(BOOL) WINAPI wglShareLists_prox( HGLRC hglrc1, HGLRC hglrc2 )
     315{
     316    ContextInfo *context1, *context2;
     317    GLint aSpuContexts[2];
     318
     319    CR_DDI_PROLOGUE();
     320
     321//    crHashtableLock(stub.windowTable);
     322    crHashtableLock(stub.contextTable);
     323
     324    context1 = (ContextInfo *) crHashtableSearch(stub.contextTable, (unsigned long) hglrc1);
     325
     326    if (!context1)
     327    {
     328        WARN(("invalid hglrc1"));
     329        return FALSE;
     330    }
     331
     332    stubCtxCheckCreate(context1);
     333
     334    context2 = (ContextInfo *) crHashtableSearch(stub.contextTable, (unsigned long) hglrc2);
     335
     336    if (!context2)
     337    {
     338        WARN(("invalid hglrc2"));
     339        return FALSE;
     340    }
     341
     342    stubCtxCheckCreate(context2);
     343
     344    aSpuContexts[0] = context1->spuContext;
     345    aSpuContexts[1] = context2->spuContext;
     346
     347    stubConChromiumParametervCR(CR_CTX_CON(context2), GL_SHARE_LISTS_CR, GL_INT, 2, aSpuContexts);
     348
     349    crHashtableUnlock(stub.contextTable);
     350
     351    return TRUE;
    319352}
    320353
  • trunk/src/VBox/GuestHost/OpenGL/glapi_parser/APIspec.txt

    r51200 r51559  
    85718571chromium    nopack
    85728572
     8573name        VBoxConChromiumParametervCR
     8574return      void
     8575param       con         GLint
     8576param       target      GLenum
     8577paramprop   target      GL_CURSOR_POSITION_CR GL_DEFAULT_BBOX_CR GL_SCREEN_BBOX_CR GL_OBJECT_BBOX_CR GL_PRINT_STRING_CR GL_MURAL_SIZE_CR GL_NUM_SERVERS_CR GL_NUM_TILES_CR GL_TILE_BOUNDS_CR GL_VERTEX_COUNTS_CR GL_RESET_VERTEX_COUNTERS_CR GL_SET_MAX_VIEWPORT_CR GL_HEAD_SPU_NAME_CR GL_PERF_GET_FRAME_DATA_CR GL_PERF_GET_TIMER_DATA_CR GL_PERF_DUMP_COUNTERS_CR GL_PERF_SET_TOKEN_CR GL_PERF_SET_DUMP_ON_SWAP_CR GL_PERF_SET_DUMP_ON_FINISH_CR GL_PERF_SET_DUMP_ON_FLUSH_CR GL_PERF_START_TIMER_CR GL_PERF_STOP_TIMER_CR GL_WINDOW_SIZE_CR GL_TILE_INFO_CR GL_GATHER_DRAWPIXELS_CR GL_GATHER_PACK_CR GL_GATHER_CONNECT_CR GL_GATHER_POST_SWAPBUFFERS_CR GL_SAVEFRAME_ENABLED_CR GL_SAVEFRAME_FRAMENUM_CR GL_SAVEFRAME_STRIDE_CR GL_SAVEFRAME_SINGLE_CR GL_SAVEFRAME_FILESPEC_CR GL_READBACK_BARRIER_SIZE_CR
     8578param       type        GLenum
     8579paramprop   type        GL_BYTE GL_UNSIGNED_BYTE GL_SHORT GL_UNSIGNED_SHORT GL_INT GL_UNSIGNED_INT GL_FLOAT GL_DOUBLE
     8580param       count       GLsizei
     8581param       values      const GLvoid *
     8582category    VBox
     8583props       nolist
     8584chromium    nopack
     8585
     8586
    85738587name        VBoxWindowCreate
    85748588return      GLint
  • trunk/src/VBox/GuestHost/OpenGL/include/chromium.h

    r51313 r51559  
    734734#define GL_CHECK_ZERO_VERT_ARRT       0x8B30
    735735
     736/* share lists */
     737#define GL_SHARE_LISTS_CR             0x8B31
     738
    736739/**********************************************************************/
    737740/*****                Chromium-specific API                       *****/
  • trunk/src/VBox/GuestHost/OpenGL/include/cr_glstate.h

    r51005 r51559  
    116116    CRHashTable *rbTable;       /* render buffers */
    117117
    118     GLint refCount;
     118    volatile int32_t refCount;
    119119    GLint id;                   /*unique shared state id, it's not always matching some existing context id!*/
    120120    GLint saveCount;
     
    308308
    309309DECLEXPORT(void) STATE_APIENTRY crStateShareContext(GLboolean value);
     310DECLEXPORT(void) STATE_APIENTRY crStateShareLists(CRContext *pContext1, CRContext *pContext2);
    310311DECLEXPORT(void) STATE_APIENTRY crStateSetSharedContext(CRContext *pCtx);
    311312DECLEXPORT(GLboolean) STATE_APIENTRY crStateContextIsShared(CRContext *pCtx);
  • trunk/src/VBox/GuestHost/OpenGL/state_tracker/state_init.c

    r51005 r51559  
    99#include "cr_error.h"
    1010#include "cr_spu.h"
     11
     12#include <iprt/asm.h>
    1113
    1214#ifdef CHROMIUM_THREADSAFE
     
    110112crStateFreeShared(CRContext *pContext, CRSharedState *s)
    111113{
    112     s->refCount--;
    113     Assert(s->refCount >= 0);
    114     if (s->refCount <= 0) {
     114    int32_t refCount = ASMAtomicDecS32(&s->refCount);
     115
     116    Assert(refCount >= 0);
     117    if (refCount <= 0) {
    115118        if (s==gSharedState)
    116119        {
     
    144147        return NULL;
    145148    }
    146     gSharedState->refCount++;
     149    ASMAtomicIncS32(&gSharedState->refCount);
    147150    return gSharedState;
    148151}
     
    176179            crStateFreeShared(pCtx, pCtx->shared);
    177180            pCtx->shared = gSharedState;
    178             gSharedState->refCount++;
     181            ASMAtomicIncS32(&gSharedState->refCount);
    179182        }
    180183    }
     
    199202        }
    200203    }
     204}
     205
     206DECLEXPORT(void) STATE_APIENTRY
     207crStateShareLists(CRContext *pContext1, CRContext *pContext2)
     208{
     209    CRASSERT(pContext1->shared);
     210    CRASSERT(pContext2->shared);
     211
     212    if (pContext2->shared == pContext1->shared)
     213    {
     214        return;
     215    }
     216
     217    crStateFreeShared(pContext1, pContext1->shared);
     218    pContext1->shared = pContext2->shared;
     219    ASMAtomicIncS32(&pContext2->shared->refCount);
    201220}
    202221
     
    271290        CRASSERT(shareCtx->shared);
    272291        ctx->shared = shareCtx->shared;
    273         ctx->shared->refCount ++;
     292        ASMAtomicIncS32(&ctx->shared->refCount);
    274293    }
    275294    else {
  • trunk/src/VBox/HostServices/SharedOpenGL/crserverlib/server_misc.c

    r51524 r51559  
    9494
    9595    switch (target) {
     96        case GL_SHARE_LISTS_CR:
     97        {
     98            CRContextInfo *pCtx[2];
     99            GLint *ai32Values;
     100            int i;
     101            if (count != 2)
     102            {
     103                WARN(("GL_SHARE_LISTS_CR invalid cound %d", count));
     104                return;
     105            }
     106
     107            if (type != GL_UNSIGNED_INT && type != GL_INT)
     108            {
     109                WARN(("GL_SHARE_LISTS_CR invalid type %d", type));
     110                return;
     111            }
     112
     113            ai32Values = (GLint*)values;
     114
     115            for (i = 0; i < 2; ++i)
     116            {
     117                const int32_t val = ai32Values[i];
     118
     119                if (val == 0)
     120                {
     121                    WARN(("GL_SHARE_LISTS_CR invalid value[%d] %d", i, val));
     122                    return;
     123                }
     124
     125                pCtx[i] = (CRContextInfo *) crHashtableSearch(cr_server.contextTable, val);
     126                if (!pCtx[i])
     127                {
     128                    WARN(("GL_SHARE_LISTS_CR invalid pCtx1 for value[%d] %d", i, val));
     129                    return;
     130                }
     131
     132                if (!pCtx[i]->pContext)
     133                {
     134                    WARN(("GL_SHARE_LISTS_CR invalid pCtx1 pContext for value[%d] %d", i, val));
     135                    return;
     136                }
     137            }
     138
     139            crStateShareLists(pCtx[0]->pContext, pCtx[1]->pContext);
     140
     141            break;
     142        }
     143
    96144    case GL_SET_MAX_VIEWPORT_CR:
    97145        {
Note: See TracChangeset for help on using the changeset viewer.

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