VirtualBox

Ignore:
Timestamp:
Jun 3, 2013 5:24:51 PM (12 years ago)
Author:
vboxsync
Message:

crOpenGL: more debugging

Location:
trunk/src/VBox/HostServices/SharedOpenGL/crserverlib
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/HostServices/SharedOpenGL/crserverlib/server.h

    r46343 r46368  
    386386void crServerInitTmpCtxDispatch();
    387387
     388//#define VBOX_WITH_CRSERVER_DUMPER
    388389#ifdef VBOX_WITH_CRSERVER_DUMPER
    389390void crServerDumpCheckTerm();
    390391int crServerDumpCheckInit();
    391 void crServerDumpBuffer();
     392void crServerDumpBuffer(int idx);
    392393void crServerDumpTextures();
    393 
    394 #define CR_SERVER_DUMP_F_DRAW_BUFF_ENTER 0x01
    395 #define CR_SERVER_DUMP_F_DRAW_BUFF_LEAVE  0x02
    396 #define CR_SERVER_DUMP_F_DRAW_TEX_ENTER  0x10
    397 #define CR_SERVER_DUMP_F_DRAW_TEX_LEAVE   0x20
    398 
    399 extern int g_CrDbgDumpDraw;
    400 bool crServerDumpFilter(int event);
     394void crServerDumpShader(GLint id);
     395void crServerDumpProgram(GLint id);
     396void crServerDumpCurrentProgram();
     397void crServerDumpFramesCheck();
     398
     399extern unsigned long g_CrDbgDumpDraw;
     400extern unsigned long g_CrDbgDumpDrawFramesSettings;
     401extern unsigned long g_CrDbgDumpDrawFramesAppliedSettings;
     402extern unsigned long g_CrDbgDumpDrawFramesCount;
     403bool crServerDumpFilter(unsigned long event);
     404
     405#define CR_SERVER_DUMP_F_DRAW_BUFF_ENTER        0x00000001
     406#define CR_SERVER_DUMP_F_DRAW_BUFF_LEAVE        0x00000002
     407#define CR_SERVER_DUMP_F_DRAW_TEX_ENTER         0x00000010
     408#define CR_SERVER_DUMP_F_DRAW_TEX_LEAVE         0x00000020
     409#define CR_SERVER_DUMP_F_DRAW_PROGRAM_ENTER     0x00000100
     410#define CR_SERVER_DUMP_F_DRAW_PROGRAM_LEAVE     0x00000200
     411
     412#define CR_SERVER_DUMP_F_DRAW_ALL (CR_SERVER_DUMP_F_DRAW_BUFF_ENTER | CR_SERVER_DUMP_F_DRAW_BUFF_LEAVE \
     413        | CR_SERVER_DUMP_F_DRAW_TEX_ENTER | CR_SERVER_DUMP_F_DRAW_TEX_LEAVE \
     414        | CR_SERVER_DUMP_F_DRAW_PROGRAM_ENTER | CR_SERVER_DUMP_F_DRAW_PROGRAM_LEAVE)
     415
     416#define CR_SERVER_DUMP_F_COMPILE_SHADER         0x00001000
     417#define CR_SERVER_DUMP_F_LINK_PROGRAM           0x00002000
     418#define CR_SERVER_DUMP_F_SWAPBUFFERS_ENTER      0x00010000
     419#define CR_SERVER_DUMP_F_SWAPBUFFERS_LEAVE      0x00020000
    401420
    402421#define CR_SERVER_DUMP_IF_ANY(_ev) ((g_CrDbgDumpDraw & (_ev)) && crServerDumpFilter((_ev)))
    403422
    404423#define CR_SERVER_DUMP_DRAW_ENTER() do { \
    405             if (!CR_SERVER_DUMP_IF_ANY(CR_SERVER_DUMP_F_DRAW_BUFF_ENTER | CR_SERVER_DUMP_F_DRAW_TEX_ENTER)) break; \
     424            if (!CR_SERVER_DUMP_IF_ANY(CR_SERVER_DUMP_F_DRAW_BUFF_ENTER | CR_SERVER_DUMP_F_DRAW_TEX_ENTER | CR_SERVER_DUMP_F_DRAW_PROGRAM_ENTER)) break; \
    406425            crServerDumpCheckInit(); \
    407             crDmpStrF(cr_server.Recorder.pDumper, "==> %s\n", __FUNCTION__); \
    408             if (CR_SERVER_DUMP_IF_ANY(CR_SERVER_DUMP_F_DRAW_BUFF_ENTER)) { \
    409                 crServerDumpBuffer(); \
    410             } \
    411             if (CR_SERVER_DUMP_IF_ANY(CR_SERVER_DUMP_F_DRAW_TEX_ENTER)) { \
    412                 crServerDumpTextures(); \
    413             } \
     426            crDmpStrF(cr_server.Recorder.pDumper, "==> %s", __FUNCTION__); \
     427            if (CR_SERVER_DUMP_IF_ANY(CR_SERVER_DUMP_F_DRAW_PROGRAM_ENTER)) { crServerDumpCurrentProgram(); } \
     428            if (CR_SERVER_DUMP_IF_ANY(CR_SERVER_DUMP_F_DRAW_TEX_ENTER)) { crServerDumpTextures(); } \
     429            if (CR_SERVER_DUMP_IF_ANY(CR_SERVER_DUMP_F_DRAW_BUFF_ENTER)) { crServerDumpBuffer(-1); } \
     430            crDmpStrF(cr_server.Recorder.pDumper, "=================="); \
    414431        } while (0)
    415432
    416433#define CR_SERVER_DUMP_DRAW_LEAVE() do { \
    417             if (!CR_SERVER_DUMP_IF_ANY(CR_SERVER_DUMP_F_DRAW_BUFF_LEAVE | CR_SERVER_DUMP_F_DRAW_TEX_LEAVE)) break; \
     434            if (!CR_SERVER_DUMP_IF_ANY(CR_SERVER_DUMP_F_DRAW_BUFF_LEAVE | CR_SERVER_DUMP_F_DRAW_TEX_LEAVE | CR_SERVER_DUMP_F_DRAW_PROGRAM_LEAVE)) break; \
    418435            crServerDumpCheckInit(); \
    419             crDmpStrF(cr_server.Recorder.pDumper, "<== %s\n", __FUNCTION__); \
    420             if (CR_SERVER_DUMP_IF_ANY(CR_SERVER_DUMP_F_DRAW_BUFF_LEAVE)) { \
    421                 crServerDumpBuffer(); \
    422             } \
    423             if (CR_SERVER_DUMP_IF_ANY(CR_SERVER_DUMP_F_DRAW_TEX_LEAVE)) { \
    424                 crServerDumpTextures(); \
    425             } \
     436            crDmpStrF(cr_server.Recorder.pDumper, "<== %s", __FUNCTION__); \
     437            if (CR_SERVER_DUMP_IF_ANY(CR_SERVER_DUMP_F_DRAW_BUFF_LEAVE)) { crServerDumpBuffer(-1); } \
     438            if (CR_SERVER_DUMP_IF_ANY(CR_SERVER_DUMP_F_DRAW_TEX_LEAVE)) { crServerDumpTextures(); } \
     439            if (CR_SERVER_DUMP_IF_ANY(CR_SERVER_DUMP_F_DRAW_PROGRAM_LEAVE)) { crServerDumpCurrentProgram(); } \
     440            crDmpStrF(cr_server.Recorder.pDumper, "=================="); \
    426441        } while (0)
     442
     443#define CR_SERVER_DUMP_COMPILE_SHADER(_id) do { \
     444            if (!CR_SERVER_DUMP_IF_ANY(CR_SERVER_DUMP_F_COMPILE_SHADER)) break; \
     445            crServerDumpCheckInit(); \
     446            crServerDumpShader((_id)); \
     447        } while (0)
     448
     449#define CR_SERVER_DUMP_LINK_PROGRAM(_id) do { \
     450            if (!CR_SERVER_DUMP_IF_ANY(CR_SERVER_DUMP_F_LINK_PROGRAM)) break; \
     451            crServerDumpCheckInit(); \
     452            crServerDumpProgram((_id)); \
     453        } while (0)
     454
     455#define CR_SERVER_DUMP_SWAPBUFFERS_ENTER() do { \
     456            if (!g_CrDbgDumpDrawFramesCount && !CR_SERVER_DUMP_IF_ANY(CR_SERVER_DUMP_F_SWAPBUFFERS_ENTER)) break; \
     457            crServerDumpCheckInit(); \
     458            crDmpStrF(cr_server.Recorder.pDumper, "== %s", __FUNCTION__); \
     459            if (CR_SERVER_DUMP_IF_ANY(CR_SERVER_DUMP_F_SWAPBUFFERS_ENTER)) { crServerDumpBuffer(CR_SERVER_FBO_BB_IDX(cr_server.currentMural)); } \
     460            if (g_CrDbgDumpDrawFramesCount) { crServerDumpFramesCheck(); } \
     461        } while (0)
     462
     463#define CR_SERVER_DUMP_SWAPBUFFERS_LEAVE() do {} while (0)
    427464#else /* if !defined VBOX_WITH_CRSERVER_DUMPER */
    428465#define CR_SERVER_DUMP_DRAW_ENTER() do {} while (0)
    429466#define CR_SERVER_DUMP_DRAW_LEAVE() do {} while (0)
     467#define CR_SERVER_DUMP_COMPILE_SHADER(_id) do {} while (0)
     468#define CR_SERVER_DUMP_LINK_PROGRAM(_id) do {} while (0)
     469#define CR_SERVER_DUMP_SWAPBUFFERS_ENTER() do {} while (0)
     470#define CR_SERVER_DUMP_SWAPBUFFERS_LEAVE() do {} while (0)
    430471#endif /* !VBOX_WITH_CRSERVER_DUMPER */
    431472
  • trunk/src/VBox/HostServices/SharedOpenGL/crserverlib/server_clear.c

    r45148 r46368  
    434434        mural->bFbDraw = GL_FALSE;
    435435
     436    CR_SERVER_DUMP_SWAPBUFFERS_ENTER();
     437
    436438    if (crServerIsRedirectedToFBO())
    437439    {
     
    445447            mural->fDataPresented = GL_TRUE;
    446448    }
     449
     450    CR_SERVER_DUMP_SWAPBUFFERS_LEAVE();
    447451}
    448452
  • trunk/src/VBox/HostServices/SharedOpenGL/crserverlib/server_glsl.c

    r45027 r46368  
    5151    Assert(iCompileStatus == GL_TRUE);
    5252#endif
     53    CR_SERVER_DUMP_COMPILE_SHADER(shader);
    5354}
    5455
     
    7980    crStateLinkProgram(program);
    8081    cr_server.head_spu->dispatch_table.LinkProgram(crStateGetProgramHWID(program));
     82    CR_SERVER_DUMP_LINK_PROGRAM(program);
    8183}
    8284
  • trunk/src/VBox/HostServices/SharedOpenGL/crserverlib/server_misc.c

    r46343 r46368  
    5050    CRASSERT(bytes < 4096);
    5151
    52     cr_server.head_spu->dispatch_table.GetChromiumParametervCR( target, index, type, count, local_storage );
     52    switch (target)
     53    {
     54        case GL_DBG_CHECK_BREAK_CR:
     55        {
     56            if (bytes > 0)
     57            {
     58                GLubyte *pbRc = local_storage;
     59                GLuint *puRc = (GLuint *)(bytes >=4 ? local_storage : NULL);
     60                int rc;
     61                memset(local_storage, 0, bytes);
     62                if (cr_server.RcToGuestOnce)
     63                {
     64                    rc = cr_server.RcToGuestOnce;
     65                    cr_server.RcToGuestOnce = 0;
     66                }
     67                else
     68                {
     69                    rc = cr_server.RcToGuest;
     70                }
     71                if (puRc)
     72                    *puRc = rc;
     73                else
     74                    *pbRc = !!rc;
     75            }
     76            else
     77            {
     78                crWarning("zero bytes for GL_DBG_CHECK_BREAK_CR");
     79            }
     80            break;
     81        }
     82        default:
     83            cr_server.head_spu->dispatch_table.GetChromiumParametervCR( target, index, type, count, local_storage );
     84            break;
     85    }
    5386
    5487    crServerReturnValue( local_storage, bytes );
     
    13591392 * 0x03 - dump buffer on enter and exit
    13601393 * 0x22 - dump texture and buffer on exit */
    1361 int g_CrDbgDumpDraw = 0; //CR_SERVER_DUMP_F_DRAW_BUFF_ENTER | CR_SERVER_DUMP_F_DRAW_BUFF_LEAVE;
     1394
     1395unsigned long g_CrDbgDumpDraw = CR_SERVER_DUMP_F_COMPILE_SHADER | CR_SERVER_DUMP_F_LINK_PROGRAM; //CR_SERVER_DUMP_F_DRAW_BUFF_ENTER | CR_SERVER_DUMP_F_DRAW_BUFF_LEAVE;
     1396unsigned long g_CrDbgDumpDrawFramesSettings = CR_SERVER_DUMP_F_DRAW_BUFF_ENTER
     1397        | CR_SERVER_DUMP_F_DRAW_BUFF_LEAVE
     1398        | CR_SERVER_DUMP_F_DRAW_TEX_ENTER
     1399        | CR_SERVER_DUMP_F_DRAW_PROGRAM_ENTER
     1400        | CR_SERVER_DUMP_F_COMPILE_SHADER
     1401        | CR_SERVER_DUMP_F_LINK_PROGRAM
     1402        | CR_SERVER_DUMP_F_SWAPBUFFERS_ENTER;
     1403unsigned long g_CrDbgDumpDrawFramesAppliedSettings = 0;
     1404unsigned long g_CrDbgDumpDrawFramesSavedInitSettings = 0;
     1405unsigned long g_CrDbgDumpDrawFramesCount = 0;
    13621406
    13631407void crServerDumpCheckTerm()
     
    14151459}
    14161460
    1417 void crServerDumpBuffer()
     1461void crServerDumpShader(GLint id)
     1462{
     1463    CRContext *ctx = crStateGetCurrent();
     1464    crRecDumpShader(&cr_server.Recorder, ctx, id, 0);
     1465}
     1466
     1467void crServerDumpProgram(GLint id)
     1468{
     1469    CRContext *ctx = crStateGetCurrent();
     1470    crRecDumpProgram(&cr_server.Recorder, ctx, id, 0);
     1471}
     1472
     1473void crServerDumpCurrentProgram()
     1474{
     1475    CRContext *ctx = crStateGetCurrent();
     1476    crRecDumpCurrentProgram(&cr_server.Recorder, ctx);
     1477}
     1478
     1479void crServerDumpBuffer(int idx)
    14181480{
    14191481    CRContextInfo *pCtxInfo = cr_server.currentCtxInfo;
     
    14211483    CR_BLITTER_CONTEXT BltCtx;
    14221484    CRContext *ctx = crStateGetCurrent();
    1423     GLint idx = crServerMuralFBOIdxFromBufferName(cr_server.currentMural, pCtxInfo->pContext->buffer.drawBuffer);
    14241485    GLint idFBO;
    14251486    GLint idTex;
    14261487    VBOXVR_TEXTURE RedirTex;
    14271488    int rc = crServerDumpCheckInit();
     1489    idx = idx >= 0 ? idx : crServerMuralFBOIdxFromBufferName(cr_server.currentMural, pCtxInfo->pContext->buffer.drawBuffer);
    14281490    if (!RT_SUCCESS(rc))
    14291491    {
     
    14711533}
    14721534
    1473 bool crServerDumpFilter(int event)
    1474 {
     1535bool crServerDumpFilter(unsigned long event)
     1536{
     1537    CRContext *ctx = crStateGetCurrent();
     1538    if ((event & CR_SERVER_DUMP_F_DRAW_ALL)
     1539            && (!ctx->glsl.activeProgram || ctx->glsl.activeProgram->id != 21))
     1540        return false;
    14751541    return true;
     1542}
     1543
     1544void crServerDumpFramesCheck()
     1545{
     1546    if (!g_CrDbgDumpDrawFramesCount)
     1547        return;
     1548
     1549    if (!g_CrDbgDumpDrawFramesAppliedSettings)
     1550    {
     1551        if (!g_CrDbgDumpDrawFramesSettings)
     1552        {
     1553            crWarning("g_CrDbgDumpDrawFramesSettings is NULL, bump will not be started");
     1554            g_CrDbgDumpDrawFramesCount = 0;
     1555            return;
     1556        }
     1557
     1558        g_CrDbgDumpDrawFramesSavedInitSettings = g_CrDbgDumpDraw;
     1559        g_CrDbgDumpDrawFramesAppliedSettings = g_CrDbgDumpDrawFramesSettings;
     1560        g_CrDbgDumpDraw = g_CrDbgDumpDrawFramesSettings;
     1561        g_CrDbgDumpDrawFramesSettings = 0;
     1562        crDmpStrF(cr_server.Recorder.pDumper, "***Starting draw dump for %d frames, settings(0x%x)", g_CrDbgDumpDrawFramesCount, g_CrDbgDumpDraw);
     1563        return;
     1564    }
     1565
     1566    --g_CrDbgDumpDrawFramesCount;
     1567
     1568    if (!g_CrDbgDumpDrawFramesCount)
     1569    {
     1570        crDmpStrF(cr_server.Recorder.pDumper, "***Stop draw dump");
     1571        g_CrDbgDumpDraw = g_CrDbgDumpDrawFramesSavedInitSettings;
     1572        g_CrDbgDumpDrawFramesAppliedSettings = 0;
     1573    }
    14761574}
    14771575#endif
Note: See TracChangeset for help on using the changeset viewer.

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