Changeset 70604 in vbox for trunk/src/VBox/Devices
- Timestamp:
- Jan 16, 2018 6:03:18 PM (7 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Devices/Graphics/DevVGA_VBVA.cpp
r70600 r70604 729 729 { 730 730 const VBVAMOUSEPOINTERSHAPE parms = *pShape; 731 ASMCompilerBarrier(); 731 732 732 733 LogFlowFunc(("VBVA_MOUSE_POINTER_SHAPE: i32Result 0x%x, fu32Flags 0x%x, hot spot %d,%d, size %dx%d\n", … … 748 749 if (parms.u32Width > 8192 || parms.u32Height > 8192) 749 750 { 750 Log(("vbvaMousePointerShape: unsupported size %ux%u\n", 751 parms.u32Width, parms.u32Height)); 751 Log(("vbvaMousePointerShape: unsupported size %ux%u\n", parms.u32Width, parms.u32Height)); 752 752 return VERR_INVALID_PARAMETER; 753 753 } … … 760 760 { 761 761 Log(("vbvaMousePointerShape: calculated pointer data size is too big (%d bytes, limit %d)\n", 762 762 cbPointerData, cbShape - RT_UOFFSETOF(VBVAMOUSEPOINTERSHAPE, au8Data))); 763 763 return VERR_INVALID_PARAMETER; 764 764 } … … 1057 1057 return true; /* command will be completed asynchronously, return right away */ 1058 1058 } 1059 elseif (rc == VERR_INVALID_STATE)1059 if (rc == VERR_INVALID_STATE) 1060 1060 { 1061 1061 Log(("VGA Command --- Trying Pend %#p, %d\n", pCommand, pCommand->enmCmd)); … … 2105 2105 } 2106 2106 2107 static int vbvaHandleQueryConf32(PVGASTATE pVGAState, VBVACONF32 *pConf32)2107 static int vbvaHandleQueryConf32(PVGASTATE pVGAState, VBVACONF32 volatile *pConf32) 2108 2108 { 2109 2109 int rc = VINF_SUCCESS; … … 2161 2161 int rc = VINF_SUCCESS; 2162 2162 const VBVACONF32 parms = *pConf32; 2163 ASMCompilerBarrier(); 2163 2164 2164 2165 LogFlowFunc(("VBVA_SET_CONF32: u32Index %d, u32Value 0x%x\n", … … 2185 2186 static int vbvaHandleInfoHeap(PVGASTATE pVGAState, const VBVAINFOHEAP *pInfoHeap) 2186 2187 { 2187 PHGSMIINSTANCE pIns = pVGAState->pHGSMI;2188 2189 2188 const VBVAINFOHEAP parms = *pInfoHeap; 2189 ASMCompilerBarrier(); 2190 2190 LogFlowFunc(("VBVA_INFO_HEAP: offset 0x%x, size 0x%x\n", 2191 2191 parms.u32HeapOffset, parms.u32HeapSize)); 2192 2192 2193 return HGSMIHostHeapSetup(p Ins, parms.u32HeapOffset, parms.u32HeapSize);2193 return HGSMIHostHeapSetup(pVGAState->pHGSMI, parms.u32HeapOffset, parms.u32HeapSize); 2194 2194 } 2195 2195 … … 2197 2197 { 2198 2198 const VBVAINFOVIEW view = *pView; 2199 ASMCompilerBarrier(); 2199 2200 2200 2201 LogFlowFunc(("VBVA_INFO_VIEW: u32ViewIndex %d, u32ViewOffset 0x%x, u32ViewSize 0x%x, u32MaxScreenSize 0x%x\n", … … 2279 2280 } 2280 2281 2281 static int vbvaHandleEnable(PVGASTATE pVGAState, const VBVAENABLE*pVbvaEnable, uint32_t u32ScreenId)2282 static int vbvaHandleEnable(PVGASTATE pVGAState, VBVAENABLE const volatile *pVbvaEnable, uint32_t u32ScreenId) 2282 2283 { 2283 2284 int rc = VINF_SUCCESS; … … 2286 2287 2287 2288 if (u32ScreenId > pCtx->cViews) 2288 {2289 2289 return VERR_INVALID_PARAMETER; 2290 } 2291 2292 const VBVAENABLE parms = *pVbvaEnable; 2293 2294 LogFlowFunc(("VBVA_ENABLE[%d]: u32Flags 0x%x u32Offset 0x%x\n", 2295 u32ScreenId, parms.u32Flags, parms.u32Offset)); 2296 2297 if ((parms.u32Flags & (VBVA_F_ENABLE | VBVA_F_DISABLE)) == VBVA_F_ENABLE) 2298 { 2299 uint32_t u32Offset = parms.u32Offset; 2300 if (u32Offset < pVGAState->vram_size) 2290 2291 uint32_t fEnableFlags = pVbvaEnable->u32Flags; 2292 uint32_t offEnable = pVbvaEnable->u32Offset; 2293 ASMCompilerBarrier(); 2294 2295 LogFlowFunc(("VBVA_ENABLE[%d]: u32Flags 0x%x u32Offset %#x\n", u32ScreenId, fEnableFlags, offEnable)); 2296 2297 if ((fEnableFlags & (VBVA_F_ENABLE | VBVA_F_DISABLE)) == VBVA_F_ENABLE) 2298 { 2299 if (offEnable < pVGAState->vram_size) 2301 2300 { 2302 2301 /* Guest reported offset either absolute or relative to view. */ 2303 if ( parms.u32Flags & VBVA_F_ABSOFFSET)2302 if (fEnableFlags & VBVA_F_ABSOFFSET) 2304 2303 { 2305 2304 /* Offset from VRAM start. */ 2306 2305 if ( pVGAState->vram_size < RT_UOFFSETOF(VBVABUFFER, au8Data) 2307 || u32Offset> pVGAState->vram_size - RT_UOFFSETOF(VBVABUFFER, au8Data))2306 || offEnable > pVGAState->vram_size - RT_UOFFSETOF(VBVABUFFER, au8Data)) 2308 2307 { 2309 2308 rc = VERR_INVALID_PARAMETER; … … 2314 2313 /* Offset from the view start. */ 2315 2314 const VBVAINFOVIEW *pView = &pCtx->aViews[u32ScreenId].view; 2316 if ( pVGAState->vram_size - u32Offset< pView->u32ViewOffset2315 if ( pVGAState->vram_size - offEnable < pView->u32ViewOffset 2317 2316 || pView->u32ViewSize < RT_UOFFSETOF(VBVABUFFER, au8Data) 2318 || u32Offset> pView->u32ViewSize - RT_UOFFSETOF(VBVABUFFER, au8Data))2317 || offEnable > pView->u32ViewSize - RT_UOFFSETOF(VBVABUFFER, au8Data)) 2319 2318 { 2320 2319 rc = VERR_INVALID_PARAMETER; … … 2322 2321 else 2323 2322 { 2324 u32Offset+= pView->u32ViewOffset;2323 offEnable += pView->u32ViewOffset; 2325 2324 } 2326 2325 } … … 2333 2332 if (RT_SUCCESS(rc)) 2334 2333 { 2335 VBVABUFFER *pVBVA = (VBVABUFFER *)HGSMIOffsetToPointerHost(pIns, u32Offset);2334 VBVABUFFER *pVBVA = (VBVABUFFER *)HGSMIOffsetToPointerHost(pIns, offEnable); 2336 2335 if (pVBVA) 2337 2336 { … … 2339 2338 vbvaFlush(pVGAState, pCtx); 2340 2339 2341 rc = vbvaEnable(u32ScreenId, pVGAState, pCtx, pVBVA, u32Offset, false /* fRestored */);2340 rc = vbvaEnable(u32ScreenId, pVGAState, pCtx, pVBVA, offEnable, false /* fRestored */); 2342 2341 } 2343 2342 else 2344 2343 { 2345 Log(("Invalid VBVABUFFER offset 0x%x!!!\n", 2346 parms.u32Offset)); 2344 Log(("Invalid VBVABUFFER offset 0x%x!!!\n", offEnable)); 2347 2345 rc = VERR_INVALID_PARAMETER; 2348 2346 } … … 2350 2348 2351 2349 if (RT_FAILURE(rc)) 2352 {2353 2350 LogRelMax(8, ("VBVA: can not enable: %Rrc\n", rc)); 2354 } 2355 } 2356 else if ((parms.u32Flags & (VBVA_F_ENABLE | VBVA_F_DISABLE)) == VBVA_F_DISABLE) 2351 } 2352 else if ((fEnableFlags & (VBVA_F_ENABLE | VBVA_F_DISABLE)) == VBVA_F_DISABLE) 2357 2353 { 2358 2354 rc = vbvaDisable(u32ScreenId, pVGAState, pCtx); … … 2360 2356 else 2361 2357 { 2362 Log(("Invalid VBVA_ENABLE flags 0x%x!!!\n", 2363 parms.u32Flags)); 2358 Log(("Invalid VBVA_ENABLE flags 0x%x!!!\n", fEnableFlags)); 2364 2359 rc = VERR_INVALID_PARAMETER; 2365 2360 } … … 2368 2363 } 2369 2364 2370 static int vbvaHandleQueryModeHints(PVGASTATE pVGAState, const VBVAQUERYMODEHINTS*pQueryModeHints, HGSMISIZE cbBuffer)2365 static int vbvaHandleQueryModeHints(PVGASTATE pVGAState, VBVAQUERYMODEHINTS volatile *pQueryModeHints, HGSMISIZE cbBuffer) 2371 2366 { 2372 2367 PHGSMIINSTANCE pIns = pVGAState->pHGSMI; 2373 VBVACONTEXT *pCtx = (VBVACONTEXT *)HGSMIContext(pIns); 2374 2375 const VBVAQUERYMODEHINTS parms = *pQueryModeHints; 2368 VBVACONTEXT *pCtx = (VBVACONTEXT *)HGSMIContext(pIns); 2369 2370 uint16_t const cHintsQueried = pQueryModeHints->cHintsQueried; 2371 uint16_t const cbHintStructureGuest = pQueryModeHints->cbHintStructureGuest; 2372 ASMCompilerBarrier(); 2376 2373 2377 2374 LogRelFlowFunc(("VBVA: HandleQueryModeHints: cHintsQueried=%RU16, cbHintStructureGuest=%RU16\n", 2378 parms.cHintsQueried, parms.cbHintStructureGuest)); 2379 2380 if (cbBuffer < sizeof(VBVAQUERYMODEHINTS) 2381 + (uint64_t)parms.cHintsQueried * parms.cbHintStructureGuest) 2382 { 2375 cHintsQueried, cbHintStructureGuest)); 2376 if (cbBuffer < sizeof(VBVAQUERYMODEHINTS) + (uint32_t)cHintsQueried * cbHintStructureGuest) 2383 2377 return VERR_INVALID_PARAMETER; 2384 } 2385 2386 uint8_t *pbHint = (uint8_t *)pQueryModeHints + sizeof(VBVAQUERYMODEHINTS); 2378 2379 uint8_t *pbHint = (uint8_t *)(pQueryModeHints + 1); 2387 2380 memset(pbHint, ~0, cbBuffer - sizeof(VBVAQUERYMODEHINTS)); 2388 2381 2389 unsigned iHint; 2390 for (iHint = 0; iHint < parms.cHintsQueried 2391 && iHint < VBOX_VIDEO_MAX_SCREENS; ++iHint) 2392 { 2393 memcpy(pbHint, &pCtx->aModeHints[iHint], 2394 RT_MIN(parms.cbHintStructureGuest, sizeof(VBVAMODEHINT))); 2395 pbHint += parms.cbHintStructureGuest; 2382 for (unsigned iHint = 0; iHint < cHintsQueried && iHint < VBOX_VIDEO_MAX_SCREENS; ++iHint) 2383 { 2384 memcpy(pbHint, &pCtx->aModeHints[iHint], RT_MIN(cbHintStructureGuest, sizeof(VBVAMODEHINT))); 2385 pbHint += cbHintStructureGuest; 2396 2386 Assert((uintptr_t)(pbHint - (uint8_t *)pQueryModeHints) <= cbBuffer); 2397 2387 } … … 2422 2412 } 2423 2413 2424 /** The guest submitted a command buffer. Verify the buffer size and invoke corresponding handler. 2414 /** 2415 * The guest submitted a command buffer (hit VGA_PORT_HGSMI_GUEST). 2416 * 2417 * Verify the buffer size and invoke corresponding handler. 2425 2418 * 2426 2419 * @return VBox status code. 2427 2420 * @param pvHandler The VBVA channel context. 2428 2421 * @param u16ChannelInfo Command code. 2429 * @param pvBuffer HGSMI buffer with command data. 2422 * @param pvBuffer HGSMI buffer with command data. Considered volatile! 2430 2423 * @param cbBuffer Size of command data. 2424 * 2425 * @thread EMT 2431 2426 */ 2432 2427 static DECLCALLBACK(int) vbvaChannelHandler(void *pvHandler, uint16_t u16ChannelInfo, void *pvBuffer, HGSMISIZE cbBuffer) … … 2434 2429 int rc = VINF_SUCCESS; 2435 2430 2436 LogFlowFunc(("pvHandler %p, u16ChannelInfo %d, pvBuffer %p, cbBuffer %u\n", 2437 pvHandler, u16ChannelInfo, pvBuffer, cbBuffer)); 2438 2439 PVGASTATE pVGAState = (PVGASTATE)pvHandler; 2440 PHGSMIINSTANCE pIns = pVGAState->pHGSMI; 2441 VBVACONTEXT *pCtx = (VBVACONTEXT *)HGSMIContext(pIns); 2431 LogFlowFunc(("pvHandler %p, u16ChannelInfo %d, pvBuffer %p, cbBuffer %u\n", pvHandler, u16ChannelInfo, pvBuffer, cbBuffer)); 2432 2433 PVGASTATE pVGAState = (PVGASTATE)pvHandler; 2434 PHGSMIINSTANCE pIns = pVGAState->pHGSMI; 2435 VBVACONTEXT *pCtx = (VBVACONTEXT *)HGSMIContext(pIns); 2442 2436 2443 2437 switch (u16ChannelInfo) … … 2487 2481 2488 2482 case VBVA_QUERY_CONF32: 2489 {2490 if (cbBuffer < sizeof(VBVACONF32))2491 {2483 if (cbBuffer >= sizeof(VBVACONF32)) 2484 rc = vbvaHandleQueryConf32(pVGAState, (VBVACONF32 *)pvBuffer); 2485 else 2492 2486 rc = VERR_INVALID_PARAMETER; 2493 break; 2494 } 2495 2496 VBVACONF32 *pConf32 = (VBVACONF32 *)pvBuffer; 2497 rc = vbvaHandleQueryConf32(pVGAState, pConf32); 2498 } break; 2487 break; 2499 2488 2500 2489 case VBVA_SET_CONF32: 2501 {2502 if (cbBuffer < sizeof(VBVACONF32))2503 {2490 if (cbBuffer >= sizeof(VBVACONF32)) 2491 rc = vbvaHandleSetConf32(pVGAState, (VBVACONF32 *)pvBuffer); 2492 else 2504 2493 rc = VERR_INVALID_PARAMETER; 2505 break; 2506 } 2507 2508 VBVACONF32 *pConf32 = (VBVACONF32 *)pvBuffer; 2509 rc = vbvaHandleSetConf32(pVGAState, pConf32); 2510 } break; 2494 break; 2511 2495 2512 2496 case VBVA_INFO_VIEW: 2513 { 2497 /* Expect at least one VBVAINFOVIEW structure. */ 2498 rc = VERR_INVALID_PARAMETER; 2499 if (cbBuffer >= sizeof(VBVAINFOVIEW)) 2500 { 2514 2501 #ifdef VBOX_WITH_CRHGSMI 2515 if (vboxCmdVBVAIsEnabled(pVGAState)) 2516 { 2517 AssertMsgFailed(("VBVA_INFO_VIEW is not acceptible for CmdVbva\n")); 2502 AssertMsgBreak(!vboxCmdVBVAIsEnabled(pVGAState), ("VBVA_INFO_VIEW is not acceptible for CmdVbva\n")); 2503 #endif 2504 /* Guest submits an array of VBVAINFOVIEW structures. */ 2505 const VBVAINFOVIEW *pView = (VBVAINFOVIEW *)pvBuffer; 2506 for (; 2507 cbBuffer >= sizeof(VBVAINFOVIEW); 2508 ++pView, cbBuffer -= sizeof(VBVAINFOVIEW)) 2509 { 2510 rc = VBVAInfoView(pVGAState, pView); 2511 if (RT_FAILURE(rc)) 2512 break; 2513 } 2514 } 2515 break; 2516 2517 case VBVA_INFO_HEAP: 2518 if (cbBuffer >= sizeof(VBVAINFOHEAP)) 2519 rc = vbvaHandleInfoHeap(pVGAState, (VBVAINFOHEAP *)pvBuffer); 2520 else 2518 2521 rc = VERR_INVALID_PARAMETER; 2519 break; 2520 } 2522 break; 2523 2524 case VBVA_FLUSH: 2525 if (cbBuffer >= sizeof(VBVAFLUSH)) 2526 rc = vbvaFlush(pVGAState, pCtx); 2527 else 2528 rc = VERR_INVALID_PARAMETER; 2529 break; 2530 2531 case VBVA_INFO_SCREEN: 2532 rc = VERR_INVALID_PARAMETER; 2533 #ifdef VBOX_WITH_CRHGSMI 2534 AssertMsgBreak(!vboxCmdVBVAIsEnabled(pVGAState), ("VBVA_INFO_SCREEN is not acceptible for CmdVbva\n")); 2535 #endif 2536 if (cbBuffer >= sizeof(VBVAINFOSCREEN)) 2537 rc = VBVAInfoScreen(pVGAState, (VBVAINFOSCREEN *)pvBuffer); 2538 break; 2539 2540 case VBVA_ENABLE: 2541 rc = VERR_INVALID_PARAMETER; 2542 #ifdef VBOX_WITH_CRHGSMI 2543 AssertMsgBreak(!vboxCmdVBVAIsEnabled(pVGAState), ("VBVA_ENABLE is not acceptible for CmdVbva\n")); 2521 2544 #endif /* VBOX_WITH_CRHGSMI */ 2522 2523 /* Expect at least one VBVAINFOVIEW structure. */ 2524 if (cbBuffer < sizeof(VBVAINFOVIEW)) 2525 { 2545 if (cbBuffer >= sizeof(VBVAENABLE)) 2546 { 2547 VBVAENABLE volatile *pVbvaEnable = (VBVAENABLE volatile *)pvBuffer; 2548 2549 uint32_t u32ScreenId; 2550 const uint32_t u32Flags = pVbvaEnable->u32Flags; 2551 if (u32Flags & VBVA_F_EXTENDED) 2552 { 2553 if (cbBuffer >= sizeof(VBVAENABLE_EX)) 2554 u32ScreenId = ((VBVAENABLE_EX volatile *)pvBuffer)->u32ScreenId; 2555 else 2556 { 2557 rc = VERR_INVALID_PARAMETER; 2558 break; 2559 } 2560 } 2561 else 2562 u32ScreenId = vbvaViewFromBufferPtr(pIns, pCtx, pvBuffer); 2563 2564 rc = vbvaHandleEnable(pVGAState, pVbvaEnable, u32ScreenId); 2565 pVbvaEnable->i32Result = rc; 2566 } 2567 break; 2568 2569 case VBVA_MOUSE_POINTER_SHAPE: 2570 if (cbBuffer >= sizeof(VBVAMOUSEPOINTERSHAPE)) 2571 { 2572 VBVAMOUSEPOINTERSHAPE *pShape = (VBVAMOUSEPOINTERSHAPE *)pvBuffer; 2573 rc = vbvaMousePointerShape(pVGAState, pCtx, pShape, cbBuffer); 2574 pShape->i32Result = rc; 2575 } 2576 else 2526 2577 rc = VERR_INVALID_PARAMETER; 2527 break; 2528 } 2529 2530 /* Guest submits an array of VBVAINFOVIEW structures. */ 2531 const VBVAINFOVIEW *pView = (VBVAINFOVIEW *)pvBuffer; 2532 for (; 2533 cbBuffer >= sizeof(VBVAINFOVIEW); 2534 ++pView, cbBuffer -= sizeof(VBVAINFOVIEW)) 2535 { 2536 rc = VBVAInfoView(pVGAState, pView); 2537 if (RT_FAILURE(rc)) 2538 break; 2539 } 2540 } break; 2541 2542 case VBVA_INFO_HEAP: 2543 { 2544 if (cbBuffer < sizeof(VBVAINFOHEAP)) 2545 { 2546 rc = VERR_INVALID_PARAMETER; 2547 break; 2548 } 2549 2550 const VBVAINFOHEAP *pInfoHeap = (VBVAINFOHEAP *)pvBuffer; 2551 rc = vbvaHandleInfoHeap(pVGAState, pInfoHeap); 2552 } break; 2553 2554 case VBVA_FLUSH: 2555 { 2556 if (cbBuffer < sizeof(VBVAFLUSH)) 2557 { 2558 rc = VERR_INVALID_PARAMETER; 2559 break; 2560 } 2561 2562 // const VBVAFLUSH *pVbvaFlush = (VBVAFLUSH *)pvBuffer; 2563 rc = vbvaFlush(pVGAState, pCtx); 2564 } break; 2565 2566 case VBVA_INFO_SCREEN: 2567 { 2568 #ifdef VBOX_WITH_CRHGSMI 2569 if (vboxCmdVBVAIsEnabled(pVGAState)) 2570 { 2571 AssertMsgFailed(("VBVA_INFO_SCREEN is not acceptible for CmdVbva\n")); 2572 rc = VERR_INVALID_PARAMETER; 2573 break; 2574 } 2575 #endif /* VBOX_WITH_CRHGSMI */ 2576 2577 if (cbBuffer < sizeof(VBVAINFOSCREEN)) 2578 { 2579 rc = VERR_INVALID_PARAMETER; 2580 break; 2581 } 2582 2583 const VBVAINFOSCREEN *pInfoScreen = (VBVAINFOSCREEN *)pvBuffer; 2584 rc = VBVAInfoScreen(pVGAState, pInfoScreen); 2585 } break; 2586 2587 case VBVA_ENABLE: 2588 { 2589 #ifdef VBOX_WITH_CRHGSMI 2590 if (vboxCmdVBVAIsEnabled(pVGAState)) 2591 { 2592 AssertMsgFailed(("VBVA_ENABLE is not acceptible for CmdVbva\n")); 2593 rc = VERR_INVALID_PARAMETER; 2594 break; 2595 } 2596 #endif /* VBOX_WITH_CRHGSMI */ 2597 2598 if (cbBuffer < sizeof(VBVAENABLE)) 2599 { 2600 rc = VERR_INVALID_PARAMETER; 2601 break; 2602 } 2603 2604 VBVAENABLE *pVbvaEnable = (VBVAENABLE *)pvBuffer; 2605 2606 uint32_t u32ScreenId; 2607 const uint32_t u32Flags = pVbvaEnable->u32Flags; 2608 if (u32Flags & VBVA_F_EXTENDED) 2609 { 2610 if (cbBuffer < sizeof(VBVAENABLE_EX)) 2611 { 2612 rc = VERR_INVALID_PARAMETER; 2613 break; 2614 } 2615 2616 const VBVAENABLE_EX *pEnableEx = (VBVAENABLE_EX *)pvBuffer; 2617 u32ScreenId = pEnableEx->u32ScreenId; 2618 } 2619 else 2620 { 2621 u32ScreenId = vbvaViewFromBufferPtr(pIns, pCtx, pvBuffer); 2622 } 2623 2624 rc = vbvaHandleEnable(pVGAState, pVbvaEnable, u32ScreenId); 2625 2626 pVbvaEnable->i32Result = rc; 2627 } break; 2628 2629 case VBVA_MOUSE_POINTER_SHAPE: 2630 { 2631 if (cbBuffer < sizeof(VBVAMOUSEPOINTERSHAPE)) 2632 { 2633 rc = VERR_INVALID_PARAMETER; 2634 break; 2635 } 2636 2637 VBVAMOUSEPOINTERSHAPE *pShape = (VBVAMOUSEPOINTERSHAPE *)pvBuffer; 2638 rc = vbvaMousePointerShape(pVGAState, pCtx, pShape, cbBuffer); 2639 2640 pShape->i32Result = rc; 2641 } break; 2578 break; 2642 2579 2643 2580 2644 2581 #ifdef VBOX_WITH_VIDEOHWACCEL 2645 2582 case VBVA_VHWA_CMD: 2646 { 2647 if (cbBuffer < VBOXVHWACMD_HEADSIZE()) 2648 { 2583 if (cbBuffer >= VBOXVHWACMD_HEADSIZE()) 2584 { 2585 vbvaVHWAHandleCommand(pVGAState, (PVBOXVHWACMD)pvBuffer); 2586 rc = VINF_SUCCESS; 2587 } 2588 else 2649 2589 rc = VERR_INVALID_PARAMETER; 2650 break; 2651 } 2652 vbvaVHWAHandleCommand(pVGAState, (PVBOXVHWACMD)pvBuffer); 2653 } break; 2654 #endif /* VBOX_WITH_VIDEOHWACCEL */ 2590 break; 2591 #endif 2655 2592 2656 2593 #ifdef VBOX_WITH_WDDM 2657 2594 case VBVA_INFO_CAPS: 2658 { 2659 if (cbBuffer < sizeof(VBVACAPS)) 2660 { 2595 if (cbBuffer >= sizeof(VBVACAPS)) 2596 { 2597 VBVACAPS volatile *pCaps = (VBVACAPS volatile *)pvBuffer; 2598 pVGAState->fGuestCaps = pCaps->fCaps; 2599 pVGAState->pDrv->pfnVBVAGuestCapabilityUpdate(pVGAState->pDrv, pVGAState->fGuestCaps); 2600 pCaps->rc = rc = VINF_SUCCESS; 2601 } 2602 else 2661 2603 rc = VERR_INVALID_PARAMETER; 2662 break; 2663 } 2664 2665 VBVACAPS *pCaps = (VBVACAPS*)pvBuffer; 2666 pVGAState->fGuestCaps = pCaps->fCaps; 2667 pVGAState->pDrv->pfnVBVAGuestCapabilityUpdate(pVGAState->pDrv, 2668 pVGAState->fGuestCaps); 2669 pCaps->rc = VINF_SUCCESS; 2670 } break; 2671 #endif /* VBOX_WITH_WDDM */ 2604 break; 2605 #endif 2672 2606 2673 2607 case VBVA_SCANLINE_CFG: 2674 { 2675 if (cbBuffer < sizeof(VBVASCANLINECFG)) 2676 { 2608 if (cbBuffer >= sizeof(VBVASCANLINECFG)) 2609 { 2610 VBVASCANLINECFG volatile *pCfg = (VBVASCANLINECFG volatile *)pvBuffer; 2611 pVGAState->fScanLineCfg = pCfg->fFlags; 2612 pCfg->rc = rc = VINF_SUCCESS; 2613 } 2614 else 2677 2615 rc = VERR_INVALID_PARAMETER; 2678 break; 2679 } 2680 2681 VBVASCANLINECFG *pCfg = (VBVASCANLINECFG*)pvBuffer; 2682 pVGAState->fScanLineCfg = pCfg->fFlags; 2683 pCfg->rc = VINF_SUCCESS; 2684 } break; 2616 break; 2685 2617 2686 2618 case VBVA_QUERY_MODE_HINTS: 2687 { 2688 if (cbBuffer < sizeof(VBVAQUERYMODEHINTS)) 2689 { 2619 if (cbBuffer >= sizeof(VBVAQUERYMODEHINTS)) 2620 { 2621 VBVAQUERYMODEHINTS volatile *pQueryModeHints = (VBVAQUERYMODEHINTS volatile *)pvBuffer; 2622 rc = vbvaHandleQueryModeHints(pVGAState, pQueryModeHints, cbBuffer); 2623 pQueryModeHints->rc = rc; 2624 } 2625 else 2690 2626 rc = VERR_INVALID_PARAMETER; 2691 break; 2692 } 2693 2694 VBVAQUERYMODEHINTS *pQueryModeHints = (VBVAQUERYMODEHINTS*)pvBuffer; 2695 rc = vbvaHandleQueryModeHints(pVGAState, pQueryModeHints, cbBuffer); 2696 pQueryModeHints->rc = rc; 2697 } break; 2627 break; 2698 2628 2699 2629 case VBVA_REPORT_INPUT_MAPPING: 2700 { 2701 if (cbBuffer < sizeof(VBVAREPORTINPUTMAPPING)) 2702 { 2630 if (cbBuffer >= sizeof(VBVAREPORTINPUTMAPPING)) 2631 { 2632 const VBVAREPORTINPUTMAPPING inputMapping = *(VBVAREPORTINPUTMAPPING *)pvBuffer; 2633 ASMCompilerBarrier(); 2634 LogRelFlowFunc(("VBVA: ChannelHandler: VBVA_REPORT_INPUT_MAPPING: x=%RI32, y=%RI32, cx=%RU32, cy=%RU32\n", 2635 inputMapping.x, inputMapping.y, inputMapping.cx, inputMapping.cy)); 2636 pVGAState->pDrv->pfnVBVAInputMappingUpdate(pVGAState->pDrv, 2637 inputMapping.x, inputMapping.y, 2638 inputMapping.cx, inputMapping.cy); 2639 rc = VINF_SUCCESS; 2640 } 2641 else 2703 2642 rc = VERR_INVALID_PARAMETER; 2704 break; 2705 } 2706 2707 const VBVAREPORTINPUTMAPPING inputMapping = *(VBVAREPORTINPUTMAPPING *)pvBuffer; 2708 LogRelFlowFunc(("VBVA: ChannelHandler: VBVA_REPORT_INPUT_MAPPING: x=%RI32, y=%RI32, cx=%RU32, cy=%RU32\n", 2709 inputMapping.x, inputMapping.y, inputMapping.cx, inputMapping.cy)); 2710 pVGAState->pDrv->pfnVBVAInputMappingUpdate(pVGAState->pDrv, 2711 inputMapping.x, inputMapping.y, 2712 inputMapping.cx, inputMapping.cy); 2713 } break; 2643 break; 2714 2644 2715 2645 case VBVA_CURSOR_POSITION: 2716 { 2717 if (cbBuffer < sizeof(VBVACURSORPOSITION)) 2718 { 2646 if (cbBuffer >= sizeof(VBVACURSORPOSITION)) 2647 { 2648 VBVACURSORPOSITION volatile *pReport = (VBVACURSORPOSITION volatile *)pvBuffer; 2649 2650 LogRelFlowFunc(("VBVA: ChannelHandler: VBVA_CURSOR_POSITION: fReportPosition=%RTbool, x=%RU32, y=%RU32\n", 2651 RT_BOOL(pReport->fReportPosition), pReport->x, pReport->y)); 2652 2653 pVGAState->pDrv->pfnVBVAReportCursorPosition(pVGAState->pDrv, RT_BOOL(pReport->fReportPosition), 2654 pReport->x, pReport->y); 2655 pReport->x = pCtx->xCursor; 2656 pReport->y = pCtx->yCursor; 2657 rc = VINF_SUCCESS; 2658 } 2659 else 2719 2660 rc = VERR_INVALID_PARAMETER; 2720 break; 2721 } 2722 2723 VBVACURSORPOSITION *pReport = (VBVACURSORPOSITION *)pvBuffer; 2724 2725 LogRelFlowFunc(("VBVA: ChannelHandler: VBVA_CURSOR_POSITION: fReportPosition=%RTbool, x=%RU32, y=%RU32\n", 2726 RT_BOOL(pReport->fReportPosition), pReport->x, pReport->y)); 2727 2728 pVGAState->pDrv->pfnVBVAReportCursorPosition(pVGAState->pDrv, RT_BOOL(pReport->fReportPosition), 2729 pReport->x, pReport->y); 2730 pReport->x = pCtx->xCursor; 2731 pReport->y = pCtx->yCursor; 2732 } break; 2661 break; 2733 2662 2734 2663 default: 2735 Log(("Unsupported VBVA guest command %d!!!\n", 2736 u16ChannelInfo)); 2664 Log(("Unsupported VBVA guest command %d (%#x)!!!\n", u16ChannelInfo, u16ChannelInfo)); 2737 2665 break; 2738 2666 }
Note:
See TracChangeset
for help on using the changeset viewer.