VirtualBox

source: vbox/trunk/src/VBox/Devices/Graphics/DevVGA-SVGA3d-dx-savedstate.cpp@ 102520

Last change on this file since 102520 was 102520, checked in by vboxsync, 15 months ago

Devices/Graphics: planar textures; video commands. bugref:10529

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 19.2 KB
Line 
1/* $Id: DevVGA-SVGA3d-dx-savedstate.cpp 102520 2023-12-07 12:06:26Z vboxsync $ */
2/** @file
3 * DevSVGA3d - VMWare SVGA device, 3D parts - DX backend saved state.
4 */
5
6/*
7 * Copyright (C) 2022-2023 Oracle and/or its affiliates.
8 *
9 * This file is part of VirtualBox base platform packages, as
10 * available from https://www.virtualbox.org.
11 *
12 * This program is free software; you can redistribute it and/or
13 * modify it under the terms of the GNU General Public License
14 * as published by the Free Software Foundation, in version 3 of the
15 * License.
16 *
17 * This program is distributed in the hope that it will be useful, but
18 * WITHOUT ANY WARRANTY; without even the implied warranty of
19 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
20 * General Public License for more details.
21 *
22 * You should have received a copy of the GNU General Public License
23 * along with this program; if not, see <https://www.gnu.org/licenses>.
24 *
25 * SPDX-License-Identifier: GPL-3.0-only
26 */
27
28
29/*********************************************************************************************************************************
30* Header Files *
31*********************************************************************************************************************************/
32#define LOG_GROUP LOG_GROUP_DEV_VMSVGA
33#include <VBox/AssertGuest.h>
34#include <iprt/errcore.h>
35#include <VBox/log.h>
36#include <VBox/vmm/pdmdev.h>
37
38#include <iprt/assert.h>
39#include <iprt/mem.h>
40
41#include <VBoxVideo.h> /* required by DevVGA.h */
42
43/* should go BEFORE any other DevVGA include to make all DevVGA.h config defines be visible */
44#include "DevVGA.h"
45
46#include "DevVGA-SVGA.h"
47#include "DevVGA-SVGA3d.h"
48#include "DevVGA-SVGA3d-internal.h"
49#include "DevVGA-SVGA-internal.h"
50
51/*
52 * Load
53 */
54
55static int vmsvga3dDXLoadSurface(PCPDMDEVHLPR3 pHlp, PVGASTATECC pThisCC, PSSMHANDLE pSSM)
56{
57 PVMSVGA3DSTATE p3dState = pThisCC->svga.p3dState;
58 int rc;
59
60 uint32_t sid;
61 rc = pHlp->pfnSSMGetU32(pSSM, &sid);
62 AssertRCReturn(rc, rc);
63
64 if (sid == SVGA3D_INVALID_ID)
65 return VINF_SUCCESS;
66
67 /* Define the surface. */
68 SVGAOTableSurfaceEntry entrySurface;
69 rc = vmsvgaR3OTableReadSurface(pThisCC->svga.pSvgaR3State, sid, &entrySurface);
70 AssertRCReturn(rc, rc);
71
72 /** @todo fAllocMipLevels=false and alloc miplevels if there is data to be loaded. */
73 rc = vmsvga3dSurfaceDefine(pThisCC, sid, entrySurface.surface1Flags, entrySurface.format,
74 entrySurface.multisampleCount, entrySurface.autogenFilter,
75 entrySurface.numMipLevels, &entrySurface.size,
76 entrySurface.arraySize,
77 /* fAllocMipLevels = */ true);
78 AssertRCReturn(rc, rc);
79
80 PVMSVGA3DSURFACE pSurface = p3dState->papSurfaces[sid];
81 AssertReturn(pSurface->id == sid, VERR_INTERNAL_ERROR);
82
83 /* Load the surface fields which are not part of SVGAOTableSurfaceEntry. */
84 pHlp->pfnSSMGetU32(pSSM, &pSurface->idAssociatedContext);
85
86 /* Load miplevels data to the surface buffers. */
87 for (uint32_t j = 0; j < pSurface->cLevels * pSurface->surfaceDesc.numArrayElements; j++)
88 {
89 PVMSVGA3DMIPMAPLEVEL pMipmapLevel = &pSurface->paMipmapLevels[j];
90
91 /* vmsvga3dSurfaceDefine already allocated the surface data buffer. */
92 Assert(pMipmapLevel->cbSurface);
93 AssertReturn(pMipmapLevel->pSurfaceData, VERR_INTERNAL_ERROR);
94
95 /* Fetch the data present boolean first. */
96 bool fDataPresent;
97 rc = pHlp->pfnSSMGetBool(pSSM, &fDataPresent);
98 AssertRCReturn(rc, rc);
99
100 if (fDataPresent)
101 {
102 rc = pHlp->pfnSSMGetMem(pSSM, pMipmapLevel->pSurfaceData, pMipmapLevel->cbSurface);
103 AssertRCReturn(rc, rc);
104
105 pMipmapLevel->fDirty = true;
106 pSurface->fDirty = true;
107 }
108 else
109 pMipmapLevel->fDirty = false;
110 }
111
112 return VINF_SUCCESS;
113}
114
115static int vmsvga3dDXLoadContext(PCPDMDEVHLPR3 pHlp, PVGASTATECC pThisCC, PSSMHANDLE pSSM)
116{
117 PVMSVGAR3STATE pSvgaR3State = pThisCC->svga.pSvgaR3State;
118 PVMSVGA3DSTATE p3dState = pThisCC->svga.p3dState;
119 uint32_t u32;
120 int rc;
121
122 uint32_t cid;
123 rc = pHlp->pfnSSMGetU32(pSSM, &cid);
124 AssertRCReturn(rc, rc);
125
126 if (cid == SVGA3D_INVALID_ID)
127 return VINF_SUCCESS;
128
129 /* Define the context. */
130 rc = vmsvga3dDXDefineContext(pThisCC, cid);
131 AssertRCReturn(rc, rc);
132
133 PVMSVGA3DDXCONTEXT pDXContext = p3dState->papDXContexts[cid];
134 AssertReturn(pDXContext->cid == cid, VERR_INTERNAL_ERROR);
135
136 /* Load the context. */
137 rc = pHlp->pfnSSMGetU32(pSSM, &u32);
138 AssertRCReturn(rc, rc);
139 AssertReturn(u32 == sizeof(SVGADXContextMobFormat), VERR_INVALID_STATE);
140
141 pHlp->pfnSSMGetMem(pSSM, &pDXContext->svgaDXContext, sizeof(SVGADXContextMobFormat));
142
143 uint32_t cCOTMobs;
144 rc = pHlp->pfnSSMGetU32(pSSM, &cCOTMobs);
145 AssertLogRelRCReturn(rc, rc);
146 AssertReturn(cCOTMobs <= RT_ELEMENTS(pDXContext->aCOTMobs), VERR_INVALID_STATE);
147
148 for (unsigned i = 0; i < cCOTMobs; ++i)
149 {
150 rc = pHlp->pfnSSMGetU32(pSSM, &u32);
151 AssertLogRelRCReturn(rc, rc);
152 pDXContext->aCOTMobs[i] = vmsvgaR3MobGet(pSvgaR3State, u32);
153 Assert(pDXContext->aCOTMobs[i] || u32 == SVGA_ID_INVALID);
154 }
155
156 struct
157 {
158 SVGACOTableType COTableType;
159 uint32_t cbEntry;
160 uint32_t *pcEntries;
161 void **ppaEntries;
162 } cot[] =
163 {
164 {SVGA_COTABLE_RTVIEW, sizeof(SVGACOTableDXRTViewEntry), &pDXContext->cot.cRTView, (void **)&pDXContext->cot.paRTView},
165 {SVGA_COTABLE_DSVIEW, sizeof(SVGACOTableDXDSViewEntry), &pDXContext->cot.cDSView, (void **)&pDXContext->cot.paDSView},
166 {SVGA_COTABLE_SRVIEW, sizeof(SVGACOTableDXSRViewEntry), &pDXContext->cot.cSRView, (void **)&pDXContext->cot.paSRView},
167 {SVGA_COTABLE_ELEMENTLAYOUT, sizeof(SVGACOTableDXElementLayoutEntry), &pDXContext->cot.cElementLayout, (void **)&pDXContext->cot.paElementLayout},
168 {SVGA_COTABLE_BLENDSTATE, sizeof(SVGACOTableDXBlendStateEntry), &pDXContext->cot.cBlendState, (void **)&pDXContext->cot.paBlendState},
169 {SVGA_COTABLE_DEPTHSTENCIL, sizeof(SVGACOTableDXDepthStencilEntry), &pDXContext->cot.cDepthStencil, (void **)&pDXContext->cot.paDepthStencil},
170 {SVGA_COTABLE_RASTERIZERSTATE, sizeof(SVGACOTableDXRasterizerStateEntry), &pDXContext->cot.cRasterizerState, (void **)&pDXContext->cot.paRasterizerState},
171 {SVGA_COTABLE_SAMPLER, sizeof(SVGACOTableDXSamplerEntry), &pDXContext->cot.cSampler, (void **)&pDXContext->cot.paSampler},
172 {SVGA_COTABLE_STREAMOUTPUT, sizeof(SVGACOTableDXStreamOutputEntry), &pDXContext->cot.cStreamOutput, (void **)&pDXContext->cot.paStreamOutput},
173 {SVGA_COTABLE_DXQUERY, sizeof(SVGACOTableDXQueryEntry), &pDXContext->cot.cQuery, (void **)&pDXContext->cot.paQuery},
174 {SVGA_COTABLE_DXSHADER, sizeof(SVGACOTableDXShaderEntry), &pDXContext->cot.cShader, (void **)&pDXContext->cot.paShader},
175 {SVGA_COTABLE_UAVIEW, sizeof(SVGACOTableDXUAViewEntry), &pDXContext->cot.cUAView, (void **)&pDXContext->cot.paUAView},
176 {VBSVGA_COTABLE_VIDEOPROCESSOR, sizeof(VBSVGACOTableDXVideoProcessorEntry), &pDXContext->cot.cVideoProcessor, (void **)&pDXContext->cot.paVideoProcessor},
177 {VBSVGA_COTABLE_VDOV, sizeof(VBSVGACOTableDXVideoDecoderOutputViewEntry), &pDXContext->cot.cVideoDecoderOutputView, (void **)&pDXContext->cot.paVideoDecoderOutputView},
178 {VBSVGA_COTABLE_VIDEODECODER, sizeof(VBSVGACOTableDXVideoDecoderEntry), &pDXContext->cot.cVideoDecoder, (void **)&pDXContext->cot.paVideoDecoder},
179 {VBSVGA_COTABLE_VPIV, sizeof(VBSVGACOTableDXVideoProcessorInputViewEntry), &pDXContext->cot.cVideoProcessorInputView, (void **)&pDXContext->cot.paVideoProcessorInputView},
180 {VBSVGA_COTABLE_VPOV, sizeof(VBSVGACOTableDXVideoProcessorOutputViewEntry), &pDXContext->cot.cVideoProcessorOutputView, (void **)&pDXContext->cot.paVideoProcessorOutputView},
181 };
182
183 AssertCompile(RT_ELEMENTS(cot) == RT_ELEMENTS(pDXContext->aCOTMobs));
184 for (unsigned i = 0; i < cCOTMobs; ++i)
185 {
186 uint32_t idxCOTable;
187 if (cot[i].COTableType < SVGA_COTABLE_MAX)
188 idxCOTable = cot[i].COTableType;
189 else if (cot[i].COTableType >= VBSVGA_COTABLE_MIN && cot[i].COTableType < VBSVGA_COTABLE_MAX)
190 idxCOTable = SVGA_COTABLE_MAX + (cot[i].COTableType - VBSVGA_COTABLE_MIN);
191 else
192 AssertFailedReturn(VERR_INVALID_STATE);
193
194 uint32_t cEntries;
195 pHlp->pfnSSMGetU32(pSSM, &cEntries);
196 rc = pHlp->pfnSSMGetU32(pSSM, &u32);
197 AssertRCReturn(rc, rc);
198 AssertReturn(u32 == cot[i].cbEntry, VERR_INVALID_STATE);
199
200 *cot[i].pcEntries = cEntries;
201 *cot[i].ppaEntries = vmsvgaR3MobBackingStorePtr(pDXContext->aCOTMobs[idxCOTable], 0);
202
203 if (cEntries)
204 {
205 rc = pSvgaR3State->pFuncsDX->pfnDXSetCOTable(pThisCC, pDXContext, cot[i].COTableType, cEntries);
206 AssertLogRelRCReturn(rc, rc);
207 }
208 }
209
210 rc = pSvgaR3State->pFuncsDX->pfnDXLoadState(pThisCC, pDXContext, pHlp, pSSM);
211 AssertRCReturn(rc, rc);
212
213 return VINF_SUCCESS;
214}
215
216int vmsvga3dDXLoadExec(PPDMDEVINS pDevIns, PVGASTATE pThis, PVGASTATECC pThisCC, PSSMHANDLE pSSM, uint32_t uVersion, uint32_t uPass)
217{
218 RT_NOREF(pThis, uPass);
219
220 if (uVersion < VGA_SAVEDSTATE_VERSION_VMSVGA_DX)
221 AssertFailedReturn(VERR_INVALID_STATE);
222
223 PCPDMDEVHLPR3 pHlp = pDevIns->pHlpR3;
224 PVMSVGAR3STATE pSvgaR3State = pThisCC->svga.pSvgaR3State;
225 PVMSVGA3DSTATE p3dState = pThisCC->svga.p3dState;
226 int rc;
227
228 /*
229 * VMSVGA3DSTATE
230 */
231 pHlp->pfnSSMGetU32(pSSM, &p3dState->cSurfaces);
232 rc = pHlp->pfnSSMGetU32(pSSM, &p3dState->cDXContexts);
233 AssertRCReturn(rc, rc);
234
235 /*
236 * Surfaces
237 */
238 if (p3dState->cSurfaces)
239 {
240 p3dState->papSurfaces = (PVMSVGA3DSURFACE *)RTMemAlloc(p3dState->cSurfaces * sizeof(PVMSVGA3DSURFACE));
241 AssertReturn(p3dState->papSurfaces, VERR_NO_MEMORY);
242 for (uint32_t i = 0; i < p3dState->cSurfaces; ++i)
243 {
244 p3dState->papSurfaces[i] = (PVMSVGA3DSURFACE)RTMemAllocZ(sizeof(VMSVGA3DSURFACE));
245 AssertPtrReturn(p3dState->papSurfaces[i], VERR_NO_MEMORY);
246 p3dState->papSurfaces[i]->id = SVGA3D_INVALID_ID;
247 }
248
249 for (uint32_t i = 0; i < p3dState->cSurfaces; ++i)
250 {
251 rc = vmsvga3dDXLoadSurface(pHlp, pThisCC, pSSM);
252 AssertRCReturn(rc, rc);
253 }
254 }
255 else
256 p3dState->papSurfaces = NULL;
257
258 /*
259 * DX contexts
260 */
261 if (p3dState->cDXContexts)
262 {
263 p3dState->papDXContexts = (PVMSVGA3DDXCONTEXT *)RTMemAlloc(p3dState->cDXContexts * sizeof(PVMSVGA3DDXCONTEXT));
264 AssertReturn(p3dState->papDXContexts, VERR_NO_MEMORY);
265 for (uint32_t i = 0; i < p3dState->cDXContexts; ++i)
266 {
267 p3dState->papDXContexts[i] = (PVMSVGA3DDXCONTEXT)RTMemAllocZ(sizeof(VMSVGA3DDXCONTEXT));
268 AssertPtrReturn(p3dState->papDXContexts[i], VERR_NO_MEMORY);
269 p3dState->papDXContexts[i]->cid = SVGA3D_INVALID_ID;
270 }
271
272 for (uint32_t i = 0; i < p3dState->cDXContexts; ++i)
273 {
274 rc = vmsvga3dDXLoadContext(pHlp, pThisCC, pSSM);
275 AssertRCReturn(rc, rc);
276 }
277 }
278 else
279 p3dState->papDXContexts = NULL;
280
281 if (pSvgaR3State->idDXContextCurrent != SVGA_ID_INVALID)
282 vmsvga3dDXSwitchContext(pThisCC, pSvgaR3State->idDXContextCurrent);
283
284 return VINF_SUCCESS;
285}
286
287/*
288 * Save
289 */
290
291static int vmsvga3dDXSaveSurface(PCPDMDEVHLPR3 pHlp, PVGASTATECC pThisCC, PSSMHANDLE pSSM, PVMSVGA3DSURFACE pSurface)
292{
293 RT_NOREF(pThisCC);
294 int rc;
295
296 rc = pHlp->pfnSSMPutU32(pSSM, pSurface->id);
297 AssertRCReturn(rc, rc);
298
299 if (pSurface->id == SVGA3D_INVALID_ID)
300 return VINF_SUCCESS;
301
302 /* Save the surface fields which are not part of SVGAOTableSurfaceEntry. */
303 pHlp->pfnSSMPutU32(pSSM, pSurface->idAssociatedContext);
304
305 for (uint32_t iArray = 0; iArray < pSurface->surfaceDesc.numArrayElements; ++iArray)
306 {
307 for (uint32_t iMipmap = 0; iMipmap < pSurface->cLevels; ++iMipmap)
308 {
309 uint32_t idx = iMipmap + iArray * pSurface->cLevels;
310 PVMSVGA3DMIPMAPLEVEL pMipmapLevel = &pSurface->paMipmapLevels[idx];
311
312 if (!VMSVGA3DSURFACE_HAS_HW_SURFACE(pSurface))
313 {
314 if (pMipmapLevel->pSurfaceData)
315 {
316 /* Data follows */
317 rc = pHlp->pfnSSMPutBool(pSSM, true);
318 AssertRCReturn(rc, rc);
319
320 Assert(pMipmapLevel->cbSurface);
321 rc = pHlp->pfnSSMPutMem(pSSM, pMipmapLevel->pSurfaceData, pMipmapLevel->cbSurface);
322 AssertRCReturn(rc, rc);
323 }
324 else
325 {
326 /* No data follows */
327 rc = pHlp->pfnSSMPutBool(pSSM, false);
328 AssertRCReturn(rc, rc);
329 }
330 }
331 else
332 {
333 SVGA3dSurfaceImageId image;
334 image.sid = pSurface->id;
335 image.face = iArray;
336 image.mipmap = iMipmap;
337
338 VMSGA3D_BOX_DIMENSIONS dims;
339 rc = vmsvga3dGetBoxDimensions(pThisCC, &image, NULL, &dims);
340 AssertRCReturn(rc, rc);
341
342 VMSVGA3D_MAPPED_SURFACE map;
343 rc = vmsvga3dSurfaceMap(pThisCC, &image, NULL, VMSVGA3D_SURFACE_MAP_READ, &map);
344 if (RT_SUCCESS(rc))
345 {
346 /* Save mapped surface data. */
347 pHlp->pfnSSMPutBool(pSSM, true);
348 if (map.cbRow == map.cbRowPitch)
349 {
350 rc = pHlp->pfnSSMPutMem(pSSM, map.pvData, pMipmapLevel->cbSurface);
351 AssertRCReturn(rc, rc);
352 }
353 else
354 {
355 uint8_t *pu8Map = (uint8_t *)map.pvData;
356 for (uint32_t z = 0; z < map.box.d; ++z)
357 {
358 uint8_t *pu8MapPlane = pu8Map;
359 for (uint32_t y = 0; y < map.cRows; ++y)
360 {
361 rc = pHlp->pfnSSMPutMem(pSSM, pu8MapPlane, dims.cbRow);
362 AssertRCReturn(rc, rc);
363
364 pu8MapPlane += map.cbRowPitch;
365 }
366 pu8Map += map.cbDepthPitch;
367 }
368 }
369
370 vmsvga3dSurfaceUnmap(pThisCC, &image, &map, false);
371 }
372 else
373 {
374 AssertFailed();
375
376 /* No data follows */
377 rc = pHlp->pfnSSMPutBool(pSSM, false);
378 AssertRCReturn(rc, rc);
379 }
380 }
381 }
382 }
383
384 return VINF_SUCCESS;
385}
386
387static int vmsvga3dDXSaveContext(PCPDMDEVHLPR3 pHlp, PVGASTATECC pThisCC, PSSMHANDLE pSSM, PVMSVGA3DDXCONTEXT pDXContext)
388{
389 PVMSVGAR3STATE pSvgaR3State = pThisCC->svga.pSvgaR3State;
390 int rc;
391
392 rc = pHlp->pfnSSMPutU32(pSSM, pDXContext->cid);
393 AssertRCReturn(rc, rc);
394
395 if (pDXContext->cid == SVGA3D_INVALID_ID)
396 return VINF_SUCCESS;
397
398 /* Save the context. */
399 pHlp->pfnSSMPutU32(pSSM, sizeof(SVGADXContextMobFormat));
400 pHlp->pfnSSMPutMem(pSSM, &pDXContext->svgaDXContext, sizeof(SVGADXContextMobFormat));
401
402 rc = pHlp->pfnSSMPutU32(pSSM, RT_ELEMENTS(pDXContext->aCOTMobs));
403 AssertLogRelRCReturn(rc, rc);
404 for (unsigned i = 0; i < RT_ELEMENTS(pDXContext->aCOTMobs); ++i)
405 {
406 uint32_t const mobId = vmsvgaR3MobId(pDXContext->aCOTMobs[i]);
407 rc = pHlp->pfnSSMPutU32(pSSM, mobId);
408 AssertLogRelRCReturn(rc, rc);
409 }
410
411 struct
412 {
413 uint32_t cEntries;
414 uint32_t cbEntry;
415 void *paEntries;
416 } cot[] =
417 {
418 {pDXContext->cot.cRTView, sizeof(SVGACOTableDXRTViewEntry), pDXContext->cot.paRTView},
419 {pDXContext->cot.cDSView, sizeof(SVGACOTableDXDSViewEntry), pDXContext->cot.paDSView},
420 {pDXContext->cot.cSRView, sizeof(SVGACOTableDXSRViewEntry), pDXContext->cot.paSRView},
421 {pDXContext->cot.cElementLayout, sizeof(SVGACOTableDXElementLayoutEntry), pDXContext->cot.paElementLayout},
422 {pDXContext->cot.cBlendState, sizeof(SVGACOTableDXBlendStateEntry), pDXContext->cot.paBlendState},
423 {pDXContext->cot.cDepthStencil, sizeof(SVGACOTableDXDepthStencilEntry), pDXContext->cot.paDepthStencil},
424 {pDXContext->cot.cRasterizerState, sizeof(SVGACOTableDXRasterizerStateEntry), pDXContext->cot.paRasterizerState},
425 {pDXContext->cot.cSampler, sizeof(SVGACOTableDXSamplerEntry), pDXContext->cot.paSampler},
426 {pDXContext->cot.cStreamOutput, sizeof(SVGACOTableDXStreamOutputEntry), pDXContext->cot.paStreamOutput},
427 {pDXContext->cot.cQuery, sizeof(SVGACOTableDXQueryEntry), pDXContext->cot.paQuery},
428 {pDXContext->cot.cShader, sizeof(SVGACOTableDXShaderEntry), pDXContext->cot.paShader},
429 {pDXContext->cot.cUAView, sizeof(SVGACOTableDXUAViewEntry), pDXContext->cot.paUAView},
430 {pDXContext->cot.cVideoProcessor, sizeof(VBSVGACOTableDXVideoProcessorEntry), pDXContext->cot.paVideoProcessor},
431 {pDXContext->cot.cVideoDecoderOutputView, sizeof(VBSVGACOTableDXVideoDecoderOutputViewEntry), pDXContext->cot.paVideoDecoderOutputView},
432 {pDXContext->cot.cVideoDecoder, sizeof(VBSVGACOTableDXVideoDecoderEntry), pDXContext->cot.paVideoDecoder},
433 {pDXContext->cot.cVideoProcessorInputView, sizeof(VBSVGACOTableDXVideoProcessorInputViewEntry), pDXContext->cot.paVideoProcessorInputView},
434 {pDXContext->cot.cVideoProcessorOutputView, sizeof(VBSVGACOTableDXVideoProcessorOutputViewEntry), pDXContext->cot.paVideoProcessorOutputView},
435 };
436
437 AssertCompile(RT_ELEMENTS(cot) == RT_ELEMENTS(pDXContext->aCOTMobs));
438 for (unsigned i = 0; i < RT_ELEMENTS(cot); ++i)
439 {
440 pHlp->pfnSSMPutU32(pSSM, cot[i].cEntries);
441 rc = pHlp->pfnSSMPutU32(pSSM, cot[i].cbEntry);
442 AssertLogRelRCReturn(rc, rc);
443 }
444
445 rc = pSvgaR3State->pFuncsDX->pfnDXSaveState(pThisCC, pDXContext, pHlp, pSSM);
446 AssertRCReturn(rc, rc);
447
448 return VINF_SUCCESS;
449}
450
451int vmsvga3dDXSaveExec(PPDMDEVINS pDevIns, PVGASTATECC pThisCC, PSSMHANDLE pSSM)
452{
453 PCPDMDEVHLPR3 pHlp = pDevIns->pHlpR3;
454 PVMSVGA3DSTATE p3dState = pThisCC->svga.p3dState;
455 int rc;
456
457 /*
458 * VMSVGA3DSTATE
459 */
460 pHlp->pfnSSMPutU32(pSSM, p3dState->cSurfaces);
461 rc = pHlp->pfnSSMPutU32(pSSM, p3dState->cDXContexts);
462 AssertRCReturn(rc, rc);
463
464 /*
465 * Surfaces
466 */
467 for (uint32_t sid = 0; sid < p3dState->cSurfaces; ++sid)
468 {
469 rc = vmsvga3dDXSaveSurface(pHlp, pThisCC, pSSM, p3dState->papSurfaces[sid]);
470 AssertRCReturn(rc, rc);
471 }
472
473 /*
474 * DX contexts
475 */
476 for (uint32_t cid = 0; cid < p3dState->cDXContexts; ++cid)
477 {
478 rc = vmsvga3dDXSaveContext(pHlp, pThisCC, pSSM, p3dState->papDXContexts[cid]);
479 AssertRCReturn(rc, rc);
480 }
481
482 return VINF_SUCCESS;
483}
Note: See TracBrowser for help on using the repository browser.

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