VirtualBox

Changeset 94632 in vbox for trunk


Ignore:
Timestamp:
Apr 19, 2022 1:44:41 PM (3 years ago)
Author:
vboxsync
Message:

Devices/Graphics: save command buffers independently from VGPU10 when saving VM state: bugref:9830

Location:
trunk/src/VBox/Devices/Graphics
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Devices/Graphics/DevVGA-SVGA.cpp

    r94271 r94632  
    55095509}
    55105510
     5511static int vmsvgaR3LoadCommandBuffers(PPDMDEVINS pDevIns, PVGASTATE pThis, PVGASTATECC pThisCC, PSSMHANDLE pSSM)
     5512{
     5513    PCPDMDEVHLPR3 pHlp = pDevIns->pHlpR3;
     5514    PVMSVGAR3STATE pSvgaR3State = pThisCC->svga.pSvgaR3State;
     5515
     5516    bool f;
     5517    uint32_t u32;
     5518
     5519    /* Device context command buffers. */
     5520    int rc = vmsvgaR3LoadBufCtx(pDevIns, pThis, pThisCC, pSSM, &pSvgaR3State->CmdBufCtxDC, SVGA_CB_CONTEXT_MAX);
     5521    AssertLogRelRCReturn(rc, rc);
     5522
     5523    /* DX contexts command buffers. */
     5524    uint32_t cBufCtx;
     5525    rc = pHlp->pfnSSMGetU32(pSSM, &cBufCtx);
     5526    AssertLogRelRCReturn(rc, rc);
     5527    AssertReturn(cBufCtx == RT_ELEMENTS(pSvgaR3State->apCmdBufCtxs), VERR_INVALID_STATE);
     5528    for (uint32_t j = 0; j < cBufCtx; ++j)
     5529    {
     5530        rc = pHlp->pfnSSMGetBool(pSSM, &f);
     5531        AssertLogRelRCReturn(rc, rc);
     5532        if (f)
     5533        {
     5534            pSvgaR3State->apCmdBufCtxs[j] = (PVMSVGACMDBUFCTX)RTMemAlloc(sizeof(VMSVGACMDBUFCTX));
     5535            AssertPtrReturn(pSvgaR3State->apCmdBufCtxs[j], VERR_NO_MEMORY);
     5536            vmsvgaR3CmdBufCtxInit(pSvgaR3State->apCmdBufCtxs[j]);
     5537
     5538            rc = vmsvgaR3LoadBufCtx(pDevIns, pThis, pThisCC, pSSM, pSvgaR3State->apCmdBufCtxs[j], (SVGACBContext)j);
     5539            AssertLogRelRCReturn(rc, rc);
     5540        }
     5541    }
     5542
     5543    rc = pHlp->pfnSSMGetU32(pSSM, &u32);
     5544    pSvgaR3State->fCmdBuf = u32;
     5545    return rc;
     5546}
     5547
    55115548static int vmsvgaR3LoadGbo(PPDMDEVINS pDevIns, PSSMHANDLE pSSM, VMSVGAGBO *pGbo)
    55125549{
     
    57155752        uint32_t u32;
    57165753
     5754        if (uVersion >= VGA_SAVEDSTATE_VERSION_VMSVGA_DX_CMDBUF)
     5755        {
     5756            /* Command buffers are saved independently from VGPU10. */
     5757            rc = pHlp->pfnSSMGetBool(pSSM, &f);
     5758            AssertLogRelRCReturn(rc, rc);
     5759            if (f)
     5760            {
     5761                rc = vmsvgaR3LoadCommandBuffers(pDevIns, pThis, pThisCC, pSSM);
     5762                AssertLogRelRCReturn(rc, rc);
     5763            }
     5764        }
     5765
    57175766        rc = pHlp->pfnSSMGetBool(pSSM, &f);
    57185767        AssertLogRelRCReturn(rc, rc);
     
    57215770        if (pThis->fVMSVGA10)
    57225771        {
    5723             /* Device context command buffers. */
    5724             rc = vmsvgaR3LoadBufCtx(pDevIns, pThis, pThisCC, pSSM, &pSVGAState->CmdBufCtxDC, SVGA_CB_CONTEXT_MAX);
    5725             AssertLogRelRCReturn(rc, rc);
    5726 
    5727             /* DX contexts command buffers. */
    5728             uint32_t cBufCtx;
    5729             rc = pHlp->pfnSSMGetU32(pSSM, &cBufCtx);
    5730             AssertLogRelRCReturn(rc, rc);
    5731             AssertReturn(cBufCtx == RT_ELEMENTS(pSVGAState->apCmdBufCtxs), VERR_INVALID_STATE);
    5732             for (uint32_t j = 0; j < cBufCtx; ++j)
    5733             {
    5734                 rc = pHlp->pfnSSMGetBool(pSSM, &f);
     5772            if (uVersion < VGA_SAVEDSTATE_VERSION_VMSVGA_DX_CMDBUF)
     5773            {
     5774                rc = vmsvgaR3LoadCommandBuffers(pDevIns, pThis, pThisCC, pSSM);
    57355775                AssertLogRelRCReturn(rc, rc);
    5736                 if (f)
    5737                 {
    5738                     pSVGAState->apCmdBufCtxs[j] = (PVMSVGACMDBUFCTX)RTMemAlloc(sizeof(VMSVGACMDBUFCTX));
    5739                     AssertPtrReturn(pSVGAState->apCmdBufCtxs[j], VERR_NO_MEMORY);
    5740                     vmsvgaR3CmdBufCtxInit(pSVGAState->apCmdBufCtxs[j]);
    5741 
    5742                     rc = vmsvgaR3LoadBufCtx(pDevIns, pThis, pThisCC, pSSM, pSVGAState->apCmdBufCtxs[j], (SVGACBContext)j);
    5743                     AssertLogRelRCReturn(rc, rc);
    5744                 }
    5745             }
    5746 
    5747             rc = pHlp->pfnSSMGetU32(pSSM, &u32);
    5748             pSVGAState->fCmdBuf = u32;
     5776            }
    57495777
    57505778            /*
     
    59976025
    59986026    /*
    5999      * VGA_SAVEDSTATE_VERSION_VMSVGA_DX
     6027     * VGA_SAVEDSTATE_VERSION_VMSVGA_DX+
    60006028     */
    6001 
    6002     rc = pHlp->pfnSSMPutBool(pSSM, pThis->fVMSVGA10);
    6003     AssertLogRelRCReturn(rc, rc);
    6004 
    6005     if (pThis->fVMSVGA10)
    6006     {
     6029    if (pThis->svga.u32DeviceCaps & SVGA_CAP_COMMAND_BUFFERS)
     6030    {
     6031        rc = pHlp->pfnSSMPutBool(pSSM, true);
     6032        AssertLogRelRCReturn(rc, rc);
     6033
    60076034        /* Device context command buffers. */
    60086035        rc = vmsvgaR3SaveBufCtx(pDevIns, pSSM, &pSVGAState->CmdBufCtxDC);
     
    60266053        rc = pHlp->pfnSSMPutU32(pSSM, pSVGAState->fCmdBuf);
    60276054        AssertRCReturn(rc, rc);
    6028 
     6055    }
     6056    else
     6057    {
     6058        rc = pHlp->pfnSSMPutBool(pSSM, false);
     6059        AssertLogRelRCReturn(rc, rc);
     6060    }
     6061
     6062    rc = pHlp->pfnSSMPutBool(pSSM, pThis->fVMSVGA10);
     6063    AssertLogRelRCReturn(rc, rc);
     6064
     6065    if (pThis->fVMSVGA10)
     6066    {
    60296067        /*
    60306068         * OTables GBOs.
  • trunk/src/VBox/Devices/Graphics/DevVGASavedState.h

    r94205 r94632  
    4747    } while (0)
    4848
    49 #define VGA_SAVEDSTATE_VERSION                   24
     49#define VGA_SAVEDSTATE_VERSION                   25
     50#define VGA_SAVEDSTATE_VERSION_VMSVGA_DX_CMDBUF  25 /* Command buffers capability is not tied to VGPU10 setting. */
    5051#define VGA_SAVEDSTATE_VERSION_VMSVGA_DX         24 /* VGPU10. */
    5152#define VGA_SAVEDSTATE_VERSION_VMSVGA_MIPLEVELS  23 /* Surface struct with number of miplevels. */
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