Opened 22 months ago
Last modified 21 months ago
#21326 new defect
DirectX 9 image wrong offset in win7 guest
| Reported by: | pv32768 | Owned by: | |
|---|---|---|---|
| Component: | 3D support | Version: | VirtualBox-7.0.4 |
| Keywords: | Cc: | ||
| Guest type: | Windows | Host type: | all |
Description
The few DX-9 applications that still run in a Windows 7 guest look like this:
VirtualBox 7.0.4, 3D Acceleration on
Host: Gentoo Linux
Guest: Windows 7
Application: DirectX 9.0 SDK, Tutorial 02
Fix:
diff -Naur a/src/VBox/Devices/Graphics/DevVGA-SVGA3d.cpp b/src/VBox/Devices/Graphics/DevVGA-SVGA3d.cpp
--- a/src/VBox/Devices/Graphics/DevVGA-SVGA3d.cpp 2022-11-17 22:12:55.000000000 +0300
+++ b/src/VBox/Devices/Graphics/DevVGA-SVGA3d.cpp 2022-12-05 16:06:25.417632425 +0300
@@ -1093,6 +1093,8 @@
VMSVGASCREENOBJECT *pScreen = &pSvgaR3State->aScreens[idDstScreen];
+ uint32_t const cbScreenPixel = RT_ALIGN(pScreen->cBpp, 8) / 8;
+
if ( srcRect.right <= srcRect.left
|| srcRect.bottom <= srcRect.top)
return VINF_SUCCESS; /* Empty src rect. */
@@ -1186,6 +1188,8 @@
+ ((box.x + pSurface->cxBlock - 1) / pSurface->cxBlock) * pSurface->cxBlock * pSurface->cbBlock
+ ((box.y + pSurface->cyBlock - 1) / pSurface->cyBlock) * pSurface->cyBlock * srcMap.cbRowPitch;
+ uint32_t const offDstBox = (dstBox.x + box.x) * cbScreenPixel + (dstBox.y + box.y) * pScreen->cbPitch;
+
/* The 'box' is actually in the destination coordinates relative to the top-left corner of destRect.
* Therefore it is relative to the top-left corner of srcRect as well.
*/
@@ -1198,11 +1202,11 @@
{
AssertContinue(srcDims.cyBlocks > 0);
- ASSERT_GUEST_BREAK( srcDims.offBox <= cbDst
- && pScreen->cbPitch * (srcDims.cyBlocks - 1) + srcDims.cbRow <= cbDst - srcDims.offBox);
+ ASSERT_GUEST_BREAK( offDstBox <= cbDst
+ && pScreen->cbPitch * (srcDims.cyBlocks - 1) + srcDims.cbRow <= cbDst - offDstBox);
RT_UNTRUSTED_VALIDATED_FENCE();
- uint8_t *pu8DstBox = pu8Dst + srcDims.offBox;
+ uint8_t *pu8DstBox = pu8Dst + offDstBox;
if ( pSurface->format == SVGA3D_R8G8B8A8_UNORM
|| pSurface->format == SVGA3D_R8G8B8A8_UNORM_SRGB)
Attachments (3)
Change History (5)
by , 22 months ago
by , 22 months ago
| Attachment: | Untitlet.png added |
|---|
by , 22 months ago
| Attachment: | Untitled.png added |
|---|
comment:2 by , 21 months ago
Hello.
Some more testing revealed that the issue is
- always reproduces in Windows 7 guest
- not observed on Windows 10 guest
This is a serious bug.
Note:
See TracTickets
for help on using tickets.



Hello. Thank you for the ticket and your patch. Could you attach VBox.log here (to be more specific)?