Changeset 29922 in vbox for trunk/src/VBox/Additions/WINNT/Graphics/Miniport
- Timestamp:
- May 31, 2010 5:38:48 PM (15 years ago)
- Location:
- trunk/src/VBox/Additions/WINNT/Graphics/Miniport
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Additions/WINNT/Graphics/Miniport/VBoxVideo.h
r29895 r29922 157 157 { 158 158 VBOXVHWA_INFO Settings; 159 boolcOverlaysCreated;159 volatile uint32_t cOverlaysCreated; 160 160 } VBOXWDDM_VHWA; 161 161 #endif -
trunk/src/VBox/Additions/WINNT/Graphics/Miniport/wddm/VBoxVideoVhwa.cpp
r29895 r29922 477 477 } 478 478 479 int vboxVhwaHlpDestroySurface(PDEVICE_EXTENSION pDevExt, PVBOXWDDM_ALLOCATION pSurf, 480 D3DDDI_VIDEO_PRESENT_SOURCE_ID VidPnSourceId) 481 { 482 Assert(pSurf->hHostHandle); 483 if (!pSurf->hHostHandle) 484 return VERR_INVALID_STATE; 485 486 VBOXVHWACMD* pCmd = vboxVhwaCommandCreate(pDevExt, VidPnSourceId, 487 VBOXVHWACMD_TYPE_SURF_DESTROY, sizeof(VBOXVHWACMD_SURF_DESTROY)); 488 Assert(pCmd); 489 if(pCmd) 490 { 491 VBOXVHWACMD_SURF_DESTROY * pBody = VBOXVHWACMD_BODY(pCmd, VBOXVHWACMD_SURF_DESTROY); 492 493 memset(pBody, 0, sizeof(VBOXVHWACMD_SURF_DESTROY)); 494 495 pBody->u.in.hSurf = pSurf->hHostHandle; 496 497 /* we're not interested in completion, just send the command */ 498 vboxVhwaCommandSubmitAsynchAndComplete(pDevExt, pCmd); 499 500 pSurf->hHostHandle = VBOXVHWA_SURFHANDLE_INVALID; 501 502 return VINF_SUCCESS; 503 } 504 505 return VERR_OUT_OF_RESOURCES; 506 } 507 508 int vboxVhwaHlpPopulateSurInfo(VBOXVHWA_SURFACEDESC *pInfo, PVBOXWDDM_ALLOCATION pSurf, 509 uint32_t fFlags, uint32_t cBackBuffers, uint32_t fSCaps, 510 D3DDDI_VIDEO_PRESENT_SOURCE_ID VidPnSourceId) 511 { 512 memset(pInfo, 0, sizeof(VBOXVHWA_SURFACEDESC)); 513 514 pInfo->height = pSurf->SurfDesc.height; 515 pInfo->width = pSurf->SurfDesc.width; 516 pInfo->flags |= VBOXVHWA_SD_HEIGHT | VBOXVHWA_SD_WIDTH; 517 if (fFlags & VBOXVHWA_SD_PITCH) 518 { 519 pInfo->pitch = pSurf->SurfDesc.pitch; 520 pInfo->flags |= VBOXVHWA_SD_PITCH; 521 pInfo->sizeX = pSurf->SurfDesc.cbSize; 522 pInfo->sizeY = 1; 523 } 524 525 if (cBackBuffers) 526 { 527 pInfo->cBackBuffers = cBackBuffers; 528 pInfo->flags |= VBOXVHWA_SD_BACKBUFFERCOUNT; 529 } 530 else 531 pInfo->cBackBuffers = 0; 532 pInfo->Reserved = 0; 533 /* @todo: color keys */ 534 // pInfo->DstOverlayCK; 535 // pInfo->DstBltCK; 536 // pInfo->SrcOverlayCK; 537 // pInfo->SrcBltCK; 538 int rc = vboxVhwaHlpTranslateFormat(&pInfo->PixelFormat, pSurf->SurfDesc.format); 539 AssertRC(rc); 540 if (RT_SUCCESS(rc)) 541 { 542 pInfo->flags |= VBOXVHWA_SD_PIXELFORMAT; 543 pInfo->surfCaps = fSCaps; 544 pInfo->flags |= VBOXVHWA_SD_CAPS; 545 pInfo->offSurface = pSurf->offVram; 546 } 547 548 return rc; 549 } 550 551 int vboxVhwaHlpCheckApplySurfInfo(PVBOXWDDM_ALLOCATION pSurf, VBOXVHWA_SURFACEDESC *pInfo, 552 uint32_t fFlags, bool bApplyHostHandle) 553 { 554 int rc = VINF_SUCCESS; 555 if (!(fFlags & VBOXVHWA_SD_PITCH)) 556 { 557 /* should be set by host */ 558 Assert(pInfo->flags & VBOXVHWA_SD_PITCH); 559 pSurf->SurfDesc.cbSize = pInfo->sizeX * pInfo->sizeY; 560 Assert(pSurf->SurfDesc.cbSize); 561 pSurf->SurfDesc.pitch = pInfo->pitch; 562 Assert(pSurf->SurfDesc.pitch); 563 } 564 else 565 { 566 Assert(pSurf->SurfDesc.cbSize == pInfo->sizeX); 567 Assert(pInfo->sizeY == 1); 568 Assert(pInfo->pitch == pSurf->SurfDesc.pitch); 569 if (pSurf->SurfDesc.cbSize != pInfo->sizeX 570 || pInfo->sizeY != 1 571 || pInfo->pitch != pSurf->SurfDesc.pitch) 572 { 573 rc = VERR_INVALID_PARAMETER; 574 } 575 } 576 577 if (bApplyHostHandle && RT_SUCCESS(rc)) 578 { 579 pSurf->hHostHandle = pInfo->hSurf; 580 } 581 582 return rc; 583 } 584 479 585 int vboxVhwaHlpCreateSurface(PDEVICE_EXTENSION pDevExt, PVBOXWDDM_ALLOCATION pSurf, 480 586 uint32_t fFlags, uint32_t cBackBuffers, uint32_t fSCaps, … … 485 591 VBOXVHWACMD_TYPE_SURF_CREATE, sizeof(VBOXVHWACMD_SURF_CREATE)); 486 592 Assert(pCmd); 487 if (pCmd)593 if (pCmd) 488 594 { 489 595 VBOXVHWACMD_SURF_CREATE * pBody = VBOXVHWACMD_BODY(pCmd, VBOXVHWACMD_SURF_CREATE); … … 492 598 memset(pBody, 0, sizeof(VBOXVHWACMD_SURF_CREATE)); 493 599 494 pBody->SurfInfo.height = pSurf->SurfDesc.height; 495 pBody->SurfInfo.width = pSurf->SurfDesc.width; 496 pBody->SurfInfo.flags |= VBOXVHWA_SD_HEIGHT | VBOXVHWA_SD_WIDTH; 497 if (fFlags & VBOXVHWA_SD_PITCH) 498 { 499 pBody->SurfInfo.pitch = pSurf->SurfDesc.pitch; 500 pBody->SurfInfo.flags |= VBOXVHWA_SD_PITCH; 501 pBody->SurfInfo.sizeX = pSurf->SurfDesc.cbSize; 502 pBody->SurfInfo.sizeY = 1; 503 } 504 if (cBackBuffers) 505 { 506 pBody->SurfInfo.cBackBuffers = cBackBuffers; 507 pBody->SurfInfo.flags |= VBOXVHWA_SD_BACKBUFFERCOUNT; 508 } 509 else 510 pBody->SurfInfo.cBackBuffers = 0; 511 pBody->SurfInfo.Reserved = 0; 512 /* @todo: color keys */ 513 // pBody->SurfInfo.DstOverlayCK; 514 // pBody->SurfInfo.DstBltCK; 515 // pBody->SurfInfo.SrcOverlayCK; 516 // pBody->SurfInfo.SrcBltCK; 517 rc = vboxVhwaHlpTranslateFormat(&pBody->SurfInfo.PixelFormat, pSurf->SurfDesc.format); 600 rc = vboxVhwaHlpPopulateSurInfo(&pBody->SurfInfo, pSurf, 601 fFlags, cBackBuffers, fSCaps, 602 VidPnSourceId); 518 603 AssertRC(rc); 519 604 if (RT_SUCCESS(rc)) 520 605 { 521 pBody->SurfInfo.flags |= VBOXVHWA_SD_PIXELFORMAT;522 pBody->SurfInfo.surfCaps = fSCaps;523 pBody->SurfInfo.flags |= VBOXVHWA_SD_CAPS;524 pBody->SurfInfo.offSurface = pSurf->offVram;525 526 606 vboxVhwaCommandSubmit(pDevExt, pCmd); 527 607 Assert(pCmd->rc == VINF_SUCCESS); 528 608 if(pCmd->rc == VINF_SUCCESS) 529 609 { 530 if (!(fFlags & VBOXVHWA_SD_PITCH)) 531 { 532 /* should be set by host */ 533 Assert(pBody->SurfInfo.flags & VBOXVHWA_SD_PITCH); 534 pSurf->SurfDesc.cbSize = pBody->SurfInfo.sizeX * pBody->SurfInfo.sizeY; 535 Assert(pSurf->SurfDesc.cbSize); 536 pSurf->SurfDesc.pitch = pBody->SurfInfo.pitch; 537 Assert(pSurf->SurfDesc.pitch); 538 } 539 else 540 { 541 Assert(pSurf->SurfDesc.cbSize == pBody->SurfInfo.sizeX); 542 Assert(pBody->SurfInfo.sizeY == 1); 543 Assert(pBody->SurfInfo.pitch == pSurf->SurfDesc.pitch); 544 if (pSurf->SurfDesc.cbSize != pBody->SurfInfo.sizeX 545 || pBody->SurfInfo.sizeY != 1 546 || pBody->SurfInfo.pitch != pSurf->SurfDesc.pitch) 547 { 548 rc = VERR_INVALID_PARAMETER; 549 } 550 } 551 552 if (RT_SUCCESS(rc)) 553 { 554 pSurf->hHostHandle = pBody->SurfInfo.hSurf; 555 } 610 rc = vboxVhwaHlpCheckApplySurfInfo(pSurf, &pBody->SurfInfo, fFlags, true); 556 611 } 557 612 else … … 565 620 } 566 621 567 int vboxVhwaHlpCreatePriary(PDEVICE_EXTENSION pDevExt, PVBOXWDDM_SOURCE pSource, D3DDDI_VIDEO_PRESENT_SOURCE_ID VidPnSourceId) 568 { 569 Assert(!!(pSource->Vhwa.Settings.fFlags & VBOXVHWA_F_ENABLED)); 570 if (!(pSource->Vhwa.Settings.fFlags & VBOXVHWA_F_ENABLED)) 571 return VERR_NOT_SUPPORTED; 572 622 int vboxVhwaHlpGetSurfInfoForSource(PDEVICE_EXTENSION pDevExt, PVBOXWDDM_ALLOCATION pSurf, D3DDDI_VIDEO_PRESENT_SOURCE_ID VidPnSourceId) 623 { 624 /* the first thing we need is to post create primary */ 625 VBOXVHWACMD* pCmd = vboxVhwaCommandCreate(pDevExt, VidPnSourceId, 626 VBOXVHWACMD_TYPE_SURF_GETINFO, sizeof(VBOXVHWACMD_SURF_GETINFO)); 627 Assert(pCmd); 628 if (pCmd) 629 { 630 VBOXVHWACMD_SURF_GETINFO * pBody = VBOXVHWACMD_BODY(pCmd, VBOXVHWACMD_SURF_GETINFO); 631 int rc = VINF_SUCCESS; 632 633 memset(pBody, 0, sizeof(VBOXVHWACMD_SURF_GETINFO)); 634 635 rc = vboxVhwaHlpPopulateSurInfo(&pBody->SurfInfo, pSurf, 636 0, 0, VBOXVHWA_SCAPS_OVERLAY | VBOXVHWA_SCAPS_VIDEOMEMORY | VBOXVHWA_SCAPS_LOCALVIDMEM | VBOXVHWA_SCAPS_COMPLEX, 637 VidPnSourceId); 638 AssertRC(rc); 639 if (RT_SUCCESS(rc)) 640 { 641 vboxVhwaCommandSubmit(pDevExt, pCmd); 642 Assert(pCmd->rc == VINF_SUCCESS); 643 if(pCmd->rc == VINF_SUCCESS) 644 { 645 rc = vboxVhwaHlpCheckApplySurfInfo(pSurf, &pBody->SurfInfo, 0, true); 646 } 647 else 648 rc = pCmd->rc; 649 } 650 vboxVhwaCommandFree(pDevExt, pCmd); 651 return rc; 652 } 653 654 return VERR_OUT_OF_RESOURCES; 655 } 656 657 int vboxVhwaHlpGetSurfInfo(PDEVICE_EXTENSION pDevExt, PVBOXWDDM_ALLOCATION pSurf) 658 { 659 for (uint32_t i = 0; i < pDevExt->cSources; ++i) 660 { 661 PVBOXWDDM_SOURCE pSource = &pDevExt->aSources[i]; 662 if (pSource->Vhwa.Settings.fFlags & VBOXVHWA_F_ENABLED) 663 { 664 int rc = vboxVhwaHlpGetSurfInfoForSource(pDevExt, pSurf, i); 665 AssertRC(rc); 666 return rc; 667 } 668 } 669 AssertBreakpoint(); 670 return VERR_NOT_SUPPORTED; 671 } 672 673 int vboxVhwaHlpDestroyPrimary(PDEVICE_EXTENSION pDevExt, PVBOXWDDM_SOURCE pSource, D3DDDI_VIDEO_PRESENT_SOURCE_ID VidPnSourceId) 674 { 573 675 #ifdef VBOXWDDM_RENDER_FROM_SHADOW 574 676 PVBOXWDDM_ALLOCATION pFbSurf = pSource->pShadowAllocation; … … 577 679 #endif 578 680 579 Assert(!pSource->Vhwa.cOverlaysCreated); 580 if (pSource->Vhwa.cOverlaysCreated) 581 { 582 Assert(pFbSurf->hHostHandle); 583 if (pFbSurf->hHostHandle) 584 return VINF_ALREADY_INITIALIZED; 681 int rc = vboxVhwaHlpDestroySurface(pDevExt, pFbSurf, VidPnSourceId); 682 AssertRC(rc); 683 return rc; 684 } 685 686 int vboxVhwaHlpCreatePrimary(PDEVICE_EXTENSION pDevExt, PVBOXWDDM_SOURCE pSource, D3DDDI_VIDEO_PRESENT_SOURCE_ID VidPnSourceId) 687 { 688 #ifdef VBOXWDDM_RENDER_FROM_SHADOW 689 PVBOXWDDM_ALLOCATION pFbSurf = pSource->pShadowAllocation; 690 #else 691 PVBOXWDDM_ALLOCATION pFbSurf = pSource->pPrimaryAllocation; 692 #endif 693 Assert(pSource->Vhwa.cOverlaysCreated == 1); 694 Assert(pFbSurf->hHostHandle == VBOXVHWA_SURFHANDLE_INVALID); 695 if (pFbSurf->hHostHandle != VBOXVHWA_SURFHANDLE_INVALID) 585 696 return VERR_INVALID_STATE; 586 }587 697 588 698 int rc = vboxVhwaHlpCreateSurface(pDevExt, pFbSurf, … … 593 703 } 594 704 595 int vboxVhwaHlpC reateOverlay(PDEVICE_EXTENSION pDevExt, PVBOXWDDM_ALLOCATION pSurf, uint32_t cBackBuffers, D3DDDI_VIDEO_PRESENT_SOURCE_ID VidPnSourceId)705 int vboxVhwaHlpCheckInit(PDEVICE_EXTENSION pDevExt, D3DDDI_VIDEO_PRESENT_SOURCE_ID VidPnSourceId) 596 706 { 597 707 Assert(VidPnSourceId < pDevExt->cSources); … … 601 711 PVBOXWDDM_SOURCE pSource = &pDevExt->aSources[VidPnSourceId]; 602 712 603 int rc = vboxVhwaHlpCreatePriary(pDevExt, pSource, VidPnSourceId); 713 Assert(!!(pSource->Vhwa.Settings.fFlags & VBOXVHWA_F_ENABLED)); 714 if (!(pSource->Vhwa.Settings.fFlags & VBOXVHWA_F_ENABLED)) 715 return VERR_NOT_SUPPORTED; 716 717 int rc = VINF_SUCCESS; 718 /* @todo: need a better synch */ 719 uint32_t cNew = ASMAtomicIncU32(&pSource->Vhwa.cOverlaysCreated); 720 if (cNew == 1) 721 { 722 rc = vboxVhwaHlpCreatePrimary(pDevExt, pSource, VidPnSourceId); 723 AssertRC(rc); 724 } 725 else 726 { 727 #ifdef VBOXWDDM_RENDER_FROM_SHADOW 728 PVBOXWDDM_ALLOCATION pFbSurf = pSource->pShadowAllocation; 729 #else 730 PVBOXWDDM_ALLOCATION pFbSurf = pSource->pPrimaryAllocation; 731 #endif 732 Assert(pFbSurf->hHostHandle); 733 if (pFbSurf->hHostHandle) 734 rc = VINF_ALREADY_INITIALIZED; 735 else 736 rc = VERR_INVALID_STATE; 737 } 738 739 if (RT_FAILURE(rc)) 740 ASMAtomicDecU32(&pSource->Vhwa.cOverlaysCreated); 741 742 return rc; 743 } 744 745 int vboxVhwaHlpCheckTerm(PDEVICE_EXTENSION pDevExt, D3DDDI_VIDEO_PRESENT_SOURCE_ID VidPnSourceId) 746 { 747 Assert(VidPnSourceId < pDevExt->cSources); 748 if (VidPnSourceId >= pDevExt->cSources) 749 return VERR_INVALID_PARAMETER; 750 751 PVBOXWDDM_SOURCE pSource = &pDevExt->aSources[VidPnSourceId]; 752 753 Assert(!!(pSource->Vhwa.Settings.fFlags & VBOXVHWA_F_ENABLED)); 754 755 /* @todo: need a better synch */ 756 uint32_t cNew = ASMAtomicDecU32(&pSource->Vhwa.cOverlaysCreated); 757 int rc = VINF_SUCCESS; 758 if (!cNew) 759 { 760 rc = vboxVhwaHlpDestroyPrimary(pDevExt, pSource, VidPnSourceId); 761 AssertRC(rc); 762 } 763 else 764 { 765 Assert(cNew < UINT32_MAX / 2); 766 } 767 768 return rc; 769 } 770 771 int vboxVhwaHlpCreateOverlay(PDEVICE_EXTENSION pDevExt, PVBOXWDDM_ALLOCATION pSurf, uint32_t cBackBuffers, D3DDDI_VIDEO_PRESENT_SOURCE_ID VidPnSourceId) 772 { 773 int rc = vboxVhwaHlpCheckInit(pDevExt, VidPnSourceId); 604 774 AssertRC(rc); 605 775 if (RT_SUCCESS(rc)) … … 609 779 VidPnSourceId); 610 780 AssertRC(rc); 611 if (RT_SUCCESS(rc)) 612 ++pSource->Vhwa.cOverlaysCreated; 613 } 614 615 return rc; 616 } 781 } 782 783 return rc; 784 } 785 786 int vboxVhwaHlpDestroyOverlay(PDEVICE_EXTENSION pDevExt, PVBOXWDDM_ALLOCATION pSurf, D3DDDI_VIDEO_PRESENT_SOURCE_ID VidPnSourceId) 787 { 788 int rc = vboxVhwaHlpDestroySurface(pDevExt, pSurf, VidPnSourceId); 789 AssertRC(rc); 790 if (RT_SUCCESS(rc)) 791 { 792 rc = vboxVhwaHlpCheckTerm(pDevExt, VidPnSourceId); 793 AssertRC(rc); 794 } 795 796 return rc; 797 } -
trunk/src/VBox/Additions/WINNT/Graphics/Miniport/wddm/VBoxVideoVhwa.h
r29895 r29922 55 55 56 56 int vboxVhwaHlpCreateOverlay(PDEVICE_EXTENSION pDevExt, PVBOXWDDM_ALLOCATION pSurf, uint32_t cBackBuffers, D3DDDI_VIDEO_PRESENT_SOURCE_ID VidPnSourceId); 57 int vboxVhwaHlpDestroyOverlay(PDEVICE_EXTENSION pDevExt, PVBOXWDDM_ALLOCATION pSurf, D3DDDI_VIDEO_PRESENT_SOURCE_ID VidPnSourceId); 58 int vboxVhwaHlpGetSurfInfo(PDEVICE_EXTENSION pDevExt, PVBOXWDDM_ALLOCATION pSurf); 57 59 58 60 #endif /* #ifndef ___VBoxVideoVhwa_h___ */ -
trunk/src/VBox/Additions/WINNT/Graphics/Miniport/wddm/VBoxVideoWddm.cpp
r29895 r29922 1372 1372 return Status; 1373 1373 } 1374 1375 PVBOXWDDM_ALLOCATION vboxWddmAllocationCreateFromResource(PVBOXWDDM_RESOURCE pResource, uint32_t iIndex) 1376 { 1377 PVBOXWDDM_ALLOCATION pAllocation = NULL; 1378 if (pResource) 1379 { 1380 Assert(iIndex < pResource->cAllocations); 1381 if (iIndex < pResource->cAllocations) 1382 { 1383 pAllocation = &pResource->aAllocations[iIndex]; 1384 memset(pAllocation, 0, sizeof (VBOXWDDM_ALLOCATION)); 1385 } 1386 } 1387 else 1388 pAllocation = (PVBOXWDDM_ALLOCATION)vboxWddmMemAllocZero(sizeof (VBOXWDDM_ALLOCATION)); 1389 1390 if (pAllocation) 1391 { 1392 if (pResource) 1393 { 1394 pAllocation->pResource = pResource; 1395 pAllocation->iIndex = iIndex; 1396 } 1397 } 1398 1399 return pAllocation; 1400 } 1401 1402 void vboxWddmAllocationDeleteFromResource(PVBOXWDDM_RESOURCE pResource, PVBOXWDDM_ALLOCATION pAllocation) 1403 { 1404 Assert(pAllocation->pResource == pResource); 1405 if (pResource) 1406 { 1407 Assert(&pResource->aAllocations[pAllocation->iIndex] == pAllocation); 1408 } 1409 else 1410 { 1411 vboxWddmMemFree(pAllocation); 1412 } 1413 } 1414 1374 1415 NTSTATUS vboxWddmDestroyAllocation(PDEVICE_EXTENSION pDevExt, PVBOXWDDM_ALLOCATION pAllocation) 1375 1416 { … … 1399 1440 } 1400 1441 #endif 1442 //#ifdef VBOX_WITH_VIDEOHWACCEL 1443 // case VBOXWDDM_ALLOC_TYPE_UMD_RC_GENERIC: 1444 // { 1445 // if (pAllocation->fRcFlags.Overlay) 1446 // { 1447 // vboxVhwaHlpDestroyOverlay(pDevExt, pAllocation); 1448 // } 1449 // break; 1450 // } 1451 //#endif 1401 1452 default: 1402 1453 break; 1403 1454 } 1404 vboxWddmMemFree(pAllocation); 1455 1456 vboxWddmAllocationDeleteFromResource(pAllocation->pResource, pAllocation); 1457 1405 1458 return STATUS_SUCCESS; 1406 1459 } 1407 1460 1408 NTSTATUS vboxWddmCreateAllocation(PDEVICE_EXTENSION pDevExt, PVBOXWDDM_R CINFO pRcInfo, DXGK_ALLOCATIONINFO* pAllocationInfo)1461 NTSTATUS vboxWddmCreateAllocation(PDEVICE_EXTENSION pDevExt, PVBOXWDDM_RESOURCE pResource, uint32_t iIndex, DXGK_ALLOCATIONINFO* pAllocationInfo) 1409 1462 { 1410 1463 PAGED_CODE(); … … 1416 1469 { 1417 1470 PVBOXWDDM_ALLOCINFO pAllocInfo = (PVBOXWDDM_ALLOCINFO)pAllocationInfo->pPrivateDriverData; 1418 PVBOXWDDM_ALLOCATION pAllocation = (PVBOXWDDM_ALLOCATION)vboxWddmMemAllocZero(sizeof (VBOXWDDM_ALLOCATION));1471 PVBOXWDDM_ALLOCATION pAllocation = vboxWddmAllocationCreateFromResource(pResource, iIndex); 1419 1472 Assert(pAllocation); 1420 1473 if (pAllocation) … … 1454 1507 break; 1455 1508 case VBOXWDDM_ALLOC_TYPE_UMD_RC_GENERIC: 1509 Assert(pResource); 1510 if (pResource) 1511 { 1512 Assert(pResource->cAllocations); 1513 if (pResource->cAllocations) 1514 { 1456 1515 #ifdef VBOX_WITH_VIDEOHWACCEL 1457 Assert(pRcInfo); 1458 if (pRcInfo) 1459 { 1460 Assert(pRcInfo->cAllocInfos); 1461 if (pRcInfo->cAllocInfos) 1462 { 1463 if (pRcInfo->RcDesc.fFlags.Overlay) 1516 if (pResource->RcDesc.fFlags.Overlay) 1464 1517 { 1465 int rc = vboxVhwaHlpCreateOverlay(pDevExt, pAllocation, pRcInfo->cAllocInfos - 1, pRcInfo->RcDesc.VidPnSourceId); 1518 /* actually we can not "properly" issue create overlay commands to the host here 1519 * because we do not know source VidPn id here, i.e. 1520 * the primary which is supposed to be overlayed, 1521 * however we need to get some info like pitch & size from the host here */ 1522 int rc = vboxVhwaHlpGetSurfInfo(pDevExt, pAllocation); 1466 1523 AssertRC(rc); 1467 if (RT_FAILURE(rc)) 1524 if (RT_SUCCESS(rc)) 1525 { 1526 pAllocInfo->SurfDesc = pAllocation->SurfDesc; 1527 } 1528 else 1468 1529 Status = STATUS_UNSUCCESSFUL; 1469 1530 } 1531 #endif 1470 1532 } 1471 1533 else 1472 1534 Status = STATUS_INVALID_PARAMETER; 1473 1535 } 1474 #endif1475 1536 /* do not break to set CPU visibility flag */ 1476 1537 case VBOXWDDM_ALLOC_TYPE_STD_SHADOWSURFACE: … … 1487 1548 1488 1549 if (Status != STATUS_SUCCESS) 1489 vboxWddm MemFree(pAllocation);1550 vboxWddmAllocationDeleteFromResource(pResource, pAllocation); 1490 1551 } 1491 1552 else … … 1518 1579 PDEVICE_EXTENSION pDevExt = (PDEVICE_EXTENSION)hAdapter; 1519 1580 NTSTATUS Status = STATUS_SUCCESS; 1520 PVBOXWDDM_R CINFO pRcInfo= NULL;1581 PVBOXWDDM_RESOURCE pResource = NULL; 1521 1582 1522 1583 if (pCreateAllocation->PrivateDriverDataSize) … … 1526 1587 if (pCreateAllocation->PrivateDriverDataSize >= sizeof (VBOXWDDM_RCINFO)) 1527 1588 { 1528 pRcInfo = (PVBOXWDDM_RCINFO)pCreateAllocation->pPrivateDriverData;1529 Assert(pRcInfo->RcDesc.VidPnSourceId < pDevExt->cSources);1589 PVBOXWDDM_RCINFO pRcInfo = (PVBOXWDDM_RCINFO)pCreateAllocation->pPrivateDriverData; 1590 // Assert(pRcInfo->RcDesc.VidPnSourceId < pDevExt->cSources); 1530 1591 Assert(pRcInfo->cAllocInfos == pCreateAllocation->NumAllocations); 1592 pResource = (PVBOXWDDM_RESOURCE)vboxWddmMemAllocZero(RT_OFFSETOF(VBOXWDDM_RESOURCE, aAllocations[pRcInfo->cAllocInfos])); 1593 Assert(pResource); 1594 if (pResource) 1595 { 1596 pResource->cAllocations = pRcInfo->cAllocInfos; 1597 pResource->fFlags = pRcInfo->fFlags; 1598 pResource->RcDesc = pRcInfo->RcDesc; 1599 } 1600 else 1601 Status = STATUS_NO_MEMORY; 1531 1602 } 1532 1603 else … … 1540 1611 for (UINT i = 0; i < pCreateAllocation->NumAllocations; ++i) 1541 1612 { 1542 Status = vboxWddmCreateAllocation(pDevExt, pR cInfo, &pCreateAllocation->pAllocationInfo[i]);1613 Status = vboxWddmCreateAllocation(pDevExt, pResource, i, &pCreateAllocation->pAllocationInfo[i]); 1543 1614 Assert(Status == STATUS_SUCCESS); 1544 1615 if (Status != STATUS_SUCCESS) … … 1552 1623 } 1553 1624 } 1625 1626 pCreateAllocation->hResource = pResource; 1627 if (pResource && Status != STATUS_SUCCESS) 1628 vboxWddmMemFree(pResource); 1554 1629 } 1555 1630 dfprintf(("<== "__FUNCTION__ ", status(0x%x), context(0x%x)\n", Status, hAdapter)); … … 1573 1648 NTSTATUS Status = STATUS_SUCCESS; 1574 1649 1650 PVBOXWDDM_RESOURCE pRc = (PVBOXWDDM_RESOURCE)pDestroyAllocation->hResource; 1651 1652 if (pRc) 1653 { 1654 Assert(pRc->cAllocations == pDestroyAllocation->NumAllocations); 1655 } 1656 1575 1657 for (UINT i = 0; i < pDestroyAllocation->NumAllocations; ++i) 1576 1658 { 1577 vboxWddmDestroyAllocation((PDEVICE_EXTENSION)hAdapter, (PVBOXWDDM_ALLOCATION)pDestroyAllocation->pAllocationList[i]); 1659 PVBOXWDDM_ALLOCATION pAlloc = (PVBOXWDDM_ALLOCATION)pDestroyAllocation->pAllocationList[i]; 1660 Assert(pAlloc->pResource == pRc); 1661 vboxWddmDestroyAllocation((PDEVICE_EXTENSION)hAdapter, pAlloc); 1662 } 1663 1664 if (pRc) 1665 { 1666 vboxWddmMemFree(pRc); 1578 1667 } 1579 1668 -
trunk/src/VBox/Additions/WINNT/Graphics/Miniport/wddm/VBoxVideoWddm.h
r29895 r29922 52 52 { 53 53 VBOXWDDM_ALLOC_TYPE enmType; 54 // D3DDDI_RESOURCEFLAGS fRcFlags; 54 55 UINT SegmentId; 55 56 VBOXVIDEOOFFSET offVram; … … 60 61 BOOLEAN bAssigned; 61 62 VBOXWDDM_SURFACE_DESC SurfDesc; 63 struct VBOXWDDM_RESOURCE *pResource; 64 uint32_t iIndex; 62 65 } VBOXWDDM_ALLOCATION, *PVBOXWDDM_ALLOCATION; 63 66 64 67 typedef struct VBOXWDDM_RESOURCE 65 68 { 66 VBOXWDDM_ALLOC_TYPE enmType; 67 UINT SegmentId; 68 VBOXVIDEOOFFSET offVram; 69 D3DDDI_RATIONAL RefreshRate; 70 D3DDDI_VIDEO_PRESENT_SOURCE_ID VidPnSourceId; 71 BOOLEAN bVisible; 72 BOOLEAN bAssigned; 73 VBOXWDDM_SURFACE_DESC SurfDesc; 69 uint32_t fFlags; 70 VBOXWDDM_RC_DESC RcDesc; 74 71 uint32_t cAllocations; 72 VBOXWDDM_ALLOCATION aAllocations[1]; 75 73 } VBOXWDDM_RESOURCE, *PVBOXWDDM_RESOURCE; 76 74
Note:
See TracChangeset
for help on using the changeset viewer.