VirtualBox

Ticket #13653: vbox-host-AllOpenGL-beta1-v5.0.0-BETA2.patch

File vbox-host-AllOpenGL-beta1-v5.0.0-BETA2.patch, 140.7 KB (added by Technologov, 9 years ago)

patch for VirtualBox 5.0. Really ugly code.

  • VirtualBox-5.0.0_BETA2/src/VBox/Additions//common/crOpenGL/load.c

    Binary files vbox-orig/VirtualBox-5.0.0_BETA2/src/VBox/Additions//common/crOpenGL/entrypoints.pyc and /home/alexey/VirtualBox-5.0.0_BETA2/src/VBox/Additions//common/crOpenGL/entrypoints.pyc differ
    diff -uNr -U 6 vbox-orig/VirtualBox-5.0.0_BETA2/src/VBox/Additions//common/crOpenGL/load.c /home/alexey/VirtualBox-5.0.0_BETA2/src/VBox/Additions//common/crOpenGL/load.c
    old new  
    481481}
    482482
    483483
    484484static void stubExitHandler(void)
    485485{
    486486    stubSPUSafeTearDown();
    487     signal(SIGTERM, SIG_DFL);
    488     signal(SIGINT, SIG_DFL);
    489487}
    490488
    491489/**
    492490 * Called when we receive a SIGTERM signal.
    493491 */
    494492static void stubSignalHandler(int signo)
     
    13231321    switch (fdwReason)
    13241322    {
    13251323    case DLL_PROCESS_ATTACH:
    13261324    {
    13271325        CRNetServer ns;
    13281326        const char * env;
    1329 #if defined(DEBUG_misha)
    1330         HMODULE hCrUtil;
    1331         char aName[MAX_PATH];
    1332 
    1333         GetModuleFileNameA(hDLLInst, aName, RT_ELEMENTS(aName));
    1334         crDbgCmdSymLoadPrint(aName, hDLLInst);
    1335 
    1336         hCrUtil = GetModuleHandleA("VBoxOGLcrutil.dll");
    1337         Assert(hCrUtil);
    1338         crDbgCmdSymLoadPrint("VBoxOGLcrutil.dll", hCrUtil);
    1339 #endif
     1327
    13401328#ifdef CHROMIUM_THREADSAFE
    13411329        crInitTSD(&g_stubCurrentContextTSD);
    13421330#endif
    13431331
    13441332        crInitMutex(&stub_init_mutex);
    13451333
  • VirtualBox-5.0.0_BETA2/src/VBox/Additions//common/crOpenGL/pack/packspu_context.c

    diff -uNr -U 6 vbox-orig/VirtualBox-5.0.0_BETA2/src/VBox/Additions//common/crOpenGL/pack/packspu_context.c /home/alexey/VirtualBox-5.0.0_BETA2/src/VBox/Additions//common/crOpenGL/pack/packspu_context.c
    old new  
    591591
    592592    if (pack_spu.swap)
    593593        crPackMakeCurrentSWAP( window, nativeWindow, serverCtx );
    594594    else
    595595        crPackMakeCurrent( window, nativeWindow, serverCtx );
    596596
    597     if (serverCtx)
    598     {
    599         packspuInitStrings();
    600     }
    601 
    602597    {
    603598        GET_THREAD(t);
    604599        (void) t;
    605600        CRASSERT(t);
    606601    }
    607602}
  • VirtualBox-5.0.0_BETA2/src/VBox/Additions//common/crOpenGL/pack/packspu_getstring.c

    diff -uNr -U 6 vbox-orig/VirtualBox-5.0.0_BETA2/src/VBox/Additions//common/crOpenGL/pack/packspu_getstring.c /home/alexey/VirtualBox-5.0.0_BETA2/src/VBox/Additions//common/crOpenGL/pack/packspu_getstring.c
    old new  
    3131    CRPACKSPU_WRITEBACK_WAIT(thread, writeback);
    3232}
    3333
    3434static GLfloat
    3535GetVersionString(void)
    3636{
    37     static GLboolean fInitialized = GL_FALSE;
    38     static GLfloat version = 0.;
     37    GLubyte return_value[100];
     38    GLfloat version;
    3939
    40     if (!fInitialized)
    41     {
    42         GLubyte return_value[100];
    43 
    44         GetString(GL_VERSION, return_value);
    45         CRASSERT(crStrlen((char *)return_value) < 100);
    46 
    47         version = crStrToFloat((char *) return_value);
    48         version = crStateComputeVersion(version);
     40    GetString(GL_VERSION, return_value);
     41    CRASSERT(crStrlen((char *)return_value) < 100);
    4942
    50         fInitialized = GL_TRUE;
    51     }
     43    version = crStrToFloat((char *) return_value);
     44    version = crStateComputeVersion(version);
    5245
    5346    return version;
    5447}
    5548
    5649static const GLubyte *
    5750GetExtensions(void)
    5851{
    59     static GLboolean fInitialized = GL_FALSE;
    60     if (!fInitialized)
     52    GLubyte return_value[10*1000];
     53    const GLubyte *extensions, *ext;
     54    GET_THREAD(thread);
     55    int writeback = 1;
     56
     57    if (pack_spu.swap)
    6158    {
    62         GLubyte return_value[10*1000];
    63         const GLubyte *extensions, *ext;
    64         GET_THREAD(thread);
    65         int writeback = 1;
    66 
    67         if (pack_spu.swap)
    68         {
    69             crPackGetStringSWAP( GL_EXTENSIONS, return_value, &writeback );
    70         }
    71         else
    72         {
    73             crPackGetString( GL_EXTENSIONS, return_value, &writeback );
    74         }
    75         packspuFlush( (void *) thread );
    76 
    77         CRPACKSPU_WRITEBACK_WAIT(thread, writeback);
    78 
    79         CRASSERT(crStrlen((char *)return_value) < 10*1000);
    80 
    81         /* OK, we got the result from the server.  Now we have to
    82          * intersect is with the set of extensions that Chromium understands
    83          * and tack on the Chromium-specific extensions.
    84          */
    85         extensions = return_value;
    86         ext = crStateMergeExtensions(1, &extensions);
     59        crPackGetStringSWAP( GL_EXTENSIONS, return_value, &writeback );
     60    }
     61    else
     62    {
     63        crPackGetString( GL_EXTENSIONS, return_value, &writeback );
     64    }
     65    packspuFlush( (void *) thread );
     66
     67    CRPACKSPU_WRITEBACK_WAIT(thread, writeback);
     68
     69    CRASSERT(crStrlen((char *)return_value) < 10*1000);
     70
     71    /* OK, we got the result from the server.  Now we have to
     72     * intersect is with the set of extensions that Chromium understands
     73     * and tack on the Chromium-specific extensions.
     74     */
     75    extensions = return_value;
     76    ext = crStateMergeExtensions(1, &extensions);
    8777
    8878#ifdef Linux
    89         /*@todo
    90          *That's a hack to allow running Unity, it uses libnux which is calling extension functions
    91          *without checking if it's being supported/exported.
    92          *glActiveStencilFaceEXT seems to be actually supported but the extension string isn't exported (for ex. on ATI HD4870),
    93          *which leads to libglew setting function pointer to NULL and crashing Unity.
    94          */
    95         sprintf((char*)gpszExtensions, "%s GL_EXT_stencil_two_side", ext);
     79    /*@todo
     80     *That's a hack to allow running Unity, it uses libnux which is calling extension functions
     81     *without checking if it's being supported/exported.
     82     *glActiveStencilFaceEXT seems to be actually supported but the extension string isn't exported (for ex. on ATI HD4870),
     83     *which leads to libglew setting function pointer to NULL and crashing Unity.
     84     */
     85    sprintf((char*)gpszExtensions, "%s GL_EXT_stencil_two_side", ext);
    9686#else
    97         sprintf((char*)gpszExtensions, "%s", ext);
     87    sprintf((char*)gpszExtensions, "%s", ext);
    9888#endif
    99         fInitialized = GL_TRUE;
    100     }
    10189
    10290    return gpszExtensions;
    10391}
    10492
    10593#ifdef WINDOWS
    10694static bool packspuRunningUnderWine(void)
     
    169157            {
    170158                return crStateGetString(name);
    171159            }
    172160
    173161#ifdef CR_OPENGL_VERSION_2_0
    174162        case GL_SHADING_LANGUAGE_VERSION:
    175         {
    176             static GLboolean fInitialized = GL_FALSE;
    177             if (!fInitialized)
    178             {
    179                 GetString(GL_SHADING_LANGUAGE_VERSION, gpszShadingVersion);
    180                 fInitialized = GL_TRUE;
    181             }
     163            GetString(GL_SHADING_LANGUAGE_VERSION, gpszShadingVersion);
    182164            return gpszShadingVersion;
    183         }
    184165#endif
    185166#ifdef GL_CR_real_vendor_strings
    186167        case GL_REAL_VENDOR:
    187168            GetString(GL_REAL_VENDOR, ctx->pszRealVendor);
    188169            return ctx->pszRealVendor;
    189170        case GL_REAL_VERSION:
     
    194175            return ctx->pszRealRenderer;
    195176#endif
    196177        default:
    197178            return crStateGetString(name);
    198179    }
    199180}
    200 
    201 void packspuInitStrings()
    202 {
    203     static GLboolean fInitialized = GL_FALSE;
    204 
    205     if (!fInitialized)
    206     {
    207         packspu_GetString(GL_EXTENSIONS);
    208         packspu_GetString(GL_VERSION);
    209         fInitialized = GL_TRUE;
    210     }
    211 }
  • VirtualBox-5.0.0_BETA2/src/VBox/Additions//common/crOpenGL/pack/packspu.h

    diff -uNr -U 6 vbox-orig/VirtualBox-5.0.0_BETA2/src/VBox/Additions//common/crOpenGL/pack/packspu.h /home/alexey/VirtualBox-5.0.0_BETA2/src/VBox/Additions//common/crOpenGL/pack/packspu.h
    old new  
    158158                , struct VBOXUHGSMI *pHgsmi
    159159#endif
    160160        );
    161161extern void packspuFlush( void *arg );
    162162extern void packspuHuge( CROpcode opcode, void *buf );
    163163
    164 extern void packspuInitStrings();
    165 
    166164extern GLboolean packspuSyncOnFlushes();
    167165
    168166extern ThreadInfo *packspuNewThread(
    169167#if defined(VBOX_WITH_CRHGSMI) && defined(IN_GUEST)
    170168                struct VBOXUHGSMI *pHgsmi
    171169#endif
  • VirtualBox-5.0.0_BETA2/src/VBox/Additions//common/crOpenGL/pack/packspu_misc.c

    diff -uNr -U 6 vbox-orig/VirtualBox-5.0.0_BETA2/src/VBox/Additions//common/crOpenGL/pack/packspu_misc.c /home/alexey/VirtualBox-5.0.0_BETA2/src/VBox/Additions//common/crOpenGL/pack/packspu_misc.c
    old new  
    204204        packspuFlush((void *) thread);
    205205
    206206        crUnlockMutex(&_PackMutex);
    207207    }
    208208}
    209209
    210 void PACKSPU_APIENTRY packspu_NewList(GLuint list, GLenum mode)
    211 {
    212     crStateNewList(list, mode);
    213     crPackNewList(list, mode);
    214 }
    215 
    216 void PACKSPU_APIENTRY packspu_EndList()
    217 {
    218     crStateEndList();
    219     crPackEndList();
    220 }
    221 
    222210void PACKSPU_APIENTRY packspu_VBoxWindowDestroy( GLint con, GLint window )
    223211{
    224212    if (CRPACKSPU_IS_WDDM_CRHGSMI())
    225213    {
    226214        GET_THREAD(thread);
    227215        if (con)
     
    517505            packspuCheckZerroVertAttr(value);
    518506            return;
    519507        case GL_SHARE_CONTEXT_RESOURCES_CR:
    520508            crStateShareContext(value);
    521509            break;
    522510        case GL_RCUSAGE_TEXTURE_SET_CR:
    523         {
    524             Assert(value);
    525511            crStateSetTextureUsed(value, GL_TRUE);
    526512            break;
    527         }
    528513        case GL_RCUSAGE_TEXTURE_CLEAR_CR:
    529         {
    530             Assert(value);
    531 #ifdef DEBUG
    532             {
    533                 CRContext *pCurState = crStateGetCurrent();
    534                 CRTextureObj *tobj = (CRTextureObj*)crHashtableSearch(pCurState->shared->textureTable, value);
    535                 Assert(tobj);
    536             }
    537 #endif
    538514            crStateSetTextureUsed(value, GL_FALSE);
    539515            break;
    540         }
    541516        default:
    542517            break;
    543518    }
    544519    crPackChromiumParameteriCR(target, value);
    545520}
    546521
    547 GLenum PACKSPU_APIENTRY packspu_GetError( void )
    548 {
    549     GET_THREAD(thread);
    550     int writeback = 1;
    551     GLenum return_val = (GLenum) 0;
    552     CRContext *pCurState = crStateGetCurrent();
    553 
    554     if (!CRPACKSPU_IS_WDDM_CRHGSMI() && !(pack_spu.thread[pack_spu.idxThreadInUse].netServer.conn->actual_network))
    555     {
    556         crError( "packspu_GetError doesn't work when there's no actual network involved!\nTry using the simplequery SPU in your chain!" );
    557     }
    558     if (pack_spu.swap)
    559     {
    560         crPackGetErrorSWAP( &return_val, &writeback );
    561     }
    562     else
    563     {
    564         crPackGetError( &return_val, &writeback );
    565     }
    566 
    567     packspuFlush( (void *) thread );
    568     CRPACKSPU_WRITEBACK_WAIT(thread, writeback);
    569 
    570     if (pack_spu.swap)
    571     {
    572         return_val = (GLenum) SWAP32(return_val);
    573     }
    574 
    575     return return_val;
    576 }
    577 
    578522#ifdef CHROMIUM_THREADSAFE
    579523GLint PACKSPU_APIENTRY packspu_VBoxPackSetInjectThread(struct VBOXUHGSMI *pHgsmi)
    580524{
    581525    GLint con = 0;
    582526    int i;
    583527    GET_THREAD(thread);
  • VirtualBox-5.0.0_BETA2/src/VBox/Additions//common/crOpenGL/pack/packspu_net.c

    diff -uNr -U 6 vbox-orig/VirtualBox-5.0.0_BETA2/src/VBox/Additions//common/crOpenGL/pack/packspu_net.c /home/alexey/VirtualBox-5.0.0_BETA2/src/VBox/Additions//common/crOpenGL/pack/packspu_net.c
    old new  
    246246                , pHgsmi
    247247#endif
    248248            );
    249249    if (server->conn)
    250250    {
    251251        g_u32VBoxHostCaps = crNetHostCapsGet();
    252         crPackCapsSet(g_u32VBoxHostCaps);
     252        if (g_u32VBoxHostCaps & CR_VBOX_CAP_CMDBLOCKS)
     253            crPackCmdBlocksEnable();
    253254    }
    254255}
    255256
    256257void packspuConnectToServer( CRNetServer *server
    257258#if defined(VBOX_WITH_CRHGSMI) && defined(IN_GUEST)
    258259                , struct VBOXUHGSMI *pHgsmi
  • VirtualBox-5.0.0_BETA2/src/VBox/Additions//common/crOpenGL/pack/packspu_special

    diff -uNr -U 6 vbox-orig/VirtualBox-5.0.0_BETA2/src/VBox/Additions//common/crOpenGL/pack/packspu_special /home/alexey/VirtualBox-5.0.0_BETA2/src/VBox/Additions//common/crOpenGL/pack/packspu_special
    old new  
    129129DeleteFramebuffersEXT
    130130DeleteRenderbuffersEXT
    131131GenBuffersARB
    132132DeleteBuffersARB
    133133StringMarkerGREMEDY
    134134GenTextures
    135 CompileShader
    136 NewList
    137 EndList
    138 GetError
    139  No newline at end of file
     135CompileShader
     136 No newline at end of file
  • VirtualBox-5.0.0_BETA2/src/VBox/GuestHost//OpenGL/include/chromium.h

    Binary files vbox-orig/VirtualBox-5.0.0_BETA2/src/VBox/GuestHost//OpenGL/glapi_parser/apiutil.pyc and /home/alexey/VirtualBox-5.0.0_BETA2/src/VBox/GuestHost//OpenGL/glapi_parser/apiutil.pyc differ
    diff -uNr -U 6 vbox-orig/VirtualBox-5.0.0_BETA2/src/VBox/GuestHost//OpenGL/include/chromium.h /home/alexey/VirtualBox-5.0.0_BETA2/src/VBox/GuestHost//OpenGL/include/chromium.h
    old new  
    733733/* enable zero vertex attribute generation to work around wine bug */
    734734#define GL_CHECK_ZERO_VERT_ARRT       0x8B30
    735735
    736736/* share lists */
    737737#define GL_SHARE_LISTS_CR             0x8B31
    738738
    739 #define GL_HH_SET_CLIENT_CALLOUT      0x8B32
    740 
    741 /* ensure the resource is  */
    742 #define GL_PIN_TEXTURE_SET_CR         0x8B32
    743 #define GL_PIN_TEXTURE_CLEAR_CR       0x8B33
    744 
    745739/**********************************************************************/
    746740/*****                Chromium-specific API                       *****/
    747741/**********************************************************************/
    748742
    749743
    750744/*
  • VirtualBox-5.0.0_BETA2/src/VBox/GuestHost//OpenGL/include/cr_dump.h

    diff -uNr -U 6 vbox-orig/VirtualBox-5.0.0_BETA2/src/VBox/GuestHost//OpenGL/include/cr_dump.h /home/alexey/VirtualBox-5.0.0_BETA2/src/VBox/GuestHost//OpenGL/include/cr_dump.h
    old new  
    2424#include <iprt/cdefs.h>
    2525#include <iprt/string.h>
    2626#include <cr_spu.h>
    2727#include <cr_glstate.h>
    2828#include <cr_blitter.h>
    2929
    30 # define VBOXDUMPDECL(_type) _type RTCALL
     30# define VBOXDUMPDECL(_type) DECLEXPORT(_type)
    3131
    3232RT_C_DECLS_BEGIN
    3333
    3434#ifdef RT_OS_WINDOWS
    3535DECLEXPORT(void) crDmpDumpImgDmlBreak(struct CR_DUMPER * pDumper, CR_BLITTER_IMG *pImg, const char*pszEntryDesc);
    3636
     
    134134{
    135135    pRec->pBlitter = pBlitter;
    136136    pRec->pDispatch = pDispatch;
    137137    pRec->pDumper = pDumper;
    138138}
    139139
    140 VBOXDUMPDECL(void) crRecDumpBuffer(CR_RECORDER *pRec, CRContext *ctx, GLint idRedirFBO, VBOXVR_TEXTURE *pRedirTex);
    141 VBOXDUMPDECL(void) crRecDumpTextures(CR_RECORDER *pRec, CRContext *ctx);
     140VBOXDUMPDECL(void) crRecDumpBuffer(CR_RECORDER *pRec, CRContext *ctx, CR_BLITTER_CONTEXT *pCurCtx, CR_BLITTER_WINDOW *pCurWin, GLint idRedirFBO, VBOXVR_TEXTURE *pRedirTex);
     141VBOXDUMPDECL(void) crRecDumpTextures(CR_RECORDER *pRec, CRContext *ctx, CR_BLITTER_CONTEXT *pCurCtx, CR_BLITTER_WINDOW *pCurWin);
    142142VBOXDUMPDECL(void) crRecDumpTextureV(CR_RECORDER *pRec, const VBOXVR_TEXTURE *pTex, CR_BLITTER_CONTEXT *pCurCtx, CR_BLITTER_WINDOW *pCurWin, const char *pszStr, va_list pArgList);
    143 VBOXDUMPDECL(void) crRecDumpTextureF(CR_RECORDER *pRec, const VBOXVR_TEXTURE *pTex, const char *pszStr, ...);
     143VBOXDUMPDECL(void) crRecDumpTextureF(CR_RECORDER *pRec, const VBOXVR_TEXTURE *pTex, CR_BLITTER_CONTEXT *pCurCtx, CR_BLITTER_WINDOW *pCurWin, const char *pszStr, ...);
    144144VBOXDUMPDECL(void) crRecDumpTextureByIdV(CR_RECORDER *pRec, CRContext *ctx, GLint id, CR_BLITTER_CONTEXT *pCurCtx, CR_BLITTER_WINDOW *pCurWin, const char *pszStr, va_list pArgList);
    145145VBOXDUMPDECL(void) crRecDumpTextureByIdF(CR_RECORDER *pRec, CRContext *ctx, GLint id, CR_BLITTER_CONTEXT *pCurCtx, CR_BLITTER_WINDOW *pCurWin, const char *pszStr, ...);
    146146VBOXDUMPDECL(void) crRecDumpShader(CR_RECORDER *pRec, CRContext *ctx, GLint id, GLint hwid);
    147147VBOXDUMPDECL(void) crRecDumpProgram(CR_RECORDER *pRec, CRContext *ctx, GLint id, GLint hwid);
    148148VBOXDUMPDECL(void) crRecRecompileShader(CR_RECORDER *pRec, CRContext *ctx, GLint id, GLint hwid);
    149149VBOXDUMPDECL(void) crRecRecompileProgram(CR_RECORDER *pRec, CRContext *ctx, GLint id, GLint hwid);
  • VirtualBox-5.0.0_BETA2/src/VBox/GuestHost//OpenGL/include/cr_error.h

    diff -uNr -U 6 vbox-orig/VirtualBox-5.0.0_BETA2/src/VBox/GuestHost//OpenGL/include/cr_error.h /home/alexey/VirtualBox-5.0.0_BETA2/src/VBox/GuestHost//OpenGL/include/cr_error.h
    old new  
    3636# endif
    3737#endif
    3838
    3939DECLEXPORT(void) crEnableWarnings(int onOff);
    4040
    4141DECLEXPORT(void) crDebug(const char *format, ... ) PRINTF;
    42 DECLEXPORT(void) crDbgCmdPrint(const char *description1, const char *description2, const char *cmd, ...);
    43 DECLEXPORT(void) crDbgCmdSymLoadPrint(const char *modName, const void*pvAddress);
    4442#if defined(DEBUG_misha) && defined(RT_OS_WINDOWS)
    4543typedef void FNCRDEBUG(const char *format, ... ) PRINTF;
    4644typedef FNCRDEBUG *PFNCRDEBUG;
    4745DECLINLINE(PFNCRDEBUG) crGetDebug() {return crDebug;}
    4846# define crWarning (RT_BREAKPOINT(), crDebug)
    4947#else
  • VirtualBox-5.0.0_BETA2/src/VBox/GuestHost//OpenGL/include/cr_glstate.h

    diff -uNr -U 6 vbox-orig/VirtualBox-5.0.0_BETA2/src/VBox/GuestHost//OpenGL/include/cr_glstate.h /home/alexey/VirtualBox-5.0.0_BETA2/src/VBox/GuestHost//OpenGL/include/cr_glstate.h
    old new  
    219219DECLEXPORT(GLboolean) crStateEnableDiffOnMakeCurrent(GLboolean fEnable);
    220220
    221221void crStateSwitchPrepare(CRContext *toCtx, CRContext *fromCtx, GLuint idDrawFBO, GLuint idReadFBO);
    222222void crStateSwitchPostprocess(CRContext *toCtx, CRContext *fromCtx, GLuint idDrawFBO, GLuint idReadFBO);
    223223
    224224void crStateSyncHWErrorState(CRContext *ctx);
    225 GLenum crStateCleanHWErrorState();
    226 
    227 #define CR_STATE_CLEAN_HW_ERR_WARN(_s) do {\
    228             GLenum _err = crStateCleanHWErrorState(); \
    229             if (_err != GL_NO_ERROR) { \
    230                 static int _cErrPrints = 0; \
    231                 if (_cErrPrints < 5) { \
    232                     ++_cErrPrints; \
    233                     WARN(("%s %#x, ignoring.. (%d out of 5)", _s, _err, _cErrPrints)); \
    234                 } \
    235             } \
    236         } while (0)
    237225
    238226DECLEXPORT(void) crStateFlushFunc( CRStateFlushFunc ff );
    239227DECLEXPORT(void) crStateFlushArg( void *arg );
    240228DECLEXPORT(void) crStateDiffAPI( SPUDispatchTable *api );
    241229DECLEXPORT(void) crStateUpdateColorBits( void );
    242230
     
    279267DECLEXPORT(void) crStateFreeFBImageLegacy(CRContext *to);
    280268
    281269DECLEXPORT(void) crStateGetTextureObjectAndImage(CRContext *g, GLenum texTarget, GLint level,
    282270                                     CRTextureObj **obj, CRTextureLevel **img);
    283271
    284272
    285 DECLEXPORT(void) crStateReleaseTexture(CRContext *pCtx, CRTextureObj *pObj);
    286 
    287273#ifndef IN_GUEST
    288274DECLEXPORT(int32_t) crStateSaveContext(CRContext *pContext, PSSMHANDLE pSSM);
    289275typedef DECLCALLBACK(CRContext*) FNCRSTATE_CONTEXT_GET(void*);
    290276typedef FNCRSTATE_CONTEXT_GET *PFNCRSTATE_CONTEXT_GET;
    291277DECLEXPORT(int32_t) crStateLoadContext(CRContext *pContext, CRHashTable * pCtxTable, PFNCRSTATE_CONTEXT_GET pfnCtxGet, PSSMHANDLE pSSM, uint32_t u32Version);
    292278DECLEXPORT(void) crStateFreeShared(CRContext *pContext, CRSharedState *s);
     
    296282
    297283DECLEXPORT(CRSharedState *) crStateGlobalSharedAcquire();
    298284DECLEXPORT(void) crStateGlobalSharedRelease();
    299285#endif
    300286
    301287DECLEXPORT(void) crStateSetTextureUsed(GLuint texture, GLboolean used);
    302 DECLEXPORT(void) crStatePinTexture(GLuint texture, GLboolean pin);
    303288DECLEXPORT(void) crStateDeleteTextureCallback(void *texObj);
    304289
    305290   /* XXX move these! */
    306291
    307292DECLEXPORT(void) STATE_APIENTRY
    308293crStateChromiumParameteriCR( GLenum target, GLint value );
  • VirtualBox-5.0.0_BETA2/src/VBox/GuestHost//OpenGL/include/cr_pack.h

    diff -uNr -U 6 vbox-orig/VirtualBox-5.0.0_BETA2/src/VBox/GuestHost//OpenGL/include/cr_pack.h /home/alexey/VirtualBox-5.0.0_BETA2/src/VBox/GuestHost//OpenGL/include/cr_pack.h
    old new  
    105105# else
    106106extern DLLDATA(CRPackContext) cr_packer_globals;
    107107#  define CR_GET_PACKER_CONTEXT(C) CRPackContext *C = &cr_packer_globals
    108108#  define CR_LOCK_PACKER_CONTEXT(PC)
    109109#  define CR_UNLOCK_PACKER_CONTEXT(PC)
    110110# endif
    111 extern uint32_t cr_packer_cmd_blocks_enabled;
     111extern int cr_packer_cmd_blocks_enabled;
    112112#else /* if defined IN_RING0 */
    113113# define CR_PACKER_CONTEXT_ARGSINGLEDECL CRPackContext *_pCtx
    114114# define CR_PACKER_CONTEXT_ARGDECL CR_PACKER_CONTEXT_ARGSINGLEDECL,
    115115# define CR_PACKER_CONTEXT_ARG _pCtx,
    116116# define CR_PACKER_CONTEXT_ARGCTX(C) C,
    117117# define CR_GET_PACKER_CONTEXT(C) CRPackContext *C = _pCtx
     
    187187extern DECLEXPORT(void) crPackExpandMultiDrawArraysEXT( GLenum mode, GLint *first, GLsizei *count, GLsizei primcount, CRClientState *c, const GLfloat *pZva );
    188188extern DECLEXPORT(void) crPackExpandMultiDrawArraysEXTSWAP( GLenum mode, GLint *first, GLsizei *count, GLsizei primcount, CRClientState *c, const GLfloat *pZva );
    189189
    190190extern DECLEXPORT(void) crPackExpandMultiDrawElementsEXT( GLenum mode, const GLsizei *count, GLenum type, const GLvoid **indices, GLsizei primcount, CRClientState *c, const GLfloat *pZva );
    191191extern DECLEXPORT(void) crPackExpandMultiDrawElementsEXTSWAP( GLenum mode, const GLsizei *count, GLenum type, const GLvoid **indices, GLsizei primcount, CRClientState *c, const GLfloat *pZva );
    192192
    193 extern DECLEXPORT(void) crPackCapsSet(uint32_t u32Caps);
     193extern DECLEXPORT(void) crPackCmdBlocksEnable();
     194
    194195
    195196/**
    196197 * Return number of opcodes in given buffer.
    197198 */
    198199static INLINE int
    199200crPackNumOpcodes(const CRPackBuffer *buffer)
     
    247248
    248249#define CR_CMDBLOCK_OP( _pc, _op)                                   \
    249250  do {                                                              \
    250251      CR_PACK_SPECIAL_OP( _pc, _op);                                \
    251252  } while (0)
    252253
    253 #define CR_CMDBLOCK_IS_STARTED( pc, op )  CRPACKBLOCKSTATE_IS_OP_STARTED((pc)->u32CmdBlockState, op)
    254254
    255255#define CR_CMDBLOCK_BEGIN( pc, op )                                 \
    256256  do {                                                              \
    257257    CR_LOCK_PACKER_CONTEXT(pc);                                     \
    258258    if (!cr_packer_cmd_blocks_enabled) break;                       \
    259     if (!CRPACKBLOCKSTATE_IS_STARTED((pc)->u32CmdBlockState)) {       \
     259    if (!CRPACKBLOCKSTATE_IS_STARTED(pc->u32CmdBlockState)) {       \
    260260      THREADASSERT( pc );                                           \
    261       CRASSERT( (pc)->currentBuffer );                                \
    262       if (!crPackBufferIsEmpty(&(pc)->buffer)) {                      \
    263         if ((*(pc)->buffer.opcode_start) != CR_NOP_OPCODE) {          \
    264           (pc)->Flush( (pc)->flush_arg );                               \
    265           Assert(crPackCanHoldOpcode( (pc), 1, 4 ) );                 \
    266           CR_CMDBLOCK_OP( (pc), CR_CMDBLOCKBEGIN_OPCODE );            \
     261      CRASSERT( pc->currentBuffer );                                \
     262      if (!crPackBufferIsEmpty(&pc->buffer)) {                      \
     263        if ((*pc->buffer.opcode_start) != CR_NOP_OPCODE) {          \
     264          pc->Flush( pc->flush_arg );                               \
     265          Assert(crPackCanHoldOpcode( pc, 1, 4 ) );                 \
     266          CR_CMDBLOCK_OP( pc, CR_CMDBLOCKBEGIN_OPCODE );            \
    267267        }                                                           \
    268268        else {                                                      \
    269           (*(pc)->buffer.opcode_start) = CR_CMDBLOCKBEGIN_OPCODE;     \
     269          (*pc->buffer.opcode_start) = CR_CMDBLOCKBEGIN_OPCODE;     \
    270270        }                                                           \
    271271      }                                                             \
    272272      else {                                                        \
    273         Assert(crPackCanHoldOpcode( (pc), 1, 4 ) );                   \
    274         CR_CMDBLOCK_OP( (pc), CR_CMDBLOCKBEGIN_OPCODE );              \
     273        Assert(crPackCanHoldOpcode( pc, 1, 4 ) );                   \
     274        CR_CMDBLOCK_OP( pc, CR_CMDBLOCKBEGIN_OPCODE );              \
    275275      }                                                             \
    276276    }                                                               \
    277     Assert(!CRPACKBLOCKSTATE_IS_OP_STARTED((pc)->u32CmdBlockState, op)); \
    278     CRPACKBLOCKSTATE_OP_START((pc)->u32CmdBlockState, op);            \
    279     Assert(CRPACKBLOCKSTATE_IS_OP_STARTED((pc)->u32CmdBlockState, op)); \
     277    CRPACKBLOCKSTATE_OP_START(pc->u32CmdBlockState, op);            \
    280278  } while (0)
    281279
    282280#define CR_CMDBLOCK_END( pc, op )                                   \
    283281  do {                                                              \
    284282    if (!cr_packer_cmd_blocks_enabled) break;                       \
    285     Assert(CRPACKBLOCKSTATE_IS_OP_STARTED((pc)->u32CmdBlockState, op)); \
    286     CRPACKBLOCKSTATE_OP_STOP((pc)->u32CmdBlockState, op);             \
    287     Assert(!CRPACKBLOCKSTATE_IS_OP_STARTED((pc)->u32CmdBlockState, op)); \
    288     if (!CRPACKBLOCKSTATE_IS_STARTED((pc)->u32CmdBlockState)) {     \
     283    CRPACKBLOCKSTATE_OP_STOP(pc->u32CmdBlockState, op);             \
     284    if (!CRPACKBLOCKSTATE_IS_STARTED(pc->u32CmdBlockState)) {       \
    289285      THREADASSERT( pc );                                           \
    290       CRASSERT( (pc)->currentBuffer );                              \
    291       if (!crPackBufferIsEmpty(&(pc)->buffer)) {                    \
    292         if ((*(pc)->buffer.opcode_start) != CR_CMDBLOCKBEGIN_OPCODE) {\
     286      CRASSERT( pc->currentBuffer );                                \
     287      if (!crPackBufferIsEmpty(&pc->buffer)) {                      \
     288        if ((*pc->buffer.opcode_start) != CR_CMDBLOCKBEGIN_OPCODE) {\
    293289          if ( !crPackCanHoldOpcode( pc, 1, 4 ) ) {                 \
    294             (pc)->Flush( (pc)->flush_arg );                         \
     290            pc->Flush( pc->flush_arg );                             \
    295291            Assert(crPackCanHoldOpcode( pc, 1, 4 ) );               \
    296292          }                                                         \
    297293          CR_CMDBLOCK_OP( pc, CR_CMDBLOCKEND_OPCODE );              \
    298           (pc)->Flush( (pc)->flush_arg );                           \
     294          pc->Flush( pc->flush_arg );                               \
    299295        }                                                           \
    300296        else {                                                      \
    301           (*(pc)->buffer.opcode_start) = CR_NOP_OPCODE;             \
     297          (*pc->buffer.opcode_start) = CR_NOP_OPCODE;               \
    302298        }                                                           \
    303299      }                                                             \
    304300      else {                                                        \
    305301        Assert(crPackCanHoldOpcode( pc, 1, 4 ) );                   \
    306302        CR_CMDBLOCK_OP( pc, CR_CMDBLOCKEND_OPCODE );                \
    307         (pc)->Flush( pc->flush_arg );                               \
     303        pc->Flush( pc->flush_arg );                                 \
    308304      }                                                             \
    309305    }                                                               \
    310306  } while (0)
    311307
    312 #define CR_CMDBLOCK_CHECK_FLUSH( pc )                               \
    313   do {                                                              \
    314     if (!(cr_packer_cmd_blocks_enabled & CR_VBOX_CAP_CMDBLOCKS_FLUSH)) break; \
    315     if(!CRPACKBLOCKSTATE_IS_OP_STARTED((pc)->u32CmdBlockState, CRPACKBLOCKSTATE_OP_NEWLIST)) break; \
    316     THREADASSERT( pc );                                             \
    317     CRASSERT( (pc)->currentBuffer );                                \
    318     if ( !crPackCanHoldOpcode( pc, 1, 4 ) ) {                       \
    319       (pc)->Flush( (pc)->flush_arg );                               \
    320       Assert(crPackCanHoldOpcode( pc, 1, 4 ) );                     \
    321     }                                                               \
    322     CR_CMDBLOCK_OP( pc, CR_CMDBLOCKFLUSH_OPCODE );                  \
    323     (pc)->Flush( (pc)->flush_arg );                                 \
    324   } while (0)
    325 
    326308/**
    327309 * Alloc space for a message of 'len' bytes (plus 1 opcode).
    328310 * Only flush if buffer is full.
    329311 */
    330312#define CR_GET_BUFFERED_POINTER_NO_BEGINEND_FLUSH(pc, len, lock)    \
    331313  do {                                                              \
  • VirtualBox-5.0.0_BETA2/src/VBox/GuestHost//OpenGL/include/cr_server.h

    diff -uNr -U 6 vbox-orig/VirtualBox-5.0.0_BETA2/src/VBox/GuestHost//OpenGL/include/cr_server.h /home/alexey/VirtualBox-5.0.0_BETA2/src/VBox/GuestHost//OpenGL/include/cr_server.h
    old new  
    353353    CRScreenInfo screen[CR_MAX_GUEST_MONITORS];
    354354    CRScreenViewportInfo screenVieport[CR_MAX_GUEST_MONITORS];
    355355    int          screenCount;
    356356
    357357    GLboolean fCrCmdEnabled;
    358358
    359     GLboolean fProcessingPendedCommands;
    360 
    361359    int numClients;
    362360    CRClient *clients[CR_MAX_CLIENTS];  /**< array [numClients] */
    363361    CRClient *curClient;
    364362    CRClientNode *pCleanupClient;  /*list of clients with pending clean up*/
    365363    CRHTABLE clientTable;
    366364    CRCurrentStatePointers current;
     
    414412    CR_BLITTER Blitter;
    415413
    416414    CR_SERVER_RPW RpwWorker;
    417415
    418416    VBOXCRCMDCTL_HGCMDISABLE_DATA DisableData;
    419417
    420     RTSEMEVENT hCalloutCompletionEvent;
    421     VBOXCRCMDCTL *pCurrentCalloutCtl;
    422     VBOXCRCLIENT_INFO ClientInfo;
    423 
    424418    /** configuration options */
    425419    /*@{*/
    426420    int useL2;
    427421    int ignore_papi;
    428422    unsigned int maxBarrierCount;
    429423    unsigned int clearCount;
  • VirtualBox-5.0.0_BETA2/src/VBox/GuestHost//OpenGL/include/cr_sortarray.h

    diff -uNr -U 6 vbox-orig/VirtualBox-5.0.0_BETA2/src/VBox/GuestHost//OpenGL/include/cr_sortarray.h /home/alexey/VirtualBox-5.0.0_BETA2/src/VBox/GuestHost//OpenGL/include/cr_sortarray.h
    old new  
    1 /* $Id: cr_sortarray.h $ */
    2 
    3 /** @file
    4  * Sorted array API
    5  */
    6 
    7 /*
    8  * Copyright (C) 2014 Oracle Corporation
    9  *
    10  * This file is part of VirtualBox Open Source Edition (OSE), as
    11  * available from http://www.virtualbox.org. This file is free software;
    12  * you can redistribute it and/or modify it under the terms of the GNU
    13  * General Public License (GPL) as published by the Free Software
    14  * Foundation, in version 2 as it comes in the "COPYING" file of the
    15  * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
    16  * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
    17  */
    18 #ifndef ___cr_sortarray_h_
    19 #define ___cr_sortarray_h_
    20 
    21 #include <iprt/types.h>
    22 #include <iprt/assert.h>
    23 
    24 typedef struct CR_SORTARRAY
    25 {
    26     uint32_t cBufferSize;
    27     uint32_t cSize;
    28     uint64_t *pElements;
    29 } CR_SORTARRAY;
    30 
    31 
    32 #ifndef IN_RING0
    33 # define VBOXSADECL(_type) DECLEXPORT(_type)
    34 #else
    35 # define VBOXSADECL(_type) RTDECL(_type)
    36 #endif
    37 
    38 
    39 DECLINLINE(uint32_t) CrSaGetSize(const CR_SORTARRAY *pArray)
    40 {
    41     return pArray->cSize;
    42 }
    43 
    44 DECLINLINE(uint64_t) CrSaGetVal(const CR_SORTARRAY *pArray, uint32_t i)
    45 {
    46     Assert(i < pArray->cSize);
    47     return pArray->pElements[i];
    48 }
    49 
    50 DECLINLINE(const uint64_t*) CrSaGetElements(const CR_SORTARRAY *pArray)
    51 {
    52     return pArray->pElements;
    53 }
    54 
    55 DECLINLINE(void) CrSaClear(CR_SORTARRAY *pArray)
    56 {
    57     pArray->cSize = 0;
    58 }
    59 
    60 VBOXSADECL(int) CrSaInit(CR_SORTARRAY *pArray, uint32_t cInitBuffer);
    61 VBOXSADECL(void) CrSaCleanup(CR_SORTARRAY *pArray);
    62 /*
    63  * @return true if element is found */
    64 VBOXSADECL(bool) CrSaContains(const CR_SORTARRAY *pArray, uint64_t element);
    65 
    66 /*
    67  * @return VINF_SUCCESS  if element is added
    68  * VINF_ALREADY_INITIALIZED if element was in array already
    69  * VERR_NO_MEMORY - no memory
    70  *  */
    71 VBOXSADECL(int) CrSaAdd(CR_SORTARRAY *pArray, uint64_t element);
    72 
    73 /*
    74  * @return VINF_SUCCESS  if element is removed
    75  * VINF_ALREADY_INITIALIZED if element was NOT in array
    76  *  */
    77 VBOXSADECL(int) CrSaRemove(CR_SORTARRAY *pArray, uint64_t element);
    78 
    79 /*
    80  * @return VINF_SUCCESS on success
    81  * VERR_NO_MEMORY - no memory
    82  *  */
    83 VBOXSADECL(void) CrSaIntersect(CR_SORTARRAY *pArray1, const CR_SORTARRAY *pArray2);
    84 VBOXSADECL(int) CrSaIntersected(const CR_SORTARRAY *pArray1, const CR_SORTARRAY *pArray2, CR_SORTARRAY *pResult);
    85 
    86 /*
    87  * @return VINF_SUCCESS on success
    88  * VERR_NO_MEMORY - no memory
    89  *  */
    90 VBOXSADECL(int) CrSaUnited(const CR_SORTARRAY *pArray1, const CR_SORTARRAY *pArray2, CR_SORTARRAY *pResult);
    91 
    92 /*
    93  * @return VINF_SUCCESS on success
    94  * VERR_NO_MEMORY - no memory
    95  *  */
    96 VBOXSADECL(int) CrSaClone(const CR_SORTARRAY *pArray1, CR_SORTARRAY *pResult);
    97 
    98 VBOXSADECL(int) CrSaCmp(const CR_SORTARRAY *pArray1, const CR_SORTARRAY *pArray2);
    99 
    100 VBOXSADECL(bool) CrSaCovers(const CR_SORTARRAY *pArray1, const CR_SORTARRAY *pArray2);
    101 
    102 #endif /* ___cr_sortarray_h_ */
  • VirtualBox-5.0.0_BETA2/src/VBox/GuestHost//OpenGL/include/cr_unpack.h

    diff -uNr -U 6 vbox-orig/VirtualBox-5.0.0_BETA2/src/VBox/GuestHost//OpenGL/include/cr_unpack.h /home/alexey/VirtualBox-5.0.0_BETA2/src/VBox/GuestHost//OpenGL/include/cr_unpack.h
    old new  
    3030DECLEXPORT(void) crUnpackPop(void);
    3131
    3232typedef enum
    3333{
    3434    CR_UNPACK_BUFFER_TYPE_GENERIC = 0,
    3535    CR_UNPACK_BUFFER_TYPE_CMDBLOCK_BEGIN,
    36     CR_UNPACK_BUFFER_TYPE_CMDBLOCK_FLUSH,
    3736    CR_UNPACK_BUFFER_TYPE_CMDBLOCK_END
    3837} CR_UNPACK_BUFFER_TYPE;
    3938
    4039DECLEXPORT(CR_UNPACK_BUFFER_TYPE) crUnpackGetBufferType(const void *opcodes, unsigned int num_opcodes);
    4140
    4241extern CRNetworkPointer * return_ptr;
  • VirtualBox-5.0.0_BETA2/src/VBox/GuestHost//OpenGL/include/state/cr_texture.h

    diff -uNr -U 6 vbox-orig/VirtualBox-5.0.0_BETA2/src/VBox/GuestHost//OpenGL/include/state/cr_texture.h /home/alexey/VirtualBox-5.0.0_BETA2/src/VBox/GuestHost//OpenGL/include/state/cr_texture.h
    old new  
    9090#ifdef CR_ARB_shadow_ambient
    9191    GLfloat                compareFailValue;
    9292#endif
    9393#ifdef CR_SGIS_generate_mipmap
    9494    GLboolean              generateMipmap;
    9595#endif
    96     GLboolean              pinned; /* <- keep the texture alive if its ctxUsage reaches zero */
    9796    CRbitvalue             dirty[CR_MAX_BITARRAY];
    9897    CRbitvalue             imageBit[CR_MAX_BITARRAY];
    9998    CRbitvalue             paramsBit[CR_MAX_TEXTURE_UNITS][CR_MAX_BITARRAY];
    10099    /* bitfield representing the object usage. 1 means the object is used by the context with the given bitid */
    101100    CRbitvalue             ctxUsage[CR_MAX_BITARRAY];
    102101} CRTextureObj;
  • VirtualBox-5.0.0_BETA2/src/VBox/GuestHost//OpenGL/packer/opcodes.py

    diff -uNr -U 6 vbox-orig/VirtualBox-5.0.0_BETA2/src/VBox/GuestHost//OpenGL/packer/opcodes.py /home/alexey/VirtualBox-5.0.0_BETA2/src/VBox/GuestHost//OpenGL/packer/opcodes.py
    old new  
    3535
    3636print "\tCR_EXTEND_OPCODE=%d," % enum_index
    3737enum_index = enum_index + 1
    3838print "\tCR_CMDBLOCKBEGIN_OPCODE=%d," % enum_index
    3939enum_index = enum_index + 1
    4040print "\tCR_CMDBLOCKEND_OPCODE=%d," % enum_index
    41 enum_index = enum_index + 1
    42 print "\tCR_CMDBLOCKFLUSH_OPCODE=%d," % enum_index
    4341print "\tCR_NOP_OPCODE=255"
    4442if enum_index > 254:
    4543        # This would have saved Mike some grief if it had been here earlier.
    4644        print >> sys.stderr, "You have more than 255 opcodes!  You've been adding functions to"
    4745        print >> sys.stderr, "glapi_parser/APIspec!  Each new function you add"
    4846        print >> sys.stderr, "gets an opcode assigned to it.  Fortunately for you, we have"
  • VirtualBox-5.0.0_BETA2/src/VBox/GuestHost//OpenGL/packer/pack_beginend.c

    diff -uNr -U 6 vbox-orig/VirtualBox-5.0.0_BETA2/src/VBox/GuestHost//OpenGL/packer/pack_beginend.c /home/alexey/VirtualBox-5.0.0_BETA2/src/VBox/GuestHost//OpenGL/packer/pack_beginend.c
    old new  
    1010void PACK_APIENTRY crPackBegin( GLenum mode )
    1111{
    1212    CR_GET_PACKER_CONTEXT(pc);
    1313    unsigned char *data_ptr;
    1414    (void) pc;
    1515
    16     if (CR_CMDBLOCK_IS_STARTED(pc, CRPACKBLOCKSTATE_OP_BEGIN))
    17     {
    18         WARN(("recursive begin?"));
    19         return;
    20     }
    21 
    2216    CR_CMDBLOCK_BEGIN( pc, CRPACKBLOCKSTATE_OP_BEGIN );
    2317#ifndef VBOX
    2418    if (pc->buffer.canBarf)
    2519    {
    2620        if (!pc->buffer.holds_BeginEnd)
    2721            pc->Flush( pc->flush_arg );
     
    8175    CR_GET_BUFFERED_POINTER_NO_ARGS( pc );
    8276    WRITE_OPCODE( pc, CR_END_OPCODE );
    8377    pc->buffer.in_BeginEnd = 0;
    8478    CR_CMDBLOCK_END( pc, CRPACKBLOCKSTATE_OP_BEGIN );
    8579    CR_UNLOCK_PACKER_CONTEXT(pc);
    8680}
     81
  • VirtualBox-5.0.0_BETA2/src/VBox/GuestHost//OpenGL/packer/pack_bufferobject.c

    diff -uNr -U 6 vbox-orig/VirtualBox-5.0.0_BETA2/src/VBox/GuestHost//OpenGL/packer/pack_bufferobject.c /home/alexey/VirtualBox-5.0.0_BETA2/src/VBox/GuestHost//OpenGL/packer/pack_bufferobject.c
    old new  
    9696        WRITE_DATA( 8, GLenum, target );
    9797        WRITE_DATA( 12, GLuint, (GLuint) offset );
    9898        WRITE_DATA( 16, GLuint, (GLuint) size );
    9999        WRITE_NETWORK_POINTER( 20, (void *) data );
    100100        WRITE_NETWORK_POINTER( 28, (void *) writeback );
    101101        WRITE_OPCODE( pc, CR_EXTEND_OPCODE );
    102         CR_CMDBLOCK_CHECK_FLUSH(pc);
    103102    CR_UNLOCK_PACKER_CONTEXT(pc);
    104103}
    105104
    106105void PACK_APIENTRY
    107106crPackDeleteBuffersARB(GLsizei n, const GLuint * buffers)
    108107{
  • VirtualBox-5.0.0_BETA2/src/VBox/GuestHost//OpenGL/packer/pack_context.c

    diff -uNr -U 6 vbox-orig/VirtualBox-5.0.0_BETA2/src/VBox/GuestHost//OpenGL/packer/pack_context.c /home/alexey/VirtualBox-5.0.0_BETA2/src/VBox/GuestHost//OpenGL/packer/pack_context.c
    old new  
    4242        WRITE_BYTES( 8, displayName, DISPLAY_NAME_LEN );
    4343        WRITE_DATA( DISPLAY_NAME_LEN + 8, GLint, visual );
    4444        WRITE_DATA( DISPLAY_NAME_LEN + 12, GLint, shareCtx );
    4545        WRITE_NETWORK_POINTER( DISPLAY_NAME_LEN + 16, (void *) return_value );
    4646        WRITE_NETWORK_POINTER( DISPLAY_NAME_LEN + 24, (void *) writeback );
    4747        WRITE_OPCODE( pc, CR_EXTEND_OPCODE );
    48         CR_CMDBLOCK_CHECK_FLUSH(pc);
    4948    CR_UNLOCK_PACKER_CONTEXT(pc);
    5049}
    5150
    5251void PACK_APIENTRY
    5352crPackCreateContextSWAP( const char *dpyName, GLint visual, GLint shareCtx,
    5453                         GLint *return_value, int *writeback )
     
    7574        WRITE_BYTES( 8, displayName, DISPLAY_NAME_LEN );
    7675        WRITE_DATA( DISPLAY_NAME_LEN + 8, GLenum, SWAP32(visual) );
    7776        WRITE_DATA( DISPLAY_NAME_LEN + 12, GLenum, SWAP32(shareCtx) );
    7877        WRITE_NETWORK_POINTER( DISPLAY_NAME_LEN + 16, (void *) return_value );
    7978        WRITE_NETWORK_POINTER( DISPLAY_NAME_LEN + 24, (void *) writeback );
    8079        WRITE_OPCODE( pc, CR_EXTEND_OPCODE );
    81         CR_CMDBLOCK_CHECK_FLUSH(pc);
    8280    CR_UNLOCK_PACKER_CONTEXT(pc);
    8381}
    8482
    8583
    8684void PACK_APIENTRY crPackWindowCreate( const char *dpyName, GLint visBits, GLint *return_value, int *writeback )
    8785{
     
    105103        WRITE_DATA( 4, GLenum, CR_WINDOWCREATE_EXTEND_OPCODE );
    106104        WRITE_BYTES( 8, displayName, DISPLAY_NAME_LEN );
    107105        WRITE_DATA( DISPLAY_NAME_LEN + 8, GLint, visBits );
    108106        WRITE_NETWORK_POINTER( DISPLAY_NAME_LEN + 12, (void *) return_value );
    109107        WRITE_NETWORK_POINTER( DISPLAY_NAME_LEN + 20, (void *) writeback );
    110108        WRITE_OPCODE( pc, CR_EXTEND_OPCODE );
    111         CR_CMDBLOCK_CHECK_FLUSH(pc);
    112109    CR_UNLOCK_PACKER_CONTEXT(pc);
    113110}
    114111
    115112void PACK_APIENTRY crPackWindowCreateSWAP( const char *dpyName, GLint visBits, GLint *return_value, int *writeback )
    116113{
    117114        char displayName[DISPLAY_NAME_LEN];
     
    134131        WRITE_DATA( 4, GLenum, SWAP32(CR_WINDOWCREATE_EXTEND_OPCODE) );
    135132        WRITE_BYTES( 8, displayName, DISPLAY_NAME_LEN );
    136133        WRITE_DATA( DISPLAY_NAME_LEN + 8, GLint, SWAP32(visBits) );
    137134        WRITE_NETWORK_POINTER( DISPLAY_NAME_LEN + 12, (void *) return_value );
    138135        WRITE_NETWORK_POINTER( DISPLAY_NAME_LEN + 20, (void *) writeback );
    139136        WRITE_OPCODE( pc, CR_EXTEND_OPCODE );
    140         CR_CMDBLOCK_CHECK_FLUSH(pc);
    141137    CR_UNLOCK_PACKER_CONTEXT(pc);
    142138}
  • VirtualBox-5.0.0_BETA2/src/VBox/GuestHost//OpenGL/packer/packer.py

    Binary files vbox-orig/VirtualBox-5.0.0_BETA2/src/VBox/GuestHost//OpenGL/packer/pack_currenttypes.pyc and /home/alexey/VirtualBox-5.0.0_BETA2/src/VBox/GuestHost//OpenGL/packer/pack_currenttypes.pyc differ
    diff -uNr -U 6 vbox-orig/VirtualBox-5.0.0_BETA2/src/VBox/GuestHost//OpenGL/packer/packer.py /home/alexey/VirtualBox-5.0.0_BETA2/src/VBox/GuestHost//OpenGL/packer/packer.py
    old new  
    207207    # finish up
    208208    if is_extended:
    209209        print "\tWRITE_OPCODE( pc, CR_EXTEND_OPCODE );"
    210210    else:
    211211        print "\tWRITE_OPCODE( pc, %s );" % apiutil.OpcodeName( func_name )
    212212
    213     if "get" in apiutil.Properties(func_name):
    214         print '\tCR_CMDBLOCK_CHECK_FLUSH(pc);'
    215 
    216213    print '\tCR_UNLOCK_PACKER_CONTEXT(pc);'
    217214    print '}\n'
    218215
    219216
    220 r0_funcs = [ 'ChromiumParameteriCR', 'WindowSize', 'WindowShow', 'WindowPosition' ]
    221217
    222218
    223219apiutil.CopyrightC()
    224220
    225221print """
    226222/* DO NOT EDIT - THIS FILE GENERATED BY THE packer.py SCRIPT */
     
    259255        pointers_ok = 1
    260256        params.append(("writeback", "int *", 0))
    261257
    262258    if func_name == 'Writeback':
    263259        pointers_ok = 1
    264260
    265     if not func_name in r0_funcs:
    266         print '#ifndef IN_RING0'
    267        
    268261    PrintFunc( func_name, params, 0, pointers_ok )
    269262    PrintFunc( func_name, params, 1, pointers_ok )
    270    
    271     if not func_name in r0_funcs:
    272         print '#endif'
    273    
  • VirtualBox-5.0.0_BETA2/src/VBox/GuestHost//OpenGL/packer/pack_init.c

    diff -uNr -U 6 vbox-orig/VirtualBox-5.0.0_BETA2/src/VBox/GuestHost//OpenGL/packer/pack_init.c /home/alexey/VirtualBox-5.0.0_BETA2/src/VBox/GuestHost//OpenGL/packer/pack_init.c
    old new  
    1414int cr_packer_globals;  /* dummy - for the sake of packer.def */
    1515#else
    1616int _PackerTSD;         /* dummy - for the sake of packer.def */  /* drm1 */
    1717DLLDATA(CRPackContext) cr_packer_globals;
    1818#endif
    1919
    20 uint32_t cr_packer_cmd_blocks_enabled = 0;
     20int cr_packer_cmd_blocks_enabled = 0;
    2121
    2222CRPackContext *crPackNewContext( int swapping )
    2323{
    2424#ifdef CHROMIUM_THREADSAFE
    2525    CRPackContext *pc = crCalloc(sizeof(CRPackContext));
    2626    if (!pc)
     
    6565    return (CRPackContext *) crGetTSD( &_PackerTSD );
    6666#else
    6767    return &cr_packer_globals;
    6868#endif
    6969}
    7070
    71 void crPackCapsSet(uint32_t u32Caps)
     71void crPackCmdBlocksEnable()
    7272{
    73     cr_packer_cmd_blocks_enabled = (u32Caps & (CR_VBOX_CAP_CMDBLOCKS_FLUSH | CR_VBOX_CAP_CMDBLOCKS));
     73    cr_packer_cmd_blocks_enabled = 1;
    7474}
  • VirtualBox-5.0.0_BETA2/src/VBox/GuestHost//OpenGL/packer/pack_lists.c

    diff -uNr -U 6 vbox-orig/VirtualBox-5.0.0_BETA2/src/VBox/GuestHost//OpenGL/packer/pack_lists.c /home/alexey/VirtualBox-5.0.0_BETA2/src/VBox/GuestHost//OpenGL/packer/pack_lists.c
    old new  
    6060
    6161void PACK_APIENTRY crPackNewList( GLuint list, GLenum mode )
    6262{
    6363    CR_GET_PACKER_CONTEXT(pc);
    6464    unsigned char *data_ptr;
    6565    (void) pc;
    66 
    67     if (CR_CMDBLOCK_IS_STARTED(pc, CRPACKBLOCKSTATE_OP_NEWLIST))
    68     {
    69         WARN(("recursive NewList?"));
    70         return;
    71     }
    72 
    7366    CR_CMDBLOCK_BEGIN( pc, CRPACKBLOCKSTATE_OP_NEWLIST );
    7467    CR_GET_BUFFERED_POINTER_NO_BEGINEND_FLUSH( pc, 16, GL_FALSE );
    7568    WRITE_DATA( 0, GLint, 16 );
    7669    WRITE_DATA( 4, GLenum, CR_NEWLIST_EXTEND_OPCODE );
    7770    WRITE_DATA( 8, GLuint, list );
    7871    WRITE_DATA( 12, GLenum, mode );
  • VirtualBox-5.0.0_BETA2/src/VBox/GuestHost//OpenGL/packer/pack_pixels.c

    diff -uNr -U 6 vbox-orig/VirtualBox-5.0.0_BETA2/src/VBox/GuestHost//OpenGL/packer/pack_pixels.c /home/alexey/VirtualBox-5.0.0_BETA2/src/VBox/GuestHost//OpenGL/packer/pack_pixels.c
    old new  
    100100    WRITE_DATA( 32, GLint, packstate->skipRows );
    101101    WRITE_DATA( 36, GLint, packstate->skipPixels );
    102102    WRITE_DATA( 40, GLint, bytes_per_row );
    103103    WRITE_DATA( 44, GLint, packstate->rowLength );
    104104    WRITE_NETWORK_POINTER( 48, (char *) pixels );
    105105    WRITE_OPCODE( pc, CR_READPIXELS_OPCODE );
    106     CR_CMDBLOCK_CHECK_FLUSH(pc);
    107106    CR_UNLOCK_PACKER_CONTEXT(pc);
    108107}
    109108
    110109/* Round N up to the next multiple of 8 */
    111110#define CEIL8(N)  (((N) + 7) & ~0x7)
    112111
     
    217216    WRITE_DATA( 12, GLint, level );
    218217    WRITE_DATA( 16, GLenum, format );
    219218    WRITE_DATA( 20, GLenum, type );
    220219    WRITE_NETWORK_POINTER( 24, (void *) pixels );
    221220    WRITE_NETWORK_POINTER( 32, (void *) writeback );
    222221    WRITE_OPCODE( pc, CR_EXTEND_OPCODE );
    223     CR_CMDBLOCK_CHECK_FLUSH(pc);
    224222    CR_UNLOCK_PACKER_CONTEXT(pc);
    225223}
  • VirtualBox-5.0.0_BETA2/src/VBox/GuestHost//OpenGL/packer/pack_program.c

    diff -uNr -U 6 vbox-orig/VirtualBox-5.0.0_BETA2/src/VBox/GuestHost//OpenGL/packer/pack_program.c /home/alexey/VirtualBox-5.0.0_BETA2/src/VBox/GuestHost//OpenGL/packer/pack_program.c
    old new  
    278278    WRITE_DATA(4, GLenum, CR_AREPROGRAMSRESIDENTNV_EXTEND_OPCODE);
    279279    WRITE_DATA(8, GLsizei, n);
    280280    crMemcpy(data_ptr + 12, programs, n * sizeof(*programs));
    281281    WRITE_NETWORK_POINTER(12 + n * sizeof(*programs),   (void *) residences);
    282282    WRITE_NETWORK_POINTER(20 + n * sizeof(*programs), (void *) writeback);
    283283    WRITE_OPCODE(pc, CR_EXTEND_OPCODE);
    284     CR_CMDBLOCK_CHECK_FLUSH(pc);
    285284    CR_UNLOCK_PACKER_CONTEXT(pc);
    286285}
    287286
    288287
    289288void PACK_APIENTRY crPackGetProgramNamedParameterfvNV( GLuint id, GLsizei len, const GLubyte *name, GLfloat *params, int *writeback )
    290289{
     
    297296    WRITE_DATA( 8, GLuint, id );
    298297    WRITE_DATA( 12, GLsizei, len );
    299298    crMemcpy(data_ptr + 16, name, len);
    300299    WRITE_NETWORK_POINTER( 16 + len, (void *) params );
    301300    WRITE_NETWORK_POINTER( 16 + len + 8, (void *) writeback );
    302301    WRITE_OPCODE( pc, CR_EXTEND_OPCODE );
    303     CR_CMDBLOCK_CHECK_FLUSH(pc);
    304302    CR_UNLOCK_PACKER_CONTEXT(pc);
    305303}
    306304
    307305void PACK_APIENTRY crPackGetProgramNamedParameterdvNV( GLuint id, GLsizei len, const GLubyte *name, GLdouble *params, int *writeback )
    308306{
    309307    int packet_length = 32 + len;
     
    315313    WRITE_DATA( 8, GLuint, id );
    316314    WRITE_DATA( 12, GLsizei, len );
    317315    crMemcpy(data_ptr + 16, name, len);
    318316    WRITE_NETWORK_POINTER( 16 + len, (void *) params );
    319317    WRITE_NETWORK_POINTER( 16 + len + 8, (void *) writeback );
    320318    WRITE_OPCODE( pc, CR_EXTEND_OPCODE );
    321     CR_CMDBLOCK_CHECK_FLUSH(pc);
    322319    CR_UNLOCK_PACKER_CONTEXT(pc);
    323320}
    324321
    325322
    326323void PACK_APIENTRY crPackDeleteProgramsARB( GLsizei n, const GLuint *ids )
    327324{
  • VirtualBox-5.0.0_BETA2/src/VBox/GuestHost//OpenGL/packer/pack_shaders.c

    diff -uNr -U 6 vbox-orig/VirtualBox-5.0.0_BETA2/src/VBox/GuestHost//OpenGL/packer/pack_shaders.c /home/alexey/VirtualBox-5.0.0_BETA2/src/VBox/GuestHost//OpenGL/packer/pack_shaders.c
    old new  
    425425    WRITE_DATA(8, GLuint, program);
    426426    WRITE_DATA(12, GLuint, index);
    427427    WRITE_DATA(16, GLsizei, bufSize);
    428428    WRITE_NETWORK_POINTER(20, (void *) length);
    429429    WRITE_NETWORK_POINTER(28, (void *) writeback);
    430430    WRITE_OPCODE(pc, CR_EXTEND_OPCODE);
    431     CR_CMDBLOCK_CHECK_FLUSH(pc);
    432431    CR_UNLOCK_PACKER_CONTEXT(pc);
    433432}
    434433
    435434void PACK_APIENTRY crPackGetActiveUniform(GLuint program, GLuint index, GLsizei bufSize, GLsizei * length, GLint * size, GLenum * type, char * name, int * writeback)
    436435{
    437436    CR_GET_PACKER_CONTEXT(pc);
     
    446445    WRITE_DATA(8, GLuint, program);
    447446    WRITE_DATA(12, GLuint, index);
    448447    WRITE_DATA(16, GLsizei, bufSize);
    449448    WRITE_NETWORK_POINTER(20, (void *) length);
    450449    WRITE_NETWORK_POINTER(28, (void *) writeback);
    451450    WRITE_OPCODE(pc, CR_EXTEND_OPCODE);
    452     CR_CMDBLOCK_CHECK_FLUSH(pc);
    453451    CR_UNLOCK_PACKER_CONTEXT(pc);
    454452}
    455453
    456454void PACK_APIENTRY crPackGetAttachedShaders(GLuint program, GLsizei maxCount, GLsizei * count, GLuint * shaders, int * writeback)
    457455{
    458456    CR_GET_PACKER_CONTEXT(pc);
     
    464462    WRITE_DATA(4, GLenum, CR_GETATTACHEDSHADERS_EXTEND_OPCODE);
    465463    WRITE_DATA(8, GLuint, program);
    466464    WRITE_DATA(12, GLsizei, maxCount);
    467465    WRITE_NETWORK_POINTER(16, (void *) count);
    468466    WRITE_NETWORK_POINTER(24, (void *) writeback);
    469467    WRITE_OPCODE(pc, CR_EXTEND_OPCODE);
    470     CR_CMDBLOCK_CHECK_FLUSH(pc);
    471468    CR_UNLOCK_PACKER_CONTEXT(pc);
    472469}
    473470
    474471void PACK_APIENTRY crPackGetAttachedObjectsARB(VBoxGLhandleARB containerObj, GLsizei maxCount, GLsizei * count, VBoxGLhandleARB * obj, int * writeback)
    475472{
    476473        CR_GET_PACKER_CONTEXT(pc);
     
    481478        WRITE_DATA(4, GLenum, CR_GETATTACHEDOBJECTSARB_EXTEND_OPCODE);
    482479        WRITE_DATA(8, VBoxGLhandleARB, containerObj);
    483480        WRITE_DATA(12, GLsizei, maxCount);
    484481        WRITE_NETWORK_POINTER(16, (void *) count);
    485482        WRITE_NETWORK_POINTER(24, (void *) writeback);
    486483        WRITE_OPCODE(pc, CR_EXTEND_OPCODE);
    487         CR_CMDBLOCK_CHECK_FLUSH(pc);
    488484    CR_UNLOCK_PACKER_CONTEXT(pc);
    489485}
    490486
    491487void PACK_APIENTRY crPackGetInfoLogARB(VBoxGLhandleARB obj, GLsizei maxLength, GLsizei * length, GLcharARB * infoLog, int * writeback)
    492488{
    493489        CR_GET_PACKER_CONTEXT(pc);
     
    498494        WRITE_DATA(4, GLenum, CR_GETINFOLOGARB_EXTEND_OPCODE);
    499495        WRITE_DATA(8, VBoxGLhandleARB, obj);
    500496        WRITE_DATA(12, GLsizei, maxLength);
    501497        WRITE_NETWORK_POINTER(16, (void *) length);
    502498        WRITE_NETWORK_POINTER(24, (void *) writeback);
    503499        WRITE_OPCODE(pc, CR_EXTEND_OPCODE);
    504         CR_CMDBLOCK_CHECK_FLUSH(pc);
    505500    CR_UNLOCK_PACKER_CONTEXT(pc);
    506501}
    507502
    508503void PACK_APIENTRY crPackGetProgramInfoLog(GLuint program, GLsizei bufSize, GLsizei * length, char * infoLog, int * writeback)
    509504{
    510505    CR_GET_PACKER_CONTEXT(pc);
     
    516511    WRITE_DATA(4, GLenum, CR_GETPROGRAMINFOLOG_EXTEND_OPCODE);
    517512    WRITE_DATA(8, GLuint, program);
    518513    WRITE_DATA(12, GLsizei, bufSize);
    519514    WRITE_NETWORK_POINTER(16, (void *) length);
    520515    WRITE_NETWORK_POINTER(24, (void *) writeback);
    521516    WRITE_OPCODE(pc, CR_EXTEND_OPCODE);
    522     CR_CMDBLOCK_CHECK_FLUSH(pc);
    523517    CR_UNLOCK_PACKER_CONTEXT(pc);
    524518}
    525519
    526520void PACK_APIENTRY crPackGetShaderInfoLog(GLuint shader, GLsizei bufSize, GLsizei * length, char * infoLog, int * writeback)
    527521{
    528522    CR_GET_PACKER_CONTEXT(pc);
     
    534528    WRITE_DATA(4, GLenum, CR_GETSHADERINFOLOG_EXTEND_OPCODE);
    535529    WRITE_DATA(8, GLuint, shader);
    536530    WRITE_DATA(12, GLsizei, bufSize);
    537531    WRITE_NETWORK_POINTER(16, (void *) length);
    538532    WRITE_NETWORK_POINTER(24, (void *) writeback);
    539533    WRITE_OPCODE(pc, CR_EXTEND_OPCODE);
    540     CR_CMDBLOCK_CHECK_FLUSH(pc);
    541534    CR_UNLOCK_PACKER_CONTEXT(pc);
    542535}
    543536
    544537void PACK_APIENTRY crPackGetShaderSource(GLuint shader, GLsizei bufSize, GLsizei * length, char * source, int * writeback)
    545538{
    546539    CR_GET_PACKER_CONTEXT(pc);
     
    552545    WRITE_DATA(4, GLenum, CR_GETSHADERSOURCE_EXTEND_OPCODE);
    553546    WRITE_DATA(8, GLuint, shader);
    554547    WRITE_DATA(12, GLsizei, bufSize);
    555548    WRITE_NETWORK_POINTER(16, (void *) length);
    556549    WRITE_NETWORK_POINTER(24, (void *) writeback);
    557550    WRITE_OPCODE(pc, CR_EXTEND_OPCODE);
    558     CR_CMDBLOCK_CHECK_FLUSH(pc);
    559551    CR_UNLOCK_PACKER_CONTEXT(pc);
    560552}
    561553
    562554void PACK_APIENTRY crPackGetUniformsLocations(GLuint program, GLsizei maxcbData, GLsizei * cbData, GLvoid * pData, int * writeback)
    563555{
    564556        CR_GET_PACKER_CONTEXT(pc);
     
    569561    WRITE_DATA(4, GLenum, CR_GETUNIFORMSLOCATIONS_EXTEND_OPCODE);
    570562    WRITE_DATA(8, GLuint, program);
    571563    WRITE_DATA(12, GLsizei, maxcbData);
    572564    WRITE_NETWORK_POINTER(16, (void *) cbData);
    573565    WRITE_NETWORK_POINTER(24, (void *) writeback);
    574566    WRITE_OPCODE(pc, CR_EXTEND_OPCODE);
    575     CR_CMDBLOCK_CHECK_FLUSH(pc);
    576567    CR_UNLOCK_PACKER_CONTEXT(pc);
    577568}
    578569
    579570void PACK_APIENTRY crPackGetAttribsLocations(GLuint program, GLsizei maxcbData, GLsizei * cbData, GLvoid * pData, int * writeback)
    580571{
    581572    CR_GET_PACKER_CONTEXT(pc);
     
    586577    WRITE_DATA(4, GLenum, CR_GETATTRIBSLOCATIONS_EXTEND_OPCODE);
    587578    WRITE_DATA(8, GLuint, program);
    588579    WRITE_DATA(12, GLsizei, maxcbData);
    589580    WRITE_NETWORK_POINTER(16, (void *) cbData);
    590581    WRITE_NETWORK_POINTER(24, (void *) writeback);
    591582    WRITE_OPCODE(pc, CR_EXTEND_OPCODE);
    592     CR_CMDBLOCK_CHECK_FLUSH(pc);
    593583    CR_UNLOCK_PACKER_CONTEXT(pc);
    594584}
    595585
    596586void PACK_APIENTRY crPackGetAttribLocation(GLuint program, const char * name, GLint * return_value, int * writeback)
    597587{
    598588    CR_GET_PACKER_CONTEXT(pc);
     
    606596    WRITE_DATA_AI(GLuint, program);
    607597    crMemcpy(data_ptr, name, cbName*sizeof(*name));
    608598    data_ptr +=  cbName*sizeof(*name);
    609599    WRITE_NETWORK_POINTER(0, (void *) return_value);
    610600    WRITE_NETWORK_POINTER(8, (void *) writeback);
    611601    WRITE_OPCODE(pc, CR_EXTEND_OPCODE);
    612     CR_CMDBLOCK_CHECK_FLUSH(pc);
    613602    CR_UNLOCK_PACKER_CONTEXT(pc);
    614603}
    615604
    616605void PACK_APIENTRY crPackGetUniformLocation(GLuint program, const char * name, GLint * return_value, int * writeback)
    617606{
    618607    CR_GET_PACKER_CONTEXT(pc);
     
    626615    WRITE_DATA_AI(GLuint, program);
    627616    crMemcpy(data_ptr, name, cbName*sizeof(*name));
    628617    data_ptr +=  cbName*sizeof(*name);
    629618    WRITE_NETWORK_POINTER(0, (void *) return_value);
    630619    WRITE_NETWORK_POINTER(8, (void *) writeback);
    631620    WRITE_OPCODE(pc, CR_EXTEND_OPCODE);
    632     CR_CMDBLOCK_CHECK_FLUSH(pc);
    633621    CR_UNLOCK_PACKER_CONTEXT(pc);
    634622}
    635623
    636624void PACK_APIENTRY crPackBindAttribLocationSWAP(GLuint program, GLuint index, const char *name)
    637625{
    638626    CR_GET_PACKER_CONTEXT(pc);
  • VirtualBox-5.0.0_BETA2/src/VBox/GuestHost//OpenGL/packer/pack_swap_texture.c

    diff -uNr -U 6 vbox-orig/VirtualBox-5.0.0_BETA2/src/VBox/GuestHost//OpenGL/packer/pack_swap_texture.c /home/alexey/VirtualBox-5.0.0_BETA2/src/VBox/GuestHost//OpenGL/packer/pack_swap_texture.c
    old new  
    681681        WRITE_DATA( (i+1)*sizeof( int ) + 8, GLuint, SWAP32(textures[i]) );
    682682    }
    683683    WRITE_NETWORK_POINTER( sizeof( int ) + 8 + n*sizeof( *textures ), (void *) residences );
    684684    WRITE_NETWORK_POINTER( sizeof( int ) + 16 + n*sizeof( *textures ), (void *) return_val );
    685685    WRITE_NETWORK_POINTER( sizeof( int ) + 24 + n*sizeof( *textures ), (void *) writeback );
    686686    WRITE_OPCODE( pc, CR_EXTEND_OPCODE );
    687     CR_CMDBLOCK_CHECK_FLUSH(pc);
    688687    CR_UNLOCK_PACKER_CONTEXT(pc);
    689688}
    690689
    691690
    692691/**********************************************************************
    693692 * Texture compression
  • VirtualBox-5.0.0_BETA2/src/VBox/GuestHost//OpenGL/packer/pack_texture.c

    diff -uNr -U 6 vbox-orig/VirtualBox-5.0.0_BETA2/src/VBox/GuestHost//OpenGL/packer/pack_texture.c /home/alexey/VirtualBox-5.0.0_BETA2/src/VBox/GuestHost//OpenGL/packer/pack_texture.c
    old new  
    715715    WRITE_DATA(4, GLenum, CR_ARETEXTURESRESIDENT_EXTEND_OPCODE);
    716716    WRITE_DATA(8, GLsizei, n);
    717717    crMemcpy(data_ptr + 12, textures, n * sizeof(*textures));
    718718    WRITE_NETWORK_POINTER(12 + n * sizeof(*textures),   (void *) residences);
    719719    WRITE_NETWORK_POINTER(20 + n * sizeof(*textures), (void *) writeback);
    720720    WRITE_OPCODE(pc, CR_EXTEND_OPCODE);
    721     CR_CMDBLOCK_CHECK_FLUSH(pc);
    722721    CR_UNLOCK_PACKER_CONTEXT(pc);
    723722}
    724723
    725724
    726725/**********************************************************************
    727726 * Texture compression
  • VirtualBox-5.0.0_BETA2/src/VBox/GuestHost//OpenGL/spu_loader/spuload.c

    diff -uNr -U 6 vbox-orig/VirtualBox-5.0.0_BETA2/src/VBox/GuestHost//OpenGL/spu_loader/spuload.c /home/alexey/VirtualBox-5.0.0_BETA2/src/VBox/GuestHost//OpenGL/spu_loader/spuload.c
    old new  
    9292         * crSPUUnloadChain in the failure branches below will misbehave */
    9393        crMemset(the_spu, 0, sizeof (*the_spu));
    9494        the_spu->id = id;
    9595        the_spu->privatePtr = NULL;
    9696        path = __findDLL( name, dir );
    9797        the_spu->dll = crDLLOpen( path, 0/*resolveGlobal*/ );
    98 #if defined(DEBUG_misha) && defined(RT_OS_WINDOWS)
    99         crDbgCmdSymLoadPrint(path, the_spu->dll->hinstLib);
    100 #endif
    10198        the_spu->entry_point =
    10299                (SPULoadFunction) crDLLGetNoError( the_spu->dll, SPU_ENTRY_POINT_NAME );
    103100        if (!the_spu->entry_point)
    104101        {
    105102                crError( "Couldn't load the SPU entry point \"%s\" from SPU \"%s\"!",
    106103                                SPU_ENTRY_POINT_NAME, name );
  • VirtualBox-5.0.0_BETA2/src/VBox/GuestHost//OpenGL/state_tracker/state_diff.c

    Binary files vbox-orig/VirtualBox-5.0.0_BETA2/src/VBox/GuestHost//OpenGL/state_tracker/convert.pyc and /home/alexey/VirtualBox-5.0.0_BETA2/src/VBox/GuestHost//OpenGL/state_tracker/convert.pyc differ
    Binary files vbox-orig/VirtualBox-5.0.0_BETA2/src/VBox/GuestHost//OpenGL/state_tracker/get_components.pyc and /home/alexey/VirtualBox-5.0.0_BETA2/src/VBox/GuestHost//OpenGL/state_tracker/get_components.pyc differ
    diff -uNr -U 6 vbox-orig/VirtualBox-5.0.0_BETA2/src/VBox/GuestHost//OpenGL/state_tracker/state_diff.c /home/alexey/VirtualBox-5.0.0_BETA2/src/VBox/GuestHost//OpenGL/state_tracker/state_diff.c
    old new  
    584584    {
    585585        if (ctx->error != GL_NO_ERROR)
    586586            ctx->error = err;
    587587    }
    588588}
    589589
    590 GLenum crStateCleanHWErrorState()
    591 {
    592     GLenum err;
    593     while ((err = diff_api.GetError()) != GL_NO_ERROR)
    594     {
    595         static int cErrPrints = 0;
    596 #ifndef DEBUG_misha
    597         if (cErrPrints < 5)
    598 #endif
    599         {
    600             ++cErrPrints;
    601             WARN(("cleaning gl error (0x%x), ignoring.. (%d out of 5) ..", err, cErrPrints));
    602         }
    603     }
    604 
    605     return err;
    606 }
    607 
    608 
    609590void crStateSwitchPrepare(CRContext *toCtx, CRContext *fromCtx, GLuint idDrawFBO, GLuint idReadFBO)
    610591{
    611592    if (!fromCtx)
    612593        return;
    613594
    614595    if (g_bVBoxEnableDiffOnMakeCurrent && toCtx && toCtx != fromCtx)
     
    621602
    622603void crStateSwitchPostprocess(CRContext *toCtx, CRContext *fromCtx, GLuint idDrawFBO, GLuint idReadFBO)
    623604{
    624605    if (!toCtx)
    625606        return;
    626607
    627 #ifdef CR_EXT_framebuffer_object
    628     crStateFramebufferObjectReenableHW(fromCtx, toCtx, idDrawFBO, idReadFBO);
    629 #endif
    630 
    631608    if (g_bVBoxEnableDiffOnMakeCurrent && fromCtx && toCtx != fromCtx)
    632609    {
    633         CR_STATE_CLEAN_HW_ERR_WARN("error on make current");
     610        GLenum err;
     611        while ((err = diff_api.GetError()) != GL_NO_ERROR)
     612        {
     613            static int cErrPrints = 0;
     614#ifndef DEBUG_misha
     615            if (cErrPrints < 5)
     616#endif
     617            {
     618                ++cErrPrints;
     619                crWarning("gl error (0x%x) after context switch, ignoring.. (%d out of 5) ..", err, cErrPrints);
     620            }
     621        }
    634622    }
     623#ifdef CR_EXT_framebuffer_object
     624    crStateFramebufferObjectReenableHW(fromCtx, toCtx, idDrawFBO, idReadFBO);
     625#endif
    635626}
  • VirtualBox-5.0.0_BETA2/src/VBox/GuestHost//OpenGL/state_tracker/state_framebuffer.c

    diff -uNr -U 6 vbox-orig/VirtualBox-5.0.0_BETA2/src/VBox/GuestHost//OpenGL/state_tracker/state_framebuffer.c /home/alexey/VirtualBox-5.0.0_BETA2/src/VBox/GuestHost//OpenGL/state_tracker/state_framebuffer.c
    old new  
    10931093
    10941094
    10951095DECLEXPORT(GLuint) STATE_APIENTRY crStateGetFramebufferHWID(GLuint id)
    10961096{
    10971097    CRContext *g = GetCurrentContext();
    10981098    CRFramebufferObject *pFBO = (CRFramebufferObject*) crHashtableSearch(g->shared->fbTable, id);
    1099 #if 0 //def DEBUG_misha
     1099#ifdef DEBUG_misha
    11001100    crDebug("FB id(%d) hw(%d)", id, pFBO ? pFBO->hwid : 0);
    11011101#endif
    11021102    return pFBO ? pFBO->hwid : 0;
    11031103}
    11041104
    11051105DECLEXPORT(GLuint) STATE_APIENTRY crStateGetRenderbufferHWID(GLuint id)
  • VirtualBox-5.0.0_BETA2/src/VBox/GuestHost//OpenGL/state_tracker/state.h

    diff -uNr -U 6 vbox-orig/VirtualBox-5.0.0_BETA2/src/VBox/GuestHost//OpenGL/state_tracker/state.h /home/alexey/VirtualBox-5.0.0_BETA2/src/VBox/GuestHost//OpenGL/state_tracker/state.h
    old new  
    7373void crStateFreeBufferObject(void *data);
    7474void crStateFreeFBO(void *data);
    7575void crStateFreeRBO(void *data);
    7676
    7777void crStateGenNames(CRContext *g, CRHashTable *table, GLsizei n, GLuint *names);
    7878void crStateRegNames(CRContext *g, CRHashTable *table, GLsizei n, GLuint *names);
    79 void crStateOnTextureUsageRelease(CRSharedState *pS, CRTextureObj *pObj);
    8079#endif
  • VirtualBox-5.0.0_BETA2/src/VBox/GuestHost//OpenGL/state_tracker/state_init.c

    diff -uNr -U 6 vbox-orig/VirtualBox-5.0.0_BETA2/src/VBox/GuestHost//OpenGL/state_tracker/state_init.c /home/alexey/VirtualBox-5.0.0_BETA2/src/VBox/GuestHost//OpenGL/state_tracker/state_init.c
    old new  
    4646        s->refCount = 1; /* refcount is number of contexts using this state */
    4747        s->saveCount = 0;
    4848    }
    4949    return s;
    5050}
    5151
     52
     53
    5254/**
    5355 * Callback used for crFreeHashtable().
    5456 */
    5557DECLEXPORT(void)
    5658crStateDeleteTextureCallback(void *texObj)
    5759{
     
    6466typedef struct CR_STATE_RELEASEOBJ
    6567{
    6668    CRContext *pCtx;
    6769    CRSharedState *s;
    6870} CR_STATE_RELEASEOBJ, *PCR_STATE_RELEASEOBJ;
    6971
    70 void crStateOnTextureUsageRelease(CRSharedState *pS, CRTextureObj *pObj)
    71 {
    72     if (!pObj->pinned)
    73         crHashtableDelete(pS->textureTable, pObj->id, crStateDeleteTextureCallback);
    74     else
    75         Assert(crHashtableSearch(pS->textureTable, pObj->id));
    76 }
    77 
    78 void crStateReleaseTextureInternal(CRSharedState *pS, CRContext *pCtx, CRTextureObj *pObj)
    79 {
    80     Assert(CR_STATE_SHAREDOBJ_USAGE_IS_USED(pObj) || pObj->pinned);
    81     CR_STATE_SHAREDOBJ_USAGE_CLEAR(pObj, pCtx);
    82     if (CR_STATE_SHAREDOBJ_USAGE_IS_USED(pObj))
    83         return;
    84 
    85     crStateOnTextureUsageRelease(pS, pObj);
    86 }
    87 
    88 DECLEXPORT(void) crStateReleaseTexture(CRContext *pCtx, CRTextureObj *pObj)
    89 {
    90     Assert(CR_STATE_SHAREDOBJ_USAGE_IS_USED(pObj));
    91     CR_STATE_SHAREDOBJ_USAGE_CLEAR(pObj, pCtx);
    92     if (CR_STATE_SHAREDOBJ_USAGE_IS_USED(pObj))
    93         return;
    94 
    95     if (!gSharedState)
    96     {
    97         WARN(("no global shared"));
    98         return;
    99     }
    100 
    101     crStateOnTextureUsageRelease(gSharedState, pObj);
    102 }
    103 
    104 void crStateReleaseBufferObjectInternal(CRSharedState *pS, CRContext *pCtx, CRBufferObject *pObj)
    105 {
    106     Assert(CR_STATE_SHAREDOBJ_USAGE_IS_USED(pObj));
    107     CR_STATE_SHAREDOBJ_USAGE_CLEAR(pObj, pCtx);
    108     if (!CR_STATE_SHAREDOBJ_USAGE_IS_USED(pObj))
    109         crHashtableDelete(pS->buffersTable, pObj->id, crStateFreeBufferObject);
    110 }
    111 
    112 void crStateReleaseFBOInternal(CRSharedState *pS, CRContext *pCtx, CRFramebufferObject *pObj)
    113 {
    114     Assert(CR_STATE_SHAREDOBJ_USAGE_IS_USED(pObj));
    115     CR_STATE_SHAREDOBJ_USAGE_CLEAR(pObj, pCtx);
    116     if (!CR_STATE_SHAREDOBJ_USAGE_IS_USED(pObj))
    117         crHashtableDelete(pS->fbTable, pObj->id, crStateFreeFBO);
    118 }
    119 
    120 void crStateReleaseRBOInternal(CRSharedState *pS, CRContext *pCtx, CRRenderbufferObject *pObj)
    121 {
    122     Assert(CR_STATE_SHAREDOBJ_USAGE_IS_USED(pObj));
    123     CR_STATE_SHAREDOBJ_USAGE_CLEAR(pObj, pCtx);
    124     if (!CR_STATE_SHAREDOBJ_USAGE_IS_USED(pObj))
    125         crHashtableDelete(pS->rbTable, pObj->id, crStateFreeRBO);
    126 }
    127 
    12872static void ReleaseTextureCallback(unsigned long key, void *data1, void *data2)
    12973{
    13074    PCR_STATE_RELEASEOBJ pData = (PCR_STATE_RELEASEOBJ)data2;
    13175    CRTextureObj *pObj = (CRTextureObj *)data1;
    132     crStateReleaseTextureInternal(pData->s, pData->pCtx, pObj);
     76    CR_STATE_SHAREDOBJ_USAGE_CLEAR(pObj, pData->pCtx);
     77    if (!CR_STATE_SHAREDOBJ_USAGE_IS_USED(pObj))
     78        crHashtableDelete(pData->s->textureTable, key, crStateDeleteTextureCallback);
    13379}
    13480
    13581static void ReleaseBufferObjectCallback(unsigned long key, void *data1, void *data2)
    13682{
    13783    PCR_STATE_RELEASEOBJ pData = (PCR_STATE_RELEASEOBJ)data2;
    13884    CRBufferObject *pObj = (CRBufferObject *)data1;
    139     crStateReleaseBufferObjectInternal(pData->s, pData->pCtx, pObj);
     85    CR_STATE_SHAREDOBJ_USAGE_CLEAR(pObj, pData->pCtx);
     86    if (!CR_STATE_SHAREDOBJ_USAGE_IS_USED(pObj))
     87        crHashtableDelete(pData->s->buffersTable, key, crStateFreeBufferObject);
    14088}
    14189
    14290static void ReleaseFBOCallback(unsigned long key, void *data1, void *data2)
    14391{
    14492    PCR_STATE_RELEASEOBJ pData = (PCR_STATE_RELEASEOBJ)data2;
    14593    CRFramebufferObject *pObj = (CRFramebufferObject *)data1;
    146     crStateReleaseFBOInternal(pData->s, pData->pCtx, pObj);
     94    CR_STATE_SHAREDOBJ_USAGE_CLEAR(pObj, pData->pCtx);
     95    if (!CR_STATE_SHAREDOBJ_USAGE_IS_USED(pObj))
     96        crHashtableDelete(pData->s->fbTable, key, crStateFreeFBO);
    14797}
    14898
    14999static void ReleaseRBOCallback(unsigned long key, void *data1, void *data2)
    150100{
    151101    PCR_STATE_RELEASEOBJ pData = (PCR_STATE_RELEASEOBJ)data2;
    152102    CRRenderbufferObject *pObj = (CRRenderbufferObject *)data1;
    153     crStateReleaseRBOInternal(pData->s, pData->pCtx, pObj);
     103    CR_STATE_SHAREDOBJ_USAGE_CLEAR(pObj, pData->pCtx);
     104    if (!CR_STATE_SHAREDOBJ_USAGE_IS_USED(pObj))
     105        crHashtableDelete(pData->s->rbTable, key, crStateFreeRBO);
    154106}
    155107
    156108/**
    157109 * Decrement shared state's refcount and delete when it hits zero.
    158110 */
    159111DECLEXPORT(void)
  • VirtualBox-5.0.0_BETA2/src/VBox/GuestHost//OpenGL/state_tracker/state_lists.c

    diff -uNr -U 6 vbox-orig/VirtualBox-5.0.0_BETA2/src/VBox/GuestHost//OpenGL/state_tracker/state_lists.c /home/alexey/VirtualBox-5.0.0_BETA2/src/VBox/GuestHost//OpenGL/state_tracker/state_lists.c
    old new  
    171171void STATE_APIENTRY crStateQueryHWState(GLuint fbFbo, GLuint bbFbo)
    172172{
    173173    CRContext *g = GetCurrentContext();
    174174    CRStateBits *sb = GetCurrentBits();
    175175    CRbitvalue *bitID=g->bitid, *negbitID=g->neg_bitid;
    176176
    177     CRASSERT(g_bVBoxEnableDiffOnMakeCurrent);
    178 
    179     crStateSyncHWErrorState(g);
    180 
    181177    if (CHECKDIRTY(sb->buffer.dirty, negbitID))
    182178    {
    183179        if (CHECKDIRTY(sb->buffer.enable, negbitID))
    184180        {
    185181            CRSTATE_SET_ENABLED(buffer.depthTest, GL_DEPTH_TEST);
    186182            CRSTATE_SET_ENABLED(buffer.blend, GL_BLEND);
     
    12021198                }
    12031199#endif
    12041200                crMemcpy(&g->polygon.stipple[0], &stipple[0], sizeof(stipple));
    12051201            }
    12061202        }
    12071203    }
    1208 
    1209     CR_STATE_CLEAN_HW_ERR_WARN("error on hw sync");
    12101204}
    12111205
    12121206void STATE_APIENTRY crStateNewList (GLuint list, GLenum mode)
    12131207{
    12141208    CRContext *g = GetCurrentContext();
    12151209    CRListsState *l = &(g->lists);
  • VirtualBox-5.0.0_BETA2/src/VBox/GuestHost//OpenGL/state_tracker/state_texture.c

    diff -uNr -U 6 vbox-orig/VirtualBox-5.0.0_BETA2/src/VBox/GuestHost//OpenGL/state_tracker/state_texture.c /home/alexey/VirtualBox-5.0.0_BETA2/src/VBox/GuestHost//OpenGL/state_tracker/state_texture.c
    old new  
    750750
    751751#ifdef CR_EXT_framebuffer_object
    752752        crStateTextureCheckFBOAPs(GL_DRAW_FRAMEBUFFER, tObj->id);
    753753        crStateTextureCheckFBOAPs(GL_READ_FRAMEBUFFER, tObj->id);
    754754#endif
    755755    }
     756
     757    CR_STATE_SHAREDOBJ_USAGE_CLEAR(tObj, g);
    756758}
    757759
    758760void STATE_APIENTRY crStateDeleteTextures(GLsizei n, const GLuint *textures)
    759761{
    760762    CRContext *g = GetCurrentContext();
    761763    CRTextureState *t = &(g->texture);
     
    790792        if (tObj)
    791793        {
    792794            GLuint j;
    793795
    794796            crStateCleanupTextureRefs(g, tObj);
    795797
    796             CR_STATE_SHAREDOBJ_USAGE_CLEAR(tObj, g);
    797 
    798798            CR_STATE_SHAREDOBJ_USAGE_FOREACH_USED_IDX(tObj, j)
    799799            {
    800800                /* saved state version <= SHCROGL_SSM_VERSION_BEFORE_CTXUSAGE_BITS does not have usage bits info,
    801801                 * so on restore, we set mark bits as used.
    802802                 * This is why g_pAvailableContexts[j] could be NULL
    803803                 * also g_pAvailableContexts[0] will hold default context, which we should discard */
    804804                CRContext *ctx = g_pAvailableContexts[j];
    805805                if (j && ctx)
    806                 {
    807806                    crStateCleanupTextureRefs(ctx, tObj);
    808                     CR_STATE_SHAREDOBJ_USAGE_CLEAR(tObj, g);
    809                 }
    810807                else
    811808                    CR_STATE_SHAREDOBJ_USAGE_CLEAR_IDX(tObj, j);
    812809            }
    813810
    814811            /* on the host side, ogl texture object is deleted by a separate cr_server.head_spu->dispatch_table.DeleteTextures(n, newTextures);
    815812             * in crServerDispatchDeleteTextures, we just delete a state object here, which crStateDeleteTextureObject does */
     
    893890    /* update the current matrix pointer, etc. */
    894891    if (g->transform.matrixMode == GL_TEXTURE) {
    895892        crStateMatrixMode(GL_TEXTURE);
    896893    }
    897894}
    898895
    899 #ifndef IN_GUEST
    900 # ifdef DEBUG
    901 static uint32_t gDbgNumPinned = 0;
    902 # endif
    903 
    904 DECLEXPORT(void) crStatePinTexture(GLuint texture, GLboolean pin)
    905 {
    906     CRTextureObj * pTobj;
    907     CRSharedState *pShared = crStateGlobalSharedAcquire();
    908     if (pShared)
    909     {
    910         pTobj = (CRTextureObj*)crHashtableSearch(pShared->textureTable, texture);
    911 
    912         if (pTobj)
    913         {
    914 # ifdef DEBUG
    915             if (!pTobj->pinned != !pin)
    916             {
    917                 if (pin)
    918                     ++gDbgNumPinned;
    919                 else
    920                 {
    921                     Assert(gDbgNumPinned);
    922                     --gDbgNumPinned;
    923                 }
    924             }
    925 # endif
    926             pTobj->pinned = !!pin;
    927             if (!pin)
    928             {
    929                 if (!CR_STATE_SHAREDOBJ_USAGE_IS_USED(pTobj))
    930                     crStateOnTextureUsageRelease(pShared, pTobj);
    931             }
    932         }
    933         else
    934             WARN(("texture %d not defined", texture));
    935 
    936         crStateGlobalSharedRelease();
    937     }
    938     else
    939         WARN(("no global shared"));
    940 }
    941 #endif
    942 
    943896DECLEXPORT(void) crStateSetTextureUsed(GLuint texture, GLboolean used)
    944897{
    945898    CRContext *g = GetCurrentContext();
    946899    CRTextureObj *tobj;
    947900
    948901    if (!texture)
     
    959912        {
    960913            tobj = crStateTextureAllocate_t(g, texture);
    961914        }
    962915        else
    963916#endif
    964917        {
    965             WARN(("crStateSetTextureUsed: failed to fined a HW name for texture(%d)!", texture));
     918            crWarning("crStateSetTextureUsed: failed to fined a HW name for texture(%d)!", texture);
    966919            return;
    967920        }
    968921    }
    969922
    970923    if (used)
    971924        CR_STATE_SHAREDOBJ_USAGE_SET(tobj, g);
     
    974927        CRStateBits *sb = GetCurrentBits();
    975928        CRTextureBits *tb = &(sb->texture);
    976929        CRTextureState *t = &(g->texture);
    977930
    978931        crStateCleanupTextureRefs(g, tobj);
    979932
    980         crStateReleaseTexture(g, tobj);
     933        if (!CR_STATE_SHAREDOBJ_USAGE_IS_USED(tobj))
     934        {
     935            /* on the host side, we need to delete an ogl texture object here as well, which crStateDeleteTextureCallback will do
     936             * in addition to calling crStateDeleteTextureObject to delete a state object */
     937            crHashtableDelete(g->shared->textureTable, texture, crStateDeleteTextureCallback);
     938        }
    981939
    982940        DIRTY(tb->dirty, g->neg_bitid);
    983941        DIRTY(tb->current[t->curTextureUnit], g->neg_bitid);
    984942    }
    985943}
    986944
     
    33863344    else
    33873345    {
    33883346        Assert(!tobj);
    33893347    }
    33903348    if (tobj)
    33913349    {
    3392 //        crDebug("tex id(%d), hwid(%d)", tobj->id, tobj->hwid);
     3350        crDebug("tex id(%d), hwid(%d)", tobj->id, tobj->hwid);
    33933351    }
    33943352#endif
    33953353
    33963354
    33973355    return tobj ? crStateGetTextureObjHWID(tobj) : 0;
    33983356}
     
    34033361
    34043362#ifndef IN_GUEST
    34053363    if (tobj->id && !tobj->hwid)
    34063364    {
    34073365        CRASSERT(diff_api.GenTextures);
    34083366        diff_api.GenTextures(1, &tobj->hwid);
    3409 #if 0 //def DEBUG_misha
     3367#ifdef DEBUG_misha
    34103368        crDebug("tex id(%d), hwid(%d)", tobj->id, tobj->hwid);
    34113369#endif
    34123370        CRASSERT(tobj->hwid);
    34133371    }
    34143372#endif
    34153373
  • VirtualBox-5.0.0_BETA2/src/VBox/GuestHost//OpenGL/util/error.c

    diff -uNr -U 6 vbox-orig/VirtualBox-5.0.0_BETA2/src/VBox/GuestHost//OpenGL/util/error.c /home/alexey/VirtualBox-5.0.0_BETA2/src/VBox/GuestHost//OpenGL/util/error.c
    old new  
    174174#if !defined(IN_GUEST) || defined(CR_DEBUG_BACKDOOR_ENABLE)
    175175#include <VBox/log.h>
    176176#endif
    177177
    178178#if defined(WINDOWS)
    179179# define CR_DEBUG_CONSOLE_ENABLE
    180 
    181 # include "Shlwapi.h"
    182180#endif
    183181
    184182#if defined(WINDOWS) && defined(IN_GUEST)
    185183# ifndef CR_DEBUG_BACKDOOR_ENABLE
    186184#  error "CR_DEBUG_BACKDOOR_ENABLE is expected!"
    187185# endif
     
    458456{
    459457    VBoxDispMpLoggerLog(pcszStr);
    460458}
    461459#endif
    462460
    463461
    464 #if defined(WINDOWS) /* && (!defined(DEBUG_misha) || !defined(IN_GUEST) ) */
     462#if defined(DEBUG) && defined(WINDOWS) /* && (!defined(DEBUG_misha) || !defined(IN_GUEST) ) */
    465463# define CR_DEBUG_DBGPRINT_ENABLE
    466464#endif
    467465
    468466#ifdef CR_DEBUG_DBGPRINT_ENABLE
    469467static void crDebugDbgPrint(const char *str)
    470468{
    471469    OutputDebugString(str);
    472470    OutputDebugString("\n");
    473471}
    474 
    475 static void crDebugDbgPrintF(const char * szString, ...)
    476 {
    477     char szBuffer[4096] = {0};
    478     va_list pArgList;
    479     va_start(pArgList, szString);
    480     vsprintf( szBuffer, szString, pArgList );
    481     va_end(pArgList);
    482 
    483     OutputDebugStringA(szBuffer);
    484 }
    485 
    486 static void crDebugDmlPrint(const char* pszDesc, const char* pszCmd)
    487 {
    488     crDebugDbgPrintF("<?dml?><exec cmd=\"%s\">%s</exec>, ( %s )\n", pszCmd, pszDesc, pszCmd);
    489 }
    490 
    491 
    492 DECLEXPORT(void) crDbgCmdPrint(const char *description1, const char *description2, const char *cmd, ...)
    493 {
    494     va_list args;
    495     char aTxt[8092];
    496     char aCmd[8092];
    497 
    498     sprintf( aTxt, "%s%s", description1, description2 );
    499 
    500     va_start( args, cmd );
    501 
    502     vsprintf( aCmd, cmd, args );
    503 
    504     va_end( args );
    505 
    506     crDebugDmlPrint(aTxt, aCmd);
    507 
    508     crDebug("%s: %s", aTxt, aCmd);
    509 }
    510 
    511 DECLEXPORT(void) crDbgCmdSymLoadPrint(const char *modName, const void*pvAddress)
    512 {
    513     static bool fEnable = false;
    514     static bool fInitialized = false;
    515     const char * pszName;
    516     static const char * pszModulePath = NULL;
    517 
    518     if (!fInitialized)
    519     {
    520 #ifndef DEBUG_misha
    521         if (crGetenv( "CR_DEBUG_MODULE_ENABLE" ))
    522 #endif
    523         {
    524             fEnable = true;
    525         }
    526 
    527         fInitialized = true;
    528     }
    529 
    530     if (!fEnable)
    531         return;
    532 
    533     pszName = PathFindFileNameA(modName);
    534 
    535     if (!pszModulePath)
    536         pszModulePath = crGetenv("CR_DEBUG_MODULE_PATH");
    537     if (!pszModulePath)
    538         pszModulePath = "c:\\Users\\senmk\\Downloads\\Data\\Data";
    539 
    540     crDbgCmdPrint("load modules for ", pszName, ".reload /i /f %s\\%s=%#p", pszModulePath, pszName, pvAddress);
    541 }
    542 
    543472#endif
    544473
    545474DECLEXPORT(void) crDebug(const char *format, ... )
    546475{
    547476    va_list args;
    548477    static char txt[8092];
  • VirtualBox-5.0.0_BETA2/src/VBox/GuestHost//OpenGL/util/sortarray.cpp

    diff -uNr -U 6 vbox-orig/VirtualBox-5.0.0_BETA2/src/VBox/GuestHost//OpenGL/util/sortarray.cpp /home/alexey/VirtualBox-5.0.0_BETA2/src/VBox/GuestHost//OpenGL/util/sortarray.cpp
    old new  
    1 /* $Id: sortarray.cpp $ */
    2 
    3 /** @file
    4  * Sorted array impl
    5  */
    6 
    7 /*
    8  * Copyright (C) 2014 Oracle Corporation
    9  *
    10  * This file is part of VirtualBox Open Source Edition (OSE), as
    11  * available from http://www.virtualbox.org. This file is free software;
    12  * you can redistribute it and/or modify it under the terms of the GNU
    13  * General Public License (GPL) as published by the Free Software
    14  * Foundation, in version 2 as it comes in the "COPYING" file of the
    15  * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
    16  * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
    17  */
    18 
    19 #include <cr_sortarray.h>
    20 #include <cr_error.h>
    21 #include <iprt/err.h>
    22 #include <iprt/mem.h>
    23 
    24 #include <memory.h>
    25 
    26 VBOXSADECL(int) CrSaInit(CR_SORTARRAY *pArray, uint32_t cInitBuffer)
    27 {
    28     pArray->cBufferSize = cInitBuffer;
    29     pArray->cSize = 0;
    30     if (cInitBuffer)
    31     {
    32         pArray->pElements = (uint64_t*)RTMemAlloc(cInitBuffer * sizeof (pArray->pElements[0]));
    33         if (!pArray->pElements)
    34         {
    35             WARN(("no memory"));
    36             /* sanity */
    37             pArray->cBufferSize = 0;
    38             return VERR_NO_MEMORY;
    39         }
    40     }
    41     else
    42         pArray->pElements = NULL;
    43 
    44     return VINF_SUCCESS;
    45 }
    46 
    47 VBOXSADECL(void) CrSaCleanup(CR_SORTARRAY *pArray)
    48 {
    49     if (pArray->pElements)
    50         RTMemFree(pArray->pElements);
    51 
    52     CrSaInit(pArray, 0);
    53 }
    54 
    55 static int crSaSearch(const CR_SORTARRAY *pArray, uint64_t element)
    56 {
    57     int iMin = 0;
    58     int iMax = pArray->cSize;
    59     int i = 0;
    60 
    61     while (iMin < iMax)
    62     {
    63         i = (iMax + iMin) / 2;
    64 
    65         uint64_t el = pArray->pElements[i];
    66         if (el == element)
    67             return i;
    68         else if (el < element)
    69             iMin = i + 1;
    70         else
    71             iMax = i;
    72     }
    73 
    74     return -1;
    75 }
    76 
    77 static void crSaDbgValidate(const CR_SORTARRAY *pArray)
    78 {
    79     Assert(pArray->cSize <= pArray->cBufferSize);
    80     Assert(!pArray->pElements == !pArray->cBufferSize);
    81     if (!pArray->cSize)
    82         return;
    83     uint64_t cur = pArray->pElements[0];
    84     for (uint32_t i = 1; i < pArray->cSize; ++i)
    85     {
    86         Assert(pArray->pElements[i] > cur);
    87         cur = pArray->pElements[i];
    88     }
    89 }
    90 
    91 #ifdef DEBUG
    92 # define crSaValidate crSaDbgValidate
    93 #else
    94 # define crSaValidate(_a) do {} while (0)
    95 #endif
    96 
    97 static int crSaInsAt(CR_SORTARRAY *pArray, uint32_t iPos, uint64_t element)
    98 {
    99     if (pArray->cSize == pArray->cBufferSize)
    100     {
    101         uint32_t cNewBufferSize = pArray->cBufferSize + 16;
    102         uint64_t *pNew;
    103         if (pArray->pElements)
    104             pNew = (uint64_t*)RTMemRealloc(pArray->pElements, cNewBufferSize * sizeof (pArray->pElements[0]));
    105         else
    106             pNew = (uint64_t*)RTMemAlloc(cNewBufferSize * sizeof (pArray->pElements[0]));
    107         if (!pNew)
    108         {
    109             WARN(("no memory"));
    110             return VERR_NO_MEMORY;
    111         }
    112 
    113         pArray->pElements = pNew;
    114         pArray->cBufferSize = cNewBufferSize;
    115         crSaValidate(pArray);
    116     }
    117 
    118     for (int32_t i = (int32_t)pArray->cSize - 1; i >= (int32_t)iPos; --i)
    119     {
    120         pArray->pElements[i+1] = pArray->pElements[i];
    121     }
    122 
    123     pArray->pElements[iPos] = element;
    124     ++pArray->cSize;
    125 
    126     crSaValidate(pArray);
    127 
    128     return VINF_SUCCESS;
    129 }
    130 
    131 static void crSaDelAt(CR_SORTARRAY *pArray, uint32_t iPos)
    132 {
    133     Assert(pArray->cSize > iPos);
    134 
    135     for (uint32_t i = iPos; i < pArray->cSize - 1; ++i)
    136     {
    137         pArray->pElements[i] = pArray->pElements[i+1];
    138     }
    139 
    140     --pArray->cSize;
    141 }
    142 
    143 static int crSaAdd(CR_SORTARRAY *pArray, uint64_t element)
    144 {
    145     int iMin = 0;
    146     int iMax = pArray->cSize;
    147     int i = 0;
    148     uint64_t el;
    149 
    150     if (!iMax)
    151         return crSaInsAt(pArray, 0, element);
    152 
    153     while (iMin < iMax)
    154     {
    155         i = (iMax + iMin) / 2;
    156 
    157         el = pArray->pElements[i];
    158         if (el == element)
    159             return VINF_ALREADY_INITIALIZED;
    160         else if (el < element)
    161             iMin = i + 1;
    162         else
    163             iMax = i;
    164     }
    165 
    166     if (el < element)
    167         return crSaInsAt(pArray, i+1, element);
    168     return crSaInsAt(pArray, i, element);
    169 }
    170 
    171 static int crSaRemove(CR_SORTARRAY *pArray, uint64_t element)
    172 {
    173     int i = crSaSearch(pArray, element);
    174     if (i >= 0)
    175     {
    176         crSaDelAt(pArray, i);
    177         return VINF_SUCCESS;
    178     }
    179     return VINF_ALREADY_INITIALIZED;
    180 }
    181 
    182 /*
    183  *  * @return true if element is found */
    184 VBOXSADECL(bool) CrSaContains(const CR_SORTARRAY *pArray, uint64_t element)
    185 {
    186     return crSaSearch(pArray, element) >= 0;
    187 }
    188 
    189 VBOXSADECL(int) CrSaAdd(CR_SORTARRAY *pArray, uint64_t element)
    190 {
    191     return crSaAdd(pArray, element);
    192 }
    193 
    194 VBOXSADECL(int) CrSaRemove(CR_SORTARRAY *pArray, uint64_t element)
    195 {
    196     return crSaRemove(pArray, element);
    197 }
    198 
    199 static int crSaIntersected(const CR_SORTARRAY *pArray1, const CR_SORTARRAY *pArray2, CR_SORTARRAY *pResult)
    200 {
    201     int rc = VINF_SUCCESS;
    202     CrSaClear(pResult);
    203 
    204     for (uint32_t i = 0, j = 0; i < pArray1->cSize && j < pArray2->cSize; )
    205     {
    206         if (pArray1->pElements[i] == pArray2->pElements[j])
    207         {
    208             rc = CrSaAdd(pResult, pArray1->pElements[i]);
    209             if (rc < 0)
    210             {
    211                 WARN(("CrSaAdd failed"));
    212                 return rc;
    213             }
    214 
    215             ++i;
    216             ++j;
    217         }
    218         else if (pArray1->pElements[i] < pArray2->pElements[j])
    219         {
    220             ++i;
    221         }
    222         else
    223         {
    224             ++j;
    225         }
    226     }
    227 
    228     return VINF_SUCCESS;
    229 }
    230 
    231 static void crSaIntersect(CR_SORTARRAY *pArray1, const CR_SORTARRAY *pArray2)
    232 {
    233     for (uint32_t i = 0, j = 0; i < pArray1->cSize && j < pArray2->cSize; )
    234     {
    235         if (pArray1->pElements[i] == pArray2->pElements[j])
    236         {
    237             ++i;
    238             ++j;
    239         }
    240         else if (pArray1->pElements[i] < pArray2->pElements[j])
    241             crSaDelAt(pArray1, i);
    242         else
    243             ++j;
    244     }
    245 }
    246 
    247 /*
    248  * @return >= 0 success
    249  * < 0 - no memory
    250  *  */
    251 VBOXSADECL(void) CrSaIntersect(CR_SORTARRAY *pArray1, const CR_SORTARRAY *pArray2)
    252 {
    253     crSaIntersect(pArray1, pArray2);
    254 }
    255 
    256 VBOXSADECL(int) CrSaIntersected(CR_SORTARRAY *pArray1, const CR_SORTARRAY *pArray2, CR_SORTARRAY *pResult)
    257 {
    258     return crSaIntersected(pArray1, pArray2, pResult);
    259 }
    260 
    261 static int crSaUnited(const CR_SORTARRAY *pArray1, const CR_SORTARRAY *pArray2, CR_SORTARRAY *pResult)
    262 {
    263     int rc = VINF_SUCCESS;
    264     CrSaClear(pResult);
    265 
    266     uint32_t i = 0, j = 0;
    267     uint32_t cResult = 0;
    268     while (i < pArray1->cSize && j < pArray2->cSize)
    269     {
    270         uint64_t element;
    271         if (pArray1->pElements[i] == pArray2->pElements[j])
    272         {
    273             element = pArray1->pElements[i];
    274             ++i;
    275             ++j;
    276         }
    277         else if (pArray1->pElements[i] < pArray2->pElements[j])
    278         {
    279             element = pArray1->pElements[i];
    280             ++i;
    281         }
    282         else
    283         {
    284             element = pArray1->pElements[j];
    285             ++j;
    286         }
    287 
    288         rc = crSaInsAt(pResult, cResult++, element);
    289         if (rc < 0)
    290         {
    291             WARN(("crSaInsAt failed"));
    292             return rc;
    293         }
    294     }
    295 
    296     uint32_t iTail;
    297     const CR_SORTARRAY *pTail;
    298 
    299     if (i < pArray1->cSize)
    300     {
    301         iTail = i;
    302         pTail = pArray1;
    303     }
    304     else if (j < pArray2->cSize)
    305     {
    306         iTail = j;
    307         pTail = pArray2;
    308     }
    309     else
    310     {
    311         iTail = 0;
    312         pTail = 0;
    313     }
    314 
    315     if (pTail)
    316     {
    317         for (;iTail < pTail->cSize; ++iTail)
    318         {
    319             rc = crSaInsAt(pResult, cResult++, pTail->pElements[iTail]);
    320             if (rc < 0)
    321             {
    322                 WARN(("crSaInsAt failed"));
    323                 return rc;
    324             }
    325         }
    326     }
    327 
    328     return VINF_SUCCESS;
    329 }
    330 
    331 VBOXSADECL(int) CrSaUnited(const CR_SORTARRAY *pArray1, const CR_SORTARRAY *pArray2, CR_SORTARRAY *pResult)
    332 {
    333     return crSaUnited(pArray1, pArray2, pResult);
    334 }
    335 
    336 static int crSaClone(const CR_SORTARRAY *pArray1, CR_SORTARRAY *pResult)
    337 {
    338     int rc = 0;
    339     CrSaClear(pResult);
    340 
    341     if (pArray1->cSize > pResult->cBufferSize)
    342     {
    343         CrSaCleanup(pResult);
    344         uint32_t cNewBufferSize = pArray1->cSize;
    345         uint64_t *pNew = (uint64_t*)RTMemAlloc(cNewBufferSize * sizeof (pResult->pElements[0]));
    346         if (!pNew)
    347         {
    348             WARN(("no memory"));
    349             return VERR_NO_MEMORY;
    350         }
    351 
    352         pResult->pElements = pNew;
    353         pResult->cBufferSize = cNewBufferSize;
    354         crSaValidate(pResult);
    355     }
    356 
    357     pResult->cSize = pArray1->cSize;
    358     memcpy(pResult->pElements, pArray1->pElements, pArray1->cSize * sizeof (pArray1->pElements[0]));
    359     return VINF_SUCCESS;
    360 }
    361 
    362 /*
    363  * @return VINF_SUCCESS on success
    364  * VERR_NO_MEMORY - no memory
    365  *  */
    366 VBOXSADECL(int) CrSaClone(const CR_SORTARRAY *pArray1, CR_SORTARRAY *pResult)
    367 {
    368     return crSaClone(pArray1, pResult);
    369 }
    370 
    371 static int crSaCmp(const CR_SORTARRAY *pArray1, const CR_SORTARRAY *pArray2)
    372 {
    373     int diff = CrSaGetSize(pArray1) - CrSaGetSize(pArray2);
    374     if (diff)
    375         return diff;
    376 
    377     return memcmp(pArray1->pElements, pArray2->pElements, pArray1->cSize * sizeof (pArray1->pElements[0]));
    378 }
    379 
    380 VBOXSADECL(int) CrSaCmp(const CR_SORTARRAY *pArray1, const CR_SORTARRAY *pArray2)
    381 {
    382     return crSaCmp(pArray1, pArray2);
    383 }
    384 
    385 static bool crSaCovers(const CR_SORTARRAY *pArray1, const CR_SORTARRAY *pArray2)
    386 {
    387     if (CrSaGetSize(pArray1) < CrSaGetSize(pArray2))
    388         return false;
    389 
    390     uint32_t i = 0, j = 0;
    391     while (j < pArray2->cSize)
    392     {
    393         if (i == pArray1->cSize)
    394             return false;
    395 
    396         if (pArray1->pElements[i] == pArray2->pElements[j])
    397         {
    398             ++i;
    399             ++j;
    400         }
    401         else if (pArray1->pElements[i] < pArray2->pElements[j])
    402             ++i;
    403         else
    404             return false;
    405     }
    406 
    407     return true;
    408 }
    409 
    410 VBOXSADECL(bool) CrSaCovers(const CR_SORTARRAY *pArray1, const CR_SORTARRAY *pArray2)
    411 {
    412     return crSaCovers(pArray1, pArray2);
    413 }
    414 
  • VirtualBox-5.0.0_BETA2/src/VBox/HostServices//SharedOpenGL/crserver/crservice.cpp

    diff -uNr -U 6 vbox-orig/VirtualBox-5.0.0_BETA2/src/VBox/HostServices//SharedOpenGL/crserver/crservice.cpp /home/alexey/VirtualBox-5.0.0_BETA2/src/VBox/HostServices//SharedOpenGL/crserver/crservice.cpp
    old new  
    948948                    g_pConsole = pConsole;
    949949                    g_u32ScreenCount = monitorCount;
    950950
    951951                    rc = crVBoxServerSetScreenCount(monitorCount);
    952952                    AssertRCReturn(rc, rc);
    953953
    954 #if 1
     954
    955955                    crServerVBoxCompositionSetEnableStateGlobal(GL_FALSE);
    956956
    957957                    for (i=0; i<monitorCount; ++i)
    958958                    {
    959959                        CHECK_ERROR_RET(pDisplay, QueryFramebuffer(i, pFramebuffer.asOutParam()), rc);
    960960
     
    975975                            rc = crVBoxServerMapScreen(i, xo, yo, w, h, winId);
    976976                            AssertRCReturn(rc, rc);
    977977                        }
    978978                    }
    979979
    980980                    crServerVBoxCompositionSetEnableStateGlobal(GL_TRUE);
    981 #endif
    982981
    983982                    rc = VINF_SUCCESS;
    984983                }
    985984            }
    986985            break;
    987986        }
     
    14291428    if ((cbCtl - sizeof (VBOXCRCMDCTL)) % sizeof(VBOXHGCMSVCPARM))
    14301429    {
    14311430        WARN(("invalid param size"));
    14321431        return VERR_INVALID_PARAMETER;
    14331432    }
    14341433    uint32_t cParams = (cbCtl - sizeof (VBOXCRCMDCTL)) / sizeof (VBOXHGCMSVCPARM);
    1435     bool fHasCallout = VBOXCRCMDCTL_IS_CALLOUT_AVAILABLE(pCtl);
    1436     if (fHasCallout)
    1437         crVBoxServerCalloutEnable(pCtl);
    1438 
    1439     int rc = svcHostCallPerform(pCtl->u32Function, cParams, (VBOXHGCMSVCPARM*)(pCtl + 1));
    1440 
    1441     if (fHasCallout)
    1442         crVBoxServerCalloutDisable();
    1443 
    1444     return rc;
     1434    return svcHostCallPerform(pCtl->u32Function, cParams, (VBOXHGCMSVCPARM*)(pCtl + 1));
    14451435}
    14461436
    14471437static DECLCALLBACK(int) svcHostCall(void *, uint32_t u32Function, uint32_t cParms, VBOXHGCMSVCPARM paParms[])
    14481438{
    14491439    switch (u32Function)
    14501440    {
  • VirtualBox-5.0.0_BETA2/src/VBox/HostServices//SharedOpenGL/crserverlib/presenter/server_presenter.cpp

    Binary files vbox-orig/VirtualBox-5.0.0_BETA2/src/VBox/HostServices//SharedOpenGL/crserverlib/get_sizes.pyc and /home/alexey/VirtualBox-5.0.0_BETA2/src/VBox/HostServices//SharedOpenGL/crserverlib/get_sizes.pyc differ
    diff -uNr -U 6 vbox-orig/VirtualBox-5.0.0_BETA2/src/VBox/HostServices//SharedOpenGL/crserverlib/presenter/server_presenter.cpp /home/alexey/VirtualBox-5.0.0_BETA2/src/VBox/HostServices//SharedOpenGL/crserverlib/presenter/server_presenter.cpp
    old new  
    3030
    3131#define PCR_FBTEX_FROM_TEX(_pTex) ((CR_FBTEX*)((uint8_t*)(_pTex) - RT_OFFSETOF(CR_FBTEX, Tex)))
    3232#define PCR_FRAMEBUFFER_FROM_COMPOSITOR(_pCompositor) ((CR_FRAMEBUFFER*)((uint8_t*)(_pCompositor) - RT_OFFSETOF(CR_FRAMEBUFFER, Compositor)))
    3333#define PCR_FBENTRY_FROM_ENTRY(_pEntry) ((CR_FRAMEBUFFER_ENTRY*)((uint8_t*)(_pEntry) - RT_OFFSETOF(CR_FRAMEBUFFER_ENTRY, Entry)))
    3434
    3535
    36 static int crPMgrFbConnectTargetDisplays(HCR_FRAMEBUFFER hFb, CR_FBDISPLAY_INFO *pDpInfo, uint32_t u32ModeAdd);
    37 
    3836CR_PRESENTER_GLOBALS g_CrPresenter;
    3937
    4038/* FRAMEBUFFER */
    4139
    4240void CrFbInit(CR_FRAMEBUFFER *pFb, uint32_t idFb)
    4341{
     
    933931    CRTextureObj *pTobj = pFbTex->pTobj;
    934932
    935933    CrTdBltDataCleanupNe(pTex);
    936934
    937935    if (pTobj)
    938936    {
     937        CR_STATE_SHAREDOBJ_USAGE_CLEAR(pTobj, cr_server.MainContextInfo.pContext);
     938
    939939        crHashtableDelete(g_CrPresenter.pFbTexMap, pTobj->id, NULL);
    940940
    941         crStateReleaseTexture(cr_server.MainContextInfo.pContext, pTobj);
     941        if (!CR_STATE_SHAREDOBJ_USAGE_IS_USED(pTobj))
     942        {
     943            CRSharedState *pShared = crStateGlobalSharedAcquire();
    942944
     945            CRASSERT(pShared);
     946            /* on the host side, we need to delete an ogl texture object here as well, which crStateDeleteTextureCallback will do
     947             * in addition to calling crStateDeleteTextureObject to delete a state object */
     948            crHashtableDelete(pShared->textureTable, pTobj->id, crStateDeleteTextureCallback);
    943949
    944         crStateGlobalSharedRelease();
     950            crStateGlobalSharedRelease();
     951        }
     952 
     953         crStateGlobalSharedRelease();
    945954    }
    946955
    947956    crFbTexFree(pFbTex);
    948957}
    949958
    950959void CrFbTexDataInit(CR_TEXDATA* pFbTex, const VBOXVR_TEXTURE *pTex, PFNCRTEXDATA_RELEASED pfnTextureReleased)
     
    39543963    }
    39553964
    39563965    const RTRECT *pRect = CrVrScrCompositorRectGet(&hFb->Compositor);
    39573966    crServerDispatchVBoxTexPresent(hostId, idFb, 0, 0, 1, (const GLint*)pRect);
    39583967    return 0;
    39593968}
    3960 
    3961 typedef struct CRSERVER_CLIENT_CALLOUT
    3962 {
    3963     VBOXCRCMDCTL_CALLOUT_LISTENTRY Entry;
    3964     PFNVCRSERVER_CLIENT_CALLOUT_CB pfnCb;
    3965     void*pvCb;
    3966 } CRSERVER_CLIENT_CALLOUT;
    3967 
    3968 static DECLCALLBACK(void) crServerClientCalloutCb(struct VBOXCRCMDCTL_CALLOUT_LISTENTRY *pEntry)
    3969 {
    3970     CRSERVER_CLIENT_CALLOUT *pCallout = RT_FROM_MEMBER(pEntry, CRSERVER_CLIENT_CALLOUT, Entry);
    3971     pCallout->pfnCb(pCallout->pvCb);
    3972     int rc = RTSemEventSignal(cr_server.hCalloutCompletionEvent);
    3973     if (RT_FAILURE(rc))
    3974         WARN(("RTSemEventSignal failed rc %d", rc));
    3975 }
    3976 
    3977 static DECLCALLBACK(void) crServerClientCallout(PFNVCRSERVER_CLIENT_CALLOUT_CB pfnCb, void*pvCb)
    3978 {
    3979     Assert(cr_server.pCurrentCalloutCtl);
    3980     CRSERVER_CLIENT_CALLOUT Callout;
    3981     Callout.pfnCb = pfnCb;
    3982     Callout.pvCb = pvCb;
    3983     cr_server.ClientInfo.pfnCallout(cr_server.ClientInfo.hClient, cr_server.pCurrentCalloutCtl, &Callout.Entry, crServerClientCalloutCb);
    3984 
    3985     int rc = RTSemEventWait(cr_server.hCalloutCompletionEvent, RT_INDEFINITE_WAIT);
    3986     if (RT_FAILURE(rc))
    3987         WARN(("RTSemEventWait failed %d", rc));
    3988 }
    3989 
    3990 
    3991 DECLEXPORT(void) crVBoxServerCalloutEnable(VBOXCRCMDCTL *pCtl)
    3992 {
    3993 #if 1 //def CR_SERVER_WITH_CLIENT_CALLOUTS
    3994     Assert(!cr_server.pCurrentCalloutCtl);
    3995     cr_server.pCurrentCalloutCtl = pCtl;
    3996 
    3997     cr_server.head_spu->dispatch_table.ChromiumParametervCR(GL_HH_SET_CLIENT_CALLOUT, 0, 0, (void*)crServerClientCallout);
    3998 #endif
    3999 }
    4000 
    4001 extern DECLEXPORT(void) crVBoxServerCalloutDisable()
    4002 {
    4003 #if 1 //def CR_SERVER_WITH_CLIENT_CALLOUTS
    4004     Assert(cr_server.pCurrentCalloutCtl);
    4005 
    4006     cr_server.head_spu->dispatch_table.ChromiumParametervCR(GL_HH_SET_CLIENT_CALLOUT, 0, 0, NULL);
    4007 
    4008     cr_server.pCurrentCalloutCtl = NULL;
    4009 #endif
    4010 }
  • VirtualBox-5.0.0_BETA2/src/VBox/HostServices//SharedOpenGL/crserverlib/server.h

    diff -uNr -U 6 vbox-orig/VirtualBox-5.0.0_BETA2/src/VBox/HostServices//SharedOpenGL/crserverlib/server.h /home/alexey/VirtualBox-5.0.0_BETA2/src/VBox/HostServices//SharedOpenGL/crserverlib/server.h
    old new  
    416416int CrPMgrViewportUpdate(uint32_t idScreen);
    417417int CrPMgrScreenChanged(uint32_t idScreen);
    418418int CrPMgrResize(const struct VBVAINFOSCREEN *pScreen, void *pvVRAM, const uint32_t *pTargetMap);
    419419int CrPMgrSaveState(PSSMHANDLE pSSM);
    420420int CrPMgrLoadState(PSSMHANDLE pSSM, uint32_t version);
    421421HCR_FRAMEBUFFER CrPMgrFbGet(uint32_t idScreen);
    422 int CrPMgrClearRegionsGlobal();
    423422/*cleanup stuff*/
    424423
    425424
    426425int CrPMgrInit();
    427426void CrPMgrTerm();
    428427int CrPMgrDisable();
  • VirtualBox-5.0.0_BETA2/src/VBox/HostServices//SharedOpenGL/crserverlib/server_lists.c

    diff -uNr -U 6 vbox-orig/VirtualBox-5.0.0_BETA2/src/VBox/HostServices//SharedOpenGL/crserverlib/server_lists.c /home/alexey/VirtualBox-5.0.0_BETA2/src/VBox/HostServices//SharedOpenGL/crserverlib/server_lists.c
    old new  
    6666    crStateNewList( list, mode );
    6767    cr_server.head_spu->dispatch_table.NewList( list, mode );
    6868}
    6969
    7070static void crServerQueryHWState()
    7171{
    72     if (!cr_server.bUseMultipleContexts)
     72    GLuint fbFbo, bbFbo;
     73    CRClient *client = cr_server.curClient;
     74    CRMuralInfo *mural = client ? client->currentMural : NULL;
     75    if (mural && mural->fRedirected)
    7376    {
    74         GLuint fbFbo, bbFbo;
    75         CRClient *client = cr_server.curClient;
    76         CRMuralInfo *mural = client ? client->currentMural : NULL;
    77         if (mural && mural->fRedirected)
    78         {
    79             fbFbo = mural->aidFBOs[CR_SERVER_FBO_FB_IDX(mural)];
    80             bbFbo = mural->aidFBOs[CR_SERVER_FBO_BB_IDX(mural)];
    81         }
    82         else
    83         {
    84             fbFbo = bbFbo = 0;
    85         }
    86         crStateQueryHWState(fbFbo, bbFbo);
     77        fbFbo = mural->aidFBOs[CR_SERVER_FBO_FB_IDX(mural)];
     78        bbFbo = mural->aidFBOs[CR_SERVER_FBO_BB_IDX(mural)];
    8779    }
     80    else
     81    {
     82        fbFbo = bbFbo = 0;
     83    }
     84    crStateQueryHWState(fbFbo, bbFbo);
    8885}
    8986
    9087void SERVER_DISPATCH_APIENTRY crServerDispatchEndList(void)
    9188{
    9289    CRContext *g = crStateGetCurrent();
    9390    CRListsState *l = &(g->lists);
  • VirtualBox-5.0.0_BETA2/src/VBox/HostServices//SharedOpenGL/crserverlib/server_main.c

    diff -uNr -U 6 vbox-orig/VirtualBox-5.0.0_BETA2/src/VBox/HostServices//SharedOpenGL/crserverlib/server_main.c /home/alexey/VirtualBox-5.0.0_BETA2/src/VBox/HostServices//SharedOpenGL/crserverlib/server_main.c
    old new  
    280280
    281281    crNetTearDown();
    282282
    283283    VBoxVrListClear(&cr_server.RootVr);
    284284
    285285    VBoxVrTerm();
    286 
    287     RTSemEventDestroy(cr_server.hCalloutCompletionEvent);
    288286}
    289287
    290288static void crServerClose( unsigned int id )
    291289{
    292290    crError( "Client disconnected!" );
    293291    (void) id;
     
    384382                            | _FPU_MASK_OM | _FPU_MASK_UM);
    385383        _FPU_SETCW(mask);
    386384    }
    387385#endif
    388386
    389387    cr_server.fCrCmdEnabled = GL_FALSE;
    390     cr_server.fProcessingPendedCommands = GL_FALSE;
    391388    CrHTableCreate(&cr_server.clientTable, CR_MAX_CLIENTS);
    392389
    393390    cr_server.bUseMultipleContexts = (crGetenv( "CR_SERVER_ENABLE_MULTIPLE_CONTEXTS" ) != NULL);
    394391
    395392    if (cr_server.bUseMultipleContexts)
    396393    {
     
    492489                            | _FPU_MASK_OM | _FPU_MASK_UM);
    493490        _FPU_SETCW(mask);
    494491    }
    495492#endif
    496493
    497494    cr_server.fCrCmdEnabled = GL_FALSE;
    498     cr_server.fProcessingPendedCommands = GL_FALSE;
    499495    CrHTableCreate(&cr_server.clientTable, CR_MAX_CLIENTS);
    500496
    501497    cr_server.bUseMultipleContexts = (crGetenv( "CR_SERVER_ENABLE_MULTIPLE_CONTEXTS" ) != NULL);
    502498
    503499    if (cr_server.bUseMultipleContexts)
    504500    {
     
    514510    cr_server.bIsInLoadingState = GL_FALSE;
    515511    cr_server.bIsInSavingState  = GL_FALSE;
    516512    cr_server.bForceMakeCurrentOnClientSwitch = GL_FALSE;
    517513
    518514    cr_server.pCleanupClient = NULL;
    519515
    520     rc = RTSemEventCreate(&cr_server.hCalloutCompletionEvent);
    521     if (!RT_SUCCESS(rc))
    522     {
    523         WARN(("RTSemEventCreate failed %d", rc));
    524         return GL_FALSE;
    525     }
    526 
    527516    /*
    528517     * Create default mural info and hash table.
    529518     */
    530519    cr_server.muralTable = crAllocHashtable();
    531520    defaultMural = (CRMuralInfo *) crCalloc(sizeof(CRMuralInfo));
    532521    defaultMural->spuWindow = CR_RENDER_DEFAULT_WINDOW_ID;
     
    39673956            PVBOXVDMACMD_CHROMIUM_CTL_CRHGSMI_SETUP pSetup = (PVBOXVDMACMD_CHROMIUM_CTL_CRHGSMI_SETUP)pCtl;
    39683957            g_pvVRamBase = (uint8_t*)pSetup->pvVRamBase;
    39693958            g_cbVRam = pSetup->cbVRam;
    39703959
    39713960            g_pLed = pSetup->pLed;
    39723961
    3973             cr_server.ClientInfo = pSetup->CrClientInfo;
    3974 
    39753962            pSetup->CrCmdServerInfo.hSvr = NULL;
    39763963            pSetup->CrCmdServerInfo.pfnEnable = crVBoxCrCmdEnable;
    39773964            pSetup->CrCmdServerInfo.pfnDisable = crVBoxCrCmdDisable;
    39783965            pSetup->CrCmdServerInfo.pfnCmd = crVBoxCrCmdCmd;
    39793966            pSetup->CrCmdServerInfo.pfnHostCtl = crVBoxCrCmdHostCtl;
    39803967            pSetup->CrCmdServerInfo.pfnGuestCtl = crVBoxCrCmdGuestCtl;
  • VirtualBox-5.0.0_BETA2/src/VBox/HostServices//SharedOpenGL/crserverlib/server_misc.c

    diff -uNr -U 6 vbox-orig/VirtualBox-5.0.0_BETA2/src/VBox/HostServices//SharedOpenGL/crserverlib/server_misc.c /home/alexey/VirtualBox-5.0.0_BETA2/src/VBox/HostServices//SharedOpenGL/crserverlib/server_misc.c
    old new  
    77#include "server_dispatch.h"
    88#include "server.h"
    99#include "cr_error.h"
    1010#include "cr_mem.h"
    1111#include "cr_string.h"
    1212#include "cr_pixeldata.h"
    13 #ifdef VBOX_WITH_CRDUMPER
    14 # include "cr_dump.h"
    15 #endif
    1613
    1714void SERVER_DISPATCH_APIENTRY crServerDispatchSelectBuffer( GLsizei size, GLuint *buffer )
    1815{
    1916    (void) size;
    2017    (void) buffer;
    2118    crError( "Unsupported network glSelectBuffer call." );
     
    7976            else
    8077            {
    8178                crWarning("zero bytes for GL_DBG_CHECK_BREAK_CR");
    8279            }
    8380            break;
    8481        }
    85         case GL_HH_SET_DEFAULT_SHARED_CTX:
    86             WARN(("Recieved GL_HH_SET_DEFAULT_SHARED_CTX from guest, ignoring"));
    87             break;
    88         case GL_HH_SET_CLIENT_CALLOUT:
    89             WARN(("Recieved GL_HH_SET_CLIENT_CALLOUT from guest, ignoring"));
    90             break;
    9182        default:
    9283            cr_server.head_spu->dispatch_table.GetChromiumParametervCR( target, index, type, count, local_storage );
    9384            break;
    9485    }
    9586
    9687    crServerReturnValue( local_storage, bytes );
     
    297288        break;
    298289
    299290    case GL_HH_SET_TMPCTX_MAKE_CURRENT:
    300291        /*we should not receive it from the guest! */
    301292        break;
    302293
    303     case GL_HH_SET_CLIENT_CALLOUT:
    304         WARN(("Recieved GL_HH_SET_CLIENT_CALLOUT from guest, ignoring"));
    305         break;
    306 
    307294    default:
    308295        /* Pass the parameter info to the head SPU */
    309296        cr_server.head_spu->dispatch_table.ChromiumParametervCR( target, type, count, values );
    310297        break;
    311298    }
    312299}
     
    321308    case GL_RCUSAGE_TEXTURE_SET_CR:
    322309        crStateSetTextureUsed(value, GL_TRUE);
    323310        break;
    324311    case GL_RCUSAGE_TEXTURE_CLEAR_CR:
    325312        crStateSetTextureUsed(value, GL_FALSE);
    326313        break;
    327     case GL_PIN_TEXTURE_SET_CR:
    328         crStatePinTexture(value, GL_TRUE);
    329         break;
    330     case GL_PIN_TEXTURE_CLEAR_CR:
    331         crStatePinTexture(value, GL_FALSE);
    332         break;
    333314    case GL_SHARED_DISPLAY_LISTS_CR:
    334315        cr_server.sharedDisplayLists = value;
    335316        break;
    336317    case GL_SHARED_TEXTURE_OBJECTS_CR:
    337318        cr_server.sharedTextureObjects = value;
    338319        break;
     
    343324        cr_server.currentEye = value ? 1 : 0;
    344325        break;
    345326    case GL_HOST_WND_CREATED_HIDDEN_CR:
    346327        cr_server.bWindowsInitiallyHidden = value ? 1 : 0;
    347328        break;
    348329    case GL_HH_SET_DEFAULT_SHARED_CTX:
    349         WARN(("Recieved GL_HH_SET_DEFAULT_SHARED_CTX from guest, ignoring"));
     330        crWarning("Recieved GL_HH_SET_DEFAULT_SHARED_CTX from guest, ignoring");
    350331        break;
    351332    case GL_HH_RENDERTHREAD_INFORM:
    352         WARN(("Recieved GL_HH_RENDERTHREAD_INFORM from guest, ignoring"));
     333        crWarning("Recieved GL_HH_RENDERTHREAD_INFORM from guest, ignoring");
    353334        break;
    354335    default:
    355336        /* Pass the parameter info to the head SPU */
    356337        cr_server.head_spu->dispatch_table.ChromiumParameteriCR( target, value );
    357338    }
    358339}
     
    15011482
    15021483}
    15031484
    15041485/* dump stuff */
    15051486#ifdef VBOX_WITH_CRSERVER_DUMPER
    15061487
    1507 # ifndef VBOX_WITH_CRDUMPER
    1508 #  error "VBOX_WITH_CRDUMPER undefined!"
    1509 # endif
    1510 
    15111488/* first four bits are buffer dump config
    15121489 * second four bits are texture dump config
    15131490 * config flags:
    15141491 * 1 - blit on enter
    15151492 * 2 - blit on exit
    15161493 *
     
    17081685    crRecDumpVertAttrv(&cr_server.Recorder, ctx, idx, pszElFormat, cbEl, pvVal, cVal);
    17091686}
    17101687
    17111688void crServerDumpBuffer(int idx)
    17121689{
    17131690    CRContextInfo *pCtxInfo = cr_server.currentCtxInfo;
     1691    CR_BLITTER_WINDOW BltWin;
     1692    CR_BLITTER_CONTEXT BltCtx;
    17141693    CRContext *ctx = crStateGetCurrent();
    17151694    GLint idFBO;
    17161695    GLint idTex;
    17171696    VBOXVR_TEXTURE RedirTex;
    17181697    int rc = crServerDumpCheckInit();
    17191698    idx = idx >= 0 ? idx : crServerMuralFBOIdxFromBufferName(cr_server.currentMural, pCtxInfo->pContext->buffer.drawBuffer);
     
    17291708        return;
    17301709    }
    17311710
    17321711    idFBO = CR_SERVER_FBO_FOR_IDX(cr_server.currentMural, idx);
    17331712    idTex = CR_SERVER_FBO_TEX_FOR_IDX(cr_server.currentMural, idx);
    17341713
     1714    crServerVBoxBlitterWinInit(&BltWin, cr_server.currentMural);
     1715    crServerVBoxBlitterCtxInit(&BltCtx, pCtxInfo);
     1716
    17351717    RedirTex.width = cr_server.currentMural->fboWidth;
    17361718    RedirTex.height = cr_server.currentMural->fboHeight;
    17371719    RedirTex.target = GL_TEXTURE_2D;
    17381720    RedirTex.hwid = idTex;
    17391721
    1740     crRecDumpBuffer(&cr_server.Recorder, ctx, idFBO, idTex ? &RedirTex : NULL);
     1722    crRecDumpBuffer(&cr_server.Recorder, ctx, &BltCtx, &BltWin, idFBO, idTex ? &RedirTex : NULL);
    17411723}
    17421724
    17431725void crServerDumpTexture(const VBOXVR_TEXTURE *pTex)
    17441726{
    17451727    CRContextInfo *pCtxInfo = cr_server.currentCtxInfo;
    17461728    CR_BLITTER_WINDOW BltWin;
     
    17591741    crRecDumpTextureF(&cr_server.Recorder, pTex, &BltCtx, &BltWin, "Tex (%d x %d), hwid (%d) target %#x", pTex->width, pTex->height, pTex->hwid, pTex->target);
    17601742}
    17611743
    17621744void crServerDumpTextures()
    17631745{
    17641746    CRContextInfo *pCtxInfo = cr_server.currentCtxInfo;
     1747    CR_BLITTER_WINDOW BltWin;
     1748    CR_BLITTER_CONTEXT BltCtx;
    17651749    CRContext *ctx = crStateGetCurrent();
    17661750    int rc = crServerDumpCheckInit();
    17671751    if (!RT_SUCCESS(rc))
    17681752    {
    17691753        crWarning("crServerDumpCheckInit failed, rc %d", rc);
    17701754        return;
    17711755    }
    17721756
    1773     crRecDumpTextures(&cr_server.Recorder, ctx);
     1757    crServerVBoxBlitterWinInit(&BltWin, cr_server.currentMural);
     1758    crServerVBoxBlitterCtxInit(&BltCtx, pCtxInfo);
     1759
     1760    crRecDumpTextures(&cr_server.Recorder, ctx, &BltCtx, &BltWin);
    17741761}
    17751762
    17761763void crServerDumpFilterOpLeave(unsigned long event, CR_DUMPER *pDumper)
    17771764{
    17781765    if (CR_SERVER_DUMP_F_DRAW_LEAVE_ALL & event)
    17791766    {
  • VirtualBox-5.0.0_BETA2/src/VBox/HostServices//SharedOpenGL/crserverlib/server_muralfbo.cpp

    diff -uNr -U 6 vbox-orig/VirtualBox-5.0.0_BETA2/src/VBox/HostServices//SharedOpenGL/crserverlib/server_muralfbo.cpp /home/alexey/VirtualBox-5.0.0_BETA2/src/VBox/HostServices//SharedOpenGL/crserverlib/server_muralfbo.cpp
    old new  
    116116    {
    117117        GLuint j;
    118118        CR_FBDATA *pData = &mural->aFBDatas[i];
    119119        if (!pData->hFb)
    120120            continue;
    121121
    122         if (pData->hFbEntry != NULL)
    123         {
    124             CrFbEntryRelease(pData->hFb, pData->hFbEntry);
    125             pData->hFbEntry = NULL;
    126         }
     122        CrFbEntryRelease(pData->hFb, pData->hFbEntry);
     123        pData->hFbEntry = NULL;
    127124
    128125        for (j = 0; j < mural->cBuffers; ++j)
    129126        {
    130127            CrTdRelease(pData->apTexDatas[j]);
    131128            pData->apTexDatas[j] = NULL;
    132129        }
     
    189186        return VINF_SUCCESS;
    190187
    191188    pData = &mural->aFBDatas[pScreenInfo->u32ViewIndex];
    192189
    193190    if (!pData->hFb)
    194191    {
    195         /* Guard against modulo-by-zero when calling CrFbEntryCreateForTexData
    196            below. Observed when failing to load atig6pxx.dll and similar. */
    197         if (RT_UNLIKELY(mural->cBuffers == 0))
    198         {
    199             WARN(("crServerRedirMuralDbSyncFb: cBuffers == 0 (crServerSupportRedirMuralFBO=%d)", crServerSupportRedirMuralFBO()));
    200             return VERR_NOT_SUPPORTED;
    201         }
    202 
    203192        pData->hFb = hFb;
    204193
    205194        for (uint32_t i = 0; i < mural->cBuffers; ++i)
    206195        {
    207196            VBOXVR_TEXTURE Tex;
    208197            Tex.width = mural->width;
  • VirtualBox-5.0.0_BETA2/src/VBox/HostServices//SharedOpenGL/crserverlib/server_retval.py

    diff -uNr -U 6 vbox-orig/VirtualBox-5.0.0_BETA2/src/VBox/HostServices//SharedOpenGL/crserverlib/server_retval.py /home/alexey/VirtualBox-5.0.0_BETA2/src/VBox/HostServices//SharedOpenGL/crserverlib/server_retval.py
    old new  
    1717#include "cr_net.h"
    1818#include "server_dispatch.h"
    1919#include "server.h"
    2020
    2121void crServerReturnValue( const void *payload, unsigned int payload_len )
    2222{
    23     if (!cr_server.fProcessingPendedCommands)
    24     {
    25         CRMessageReadback *rb;
    26         int msg_len = sizeof( *rb ) + payload_len;
    27    
    28         /* Don't reply to client if we're loading VM snapshot*/
    29         if (cr_server.bIsInLoadingState)
    30             return;
    31    
    32         if (cr_server.curClient->conn->type == CR_FILE)
    33         {
    34             return;
    35         }
    36    
    37         rb = (CRMessageReadback *) crAlloc( msg_len );
    38    
    39         rb->header.type = CR_MESSAGE_READBACK;
    40         CRDBGPTR_PRINTRB(cr_server.curClient->conn->u32ClientID, &cr_server.writeback_ptr);
    41         CRDBGPTR_CHECKNZ(&cr_server.writeback_ptr);
    42         CRDBGPTR_CHECKNZ(&cr_server.return_ptr);
    43         crMemcpy( &(rb->writeback_ptr), &(cr_server.writeback_ptr), sizeof( rb->writeback_ptr ) );
    44         crMemcpy( &(rb->readback_ptr), &(cr_server.return_ptr), sizeof( rb->readback_ptr ) );
    45         crMemcpy( rb+1, payload, payload_len );
    46         crNetSend( cr_server.curClient->conn, NULL, rb, msg_len );
    47         CRDBGPTR_SETZ(&cr_server.writeback_ptr);
    48         CRDBGPTR_SETZ(&cr_server.return_ptr);
    49         crFree( rb );
     23    CRMessageReadback *rb;
     24    int msg_len = sizeof( *rb ) + payload_len;
     25
     26    /* Don't reply to client if we're loading VM snapshot*/
     27    if (cr_server.bIsInLoadingState)
     28        return;
     29
     30    if (cr_server.curClient->conn->type == CR_FILE)
     31    {
    5032        return;
    5133    }
    52 #ifdef DEBUG_misha
    53     WARN(("Pending command returns value"));
    54 #endif
     34
     35    rb = (CRMessageReadback *) crAlloc( msg_len );
     36
     37    rb->header.type = CR_MESSAGE_READBACK;
     38    CRDBGPTR_PRINTRB(cr_server.curClient->conn->u32ClientID, &cr_server.writeback_ptr);
     39    CRDBGPTR_CHECKNZ(&cr_server.writeback_ptr);
     40    CRDBGPTR_CHECKNZ(&cr_server.return_ptr);
     41    crMemcpy( &(rb->writeback_ptr), &(cr_server.writeback_ptr), sizeof( rb->writeback_ptr ) );
     42    crMemcpy( &(rb->readback_ptr), &(cr_server.return_ptr), sizeof( rb->readback_ptr ) );
     43    crMemcpy( rb+1, payload, payload_len );
     44    crNetSend( cr_server.curClient->conn, NULL, rb, msg_len );
    5545    CRDBGPTR_SETZ(&cr_server.writeback_ptr);
    5646    CRDBGPTR_SETZ(&cr_server.return_ptr);
     47    crFree( rb );
    5748}
    5849"""
    5950
    6051keys = apiutil.GetDispatchedFunctions(sys.argv[1]+"/APIspec.txt")
    6152
    6253for func_name in keys:
  • VirtualBox-5.0.0_BETA2/src/VBox/HostServices//SharedOpenGL/crserverlib/server_stream.c

    diff -uNr -U 6 vbox-orig/VirtualBox-5.0.0_BETA2/src/VBox/HostServices//SharedOpenGL/crserverlib/server_stream.c /home/alexey/VirtualBox-5.0.0_BETA2/src/VBox/HostServices//SharedOpenGL/crserverlib/server_stream.c
    old new  
    547547    return VINF_SUCCESS;
    548548}
    549549
    550550static void crServerPendProcess(CRConnection *conn)
    551551{
    552552    CR_SERVER_PENDING_MSG *pIter, *pNext;
    553 
    554     cr_server.fProcessingPendedCommands = GL_TRUE;
    555 
    556553    RTListForEachSafe(&conn->PendingMsgList, pIter, pNext, CR_SERVER_PENDING_MSG, Node)
    557554    {
    558555        CRMessage *msg = &pIter->Msg;
    559556        const CRMessageOpcodes *msg_opcodes;
    560557        int opcodeBytes;
    561558        const char *data_ptr;
     
    573570                 data_ptr - 1,             /* first command's opcode */
    574571                 msg_opcodes->numOpcodes,  /* how many opcodes */
    575572                 &(cr_server.dispatch));   /* the CR dispatch table */
    576573
    577574        RTMemFree(pIter);
    578575    }
    579 
    580     cr_server.fProcessingPendedCommands = GL_FALSE;
    581576}
    582577
    583578/**
    584579 * This function takes the given message (which should be a buffer of
    585580 * rendering commands) and executes it.
    586581 */
     
    651646            else
    652647                WARN(("Pend List is NOT empty, drain the current list, and ignore this command"));
    653648
    654649            crServerPendProcess(conn);
    655650            break;
    656651        }
    657         case CR_UNPACK_BUFFER_TYPE_CMDBLOCK_FLUSH: /* just flush for now */
    658         {
    659             CrPMgrClearRegionsGlobal(); /* clear regions to ensure we don't do MakeCurrent and friends */
    660             crServerPendProcess(conn);
    661             Assert(RTListIsEmpty(&conn->PendingMsgList));
    662             break;
    663         }
    664652        case CR_UNPACK_BUFFER_TYPE_CMDBLOCK_END:
    665653        {
    666 //            CRASSERT(!RTListIsEmpty(&conn->PendingMsgList));
     654            CRASSERT(!RTListIsEmpty(&conn->PendingMsgList));
    667655            crServerPendProcess(conn);
    668656            Assert(RTListIsEmpty(&conn->PendingMsgList));
    669657            break;
    670658        }
    671659        default:
    672660            WARN(("unsupported buffer type"));
  • VirtualBox-5.0.0_BETA2/src/VBox/HostServices//SharedOpenGL/crserverlib/server_window.c

    diff -uNr -U 6 vbox-orig/VirtualBox-5.0.0_BETA2/src/VBox/HostServices//SharedOpenGL/crserverlib/server_window.c /home/alexey/VirtualBox-5.0.0_BETA2/src/VBox/HostServices//SharedOpenGL/crserverlib/server_window.c
    old new  
    3232    if (cr_server.fVisualBitsDefault)
    3333        realVisBits = cr_server.fVisualBitsDefault;
    3434
    3535#ifdef RT_OS_DARWIN
    3636    if (fGuestWindow)
    3737    {
    38         CRMuralInfo *dummy = crServerGetDummyMural(realVisBits);
     38        CRMuralInfo *dummy = crServerGetDummyMural(visBits);
    3939        if (!dummy)
    4040        {
    4141            WARN(("crServerGetDummyMural failed"));
    4242            return -1;
    4343        }
    4444        spuWindow = dummy->spuWindow;
    4545        mural->fIsDummyRefference = GL_TRUE;
    46 
    47         dims[0] = dummy->width;
    48         dims[1] = dummy->height;
    4946    }
    5047    else
    5148#endif
    5249    {
    5350        /*
    5451         * Have first SPU make a new window.
    5552         */
    5653        spuWindow = cr_server.head_spu->dispatch_table.WindowCreate( dpyName, realVisBits );
    5754        if (spuWindow < 0) {
    5855            return spuWindow;
    5956        }
    6057        mural->fIsDummyRefference = GL_FALSE;
    61 
    62         /* get initial window size */
    63         cr_server.head_spu->dispatch_table.GetChromiumParametervCR(GL_WINDOW_SIZE_CR, spuWindow, GL_INT, 2, dims);
    6458    }
    6559
     60    /* get initial window size */
     61    cr_server.head_spu->dispatch_table.GetChromiumParametervCR(GL_WINDOW_SIZE_CR, spuWindow, GL_INT, 2, dims);
     62
    6663    defaultMural = (CRMuralInfo *) crHashtableSearch(cr_server.muralTable, 0);
    6764    CRASSERT(defaultMural);
    6865    mural->gX = 0;
    6966    mural->gY = 0;
    7067    mural->width = dims[0];
    7168    mural->height = dims[1];
  • VirtualBox-5.0.0_BETA2/src/VBox/HostServices//SharedOpenGL/Makefile.kmk

    diff -uNr -U 6 vbox-orig/VirtualBox-5.0.0_BETA2/src/VBox/HostServices//SharedOpenGL/Makefile.kmk /home/alexey/VirtualBox-5.0.0_BETA2/src/VBox/HostServices//SharedOpenGL/Makefile.kmk
    old new  
    11# $Id: Makefile.kmk $
    22## @file
    33# Sub-Makefile for the Shared OpenGL Host Service.
    44#
    55
    66#
    7 # Copyright (C) 2008-2014 Oracle Corporation
     7# Copyright (C) 2008-2012 Oracle Corporation
    88#
    99# This file is part of VirtualBox Open Source Edition (OSE), as
    1010# available from http://www.virtualbox.org. This file is free software;
    1111# you can redistribute it and/or modify it under the terms of the GNU
    1212# General Public License (GPL) as published by the Free Software
    1313# Foundation, in version 2 as it comes in the "COPYING" file of the
     
    371371        render/VBoxOGLrenderspu.rc
    372372VBoxOGLrenderspu_SOURCES.linux   = render/renderspu_glx.c
    373373VBoxOGLrenderspu_SOURCES.solaris = render/renderspu_glx.c
    374374VBoxOGLrenderspu_SOURCES.freebsd = render/renderspu_glx.c
    375375VBoxOGLrenderspu_OBJCFLAGS.darwin = -Wno-shadow
    376376VBoxOGLrenderspu_SOURCES.darwin  = \
    377         OpenGLTest/OpenGLTestDarwin.cpp \
    378377        render/renderspu_cocoa.c \
    379378        render/renderspu_cocoa_helper.m
    380379ifdef VBOX_WITH_CRHGSMI
    381380VBoxOGLrenderspu_DEFS += VBOX_WITH_CRHGSMI
    382381endif
    383382ifdef VBOX_WITH_VDMA
    384383VBoxOGLrenderspu_DEFS += VBOX_WITH_VDMA
    385384endif
    386 VBoxOGLrenderspu_LDFLAGS.darwin += -install_name $(VBOX_DYLD_EXECUTABLE_PATH)/VBoxOGLrenderspu.dylib -framework IOKit
     385VBoxOGLrenderspu_LDFLAGS.darwin += -install_name $(VBOX_DYLD_EXECUTABLE_PATH)/VBoxOGLrenderspu.dylib
    387386VBoxOGLrenderspu_LIBS = \
    388387        $(PATH_STAGE_LIB)/VBoxOGLhostspuload$(VBOX_SUFF_LIB) \
    389388        $(VBOX_LIB_OGL_HOSTCRUTIL) \
    390389        $(LIB_RUNTIME)
    391390if1of ($(KBUILD_TARGET), freebsd linux netbsd openbsd solaris) # the X11 gang
    392391 VBoxOGLrenderspu_LIBS += \
  • VirtualBox-5.0.0_BETA2/src/VBox/HostServices//SharedOpenGL/render/renderspu.c

    diff -uNr -U 6 vbox-orig/VirtualBox-5.0.0_BETA2/src/VBox/HostServices//SharedOpenGL/render/renderspu.c /home/alexey/VirtualBox-5.0.0_BETA2/src/VBox/HostServices//SharedOpenGL/render/renderspu.c
    old new  
    312312
    313313    crHashtableDelete(render_spu.contextTable, ctx, NULL);
    314314
    315315    renderspuContextMarkDeletedAndRelease(context);
    316316}
    317317
    318 WindowInfo* renderspuWinCreate(GLint visBits, GLint id)
    319 {
    320     WindowInfo* window = (WindowInfo *)crAlloc(sizeof (*window));
    321     if (!window)
    322     {
    323         crWarning("crAlloc failed");
    324         return NULL;
    325     }
    326 
    327     if (!renderspuWinInit(window, NULL, visBits, id))
    328     {
    329         crWarning("renderspuWinInit failed");
    330         crFree(window);
    331         return NULL;
    332     }
    333 
    334     return window;
    335 }
    336 
    337 void renderspuWinTermOnShutdown(WindowInfo *window)
    338 {
    339     renderspuVBoxCompositorSet(window, NULL);
    340     renderspuVBoxPresentBlitterCleanup(window);
    341     window->BltInfo.Base.id = -1;
    342     renderspu_SystemDestroyWindow( window );
    343 }
    344 
    345 static void renderspuCheckCurrentCtxWindowCB(unsigned long key, void *data1, void *data2)
    346 {
    347     ContextInfo *pCtx = (ContextInfo *) data1;
    348     WindowInfo *pWindow = data2;
    349     (void) key;
    350 
    351     if (pCtx->currentWindow==pWindow)
    352     {
    353         WindowInfo* pDummy = renderspuGetDummyWindow(pCtx->BltInfo.Base.visualBits);
    354         if (pDummy)
    355         {
    356             renderspuPerformMakeCurrent(pDummy, 0, pCtx);
    357         }
    358         else
    359         {
    360             crWarning("failed to get dummy window");
    361             renderspuMakeCurrent(CR_RENDER_DEFAULT_WINDOW_ID, 0, pCtx->BltInfo.Base.id);
    362         }
    363     }
    364 }
    365 
    366 void renderspuWinTerm( WindowInfo *window )
    367 {
    368     if (!renderspuWinIsTermed(window))
    369     {
    370 
    371     GET_CONTEXT(pOldCtx);
    372     WindowInfo * pOldWindow = pOldCtx ? pOldCtx->currentWindow : NULL;
    373     CRASSERT(!pOldCtx == !pOldWindow);
    374     /* ensure no concurrent draws can take place */
    375     renderspuWinTermOnShutdown(window);
    376     /* check if this window is bound to some ctx. Note: window pointer is already freed here */
    377     crHashtableWalk(render_spu.contextTable, renderspuCheckCurrentCtxWindowCB, window);
    378     /* restore current context */
    379     {
    380         GET_CONTEXT(pNewCtx);
    381         WindowInfo * pNewWindow = pNewCtx ? pNewCtx->currentWindow : NULL;
    382         CRASSERT(!pNewCtx == !pNewWindow);
    383 
    384         if (pOldWindow == window)
    385             renderspuMakeCurrent(CR_RENDER_DEFAULT_WINDOW_ID, 0, CR_RENDER_DEFAULT_CONTEXT_ID);
    386         else if (pNewCtx != pOldCtx || pOldWindow != pNewWindow)
    387         {
    388             if (pOldCtx)
    389                 renderspuPerformMakeCurrent(pOldWindow, 0, pOldCtx);
    390             else
    391                 renderspuMakeCurrent(CR_RENDER_DEFAULT_WINDOW_ID, 0, CR_RENDER_DEFAULT_CONTEXT_ID);
    392         }
    393     }
    394 
    395     }
    396 }
    397 
    398 void renderspuWinCleanup(WindowInfo *window)
    399 {
    400     renderspuWinTerm( window );
    401     RTCritSectDelete(&window->CompositorLock);
    402 }
    403 
    404 void renderspuWinDestroy(WindowInfo *window)
    405 {
    406     renderspuWinCleanup(window);
    407     crFree(window);
    408 }
    409 
    410318WindowInfo* renderspuGetDummyWindow(GLint visBits)
    411319{
    412320    WindowInfo *window = (WindowInfo *) crHashtableSearch(render_spu.dummyWindowTable, visBits);
    413321    if (!window)
    414322    {
    415         window = renderspuWinCreate(visBits, -1);
     323        window = (WindowInfo *)crAlloc(sizeof (*window));
    416324        if (!window)
    417325        {
    418             WARN(("renderspuWinCreate failed"));
     326            crWarning("crAlloc failed");
     327            return NULL;
     328        }
     329
     330        if (!renderspuWindowInit(window, NULL, visBits, -1))
     331        {
     332            crWarning("renderspuWindowInit failed");
     333            crFree(window);
    419334            return NULL;
    420335        }
    421336
    422337        crHashtableAdd(render_spu.dummyWindowTable, visBits, window);
    423338    }
    424339
     
    527442        return;
    528443    }
    529444
    530445    renderspuPerformMakeCurrent(window, nativeWindow, context);
    531446}
    532447
    533 GLboolean renderspuWinInitWithVisual( WindowInfo *window, VisualInfo *visual, GLboolean showIt, GLint id )
     448GLboolean renderspuWindowInitWithVisual( WindowInfo *window, VisualInfo *visual, GLboolean showIt, GLint id )
    534449{
    535450    crMemset(window, 0, sizeof (*window));
    536451    RTCritSectInit(&window->CompositorLock);
    537452    window->pCompositor = NULL;
    538453
    539454    window->BltInfo.Base.id = id;
     
    562477            window->title = crStrdup(render_spu.window_title);
    563478        }
    564479    }
    565480       
    566481    window->BltInfo.Base.visualBits = visual->visAttribs;
    567482   
    568     window->cRefs = 1;
    569483   
    570484    /*
    571485    crDebug("Render SPU: Creating window (visBits=0x%x, id=%d)", visBits, window->BltInfo.Base.id);
    572486    */
    573487    /* Have GLX/WGL/AGL create the window */
    574488    if (!renderspu_SystemVBoxCreateWindow( visual, showIt, window ))
     
    583497    return GL_TRUE;
    584498}
    585499
    586500/*
    587501 * Window functions
    588502 */
    589 GLboolean renderspuWinInit(WindowInfo *pWindow, const char *dpyName, GLint visBits, GLint id)
     503GLboolean renderspuWindowInit(WindowInfo *pWindow, const char *dpyName, GLint visBits, GLint id)
    590504{
    591505    VisualInfo *visual;
    592506
    593507    crMemset(pWindow, 0, sizeof (*pWindow));
    594508
    595509    if (!dpyName || crStrlen(render_spu.display_string) > 0)
     
    603517    }
    604518
    605519    /*
    606520    crDebug("Render SPU: Creating window (visBits=0x%x, id=%d)", visBits, window->BltInfo.Base.id);
    607521    */
    608522    /* Have GLX/WGL/AGL create the window */
    609     if (!renderspuWinInitWithVisual( pWindow, visual, 0, id ))
     523    if (!renderspuWindowInitWithVisual( pWindow, visual, 0, id ))
    610524    {
    611525        crWarning( "Render SPU: Couldn't create a window, renderspu_SystemCreateWindow failed" );
    612526        return GL_FALSE;
    613527    }
    614528
    615529    return GL_TRUE;
     
    635549            crWarning("the specified window key %d is in use", id);
    636550            return -1;
    637551        }
    638552    }
    639553
    640554    /* Allocate WindowInfo */
    641     window = renderspuWinCreate(visBits, id);
    642 
     555    window = (WindowInfo *) crCalloc(sizeof(WindowInfo));
    643556    if (!window)
    644557    {
    645         crWarning("renderspuWinCreate failed");
     558        crWarning( "Render SPU: Couldn't create a window" );
     559        return -1;
     560    }
     561   
     562    if (!renderspuWindowInit(window, dpyName, visBits, id))
     563    {
     564        crWarning("renderspuWindowInit failed");
    646565        crFree(window);
    647566        return -1;
    648567    }
    649568
    650569    crHashtableAdd(render_spu.windowTable, id, window);
    651570    return window->BltInfo.Base.id;
     
    654573GLint RENDER_APIENTRY
    655574renderspuWindowCreate( const char *dpyName, GLint visBits )
    656575{
    657576    return renderspuWindowCreateEx( dpyName, visBits, 0 );
    658577}
    659578
    660 void renderspuWinReleaseCb(void*pvWindow)
     579static void renderspuCheckCurrentCtxWindowCB(unsigned long key, void *data1, void *data2)
    661580{
    662     renderspuWinRelease((WindowInfo*)pvWindow);
     581    ContextInfo *pCtx = (ContextInfo *) data1;
     582    WindowInfo *pWindow = data2;
     583    (void) key;
     584
     585    if (pCtx->currentWindow==pWindow)
     586    {
     587        WindowInfo* pDummy = renderspuGetDummyWindow(pCtx->BltInfo.Base.visualBits);
     588        if (pDummy)
     589        {
     590            renderspuPerformMakeCurrent(pDummy, 0, pCtx);
     591        }
     592        else
     593        {
     594            crWarning("failed to get dummy window");
     595            renderspuMakeCurrent(CR_RENDER_DEFAULT_WINDOW_ID, 0, pCtx->BltInfo.Base.id);
     596        }
     597    }
     598}
     599
     600void renderspuWindowTermBase( WindowInfo *window )
     601{
     602    renderspuVBoxCompositorSet(window, NULL);
     603    renderspuVBoxPresentBlitterCleanup(window);
     604    renderspu_SystemDestroyWindow( window );
     605    RTCritSectDelete(&window->CompositorLock);
     606}
     607
     608void renderspuWindowTerm( WindowInfo *window )
     609{
     610    GET_CONTEXT(pOldCtx);
     611    WindowInfo * pOldWindow = pOldCtx ? pOldCtx->currentWindow : NULL;
     612    CRASSERT(!pOldCtx == !pOldWindow);
     613    /* ensure no concurrent draws can take place */
     614    renderspuWindowTermBase(window);
     615    /* check if this window is bound to some ctx. Note: window pointer is already freed here */
     616    crHashtableWalk(render_spu.contextTable, renderspuCheckCurrentCtxWindowCB, window);
     617    /* restore current context */
     618    {
     619        GET_CONTEXT(pNewCtx);
     620        WindowInfo * pNewWindow = pNewCtx ? pNewCtx->currentWindow : NULL;
     621        CRASSERT(!pNewCtx == !pNewWindow);
     622
     623        if (pOldWindow == window)
     624            renderspuMakeCurrent(CR_RENDER_DEFAULT_WINDOW_ID, 0, CR_RENDER_DEFAULT_CONTEXT_ID);
     625        else if (pNewCtx != pOldCtx || pOldWindow != pNewWindow)
     626        {
     627            if (pOldCtx)
     628                renderspuPerformMakeCurrent(pOldWindow, 0, pOldCtx);
     629            else
     630                renderspuMakeCurrent(CR_RENDER_DEFAULT_WINDOW_ID, 0, CR_RENDER_DEFAULT_CONTEXT_ID);
     631        }
     632    }
    663633}
    664634
    665635void
    666636RENDER_APIENTRY renderspuWindowDestroy( GLint win )
    667637{
    668638    WindowInfo *window;
     
    673643        crWarning("request to destroy a default mural, ignoring");
    674644        return;
    675645    }
    676646    window = (WindowInfo *) crHashtableSearch(render_spu.windowTable, win);
    677647    if (window) {
    678648        crDebug("Render SPU: Destroy window (%d)", win);
    679         /* since os-specific backend can hold its own reference to the window object (e.g. on OSX),
    680          * we need to explicitly issue a window destroy command
    681          * this ensures the backend will eventually release the reference,
    682          * the window object itself will remain valid until its ref count reaches zero */
    683         renderspuWinTerm( window );
     649        renderspuWindowTerm( window );
    684650
    685651        /* remove window info from hash table, and free it */
    686         crHashtableDelete(render_spu.windowTable, win, renderspuWinReleaseCb);
     652        crHashtableDelete(render_spu.windowTable, win, crFree);
    687653
    688654    }
    689655    else {
    690656        crDebug("Render SPU: Attempt to destroy invalid window (%d)", win);
    691657    }
    692658}
     
    709675            renderspu_SystemWindowSize( window, w, h );
    710676            window->BltInfo.width  = w;
    711677            window->BltInfo.height = h;
    712678        }
    713679    }
    714680    else {
    715         WARN(("Render SPU: Attempt to resize invalid window (%d)", win));
     681        crDebug("Render SPU: Attempt to resize invalid window (%d)", win);
    716682    }
    717683}
    718684
    719685
    720686static void RENDER_APIENTRY
    721687renderspuWindowPosition( GLint win, GLint x, GLint y )
     
    788754             */
    789755            flag = 0;
    790756        }
    791757       
    792758        visible = !!flag;
    793759       
    794 //        if (window->visible != visible)
     760        if (window->visible != visible)
    795761        {
    796762            renderspu_SystemShowWindow( window, visible );
    797763            window->visible = visible;
    798764        }
    799765    }
    800766    else {
     
    14741440        crWarning("Unhandled target in renderspuChromiumParameterfCR()");
    14751441        break;
    14761442    }
    14771443#endif
    14781444}
    14791445
    1480 bool renderspuCalloutAvailable()
    1481 {
    1482     return render_spu.pfnClientCallout != NULL;
    1483 }
    1484 
    1485 bool renderspuCalloutClient(PFNVCRSERVER_CLIENT_CALLOUT_CB pfnCb, void *pvCb)
    1486 {
    1487     if (render_spu.pfnClientCallout)
    1488     {
    1489         render_spu.pfnClientCallout(pfnCb, pvCb);
    1490         return true;
    1491     }
    1492     return false;
    1493 }
    14941446
    14951447static void RENDER_APIENTRY
    14961448renderspuChromiumParametervCR(GLenum target, GLenum type, GLsizei count,
    14971449                                                            const GLvoid *values)
    14981450{
    14991451    int client_num;
    15001452    unsigned short port;
    15011453    CRMessage *msg, pingback;
    15021454    unsigned char *privbuf = NULL;
    15031455
    15041456    switch (target) {
    1505         case GL_HH_SET_CLIENT_CALLOUT:
    1506             render_spu.pfnClientCallout = (PFNVCRSERVER_CLIENT_CALLOUT)values;
    1507             break;
     1457
    15081458        case GL_GATHER_CONNECT_CR:
    15091459            if (render_spu.gather_userbuf_size)
    15101460                privbuf = (unsigned char *)crAlloc(1024*768*4);
    15111461
    15121462            port = ((GLint *) values)[0];
    15131463
  • VirtualBox-5.0.0_BETA2/src/VBox/HostServices//SharedOpenGL/render/renderspu_glx.c

    diff -uNr -U 6 vbox-orig/VirtualBox-5.0.0_BETA2/src/VBox/HostServices//SharedOpenGL/render/renderspu_glx.c /home/alexey/VirtualBox-5.0.0_BETA2/src/VBox/HostServices//SharedOpenGL/render/renderspu_glx.c
    old new  
    400400        dpyName = renderspuGetDisplayName();
    401401        if (dpyName)
    402402        {
    403403            GLboolean bRc = renderspuInitVisual(&render_spu.WinCmdVisual, dpyName, render_spu.default_visual);
    404404            if (bRc)
    405405            {
    406                 bRc = renderspuWinInitWithVisual(&render_spu.WinCmdWindow, &render_spu.WinCmdVisual, GL_FALSE, CR_RENDER_WINCMD_ID);
     406                bRc = renderspuWindowInitWithVisual(&render_spu.WinCmdWindow, &render_spu.WinCmdVisual, GL_FALSE, CR_RENDER_WINCMD_ID);
    407407                if (bRc)
    408408                {
    409409                    XSelectInput(render_spu.WinCmdVisual.dpy, render_spu.WinCmdWindow.window, StructureNotifyMask);
    410410                    render_spu.WinCmdAtom = XInternAtom(render_spu.WinCmdVisual.dpy, "VBoxWinCmd", False);
    411411                    CRASSERT(render_spu.WinCmdAtom != None);
    412412                    return VINF_SUCCESS;
    413413                }
    414414                else
    415415                {
    416                     crError("renderspuWinInitWithVisual failed");
     416                    crError("renderspuWindowInitWithVisual failed");
    417417                }
    418418                /* there is no visual destroy impl currently
    419419                 * @todo: implement */
    420420            }
    421421            else
    422422            {
     
    438438}
    439439
    440440static void renderspuWinCmdTerm()
    441441{
    442442    /* the window is not in the table, this will just ensure the key is freed */
    443443    crHashtableDelete(render_spu.windowTable, CR_RENDER_WINCMD_ID, NULL);
    444     renderspuWinCleanup(&render_spu.WinCmdWindow);
     444    renderspuWindowTerm(&render_spu.WinCmdWindow);
    445445    crFreeHashtable(render_spu.pWinToInfoTable, NULL);
    446446    /* we do not have visual destroy functionality
    447447     * @todo implement */
    448448}
    449449
    450450
     
    536536                    {
    537537                        const struct VBOXVR_SCR_COMPOSITOR * pCompositor;
    538538
    539539                        pCompositor = renderspuVBoxCompositorAcquire(pWindow);
    540540                        if (pCompositor)
    541541                        {
    542                             renderspuVBoxPresentCompositionGeneric(pWindow, pCompositor, NULL, 0, false);
     542                            renderspuVBoxPresentCompositionGeneric(pWindow, pCompositor, NULL, 0, true);
    543543                            renderspuVBoxCompositorRelease(pWindow);
    544544                        }
    545545                    }
    546546                }
    547547                break;
    548548            }
     
    19211921            XUnmapWindow( window->visual->dpy, window->window );
    19221922            XSync(window->visual->dpy, 0);
    19231923        }
    19241924    }
    19251925}
    19261926
    1927 #define CR_RENDER_FORCE_PRESENT_MAIN_THREAD
    1928 
    19291927void renderspu_SystemVBoxPresentComposition( WindowInfo *window, const struct VBOXVR_SCR_COMPOSITOR_ENTRY *pChangedEntry )
    19301928{
    19311929    /* the CR_RENDER_FORCE_PRESENT_MAIN_THREAD is actually inherited from cocoa backend impl,
    19321930     * here it forces rendering in WinCmd thread rather than a Main thread.
    19331931     * it is used for debugging only in any way actually.
    19341932     * @todo: change to some more generic macro name */
     
    19441942    else if (rc == VERR_SEM_BUSY)
    19451943#endif
    19461944    {
    19471945        Status status;
    19481946        XEvent event;
    19491947        render_spu.self.Flush();
    1950 //        renderspuVBoxPresentBlitterEnsureCreated(window, 0);
     1948        renderspuVBoxPresentBlitterEnsureCreated(window, 0);
    19511949
    19521950        crMemset(&event, 0, sizeof (event));
    19531951        event.type = Expose;
    19541952        event.xexpose.window = window->window;
    19551953        event.xexpose.width = window->BltInfo.width;
    19561954        event.xexpose.height = window->BltInfo.height;
    19571955        status = XSendEvent(render_spu.pCommunicationDisplay, render_spu.WinCmdWindow.window, False, 0, &event);
    19581956        if (!status)
    19591957        {
    1960             WARN(("XSendEvent returned null"));
     1958            Assert(0);
     1959            crWarning("XSendEvent returned null");
    19611960        }
    19621961        XFlush(render_spu.pCommunicationDisplay);
    19631962    }
    19641963#ifndef CR_RENDER_FORCE_PRESENT_MAIN_THREAD
    19651964    else
    19661965    {
    19671966        /* this is somewhat we do not expect */
    1968         WARN(("renderspuVBoxCompositorTryAcquire failed rc %d", rc));
     1967        crWarning("renderspuVBoxCompositorTryAcquire failed rc %d", rc);
    19691968    }
    19701969#endif
    19711970}
    19721971
    19731972static void
    19741973MarkWindow(WindowInfo *w)
  • VirtualBox-5.0.0_BETA2/src/VBox/HostServices//SharedOpenGL/render/renderspu.h

    diff -uNr -U 6 vbox-orig/VirtualBox-5.0.0_BETA2/src/VBox/HostServices//SharedOpenGL/render/renderspu.h /home/alexey/VirtualBox-5.0.0_BETA2/src/VBox/HostServices//SharedOpenGL/render/renderspu.h
    old new  
    9494    int x, y;
    9595//    int width, height;
    9696//    int id; /**< integer window ID */
    9797    CR_BLITTER_WINDOW BltInfo;
    9898
    9999    VisualInfo *visual;
    100 
    101     volatile uint32_t cRefs;
    102 
    103100    GLboolean mapPending;
    104101    GLboolean visible;
    105102    GLboolean everCurrent; /**< has this window ever been bound? */
    106103    char *title;
    107104
    108105    const VBOXVR_SCR_COMPOSITOR *pCompositor;
     
    218215typedef GLhandleARB (*PFNGET_HANDLE)(GLenum pname);
    219216typedef void (*PFNGET_INFO_LOG)( GLhandleARB obj, GLsizei maxLength, GLsizei * length, GLcharARB * infoLog );
    220217typedef void (*PFNGET_OBJECT_PARAMETERFV)( GLhandleARB obj, GLenum pname, GLfloat * params );
    221218typedef void (*PFNGET_OBJECT_PARAMETERIV)( GLhandleARB obj, GLenum pname, GLint * params );
    222219#endif
    223220
    224 typedef DECLCALLBACKPTR(void, PFNVCRSERVER_CLIENT_CALLOUT_CB)(void *pvCb);
    225 typedef DECLCALLBACKPTR(void, PFNVCRSERVER_CLIENT_CALLOUT)(PFNVCRSERVER_CLIENT_CALLOUT_CB pfnCb, void*pvCb);
    226 
    227 
    228221/**
    229222 * Renderspu state info
    230223 */
    231224typedef struct {
    232225    SPUDispatchTable self;
    233226    int id;
     
    291284    char *swap_master_url;
    292285    CRConnection **swap_conns;
    293286
    294287    SPUDispatchTable blitterDispatch;
    295288    CRHashTable *blitterTable;
    296289
    297     PFNVCRSERVER_CLIENT_CALLOUT pfnClientCallout;
    298 
    299290#ifdef USE_OSMESA
    300291    /** Off screen rendering hooks.  */
    301292    int use_osmesa;
    302293
    303294    OSMesaContext (*OSMesaCreateContext)( GLenum format, OSMesaContext sharelist );
    304295    GLboolean (* OSMesaMakeCurrent)( OSMesaContext ctx,
     
    434425        bool fRedraw);
    435426extern PCR_BLITTER renderspuVBoxPresentBlitterGet( WindowInfo *window );
    436427void renderspuVBoxPresentBlitterCleanup( WindowInfo *window );
    437428extern int renderspuVBoxPresentBlitterEnter( PCR_BLITTER pBlitter, int32_t i32MakeCurrentUserData );
    438429extern PCR_BLITTER renderspuVBoxPresentBlitterGetAndEnter( WindowInfo *window, int32_t i32MakeCurrentUserData, bool fRedraw );
    439430extern PCR_BLITTER renderspuVBoxPresentBlitterEnsureCreated( WindowInfo *window, int32_t i32MakeCurrentUserData );
    440 WindowInfo* renderspuWinCreate(GLint visBits, GLint id);
    441 void renderspuWinTermOnShutdown(WindowInfo *window);
    442 void renderspuWinTerm( WindowInfo *window );
    443 void renderspuWinCleanup(WindowInfo *window);
    444 void renderspuWinDestroy(WindowInfo *window);
    445 GLboolean renderspuWinInitWithVisual( WindowInfo *window, VisualInfo *visual, GLboolean showIt, GLint id );
    446 GLboolean renderspuWinInit(WindowInfo *pWindow, const char *dpyName, GLint visBits, GLint id);
    447 
    448 DECLINLINE(void) renderspuWinRetain(WindowInfo *window)
    449 {
    450     ASMAtomicIncU32(&window->cRefs);
    451 }
    452 
    453 DECLINLINE(bool) renderspuWinIsTermed(WindowInfo *window)
    454 {
    455     return window->BltInfo.Base.id < 0;
    456 }
    457 
    458 DECLINLINE(void) renderspuWinRelease(WindowInfo *window)
    459 {
    460     uint32_t cRefs = ASMAtomicDecU32(&window->cRefs);
    461     if (!cRefs)
    462     {
    463         renderspuWinDestroy(window);
    464     }
    465 }
    466 
     431void renderspuWindowTermBase( WindowInfo *window );
     432extern void renderspuWindowTerm( WindowInfo *window );
    467433extern WindowInfo* renderspuGetDummyWindow(GLint visBits);
    468434extern void renderspuPerformMakeCurrent(WindowInfo *window, GLint nativeWindow, ContextInfo *context);
     435extern GLboolean renderspuWindowInit(WindowInfo *pWindow, const char *dpyName, GLint visBits, GLint id);
     436extern GLboolean renderspuWindowInitWithVisual( WindowInfo *window, VisualInfo *visual, GLboolean showIt, GLint id );
    469437extern GLboolean renderspuInitVisual(VisualInfo *pVisInfo, const char *displayName, GLbitfield visAttribs);
    470438extern void renderspuVBoxCompositorBlit ( const struct VBOXVR_SCR_COMPOSITOR * pCompositor, PCR_BLITTER pBlitter);
    471439extern void renderspuVBoxCompositorBlitStretched ( const struct VBOXVR_SCR_COMPOSITOR * pCompositor, PCR_BLITTER pBlitter, GLfloat scaleX, GLfloat scaleY);
    472440extern GLint renderspuCreateContextEx(const char *dpyName, GLint visBits, GLint id, GLint shareCtx);
    473441extern GLint renderspuWindowCreateEx( const char *dpyName, GLint visBits, GLint id );
    474442
     
    485453
    486454ContextInfo * renderspuDefaultSharedContextAcquire();
    487455void renderspuDefaultSharedContextRelease(ContextInfo * pCtx);
    488456uint32_t renderspuContextRelease(ContextInfo *context);
    489457uint32_t renderspuContextRetain(ContextInfo *context);
    490458
    491 bool renderspuCalloutAvailable();
    492 bool renderspuCalloutClient(PFNVCRSERVER_CLIENT_CALLOUT_CB pfnCb, void *pvCb);
    493 
    494 
    495459#ifdef __cplusplus
    496460extern "C" {
    497461#endif
    498462DECLEXPORT(void) renderspuSetWindowId(uint64_t winId);
    499463DECLEXPORT(void) renderspuReparentWindow(GLint window);
    500464DECLEXPORT(void) renderspuSetUnscaledHiDPI(bool fEnable);
  • VirtualBox-5.0.0_BETA2/src/VBox/HostServices//SharedOpenGL/render/renderspu_init.c

    diff -uNr -U 6 vbox-orig/VirtualBox-5.0.0_BETA2/src/VBox/HostServices//SharedOpenGL/render/renderspu_init.c /home/alexey/VirtualBox-5.0.0_BETA2/src/VBox/HostServices//SharedOpenGL/render/renderspu_init.c
    old new  
    425425    renderspuContextMarkDeletedAndRelease(context);
    426426}
    427427
    428428static void DeleteWindowCallback( void *data )
    429429{
    430430    WindowInfo *window = (WindowInfo *) data;
    431     renderspuWinTermOnShutdown(window);
    432     renderspuWinRelease(window);
     431    renderspuWindowTermBase(window);
     432    crFree(window);
    433433}
    434434
    435435static void DeleteBlitterCallback( void *data )
    436436{
    437437    PCR_BLITTER pBlitter = (PCR_BLITTER) data;
    438438    CrBltTerm(pBlitter);
  • VirtualBox-5.0.0_BETA2/src/VBox/HostServices//SharedOpenGL/unpacker/unpack.py

    diff -uNr -U 6 vbox-orig/VirtualBox-5.0.0_BETA2/src/VBox/HostServices//SharedOpenGL/unpacker/unpack.py /home/alexey/VirtualBox-5.0.0_BETA2/src/VBox/HostServices//SharedOpenGL/unpacker/unpack.py
    old new  
    2626DECLEXPORT(const unsigned char *) cr_unpackData = NULL;
    2727SPUDispatchTable cr_unpackDispatch;
    2828
    2929static void crUnpackExtend(void);
    3030static void crUnpackExtendDbg(void);
    3131
    32 #if 0 //def DEBUG_misha
    33 //# define CR_UNPACK_DEBUG_OPCODES
    34 # define CR_UNPACK_DEBUG_LAST_OPCODES
    35 # define CR_UNPACK_DEBUG_PREV_OPCODES
    36 #endif
    37 
    38 #ifdef CR_UNPACK_DEBUG_PREV_OPCODES
    39 static GLenum g_VBoxDbgCrPrevOpcode = 0;
    40 static GLenum g_VBoxDbgCrPrevExtendOpcode = 0;
    41 #endif
     32/*#define CR_UNPACK_DEBUG_OPCODES*/
     33/*#define CR_UNPACK_DEBUG_LAST_OPCODES*/
    4234"""
    4335
    4436nodebug_opcodes = [
    4537    "CR_MULTITEXCOORD2FARB_OPCODE",
    4638    "CR_VERTEX3F_OPCODE",
    4739    "CR_NORMAL3F_OPCODE",
     
    215207}
    216208
    217209CR_UNPACK_BUFFER_TYPE crUnpackGetBufferType(const void *opcodes, unsigned int num_opcodes)
    218210{
    219211    const uint8_t *pu8Codes = (const uint8_t *)opcodes;
    220212
     213    CR_UNPACK_BUFFER_TYPE enmType;
    221214    uint8_t first;
    222215    uint8_t last;
    223216
    224217    if (!num_opcodes)
    225218        return CR_UNPACK_BUFFER_TYPE_GENERIC;
    226219
    227220    first = pu8Codes[0];
    228221    last = pu8Codes[1-(int)num_opcodes];
    229    
    230     switch (last)
    231     {
    232         case CR_CMDBLOCKFLUSH_OPCODE:
    233             return CR_UNPACK_BUFFER_TYPE_CMDBLOCK_FLUSH;
    234         case CR_CMDBLOCKEND_OPCODE:
    235             return (first == CR_CMDBLOCKBEGIN_OPCODE) ? CR_UNPACK_BUFFER_TYPE_GENERIC : CR_UNPACK_BUFFER_TYPE_CMDBLOCK_END;
    236         default:
    237             return (first != CR_CMDBLOCKBEGIN_OPCODE) ? CR_UNPACK_BUFFER_TYPE_GENERIC : CR_UNPACK_BUFFER_TYPE_CMDBLOCK_BEGIN;
    238     }
     222
     223    enmType = (first != CR_CMDBLOCKBEGIN_OPCODE) ? CR_UNPACK_BUFFER_TYPE_GENERIC : CR_UNPACK_BUFFER_TYPE_CMDBLOCK_BEGIN;
     224
     225    if (last != CR_CMDBLOCKEND_OPCODE)
     226        return enmType;
     227
     228    /* last is CMDBLOCKEND*/
     229    return (enmType == CR_UNPACK_BUFFER_TYPE_CMDBLOCK_BEGIN) ? CR_UNPACK_BUFFER_TYPE_GENERIC : CR_UNPACK_BUFFER_TYPE_CMDBLOCK_END;
    239230}
    240231
    241232void crUnpack( const void *data, const void *opcodes,
    242233        unsigned int num_opcodes, SPUDispatchTable *table )
    243234{
    244235    unsigned int i;
     
    260251    {
    261252   
    262253        CRDBGPTR_CHECKZ(writeback_ptr);
    263254        CRDBGPTR_CHECKZ(return_ptr);
    264255   
    265256        /*crDebug(\"Unpacking opcode \%d\", *unpack_opcodes);*/
    266 #ifdef CR_UNPACK_DEBUG_PREV_OPCODES
    267         g_VBoxDbgCrPrevOpcode = *unpack_opcodes;
    268 #endif
    269257        switch( *unpack_opcodes )
    270258        {"""
    271259
    272260#
    273261# Emit switch cases for all unextended opcodes
    274262#
     
    296284                # endif
    297285                    crUnpackExtend();
    298286                #endif
    299287                break;
    300288            case CR_CMDBLOCKBEGIN_OPCODE:
    301289            case CR_CMDBLOCKEND_OPCODE:
    302             case CR_CMDBLOCKFLUSH_OPCODE:
    303290            case CR_NOP_OPCODE:
    304291                INCR_DATA_PTR_NO_ARGS( );
    305292                break;
    306293            default:
    307294                crError( "Unknown opcode: %d", *unpack_opcodes );
    308295                break;
     
    330317            print '}\n'
    331318
    332319print 'static void crUnpackExtend(void)'
    333320print '{'
    334321print '\tGLenum extend_opcode = %s;' % ReadData( 4, 'GLenum' );
    335322print ''
    336 print '#ifdef CR_UNPACK_DEBUG_PREV_OPCODES'
    337 print '\tg_VBoxDbgCrPrevExtendOpcode = extend_opcode;'
    338 print '#endif'
    339 print ''
    340323print '\t/*crDebug(\"Unpacking extended opcode \%d", extend_opcode);*/'
    341324print '\tswitch( extend_opcode )'
    342325print '\t{'
    343326
    344327
    345328#
     
    360343}"""
    361344
    362345print 'static void crUnpackExtendDbg(void)'
    363346print '{'
    364347print '\tGLenum extend_opcode = %s;' % ReadData( 4, 'GLenum' );
    365348print ''
    366 print '#ifdef CR_UNPACK_DEBUG_PREV_OPCODES'
    367 print '\tg_VBoxDbgCrPrevExtendOpcode = extend_opcode;'
    368 print '#endif'
    369 print ''
    370349print '\t/*crDebug(\"Unpacking extended opcode \%d", extend_opcode);*/'
    371350print '\tswitch( extend_opcode )'
    372351print '\t{'
    373352
    374353
    375354#

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