Changeset 73194 in vbox
- Timestamp:
- Jul 18, 2018 7:14:24 AM (7 years ago)
- Location:
- trunk/src/VBox/Devices/Graphics
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Devices/Graphics/DevVGA-SVGA.cpp
r73004 r73194 3760 3760 STAM_REL_COUNTER_INC(&pSVGAState->StatR3CmdBlitGmrFbToScreen); 3761 3761 3762 Log(("vmsvgaFIFOLoop: SVGA_CMD_BLIT_GMRFB_TO_SCREEN src=(%d,%d) dest id=%d (%d,%d)(%d,%d)\n", pCmd->srcOrigin.x, pCmd->srcOrigin.y, pCmd->destScreenId, pCmd->destRect.left, pCmd->destRect.top, pCmd->destRect.right, pCmd->destRect.bottom)); 3762 LogFunc(("SVGA_CMD_BLIT_GMRFB_TO_SCREEN src=(%d,%d) dest id=%d (%d,%d)(%d,%d)\n", 3763 pCmd->srcOrigin.x, pCmd->srcOrigin.y, pCmd->destScreenId, pCmd->destRect.left, pCmd->destRect.top, pCmd->destRect.right, pCmd->destRect.bottom)); 3763 3764 3764 3765 /** @todo Support GMRFB.format.s.bitsPerPixel != pThis->svga.uBpp */ 3765 3766 AssertBreak(pSVGAState->GMRFB.format.s.bitsPerPixel == pThis->svga.uBpp); 3767 /** @todo Multimonitor. */ 3766 3768 AssertBreak(pCmd->destScreenId == 0); 3767 3769 3768 if (pCmd->destRect.left < 0) 3769 pCmd->destRect.left = 0; 3770 if (pCmd->destRect.top < 0) 3771 pCmd->destRect.top = 0; 3772 if (pCmd->destRect.right < 0) 3773 pCmd->destRect.right = 0; 3774 if (pCmd->destRect.bottom < 0) 3775 pCmd->destRect.bottom = 0; 3776 3777 width = pCmd->destRect.right - pCmd->destRect.left; 3778 height = pCmd->destRect.bottom - pCmd->destRect.top; 3779 3780 if ( width == 0 3781 || height == 0) 3770 /* Clip destRect to the screen dimensions. */ 3771 SVGASignedRect screenRect; 3772 screenRect.left = 0; 3773 screenRect.top = 0; 3774 screenRect.right = pThis->svga.uWidth; 3775 screenRect.top = pThis->svga.uHeight; 3776 SVGASignedRect clipRect = pCmd->destRect; 3777 vmsvgaClipRect(&screenRect, &clipRect); 3778 RT_UNTRUSTED_VALIDATED_FENCE(); 3779 3780 width = clipRect.right - clipRect.left; 3781 height = clipRect.bottom - clipRect.top; 3782 3783 if ( width == 0 3784 || height == 0) 3782 3785 break; /* Nothing to do. */ 3783 3786 3784 /* Clip to screen dimensions. */ 3785 if (width > pThis->svga.uWidth) 3786 width = pThis->svga.uWidth; 3787 if (height > pThis->svga.uHeight) 3788 height = pThis->svga.uHeight; 3789 3790 /* srcOrigin */ 3791 AssertBreak(pSVGAState->GMRFB.bytesPerLine != 0); 3792 AssertBreak(pSVGAState->GMRFB.format.s.bitsPerPixel != 0); 3793 3787 int32_t const srcx = pCmd->srcOrigin.x + (clipRect.left - pCmd->destRect.left); 3788 int32_t const srcy = pCmd->srcOrigin.y + (clipRect.top - pCmd->destRect.top); 3789 3790 /* Copy the defined by GMRFB image to the screen 0 VRAM area. 3791 * Prepare parameters for vmsvgaGMRTransfer. 3792 */ 3794 3793 AssertBreak(pThis->svga.uScreenOffset < pThis->vram_size); /* Paranoia. Ensured by SVGA_CMD_DEFINE_SCREEN. */ 3795 const uint32_t cbVram = pThis->vram_size - pThis->svga.uScreenOffset; 3796 3797 const uint32_t cScanlines = cbVram / pSVGAState->GMRFB.bytesPerLine; 3798 AssertBreak(pCmd->srcOrigin.y < (int32_t)cScanlines); 3799 3800 AssertBreak(pCmd->srcOrigin.x < (int32_t)(pSVGAState->GMRFB.bytesPerLine / ((pSVGAState->GMRFB.format.s.bitsPerPixel + 7) / 8))); 3801 3802 unsigned offsetSource = (pCmd->srcOrigin.x * pSVGAState->GMRFB.format.s.bitsPerPixel) / 8 + pSVGAState->GMRFB.bytesPerLine * pCmd->srcOrigin.y; 3803 unsigned offsetDest = (pCmd->destRect.left * RT_ALIGN(pThis->svga.uBpp, 8)) / 8 + pThis->svga.cbScanline * pCmd->destRect.top; 3804 unsigned cbCopyWidth = (width * RT_ALIGN(pThis->svga.uBpp, 8)) / 8; 3805 3806 AssertBreak(offsetDest < cbVram); 3807 offsetDest += pThis->svga.uScreenOffset; 3808 3809 RT_UNTRUSTED_VALIDATED_FENCE(); 3810 3811 rc = vmsvgaGMRTransfer(pThis, SVGA3D_WRITE_HOST_VRAM, pThis->CTX_SUFF(vram_ptr) + offsetDest, pThis->svga.cbScanline, pSVGAState->GMRFB.ptr, offsetSource, pSVGAState->GMRFB.bytesPerLine, cbCopyWidth, height); 3794 3795 /* Destination: host buffer which describes the screen 0 VRAM. 3796 * Important are pbHstBuf and cbHstBuf. offHst and cbHstPitch are verified by vmsvgaGMRTransfer. 3797 */ 3798 uint8_t * const pbHstBuf = (uint8_t *)pThis->CTX_SUFF(vram_ptr) + pThis->svga.uScreenOffset; 3799 uint32_t cbHstBuf = pThis->svga.cbScanline * pThis->svga.uHeight; 3800 if (cbHstBuf > pThis->vram_size - pThis->svga.uScreenOffset) 3801 cbHstBuf = pThis->vram_size - pThis->svga.uScreenOffset; /* Paranoia. */ 3802 uint32_t const offHst = (clipRect.left * RT_ALIGN(pThis->svga.uBpp, 8)) / 8 3803 + pThis->svga.cbScanline * clipRect.top; 3804 int32_t const cbHstPitch = pThis->svga.cbScanline; 3805 3806 /* Source: GMRFB. vmsvgaGMRTransfer ensures that no memory outside the GMR is read. */ 3807 SVGAGuestPtr const gstPtr = pSVGAState->GMRFB.ptr; 3808 uint32_t const offGst = (srcx * RT_ALIGN(pSVGAState->GMRFB.format.s.bitsPerPixel, 8)) / 8 3809 + pSVGAState->GMRFB.bytesPerLine * srcy; 3810 int32_t const cbGstPitch = pSVGAState->GMRFB.bytesPerLine; 3811 3812 rc = vmsvgaGMRTransfer(pThis, SVGA3D_WRITE_HOST_VRAM, 3813 pbHstBuf, cbHstBuf, offHst, cbHstPitch, 3814 gstPtr, offGst, cbGstPitch, 3815 (width * RT_ALIGN(pThis->svga.uBpp, 8)) / 8, height); 3812 3816 AssertRC(rc); 3813 vgaR3UpdateDisplay(pThis, pCmd->destRect.left, pCmd->destRect.top, pCmd->destRect.right - pCmd->destRect.left, pCmd->destRect.bottom - pCmd->destRect.top);3817 vgaR3UpdateDisplay(pThis, clipRect.left, clipRect.top, width, height); 3814 3818 break; 3815 3819 } … … 4352 4356 * @param pThis VGA device instance data. 4353 4357 * @param enmTransferType Transfer type (read/write) 4354 * @param pbHst Host destination pointer 4358 * @param pbHstBuf Host buffer pointer (valid) 4359 * @param cbHstBuf Size of host buffer (valid) 4360 * @param offHst Host buffer offset of the first scanline 4355 4361 * @param cbHstPitch Destination buffer pitch 4356 4362 * @param gstPtr GMR description 4357 * @param offGst Guest buffer offset 4363 * @param offGst Guest buffer offset of the first scanline 4358 4364 * @param cbGstPitch Guest buffer pitch 4359 4365 * @param cbWidth Width in bytes to copy 4360 4366 * @param cHeight Number of scanllines to copy 4361 4367 */ 4362 int vmsvgaGMRTransfer(PVGASTATE pThis, const SVGA3dTransferType enmTransferType, uint8_t *pbHst, int32_t cbHstPitch, 4363 SVGAGuestPtr gstPtr, uint32_t offGst, int32_t cbGstPitch, uint32_t cbWidth, uint32_t cHeight) 4368 int vmsvgaGMRTransfer(PVGASTATE pThis, const SVGA3dTransferType enmTransferType, 4369 uint8_t *pbHstBuf, uint32_t cbHstBuf, uint32_t offHst, int32_t cbHstPitch, 4370 SVGAGuestPtr gstPtr, uint32_t offGst, int32_t cbGstPitch, 4371 uint32_t cbWidth, uint32_t cHeight) 4364 4372 { 4365 4373 PVMSVGAR3STATE pSVGAState = pThis->svga.pSvgaR3State; 4366 4374 int rc; 4367 4375 4368 LogFunc(("%s host %p pitch=%d; guest gmr=%#x:%#x offset=%d pitch=%d cbWidth=%d cHeight=%d\n", 4369 enmTransferType == SVGA3D_READ_HOST_VRAM ? "READ" : "WRITE", pbHst, cbHstPitch, 4376 LogFunc(("%s host %p size=%d offset %d pitch=%d; guest gmr=%#x:%#x offset=%d pitch=%d cbWidth=%d cHeight=%d\n", 4377 enmTransferType == SVGA3D_READ_HOST_VRAM ? "READ" : "WRITE", 4378 pbHstBuf, cbHstBuf, offHst, cbHstPitch, 4370 4379 gstPtr.gmrId, gstPtr.offset, offGst, cbGstPitch, cbWidth, cHeight)); 4371 4380 AssertReturn(cbWidth && cHeight, VERR_INVALID_PARAMETER); 4372 4381 4373 4382 PGMR pGMR; 4374 uint32_t cbGmr Total; /* The GMR size in bytes. */4383 uint32_t cbGmr; /* The GMR size in bytes. */ 4375 4384 if (gstPtr.gmrId == SVGA_GMR_FRAMEBUFFER) 4376 4385 { 4377 4386 pGMR = NULL; 4378 cbGmr Total= pThis->vram_size;4387 cbGmr = pThis->vram_size; 4379 4388 } 4380 4389 else … … 4383 4392 RT_UNTRUSTED_VALIDATED_FENCE(); 4384 4393 pGMR = &pSVGAState->paGMR[gstPtr.gmrId]; 4385 cbGmrTotal = pGMR->cbTotal; 4386 } 4387 4394 cbGmr = pGMR->cbTotal; 4395 } 4396 4397 /* 4398 * GMR 4399 */ 4388 4400 /* Calculate GMR offset of the data to be copied. */ 4389 AssertMsgReturn(gstPtr.offset < cbGmr Total,4390 ("gmr=%#x:%#x offGst=%#x cbGstPitch=%#x cHeight=%#x cbWidth=%#x cbGmr Total=%#x\n",4391 gstPtr.gmrId, gstPtr.offset, offGst, cbGstPitch, cHeight, cbWidth, cbGmr Total),4401 AssertMsgReturn(gstPtr.offset < cbGmr, 4402 ("gmr=%#x:%#x offGst=%#x cbGstPitch=%#x cHeight=%#x cbWidth=%#x cbGmr=%#x\n", 4403 gstPtr.gmrId, gstPtr.offset, offGst, cbGstPitch, cHeight, cbWidth, cbGmr), 4392 4404 VERR_INVALID_PARAMETER); 4393 4405 RT_UNTRUSTED_VALIDATED_FENCE(); 4394 AssertMsgReturn(offGst < cbGmr Total- gstPtr.offset,4395 ("gmr=%#x:%#x offGst=%#x cbGstPitch=%#x cHeight=%#x cbWidth=%#x cbGmr Total=%#x\n",4396 gstPtr.gmrId, gstPtr.offset, offGst, cbGstPitch, cHeight, cbWidth, cbGmr Total),4406 AssertMsgReturn(offGst < cbGmr - gstPtr.offset, 4407 ("gmr=%#x:%#x offGst=%#x cbGstPitch=%#x cHeight=%#x cbWidth=%#x cbGmr=%#x\n", 4408 gstPtr.gmrId, gstPtr.offset, offGst, cbGstPitch, cHeight, cbWidth, cbGmr), 4397 4409 VERR_INVALID_PARAMETER); 4398 4410 RT_UNTRUSTED_VALIDATED_FENCE(); 4399 4411 uint32_t const offGmr = offGst + gstPtr.offset; /* Offset in the GMR, where the first scanline is located. */ 4400 4412 4401 /* Verify that cbWidth is less tha tscanline and fits into the GMR. */4413 /* Verify that cbWidth is less than scanline and fits into the GMR. */ 4402 4414 uint32_t const cbGmrScanline = cbGstPitch > 0 ? cbGstPitch : -cbGstPitch; 4403 4415 AssertMsgReturn(cbGmrScanline != 0, 4404 ("gmr=%#x:%#x offGst=%#x cbGstPitch=%#x cHeight=%#x cbWidth=%#x cbGmr Total=%#x\n",4405 gstPtr.gmrId, gstPtr.offset, offGst, cbGstPitch, cHeight, cbWidth, cbGmr Total),4416 ("gmr=%#x:%#x offGst=%#x cbGstPitch=%#x cHeight=%#x cbWidth=%#x cbGmr=%#x\n", 4417 gstPtr.gmrId, gstPtr.offset, offGst, cbGstPitch, cHeight, cbWidth, cbGmr), 4406 4418 VERR_INVALID_PARAMETER); 4407 4419 RT_UNTRUSTED_VALIDATED_FENCE(); 4408 4420 AssertMsgReturn(cbWidth <= cbGmrScanline, 4409 ("gmr=%#x:%#x offGst=%#x cbGstPitch=%#x cHeight=%#x cbWidth=%#x cbGmr Total=%#x\n",4410 gstPtr.gmrId, gstPtr.offset, offGst, cbGstPitch, cHeight, cbWidth, cbGmr Total),4421 ("gmr=%#x:%#x offGst=%#x cbGstPitch=%#x cHeight=%#x cbWidth=%#x cbGmr=%#x\n", 4422 gstPtr.gmrId, gstPtr.offset, offGst, cbGstPitch, cHeight, cbWidth, cbGmr), 4411 4423 VERR_INVALID_PARAMETER); 4412 AssertMsgReturn(cbWidth <= cbGmr Total- offGmr,4413 ("gmr=%#x:%#x offGst=%#x cbGstPitch=%#x cHeight=%#x cbWidth=%#x cbGmr Total=%#x\n",4414 gstPtr.gmrId, gstPtr.offset, offGst, cbGstPitch, cHeight, cbWidth, cbGmr Total),4424 AssertMsgReturn(cbWidth <= cbGmr - offGmr, 4425 ("gmr=%#x:%#x offGst=%#x cbGstPitch=%#x cHeight=%#x cbWidth=%#x cbGmr=%#x\n", 4426 gstPtr.gmrId, gstPtr.offset, offGst, cbGstPitch, cHeight, cbWidth, cbGmr), 4415 4427 VERR_INVALID_PARAMETER); 4416 4428 RT_UNTRUSTED_VALIDATED_FENCE(); 4417 4429 4418 4430 /* How many bytes are available for the data in the GMR. */ 4419 uint32_t const cbGmrLeft = cbGstPitch > 0 ? cbGmr Total- offGmr : offGmr + cbWidth;4431 uint32_t const cbGmrLeft = cbGstPitch > 0 ? cbGmr - offGmr : offGmr + cbWidth; 4420 4432 4421 4433 /* How many scanlines would fit into the available data. */ 4422 4434 uint32_t cGmrScanlines = cbGmrLeft / cbGmrScanline; 4423 uint32_t const cb LastScanline = cbGmrLeft - cGmrScanlines * cbGmrScanline; /* Slack space. */4424 if (cbWidth <= cb LastScanline)4435 uint32_t const cbGmrLastScanline = cbGmrLeft - cGmrScanlines * cbGmrScanline; /* Slack space. */ 4436 if (cbWidth <= cbGmrLastScanline) 4425 4437 ++cGmrScanlines; 4426 4438 … … 4429 4441 4430 4442 AssertMsgReturn(cHeight > 0, 4431 ("gmr=%#x:%#x offGst=%#x cbGstPitch=%#x cHeight=%#x cbWidth=%#x cbGmr Total=%#x\n",4432 gstPtr.gmrId, gstPtr.offset, offGst, cbGstPitch, cHeight, cbWidth, cbGmr Total),4443 ("gmr=%#x:%#x offGst=%#x cbGstPitch=%#x cHeight=%#x cbWidth=%#x cbGmr=%#x\n", 4444 gstPtr.gmrId, gstPtr.offset, offGst, cbGstPitch, cHeight, cbWidth, cbGmr), 4433 4445 VERR_INVALID_PARAMETER); 4434 4446 RT_UNTRUSTED_VALIDATED_FENCE(); 4447 4448 /* 4449 * Host buffer. 4450 */ 4451 AssertMsgReturn(offHst < cbHstBuf, 4452 ("buffer=%p size %d offHst=%d cbHstPitch=%d cHeight=%d cbWidth=%d\n", 4453 pbHstBuf, cbHstBuf, offHst, cbHstPitch, cHeight, cbWidth), 4454 VERR_INVALID_PARAMETER); 4455 4456 /* Verify that cbWidth is less than scanline and fits into the buffer. */ 4457 uint32_t const cbHstScanline = cbHstPitch > 0 ? cbHstPitch : -cbHstPitch; 4458 AssertMsgReturn(cbHstScanline != 0, 4459 ("buffer=%p size %d offHst=%d cbHstPitch=%d cHeight=%d cbWidth=%d\n", 4460 pbHstBuf, cbHstBuf, offHst, cbHstPitch, cHeight, cbWidth), 4461 VERR_INVALID_PARAMETER); 4462 AssertMsgReturn(cbWidth <= cbHstScanline, 4463 ("buffer=%p size %d offHst=%d cbHstPitch=%d cHeight=%d cbWidth=%d\n", 4464 pbHstBuf, cbHstBuf, offHst, cbHstPitch, cHeight, cbWidth), 4465 VERR_INVALID_PARAMETER); 4466 AssertMsgReturn(cbWidth <= cbHstBuf - offHst, 4467 ("buffer=%p size %d offHst=%d cbHstPitch=%d cHeight=%d cbWidth=%d\n", 4468 pbHstBuf, cbHstBuf, offHst, cbHstPitch, cHeight, cbWidth), 4469 VERR_INVALID_PARAMETER); 4470 4471 /* How many bytes are available for the data in the buffer. */ 4472 uint32_t const cbHstLeft = cbHstPitch > 0 ? cbHstBuf - offHst : offHst + cbWidth; 4473 4474 /* How many scanlines would fit into the available data. */ 4475 uint32_t cHstScanlines = cbHstLeft / cbHstScanline; 4476 uint32_t const cbHstLastScanline = cbHstLeft - cHstScanlines * cbHstScanline; /* Slack space. */ 4477 if (cbWidth <= cbHstLastScanline) 4478 ++cHstScanlines; 4479 4480 if (cHeight > cHstScanlines) 4481 cHeight = cHstScanlines; 4482 4483 AssertMsgReturn(cHeight > 0, 4484 ("buffer=%p size %d offHst=%d cbHstPitch=%d cHeight=%d cbWidth=%d\n", 4485 pbHstBuf, cbHstBuf, offHst, cbHstPitch, cHeight, cbWidth), 4486 VERR_INVALID_PARAMETER); 4487 4488 uint8_t *pbHst = pbHstBuf + offHst; 4435 4489 4436 4490 /* Shortcut for the framebuffer. */ -
trunk/src/VBox/Devices/Graphics/DevVGA-SVGA3d-ogl.cpp
r71686 r73194 2349 2349 * @param cbGuestPitch The guest pitch. 2350 2350 * @param transfer The transfer direction. 2351 * @param pBox The box to copy .2351 * @param pBox The box to copy (clipped, valid, except for guest's srcx, srcy, srcz). 2352 2352 * @param pContext The context (for OpenGL). 2353 2353 * @param rc The current rc for all boxes. … … 2369 2369 { 2370 2370 uint32_t cbSurfacePitch; 2371 uint8_t *pDoubleBuffer , *pBufferStart;2372 u nsigned uDestOffset = 0;2371 uint8_t *pDoubleBuffer; 2372 uint32_t offHst; 2373 2373 2374 2374 pDoubleBuffer = (uint8_t *)RTMemAlloc(pMipLevel->cbSurface); … … 2403 2403 VMSVGA3D_CHECK_LAST_ERROR_WARN(pState, pContext); 2404 2404 2405 uDestOffset = pBox->x * pSurface->cbBlock + pBox->y * pMipLevel->cbSurfacePitch; 2406 AssertReturnStmt( uDestOffset + pBox->w * pSurface->cbBlock + (pBox->h - 1) * pMipLevel->cbSurfacePitch 2407 <= pMipLevel->cbSurface, 2408 RTMemFree(pDoubleBuffer), 2409 VERR_INTERNAL_ERROR); 2410 2405 offHst = pBox->x * pSurface->cbBlock + pBox->y * pMipLevel->cbSurfacePitch; 2411 2406 cbSurfacePitch = pMipLevel->cbSurfacePitch; 2412 2407 … … 2417 2412 - cbSurfacePitch; /* flip image during copy */ 2418 2413 #else 2419 pBufferStart = pDoubleBuffer + uDestOffset;2420 2414 #endif 2421 2415 } 2422 2416 else 2423 2417 { 2418 /* The buffer will contain only the copied rectangle. */ 2419 offHst = 0; 2424 2420 cbSurfacePitch = pBox->w * pSurface->cbBlock; 2425 2421 #ifdef MANUAL_FLIP_SURFACE_DATA 2426 2422 pBufferStart = pDoubleBuffer + cbSurfacePitch * pBox->h - cbSurfacePitch; /* flip image during copy */ 2427 2423 #else 2428 pBufferStart = pDoubleBuffer; 2429 #endif 2430 } 2424 #endif 2425 } 2426 2427 uint32_t const offGst = pBox->srcx * pSurface->cbBlock + pBox->srcy * cbGuestPitch; /// @todo compressed fmts 2431 2428 2432 2429 rc = vmsvgaGMRTransfer(pThis, 2433 2430 transfer, 2434 pBufferStart, 2431 pDoubleBuffer, 2432 pMipLevel->cbSurface, 2433 offHst, 2435 2434 #ifdef MANUAL_FLIP_SURFACE_DATA 2436 2435 -(int32_t)cbSurfacePitch, 2437 2436 #else 2438 (int32_t)cbSurfacePitch,2437 cbSurfacePitch, 2439 2438 #endif 2440 2439 GuestPtr, 2441 pBox->srcx * pSurface->cbBlock + pBox->srcy * cbGuestPitch, /// @todo compressed fmts2440 offGst, 2442 2441 cbGuestPitch, 2443 2442 pBox->w * pSurface->cbBlock, … … 2498 2497 case SVGA3D_SURFACE_HINT_INDEXBUFFER: 2499 2498 { 2500 Assert(pBox->h == 1); 2499 /* Caller already clipped pBox and buffers are 1-dimensional. */ 2500 Assert(pBox->y == 0 && pBox->h == 1 && pBox->z == 0 && pBox->d == 1); 2501 2501 2502 2502 VMSVGA3D_CLEAR_GL_ERRORS(); … … 2515 2515 ("cbStrictBufSize=%#x cbSurface=%#x pContext->id=%#x\n", (uint32_t)cbStrictBufSize, pMipLevel->cbSurface, pContext->id)); 2516 2516 #endif 2517 2518 unsigned offDst = pBox->x * pSurface->cbBlock + pBox->y * pMipLevel->cbSurfacePitch; 2519 if (RT_LIKELY( offDst + pBox->w * pSurface->cbBlock + (pBox->h - 1) * pMipLevel->cbSurfacePitch 2520 <= pMipLevel->cbSurface)) 2521 { 2522 Log(("Lock %s memory for rectangle (%d,%d)(%d,%d)\n", 2523 (pSurface->surfaceFlags & VMSVGA3D_SURFACE_HINT_SWITCH_MASK) == SVGA3D_SURFACE_HINT_VERTEXBUFFER ? "vertex" : 2524 (pSurface->surfaceFlags & VMSVGA3D_SURFACE_HINT_SWITCH_MASK) == SVGA3D_SURFACE_HINT_INDEXBUFFER ? "index" : "buffer", 2525 pBox->x, pBox->y, pBox->x + pBox->w, pBox->y + pBox->h)); 2526 2527 rc = vmsvgaGMRTransfer(pThis, 2528 transfer, 2529 pbData + offDst, 2530 pMipLevel->cbSurfacePitch, 2531 GuestPtr, 2532 pBox->srcx * pSurface->cbBlock + pBox->srcy * cbGuestPitch, 2533 cbGuestPitch, 2534 pBox->w * pSurface->cbBlock, 2535 pBox->h); 2536 AssertRC(rc); 2537 2538 Log4(("first line:\n%.*Rhxd\n", cbGuestPitch, pbData + offDst)); 2539 } 2540 else 2541 { 2542 AssertFailed(); 2543 rc = VERR_INTERNAL_ERROR; 2544 } 2517 Log(("Lock %s memory for rectangle (%d,%d)(%d,%d)\n", 2518 (pSurface->surfaceFlags & VMSVGA3D_SURFACE_HINT_SWITCH_MASK) == SVGA3D_SURFACE_HINT_VERTEXBUFFER ? "vertex" : 2519 (pSurface->surfaceFlags & VMSVGA3D_SURFACE_HINT_SWITCH_MASK) == SVGA3D_SURFACE_HINT_INDEXBUFFER ? "index" : "buffer", 2520 pBox->x, pBox->y, pBox->x + pBox->w, pBox->y + pBox->h)); 2521 2522 uint32_t const offHst = pBox->x * pSurface->cbBlock; 2523 2524 rc = vmsvgaGMRTransfer(pThis, 2525 transfer, 2526 pbData, 2527 pMipLevel->cbSurface, 2528 offHst, 2529 pMipLevel->cbSurfacePitch, 2530 GuestPtr, 2531 pBox->srcx * pSurface->cbBlock, 2532 cbGuestPitch, 2533 pBox->w * pSurface->cbBlock, 2534 pBox->h); 2535 AssertRC(rc); 2536 2537 Log4(("first line:\n%.*Rhxd\n", cbGuestPitch, pbData + offHst)); 2545 2538 2546 2539 pState->ext.glUnmapBuffer(GL_ARRAY_BUFFER); -
trunk/src/VBox/Devices/Graphics/DevVGA-SVGA3d-shared.cpp
r69852 r73194 1190 1190 pBox->d = pSize->depth - pBox->z; 1191 1191 } 1192 1193 /** Clip. 1194 * 1195 * @param pBound Bounding rectangle. 1196 * @param pRect Rectangle to be clipped. 1197 */ 1198 void vmsvgaClipRect(SVGASignedRect const *pBound, 1199 SVGASignedRect *pRect) 1200 { 1201 int32_t left; 1202 int32_t top; 1203 int32_t right; 1204 int32_t bottom; 1205 1206 /* Right order. */ 1207 Assert(pBound->left <= pBound->right && pBound->top <= pBound->bottom); 1208 if (pRect->left < pRect->right) 1209 { 1210 left = pRect->left; 1211 right = pRect->right; 1212 } 1213 else 1214 { 1215 left = pRect->right; 1216 right = pRect->left; 1217 } 1218 if (pRect->top < pRect->bottom) 1219 { 1220 top = pRect->top; 1221 bottom = pRect->bottom; 1222 } 1223 else 1224 { 1225 top = pRect->bottom; 1226 bottom = pRect->top; 1227 } 1228 1229 if (left < pBound->left) 1230 left = pBound->left; 1231 if (right < pBound->left) 1232 right = pBound->left; 1233 1234 if (left > pBound->right) 1235 left = pBound->right; 1236 if (right > pBound->right) 1237 right = pBound->right; 1238 1239 if (top < pBound->top) 1240 top = pBound->top; 1241 if (bottom < pBound->top) 1242 bottom = pBound->top; 1243 1244 if (top > pBound->bottom) 1245 top = pBound->bottom; 1246 if (bottom > pBound->bottom) 1247 bottom = pBound->bottom; 1248 1249 pRect->left = left; 1250 pRect->right = right; 1251 pRect->top = top; 1252 pRect->bottom = bottom; 1253 } -
trunk/src/VBox/Devices/Graphics/DevVGA-SVGA3d-win.cpp
r72241 r73194 2188 2188 * @param cbGuestPitch The guest pitch. 2189 2189 * @param transfer The transfer direction. 2190 * @param pBox The box to copy (clipped, valid ).2190 * @param pBox The box to copy (clipped, valid, except for guest's srcx, srcy, srcz). 2191 2191 * @param pContext The context (for OpenGL). 2192 2192 * @param rc The current rc for all boxes. … … 2244 2244 } 2245 2245 2246 uint32_t const u32GuestBlockX = pBox->srcx / pSurface->cxBlock; 2247 uint32_t const u32GuestBlockY = pBox->srcy / pSurface->cyBlock; 2248 Assert(u32GuestBlockX * pSurface->cxBlock == pBox->srcx); 2249 Assert(u32GuestBlockY * pSurface->cyBlock == pBox->srcy); 2250 uint32_t const cBlocksX = (pBox->w + pSurface->cxBlock - 1) / pSurface->cxBlock; 2251 uint32_t const cBlocksY = (pBox->h + pSurface->cyBlock - 1) / pSurface->cyBlock; 2252 AssertMsgReturn(cBlocksX && cBlocksY, ("Empty box %dx%d\n", pBox->w, pBox->h), VERR_INTERNAL_ERROR); 2253 2254 /* vmsvgaGMRTransfer verifies uGuestOffset. 2255 * srcx(u32GuestBlockX) and srcy(u32GuestBlockY) have been verified in vmsvga3dSurfaceDMA 2256 * to not cause 32 bit overflow when multiplied by cbBlock and cbGuestPitch. 2257 */ 2258 uint64_t const uGuestOffset = u32GuestBlockX * pSurface->cbBlock + u32GuestBlockY * cbGuestPitch; 2259 AssertReturn(uGuestOffset < UINT32_MAX, VERR_INVALID_PARAMETER); 2260 2246 2261 RECT Rect; 2247 2262 Rect.left = pBox->x; … … 2258 2273 Rect.left, Rect.top, Rect.right, Rect.bottom)); 2259 2274 2260 uint32_t u32BlockX = pBox->srcx / pSurface->cxBlock; 2261 uint32_t u32BlockY = pBox->srcy / pSurface->cyBlock; 2262 Assert(u32BlockX * pSurface->cxBlock == pBox->srcx); 2263 Assert(u32BlockY * pSurface->cyBlock == pBox->srcy); 2264 uint32_t cBlocksX = (pBox->w + pSurface->cxBlock - 1) / pSurface->cxBlock; 2265 uint32_t cBlocksY = (pBox->h + pSurface->cyBlock - 1) / pSurface->cyBlock; 2275 /* Prepare parameters for vmsvgaGMRTransfer, which needs the host buffer address, size 2276 * and offset of the first scanline. 2277 */ 2278 uint32_t const cbLockedBuf = RT_ABS(LockedRect.Pitch) * cBlocksY; 2279 uint8_t *pu8LockedBuf = (uint8_t *)LockedRect.pBits; 2280 if (LockedRect.Pitch < 0) 2281 pu8LockedBuf -= cbLockedBuf + LockedRect.Pitch; 2282 uint32_t const offLockedBuf = (uint32_t)((uintptr_t)LockedRect.pBits - (uintptr_t)pu8LockedBuf); 2266 2283 2267 2284 rc = vmsvgaGMRTransfer(pThis, 2268 2285 transfer, 2269 (uint8_t *)LockedRect.pBits, 2286 pu8LockedBuf, 2287 cbLockedBuf, 2288 offLockedBuf, 2270 2289 LockedRect.Pitch, 2271 2290 GuestPtr, 2272 u32BlockX * pSurface->cbBlock + u32BlockY * cbGuestPitch,2291 (uint32_t)uGuestOffset, 2273 2292 cbGuestPitch, 2274 2293 cBlocksX * pSurface->cbBlock, … … 2325 2344 Assert(pBox->y == 0 && pBox->h == 1 && pBox->z == 0 && pBox->d == 1); 2326 2345 2327 const uint32_t uHostOffset = pBox->x * pSurface->cbBlock; 2328 const uint32_t cbWidth = pBox->w * pSurface->cbBlock; 2329 2330 AssertReturn(uHostOffset < pMipLevel->cbSurface, VERR_INTERNAL_ERROR); 2331 AssertReturn(cbWidth <= pMipLevel->cbSurface, VERR_INTERNAL_ERROR); 2332 AssertReturn(uHostOffset <= pMipLevel->cbSurface - cbWidth, VERR_INTERNAL_ERROR); 2333 2334 uint8_t *pu8HostData = (uint8_t *)pMipLevel->pSurfaceData + uHostOffset; 2335 2336 const uint32_t uGuestOffset = pBox->srcx * pSurface->cbBlock; 2346 /* vmsvgaGMRTransfer verifies input parameters except for the host buffer addres and size. 2347 * srcx has been verified in vmsvga3dSurfaceDMA to not cause 32 bit overflow when multiplied by cbBlock. 2348 */ 2349 uint32_t const offHst = pBox->x * pSurface->cbBlock; 2350 uint32_t const cbWidth = pBox->w * pSurface->cbBlock; 2351 2352 uint32_t const offGst = pBox->srcx * pSurface->cbBlock; 2337 2353 2338 2354 /* Copy data between the guest and the host buffer. */ 2339 2355 rc = vmsvgaGMRTransfer(pThis, 2340 2356 transfer, 2341 pu8HostData, 2357 (uint8_t *)pMipLevel->pSurfaceData, 2358 pMipLevel->cbSurface, 2359 offHst, 2342 2360 pMipLevel->cbSurfacePitch, 2343 2361 GuestPtr, 2344 uGuestOffset,2362 offGst, 2345 2363 cbGuestPitch, 2346 2364 cbWidth, … … 2348 2366 AssertRC(rc); 2349 2367 2350 Log4(("Buffer first line:\n%.*Rhxd\n", cbWidth, pu8HostData));2368 Log4(("Buffer first line:\n%.*Rhxd\n", cbWidth, (uint8_t *)pMipLevel->pSurfaceData + uHostOffset)); 2351 2369 2352 2370 /* Do not bother to copy the data to the D3D resource now. vmsvga3dDrawPrimitives will do that. -
trunk/src/VBox/Devices/Graphics/DevVGA-SVGA3d.cpp
r69859 r73194 494 494 AssertRCReturn(rc, rc); 495 495 496 PVMSVGA3DCONTEXT pContext = NULL; 496 497 if (!VMSVGA3DSURFACE_HAS_HW_SURFACE(pSurface)) 497 498 { … … 501 502 */ 502 503 AssertReturn(pMipLevel->pSurfaceData, VERR_INTERNAL_ERROR); 503 504 for (uint32_t i = 0; i < cCopyBoxes; ++i) 505 { 506 Log(("Copy box (mem) %d (%d,%d,%d)(%d,%d,%d) dest (%d,%d)\n", 507 i, paBoxes[i].srcx, paBoxes[i].srcy, paBoxes[i].srcz, paBoxes[i].w, paBoxes[i].h, paBoxes[i].d, paBoxes[i].x, paBoxes[i].y)); 508 509 /* Apparently we're supposed to clip it (gmr test sample) */ 510 SVGA3dCopyBox clipBox = paBoxes[i]; 511 vmsvgaClipCopyBox(&pMipLevel->mipmapSize, &pMipLevel->mipmapSize, &clipBox); 512 if ( !clipBox.w 513 || !clipBox.h 514 || !clipBox.d) 515 { 516 Log(("Skip empty box\n")); 517 continue; 518 } 519 520 /* Calculate memory addresses of the image blocks for the transfer. */ 521 uint32_t u32HostBlockX; 522 uint32_t u32HostBlockY; 523 uint32_t u32GuestBlockX; 524 uint32_t u32GuestBlockY; 525 uint32_t cBlocksX; 526 uint32_t cBlocksY; 527 if (RT_LIKELY(pSurface->cxBlock == 1 && pSurface->cyBlock == 1)) 528 { 529 u32HostBlockX = clipBox.x; 530 u32HostBlockY = clipBox.y; 531 532 u32GuestBlockX = clipBox.srcx; 533 u32GuestBlockY = clipBox.srcy; 534 535 cBlocksX = clipBox.w; 536 cBlocksY = clipBox.h; 537 } 538 else 539 { 540 /* Pixels to blocks. */ 541 u32HostBlockX = clipBox.x / pSurface->cxBlock; 542 u32HostBlockY = clipBox.y / pSurface->cyBlock; 543 Assert(u32HostBlockX * pSurface->cxBlock == clipBox.x); 544 Assert(u32HostBlockY * pSurface->cyBlock == clipBox.y); 545 546 u32GuestBlockX = clipBox.srcx / pSurface->cxBlock; 547 u32GuestBlockY = clipBox.srcy / pSurface->cyBlock; 548 Assert(u32GuestBlockX * pSurface->cxBlock == clipBox.srcx); 549 Assert(u32GuestBlockY * pSurface->cyBlock == clipBox.srcy); 550 551 cBlocksX = (clipBox.w + pSurface->cxBlock - 1) / pSurface->cxBlock; 552 cBlocksY = (clipBox.h + pSurface->cyBlock - 1) / pSurface->cyBlock; 553 } 554 555 uint32_t cbGuestPitch; 556 if (guest.pitch == 0) 557 cbGuestPitch = cBlocksX * pSurface->cbBlock; 558 else 559 { 560 cbGuestPitch = guest.pitch; /* vmsvgaGMRTransfer will verify the value. */ 561 AssertReturn(cbGuestPitch <= SVGA3D_MAX_SURFACE_MEM_SIZE, VERR_INVALID_PARAMETER); 562 } 563 504 } 505 else 506 { 507 #ifdef VMSVGA3D_DIRECT3D 508 /* Flush the drawing pipeline for this surface as it could be used in a shared context. */ 509 vmsvga3dSurfaceFlush(pThis, pSurface); 510 511 #else /* VMSVGA3D_OPENGL */ 512 pContext = &pState->SharedCtx; 513 VMSVGA3D_SET_CURRENT_CONTEXT(pState, pContext); 514 #endif 515 } 516 517 /* SVGA_3D_CMD_SURFACE_DMA: 518 * "define the 'source' in each copyBox as the guest image and the 519 * 'destination' as the host image, regardless of transfer direction." 520 */ 521 for (uint32_t i = 0; i < cCopyBoxes; ++i) 522 { 523 Log(("Copy box (%s) %d (%d,%d,%d)(%d,%d,%d) dest (%d,%d)\n", 524 VMSVGA3DSURFACE_HAS_HW_SURFACE(pSurface) ? "hw" : "mem", 525 i, paBoxes[i].srcx, paBoxes[i].srcy, paBoxes[i].srcz, paBoxes[i].w, paBoxes[i].h, paBoxes[i].d, paBoxes[i].x, paBoxes[i].y)); 526 527 /* Apparently we're supposed to clip it (gmr test sample) */ 528 529 /* The copybox's "dest" is coords in the host surface. Verify them against the surface's mipmap size. */ 530 SVGA3dBox hostBox; 531 hostBox.x = paBoxes[i].x; 532 hostBox.y = paBoxes[i].y; 533 hostBox.z = paBoxes[i].z; 534 hostBox.w = paBoxes[i].w; 535 hostBox.h = paBoxes[i].h; 536 hostBox.d = paBoxes[i].d; 537 vmsvgaClipBox(&pMipLevel->mipmapSize, &hostBox); 538 539 if ( !hostBox.w 540 || !hostBox.h 541 || !hostBox.d) 542 { 543 Log(("Skip empty box\n")); 544 continue; 545 } 546 RT_UNTRUSTED_VALIDATED_FENCE(); 547 548 /* Adjust the guest, i.e. "src", point. 549 * Do not try to verify them here because vmsvgaGMRTransfer takes care of this. 550 */ 551 uint32_t const srcx = paBoxes[i].srcx + (hostBox.x - paBoxes[i].x); 552 uint32_t const srcy = paBoxes[i].srcy + (hostBox.y - paBoxes[i].y); 553 uint32_t const srcz = paBoxes[i].srcz + (hostBox.z - paBoxes[i].z); 554 555 /* Calculate offsets of the image blocks for the transfer. */ 556 uint32_t u32HostBlockX; 557 uint32_t u32HostBlockY; 558 uint32_t u32GuestBlockX; 559 uint32_t u32GuestBlockY; 560 uint32_t cBlocksX; 561 uint32_t cBlocksY; 562 if (RT_LIKELY(pSurface->cxBlock == 1 && pSurface->cyBlock == 1)) 563 { 564 u32HostBlockX = hostBox.x; 565 u32HostBlockY = hostBox.y; 566 567 u32GuestBlockX = srcx; 568 u32GuestBlockY = srcy; 569 570 cBlocksX = hostBox.w; 571 cBlocksY = hostBox.h; 572 } 573 else 574 { 575 /* Pixels to blocks. */ 576 u32HostBlockX = hostBox.x / pSurface->cxBlock; 577 u32HostBlockY = hostBox.y / pSurface->cyBlock; 578 Assert(u32HostBlockX * pSurface->cxBlock == hostBox.x); 579 Assert(u32HostBlockY * pSurface->cyBlock == hostBox.y); 580 581 u32GuestBlockX = srcx / pSurface->cxBlock; 582 u32GuestBlockY = srcy / pSurface->cyBlock; 583 Assert(u32GuestBlockX * pSurface->cxBlock == srcx); 584 Assert(u32GuestBlockY * pSurface->cyBlock == srcy); 585 586 cBlocksX = (hostBox.w + pSurface->cxBlock - 1) / pSurface->cxBlock; 587 cBlocksY = (hostBox.h + pSurface->cyBlock - 1) / pSurface->cyBlock; 588 } 589 590 uint32_t cbGuestPitch = guest.pitch; 591 if (cbGuestPitch == 0) 592 cbGuestPitch = cBlocksX * pSurface->cbBlock; /* Have to calculate. */ 593 else 594 { 595 /* vmsvgaGMRTransfer will verify the value, just check it is sane. */ 596 AssertReturn(cbGuestPitch <= SVGA3D_MAX_SURFACE_MEM_SIZE, VERR_INVALID_PARAMETER); 597 RT_UNTRUSTED_VALIDATED_FENCE(); 598 } 599 600 /* srcx, srcy and srcz values are used to calculate the guest offset. 601 * The offset will be verified by vmsvgaGMRTransfer, so just check for overflows here. 602 */ 603 AssertReturn(srcz < UINT32_MAX / pMipLevel->mipmapSize.height / cbGuestPitch, VERR_INVALID_PARAMETER); 604 AssertReturn(u32GuestBlockY < UINT32_MAX / cbGuestPitch, VERR_INVALID_PARAMETER); 605 AssertReturn(u32GuestBlockX < UINT32_MAX / pSurface->cbBlock, VERR_INVALID_PARAMETER); 606 RT_UNTRUSTED_VALIDATED_FENCE(); 607 608 if (!VMSVGA3DSURFACE_HAS_HW_SURFACE(pSurface)) 609 { 564 610 uint64_t uGuestOffset = u32GuestBlockX * pSurface->cbBlock + 565 611 u32GuestBlockY * cbGuestPitch + 566 clipBox.srcz * pMipLevel->mipmapSize.height * cbGuestPitch;612 srcz * pMipLevel->mipmapSize.height * cbGuestPitch; 567 613 AssertReturn(uGuestOffset < UINT32_MAX, VERR_INVALID_PARAMETER); 568 614 … … 570 616 uint32_t uHostOffset = u32HostBlockX * pSurface->cbBlock + 571 617 u32HostBlockY * pMipLevel->cbSurfacePitch + 572 clipBox.z * pMipLevel->cbSurfacePlane;618 hostBox.z * pMipLevel->cbSurfacePlane; 573 619 AssertReturn(uHostOffset < pMipLevel->cbSurface, VERR_INTERNAL_ERROR); 574 620 575 for (uint32_t z = 0; z < clipBox.d; ++z)621 for (uint32_t z = 0; z < hostBox.d; ++z) 576 622 { 577 623 rc = vmsvgaGMRTransfer(pThis, 578 624 transfer, 579 (uint8_t *)pMipLevel->pSurfaceData + uHostOffset, 625 (uint8_t *)pMipLevel->pSurfaceData, 626 pMipLevel->cbSurface, 627 uHostOffset, 580 628 (int32_t)pMipLevel->cbSurfacePitch, 581 629 guest.ptr, … … 591 639 uHostOffset += pMipLevel->cbSurfacePlane; 592 640 uGuestOffset += pMipLevel->mipmapSize.height * cbGuestPitch; 641 AssertReturn(uGuestOffset < UINT32_MAX, VERR_INVALID_PARAMETER); 593 642 } 594 643 } 595 596 pMipLevel->fDirty = true; 597 pSurface->fDirty = true; 598 } 599 else 600 { 601 /* 602 * Because of the clipping below, we're doing a little more 603 * here before calling the backend specific code. 604 */ 605 #ifdef VMSVGA3D_DIRECT3D 606 /* Flush the drawing pipeline for this surface as it could be used in a shared context. */ 607 vmsvga3dSurfaceFlush(pThis, pSurface); 608 PVMSVGA3DCONTEXT pContext = NULL; 609 610 #else /* VMSVGA3D_OPENGL */ 611 PVMSVGA3DCONTEXT pContext = &pState->SharedCtx; 612 VMSVGA3D_SET_CURRENT_CONTEXT(pState, pContext); 613 #endif 614 615 for (uint32_t i = 0; i < cCopyBoxes; ++i) 616 { 617 /** @todo Identical code to the above no-hw branch. Think about merging. */ 618 Log(("Copy box (hw) %d (%d,%d,%d)(%d,%d,%d) dest (%d,%d)\n", 619 i, paBoxes[i].srcx, paBoxes[i].srcy, paBoxes[i].srcz, paBoxes[i].w, paBoxes[i].h, paBoxes[i].d, paBoxes[i].x, paBoxes[i].y)); 620 621 /* Apparently we're supposed to clip it (gmr test sample) */ 622 SVGA3dCopyBox clipBox = paBoxes[i]; 623 vmsvgaClipCopyBox(&pMipLevel->mipmapSize, &pMipLevel->mipmapSize, &clipBox); 624 if ( !clipBox.w 625 || !clipBox.h 626 || !clipBox.d) 627 { 628 Log(("Skip empty box\n")); 629 continue; 630 } 631 632 /* Calculate memory addresses of the image blocks for the transfer. */ 633 uint32_t u32HostBlockX; 634 uint32_t u32HostBlockY; 635 uint32_t u32GuestBlockX; 636 uint32_t u32GuestBlockY; 637 uint32_t cBlocksX; 638 uint32_t cBlocksY; 639 if (RT_LIKELY(pSurface->cxBlock == 1 && pSurface->cyBlock == 1)) 640 { 641 u32HostBlockX = clipBox.x; 642 u32HostBlockY = clipBox.y; 643 644 u32GuestBlockX = clipBox.srcx; 645 u32GuestBlockY = clipBox.srcy; 646 647 cBlocksX = clipBox.w; 648 cBlocksY = clipBox.h; 649 } 650 else 651 { 652 /* Pixels to blocks. */ 653 u32HostBlockX = clipBox.x / pSurface->cxBlock; 654 u32HostBlockY = clipBox.y / pSurface->cyBlock; 655 Assert(u32HostBlockX * pSurface->cxBlock == clipBox.x); 656 Assert(u32HostBlockY * pSurface->cyBlock == clipBox.y); 657 658 u32GuestBlockX = clipBox.srcx / pSurface->cxBlock; 659 u32GuestBlockY = clipBox.srcy / pSurface->cyBlock; 660 Assert(u32GuestBlockX * pSurface->cxBlock == clipBox.srcx); 661 Assert(u32GuestBlockY * pSurface->cyBlock == clipBox.srcy); 662 663 cBlocksX = (clipBox.w + pSurface->cxBlock - 1) / pSurface->cxBlock; 664 cBlocksY = (clipBox.h + pSurface->cyBlock - 1) / pSurface->cyBlock; 665 } 666 667 uint32_t cbGuestPitch; 668 if (guest.pitch == 0) 669 cbGuestPitch = cBlocksX * pSurface->cbBlock; 670 else 671 { 672 cbGuestPitch = guest.pitch; /* vmsvgaGMRTransfer will verify the value. */ 673 AssertReturn(cbGuestPitch <= SVGA3D_MAX_SURFACE_MEM_SIZE, VERR_INVALID_PARAMETER); 674 } 675 644 else 645 { 646 SVGA3dCopyBox clipBox; 647 clipBox.x = hostBox.x; 648 clipBox.y = hostBox.y; 649 clipBox.z = hostBox.z; 650 clipBox.w = hostBox.w; 651 clipBox.h = hostBox.h; 652 clipBox.d = hostBox.d; 653 clipBox.srcx = srcx; 654 clipBox.srcy = srcy; 655 clipBox.srcz = srcz; 676 656 rc = vmsvga3dBackSurfaceDMACopyBox(pThis, pState, pSurface, pMipLevel, host.face, host.mipmap, 677 657 guest.ptr, cbGuestPitch, transfer, … … 679 659 AssertRC(rc); 680 660 } 661 } 662 663 if (!VMSVGA3DSURFACE_HAS_HW_SURFACE(pSurface)) 664 { 665 pMipLevel->fDirty = true; 666 pSurface->fDirty = true; 681 667 } 682 668 … … 691 677 queryResult.result32 = u32Result; 692 678 693 int rc = vmsvgaGMRTransfer(pThis, SVGA3D_READ_HOST_VRAM, (uint8_t *)&queryResult, sizeof(queryResult), 679 int rc = vmsvgaGMRTransfer(pThis, SVGA3D_READ_HOST_VRAM, 680 (uint8_t *)&queryResult, sizeof(queryResult), 0, sizeof(queryResult), 694 681 guestResult, 0, sizeof(queryResult), sizeof(queryResult), 1); 695 682 AssertRC(rc); -
trunk/src/VBox/Devices/Graphics/DevVGA-SVGA3d.h
r73004 r73194 51 51 /* DevVGA-SVGA.cpp: */ 52 52 void vmsvgaGMRFree(PVGASTATE pThis, uint32_t idGMR); 53 int vmsvgaGMRTransfer(PVGASTATE pThis, const SVGA3dTransferType enmTransferType, uint8_t *pbHst, int32_t cbHstPitch, 54 SVGAGuestPtr gstPtr, uint32_t offGst, int32_t cbGstPitch, uint32_t cbWidth, uint32_t cHeight); 53 int vmsvgaGMRTransfer(PVGASTATE pThis, const SVGA3dTransferType enmTransferType, 54 uint8_t *pbHstBuf, uint32_t cbHstBuf, uint32_t offHst, int32_t cbHstPitch, 55 SVGAGuestPtr gstPtr, uint32_t offGst, int32_t cbGstPitch, 56 uint32_t cbWidth, uint32_t cHeight); 55 57 void vmsvga3dSurfaceUpdateHeapBuffersOnFifoThread(PVGASTATE pThis, uint32_t sid); 56 58 … … 123 125 void vmsvga3dInfoSurfaceWorker(PVGASTATE pThis, PCDBGFINFOHLP pHlp, uint32_t sid, bool fVerbose, uint32_t cxAscii, bool fInvY, const char *pszBitmapPath); 124 126 127 void vmsvgaClipRect(SVGASignedRect const *pBound, 128 SVGASignedRect *pRect); 125 129 126 130 /* DevVGA-SVGA3d-shared.cpp: */
Note:
See TracChangeset
for help on using the changeset viewer.