VirtualBox

Ticket #13653: cr_render_force_present_main_thread_runtime.patch

File cr_render_force_present_main_thread_runtime.patch, 2.9 KB (added by Piotr Filiciak, 7 years ago)

CR_RENDER_FORCE_PRESENT_MAIN_THREAD as environment variable

  • src/VBox/HostServices/SharedOpenGL/render/renderspu_glx.c

    diff -dupr VirtualBox-5.1.30.org/src/VBox/HostServices/SharedOpenGL/render/renderspu_glx.c VirtualBox-5.1.30/src/VBox/HostServices/SharedOpenGL/render/renderspu_glx.c
    old new typedef struct  
    4444#define WINDOW_NAME window->title
    4545
    4646static Bool WindowExistsFlag;
     47static Bool CrRenderForcePresentMainThread = True;
    4748
    4849static int
    4950WindowExistsErrorHandler( Display *dpy, XErrorEvent *xerr )
    createWindow( VisualInfo *visual, GLbool  
    11141115        AssertRC(rc);
    11151116    }
    11161117
     1118    /*
     1119     * Runtime CR_RENDER_FORCE_PRESENT_MAIN_THREAD flag
     1120     */
     1121    const char *pEnvCrRenderForcePresentMainThread = crGetenv("CR_RENDER_FORCE_PRESENT_MAIN_THREAD");
     1122    if (pEnvCrRenderForcePresentMainThread != NULL)
     1123    {
     1124        CrRenderForcePresentMainThread = crStrToInt(pEnvCrRenderForcePresentMainThread) != 0 ? True : False;
     1125    }
     1126
    11171127    return GL_TRUE;
    11181128}
    11191129
    renderspu_SystemShowWindow( WindowInfo *  
    19241934    }
    19251935}
    19261936
    1927 #define CR_RENDER_FORCE_PRESENT_MAIN_THREAD
    1928 
    19291937void renderspu_SystemVBoxPresentComposition( WindowInfo *window, const struct VBOXVR_SCR_COMPOSITOR_ENTRY *pChangedEntry )
    19301938{
    19311939    /* the CR_RENDER_FORCE_PRESENT_MAIN_THREAD is actually inherited from cocoa backend impl,
    19321940     * here it forces rendering in WinCmd thread rather than a Main thread.
    19331941     * it is used for debugging only in any way actually.
    19341942     * @todo: change to some more generic macro name */
    1935 #ifndef CR_RENDER_FORCE_PRESENT_MAIN_THREAD
     1943    int rc = VERR_SEM_BUSY;
    19361944    const struct VBOXVR_SCR_COMPOSITOR *pCompositor;
    1937     /* we do not want to be blocked with the GUI thread here, so only draw her eif we are really able to do that w/o bllocking */
    1938     int rc = renderspuVBoxCompositorTryAcquire(window, &pCompositor);
     1945    if (!CrRenderForcePresentMainThread)
     1946    {
     1947        /* we do not want to be blocked with the GUI thread here, so only draw her eif we are really able to do that w/o bllocking */
     1948        rc = renderspuVBoxCompositorTryAcquire(window, &pCompositor);
     1949    }
    19391950    if (RT_SUCCESS(rc))
    19401951    {
    1941         renderspuVBoxPresentCompositionGeneric(window, pCompositor, pChangedEntry, 0, false);
    1942         renderspuVBoxCompositorRelease(window);
     1952            renderspuVBoxPresentCompositionGeneric(window, pCompositor, pChangedEntry, 0, false);
     1953            renderspuVBoxCompositorRelease(window);
    19431954    }
    19441955    else if (rc == VERR_SEM_BUSY)
    1945 #endif
    19461956    {
    19471957        Status status;
    19481958        XEvent event;
    void renderspu_SystemVBoxPresentComposit  
    19611971        }
    19621972        XFlush(render_spu.pCommunicationDisplay);
    19631973    }
    1964 #ifndef CR_RENDER_FORCE_PRESENT_MAIN_THREAD
    19651974    else
    19661975    {
    19671976        /* this is somewhat we do not expect */
    19681977        WARN(("renderspuVBoxCompositorTryAcquire failed rc %d", rc));
    19691978    }
    1970 #endif
    19711979}
    19721980
    19731981static void

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