Changeset 47151 in vbox for trunk/src/VBox
- Timestamp:
- Jul 15, 2013 10:47:42 AM (12 years ago)
- svn:sync-xref-src-repo-rev:
- 87253
- Location:
- trunk/src/VBox/Additions
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Additions/WINNT/Graphics/Video/mp/wddm/VBoxMPVdma.cpp
r47070 r47151 1182 1182 vboxVdmaBltDirtyRectsUpdate(pDevExt, pSource, pBlt->Blt.DstRects.UpdateRects.cRects, pBlt->Blt.DstRects.UpdateRects.aRects); 1183 1183 1184 if (pSrcAlloc->AllocData.hostID || pSource->fHas3DVrs)1184 if (pSrcAlloc->AllocData.hostID || (pDevExt->fTexPresentEnabled ? pSource->fHas3DVrs : !!pDevExt->cContexts3D)) 1185 1185 { 1186 1186 Status = vboxVdmaProcessVRegCmd(pDevExt, pContext, &pBlt->Blt.SrcAlloc, &pBlt->Blt.DstAlloc, &pBlt->Blt.SrcRect, &pBlt->Blt.DstRects); -
trunk/src/VBox/Additions/WINNT/Graphics/Video/mp/wddm/VBoxMPWddm.cpp
r47070 r47151 3020 3020 vboxWddmAddrSetVram(&pSrcAlloc->AllocData.Addr, pBlt->Blt.SrcAlloc.segmentIdAlloc, pBlt->Blt.SrcAlloc.offAlloc); 3021 3021 3022 if (pDstAlloc->bAssigned && 3023 (pDstAlloc->enmType == VBOXWDDM_ALLOC_TYPE_STD_SHAREDPRIMARYSURFACE 3024 || pDstAlloc->enmType == VBOXWDDM_CONTEXT_TYPE_CUSTOM_3D) 3025 ) 3022 if (VBOXWDDM_IS_REAL_FB_ALLOCATION(pDevExt, pDstAlloc)) 3026 3023 { 3027 3024 VBOXWDDM_SOURCE *pSource = &pDevExt->aSources[pDstAlloc->AllocData.SurfDesc.VidPnSourceId]; … … 5451 5448 DXGK_ALLOCATIONLIST *pDst = &pPresent->pAllocationList[DXGK_PRESENT_DESTINATION_INDEX]; 5452 5449 PVBOXWDDM_ALLOCATION pSrcAlloc = vboxWddmGetAllocationFromAllocList(pDevExt, pSrc); 5453 Assert(pSrcAlloc); 5454 if (pSrcAlloc) 5455 { 5456 PVBOXWDDM_ALLOCATION pDstAlloc = vboxWddmGetAllocationFromAllocList(pDevExt, pDst); 5457 Assert(pDstAlloc); 5458 if (pDstAlloc) 5459 { 5460 PVBOXWDDM_SOURCE pSource = &pDevExt->aSources[pDstAlloc->AllocData.SurfDesc.VidPnSourceId]; 5461 do 5462 { 5463 #ifdef VBOXWDDM_RENDER_FROM_SHADOW 5464 #if 0 5465 Assert (pSrcAlloc->enmType == VBOXWDDM_ALLOC_TYPE_STD_SHADOWSURFACE); 5466 Assert (pDstAlloc->enmType == VBOXWDDM_ALLOC_TYPE_STD_SHAREDPRIMARYSURFACE); 5467 #else 5468 if (pContext->enmType == VBOXWDDM_CONTEXT_TYPE_SYSTEM) 5469 { 5470 Assert ((pSrcAlloc->enmType == VBOXWDDM_ALLOC_TYPE_STD_SHADOWSURFACE 5471 && pDstAlloc->enmType == VBOXWDDM_ALLOC_TYPE_STD_SHAREDPRIMARYSURFACE) 5472 || (pSrcAlloc->enmType == VBOXWDDM_ALLOC_TYPE_STD_SHAREDPRIMARYSURFACE 5473 && pDstAlloc->enmType == VBOXWDDM_ALLOC_TYPE_STD_SHADOWSURFACE)); 5474 } 5475 #endif 5476 /* issue VBOXWDDM_ALLOC_TYPE_STD_SHADOWSURFACE ONLY in case there are no 3D Visible Regions currently 5477 * otherwise we would need info about all rects being updated on primary for visible rect reporting */ 5478 if (!cContexts2D && !pSource->fHas3DVrs) 5479 { 5480 if (pDstAlloc->enmType == VBOXWDDM_ALLOC_TYPE_STD_SHAREDPRIMARYSURFACE 5481 && pSrcAlloc->enmType == VBOXWDDM_ALLOC_TYPE_STD_SHADOWSURFACE) 5482 { 5483 Assert(pContext->enmType == VBOXWDDM_CONTEXT_TYPE_SYSTEM); 5484 Assert(pDstAlloc->bAssigned); 5485 if (pDstAlloc->bAssigned) 5486 { 5487 #ifdef VBOX_WITH_VIDEOHWACCEL 5488 // if (vboxVhwaHlpOverlayListIsEmpty(pDevExt, pDstAlloc->AllocData.SurfDesc.VidPnSourceId)) 5489 #endif 5490 { 5491 Assert(pPresent->DmaBufferPrivateDataSize >= sizeof (VBOXWDDM_DMA_PRIVATEDATA_SHADOW2PRIMARY)); 5492 if (pPresent->DmaBufferPrivateDataSize >= sizeof (VBOXWDDM_DMA_PRIVATEDATA_SHADOW2PRIMARY)) 5493 { 5494 Assert(pPresent->SrcRect.left == pPresent->DstRect.left); 5495 Assert(pPresent->SrcRect.right == pPresent->DstRect.right); 5496 Assert(pPresent->SrcRect.top == pPresent->DstRect.top); 5497 Assert(pPresent->SrcRect.bottom == pPresent->DstRect.bottom); 5498 RECT rect; 5499 if (pPresent->SubRectCnt) 5500 { 5501 rect = pPresent->pDstSubRects[0]; 5502 for (UINT i = 1; i < pPresent->SubRectCnt; ++i) 5503 { 5504 vboxWddmRectUnited(&rect, &rect, &pPresent->pDstSubRects[i]); 5505 } 5506 } 5507 else 5508 rect = pPresent->SrcRect; 5509 5510 5511 pPresent->pDmaBufferPrivateData = (uint8_t*)pPresent->pDmaBufferPrivateData + sizeof (VBOXWDDM_DMA_PRIVATEDATA_SHADOW2PRIMARY); 5512 pPresent->pDmaBuffer = ((uint8_t*)pPresent->pDmaBuffer) + VBOXWDDM_DUMMY_DMABUFFER_SIZE; 5513 Assert(pPresent->DmaSize >= VBOXWDDM_DUMMY_DMABUFFER_SIZE); 5514 memset(pPresent->pPatchLocationListOut, 0, 2*sizeof (D3DDDI_PATCHLOCATIONLIST)); 5515 pPresent->pPatchLocationListOut->PatchOffset = 0; 5516 pPresent->pPatchLocationListOut->AllocationIndex = DXGK_PRESENT_SOURCE_INDEX; 5517 ++pPresent->pPatchLocationListOut; 5518 pPresent->pPatchLocationListOut->PatchOffset = 4; 5519 pPresent->pPatchLocationListOut->AllocationIndex = DXGK_PRESENT_DESTINATION_INDEX; 5520 ++pPresent->pPatchLocationListOut; 5521 5522 pPrivateData->BaseHdr.enmCmd = VBOXVDMACMD_TYPE_DMA_PRESENT_SHADOW2PRIMARY; 5523 PVBOXWDDM_DMA_PRIVATEDATA_SHADOW2PRIMARY pS2P = (PVBOXWDDM_DMA_PRIVATEDATA_SHADOW2PRIMARY)pPrivateData; 5524 /* we do not know the shadow address yet, perform dummy DMA cycle */ 5525 vboxWddmPopulateDmaAllocInfo(&pS2P->Shadow2Primary.ShadowAlloc, pSrcAlloc, pSrc); 5526 // vboxWddmPopulateDmaAllocInfo(&pPrivateData->DstAllocInfo, pDstAlloc, pDst); 5527 pS2P->Shadow2Primary.SrcRect = rect; 5528 pS2P->Shadow2Primary.VidPnSourceId = pDstAlloc->AllocData.SurfDesc.VidPnSourceId; 5529 break; 5530 } 5531 else 5532 { 5533 Status = STATUS_GRAPHICS_INSUFFICIENT_DMA_BUFFER; 5534 break; 5535 } 5536 } 5537 } 5538 } 5539 } 5540 5541 /* we're here because this is NOT a shadow->primary update 5542 * or because there are d3d contexts and we need to report visible rects 5543 * or because we have overlays active and we need a special handling for primary */ 5544 #endif 5545 UINT cbCmd = pPresent->DmaBufferPrivateDataSize; 5546 pPrivateData->BaseHdr.enmCmd = VBOXVDMACMD_TYPE_DMA_PRESENT_BLT; 5547 5548 PVBOXWDDM_DMA_PRIVATEDATA_BLT pBlt = (PVBOXWDDM_DMA_PRIVATEDATA_BLT)pPrivateData; 5549 5550 vboxWddmPopulateDmaAllocInfo(&pBlt->Blt.SrcAlloc, pSrcAlloc, pSrc); 5551 vboxWddmPopulateDmaAllocInfo(&pBlt->Blt.DstAlloc, pDstAlloc, pDst); 5552 5553 ASSERT_WARN(!pSrcAlloc->fRcFlags.SharedResource, ("Shared Allocatoin used in Present!")); 5554 5555 pBlt->Blt.SrcRect = pPresent->SrcRect; 5556 pBlt->Blt.DstRects.ContextRect = pPresent->DstRect; 5557 pBlt->Blt.DstRects.UpdateRects.cRects = 0; 5558 UINT cbHead = RT_OFFSETOF(VBOXWDDM_DMA_PRIVATEDATA_BLT, Blt.DstRects.UpdateRects.aRects[0]); 5559 Assert(pPresent->SubRectCnt > pPresent->MultipassOffset); 5560 UINT cbRects = (pPresent->SubRectCnt - pPresent->MultipassOffset) * sizeof (RECT); 5561 pPresent->pDmaBufferPrivateData = (uint8_t*)pPresent->pDmaBufferPrivateData + cbHead + cbRects; 5562 pPresent->pDmaBuffer = ((uint8_t*)pPresent->pDmaBuffer) + VBOXWDDM_DUMMY_DMABUFFER_SIZE; 5563 Assert(pPresent->DmaSize >= VBOXWDDM_DUMMY_DMABUFFER_SIZE); 5564 cbCmd -= cbHead; 5565 Assert(cbCmd < UINT32_MAX/2); 5566 Assert(cbCmd > sizeof (RECT)); 5567 if (cbCmd >= cbRects) 5568 { 5569 cbCmd -= cbRects; 5570 memcpy(&pBlt->Blt.DstRects.UpdateRects.aRects[pPresent->MultipassOffset], &pPresent->pDstSubRects[pPresent->MultipassOffset], cbRects); 5571 pBlt->Blt.DstRects.UpdateRects.cRects += cbRects/sizeof (RECT); 5572 } 5573 else 5574 { 5575 UINT cbFitingRects = (cbCmd/sizeof (RECT)) * sizeof (RECT); 5576 Assert(cbFitingRects); 5577 memcpy(&pBlt->Blt.DstRects.UpdateRects.aRects[pPresent->MultipassOffset], &pPresent->pDstSubRects[pPresent->MultipassOffset], cbFitingRects); 5578 cbCmd -= cbFitingRects; 5579 pPresent->MultipassOffset += cbFitingRects/sizeof (RECT); 5580 pBlt->Blt.DstRects.UpdateRects.cRects += cbFitingRects/sizeof (RECT); 5581 Assert(pPresent->SubRectCnt > pPresent->MultipassOffset); 5582 Status = STATUS_GRAPHICS_INSUFFICIENT_DMA_BUFFER; 5583 } 5584 5585 memset(pPresent->pPatchLocationListOut, 0, 2*sizeof (D3DDDI_PATCHLOCATIONLIST)); 5586 pPresent->pPatchLocationListOut->PatchOffset = 0; 5587 pPresent->pPatchLocationListOut->AllocationIndex = DXGK_PRESENT_SOURCE_INDEX; 5588 ++pPresent->pPatchLocationListOut; 5589 pPresent->pPatchLocationListOut->PatchOffset = 4; 5590 pPresent->pPatchLocationListOut->AllocationIndex = DXGK_PRESENT_DESTINATION_INDEX; 5591 ++pPresent->pPatchLocationListOut; 5592 5593 break; 5594 #ifdef VBOX_WITH_VDMA 5595 cbCmd = pPresent->DmaSize; 5596 5597 Assert(pPresent->SubRectCnt); 5598 UINT cmdSize = VBOXVDMACMD_DMA_PRESENT_BLT_SIZE(pPresent->SubRectCnt - pPresent->MultipassOffset); 5599 PVBOXVDMACMD pCmd = (PVBOXVDMACMD)pPresent->pDmaBuffer; 5600 pPresent->pDmaBuffer = ((uint8_t*)pPresent->pDmaBuffer) + cmdSize; 5601 Assert(cbCmd >= VBOXVDMACMD_DMA_PRESENT_BLT_MINSIZE()); 5602 if (cbCmd >= VBOXVDMACMD_DMA_PRESENT_BLT_MINSIZE()) 5603 { 5604 if (vboxWddmPixFormatConversionSupported(pSrcAlloc->AllocData.SurfDesc.format, pDstAlloc->AllocData.SurfDesc.format)) 5605 { 5606 memset(pPresent->pPatchLocationListOut, 0, 2*sizeof (D3DDDI_PATCHLOCATIONLIST)); 5607 // pPresent->pPatchLocationListOut->PatchOffset = 0; 5608 // ++pPresent->pPatchLocationListOut; 5609 pPresent->pPatchLocationListOut->PatchOffset = VBOXVDMACMD_BODY_FIELD_OFFSET(UINT, VBOXVDMACMD_DMA_PRESENT_BLT, offSrc); 5610 pPresent->pPatchLocationListOut->AllocationIndex = DXGK_PRESENT_SOURCE_INDEX; 5611 ++pPresent->pPatchLocationListOut; 5612 pPresent->pPatchLocationListOut->PatchOffset = VBOXVDMACMD_BODY_FIELD_OFFSET(UINT, VBOXVDMACMD_DMA_PRESENT_BLT, offDst); 5613 pPresent->pPatchLocationListOut->AllocationIndex = DXGK_PRESENT_DESTINATION_INDEX; 5614 ++pPresent->pPatchLocationListOut; 5615 5616 pCmd->enmType = VBOXVDMACMD_TYPE_DMA_PRESENT_BLT; 5617 pCmd->u32CmdSpecific = 0; 5618 PVBOXVDMACMD_DMA_PRESENT_BLT pTransfer = VBOXVDMACMD_BODY(pCmd, VBOXVDMACMD_DMA_PRESENT_BLT); 5619 pTransfer->offSrc = (VBOXVIDEOOFFSET)pSrc->PhysicalAddress.QuadPart; 5620 pTransfer->offDst = (VBOXVIDEOOFFSET)pDst->PhysicalAddress.QuadPart; 5621 vboxWddmSurfDescFromAllocation(pSrcAlloc, &pTransfer->srcDesc); 5622 vboxWddmSurfDescFromAllocation(pDstAlloc, &pTransfer->dstDesc); 5623 vboxWddmRectlFromRect(&pPresent->SrcRect, &pTransfer->srcRectl); 5624 vboxWddmRectlFromRect(&pPresent->DstRect, &pTransfer->dstRectl); 5625 UINT i = 0; 5626 cbCmd -= VBOXVDMACMD_BODY_FIELD_OFFSET(UINT, VBOXVDMACMD_DMA_PRESENT_BLT, aDstSubRects); 5627 Assert(cbCmd >= sizeof (VBOXVDMA_RECTL)); 5628 Assert(cbCmd < pPresent->DmaSize); 5629 for (; i < pPresent->SubRectCnt; ++i) 5630 { 5631 if (cbCmd < sizeof (VBOXVDMA_RECTL)) 5632 { 5633 Assert(i); 5634 pPresent->MultipassOffset += i; 5635 Status = STATUS_GRAPHICS_INSUFFICIENT_DMA_BUFFER; 5636 break; 5637 } 5638 vboxWddmRectlFromRect(&pPresent->pDstSubRects[i + pPresent->MultipassOffset], &pTransfer->aDstSubRects[i]); 5639 cbCmd -= sizeof (VBOXVDMA_RECTL); 5640 } 5641 Assert(i); 5642 pPrivateData->BaseHdr.enmCmd = VBOXVDMACMD_TYPE_DMA_PRESENT_BLT; 5643 pTransfer->cDstSubRects = i; 5644 pPresent->pDmaBufferPrivateData = (uint8_t*)pPresent->pDmaBufferPrivateData + sizeof(VBOXWDDM_DMA_PRIVATEDATA_PRESENTHDR); 5645 } 5646 else 5647 { 5648 AssertBreakpoint(); 5649 LOGREL(("unsupported format conversion from(%d) to (%d)",pSrcAlloc->AllocData.SurfDesc.format, pDstAlloc->AllocData.SurfDesc.format)); 5650 Status = STATUS_GRAPHICS_CANNOTCOLORCONVERT; 5651 } 5652 } 5653 else 5654 { 5655 /* this should not happen actually */ 5656 LOGREL(("cbCmd too small!! (%d)", cbCmd)); 5657 Status = STATUS_GRAPHICS_INSUFFICIENT_DMA_BUFFER; 5658 } 5659 #endif 5660 } while(0); 5661 } 5662 else 5663 { 5664 /* this should not happen actually */ 5665 LOGREL(("failed to get Dst Allocation info for hDeviceSpecificAllocation(0x%x)",pDst->hDeviceSpecificAllocation)); 5666 Status = STATUS_INVALID_HANDLE; 5667 } 5450 if (!pSrcAlloc) 5451 { 5452 /* this should not happen actually */ 5453 WARN(("failed to get Src Allocation info for hDeviceSpecificAllocation(0x%x)",pSrc->hDeviceSpecificAllocation)); 5454 Status = STATUS_INVALID_HANDLE; 5455 goto done; 5456 } 5457 5458 PVBOXWDDM_ALLOCATION pDstAlloc = vboxWddmGetAllocationFromAllocList(pDevExt, pDst); 5459 if (!pDstAlloc) 5460 { 5461 /* this should not happen actually */ 5462 WARN(("failed to get Dst Allocation info for hDeviceSpecificAllocation(0x%x)",pDst->hDeviceSpecificAllocation)); 5463 Status = STATUS_INVALID_HANDLE; 5464 goto done; 5465 } 5466 5467 5468 UINT cbCmd = pPresent->DmaBufferPrivateDataSize; 5469 pPrivateData->BaseHdr.enmCmd = VBOXVDMACMD_TYPE_DMA_PRESENT_BLT; 5470 5471 PVBOXWDDM_DMA_PRIVATEDATA_BLT pBlt = (PVBOXWDDM_DMA_PRIVATEDATA_BLT)pPrivateData; 5472 5473 vboxWddmPopulateDmaAllocInfo(&pBlt->Blt.SrcAlloc, pSrcAlloc, pSrc); 5474 vboxWddmPopulateDmaAllocInfo(&pBlt->Blt.DstAlloc, pDstAlloc, pDst); 5475 5476 ASSERT_WARN(!pSrcAlloc->fRcFlags.SharedResource, ("Shared Allocatoin used in Present!")); 5477 5478 pBlt->Blt.SrcRect = pPresent->SrcRect; 5479 pBlt->Blt.DstRects.ContextRect = pPresent->DstRect; 5480 pBlt->Blt.DstRects.UpdateRects.cRects = 0; 5481 UINT cbHead = RT_OFFSETOF(VBOXWDDM_DMA_PRIVATEDATA_BLT, Blt.DstRects.UpdateRects.aRects[0]); 5482 Assert(pPresent->SubRectCnt > pPresent->MultipassOffset); 5483 UINT cbRects = (pPresent->SubRectCnt - pPresent->MultipassOffset) * sizeof (RECT); 5484 pPresent->pDmaBufferPrivateData = (uint8_t*)pPresent->pDmaBufferPrivateData + cbHead + cbRects; 5485 pPresent->pDmaBuffer = ((uint8_t*)pPresent->pDmaBuffer) + VBOXWDDM_DUMMY_DMABUFFER_SIZE; 5486 Assert(pPresent->DmaSize >= VBOXWDDM_DUMMY_DMABUFFER_SIZE); 5487 cbCmd -= cbHead; 5488 Assert(cbCmd < UINT32_MAX/2); 5489 Assert(cbCmd > sizeof (RECT)); 5490 if (cbCmd >= cbRects) 5491 { 5492 cbCmd -= cbRects; 5493 memcpy(&pBlt->Blt.DstRects.UpdateRects.aRects[pPresent->MultipassOffset], &pPresent->pDstSubRects[pPresent->MultipassOffset], cbRects); 5494 pBlt->Blt.DstRects.UpdateRects.cRects += cbRects/sizeof (RECT); 5668 5495 } 5669 5496 else 5670 5497 { 5671 /* this should not happen actually */ 5672 LOGREL(("failed to get Src Allocation info for hDeviceSpecificAllocation(0x%x)",pSrc->hDeviceSpecificAllocation)); 5673 Status = STATUS_INVALID_HANDLE; 5674 } 5675 #if 0 5676 UINT cbCmd = pPresent->DmaSize; 5677 5678 Assert(pPresent->SubRectCnt); 5679 UINT cmdSize = VBOXVDMACMD_DMA_PRESENT_BLT_SIZE(pPresent->SubRectCnt - pPresent->MultipassOffset); 5680 PVBOXVDMACMD pCmd = (PVBOXVDMACMD)pPresent->pDmaBuffer; 5681 pPresent->pDmaBuffer = ((uint8_t*)pPresent->pDmaBuffer) + cmdSize; 5682 Assert(cbCmd >= VBOXVDMACMD_DMA_PRESENT_BLT_MINSIZE()); 5683 if (cbCmd >= VBOXVDMACMD_DMA_PRESENT_BLT_MINSIZE()) 5684 { 5685 DXGK_ALLOCATIONLIST *pSrc = &pPresent->pAllocationList[DXGK_PRESENT_SOURCE_INDEX]; 5686 DXGK_ALLOCATIONLIST *pDst = &pPresent->pAllocationList[DXGK_PRESENT_DESTINATION_INDEX]; 5687 PVBOXWDDM_ALLOCATION pSrcAlloc = vboxWddmGetAllocationFromAllocList(pDevExt, pSrc); 5688 Assert(pSrcAlloc); 5689 if (pSrcAlloc) 5690 { 5691 PVBOXWDDM_ALLOCATION pDstAlloc = vboxWddmGetAllocationFromAllocList(pDevExt, pDst); 5692 Assert(pDstAlloc); 5693 if (pDstAlloc) 5694 { 5695 if (vboxWddmPixFormatConversionSupported(pSrcAlloc->AllocData.SurfDesc.format, pDstAlloc->AllocData.SurfDesc.format)) 5696 { 5697 memset(pPresent->pPatchLocationListOut, 0, 2*sizeof (D3DDDI_PATCHLOCATIONLIST)); 5698 // pPresent->pPatchLocationListOut->PatchOffset = 0; 5699 // ++pPresent->pPatchLocationListOut; 5700 pPresent->pPatchLocationListOut->PatchOffset = VBOXVDMACMD_BODY_FIELD_OFFSET(UINT, VBOXVDMACMD_DMA_PRESENT_BLT, offSrc); 5701 pPresent->pPatchLocationListOut->AllocationIndex = DXGK_PRESENT_SOURCE_INDEX; 5702 ++pPresent->pPatchLocationListOut; 5703 pPresent->pPatchLocationListOut->PatchOffset = VBOXVDMACMD_BODY_FIELD_OFFSET(UINT, VBOXVDMACMD_DMA_PRESENT_BLT, offDst); 5704 pPresent->pPatchLocationListOut->AllocationIndex = DXGK_PRESENT_DESTINATION_INDEX; 5705 ++pPresent->pPatchLocationListOut; 5706 5707 pCmd->enmType = VBOXVDMACMD_TYPE_DMA_PRESENT_BLT; 5708 pCmd->u32CmdSpecific = 0; 5709 PVBOXVDMACMD_DMA_PRESENT_BLT pTransfer = VBOXVDMACMD_BODY(pCmd, VBOXVDMACMD_DMA_PRESENT_BLT); 5710 pTransfer->offSrc = (VBOXVIDEOOFFSET)pSrc->PhysicalAddress.QuadPart; 5711 pTransfer->offDst = (VBOXVIDEOOFFSET)pDst->PhysicalAddress.QuadPart; 5712 vboxWddmSurfDescFromAllocation(pSrcAlloc, &pTransfer->srcDesc); 5713 vboxWddmSurfDescFromAllocation(pDstAlloc, &pTransfer->dstDesc); 5714 vboxWddmRectlFromRect(&pPresent->SrcRect, &pTransfer->srcRectl); 5715 vboxWddmRectlFromRect(&pPresent->DstRect, &pTransfer->dstRectl); 5716 UINT i = 0; 5717 cbCmd -= VBOXVDMACMD_BODY_FIELD_OFFSET(UINT, VBOXVDMACMD_DMA_PRESENT_BLT, aDstSubRects); 5718 Assert(cbCmd >= sizeof (VBOXVDMA_RECTL)); 5719 Assert(cbCmd < pPresent->DmaSize); 5720 for (; i < pPresent->SubRectCnt; ++i) 5721 { 5722 if (cbCmd < sizeof (VBOXVDMA_RECTL)) 5723 { 5724 Assert(i); 5725 pPresent->MultipassOffset += i; 5726 Status = STATUS_GRAPHICS_INSUFFICIENT_DMA_BUFFER; 5727 break; 5728 } 5729 vboxWddmRectlFromRect(&pPresent->pDstSubRects[i + pPresent->MultipassOffset], &pTransfer->aDstSubRects[i]); 5730 cbCmd -= sizeof (VBOXVDMA_RECTL); 5731 } 5732 Assert(i); 5733 pTransfer->cDstSubRects = i; 5734 pPresent->pDmaBufferPrivateData = (uint8_t*)pPresent->pDmaBufferPrivateData + sizeof(VBOXWDDM_DMA_PRIVATEDATA_HDR); 5735 } 5736 else 5737 { 5738 AssertBreakpoint(); 5739 LOGREL(("unsupported format conversion from(%d) to (%d)",pSrcAlloc->AllocData.SurfDesc.format, pDstAlloc->AllocData.SurfDesc.format)); 5740 Status = STATUS_GRAPHICS_CANNOTCOLORCONVERT; 5741 } 5742 } 5743 else 5744 { 5745 /* this should not happen actually */ 5746 LOGREL(("failed to get Dst Allocation info for hDeviceSpecificAllocation(0x%x)",pDst->hDeviceSpecificAllocation)); 5747 Status = STATUS_INVALID_HANDLE; 5748 } 5749 } 5750 else 5751 { 5752 /* this should not happen actually */ 5753 LOGREL(("failed to get Src Allocation info for hDeviceSpecificAllocation(0x%x)",pSrc->hDeviceSpecificAllocation)); 5754 Status = STATUS_INVALID_HANDLE; 5755 } 5756 } 5757 else 5758 { 5759 /* this should not happen actually */ 5760 LOGREL(("cbCmd too small!! (%d)", cbCmd)); 5498 UINT cbFitingRects = (cbCmd/sizeof (RECT)) * sizeof (RECT); 5499 Assert(cbFitingRects); 5500 memcpy(&pBlt->Blt.DstRects.UpdateRects.aRects[pPresent->MultipassOffset], &pPresent->pDstSubRects[pPresent->MultipassOffset], cbFitingRects); 5501 cbCmd -= cbFitingRects; 5502 pPresent->MultipassOffset += cbFitingRects/sizeof (RECT); 5503 pBlt->Blt.DstRects.UpdateRects.cRects += cbFitingRects/sizeof (RECT); 5504 Assert(pPresent->SubRectCnt > pPresent->MultipassOffset); 5761 5505 Status = STATUS_GRAPHICS_INSUFFICIENT_DMA_BUFFER; 5762 5506 } 5763 #endif 5507 5508 memset(pPresent->pPatchLocationListOut, 0, 2*sizeof (D3DDDI_PATCHLOCATIONLIST)); 5509 pPresent->pPatchLocationListOut->PatchOffset = 0; 5510 pPresent->pPatchLocationListOut->AllocationIndex = DXGK_PRESENT_SOURCE_INDEX; 5511 ++pPresent->pPatchLocationListOut; 5512 pPresent->pPatchLocationListOut->PatchOffset = 4; 5513 pPresent->pPatchLocationListOut->AllocationIndex = DXGK_PRESENT_DESTINATION_INDEX; 5514 ++pPresent->pPatchLocationListOut; 5764 5515 } 5765 5516 else if (pPresent->Flags.Flip) … … 5769 5520 DXGK_ALLOCATIONLIST *pSrc = &pPresent->pAllocationList[DXGK_PRESENT_SOURCE_INDEX]; 5770 5521 PVBOXWDDM_ALLOCATION pSrcAlloc = vboxWddmGetAllocationFromAllocList(pDevExt, pSrc); 5771 Assert(pSrcAlloc); 5772 if (pSrcAlloc) 5773 { 5774 Assert(pDevExt->cContexts3D); 5775 pPrivateData->BaseHdr.enmCmd = VBOXVDMACMD_TYPE_DMA_PRESENT_FLIP; 5776 PVBOXWDDM_DMA_PRIVATEDATA_FLIP pFlip = (PVBOXWDDM_DMA_PRIVATEDATA_FLIP)pPrivateData; 5777 5778 vboxWddmPopulateDmaAllocInfo(&pFlip->Flip.Alloc, pSrcAlloc, pSrc); 5779 5780 UINT cbCmd = sizeof (VBOXWDDM_DMA_PRIVATEDATA_FLIP); 5781 pPresent->pDmaBufferPrivateData = (uint8_t*)pPresent->pDmaBufferPrivateData + cbCmd; 5782 pPresent->pDmaBuffer = ((uint8_t*)pPresent->pDmaBuffer) + VBOXWDDM_DUMMY_DMABUFFER_SIZE; 5783 Assert(pPresent->DmaSize >= VBOXWDDM_DUMMY_DMABUFFER_SIZE); 5784 5785 memset(pPresent->pPatchLocationListOut, 0, sizeof (D3DDDI_PATCHLOCATIONLIST)); 5786 pPresent->pPatchLocationListOut->PatchOffset = 0; 5787 pPresent->pPatchLocationListOut->AllocationIndex = DXGK_PRESENT_SOURCE_INDEX; 5788 ++pPresent->pPatchLocationListOut; 5789 } 5790 else 5522 5523 if (!pSrcAlloc) 5791 5524 { 5792 5525 /* this should not happen actually */ 5793 LOGREL(("failed to get pSrc Allocation info for hDeviceSpecificAllocation(0x%x)",pSrc->hDeviceSpecificAllocation));5526 WARN(("failed to get pSrc Allocation info for hDeviceSpecificAllocation(0x%x)",pSrc->hDeviceSpecificAllocation)); 5794 5527 Status = STATUS_INVALID_HANDLE; 5795 } 5528 goto done; 5529 } 5530 5531 Assert(pDevExt->cContexts3D); 5532 pPrivateData->BaseHdr.enmCmd = VBOXVDMACMD_TYPE_DMA_PRESENT_FLIP; 5533 PVBOXWDDM_DMA_PRIVATEDATA_FLIP pFlip = (PVBOXWDDM_DMA_PRIVATEDATA_FLIP)pPrivateData; 5534 5535 vboxWddmPopulateDmaAllocInfo(&pFlip->Flip.Alloc, pSrcAlloc, pSrc); 5536 5537 UINT cbCmd = sizeof (VBOXWDDM_DMA_PRIVATEDATA_FLIP); 5538 pPresent->pDmaBufferPrivateData = (uint8_t*)pPresent->pDmaBufferPrivateData + cbCmd; 5539 pPresent->pDmaBuffer = ((uint8_t*)pPresent->pDmaBuffer) + VBOXWDDM_DUMMY_DMABUFFER_SIZE; 5540 Assert(pPresent->DmaSize >= VBOXWDDM_DUMMY_DMABUFFER_SIZE); 5541 5542 memset(pPresent->pPatchLocationListOut, 0, sizeof (D3DDDI_PATCHLOCATIONLIST)); 5543 pPresent->pPatchLocationListOut->PatchOffset = 0; 5544 pPresent->pPatchLocationListOut->AllocationIndex = DXGK_PRESENT_SOURCE_INDEX; 5545 ++pPresent->pPatchLocationListOut; 5796 5546 } 5797 5547 else if (pPresent->Flags.ColorFill) … … 5801 5551 DXGK_ALLOCATIONLIST *pDst = &pPresent->pAllocationList[DXGK_PRESENT_DESTINATION_INDEX]; 5802 5552 PVBOXWDDM_ALLOCATION pDstAlloc = vboxWddmGetAllocationFromAllocList(pDevExt, pDst); 5803 Assert(pDstAlloc); 5804 if (pDstAlloc) 5805 { 5806 UINT cbCmd = pPresent->DmaBufferPrivateDataSize; 5807 pPrivateData->BaseHdr.enmCmd = VBOXVDMACMD_TYPE_DMA_PRESENT_CLRFILL; 5808 PVBOXWDDM_DMA_PRIVATEDATA_CLRFILL pCF = (PVBOXWDDM_DMA_PRIVATEDATA_CLRFILL)pPrivateData; 5809 5810 vboxWddmPopulateDmaAllocInfo(&pCF->ClrFill.Alloc, pDstAlloc, pDst); 5811 5812 pCF->ClrFill.Color = pPresent->Color; 5813 pCF->ClrFill.Rects.cRects = 0; 5814 UINT cbHead = RT_OFFSETOF(VBOXWDDM_DMA_PRIVATEDATA_CLRFILL, ClrFill.Rects.aRects[0]); 5553 if (!pDstAlloc) 5554 { 5555 5556 /* this should not happen actually */ 5557 WARN(("failed to get pDst Allocation info for hDeviceSpecificAllocation(0x%x)",pDst->hDeviceSpecificAllocation)); 5558 Status = STATUS_INVALID_HANDLE; 5559 goto done; 5560 } 5561 5562 UINT cbCmd = pPresent->DmaBufferPrivateDataSize; 5563 pPrivateData->BaseHdr.enmCmd = VBOXVDMACMD_TYPE_DMA_PRESENT_CLRFILL; 5564 PVBOXWDDM_DMA_PRIVATEDATA_CLRFILL pCF = (PVBOXWDDM_DMA_PRIVATEDATA_CLRFILL)pPrivateData; 5565 5566 vboxWddmPopulateDmaAllocInfo(&pCF->ClrFill.Alloc, pDstAlloc, pDst); 5567 5568 pCF->ClrFill.Color = pPresent->Color; 5569 pCF->ClrFill.Rects.cRects = 0; 5570 UINT cbHead = RT_OFFSETOF(VBOXWDDM_DMA_PRIVATEDATA_CLRFILL, ClrFill.Rects.aRects[0]); 5571 Assert(pPresent->SubRectCnt > pPresent->MultipassOffset); 5572 UINT cbRects = (pPresent->SubRectCnt - pPresent->MultipassOffset) * sizeof (RECT); 5573 pPresent->pDmaBufferPrivateData = (uint8_t*)pPresent->pDmaBufferPrivateData + cbHead + cbRects; 5574 pPresent->pDmaBuffer = ((uint8_t*)pPresent->pDmaBuffer) + VBOXWDDM_DUMMY_DMABUFFER_SIZE; 5575 Assert(pPresent->DmaSize >= VBOXWDDM_DUMMY_DMABUFFER_SIZE); 5576 cbCmd -= cbHead; 5577 Assert(cbCmd < UINT32_MAX/2); 5578 Assert(cbCmd > sizeof (RECT)); 5579 if (cbCmd >= cbRects) 5580 { 5581 cbCmd -= cbRects; 5582 memcpy(&pCF->ClrFill.Rects.aRects[pPresent->MultipassOffset], pPresent->pDstSubRects, cbRects); 5583 pCF->ClrFill.Rects.cRects += cbRects/sizeof (RECT); 5584 } 5585 else 5586 { 5587 UINT cbFitingRects = (cbCmd/sizeof (RECT)) * sizeof (RECT); 5588 Assert(cbFitingRects); 5589 memcpy(&pCF->ClrFill.Rects.aRects[pPresent->MultipassOffset], pPresent->pDstSubRects, cbFitingRects); 5590 cbCmd -= cbFitingRects; 5591 pPresent->MultipassOffset += cbFitingRects/sizeof (RECT); 5592 pCF->ClrFill.Rects.cRects += cbFitingRects/sizeof (RECT); 5815 5593 Assert(pPresent->SubRectCnt > pPresent->MultipassOffset); 5816 UINT cbRects = (pPresent->SubRectCnt - pPresent->MultipassOffset) * sizeof (RECT); 5817 pPresent->pDmaBufferPrivateData = (uint8_t*)pPresent->pDmaBufferPrivateData + cbHead + cbRects; 5818 pPresent->pDmaBuffer = ((uint8_t*)pPresent->pDmaBuffer) + VBOXWDDM_DUMMY_DMABUFFER_SIZE; 5819 Assert(pPresent->DmaSize >= VBOXWDDM_DUMMY_DMABUFFER_SIZE); 5820 cbCmd -= cbHead; 5821 Assert(cbCmd < UINT32_MAX/2); 5822 Assert(cbCmd > sizeof (RECT)); 5823 if (cbCmd >= cbRects) 5824 { 5825 cbCmd -= cbRects; 5826 memcpy(&pCF->ClrFill.Rects.aRects[pPresent->MultipassOffset], pPresent->pDstSubRects, cbRects); 5827 pCF->ClrFill.Rects.cRects += cbRects/sizeof (RECT); 5828 } 5829 else 5830 { 5831 UINT cbFitingRects = (cbCmd/sizeof (RECT)) * sizeof (RECT); 5832 Assert(cbFitingRects); 5833 memcpy(&pCF->ClrFill.Rects.aRects[pPresent->MultipassOffset], pPresent->pDstSubRects, cbFitingRects); 5834 cbCmd -= cbFitingRects; 5835 pPresent->MultipassOffset += cbFitingRects/sizeof (RECT); 5836 pCF->ClrFill.Rects.cRects += cbFitingRects/sizeof (RECT); 5837 Assert(pPresent->SubRectCnt > pPresent->MultipassOffset); 5838 Status = STATUS_GRAPHICS_INSUFFICIENT_DMA_BUFFER; 5839 } 5840 5841 memset(pPresent->pPatchLocationListOut, 0, sizeof (D3DDDI_PATCHLOCATIONLIST)); 5842 pPresent->pPatchLocationListOut->PatchOffset = 0; 5843 pPresent->pPatchLocationListOut->AllocationIndex = DXGK_PRESENT_DESTINATION_INDEX; 5844 ++pPresent->pPatchLocationListOut; 5845 } 5846 else 5847 { 5848 /* this should not happen actually */ 5849 LOGREL(("failed to get pDst Allocation info for hDeviceSpecificAllocation(0x%x)",pDst->hDeviceSpecificAllocation)); 5850 Status = STATUS_INVALID_HANDLE; 5851 } 5852 5594 Status = STATUS_GRAPHICS_INSUFFICIENT_DMA_BUFFER; 5595 } 5596 5597 memset(pPresent->pPatchLocationListOut, 0, sizeof (D3DDDI_PATCHLOCATIONLIST)); 5598 pPresent->pPatchLocationListOut->PatchOffset = 0; 5599 pPresent->pPatchLocationListOut->AllocationIndex = DXGK_PRESENT_DESTINATION_INDEX; 5600 ++pPresent->pPatchLocationListOut; 5853 5601 } 5854 5602 else 5855 5603 { 5856 LOGREL(("cmd NOT IMPLEMENTED!! Flags(0x%x)", pPresent->Flags.Value)); 5857 AssertBreakpoint(); 5858 } 5859 5604 WARN(("cmd NOT IMPLEMENTED!! Flags(0x%x)", pPresent->Flags.Value)); 5605 Status = STATUS_NOT_SUPPORTED; 5606 } 5607 5608 done: 5860 5609 // LOGF(("LEAVE, hContext(0x%x), Status(0x%x)", hContext, Status)); 5861 5610 -
trunk/src/VBox/Additions/common/crOpenGL/load.c
r46757 r47151 397 397 crUnlockMutex(mutex); 398 398 # if defined(WINDOWS) 399 if ( RTThreadGetState(stub.hSyncThread)!=RTTHREADSTATE_TERMINATED)399 if (stub.hSyncThread && RTThreadGetState(stub.hSyncThread)!=RTTHREADSTATE_TERMINATED) 400 400 { 401 401 HANDLE hNative; … … 820 820 # ifdef VBOX_WITH_WDDM 821 821 HMODULE hVBoxD3D = NULL; 822 HRESULT hr;823 822 GLint spuConnection = 0; 824 823 # endif … … 938 937 int i; 939 938 int disable_sync = 0; 939 #if defined(WINDOWS) && defined(VBOX_WITH_WDDM) 940 HMODULE hVBoxD3D = NULL; 941 #endif 940 942 941 943 stubInitVars(); … … 954 956 } 955 957 #elif defined(WINDOWS) && defined(VBOX_WITH_WDDM) 956 if (stub.bNewPresent) 958 hVBoxD3D = NULL; 959 if (!GetModuleHandleEx(0, VBOX_MODNAME_DISPD3D, &hVBoxD3D)) 960 { 961 crDebug("GetModuleHandleEx failed err %d", GetLastError()); 962 hVBoxD3D = NULL; 963 } 964 965 if (hVBoxD3D) 957 966 { 958 967 disable_sync = 1; 959 968 crDebug("running with %s", VBOX_MODNAME_DISPD3D); 969 stub.trackWindowVisibleRgn = 0; 970 stub.trackWindowSize = 0; 971 stub.trackWindowPos = 0; 972 stub.trackWindowVisibility = 0; 960 973 stub.trackWindowVisibleRgn = 0; 961 974 stub.bRunningUnderWDDM = true; … … 1116 1129 #include <windows.h> 1117 1130 1118 #if def DEBUG_misha1131 #if 1//def DEBUG_misha 1119 1132 /* debugging: this is to be able to catch first-chance notifications 1120 1133 * for exceptions other than EXCEPTION_BREAKPOINT in kernel debugger */ … … 1123 1136 1124 1137 #ifdef VDBG_VEHANDLER 1125 static PVOID g_VBoxWDbgVEHandler = NULL; 1126 static DWORD g_VBoxWDbgVEHExit = 1; 1138 # include <dbghelp.h> 1139 static PVOID g_VBoxVehHandler = NULL; 1140 static DWORD g_VBoxVehEnable = 0; 1141 1142 /* generate a crash dump on exception */ 1143 #define VBOXVEH_F_DUMP 0x00000001 1144 /* generate a debugger breakpoint exception */ 1145 #define VBOXVEH_F_BREAK 0x00000002 1146 /* exit on exception */ 1147 #define VBOXVEH_F_EXIT 0x00000004 1148 1149 static DWORD g_VBoxVehFlags = VBOXVEH_F_DUMP 1150 #ifdef DEBUG_misha 1151 | VBOXVEH_F_BREAK 1152 #endif 1153 ; 1154 1155 typedef BOOL WINAPI FNVBOXDBG_MINIDUMPWRITEDUMP(HANDLE hProcess, 1156 DWORD ProcessId, 1157 HANDLE hFile, 1158 MINIDUMP_TYPE DumpType, 1159 PMINIDUMP_EXCEPTION_INFORMATION ExceptionParam, 1160 PMINIDUMP_USER_STREAM_INFORMATION UserStreamParam, 1161 PMINIDUMP_CALLBACK_INFORMATION CallbackParam); 1162 typedef FNVBOXDBG_MINIDUMPWRITEDUMP *PFNVBOXDBG_MINIDUMPWRITEDUMP; 1163 1164 static HMODULE g_hVBoxMdDbgHelp = NULL; 1165 static PFNVBOXDBG_MINIDUMPWRITEDUMP g_pfnVBoxMdMiniDumpWriteDump = NULL; 1166 static uint32_t g_cVBoxMdFilePrefixLen = 0; 1167 static WCHAR g_aszwVBoxMdFilePrefix[MAX_PATH]; 1168 static WCHAR g_aszwVBoxMdDumpCount = 0; 1169 static MINIDUMP_TYPE g_enmVBoxMdDumpType = MiniDumpNormal 1170 | MiniDumpWithDataSegs 1171 | MiniDumpWithFullMemory 1172 | MiniDumpWithHandleData 1173 //// | MiniDumpFilterMemory 1174 //// | MiniDumpScanMemory 1175 // | MiniDumpWithUnloadedModules 1176 //// | MiniDumpWithIndirectlyReferencedMemory 1177 //// | MiniDumpFilterModulePaths 1178 // | MiniDumpWithProcessThreadData 1179 // | MiniDumpWithPrivateReadWriteMemory 1180 //// | MiniDumpWithoutOptionalData 1181 // | MiniDumpWithFullMemoryInfo 1182 // | MiniDumpWithThreadInfo 1183 // | MiniDumpWithCodeSegs 1184 // | MiniDumpWithFullAuxiliaryState 1185 // | MiniDumpWithPrivateWriteCopyMemory 1186 // | MiniDumpIgnoreInaccessibleMemory 1187 // | MiniDumpWithTokenInformation 1188 //// | MiniDumpWithModuleHeaders 1189 //// | MiniDumpFilterTriage 1190 ; 1191 1192 1193 1194 #define VBOXMD_DUMP_DIR_PREFIX_DEFAULT L"C:\\dumps\\vboxdmp" 1195 1196 static HMODULE loadSystemDll(const char *pszName) 1197 { 1198 char szPath[MAX_PATH]; 1199 UINT cchPath = GetSystemDirectoryA(szPath, sizeof(szPath)); 1200 size_t cbName = strlen(pszName) + 1; 1201 if (cchPath + 1 + cbName > sizeof(szPath)) 1202 { 1203 SetLastError(ERROR_FILENAME_EXCED_RANGE); 1204 return NULL; 1205 } 1206 szPath[cchPath] = '\\'; 1207 memcpy(&szPath[cchPath + 1], pszName, cbName); 1208 return LoadLibraryA(szPath); 1209 } 1210 1211 static DWORD vboxMdMinidumpCreate(struct _EXCEPTION_POINTERS *pExceptionInfo) 1212 { 1213 WCHAR aszwMdFileName[MAX_PATH]; 1214 HANDLE hProcess = GetCurrentProcess(); 1215 DWORD ProcessId = GetCurrentProcessId(); 1216 MINIDUMP_EXCEPTION_INFORMATION ExceptionInfo; 1217 HANDLE hFile; 1218 DWORD winErr = ERROR_SUCCESS; 1219 1220 if (!g_pfnVBoxMdMiniDumpWriteDump) 1221 { 1222 if (!g_hVBoxMdDbgHelp) 1223 { 1224 g_hVBoxMdDbgHelp = loadSystemDll("DbgHelp.dll"); 1225 if (!g_hVBoxMdDbgHelp) 1226 return GetLastError(); 1227 } 1228 1229 g_pfnVBoxMdMiniDumpWriteDump = (PFNVBOXDBG_MINIDUMPWRITEDUMP)GetProcAddress(g_hVBoxMdDbgHelp, "MiniDumpWriteDump"); 1230 if (!g_pfnVBoxMdMiniDumpWriteDump) 1231 return GetLastError(); 1232 } 1233 1234 /* @todo: this is a tmp stuff until we get that info from the settings properly */ 1235 if (!g_cVBoxMdFilePrefixLen) 1236 { 1237 g_cVBoxMdFilePrefixLen = sizeof (VBOXMD_DUMP_DIR_PREFIX_DEFAULT)/sizeof (g_aszwVBoxMdFilePrefix[0]) - 1 /* <- don't include nul terminator */; 1238 memcpy(g_aszwVBoxMdFilePrefix, VBOXMD_DUMP_DIR_PREFIX_DEFAULT, sizeof (VBOXMD_DUMP_DIR_PREFIX_DEFAULT)); 1239 } 1240 1241 1242 if (RT_ELEMENTS(aszwMdFileName) <= g_cVBoxMdFilePrefixLen) 1243 { 1244 return ERROR_INVALID_STATE; 1245 } 1246 1247 ++g_aszwVBoxMdDumpCount; 1248 1249 memcpy(aszwMdFileName, g_aszwVBoxMdFilePrefix, g_cVBoxMdFilePrefixLen * sizeof (g_aszwVBoxMdFilePrefix[0])); 1250 swprintf(aszwMdFileName + g_cVBoxMdFilePrefixLen, RT_ELEMENTS(aszwMdFileName) - g_cVBoxMdFilePrefixLen, L"%d_%d.dmp", ProcessId, g_aszwVBoxMdDumpCount); 1251 1252 hFile = CreateFileW(aszwMdFileName, GENERIC_WRITE, 0, NULL, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL); 1253 if (hFile == INVALID_HANDLE_VALUE) 1254 return GetLastError(); 1255 1256 ExceptionInfo.ThreadId = GetCurrentThreadId(); 1257 ExceptionInfo.ExceptionPointers = pExceptionInfo; 1258 ExceptionInfo.ClientPointers = FALSE; 1259 1260 if (!g_pfnVBoxMdMiniDumpWriteDump(hProcess, ProcessId, hFile, g_enmVBoxMdDumpType, &ExceptionInfo, NULL, NULL)) 1261 winErr = GetLastError(); 1262 1263 CloseHandle(hFile); 1264 return winErr; 1265 } 1266 1127 1267 LONG WINAPI vboxVDbgVectoredHandler(struct _EXCEPTION_POINTERS *pExceptionInfo) 1128 1268 { … … 1139 1279 case EXCEPTION_INT_DIVIDE_BY_ZERO: 1140 1280 case EXCEPTION_ILLEGAL_INSTRUCTION: 1141 CRASSERT(0); 1142 if (g_VBoxWDbgVEHExit) 1281 if (g_VBoxVehFlags & VBOXVEH_F_BREAK) 1282 { 1283 BOOL fBreak = TRUE; 1284 if (pExceptionRecord->ExceptionCode == EXCEPTION_BREAKPOINT) 1285 { 1286 HANDLE hProcess = GetCurrentProcess(); 1287 BOOL fDebuggerPresent = FALSE; 1288 /* we do not want to generate breakpoint exceptions recursively, so do it only when running under debugger */ 1289 if (CheckRemoteDebuggerPresent(hProcess, &fDebuggerPresent)) 1290 fBreak = !!fDebuggerPresent; 1291 else 1292 fBreak = FALSE; /* <- the function has failed, don't break for sanity */ 1293 } 1294 1295 if (fBreak) 1296 { 1297 RT_BREAKPOINT(); 1298 } 1299 } 1300 1301 if (g_VBoxVehFlags & VBOXVEH_F_DUMP) 1302 vboxMdMinidumpCreate(pExceptionInfo); 1303 1304 if (g_VBoxVehFlags & VBOXVEH_F_EXIT) 1143 1305 exit(1); 1144 1306 break; … … 1151 1313 void vboxVDbgVEHandlerRegister() 1152 1314 { 1153 CRASSERT(!g_VBox WDbgVEHandler);1154 g_VBox WDbgVEHandler = AddVectoredExceptionHandler(1,vboxVDbgVectoredHandler);1155 CRASSERT(g_VBox WDbgVEHandler);1315 CRASSERT(!g_VBoxVehHandler); 1316 g_VBoxVehHandler = AddVectoredExceptionHandler(1,vboxVDbgVectoredHandler); 1317 CRASSERT(g_VBoxVehHandler); 1156 1318 } 1157 1319 … … 1159 1321 { 1160 1322 ULONG uResult; 1161 if (g_VBox WDbgVEHandler)1162 { 1163 uResult = RemoveVectoredExceptionHandler(g_VBox WDbgVEHandler);1323 if (g_VBoxVehHandler) 1324 { 1325 uResult = RemoveVectoredExceptionHandler(g_VBoxVehHandler); 1164 1326 CRASSERT(uResult); 1165 g_VBox WDbgVEHandler = NULL;1327 g_VBoxVehHandler = NULL; 1166 1328 } 1167 1329 } … … 1186 1348 1187 1349 #ifdef VDBG_VEHANDLER 1188 vboxVDbgVEHandlerRegister(); 1350 g_VBoxVehEnable = !!crGetenv("CR_DBG_VEH_ENABLE"); 1351 if (g_VBoxVehEnable) 1352 vboxVDbgVEHandlerRegister(); 1189 1353 #endif 1190 1354 … … 1201 1365 crDebug("Failed to connect to host (is guest 3d acceleration enabled?), aborting ICD load."); 1202 1366 #ifdef VDBG_VEHANDLER 1203 vboxVDbgVEHandlerUnregister(); 1367 if (g_VBoxVehEnable) 1368 vboxVDbgVEHandlerUnregister(); 1204 1369 #endif 1205 1370 return FALSE; … … 1207 1372 else 1208 1373 { 1209 /* @todo: impl proper detection */1210 #ifndef DEBUG_misha1211 stub.bNewPresent = true;1212 #endif1213 1214 1374 crNetFreeConnection(ns.conn); 1215 1375 } … … 1236 1396 1237 1397 #ifdef VDBG_VEHANDLER 1238 vboxVDbgVEHandlerUnregister(); 1398 if (g_VBoxVehEnable) 1399 vboxVDbgVEHandlerUnregister(); 1239 1400 #endif 1240 1401 break; -
trunk/src/VBox/Additions/common/crOpenGL/stub.h
r46757 r47151 261 261 # ifdef VBOX_WITH_WDDM 262 262 bool bRunningUnderWDDM; 263 bool bNewPresent;264 263 # endif 265 264 #endif
Note:
See TracChangeset
for help on using the changeset viewer.