1 | /* $Id: DevVGA_VBVA.cpp 49366 2013-11-01 15:21:10Z vboxsync $ */
|
---|
2 | /** @file
|
---|
3 | * VirtualBox Video Acceleration (VBVA).
|
---|
4 | */
|
---|
5 |
|
---|
6 | /*
|
---|
7 | * Copyright (C) 2006-2013 Oracle Corporation
|
---|
8 | *
|
---|
9 | * This file is part of VirtualBox Open Source Edition (OSE), as
|
---|
10 | * available from http://www.virtualbox.org. This file is free software;
|
---|
11 | * you can redistribute it and/or modify it under the terms of the GNU
|
---|
12 | * General Public License (GPL) as published by the Free Software
|
---|
13 | * Foundation, in version 2 as it comes in the "COPYING" file of the
|
---|
14 | * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
|
---|
15 | * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
|
---|
16 | */
|
---|
17 |
|
---|
18 | /*******************************************************************************
|
---|
19 | * Header Files *
|
---|
20 | *******************************************************************************/
|
---|
21 | #define LOG_GROUP LOG_GROUP_DEV_VGA
|
---|
22 | #include <VBox/vmm/pdmifs.h>
|
---|
23 | #include <VBox/vmm/pdmdev.h>
|
---|
24 | #include <VBox/vmm/pgm.h>
|
---|
25 | #include <VBox/vmm/ssm.h>
|
---|
26 | #include <VBox/VMMDev.h>
|
---|
27 | #include <VBox/VBoxVideo.h>
|
---|
28 | #include <iprt/alloc.h>
|
---|
29 | #include <iprt/assert.h>
|
---|
30 | #include <iprt/asm.h>
|
---|
31 | #include <iprt/string.h>
|
---|
32 | #include <iprt/param.h>
|
---|
33 | #ifdef VBOX_WITH_VIDEOHWACCEL
|
---|
34 | #include <iprt/semaphore.h>
|
---|
35 | #endif
|
---|
36 |
|
---|
37 | #include "DevVGA.h"
|
---|
38 |
|
---|
39 | /* A very detailed logging. */
|
---|
40 | #if 0 // def DEBUG_sunlover
|
---|
41 | #define LOGVBVABUFFER(a) LogFlow(a)
|
---|
42 | #else
|
---|
43 | #define LOGVBVABUFFER(a) do {} while (0)
|
---|
44 | #endif
|
---|
45 |
|
---|
46 | /*******************************************************************************
|
---|
47 | * Structures and Typedefs *
|
---|
48 | *******************************************************************************/
|
---|
49 | typedef struct VBVAPARTIALRECORD
|
---|
50 | {
|
---|
51 | uint8_t *pu8;
|
---|
52 | uint32_t cb;
|
---|
53 | } VBVAPARTIALRECORD;
|
---|
54 |
|
---|
55 | typedef struct VBVAVIEW
|
---|
56 | {
|
---|
57 | VBVAINFOVIEW view;
|
---|
58 | VBVAINFOSCREEN screen;
|
---|
59 | VBVABUFFER *pVBVA;
|
---|
60 | uint32_t u32VBVAOffset;
|
---|
61 | VBVAPARTIALRECORD partialRecord;
|
---|
62 | } VBVAVIEW;
|
---|
63 |
|
---|
64 | typedef struct VBVAMOUSESHAPEINFO
|
---|
65 | {
|
---|
66 | bool fSet;
|
---|
67 | bool fVisible;
|
---|
68 | bool fAlpha;
|
---|
69 | uint32_t u32HotX;
|
---|
70 | uint32_t u32HotY;
|
---|
71 | uint32_t u32Width;
|
---|
72 | uint32_t u32Height;
|
---|
73 | uint32_t cbShape;
|
---|
74 | uint32_t cbAllocated;
|
---|
75 | uint8_t *pu8Shape;
|
---|
76 | } VBVAMOUSESHAPEINFO;
|
---|
77 |
|
---|
78 | /** @todo saved state: save and restore VBVACONTEXT */
|
---|
79 | typedef struct VBVACONTEXT
|
---|
80 | {
|
---|
81 | uint32_t cViews;
|
---|
82 | VBVAVIEW aViews[64 /* @todo SchemaDefs::MaxGuestMonitors*/];
|
---|
83 | VBVAMOUSESHAPEINFO mouseShapeInfo;
|
---|
84 | } VBVACONTEXT;
|
---|
85 |
|
---|
86 |
|
---|
87 |
|
---|
88 | /** Copies @a cb bytes from the VBVA ring buffer to the @a pu8Dst.
|
---|
89 | * Used for partial records or for records which cross the ring boundary.
|
---|
90 | */
|
---|
91 | static void vbvaFetchBytes (VBVABUFFER *pVBVA, uint8_t *pu8Dst, uint32_t cb)
|
---|
92 | {
|
---|
93 | /** @todo replace the 'if' with an assert. The caller must ensure this condition. */
|
---|
94 | if (cb >= pVBVA->cbData)
|
---|
95 | {
|
---|
96 | AssertMsgFailed (("cb = 0x%08X, ring buffer size 0x%08X", cb, pVBVA->cbData));
|
---|
97 | return;
|
---|
98 | }
|
---|
99 |
|
---|
100 | const uint32_t u32BytesTillBoundary = pVBVA->cbData - pVBVA->off32Data;
|
---|
101 | const uint8_t *src = &pVBVA->au8Data[pVBVA->off32Data];
|
---|
102 | const int32_t i32Diff = cb - u32BytesTillBoundary;
|
---|
103 |
|
---|
104 | if (i32Diff <= 0)
|
---|
105 | {
|
---|
106 | /* Chunk will not cross buffer boundary. */
|
---|
107 | memcpy (pu8Dst, src, cb);
|
---|
108 | }
|
---|
109 | else
|
---|
110 | {
|
---|
111 | /* Chunk crosses buffer boundary. */
|
---|
112 | memcpy (pu8Dst, src, u32BytesTillBoundary);
|
---|
113 | memcpy (pu8Dst + u32BytesTillBoundary, &pVBVA->au8Data[0], i32Diff);
|
---|
114 | }
|
---|
115 |
|
---|
116 | /* Advance data offset. */
|
---|
117 | pVBVA->off32Data = (pVBVA->off32Data + cb) % pVBVA->cbData;
|
---|
118 |
|
---|
119 | return;
|
---|
120 | }
|
---|
121 |
|
---|
122 |
|
---|
123 | static bool vbvaPartialRead (VBVAPARTIALRECORD *pPartialRecord, uint32_t cbRecord, VBVABUFFER *pVBVA)
|
---|
124 | {
|
---|
125 | uint8_t *pu8New;
|
---|
126 |
|
---|
127 | LOGVBVABUFFER(("vbvaPartialRead: p = %p, cb = %d, cbRecord 0x%08X\n",
|
---|
128 | pPartialRecord->pu8, pPartialRecord->cb, cbRecord));
|
---|
129 |
|
---|
130 | if (pPartialRecord->pu8)
|
---|
131 | {
|
---|
132 | Assert (pPartialRecord->cb);
|
---|
133 | pu8New = (uint8_t *)RTMemRealloc (pPartialRecord->pu8, cbRecord);
|
---|
134 | }
|
---|
135 | else
|
---|
136 | {
|
---|
137 | Assert (!pPartialRecord->cb);
|
---|
138 | pu8New = (uint8_t *)RTMemAlloc (cbRecord);
|
---|
139 | }
|
---|
140 |
|
---|
141 | if (!pu8New)
|
---|
142 | {
|
---|
143 | /* Memory allocation failed, fail the function. */
|
---|
144 | Log(("vbvaPartialRead: failed to (re)alocate memory for partial record!!! cbRecord 0x%08X\n",
|
---|
145 | cbRecord));
|
---|
146 |
|
---|
147 | if (pPartialRecord->pu8)
|
---|
148 | {
|
---|
149 | RTMemFree (pPartialRecord->pu8);
|
---|
150 | }
|
---|
151 |
|
---|
152 | pPartialRecord->pu8 = NULL;
|
---|
153 | pPartialRecord->cb = 0;
|
---|
154 |
|
---|
155 | return false;
|
---|
156 | }
|
---|
157 |
|
---|
158 | /* Fetch data from the ring buffer. */
|
---|
159 | vbvaFetchBytes (pVBVA, pu8New + pPartialRecord->cb, cbRecord - pPartialRecord->cb);
|
---|
160 |
|
---|
161 | pPartialRecord->pu8 = pu8New;
|
---|
162 | pPartialRecord->cb = cbRecord;
|
---|
163 |
|
---|
164 | return true;
|
---|
165 | }
|
---|
166 |
|
---|
167 | /* For contiguous chunks just return the address in the buffer.
|
---|
168 | * For crossing boundary - allocate a buffer from heap.
|
---|
169 | */
|
---|
170 | static bool vbvaFetchCmd (VBVAPARTIALRECORD *pPartialRecord, VBVABUFFER *pVBVA, VBVACMDHDR **ppHdr, uint32_t *pcbCmd)
|
---|
171 | {
|
---|
172 | uint32_t indexRecordFirst = pVBVA->indexRecordFirst;
|
---|
173 | uint32_t indexRecordFree = pVBVA->indexRecordFree;
|
---|
174 |
|
---|
175 | LOGVBVABUFFER(("first = %d, free = %d\n",
|
---|
176 | indexRecordFirst, indexRecordFree));
|
---|
177 |
|
---|
178 | if (indexRecordFirst == indexRecordFree)
|
---|
179 | {
|
---|
180 | /* No records to process. Return without assigning output variables. */
|
---|
181 | return true;
|
---|
182 | }
|
---|
183 |
|
---|
184 | uint32_t cbRecordCurrent = ASMAtomicReadU32(&pVBVA->aRecords[indexRecordFirst].cbRecord);
|
---|
185 |
|
---|
186 | LOGVBVABUFFER(("cbRecord = 0x%08X, pPartialRecord->cb = 0x%08X\n", cbRecordCurrent, pPartialRecord->cb));
|
---|
187 |
|
---|
188 | uint32_t cbRecord = cbRecordCurrent & ~VBVA_F_RECORD_PARTIAL;
|
---|
189 |
|
---|
190 | if (pPartialRecord->cb)
|
---|
191 | {
|
---|
192 | /* There is a partial read in process. Continue with it. */
|
---|
193 | Assert (pPartialRecord->pu8);
|
---|
194 |
|
---|
195 | LOGVBVABUFFER(("continue partial record cb = %d cbRecord 0x%08X, first = %d, free = %d\n",
|
---|
196 | pPartialRecord->cb, cbRecordCurrent, indexRecordFirst, indexRecordFree));
|
---|
197 |
|
---|
198 | if (cbRecord > pPartialRecord->cb)
|
---|
199 | {
|
---|
200 | /* New data has been added to the record. */
|
---|
201 | if (!vbvaPartialRead (pPartialRecord, cbRecord, pVBVA))
|
---|
202 | {
|
---|
203 | return false;
|
---|
204 | }
|
---|
205 | }
|
---|
206 |
|
---|
207 | if (!(cbRecordCurrent & VBVA_F_RECORD_PARTIAL))
|
---|
208 | {
|
---|
209 | /* The record is completed by guest. Return it to the caller. */
|
---|
210 | *ppHdr = (VBVACMDHDR *)pPartialRecord->pu8;
|
---|
211 | *pcbCmd = pPartialRecord->cb;
|
---|
212 |
|
---|
213 | pPartialRecord->pu8 = NULL;
|
---|
214 | pPartialRecord->cb = 0;
|
---|
215 |
|
---|
216 | /* Advance the record index. */
|
---|
217 | pVBVA->indexRecordFirst = (indexRecordFirst + 1) % RT_ELEMENTS(pVBVA->aRecords);
|
---|
218 |
|
---|
219 | LOGVBVABUFFER(("partial done ok, data = %d, free = %d\n",
|
---|
220 | pVBVA->off32Data, pVBVA->off32Free));
|
---|
221 | }
|
---|
222 |
|
---|
223 | return true;
|
---|
224 | }
|
---|
225 |
|
---|
226 | /* A new record need to be processed. */
|
---|
227 | if (cbRecordCurrent & VBVA_F_RECORD_PARTIAL)
|
---|
228 | {
|
---|
229 | /* Current record is being written by guest. '=' is important here,
|
---|
230 | * because the guest will do a FLUSH at this condition.
|
---|
231 | * This partial record is too large for the ring buffer and must
|
---|
232 | * be accumulated in an allocated buffer.
|
---|
233 | */
|
---|
234 | if (cbRecord >= pVBVA->cbData - pVBVA->cbPartialWriteThreshold)
|
---|
235 | {
|
---|
236 | /* Partial read must be started. */
|
---|
237 | if (!vbvaPartialRead (pPartialRecord, cbRecord, pVBVA))
|
---|
238 | {
|
---|
239 | return false;
|
---|
240 | }
|
---|
241 |
|
---|
242 | LOGVBVABUFFER(("started partial record cb = 0x%08X cbRecord 0x%08X, first = %d, free = %d\n",
|
---|
243 | pPartialRecord->cb, cbRecordCurrent, indexRecordFirst, indexRecordFree));
|
---|
244 | }
|
---|
245 |
|
---|
246 | return true;
|
---|
247 | }
|
---|
248 |
|
---|
249 | /* Current record is complete. If it is not empty, process it. */
|
---|
250 | if (cbRecord)
|
---|
251 | {
|
---|
252 | /* The size of largest contiguous chunk in the ring biffer. */
|
---|
253 | uint32_t u32BytesTillBoundary = pVBVA->cbData - pVBVA->off32Data;
|
---|
254 |
|
---|
255 | /* The pointer to data in the ring buffer. */
|
---|
256 | uint8_t *src = &pVBVA->au8Data[pVBVA->off32Data];
|
---|
257 |
|
---|
258 | /* Fetch or point the data. */
|
---|
259 | if (u32BytesTillBoundary >= cbRecord)
|
---|
260 | {
|
---|
261 | /* The command does not cross buffer boundary. Return address in the buffer. */
|
---|
262 | *ppHdr = (VBVACMDHDR *)src;
|
---|
263 |
|
---|
264 | /* Advance data offset. */
|
---|
265 | pVBVA->off32Data = (pVBVA->off32Data + cbRecord) % pVBVA->cbData;
|
---|
266 | }
|
---|
267 | else
|
---|
268 | {
|
---|
269 | /* The command crosses buffer boundary. Rare case, so not optimized. */
|
---|
270 | uint8_t *dst = (uint8_t *)RTMemAlloc (cbRecord);
|
---|
271 |
|
---|
272 | if (!dst)
|
---|
273 | {
|
---|
274 | LogFlowFunc (("could not allocate %d bytes from heap!!!\n", cbRecord));
|
---|
275 | pVBVA->off32Data = (pVBVA->off32Data + cbRecord) % pVBVA->cbData;
|
---|
276 | return false;
|
---|
277 | }
|
---|
278 |
|
---|
279 | vbvaFetchBytes (pVBVA, dst, cbRecord);
|
---|
280 |
|
---|
281 | *ppHdr = (VBVACMDHDR *)dst;
|
---|
282 |
|
---|
283 | LOGVBVABUFFER(("Allocated from heap %p\n", dst));
|
---|
284 | }
|
---|
285 | }
|
---|
286 |
|
---|
287 | *pcbCmd = cbRecord;
|
---|
288 |
|
---|
289 | /* Advance the record index. */
|
---|
290 | pVBVA->indexRecordFirst = (indexRecordFirst + 1) % RT_ELEMENTS(pVBVA->aRecords);
|
---|
291 |
|
---|
292 | LOGVBVABUFFER(("done ok, data = %d, free = %d\n",
|
---|
293 | pVBVA->off32Data, pVBVA->off32Free));
|
---|
294 |
|
---|
295 | return true;
|
---|
296 | }
|
---|
297 |
|
---|
298 | static void vbvaReleaseCmd (VBVAPARTIALRECORD *pPartialRecord, VBVABUFFER *pVBVA, VBVACMDHDR *pHdr, uint32_t cbCmd)
|
---|
299 | {
|
---|
300 | uint8_t *au8RingBuffer = &pVBVA->au8Data[0];
|
---|
301 |
|
---|
302 | if ( (uint8_t *)pHdr >= au8RingBuffer
|
---|
303 | && (uint8_t *)pHdr < &au8RingBuffer[pVBVA->cbData])
|
---|
304 | {
|
---|
305 | /* The pointer is inside ring buffer. Must be continuous chunk. */
|
---|
306 | Assert (pVBVA->cbData - ((uint8_t *)pHdr - au8RingBuffer) >= cbCmd);
|
---|
307 |
|
---|
308 | /* Do nothing. */
|
---|
309 |
|
---|
310 | Assert (!pPartialRecord->pu8 && pPartialRecord->cb == 0);
|
---|
311 | }
|
---|
312 | else
|
---|
313 | {
|
---|
314 | /* The pointer is outside. It is then an allocated copy. */
|
---|
315 | LOGVBVABUFFER(("Free heap %p\n", pHdr));
|
---|
316 |
|
---|
317 | if ((uint8_t *)pHdr == pPartialRecord->pu8)
|
---|
318 | {
|
---|
319 | pPartialRecord->pu8 = NULL;
|
---|
320 | pPartialRecord->cb = 0;
|
---|
321 | }
|
---|
322 | else
|
---|
323 | {
|
---|
324 | Assert (!pPartialRecord->pu8 && pPartialRecord->cb == 0);
|
---|
325 | }
|
---|
326 |
|
---|
327 | RTMemFree (pHdr);
|
---|
328 | }
|
---|
329 |
|
---|
330 | return;
|
---|
331 | }
|
---|
332 |
|
---|
333 | static int vbvaFlushProcess (unsigned uScreenId, PVGASTATE pVGAState, VBVAPARTIALRECORD *pPartialRecord, VBVABUFFER *pVBVA)
|
---|
334 | {
|
---|
335 | LOGVBVABUFFER(("uScreenId %d, indexRecordFirst = %d, indexRecordFree = %d, off32Data = %d, off32Free = %d\n",
|
---|
336 | uScreenId, pVBVA->indexRecordFirst, pVBVA->indexRecordFree, pVBVA->off32Data, pVBVA->off32Free));
|
---|
337 | struct {
|
---|
338 | /* The rectangle that includes all dirty rectangles. */
|
---|
339 | int32_t xLeft;
|
---|
340 | int32_t xRight;
|
---|
341 | int32_t yTop;
|
---|
342 | int32_t yBottom;
|
---|
343 | } dirtyRect;
|
---|
344 | RT_ZERO(dirtyRect);
|
---|
345 |
|
---|
346 | bool fUpdate = false; /* Whether there were any updates. */
|
---|
347 | bool fDirtyEmpty = true;
|
---|
348 |
|
---|
349 | for (;;)
|
---|
350 | {
|
---|
351 | VBVACMDHDR *phdr = NULL;
|
---|
352 | uint32_t cbCmd = ~0;
|
---|
353 |
|
---|
354 | /* Fetch the command data. */
|
---|
355 | if (!vbvaFetchCmd (pPartialRecord, pVBVA, &phdr, &cbCmd))
|
---|
356 | {
|
---|
357 | LogFunc(("unable to fetch command. off32Data = %d, off32Free = %d!!!\n",
|
---|
358 | pVBVA->off32Data, pVBVA->off32Free));
|
---|
359 |
|
---|
360 | /* @todo old code disabled VBVA processing here. */
|
---|
361 | return VERR_NOT_SUPPORTED;
|
---|
362 | }
|
---|
363 |
|
---|
364 | if (cbCmd == uint32_t(~0))
|
---|
365 | {
|
---|
366 | /* No more commands yet in the queue. */
|
---|
367 | break;
|
---|
368 | }
|
---|
369 |
|
---|
370 | if (cbCmd != 0)
|
---|
371 | {
|
---|
372 | if (!fUpdate)
|
---|
373 | {
|
---|
374 | pVGAState->pDrv->pfnVBVAUpdateBegin (pVGAState->pDrv, uScreenId);
|
---|
375 | fUpdate = true;
|
---|
376 | }
|
---|
377 |
|
---|
378 | /* Updates the rectangle and sends the command to the VRDP server. */
|
---|
379 | pVGAState->pDrv->pfnVBVAUpdateProcess (pVGAState->pDrv, uScreenId, phdr, cbCmd);
|
---|
380 |
|
---|
381 | int32_t xRight = phdr->x + phdr->w;
|
---|
382 | int32_t yBottom = phdr->y + phdr->h;
|
---|
383 |
|
---|
384 | /* These are global coords, relative to the primary screen. */
|
---|
385 |
|
---|
386 | LOGVBVABUFFER(("cbCmd = %d, x=%d, y=%d, w=%d, h=%d\n",
|
---|
387 | cbCmd, phdr->x, phdr->y, phdr->w, phdr->h));
|
---|
388 | LogRel3(("%s: update command cbCmd = %d, x=%d, y=%d, w=%d, h=%d\n",
|
---|
389 | __PRETTY_FUNCTION__, cbCmd, phdr->x, phdr->y, phdr->w,
|
---|
390 | phdr->h));
|
---|
391 |
|
---|
392 | /* Collect all rects into one. */
|
---|
393 | if (fDirtyEmpty)
|
---|
394 | {
|
---|
395 | /* This is the first rectangle to be added. */
|
---|
396 | dirtyRect.xLeft = phdr->x;
|
---|
397 | dirtyRect.yTop = phdr->y;
|
---|
398 | dirtyRect.xRight = xRight;
|
---|
399 | dirtyRect.yBottom = yBottom;
|
---|
400 | fDirtyEmpty = false;
|
---|
401 | }
|
---|
402 | else
|
---|
403 | {
|
---|
404 | /* Adjust region coordinates. */
|
---|
405 | if (dirtyRect.xLeft > phdr->x)
|
---|
406 | {
|
---|
407 | dirtyRect.xLeft = phdr->x;
|
---|
408 | }
|
---|
409 |
|
---|
410 | if (dirtyRect.yTop > phdr->y)
|
---|
411 | {
|
---|
412 | dirtyRect.yTop = phdr->y;
|
---|
413 | }
|
---|
414 |
|
---|
415 | if (dirtyRect.xRight < xRight)
|
---|
416 | {
|
---|
417 | dirtyRect.xRight = xRight;
|
---|
418 | }
|
---|
419 |
|
---|
420 | if (dirtyRect.yBottom < yBottom)
|
---|
421 | {
|
---|
422 | dirtyRect.yBottom = yBottom;
|
---|
423 | }
|
---|
424 | }
|
---|
425 | }
|
---|
426 |
|
---|
427 | vbvaReleaseCmd (pPartialRecord, pVBVA, phdr, cbCmd);
|
---|
428 | }
|
---|
429 |
|
---|
430 | if (fUpdate)
|
---|
431 | {
|
---|
432 | if (dirtyRect.xRight - dirtyRect.xLeft)
|
---|
433 | {
|
---|
434 | LogRel3(("%s: sending update screen=%d, x=%d, y=%d, w=%d, h=%d\n",
|
---|
435 | __PRETTY_FUNCTION__, uScreenId, dirtyRect.xLeft,
|
---|
436 | dirtyRect.yTop, dirtyRect.xRight - dirtyRect.xLeft,
|
---|
437 | dirtyRect.yBottom - dirtyRect.yTop));
|
---|
438 | pVGAState->pDrv->pfnVBVAUpdateEnd (pVGAState->pDrv, uScreenId, dirtyRect.xLeft, dirtyRect.yTop,
|
---|
439 | dirtyRect.xRight - dirtyRect.xLeft, dirtyRect.yBottom - dirtyRect.yTop);
|
---|
440 | }
|
---|
441 | else
|
---|
442 | {
|
---|
443 | pVGAState->pDrv->pfnVBVAUpdateEnd (pVGAState->pDrv, uScreenId, 0, 0, 0, 0);
|
---|
444 | }
|
---|
445 | }
|
---|
446 |
|
---|
447 | return VINF_SUCCESS;
|
---|
448 | }
|
---|
449 |
|
---|
450 | static int vbvaFlush (PVGASTATE pVGAState, VBVACONTEXT *pCtx)
|
---|
451 | {
|
---|
452 | unsigned uScreenId;
|
---|
453 |
|
---|
454 | for (uScreenId = 0; uScreenId < pCtx->cViews; uScreenId++)
|
---|
455 | {
|
---|
456 | VBVAPARTIALRECORD *pPartialRecord = &pCtx->aViews[uScreenId].partialRecord;
|
---|
457 | VBVABUFFER *pVBVA = pCtx->aViews[uScreenId].pVBVA;
|
---|
458 |
|
---|
459 | if (pVBVA)
|
---|
460 | {
|
---|
461 | vbvaFlushProcess (uScreenId, pVGAState, pPartialRecord, pVBVA);
|
---|
462 | }
|
---|
463 | }
|
---|
464 |
|
---|
465 | /* @todo rc */
|
---|
466 | return VINF_SUCCESS;
|
---|
467 | }
|
---|
468 |
|
---|
469 | static int vbvaResize (PVGASTATE pVGAState, VBVAVIEW *pView, const VBVAINFOSCREEN *pNewScreen)
|
---|
470 | {
|
---|
471 | /* Verify pNewScreen. */
|
---|
472 | /* @todo */
|
---|
473 |
|
---|
474 | /* Apply these changes. */
|
---|
475 | pView->screen = *pNewScreen;
|
---|
476 |
|
---|
477 | uint8_t *pu8VRAM = pVGAState->vram_ptrR3 + pView->view.u32ViewOffset;
|
---|
478 |
|
---|
479 | int rc = pVGAState->pDrv->pfnVBVAResize (pVGAState->pDrv, &pView->view, &pView->screen, pu8VRAM);
|
---|
480 |
|
---|
481 | /* @todo process VINF_VGA_RESIZE_IN_PROGRESS? */
|
---|
482 |
|
---|
483 | return rc;
|
---|
484 | }
|
---|
485 |
|
---|
486 | static int vbvaEnable (unsigned uScreenId, PVGASTATE pVGAState, VBVACONTEXT *pCtx, VBVABUFFER *pVBVA, uint32_t u32Offset, bool fRestored)
|
---|
487 | {
|
---|
488 | /* @todo old code did a UpdateDisplayAll at this place. */
|
---|
489 |
|
---|
490 | int rc;
|
---|
491 |
|
---|
492 | if (pVGAState->pDrv->pfnVBVAEnable)
|
---|
493 | {
|
---|
494 | pVBVA->hostFlags.u32HostEvents = 0;
|
---|
495 | pVBVA->hostFlags.u32SupportedOrders = 0;
|
---|
496 |
|
---|
497 | rc = pVGAState->pDrv->pfnVBVAEnable (pVGAState->pDrv, uScreenId, &pVBVA->hostFlags);
|
---|
498 | }
|
---|
499 | else
|
---|
500 | {
|
---|
501 | rc = VERR_NOT_SUPPORTED;
|
---|
502 | }
|
---|
503 |
|
---|
504 | if (RT_SUCCESS (rc))
|
---|
505 | {
|
---|
506 | /* pVBVA->hostFlags has been set up by pfnVBVAEnable. */
|
---|
507 | LogFlowFunc(("u32HostEvents 0x%08X, u32SupportedOrders 0x%08X\n",
|
---|
508 | pVBVA->hostFlags.u32HostEvents, pVBVA->hostFlags.u32SupportedOrders));
|
---|
509 |
|
---|
510 | if (!fRestored)
|
---|
511 | {
|
---|
512 | /* @todo Actually this function must not touch the partialRecord structure at all,
|
---|
513 | * because initially it is a zero and when VBVA is disabled this should be set to zero.
|
---|
514 | * But I'm not sure that no code depends on zeroing partialRecord here.
|
---|
515 | * So for now (a quick fix for 4.1) just do not do this if the VM was restored,
|
---|
516 | * when partialRecord might be loaded already from the saved state.
|
---|
517 | */
|
---|
518 | pCtx->aViews[uScreenId].partialRecord.pu8 = NULL;
|
---|
519 | pCtx->aViews[uScreenId].partialRecord.cb = 0;
|
---|
520 | }
|
---|
521 |
|
---|
522 | pCtx->aViews[uScreenId].pVBVA = pVBVA;
|
---|
523 | pCtx->aViews[uScreenId].u32VBVAOffset = u32Offset;
|
---|
524 | }
|
---|
525 |
|
---|
526 | return rc;
|
---|
527 | }
|
---|
528 |
|
---|
529 | static int vbvaDisable (unsigned uScreenId, PVGASTATE pVGAState, VBVACONTEXT *pCtx)
|
---|
530 | {
|
---|
531 | /* Process any pending orders and empty the VBVA ring buffer. */
|
---|
532 | vbvaFlush (pVGAState, pCtx);
|
---|
533 |
|
---|
534 | VBVAVIEW *pView = &pCtx->aViews[uScreenId];
|
---|
535 |
|
---|
536 | if (pView->pVBVA)
|
---|
537 | {
|
---|
538 | pView->pVBVA->hostFlags.u32HostEvents = 0;
|
---|
539 | pView->pVBVA->hostFlags.u32SupportedOrders = 0;
|
---|
540 |
|
---|
541 | pView->partialRecord.pu8 = NULL;
|
---|
542 | pView->partialRecord.cb = 0;
|
---|
543 |
|
---|
544 | pView->pVBVA = NULL;
|
---|
545 | pView->u32VBVAOffset = HGSMIOFFSET_VOID;
|
---|
546 | }
|
---|
547 |
|
---|
548 | pVGAState->pDrv->pfnVBVADisable (pVGAState->pDrv, uScreenId);
|
---|
549 | return VINF_SUCCESS;
|
---|
550 | }
|
---|
551 |
|
---|
552 | bool VBVAIsEnabled(PVGASTATE pVGAState)
|
---|
553 | {
|
---|
554 | PHGSMIINSTANCE pHGSMI = pVGAState->pHGSMI;
|
---|
555 | if (pHGSMI)
|
---|
556 | {
|
---|
557 | VBVACONTEXT *pCtx = (VBVACONTEXT *)HGSMIContext(pHGSMI);
|
---|
558 | if (pCtx)
|
---|
559 | {
|
---|
560 | if (pCtx->cViews)
|
---|
561 | {
|
---|
562 | VBVAVIEW * pView = &pCtx->aViews[0];
|
---|
563 | if (pView->pVBVA)
|
---|
564 | return true;
|
---|
565 | }
|
---|
566 | }
|
---|
567 | }
|
---|
568 | return false;
|
---|
569 | }
|
---|
570 |
|
---|
571 | #ifdef DEBUG_sunlover
|
---|
572 | void dumpMouseShapeInfo(const VBVAMOUSESHAPEINFO *pMouseShapeInfo)
|
---|
573 | {
|
---|
574 | LogFlow(("fSet = %d, fVisible %d, fAlpha %d, @%d,%d %dx%d (%p, %d/%d)\n",
|
---|
575 | pMouseShapeInfo->fSet,
|
---|
576 | pMouseShapeInfo->fVisible,
|
---|
577 | pMouseShapeInfo->fAlpha,
|
---|
578 | pMouseShapeInfo->u32HotX,
|
---|
579 | pMouseShapeInfo->u32HotY,
|
---|
580 | pMouseShapeInfo->u32Width,
|
---|
581 | pMouseShapeInfo->u32Height,
|
---|
582 | pMouseShapeInfo->pu8Shape,
|
---|
583 | pMouseShapeInfo->cbShape,
|
---|
584 | pMouseShapeInfo->cbAllocated
|
---|
585 | ));
|
---|
586 | }
|
---|
587 | #endif
|
---|
588 |
|
---|
589 | static int vbvaUpdateMousePointerShape(PVGASTATE pVGAState, VBVAMOUSESHAPEINFO *pMouseShapeInfo, bool fShape, const uint8_t *pu8Shape)
|
---|
590 | {
|
---|
591 | int rc;
|
---|
592 | LogFlowFunc(("pVGAState %p, pMouseShapeInfo %p, fShape %d, pu8Shape %p\n",
|
---|
593 | pVGAState, pMouseShapeInfo, fShape, pu8Shape));
|
---|
594 | #ifdef DEBUG_sunlover
|
---|
595 | dumpMouseShapeInfo(pMouseShapeInfo);
|
---|
596 | #endif
|
---|
597 |
|
---|
598 | if (fShape && pu8Shape != NULL)
|
---|
599 | {
|
---|
600 | rc = pVGAState->pDrv->pfnVBVAMousePointerShape (pVGAState->pDrv,
|
---|
601 | pMouseShapeInfo->fVisible,
|
---|
602 | pMouseShapeInfo->fAlpha,
|
---|
603 | pMouseShapeInfo->u32HotX,
|
---|
604 | pMouseShapeInfo->u32HotY,
|
---|
605 | pMouseShapeInfo->u32Width,
|
---|
606 | pMouseShapeInfo->u32Height,
|
---|
607 | pu8Shape);
|
---|
608 | }
|
---|
609 | else
|
---|
610 | {
|
---|
611 | rc = pVGAState->pDrv->pfnVBVAMousePointerShape (pVGAState->pDrv,
|
---|
612 | pMouseShapeInfo->fVisible,
|
---|
613 | false,
|
---|
614 | 0, 0,
|
---|
615 | 0, 0,
|
---|
616 | NULL);
|
---|
617 | }
|
---|
618 |
|
---|
619 | return rc;
|
---|
620 | }
|
---|
621 |
|
---|
622 | static int vbvaMousePointerShape (PVGASTATE pVGAState, VBVACONTEXT *pCtx, const VBVAMOUSEPOINTERSHAPE *pShape, HGSMISIZE cbShape)
|
---|
623 | {
|
---|
624 | bool fVisible = (pShape->fu32Flags & VBOX_MOUSE_POINTER_VISIBLE) != 0;
|
---|
625 | bool fAlpha = (pShape->fu32Flags & VBOX_MOUSE_POINTER_ALPHA) != 0;
|
---|
626 | bool fShape = (pShape->fu32Flags & VBOX_MOUSE_POINTER_SHAPE) != 0;
|
---|
627 |
|
---|
628 | HGSMISIZE cbPointerData = 0;
|
---|
629 |
|
---|
630 | if (fShape)
|
---|
631 | {
|
---|
632 | cbPointerData = ((((pShape->u32Width + 7) / 8) * pShape->u32Height + 3) & ~3)
|
---|
633 | + pShape->u32Width * 4 * pShape->u32Height;
|
---|
634 | }
|
---|
635 |
|
---|
636 | if (cbPointerData > cbShape - RT_OFFSETOF(VBVAMOUSEPOINTERSHAPE, au8Data))
|
---|
637 | {
|
---|
638 | Log(("vbvaMousePointerShape: calculated pointer data size is too big (%d bytes, limit %d)\n",
|
---|
639 | cbPointerData, cbShape - RT_OFFSETOF(VBVAMOUSEPOINTERSHAPE, au8Data)));
|
---|
640 | return VERR_INVALID_PARAMETER;
|
---|
641 | }
|
---|
642 |
|
---|
643 | /* Save mouse info it will be used to restore mouse pointer after restoring saved state. */
|
---|
644 | pCtx->mouseShapeInfo.fSet = true;
|
---|
645 | pCtx->mouseShapeInfo.fVisible = fVisible;
|
---|
646 | pCtx->mouseShapeInfo.fAlpha = fAlpha;
|
---|
647 | if (fShape)
|
---|
648 | {
|
---|
649 | /* Data related to shape. */
|
---|
650 | pCtx->mouseShapeInfo.u32HotX = pShape->u32HotX;
|
---|
651 | pCtx->mouseShapeInfo.u32HotY = pShape->u32HotY;
|
---|
652 | pCtx->mouseShapeInfo.u32Width = pShape->u32Width;
|
---|
653 | pCtx->mouseShapeInfo.u32Height = pShape->u32Height;
|
---|
654 |
|
---|
655 | /* Reallocate memory buffer if necessary. */
|
---|
656 | if (cbPointerData > pCtx->mouseShapeInfo.cbAllocated)
|
---|
657 | {
|
---|
658 | RTMemFree (pCtx->mouseShapeInfo.pu8Shape);
|
---|
659 | pCtx->mouseShapeInfo.pu8Shape = NULL;
|
---|
660 | pCtx->mouseShapeInfo.cbShape = 0;
|
---|
661 |
|
---|
662 | uint8_t *pu8Shape = (uint8_t *)RTMemAlloc (cbPointerData);
|
---|
663 | if (pu8Shape)
|
---|
664 | {
|
---|
665 | pCtx->mouseShapeInfo.pu8Shape = pu8Shape;
|
---|
666 | pCtx->mouseShapeInfo.cbAllocated = cbPointerData;
|
---|
667 | }
|
---|
668 | }
|
---|
669 |
|
---|
670 | /* Copy shape bitmaps. */
|
---|
671 | if (pCtx->mouseShapeInfo.pu8Shape)
|
---|
672 | {
|
---|
673 | memcpy (pCtx->mouseShapeInfo.pu8Shape, &pShape->au8Data[0], cbPointerData);
|
---|
674 | pCtx->mouseShapeInfo.cbShape = cbPointerData;
|
---|
675 | }
|
---|
676 | }
|
---|
677 |
|
---|
678 | if (pVGAState->pDrv->pfnVBVAMousePointerShape == NULL)
|
---|
679 | {
|
---|
680 | return VERR_NOT_SUPPORTED;
|
---|
681 | }
|
---|
682 |
|
---|
683 | int rc = vbvaUpdateMousePointerShape(pVGAState, &pCtx->mouseShapeInfo, fShape, &pShape->au8Data[0]);
|
---|
684 |
|
---|
685 | return rc;
|
---|
686 | }
|
---|
687 |
|
---|
688 | static unsigned vbvaViewFromOffset (PHGSMIINSTANCE pIns, VBVACONTEXT *pCtx, const void *pvBuffer)
|
---|
689 | {
|
---|
690 | /* Check which view contains the buffer. */
|
---|
691 | HGSMIOFFSET offBuffer = HGSMIPointerToOffsetHost (pIns, pvBuffer);
|
---|
692 |
|
---|
693 | if (offBuffer != HGSMIOFFSET_VOID)
|
---|
694 | {
|
---|
695 | unsigned uScreenId;
|
---|
696 |
|
---|
697 | for (uScreenId = 0; uScreenId < pCtx->cViews; uScreenId++)
|
---|
698 | {
|
---|
699 | VBVAINFOVIEW *pView = &pCtx->aViews[uScreenId].view;
|
---|
700 |
|
---|
701 | if ( pView->u32ViewSize > 0
|
---|
702 | && pView->u32ViewOffset <= offBuffer
|
---|
703 | && offBuffer <= pView->u32ViewOffset + pView->u32ViewSize - 1)
|
---|
704 | {
|
---|
705 | return pView->u32ViewIndex;
|
---|
706 | }
|
---|
707 | }
|
---|
708 | }
|
---|
709 |
|
---|
710 | return ~0U;
|
---|
711 | }
|
---|
712 |
|
---|
713 | #ifdef DEBUG_sunlover
|
---|
714 | static void dumpctx(const VBVACONTEXT *pCtx)
|
---|
715 | {
|
---|
716 | Log(("VBVACONTEXT dump: cViews %d\n", pCtx->cViews));
|
---|
717 |
|
---|
718 | uint32_t iView;
|
---|
719 | for (iView = 0; iView < pCtx->cViews; iView++)
|
---|
720 | {
|
---|
721 | const VBVAVIEW *pView = &pCtx->aViews[iView];
|
---|
722 |
|
---|
723 | Log((" view %d o 0x%x s 0x%x m 0x%x\n",
|
---|
724 | pView->view.u32ViewIndex,
|
---|
725 | pView->view.u32ViewOffset,
|
---|
726 | pView->view.u32ViewSize,
|
---|
727 | pView->view.u32MaxScreenSize));
|
---|
728 |
|
---|
729 | Log((" screen %d @%d,%d s 0x%x l 0x%x %dx%d bpp %d f 0x%x\n",
|
---|
730 | pView->screen.u32ViewIndex,
|
---|
731 | pView->screen.i32OriginX,
|
---|
732 | pView->screen.i32OriginY,
|
---|
733 | pView->screen.u32StartOffset,
|
---|
734 | pView->screen.u32LineSize,
|
---|
735 | pView->screen.u32Width,
|
---|
736 | pView->screen.u32Height,
|
---|
737 | pView->screen.u16BitsPerPixel,
|
---|
738 | pView->screen.u16Flags));
|
---|
739 |
|
---|
740 | Log((" VBVA o 0x%x p %p\n",
|
---|
741 | pView->u32VBVAOffset,
|
---|
742 | pView->pVBVA));
|
---|
743 |
|
---|
744 | Log((" PR cb 0x%x p %p\n",
|
---|
745 | pView->partialRecord.cb,
|
---|
746 | pView->partialRecord.pu8));
|
---|
747 | }
|
---|
748 |
|
---|
749 | dumpMouseShapeInfo(&pCtx->mouseShapeInfo);
|
---|
750 | }
|
---|
751 | #endif /* DEBUG_sunlover */
|
---|
752 |
|
---|
753 | #define VBOXVBVASAVEDSTATE_VHWAAVAILABLE_MAGIC 0x12345678
|
---|
754 | #define VBOXVBVASAVEDSTATE_VHWAUNAVAILABLE_MAGIC 0x9abcdef0
|
---|
755 |
|
---|
756 | #ifdef VBOX_WITH_VIDEOHWACCEL
|
---|
757 | static void vbvaVHWAHHCommandReinit(VBOXVHWACMD* pHdr, VBOXVHWACMD_TYPE enmCmd, int32_t iDisplay)
|
---|
758 | {
|
---|
759 | memset(pHdr, 0, VBOXVHWACMD_HEADSIZE());
|
---|
760 | pHdr->cRefs = 1;
|
---|
761 | pHdr->iDisplay = iDisplay;
|
---|
762 | pHdr->rc = VERR_NOT_IMPLEMENTED;
|
---|
763 | pHdr->enmCmd = enmCmd;
|
---|
764 | pHdr->Flags = VBOXVHWACMD_FLAG_HH_CMD;
|
---|
765 | }
|
---|
766 |
|
---|
767 | static VBOXVHWACMD* vbvaVHWAHHCommandCreate (PVGASTATE pVGAState, VBOXVHWACMD_TYPE enmCmd, int32_t iDisplay, VBOXVHWACMD_LENGTH cbCmd)
|
---|
768 | {
|
---|
769 | VBOXVHWACMD* pHdr = (VBOXVHWACMD*)RTMemAlloc(cbCmd + VBOXVHWACMD_HEADSIZE());
|
---|
770 | Assert(pHdr);
|
---|
771 | if (pHdr)
|
---|
772 | vbvaVHWAHHCommandReinit(pHdr, enmCmd, iDisplay);
|
---|
773 |
|
---|
774 | return pHdr;
|
---|
775 | }
|
---|
776 |
|
---|
777 | DECLINLINE(void) vbvaVHWAHHCommandRelease (VBOXVHWACMD* pCmd)
|
---|
778 | {
|
---|
779 | uint32_t cRefs = ASMAtomicDecU32(&pCmd->cRefs);
|
---|
780 | if(!cRefs)
|
---|
781 | {
|
---|
782 | RTMemFree(pCmd);
|
---|
783 | }
|
---|
784 | }
|
---|
785 |
|
---|
786 | DECLINLINE(void) vbvaVHWAHHCommandRetain (VBOXVHWACMD* pCmd)
|
---|
787 | {
|
---|
788 | ASMAtomicIncU32(&pCmd->cRefs);
|
---|
789 | }
|
---|
790 |
|
---|
791 | static unsigned vbvaVHWAHandleCommand (PVGASTATE pVGAState, VBVACONTEXT *pCtx, PVBOXVHWACMD pCmd)
|
---|
792 | {
|
---|
793 | if (pVGAState->pDrv->pfnVHWACommandProcess)
|
---|
794 | pVGAState->pDrv->pfnVHWACommandProcess(pVGAState->pDrv, pCmd);
|
---|
795 | #ifdef DEBUG_misha
|
---|
796 | else
|
---|
797 | AssertFailed();
|
---|
798 | #endif
|
---|
799 | return 0;
|
---|
800 | }
|
---|
801 |
|
---|
802 | static DECLCALLBACK(void) vbvaVHWAHHCommandSetEventCallback(void * pContext)
|
---|
803 | {
|
---|
804 | RTSemEventSignal((RTSEMEVENT)pContext);
|
---|
805 | }
|
---|
806 |
|
---|
807 | static int vbvaVHWAHHCommandPost(PVGASTATE pVGAState, VBOXVHWACMD* pCmd)
|
---|
808 | {
|
---|
809 | RTSEMEVENT hComplEvent;
|
---|
810 | int rc = RTSemEventCreate(&hComplEvent);
|
---|
811 | AssertRC(rc);
|
---|
812 | if(RT_SUCCESS(rc))
|
---|
813 | {
|
---|
814 | /* ensure the cmd is not deleted until we process it */
|
---|
815 | vbvaVHWAHHCommandRetain (pCmd);
|
---|
816 | VBOXVHWA_HH_CALLBACK_SET(pCmd, vbvaVHWAHHCommandSetEventCallback, (void*)hComplEvent);
|
---|
817 | vbvaVHWAHandleCommand(pVGAState, NULL, pCmd);
|
---|
818 | if((ASMAtomicReadU32((volatile uint32_t *)&pCmd->Flags) & VBOXVHWACMD_FLAG_HG_ASYNCH) != 0)
|
---|
819 | {
|
---|
820 | rc = RTSemEventWaitNoResume(hComplEvent, RT_INDEFINITE_WAIT);
|
---|
821 | }
|
---|
822 | else
|
---|
823 | {
|
---|
824 | /* the command is completed */
|
---|
825 | }
|
---|
826 |
|
---|
827 | AssertRC(rc);
|
---|
828 | if(RT_SUCCESS(rc))
|
---|
829 | {
|
---|
830 | RTSemEventDestroy(hComplEvent);
|
---|
831 | }
|
---|
832 | vbvaVHWAHHCommandRelease(pCmd);
|
---|
833 | }
|
---|
834 | return rc;
|
---|
835 | }
|
---|
836 |
|
---|
837 | int vbvaVHWAConstruct (PVGASTATE pVGAState)
|
---|
838 | {
|
---|
839 | VBOXVHWACMD *pCmd = vbvaVHWAHHCommandCreate(pVGAState, VBOXVHWACMD_TYPE_HH_CONSTRUCT, 0, sizeof(VBOXVHWACMD_HH_CONSTRUCT));
|
---|
840 | Assert(pCmd);
|
---|
841 | if(pCmd)
|
---|
842 | {
|
---|
843 | uint32_t iDisplay = 0;
|
---|
844 | int rc = VINF_SUCCESS;
|
---|
845 | VBOXVHWACMD_HH_CONSTRUCT * pBody = VBOXVHWACMD_BODY(pCmd, VBOXVHWACMD_HH_CONSTRUCT);
|
---|
846 |
|
---|
847 | do
|
---|
848 | {
|
---|
849 | memset(pBody, 0, sizeof(VBOXVHWACMD_HH_CONSTRUCT));
|
---|
850 |
|
---|
851 | PPDMDEVINS pDevIns = pVGAState->pDevInsR3;
|
---|
852 | PVM pVM = PDMDevHlpGetVM(pDevIns);
|
---|
853 |
|
---|
854 | pBody->pVM = pVM;
|
---|
855 | pBody->pvVRAM = pVGAState->vram_ptrR3;
|
---|
856 | pBody->cbVRAM = pVGAState->vram_size;
|
---|
857 |
|
---|
858 | rc = vbvaVHWAHHCommandPost(pVGAState, pCmd);
|
---|
859 | AssertRC(rc);
|
---|
860 | if(RT_SUCCESS(rc))
|
---|
861 | {
|
---|
862 | rc = pCmd->rc;
|
---|
863 | AssertMsg(RT_SUCCESS(rc) || rc == VERR_NOT_IMPLEMENTED, ("%Rrc\n", rc));
|
---|
864 | if(rc == VERR_NOT_IMPLEMENTED)
|
---|
865 | {
|
---|
866 | /* @todo: set some flag in pVGAState indicating VHWA is not supported */
|
---|
867 | /* VERR_NOT_IMPLEMENTED is not a failure, we just do not support it */
|
---|
868 | rc = VINF_SUCCESS;
|
---|
869 | }
|
---|
870 |
|
---|
871 | if (!RT_SUCCESS(rc))
|
---|
872 | break;
|
---|
873 | }
|
---|
874 | else
|
---|
875 | break;
|
---|
876 |
|
---|
877 | ++iDisplay;
|
---|
878 | if (iDisplay >= pVGAState->cMonitors)
|
---|
879 | break;
|
---|
880 | vbvaVHWAHHCommandReinit(pCmd, VBOXVHWACMD_TYPE_HH_CONSTRUCT, (int32_t)iDisplay);
|
---|
881 | } while (true);
|
---|
882 |
|
---|
883 | vbvaVHWAHHCommandRelease(pCmd);
|
---|
884 |
|
---|
885 | return rc;
|
---|
886 | }
|
---|
887 | return VERR_OUT_OF_RESOURCES;
|
---|
888 | }
|
---|
889 |
|
---|
890 | int vbvaVHWAReset (PVGASTATE pVGAState)
|
---|
891 | {
|
---|
892 | /* ensure we have all pending cmds processed and h->g cmds disabled */
|
---|
893 | VBOXVHWACMD *pCmd = vbvaVHWAHHCommandCreate(pVGAState, VBOXVHWACMD_TYPE_HH_RESET, 0, 0);
|
---|
894 | Assert(pCmd);
|
---|
895 | if(pCmd)
|
---|
896 | {
|
---|
897 | int rc = VINF_SUCCESS;
|
---|
898 | uint32_t iDisplay = 0;
|
---|
899 |
|
---|
900 | do
|
---|
901 | {
|
---|
902 | rc =vbvaVHWAHHCommandPost(pVGAState, pCmd);
|
---|
903 | AssertRC(rc);
|
---|
904 | if(RT_SUCCESS(rc))
|
---|
905 | {
|
---|
906 | rc = pCmd->rc;
|
---|
907 | AssertMsg(RT_SUCCESS(rc) || rc == VERR_NOT_IMPLEMENTED, ("%Rrc\n", rc));
|
---|
908 | if (rc == VERR_NOT_IMPLEMENTED)
|
---|
909 | rc = VINF_SUCCESS;
|
---|
910 | }
|
---|
911 |
|
---|
912 | if (!RT_SUCCESS(rc))
|
---|
913 | break;
|
---|
914 |
|
---|
915 | ++iDisplay;
|
---|
916 | if (iDisplay >= pVGAState->cMonitors)
|
---|
917 | break;
|
---|
918 | vbvaVHWAHHCommandReinit(pCmd, VBOXVHWACMD_TYPE_HH_RESET, (int32_t)iDisplay);
|
---|
919 |
|
---|
920 | } while (true);
|
---|
921 |
|
---|
922 | vbvaVHWAHHCommandRelease(pCmd);
|
---|
923 |
|
---|
924 | return rc;
|
---|
925 | }
|
---|
926 | return VERR_OUT_OF_RESOURCES;
|
---|
927 | }
|
---|
928 |
|
---|
929 | typedef DECLCALLBACK(bool) FNVBOXVHWAHHCMDPRECB(PVGASTATE pVGAState, VBOXVHWACMD *pCmd, uint32_t iDisplay, void *pvContext);
|
---|
930 | typedef FNVBOXVHWAHHCMDPRECB *PFNVBOXVHWAHHCMDPRECB;
|
---|
931 |
|
---|
932 | typedef DECLCALLBACK(bool) FNVBOXVHWAHHCMDPOSTCB(PVGASTATE pVGAState, VBOXVHWACMD *pCmd, uint32_t iDisplay, int rc, void *pvContext);
|
---|
933 | typedef FNVBOXVHWAHHCMDPOSTCB *PFNVBOXVHWAHHCMDPOSTCB;
|
---|
934 |
|
---|
935 | int vbvaVHWAHHPost(PVGASTATE pVGAState, VBOXVHWACMD *pCmd, PFNVBOXVHWAHHCMDPRECB pfnPre, PFNVBOXVHWAHHCMDPOSTCB pfnPost, void *pvContext)
|
---|
936 | {
|
---|
937 | const VBOXVHWACMD_TYPE enmType = pCmd->enmCmd;
|
---|
938 | int rc = VINF_SUCCESS;
|
---|
939 | uint32_t iDisplay = 0;
|
---|
940 |
|
---|
941 | do
|
---|
942 | {
|
---|
943 | if (!pfnPre || pfnPre(pVGAState, pCmd, iDisplay, pvContext))
|
---|
944 | {
|
---|
945 | rc = vbvaVHWAHHCommandPost(pVGAState, pCmd);
|
---|
946 | AssertRC(rc);
|
---|
947 | if (pfnPost)
|
---|
948 | {
|
---|
949 | if (!pfnPost(pVGAState, pCmd, iDisplay, rc, pvContext))
|
---|
950 | {
|
---|
951 | rc = VINF_SUCCESS;
|
---|
952 | break;
|
---|
953 | }
|
---|
954 | rc = VINF_SUCCESS;
|
---|
955 | }
|
---|
956 | else if(RT_SUCCESS(rc))
|
---|
957 | {
|
---|
958 | rc = pCmd->rc;
|
---|
959 | AssertMsg(RT_SUCCESS(rc) || rc == VERR_NOT_IMPLEMENTED, ("%Rrc\n", rc));
|
---|
960 | if(rc == VERR_NOT_IMPLEMENTED)
|
---|
961 | {
|
---|
962 | rc = VINF_SUCCESS;
|
---|
963 | }
|
---|
964 | }
|
---|
965 |
|
---|
966 | if (!RT_SUCCESS(rc))
|
---|
967 | break;
|
---|
968 | }
|
---|
969 |
|
---|
970 | ++iDisplay;
|
---|
971 | if (iDisplay >= pVGAState->cMonitors)
|
---|
972 | break;
|
---|
973 | vbvaVHWAHHCommandReinit(pCmd, enmType, (int32_t)iDisplay);
|
---|
974 | } while (true);
|
---|
975 |
|
---|
976 | return rc;
|
---|
977 | }
|
---|
978 |
|
---|
979 | /* @todo call this also on reset? */
|
---|
980 | int vbvaVHWAEnable (PVGASTATE pVGAState, bool bEnable)
|
---|
981 | {
|
---|
982 | const VBOXVHWACMD_TYPE enmType = bEnable ? VBOXVHWACMD_TYPE_HH_ENABLE : VBOXVHWACMD_TYPE_HH_DISABLE;
|
---|
983 | VBOXVHWACMD *pCmd = vbvaVHWAHHCommandCreate(pVGAState,
|
---|
984 | enmType,
|
---|
985 | 0, 0);
|
---|
986 | Assert(pCmd);
|
---|
987 | if(pCmd)
|
---|
988 | {
|
---|
989 | int rc = vbvaVHWAHHPost (pVGAState, pCmd, NULL, NULL, NULL);
|
---|
990 | vbvaVHWAHHCommandRelease(pCmd);
|
---|
991 | return rc;
|
---|
992 | }
|
---|
993 | return VERR_OUT_OF_RESOURCES;
|
---|
994 | }
|
---|
995 |
|
---|
996 | int vboxVBVASaveStatePrep (PPDMDEVINS pDevIns, PSSMHANDLE pSSM)
|
---|
997 | {
|
---|
998 | /* ensure we have no pending commands */
|
---|
999 | return vbvaVHWAEnable(PDMINS_2_DATA(pDevIns, PVGASTATE), false);
|
---|
1000 | }
|
---|
1001 |
|
---|
1002 | int vboxVBVASaveStateDone (PPDMDEVINS pDevIns, PSSMHANDLE pSSM)
|
---|
1003 | {
|
---|
1004 | /* ensure we have no pending commands */
|
---|
1005 | return vbvaVHWAEnable(PDMINS_2_DATA(pDevIns, PVGASTATE), true);
|
---|
1006 | }
|
---|
1007 |
|
---|
1008 | int vbvaVHWACommandCompleteAsynch(PPDMIDISPLAYVBVACALLBACKS pInterface, PVBOXVHWACMD pCmd)
|
---|
1009 | {
|
---|
1010 | int rc;
|
---|
1011 | if((pCmd->Flags & VBOXVHWACMD_FLAG_HH_CMD) == 0)
|
---|
1012 | {
|
---|
1013 | PVGASTATE pVGAState = PPDMIDISPLAYVBVACALLBACKS_2_PVGASTATE(pInterface);
|
---|
1014 | PHGSMIINSTANCE pIns = pVGAState->pHGSMI;
|
---|
1015 |
|
---|
1016 | Assert(pCmd->Flags & VBOXVHWACMD_FLAG_HG_ASYNCH);
|
---|
1017 | #ifdef VBOX_WITH_WDDM
|
---|
1018 | if (pVGAState->fGuestCaps & VBVACAPS_COMPLETEGCMD_BY_IOREAD)
|
---|
1019 | {
|
---|
1020 | rc = HGSMICompleteGuestCommand(pIns, pCmd, !!(pCmd->Flags & VBOXVHWACMD_FLAG_GH_ASYNCH_IRQ));
|
---|
1021 | AssertRC(rc);
|
---|
1022 | }
|
---|
1023 | else
|
---|
1024 | #endif
|
---|
1025 | {
|
---|
1026 | VBVAHOSTCMD *pHostCmd;
|
---|
1027 | int32_t iDisplay = pCmd->iDisplay;
|
---|
1028 |
|
---|
1029 | if(pCmd->Flags & VBOXVHWACMD_FLAG_GH_ASYNCH_EVENT)
|
---|
1030 | {
|
---|
1031 | rc = HGSMIHostCommandAlloc (pIns,
|
---|
1032 | (void**)&pHostCmd,
|
---|
1033 | VBVAHOSTCMD_SIZE(sizeof(VBVAHOSTCMDEVENT)),
|
---|
1034 | HGSMI_CH_VBVA,
|
---|
1035 | VBVAHG_EVENT);
|
---|
1036 | AssertRC(rc);
|
---|
1037 | if(RT_SUCCESS(rc))
|
---|
1038 | {
|
---|
1039 | memset(pHostCmd, 0 , VBVAHOSTCMD_SIZE(sizeof(VBVAHOSTCMDEVENT)));
|
---|
1040 | pHostCmd->iDstID = pCmd->iDisplay;
|
---|
1041 | pHostCmd->customOpCode = 0;
|
---|
1042 | VBVAHOSTCMDEVENT *pBody = VBVAHOSTCMD_BODY(pHostCmd, VBVAHOSTCMDEVENT);
|
---|
1043 | pBody->pEvent = pCmd->GuestVBVAReserved1;
|
---|
1044 | }
|
---|
1045 | }
|
---|
1046 | else
|
---|
1047 | {
|
---|
1048 | HGSMIOFFSET offCmd = HGSMIPointerToOffsetHost (pIns, pCmd);
|
---|
1049 | Assert(offCmd != HGSMIOFFSET_VOID);
|
---|
1050 | if(offCmd != HGSMIOFFSET_VOID)
|
---|
1051 | {
|
---|
1052 | rc = HGSMIHostCommandAlloc (pIns,
|
---|
1053 | (void**)&pHostCmd,
|
---|
1054 | VBVAHOSTCMD_SIZE(sizeof(VBVAHOSTCMDVHWACMDCOMPLETE)),
|
---|
1055 | HGSMI_CH_VBVA,
|
---|
1056 | VBVAHG_DISPLAY_CUSTOM);
|
---|
1057 | AssertRC(rc);
|
---|
1058 | if(RT_SUCCESS(rc))
|
---|
1059 | {
|
---|
1060 | memset(pHostCmd, 0 , VBVAHOSTCMD_SIZE(sizeof(VBVAHOSTCMDVHWACMDCOMPLETE)));
|
---|
1061 | pHostCmd->iDstID = pCmd->iDisplay;
|
---|
1062 | pHostCmd->customOpCode = VBVAHG_DCUSTOM_VHWA_CMDCOMPLETE;
|
---|
1063 | VBVAHOSTCMDVHWACMDCOMPLETE *pBody = VBVAHOSTCMD_BODY(pHostCmd, VBVAHOSTCMDVHWACMDCOMPLETE);
|
---|
1064 | pBody->offCmd = offCmd;
|
---|
1065 | }
|
---|
1066 | }
|
---|
1067 | else
|
---|
1068 | {
|
---|
1069 | rc = VERR_INVALID_PARAMETER;
|
---|
1070 | }
|
---|
1071 | }
|
---|
1072 |
|
---|
1073 | if(RT_SUCCESS(rc))
|
---|
1074 | {
|
---|
1075 | rc = HGSMIHostCommandProcessAndFreeAsynch(pIns, pHostCmd, (pCmd->Flags & VBOXVHWACMD_FLAG_GH_ASYNCH_IRQ) != 0);
|
---|
1076 | AssertRC(rc);
|
---|
1077 | if(RT_SUCCESS(rc))
|
---|
1078 | {
|
---|
1079 | return rc;
|
---|
1080 | }
|
---|
1081 | HGSMIHostCommandFree (pIns, pHostCmd);
|
---|
1082 | }
|
---|
1083 | }
|
---|
1084 | }
|
---|
1085 | else
|
---|
1086 | {
|
---|
1087 | PFNVBOXVHWA_HH_CALLBACK pfn = VBOXVHWA_HH_CALLBACK_GET(pCmd);
|
---|
1088 | if(pfn)
|
---|
1089 | {
|
---|
1090 | pfn(VBOXVHWA_HH_CALLBACK_GET_ARG(pCmd));
|
---|
1091 | }
|
---|
1092 | rc = VINF_SUCCESS;
|
---|
1093 | }
|
---|
1094 | return rc;
|
---|
1095 | }
|
---|
1096 |
|
---|
1097 | typedef struct VBOXVBVASAVEDSTATECBDATA
|
---|
1098 | {
|
---|
1099 | PSSMHANDLE pSSM;
|
---|
1100 | int rc;
|
---|
1101 | bool ab2DOn[VBOX_VIDEO_MAX_SCREENS];
|
---|
1102 | } VBOXVBVASAVEDSTATECBDATA, *PVBOXVBVASAVEDSTATECBDATA;
|
---|
1103 |
|
---|
1104 | static DECLCALLBACK(bool) vboxVBVASaveStateBeginPostCb(PVGASTATE pVGAState, VBOXVHWACMD *pCmd, uint32_t iDisplay, int rc, void *pvContext)
|
---|
1105 | {
|
---|
1106 | PVBOXVBVASAVEDSTATECBDATA pData = (PVBOXVBVASAVEDSTATECBDATA)pvContext;
|
---|
1107 | if (RT_FAILURE(pData->rc))
|
---|
1108 | return false;
|
---|
1109 | if (RT_FAILURE(rc))
|
---|
1110 | {
|
---|
1111 | pData->rc = rc;
|
---|
1112 | return false;
|
---|
1113 | }
|
---|
1114 |
|
---|
1115 | Assert(iDisplay < RT_ELEMENTS(pData->ab2DOn));
|
---|
1116 | if (iDisplay >= RT_ELEMENTS(pData->ab2DOn))
|
---|
1117 | {
|
---|
1118 | pData->rc = VERR_INVALID_PARAMETER;
|
---|
1119 | return false;
|
---|
1120 | }
|
---|
1121 |
|
---|
1122 | Assert(RT_SUCCESS(pCmd->rc) || pCmd->rc == VERR_NOT_IMPLEMENTED);
|
---|
1123 | if (RT_SUCCESS(pCmd->rc))
|
---|
1124 | {
|
---|
1125 | pData->ab2DOn[iDisplay] = true;
|
---|
1126 | }
|
---|
1127 | else if (pCmd->rc != VERR_NOT_IMPLEMENTED)
|
---|
1128 | {
|
---|
1129 | pData->rc = pCmd->rc;
|
---|
1130 | return false;
|
---|
1131 | }
|
---|
1132 |
|
---|
1133 | return true;
|
---|
1134 | }
|
---|
1135 |
|
---|
1136 | static DECLCALLBACK(bool) vboxVBVASaveStatePerformPreCb(PVGASTATE pVGAState, VBOXVHWACMD *pCmd, uint32_t iDisplay, void *pvContext)
|
---|
1137 | {
|
---|
1138 | PVBOXVBVASAVEDSTATECBDATA pData = (PVBOXVBVASAVEDSTATECBDATA)pvContext;
|
---|
1139 | if (RT_FAILURE(pData->rc))
|
---|
1140 | return false;
|
---|
1141 |
|
---|
1142 | Assert(iDisplay < RT_ELEMENTS(pData->ab2DOn));
|
---|
1143 | if (iDisplay >= RT_ELEMENTS(pData->ab2DOn))
|
---|
1144 | {
|
---|
1145 | pData->rc = VERR_INVALID_PARAMETER;
|
---|
1146 | return false;
|
---|
1147 | }
|
---|
1148 |
|
---|
1149 | int rc;
|
---|
1150 |
|
---|
1151 | if (pData->ab2DOn[iDisplay])
|
---|
1152 | {
|
---|
1153 | rc = SSMR3PutU32 (pData->pSSM, VBOXVBVASAVEDSTATE_VHWAAVAILABLE_MAGIC); AssertRC(rc);
|
---|
1154 | if (RT_FAILURE(rc))
|
---|
1155 | {
|
---|
1156 | pData->rc = rc;
|
---|
1157 | return false;
|
---|
1158 | }
|
---|
1159 | return true;
|
---|
1160 | }
|
---|
1161 |
|
---|
1162 | rc = SSMR3PutU32 (pData->pSSM, VBOXVBVASAVEDSTATE_VHWAUNAVAILABLE_MAGIC); AssertRC(rc);
|
---|
1163 | if (RT_FAILURE(rc))
|
---|
1164 | {
|
---|
1165 | pData->rc = rc;
|
---|
1166 | return false;
|
---|
1167 | }
|
---|
1168 |
|
---|
1169 | return false;
|
---|
1170 | }
|
---|
1171 |
|
---|
1172 | static DECLCALLBACK(bool) vboxVBVASaveStateEndPreCb(PVGASTATE pVGAState, VBOXVHWACMD *pCmd, uint32_t iDisplay, void *pvContext)
|
---|
1173 | {
|
---|
1174 | PVBOXVBVASAVEDSTATECBDATA pData = (PVBOXVBVASAVEDSTATECBDATA)pvContext;
|
---|
1175 | Assert(iDisplay < RT_ELEMENTS(pData->ab2DOn));
|
---|
1176 | if (pData->ab2DOn[iDisplay])
|
---|
1177 | {
|
---|
1178 | return true;
|
---|
1179 | }
|
---|
1180 |
|
---|
1181 | return false;
|
---|
1182 | }
|
---|
1183 |
|
---|
1184 | static DECLCALLBACK(bool) vboxVBVALoadStatePerformPostCb(PVGASTATE pVGAState, VBOXVHWACMD *pCmd, uint32_t iDisplay, int rc, void *pvContext)
|
---|
1185 | {
|
---|
1186 | PVBOXVBVASAVEDSTATECBDATA pData = (PVBOXVBVASAVEDSTATECBDATA)pvContext;
|
---|
1187 | if (RT_FAILURE(pData->rc))
|
---|
1188 | return false;
|
---|
1189 | if (RT_FAILURE(rc))
|
---|
1190 | {
|
---|
1191 | pData->rc = rc;
|
---|
1192 | return false;
|
---|
1193 | }
|
---|
1194 |
|
---|
1195 | Assert(iDisplay < RT_ELEMENTS(pData->ab2DOn));
|
---|
1196 | if (iDisplay >= RT_ELEMENTS(pData->ab2DOn))
|
---|
1197 | {
|
---|
1198 | pData->rc = VERR_INVALID_PARAMETER;
|
---|
1199 | return false;
|
---|
1200 | }
|
---|
1201 |
|
---|
1202 | Assert(RT_SUCCESS(pCmd->rc) || pCmd->rc == VERR_NOT_IMPLEMENTED);
|
---|
1203 | if (pCmd->rc == VERR_NOT_IMPLEMENTED)
|
---|
1204 | {
|
---|
1205 | pData->rc = SSMR3SkipToEndOfUnit(pData->pSSM);
|
---|
1206 | AssertRC(pData->rc);
|
---|
1207 | return false;
|
---|
1208 | }
|
---|
1209 | if (RT_FAILURE(pCmd->rc))
|
---|
1210 | {
|
---|
1211 | pData->rc = pCmd->rc;
|
---|
1212 | return false;
|
---|
1213 | }
|
---|
1214 |
|
---|
1215 | return true;
|
---|
1216 | }
|
---|
1217 |
|
---|
1218 | static DECLCALLBACK(bool) vboxVBVALoadStatePerformPreCb(PVGASTATE pVGAState, VBOXVHWACMD *pCmd, uint32_t iDisplay, void *pvContext)
|
---|
1219 | {
|
---|
1220 | PVBOXVBVASAVEDSTATECBDATA pData = (PVBOXVBVASAVEDSTATECBDATA)pvContext;
|
---|
1221 | if (RT_FAILURE(pData->rc))
|
---|
1222 | return false;
|
---|
1223 |
|
---|
1224 | Assert(iDisplay < RT_ELEMENTS(pData->ab2DOn));
|
---|
1225 | if (iDisplay >= RT_ELEMENTS(pData->ab2DOn))
|
---|
1226 | {
|
---|
1227 | pData->rc = VERR_INVALID_PARAMETER;
|
---|
1228 | return false;
|
---|
1229 | }
|
---|
1230 |
|
---|
1231 | int rc;
|
---|
1232 | uint32_t u32;
|
---|
1233 | rc = SSMR3GetU32(pData->pSSM, &u32); AssertRC(rc);
|
---|
1234 | if (RT_FAILURE(rc))
|
---|
1235 | {
|
---|
1236 | pData->rc = rc;
|
---|
1237 | return false;
|
---|
1238 | }
|
---|
1239 |
|
---|
1240 | switch (u32)
|
---|
1241 | {
|
---|
1242 | case VBOXVBVASAVEDSTATE_VHWAAVAILABLE_MAGIC:
|
---|
1243 | return true;
|
---|
1244 | case VBOXVBVASAVEDSTATE_VHWAUNAVAILABLE_MAGIC:
|
---|
1245 | return false;
|
---|
1246 | default:
|
---|
1247 | pData->rc = VERR_INVALID_STATE;
|
---|
1248 | return false;
|
---|
1249 | }
|
---|
1250 | }
|
---|
1251 | #endif /* #ifdef VBOX_WITH_VIDEOHWACCEL */
|
---|
1252 |
|
---|
1253 | int vboxVBVASaveDevStateExec (PVGASTATE pVGAState, PSSMHANDLE pSSM)
|
---|
1254 | {
|
---|
1255 | PHGSMIINSTANCE pIns = pVGAState->pHGSMI;
|
---|
1256 | int rc = HGSMIHostSaveStateExec (pIns, pSSM);
|
---|
1257 | if (RT_SUCCESS(rc))
|
---|
1258 | {
|
---|
1259 | /* Save VBVACONTEXT. */
|
---|
1260 | VBVACONTEXT *pCtx = (VBVACONTEXT *)HGSMIContext (pIns);
|
---|
1261 |
|
---|
1262 | if (!pCtx)
|
---|
1263 | {
|
---|
1264 | AssertFailed();
|
---|
1265 |
|
---|
1266 | /* Still write a valid value to the SSM. */
|
---|
1267 | rc = SSMR3PutU32 (pSSM, 0);
|
---|
1268 | AssertRCReturn(rc, rc);
|
---|
1269 | }
|
---|
1270 | else
|
---|
1271 | {
|
---|
1272 | #ifdef DEBUG_sunlover
|
---|
1273 | dumpctx(pCtx);
|
---|
1274 | #endif
|
---|
1275 |
|
---|
1276 | rc = SSMR3PutU32 (pSSM, pCtx->cViews);
|
---|
1277 | AssertRCReturn(rc, rc);
|
---|
1278 |
|
---|
1279 | uint32_t iView;
|
---|
1280 | for (iView = 0; iView < pCtx->cViews; iView++)
|
---|
1281 | {
|
---|
1282 | VBVAVIEW *pView = &pCtx->aViews[iView];
|
---|
1283 |
|
---|
1284 | rc = SSMR3PutU32 (pSSM, pView->view.u32ViewIndex);
|
---|
1285 | AssertRCReturn(rc, rc);
|
---|
1286 | rc = SSMR3PutU32 (pSSM, pView->view.u32ViewOffset);
|
---|
1287 | AssertRCReturn(rc, rc);
|
---|
1288 | rc = SSMR3PutU32 (pSSM, pView->view.u32ViewSize);
|
---|
1289 | AssertRCReturn(rc, rc);
|
---|
1290 | rc = SSMR3PutU32 (pSSM, pView->view.u32MaxScreenSize);
|
---|
1291 | AssertRCReturn(rc, rc);
|
---|
1292 |
|
---|
1293 | rc = SSMR3PutU32 (pSSM, pView->screen.u32ViewIndex);
|
---|
1294 | AssertRCReturn(rc, rc);
|
---|
1295 | rc = SSMR3PutS32 (pSSM, pView->screen.i32OriginX);
|
---|
1296 | AssertRCReturn(rc, rc);
|
---|
1297 | rc = SSMR3PutS32 (pSSM, pView->screen.i32OriginY);
|
---|
1298 | AssertRCReturn(rc, rc);
|
---|
1299 | rc = SSMR3PutU32 (pSSM, pView->screen.u32StartOffset);
|
---|
1300 | AssertRCReturn(rc, rc);
|
---|
1301 | rc = SSMR3PutU32 (pSSM, pView->screen.u32LineSize);
|
---|
1302 | AssertRCReturn(rc, rc);
|
---|
1303 | rc = SSMR3PutU32 (pSSM, pView->screen.u32Width);
|
---|
1304 | AssertRCReturn(rc, rc);
|
---|
1305 | rc = SSMR3PutU32 (pSSM, pView->screen.u32Height);
|
---|
1306 | AssertRCReturn(rc, rc);
|
---|
1307 | rc = SSMR3PutU16 (pSSM, pView->screen.u16BitsPerPixel);
|
---|
1308 | AssertRCReturn(rc, rc);
|
---|
1309 | rc = SSMR3PutU16 (pSSM, pView->screen.u16Flags);
|
---|
1310 | AssertRCReturn(rc, rc);
|
---|
1311 |
|
---|
1312 | rc = SSMR3PutU32 (pSSM, pView->pVBVA? pView->u32VBVAOffset: HGSMIOFFSET_VOID);
|
---|
1313 | AssertRCReturn(rc, rc);
|
---|
1314 |
|
---|
1315 | rc = SSMR3PutU32 (pSSM, pView->partialRecord.cb);
|
---|
1316 | AssertRCReturn(rc, rc);
|
---|
1317 |
|
---|
1318 | if (pView->partialRecord.cb > 0)
|
---|
1319 | {
|
---|
1320 | rc = SSMR3PutMem (pSSM, pView->partialRecord.pu8, pView->partialRecord.cb);
|
---|
1321 | AssertRCReturn(rc, rc);
|
---|
1322 | }
|
---|
1323 | }
|
---|
1324 |
|
---|
1325 | /* Save mouse pointer shape information. */
|
---|
1326 | rc = SSMR3PutBool (pSSM, pCtx->mouseShapeInfo.fSet);
|
---|
1327 | AssertRCReturn(rc, rc);
|
---|
1328 | rc = SSMR3PutBool (pSSM, pCtx->mouseShapeInfo.fVisible);
|
---|
1329 | AssertRCReturn(rc, rc);
|
---|
1330 | rc = SSMR3PutBool (pSSM, pCtx->mouseShapeInfo.fAlpha);
|
---|
1331 | AssertRCReturn(rc, rc);
|
---|
1332 | rc = SSMR3PutU32 (pSSM, pCtx->mouseShapeInfo.u32HotX);
|
---|
1333 | AssertRCReturn(rc, rc);
|
---|
1334 | rc = SSMR3PutU32 (pSSM, pCtx->mouseShapeInfo.u32HotY);
|
---|
1335 | AssertRCReturn(rc, rc);
|
---|
1336 | rc = SSMR3PutU32 (pSSM, pCtx->mouseShapeInfo.u32Width);
|
---|
1337 | AssertRCReturn(rc, rc);
|
---|
1338 | rc = SSMR3PutU32 (pSSM, pCtx->mouseShapeInfo.u32Height);
|
---|
1339 | AssertRCReturn(rc, rc);
|
---|
1340 | rc = SSMR3PutU32 (pSSM, pCtx->mouseShapeInfo.cbShape);
|
---|
1341 | AssertRCReturn(rc, rc);
|
---|
1342 | if (pCtx->mouseShapeInfo.cbShape)
|
---|
1343 | {
|
---|
1344 | rc = SSMR3PutMem (pSSM, pCtx->mouseShapeInfo.pu8Shape, pCtx->mouseShapeInfo.cbShape);
|
---|
1345 | AssertRCReturn(rc, rc);
|
---|
1346 | }
|
---|
1347 |
|
---|
1348 | #ifdef VBOX_WITH_WDDM
|
---|
1349 | /* Size of some additional data. For future extensions. */
|
---|
1350 | rc = SSMR3PutU32 (pSSM, 4);
|
---|
1351 | AssertRCReturn(rc, rc);
|
---|
1352 | rc = SSMR3PutU32 (pSSM, pVGAState->fGuestCaps);
|
---|
1353 | AssertRCReturn(rc, rc);
|
---|
1354 | #else
|
---|
1355 | /* Size of some additional data. For future extensions. */
|
---|
1356 | rc = SSMR3PutU32 (pSSM, 0);
|
---|
1357 | AssertRCReturn(rc, rc);
|
---|
1358 | #endif
|
---|
1359 | }
|
---|
1360 | }
|
---|
1361 |
|
---|
1362 | return rc;
|
---|
1363 | }
|
---|
1364 |
|
---|
1365 | int vboxVBVASaveStateExec (PPDMDEVINS pDevIns, PSSMHANDLE pSSM)
|
---|
1366 | {
|
---|
1367 | PVGASTATE pVGAState = PDMINS_2_DATA(pDevIns, PVGASTATE);
|
---|
1368 | int rc;
|
---|
1369 | #ifdef VBOX_WITH_VIDEOHWACCEL
|
---|
1370 | VBOXVBVASAVEDSTATECBDATA VhwaData = {0};
|
---|
1371 | VhwaData.pSSM = pSSM;
|
---|
1372 | uint32_t cbCmd = sizeof (VBOXVHWACMD_HH_SAVESTATE_SAVEPERFORM); /* maximum cmd size */
|
---|
1373 | VBOXVHWACMD *pCmd = vbvaVHWAHHCommandCreate(pVGAState, VBOXVHWACMD_TYPE_HH_SAVESTATE_SAVEBEGIN, 0, cbCmd);
|
---|
1374 | Assert(pCmd);
|
---|
1375 | if(pCmd)
|
---|
1376 | {
|
---|
1377 | vbvaVHWAHHPost (pVGAState, pCmd, NULL, vboxVBVASaveStateBeginPostCb, &VhwaData);
|
---|
1378 | rc = VhwaData.rc;
|
---|
1379 | AssertRC(rc);
|
---|
1380 | if (RT_SUCCESS(rc))
|
---|
1381 | {
|
---|
1382 | #endif
|
---|
1383 | rc = vboxVBVASaveDevStateExec (pVGAState, pSSM);
|
---|
1384 | AssertRC(rc);
|
---|
1385 | #ifdef VBOX_WITH_VIDEOHWACCEL
|
---|
1386 | if (RT_SUCCESS(rc))
|
---|
1387 | {
|
---|
1388 | vbvaVHWAHHCommandReinit(pCmd, VBOXVHWACMD_TYPE_HH_SAVESTATE_SAVEPERFORM, 0);
|
---|
1389 | VBOXVHWACMD_HH_SAVESTATE_SAVEPERFORM *pSave = VBOXVHWACMD_BODY(pCmd, VBOXVHWACMD_HH_SAVESTATE_SAVEPERFORM);
|
---|
1390 | pSave->pSSM = pSSM;
|
---|
1391 | vbvaVHWAHHPost (pVGAState, pCmd, vboxVBVASaveStatePerformPreCb, NULL, &VhwaData);
|
---|
1392 | rc = VhwaData.rc;
|
---|
1393 | AssertRC(rc);
|
---|
1394 | if (RT_SUCCESS(rc))
|
---|
1395 | {
|
---|
1396 | vbvaVHWAHHCommandReinit(pCmd, VBOXVHWACMD_TYPE_HH_SAVESTATE_SAVEEND, 0);
|
---|
1397 | vbvaVHWAHHPost (pVGAState, pCmd, vboxVBVASaveStateEndPreCb, NULL, &VhwaData);
|
---|
1398 | rc = VhwaData.rc;
|
---|
1399 | AssertRC(rc);
|
---|
1400 | }
|
---|
1401 | }
|
---|
1402 | }
|
---|
1403 |
|
---|
1404 | vbvaVHWAHHCommandRelease(pCmd);
|
---|
1405 | }
|
---|
1406 | else
|
---|
1407 | rc = VERR_OUT_OF_RESOURCES;
|
---|
1408 | #else
|
---|
1409 | if (RT_SUCCESS(rc))
|
---|
1410 | {
|
---|
1411 | for (uint32_t i = 0; i < pVGAState->cMonitors; ++i)
|
---|
1412 | {
|
---|
1413 | rc = SSMR3PutU32 (pSSM, VBOXVBVASAVEDSTATE_VHWAUNAVAILABLE_MAGIC);
|
---|
1414 | AssertRCReturn(rc, rc);
|
---|
1415 | }
|
---|
1416 | }
|
---|
1417 | #endif
|
---|
1418 | return rc;
|
---|
1419 | }
|
---|
1420 |
|
---|
1421 | int vboxVBVALoadStateExec (PPDMDEVINS pDevIns, PSSMHANDLE pSSM, uint32_t u32Version)
|
---|
1422 | {
|
---|
1423 | if (u32Version < VGA_SAVEDSTATE_VERSION_HGSMI)
|
---|
1424 | {
|
---|
1425 | /* Nothing was saved. */
|
---|
1426 | return VINF_SUCCESS;
|
---|
1427 | }
|
---|
1428 |
|
---|
1429 | PVGASTATE pVGAState = PDMINS_2_DATA(pDevIns, PVGASTATE);
|
---|
1430 | PHGSMIINSTANCE pIns = pVGAState->pHGSMI;
|
---|
1431 | int rc = HGSMIHostLoadStateExec (pIns, pSSM, u32Version);
|
---|
1432 | if (RT_SUCCESS(rc))
|
---|
1433 | {
|
---|
1434 | /* Load VBVACONTEXT. */
|
---|
1435 | VBVACONTEXT *pCtx = (VBVACONTEXT *)HGSMIContext (pIns);
|
---|
1436 |
|
---|
1437 | if (!pCtx)
|
---|
1438 | {
|
---|
1439 | /* This should not happen. */
|
---|
1440 | AssertFailed();
|
---|
1441 | rc = VERR_INVALID_PARAMETER;
|
---|
1442 | }
|
---|
1443 | else
|
---|
1444 | {
|
---|
1445 | uint32_t cViews = 0;
|
---|
1446 | rc = SSMR3GetU32 (pSSM, &cViews);
|
---|
1447 | AssertRCReturn(rc, rc);
|
---|
1448 |
|
---|
1449 | uint32_t iView;
|
---|
1450 | for (iView = 0; iView < cViews; iView++)
|
---|
1451 | {
|
---|
1452 | VBVAVIEW *pView = &pCtx->aViews[iView];
|
---|
1453 |
|
---|
1454 | rc = SSMR3GetU32 (pSSM, &pView->view.u32ViewIndex);
|
---|
1455 | AssertRCReturn(rc, rc);
|
---|
1456 | rc = SSMR3GetU32 (pSSM, &pView->view.u32ViewOffset);
|
---|
1457 | AssertRCReturn(rc, rc);
|
---|
1458 | rc = SSMR3GetU32 (pSSM, &pView->view.u32ViewSize);
|
---|
1459 | AssertRCReturn(rc, rc);
|
---|
1460 | rc = SSMR3GetU32 (pSSM, &pView->view.u32MaxScreenSize);
|
---|
1461 | AssertRCReturn(rc, rc);
|
---|
1462 |
|
---|
1463 | rc = SSMR3GetU32 (pSSM, &pView->screen.u32ViewIndex);
|
---|
1464 | AssertRCReturn(rc, rc);
|
---|
1465 | rc = SSMR3GetS32 (pSSM, &pView->screen.i32OriginX);
|
---|
1466 | AssertRCReturn(rc, rc);
|
---|
1467 | rc = SSMR3GetS32 (pSSM, &pView->screen.i32OriginY);
|
---|
1468 | AssertRCReturn(rc, rc);
|
---|
1469 | rc = SSMR3GetU32 (pSSM, &pView->screen.u32StartOffset);
|
---|
1470 | AssertRCReturn(rc, rc);
|
---|
1471 | rc = SSMR3GetU32 (pSSM, &pView->screen.u32LineSize);
|
---|
1472 | AssertRCReturn(rc, rc);
|
---|
1473 | rc = SSMR3GetU32 (pSSM, &pView->screen.u32Width);
|
---|
1474 | AssertRCReturn(rc, rc);
|
---|
1475 | rc = SSMR3GetU32 (pSSM, &pView->screen.u32Height);
|
---|
1476 | AssertRCReturn(rc, rc);
|
---|
1477 | rc = SSMR3GetU16 (pSSM, &pView->screen.u16BitsPerPixel);
|
---|
1478 | AssertRCReturn(rc, rc);
|
---|
1479 | rc = SSMR3GetU16 (pSSM, &pView->screen.u16Flags);
|
---|
1480 | AssertRCReturn(rc, rc);
|
---|
1481 |
|
---|
1482 | rc = SSMR3GetU32 (pSSM, &pView->u32VBVAOffset);
|
---|
1483 | AssertRCReturn(rc, rc);
|
---|
1484 |
|
---|
1485 | rc = SSMR3GetU32 (pSSM, &pView->partialRecord.cb);
|
---|
1486 | AssertRCReturn(rc, rc);
|
---|
1487 |
|
---|
1488 | if (pView->partialRecord.cb == 0)
|
---|
1489 | {
|
---|
1490 | pView->partialRecord.pu8 = NULL;
|
---|
1491 | }
|
---|
1492 | else
|
---|
1493 | {
|
---|
1494 | Assert(pView->partialRecord.pu8 == NULL); /* Should be it. */
|
---|
1495 |
|
---|
1496 | uint8_t *pu8 = (uint8_t *)RTMemAlloc (pView->partialRecord.cb);
|
---|
1497 |
|
---|
1498 | if (!pu8)
|
---|
1499 | {
|
---|
1500 | return VERR_NO_MEMORY;
|
---|
1501 | }
|
---|
1502 |
|
---|
1503 | pView->partialRecord.pu8 = pu8;
|
---|
1504 |
|
---|
1505 | rc = SSMR3GetMem (pSSM, pView->partialRecord.pu8, pView->partialRecord.cb);
|
---|
1506 | AssertRCReturn(rc, rc);
|
---|
1507 | }
|
---|
1508 |
|
---|
1509 | if (pView->u32VBVAOffset == HGSMIOFFSET_VOID)
|
---|
1510 | {
|
---|
1511 | pView->pVBVA = NULL;
|
---|
1512 | }
|
---|
1513 | else
|
---|
1514 | {
|
---|
1515 | pView->pVBVA = (VBVABUFFER *)HGSMIOffsetToPointerHost (pIns, pView->u32VBVAOffset);
|
---|
1516 | }
|
---|
1517 | }
|
---|
1518 |
|
---|
1519 | if (u32Version > VGA_SAVEDSTATE_VERSION_WITH_CONFIG)
|
---|
1520 | {
|
---|
1521 | /* Read mouse pointer shape information. */
|
---|
1522 | rc = SSMR3GetBool (pSSM, &pCtx->mouseShapeInfo.fSet);
|
---|
1523 | AssertRCReturn(rc, rc);
|
---|
1524 | rc = SSMR3GetBool (pSSM, &pCtx->mouseShapeInfo.fVisible);
|
---|
1525 | AssertRCReturn(rc, rc);
|
---|
1526 | rc = SSMR3GetBool (pSSM, &pCtx->mouseShapeInfo.fAlpha);
|
---|
1527 | AssertRCReturn(rc, rc);
|
---|
1528 | rc = SSMR3GetU32 (pSSM, &pCtx->mouseShapeInfo.u32HotX);
|
---|
1529 | AssertRCReturn(rc, rc);
|
---|
1530 | rc = SSMR3GetU32 (pSSM, &pCtx->mouseShapeInfo.u32HotY);
|
---|
1531 | AssertRCReturn(rc, rc);
|
---|
1532 | rc = SSMR3GetU32 (pSSM, &pCtx->mouseShapeInfo.u32Width);
|
---|
1533 | AssertRCReturn(rc, rc);
|
---|
1534 | rc = SSMR3GetU32 (pSSM, &pCtx->mouseShapeInfo.u32Height);
|
---|
1535 | AssertRCReturn(rc, rc);
|
---|
1536 | rc = SSMR3GetU32 (pSSM, &pCtx->mouseShapeInfo.cbShape);
|
---|
1537 | AssertRCReturn(rc, rc);
|
---|
1538 | if (pCtx->mouseShapeInfo.cbShape)
|
---|
1539 | {
|
---|
1540 | pCtx->mouseShapeInfo.pu8Shape = (uint8_t *)RTMemAlloc(pCtx->mouseShapeInfo.cbShape);
|
---|
1541 | if (pCtx->mouseShapeInfo.pu8Shape == NULL)
|
---|
1542 | {
|
---|
1543 | return VERR_NO_MEMORY;
|
---|
1544 | }
|
---|
1545 | pCtx->mouseShapeInfo.cbAllocated = pCtx->mouseShapeInfo.cbShape;
|
---|
1546 | rc = SSMR3GetMem (pSSM, pCtx->mouseShapeInfo.pu8Shape, pCtx->mouseShapeInfo.cbShape);
|
---|
1547 | AssertRCReturn(rc, rc);
|
---|
1548 | }
|
---|
1549 | else
|
---|
1550 | {
|
---|
1551 | pCtx->mouseShapeInfo.pu8Shape = NULL;
|
---|
1552 | }
|
---|
1553 |
|
---|
1554 | /* Size of some additional data. For future extensions. */
|
---|
1555 | uint32_t cbExtra = 0;
|
---|
1556 | rc = SSMR3GetU32 (pSSM, &cbExtra);
|
---|
1557 | AssertRCReturn(rc, rc);
|
---|
1558 | #ifdef VBOX_WITH_WDDM
|
---|
1559 | if (cbExtra >= 4)
|
---|
1560 | {
|
---|
1561 | rc = SSMR3GetU32 (pSSM, &pVGAState->fGuestCaps);
|
---|
1562 | AssertRCReturn(rc, rc);
|
---|
1563 | cbExtra -= 4;
|
---|
1564 | }
|
---|
1565 | #endif
|
---|
1566 | if (cbExtra > 0)
|
---|
1567 | {
|
---|
1568 | rc = SSMR3Skip(pSSM, cbExtra);
|
---|
1569 | AssertRCReturn(rc, rc);
|
---|
1570 | }
|
---|
1571 | }
|
---|
1572 |
|
---|
1573 | pCtx->cViews = iView;
|
---|
1574 | LogFlowFunc(("%d views loaded\n", pCtx->cViews));
|
---|
1575 |
|
---|
1576 | if (u32Version > VGA_SAVEDSTATE_VERSION_WDDM)
|
---|
1577 | {
|
---|
1578 | #ifdef VBOX_WITH_VIDEOHWACCEL
|
---|
1579 | uint32_t cbCmd = sizeof (VBOXVHWACMD_HH_SAVESTATE_LOADPERFORM); /* maximum cmd size */
|
---|
1580 | VBOXVHWACMD *pCmd = vbvaVHWAHHCommandCreate(pVGAState, VBOXVHWACMD_TYPE_HH_SAVESTATE_LOADPERFORM, 0, cbCmd);
|
---|
1581 | Assert(pCmd);
|
---|
1582 | if(pCmd)
|
---|
1583 | {
|
---|
1584 | VBOXVBVASAVEDSTATECBDATA VhwaData = {0};
|
---|
1585 | VhwaData.pSSM = pSSM;
|
---|
1586 | VBOXVHWACMD_HH_SAVESTATE_LOADPERFORM *pLoad = VBOXVHWACMD_BODY(pCmd, VBOXVHWACMD_HH_SAVESTATE_LOADPERFORM);
|
---|
1587 | pLoad->pSSM = pSSM;
|
---|
1588 | vbvaVHWAHHPost (pVGAState, pCmd, vboxVBVALoadStatePerformPreCb, vboxVBVALoadStatePerformPostCb, &VhwaData);
|
---|
1589 | rc = VhwaData.rc;
|
---|
1590 | AssertRC(rc);
|
---|
1591 | vbvaVHWAHHCommandRelease(pCmd);
|
---|
1592 | }
|
---|
1593 | else
|
---|
1594 | {
|
---|
1595 | rc = VERR_OUT_OF_RESOURCES;
|
---|
1596 | }
|
---|
1597 | #else
|
---|
1598 | rc = SSMR3SkipToEndOfUnit(pSSM);
|
---|
1599 | AssertRCReturn(rc, rc);
|
---|
1600 | #endif
|
---|
1601 | }
|
---|
1602 |
|
---|
1603 | #ifdef DEBUG_sunlover
|
---|
1604 | dumpctx(pCtx);
|
---|
1605 | #endif
|
---|
1606 | }
|
---|
1607 | }
|
---|
1608 |
|
---|
1609 | return rc;
|
---|
1610 | }
|
---|
1611 |
|
---|
1612 | int vboxVBVALoadStateDone (PPDMDEVINS pDevIns, PSSMHANDLE pSSM)
|
---|
1613 | {
|
---|
1614 | PVGASTATE pVGAState = PDMINS_2_DATA(pDevIns, PVGASTATE);
|
---|
1615 | VBVACONTEXT *pCtx = (VBVACONTEXT *)HGSMIContext (pVGAState->pHGSMI);
|
---|
1616 |
|
---|
1617 | if (pCtx)
|
---|
1618 | {
|
---|
1619 | uint32_t iView;
|
---|
1620 | for (iView = 0; iView < pCtx->cViews; iView++)
|
---|
1621 | {
|
---|
1622 | VBVAVIEW *pView = &pCtx->aViews[iView];
|
---|
1623 |
|
---|
1624 | if (pView->pVBVA)
|
---|
1625 | {
|
---|
1626 | vbvaEnable (iView, pVGAState, pCtx, pView->pVBVA, pView->u32VBVAOffset, true /* fRestored */);
|
---|
1627 | vbvaResize (pVGAState, pView, &pView->screen);
|
---|
1628 | }
|
---|
1629 | }
|
---|
1630 |
|
---|
1631 | if (pCtx->mouseShapeInfo.fSet)
|
---|
1632 | {
|
---|
1633 | vbvaUpdateMousePointerShape(pVGAState, &pCtx->mouseShapeInfo, true, pCtx->mouseShapeInfo.pu8Shape);
|
---|
1634 | }
|
---|
1635 | }
|
---|
1636 |
|
---|
1637 | return VINF_SUCCESS;
|
---|
1638 | }
|
---|
1639 |
|
---|
1640 | void VBVARaiseIrq (PVGASTATE pVGAState, uint32_t fFlags)
|
---|
1641 | {
|
---|
1642 | PPDMDEVINS pDevIns = pVGAState->pDevInsR3;
|
---|
1643 | PDMCritSectEnter(&pVGAState->CritSect, VERR_SEM_BUSY);
|
---|
1644 |
|
---|
1645 | HGSMISetHostGuestFlags(pVGAState->pHGSMI, HGSMIHOSTFLAGS_IRQ | fFlags);
|
---|
1646 | PDMDevHlpPCISetIrq(pDevIns, 0, PDM_IRQ_LEVEL_HIGH);
|
---|
1647 |
|
---|
1648 | PDMCritSectLeave(&pVGAState->CritSect);
|
---|
1649 | }
|
---|
1650 |
|
---|
1651 | /*
|
---|
1652 | *
|
---|
1653 | * New VBVA uses a new interface id: #define VBE_DISPI_ID_VBOX_VIDEO 0xBE01
|
---|
1654 | *
|
---|
1655 | * VBVA uses two 32 bits IO ports to write VRAM offsets of shared memory blocks for commands.
|
---|
1656 | * Read Write
|
---|
1657 | * Host port 0x3b0 to process completed
|
---|
1658 | * Guest port 0x3d0 control value? to process
|
---|
1659 | *
|
---|
1660 | */
|
---|
1661 |
|
---|
1662 | static DECLCALLBACK(void) vbvaNotifyGuest (void *pvCallback)
|
---|
1663 | {
|
---|
1664 | #if defined(VBOX_WITH_HGSMI) && (defined(VBOX_WITH_VIDEOHWACCEL) || defined(VBOX_WITH_VDMA) || defined(VBOX_WITH_WDDM))
|
---|
1665 | PVGASTATE pVGAState = (PVGASTATE)pvCallback;
|
---|
1666 | VBVARaiseIrq (pVGAState, 0);
|
---|
1667 | #else
|
---|
1668 | NOREF(pvCallback);
|
---|
1669 | /* Do nothing. Later the VMMDev/VGA IRQ can be used for the notification. */
|
---|
1670 | #endif
|
---|
1671 | }
|
---|
1672 |
|
---|
1673 | /* The guest submitted a buffer. @todo Verify all guest data. */
|
---|
1674 | static DECLCALLBACK(int) vbvaChannelHandler (void *pvHandler, uint16_t u16ChannelInfo, void *pvBuffer, HGSMISIZE cbBuffer)
|
---|
1675 | {
|
---|
1676 | int rc = VINF_SUCCESS;
|
---|
1677 |
|
---|
1678 | LogFlowFunc(("pvHandler %p, u16ChannelInfo %d, pvBuffer %p, cbBuffer %u\n",
|
---|
1679 | pvHandler, u16ChannelInfo, pvBuffer, cbBuffer));
|
---|
1680 |
|
---|
1681 | PVGASTATE pVGAState = (PVGASTATE)pvHandler;
|
---|
1682 | PHGSMIINSTANCE pIns = pVGAState->pHGSMI;
|
---|
1683 | VBVACONTEXT *pCtx = (VBVACONTEXT *)HGSMIContext (pIns);
|
---|
1684 |
|
---|
1685 | switch (u16ChannelInfo)
|
---|
1686 | {
|
---|
1687 | #ifdef VBOX_WITH_VDMA
|
---|
1688 | case VBVA_VDMA_CMD:
|
---|
1689 | {
|
---|
1690 | if (cbBuffer < VBoxSHGSMIBufferHeaderSize() + sizeof (VBOXVDMACBUF_DR))
|
---|
1691 | {
|
---|
1692 | rc = VERR_INVALID_PARAMETER;
|
---|
1693 | break;
|
---|
1694 | }
|
---|
1695 | PVBOXVDMACBUF_DR pCmd = (PVBOXVDMACBUF_DR)VBoxSHGSMIBufferData ((PVBOXSHGSMIHEADER)pvBuffer);
|
---|
1696 | vboxVDMACommand(pVGAState->pVdma, pCmd, cbBuffer - VBoxSHGSMIBufferHeaderSize());
|
---|
1697 | rc = VINF_SUCCESS;
|
---|
1698 | break;
|
---|
1699 | }
|
---|
1700 | case VBVA_VDMA_CTL:
|
---|
1701 | {
|
---|
1702 | if (cbBuffer < VBoxSHGSMIBufferHeaderSize() + sizeof (VBOXVDMA_CTL))
|
---|
1703 | {
|
---|
1704 | rc = VERR_INVALID_PARAMETER;
|
---|
1705 | break;
|
---|
1706 | }
|
---|
1707 | PVBOXVDMA_CTL pCmd = (PVBOXVDMA_CTL)VBoxSHGSMIBufferData ((PVBOXSHGSMIHEADER)pvBuffer);
|
---|
1708 | vboxVDMAControl(pVGAState->pVdma, pCmd, cbBuffer - VBoxSHGSMIBufferHeaderSize());
|
---|
1709 | rc = VINF_SUCCESS;
|
---|
1710 | break;
|
---|
1711 | }
|
---|
1712 | #endif
|
---|
1713 | case VBVA_QUERY_CONF32:
|
---|
1714 | {
|
---|
1715 | if (cbBuffer < sizeof (VBVACONF32))
|
---|
1716 | {
|
---|
1717 | rc = VERR_INVALID_PARAMETER;
|
---|
1718 | break;
|
---|
1719 | }
|
---|
1720 |
|
---|
1721 | VBVACONF32 *pConf32 = (VBVACONF32 *)pvBuffer;
|
---|
1722 | LogFlowFunc(("VBVA_QUERY_CONF32: u32Index %d, u32Value 0x%x\n",
|
---|
1723 | pConf32->u32Index, pConf32->u32Value));
|
---|
1724 |
|
---|
1725 | if (pConf32->u32Index == VBOX_VBVA_CONF32_MONITOR_COUNT)
|
---|
1726 | {
|
---|
1727 | pConf32->u32Value = pCtx->cViews;
|
---|
1728 | }
|
---|
1729 | else if (pConf32->u32Index == VBOX_VBVA_CONF32_HOST_HEAP_SIZE)
|
---|
1730 | {
|
---|
1731 | /* @todo a value calculated from the vram size */
|
---|
1732 | pConf32->u32Value = 64*_1K;
|
---|
1733 | }
|
---|
1734 | else
|
---|
1735 | {
|
---|
1736 | Log(("Unsupported VBVA_QUERY_CONF32 index %d!!!\n",
|
---|
1737 | pConf32->u32Index));
|
---|
1738 | rc = VERR_INVALID_PARAMETER;
|
---|
1739 | }
|
---|
1740 | } break;
|
---|
1741 |
|
---|
1742 | case VBVA_SET_CONF32:
|
---|
1743 | {
|
---|
1744 | if (cbBuffer < sizeof (VBVACONF32))
|
---|
1745 | {
|
---|
1746 | rc = VERR_INVALID_PARAMETER;
|
---|
1747 | break;
|
---|
1748 | }
|
---|
1749 |
|
---|
1750 | VBVACONF32 *pConf32 = (VBVACONF32 *)pvBuffer;
|
---|
1751 | LogFlowFunc(("VBVA_SET_CONF32: u32Index %d, u32Value 0x%x\n",
|
---|
1752 | pConf32->u32Index, pConf32->u32Value));
|
---|
1753 |
|
---|
1754 | if (pConf32->u32Index == VBOX_VBVA_CONF32_MONITOR_COUNT)
|
---|
1755 | {
|
---|
1756 | /* do nothing. this is a const. */
|
---|
1757 | }
|
---|
1758 | else if (pConf32->u32Index == VBOX_VBVA_CONF32_HOST_HEAP_SIZE)
|
---|
1759 | {
|
---|
1760 | /* do nothing. this is a const. */
|
---|
1761 | }
|
---|
1762 | else
|
---|
1763 | {
|
---|
1764 | Log(("Unsupported VBVA_SET_CONF32 index %d!!!\n",
|
---|
1765 | pConf32->u32Index));
|
---|
1766 | rc = VERR_INVALID_PARAMETER;
|
---|
1767 | }
|
---|
1768 | } break;
|
---|
1769 |
|
---|
1770 | case VBVA_INFO_VIEW:
|
---|
1771 | {
|
---|
1772 | if (cbBuffer < sizeof (VBVAINFOVIEW))
|
---|
1773 | {
|
---|
1774 | rc = VERR_INVALID_PARAMETER;
|
---|
1775 | break;
|
---|
1776 | }
|
---|
1777 |
|
---|
1778 | /* Guest submits an array of VBVAINFOVIEW structures. */
|
---|
1779 | VBVAINFOVIEW *pView = (VBVAINFOVIEW *)pvBuffer;
|
---|
1780 |
|
---|
1781 | for (;
|
---|
1782 | cbBuffer >= sizeof (VBVAINFOVIEW);
|
---|
1783 | pView++, cbBuffer -= sizeof (VBVAINFOVIEW))
|
---|
1784 | {
|
---|
1785 | LogFlowFunc(("VBVA_INFO_VIEW: index %d, offset 0x%x, size 0x%x, max screen size 0x%x\n",
|
---|
1786 | pView->u32ViewIndex, pView->u32ViewOffset, pView->u32ViewSize, pView->u32MaxScreenSize));
|
---|
1787 |
|
---|
1788 | /* @todo verify view data. */
|
---|
1789 | if (pView->u32ViewIndex >= pCtx->cViews)
|
---|
1790 | {
|
---|
1791 | Log(("View index too large %d!!!\n",
|
---|
1792 | pView->u32ViewIndex));
|
---|
1793 | rc = VERR_INVALID_PARAMETER;
|
---|
1794 | break;
|
---|
1795 | }
|
---|
1796 |
|
---|
1797 | pCtx->aViews[pView->u32ViewIndex].view = *pView;
|
---|
1798 | }
|
---|
1799 | } break;
|
---|
1800 |
|
---|
1801 | case VBVA_INFO_HEAP:
|
---|
1802 | {
|
---|
1803 | if (cbBuffer < sizeof (VBVAINFOHEAP))
|
---|
1804 | {
|
---|
1805 | rc = VERR_INVALID_PARAMETER;
|
---|
1806 | break;
|
---|
1807 | }
|
---|
1808 |
|
---|
1809 | VBVAINFOHEAP *pHeap = (VBVAINFOHEAP *)pvBuffer;
|
---|
1810 | LogFlowFunc(("VBVA_INFO_HEAP: offset 0x%x, size 0x%x\n",
|
---|
1811 | pHeap->u32HeapOffset, pHeap->u32HeapSize));
|
---|
1812 |
|
---|
1813 | rc = HGSMISetupHostHeap (pIns, pHeap->u32HeapOffset, pHeap->u32HeapSize);
|
---|
1814 | } break;
|
---|
1815 |
|
---|
1816 | case VBVA_FLUSH:
|
---|
1817 | {
|
---|
1818 | if (cbBuffer < sizeof (VBVAFLUSH))
|
---|
1819 | {
|
---|
1820 | rc = VERR_INVALID_PARAMETER;
|
---|
1821 | break;
|
---|
1822 | }
|
---|
1823 |
|
---|
1824 | VBVAFLUSH *pFlush = (VBVAFLUSH *)pvBuffer;
|
---|
1825 | LogFlowFunc(("VBVA_FLUSH: u32Reserved 0x%x\n",
|
---|
1826 | pFlush->u32Reserved));
|
---|
1827 |
|
---|
1828 | rc = vbvaFlush (pVGAState, pCtx);
|
---|
1829 | } break;
|
---|
1830 |
|
---|
1831 | case VBVA_INFO_SCREEN:
|
---|
1832 | {
|
---|
1833 | if (cbBuffer < sizeof (VBVAINFOSCREEN))
|
---|
1834 | {
|
---|
1835 | rc = VERR_INVALID_PARAMETER;
|
---|
1836 | break;
|
---|
1837 | }
|
---|
1838 |
|
---|
1839 | VBVAINFOSCREEN *pScreen = (VBVAINFOSCREEN *)pvBuffer;
|
---|
1840 | VBVAINFOVIEW *pView = &pCtx->aViews[pScreen->u32ViewIndex].view;
|
---|
1841 | /* Calculate the offset of the end of the screen so we can make
|
---|
1842 | * sure it is inside the view. I assume that screen rollover is not
|
---|
1843 | * implemented. */
|
---|
1844 | int64_t offEnd = (int64_t)pScreen->u32Height * pScreen->u32LineSize
|
---|
1845 | + pScreen->u32Width + pScreen->u32StartOffset;
|
---|
1846 | LogRel(("VBVA_INFO_SCREEN: [%d] @%d,%d %dx%d, line 0x%x, BPP %d, flags 0x%x\n",
|
---|
1847 | pScreen->u32ViewIndex, pScreen->i32OriginX, pScreen->i32OriginY,
|
---|
1848 | pScreen->u32Width, pScreen->u32Height,
|
---|
1849 | pScreen->u32LineSize, pScreen->u16BitsPerPixel, pScreen->u16Flags));
|
---|
1850 |
|
---|
1851 | if ( pScreen->u32ViewIndex < RT_ELEMENTS (pCtx->aViews)
|
---|
1852 | && pScreen->u16BitsPerPixel <= 32
|
---|
1853 | && pScreen->u32Width <= UINT16_MAX
|
---|
1854 | && pScreen->u32Height <= UINT16_MAX
|
---|
1855 | && pScreen->u32LineSize <= UINT16_MAX * 4
|
---|
1856 | && offEnd < pView->u32MaxScreenSize)
|
---|
1857 | {
|
---|
1858 | vbvaResize (pVGAState, &pCtx->aViews[pScreen->u32ViewIndex], pScreen);
|
---|
1859 | }
|
---|
1860 | else
|
---|
1861 | {
|
---|
1862 | LogRelFlow(("VBVA_INFO_SCREEN [%lu]: bad data: %lux%lu, line 0x%lx, BPP %u, start offset %lu, max screen size %lu\n",
|
---|
1863 | (unsigned long)pScreen->u32ViewIndex,
|
---|
1864 | (unsigned long)pScreen->u32Width,
|
---|
1865 | (unsigned long)pScreen->u32Height,
|
---|
1866 | (unsigned long)pScreen->u32LineSize,
|
---|
1867 | (unsigned long)pScreen->u16BitsPerPixel,
|
---|
1868 | (unsigned long)pScreen->u32StartOffset,
|
---|
1869 | (unsigned long)pView->u32MaxScreenSize));
|
---|
1870 | rc = VERR_INVALID_PARAMETER;
|
---|
1871 | }
|
---|
1872 | } break;
|
---|
1873 |
|
---|
1874 | case VBVA_ENABLE:
|
---|
1875 | {
|
---|
1876 | if (cbBuffer < sizeof (VBVAENABLE))
|
---|
1877 | {
|
---|
1878 | rc = VERR_INVALID_PARAMETER;
|
---|
1879 | break;
|
---|
1880 | }
|
---|
1881 |
|
---|
1882 | VBVAENABLE *pEnable = (VBVAENABLE *)pvBuffer;
|
---|
1883 | unsigned uScreenId;
|
---|
1884 | if (pEnable->u32Flags & VBVA_F_EXTENDED)
|
---|
1885 | {
|
---|
1886 | if (cbBuffer < sizeof (VBVAENABLE_EX))
|
---|
1887 | {
|
---|
1888 | rc = VERR_INVALID_PARAMETER;
|
---|
1889 | break;
|
---|
1890 | }
|
---|
1891 |
|
---|
1892 | VBVAENABLE_EX *pEnableEx = (VBVAENABLE_EX *)pvBuffer;
|
---|
1893 | uScreenId = pEnableEx->u32ScreenId;
|
---|
1894 | }
|
---|
1895 | else
|
---|
1896 | {
|
---|
1897 | uScreenId = vbvaViewFromOffset (pIns, pCtx, pvBuffer);
|
---|
1898 | }
|
---|
1899 |
|
---|
1900 | if (uScreenId == ~0U)
|
---|
1901 | {
|
---|
1902 | rc = VERR_INVALID_PARAMETER;
|
---|
1903 | break;
|
---|
1904 | }
|
---|
1905 |
|
---|
1906 | LogFlowFunc(("VBVA_ENABLE[%d]: u32Flags 0x%x u32Offset 0x%x\n",
|
---|
1907 | uScreenId, pEnable->u32Flags, pEnable->u32Offset));
|
---|
1908 |
|
---|
1909 | if ((pEnable->u32Flags & (VBVA_F_ENABLE | VBVA_F_DISABLE)) == VBVA_F_ENABLE)
|
---|
1910 | {
|
---|
1911 | /* Guest reported offset relative to view. */
|
---|
1912 | uint32_t u32Offset = pEnable->u32Offset;
|
---|
1913 | if (!(pEnable->u32Flags & VBVA_F_ABSOFFSET))
|
---|
1914 | {
|
---|
1915 | u32Offset += pCtx->aViews[uScreenId].view.u32ViewOffset;
|
---|
1916 | }
|
---|
1917 |
|
---|
1918 | VBVABUFFER *pVBVA = (VBVABUFFER *)HGSMIOffsetToPointerHost (pIns, u32Offset);
|
---|
1919 |
|
---|
1920 | if (pVBVA)
|
---|
1921 | {
|
---|
1922 | /* Process any pending orders and empty the VBVA ring buffer. */
|
---|
1923 | vbvaFlush (pVGAState, pCtx);
|
---|
1924 |
|
---|
1925 | rc = vbvaEnable (uScreenId, pVGAState, pCtx, pVBVA, u32Offset, false /* fRestored */);
|
---|
1926 | }
|
---|
1927 | else
|
---|
1928 | {
|
---|
1929 | Log(("Invalid VBVABUFFER offset 0x%x!!!\n",
|
---|
1930 | pEnable->u32Offset));
|
---|
1931 | rc = VERR_INVALID_PARAMETER;
|
---|
1932 | }
|
---|
1933 | }
|
---|
1934 | else if ((pEnable->u32Flags & (VBVA_F_ENABLE | VBVA_F_DISABLE)) == VBVA_F_DISABLE)
|
---|
1935 | {
|
---|
1936 | rc = vbvaDisable (uScreenId, pVGAState, pCtx);
|
---|
1937 | }
|
---|
1938 | else
|
---|
1939 | {
|
---|
1940 | Log(("Invalid VBVA_ENABLE flags 0x%x!!!\n",
|
---|
1941 | pEnable->u32Flags));
|
---|
1942 | rc = VERR_INVALID_PARAMETER;
|
---|
1943 | }
|
---|
1944 |
|
---|
1945 | pEnable->i32Result = rc;
|
---|
1946 | } break;
|
---|
1947 |
|
---|
1948 | case VBVA_MOUSE_POINTER_SHAPE:
|
---|
1949 | {
|
---|
1950 | if (cbBuffer < sizeof (VBVAMOUSEPOINTERSHAPE))
|
---|
1951 | {
|
---|
1952 | rc = VERR_INVALID_PARAMETER;
|
---|
1953 | break;
|
---|
1954 | }
|
---|
1955 |
|
---|
1956 | VBVAMOUSEPOINTERSHAPE *pShape = (VBVAMOUSEPOINTERSHAPE *)pvBuffer;
|
---|
1957 |
|
---|
1958 | LogFlowFunc(("VBVA_MOUSE_POINTER_SHAPE: i32Result 0x%x, fu32Flags 0x%x, hot spot %d,%d, size %dx%d\n",
|
---|
1959 | pShape->i32Result,
|
---|
1960 | pShape->fu32Flags,
|
---|
1961 | pShape->u32HotX,
|
---|
1962 | pShape->u32HotY,
|
---|
1963 | pShape->u32Width,
|
---|
1964 | pShape->u32Height));
|
---|
1965 |
|
---|
1966 | rc = vbvaMousePointerShape (pVGAState, pCtx, pShape, cbBuffer);
|
---|
1967 |
|
---|
1968 | pShape->i32Result = rc;
|
---|
1969 | } break;
|
---|
1970 |
|
---|
1971 |
|
---|
1972 | #ifdef VBOX_WITH_VIDEOHWACCEL
|
---|
1973 | case VBVA_VHWA_CMD:
|
---|
1974 | {
|
---|
1975 | rc = vbvaVHWAHandleCommand (pVGAState, pCtx, (PVBOXVHWACMD)pvBuffer);
|
---|
1976 | } break;
|
---|
1977 | #endif
|
---|
1978 |
|
---|
1979 | #ifdef VBOX_WITH_WDDM
|
---|
1980 | case VBVA_INFO_CAPS:
|
---|
1981 | {
|
---|
1982 | if (cbBuffer < sizeof (VBVACAPS))
|
---|
1983 | {
|
---|
1984 | rc = VERR_INVALID_PARAMETER;
|
---|
1985 | break;
|
---|
1986 | }
|
---|
1987 |
|
---|
1988 | VBVACAPS *pCaps = (VBVACAPS*)pvBuffer;
|
---|
1989 | pVGAState->fGuestCaps = pCaps->fCaps;
|
---|
1990 | pCaps->rc = VINF_SUCCESS;
|
---|
1991 | } break;
|
---|
1992 | #endif
|
---|
1993 |
|
---|
1994 | case VBVA_CMDVBVA_ENABLE:
|
---|
1995 | case VBVA_CMDVBVA_SUBMIT:
|
---|
1996 | case VBVA_CMDVBVA_FLUSH:
|
---|
1997 | {
|
---|
1998 | /* implement */
|
---|
1999 | } break;
|
---|
2000 |
|
---|
2001 | case VBVA_SCANLINE_CFG:
|
---|
2002 | {
|
---|
2003 | if (cbBuffer < sizeof (VBVASCANLINECFG))
|
---|
2004 | {
|
---|
2005 | rc = VERR_INVALID_PARAMETER;
|
---|
2006 | break;
|
---|
2007 | }
|
---|
2008 |
|
---|
2009 | VBVASCANLINECFG *pCfg = (VBVASCANLINECFG*)pvBuffer;
|
---|
2010 | pVGAState->fScanLineCfg = pCfg->fFlags;
|
---|
2011 | pCfg->rc = VINF_SUCCESS;
|
---|
2012 | } break;
|
---|
2013 | default:
|
---|
2014 | Log(("Unsupported VBVA guest command %d!!!\n",
|
---|
2015 | u16ChannelInfo));
|
---|
2016 | break;
|
---|
2017 | }
|
---|
2018 |
|
---|
2019 | return rc;
|
---|
2020 | }
|
---|
2021 |
|
---|
2022 | void VBVAReset (PVGASTATE pVGAState)
|
---|
2023 | {
|
---|
2024 | if (!pVGAState || !pVGAState->pHGSMI)
|
---|
2025 | {
|
---|
2026 | return;
|
---|
2027 | }
|
---|
2028 |
|
---|
2029 | VBVACONTEXT *pCtx = (VBVACONTEXT *)HGSMIContext (pVGAState->pHGSMI);
|
---|
2030 |
|
---|
2031 | #ifdef VBOX_WITH_VIDEOHWACCEL
|
---|
2032 | vbvaVHWAReset (pVGAState);
|
---|
2033 | #endif
|
---|
2034 |
|
---|
2035 | uint32_t HgFlags = HGSMIReset (pVGAState->pHGSMI);
|
---|
2036 | if(HgFlags & HGSMIHOSTFLAGS_IRQ)
|
---|
2037 | {
|
---|
2038 | /* this means the IRQ is LEVEL_HIGH, need to reset it */
|
---|
2039 | PDMDevHlpPCISetIrq(pVGAState->pDevInsR3, 0, PDM_IRQ_LEVEL_LOW);
|
---|
2040 | }
|
---|
2041 |
|
---|
2042 | if (pCtx)
|
---|
2043 | {
|
---|
2044 | vbvaFlush (pVGAState, pCtx);
|
---|
2045 |
|
---|
2046 | unsigned uScreenId;
|
---|
2047 |
|
---|
2048 | for (uScreenId = 0; uScreenId < pCtx->cViews; uScreenId++)
|
---|
2049 | {
|
---|
2050 | vbvaDisable (uScreenId, pVGAState, pCtx);
|
---|
2051 | }
|
---|
2052 |
|
---|
2053 | pCtx->mouseShapeInfo.fSet = false;
|
---|
2054 | RTMemFree(pCtx->mouseShapeInfo.pu8Shape);
|
---|
2055 | pCtx->mouseShapeInfo.pu8Shape = NULL;
|
---|
2056 | pCtx->mouseShapeInfo.cbAllocated = 0;
|
---|
2057 | pCtx->mouseShapeInfo.cbShape = 0;
|
---|
2058 | }
|
---|
2059 |
|
---|
2060 | }
|
---|
2061 |
|
---|
2062 | int VBVAUpdateDisplay (PVGASTATE pVGAState)
|
---|
2063 | {
|
---|
2064 | int rc = VERR_NOT_SUPPORTED; /* Assuming that the VGA device will have to do updates. */
|
---|
2065 |
|
---|
2066 | VBVACONTEXT *pCtx = (VBVACONTEXT *)HGSMIContext (pVGAState->pHGSMI);
|
---|
2067 |
|
---|
2068 | if (pCtx)
|
---|
2069 | {
|
---|
2070 | rc = vbvaFlush (pVGAState, pCtx);
|
---|
2071 |
|
---|
2072 | if (RT_SUCCESS (rc))
|
---|
2073 | {
|
---|
2074 | if (!pCtx->aViews[0].pVBVA)
|
---|
2075 | {
|
---|
2076 | /* VBVA is not enabled for the first view, so VGA device must do updates. */
|
---|
2077 | rc = VERR_NOT_SUPPORTED;
|
---|
2078 | }
|
---|
2079 | }
|
---|
2080 | }
|
---|
2081 |
|
---|
2082 | return rc;
|
---|
2083 | }
|
---|
2084 |
|
---|
2085 | static HGSMICHANNELHANDLER sOldChannelHandler;
|
---|
2086 |
|
---|
2087 | int VBVAInit (PVGASTATE pVGAState)
|
---|
2088 | {
|
---|
2089 | PPDMDEVINS pDevIns = pVGAState->pDevInsR3;
|
---|
2090 |
|
---|
2091 | PVM pVM = PDMDevHlpGetVM(pDevIns);
|
---|
2092 |
|
---|
2093 | int rc = HGSMICreate (&pVGAState->pHGSMI,
|
---|
2094 | pVM,
|
---|
2095 | "VBVA",
|
---|
2096 | 0,
|
---|
2097 | pVGAState->vram_ptrR3,
|
---|
2098 | pVGAState->vram_size,
|
---|
2099 | vbvaNotifyGuest,
|
---|
2100 | pVGAState,
|
---|
2101 | sizeof (VBVACONTEXT));
|
---|
2102 |
|
---|
2103 | if (RT_SUCCESS (rc))
|
---|
2104 | {
|
---|
2105 | rc = HGSMIHostChannelRegister (pVGAState->pHGSMI,
|
---|
2106 | HGSMI_CH_VBVA,
|
---|
2107 | vbvaChannelHandler,
|
---|
2108 | pVGAState,
|
---|
2109 | &sOldChannelHandler);
|
---|
2110 | if (RT_SUCCESS (rc))
|
---|
2111 | {
|
---|
2112 | VBVACONTEXT *pCtx = (VBVACONTEXT *)HGSMIContext (pVGAState->pHGSMI);
|
---|
2113 | pCtx->cViews = pVGAState->cMonitors;
|
---|
2114 | }
|
---|
2115 | }
|
---|
2116 |
|
---|
2117 | return rc;
|
---|
2118 |
|
---|
2119 | }
|
---|
2120 |
|
---|
2121 | void VBVADestroy (PVGASTATE pVGAState)
|
---|
2122 | {
|
---|
2123 | VBVACONTEXT *pCtx = (VBVACONTEXT *)HGSMIContext (pVGAState->pHGSMI);
|
---|
2124 |
|
---|
2125 | if (pCtx)
|
---|
2126 | {
|
---|
2127 | pCtx->mouseShapeInfo.fSet = false;
|
---|
2128 | RTMemFree(pCtx->mouseShapeInfo.pu8Shape);
|
---|
2129 | pCtx->mouseShapeInfo.pu8Shape = NULL;
|
---|
2130 | pCtx->mouseShapeInfo.cbAllocated = 0;
|
---|
2131 | pCtx->mouseShapeInfo.cbShape = 0;
|
---|
2132 | }
|
---|
2133 |
|
---|
2134 | HGSMIDestroy (pVGAState->pHGSMI);
|
---|
2135 | pVGAState->pHGSMI = NULL;
|
---|
2136 | }
|
---|