- Timestamp:
- Apr 19, 2022 1:44:41 PM (3 years ago)
- Location:
- trunk/src/VBox/Devices/Graphics
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Devices/Graphics/DevVGA-SVGA.cpp
r94271 r94632 5509 5509 } 5510 5510 5511 static 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 5511 5548 static int vmsvgaR3LoadGbo(PPDMDEVINS pDevIns, PSSMHANDLE pSSM, VMSVGAGBO *pGbo) 5512 5549 { … … 5715 5752 uint32_t u32; 5716 5753 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 5717 5766 rc = pHlp->pfnSSMGetBool(pSSM, &f); 5718 5767 AssertLogRelRCReturn(rc, rc); … … 5721 5770 if (pThis->fVMSVGA10) 5722 5771 { 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); 5735 5775 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 } 5749 5777 5750 5778 /* … … 5997 6025 5998 6026 /* 5999 * VGA_SAVEDSTATE_VERSION_VMSVGA_DX 6027 * VGA_SAVEDSTATE_VERSION_VMSVGA_DX+ 6000 6028 */ 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 6007 6034 /* Device context command buffers. */ 6008 6035 rc = vmsvgaR3SaveBufCtx(pDevIns, pSSM, &pSVGAState->CmdBufCtxDC); … … 6026 6053 rc = pHlp->pfnSSMPutU32(pSSM, pSVGAState->fCmdBuf); 6027 6054 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 { 6029 6067 /* 6030 6068 * OTables GBOs. -
trunk/src/VBox/Devices/Graphics/DevVGASavedState.h
r94205 r94632 47 47 } while (0) 48 48 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. */ 50 51 #define VGA_SAVEDSTATE_VERSION_VMSVGA_DX 24 /* VGPU10. */ 51 52 #define VGA_SAVEDSTATE_VERSION_VMSVGA_MIPLEVELS 23 /* Surface struct with number of miplevels. */
Note:
See TracChangeset
for help on using the changeset viewer.