Changeset 20683 in vbox for trunk/src/VBox/Additions/WINNT
- Timestamp:
- Jun 18, 2009 11:18:42 AM (16 years ago)
- Location:
- trunk/src/VBox/Additions/WINNT/Graphics/Display
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Additions/WINNT/Graphics/Display/dd.c
r20653 r20683 610 610 611 611 #ifdef VBOX_WITH_VIDEOHWACCEL 612 if(pDev->vhwaInfo.bVHWAEnabled && lpSurfaceLocal->ddsCaps.dwCaps & DDSCAPS_PRIMARYSURFACE)613 {614 lBpp = pDev->ulBitCount;615 lPitch = pDev->lDeltaScreen;616 }617 else618 #endif619 {620 lpSurfaceGlobal->dwReserved1 = 0;621 622 if (lpSurfaceDesc->ddpfPixelFormat.dwFlags & DDPF_PALETTEINDEXED4)623 {624 lBpp = 4;625 lPitch = lpSurfaceGlobal->wWidth/2;626 lPitch = (lPitch + 31) & ~31;627 }628 else629 if (lpSurfaceDesc->ddpfPixelFormat.dwFlags & DDPF_PALETTEINDEXED8)630 {631 lBpp = 8;632 lPitch = lpSurfaceGlobal->wWidth;633 lPitch = (lPitch + 31) & ~31;634 }635 else636 {637 lBpp = lpSurfaceDesc->ddpfPixelFormat.dwRGBBitCount;638 lPitch = lpSurfaceGlobal->wWidth*(lBpp/8);639 }640 DISPDBG((0, "New surface (%d,%d)\n", lpSurfaceGlobal->wWidth, lpSurfaceGlobal->wHeight));641 DISPDBG((0, "BPP %d lPitch=%d\n", lBpp, lPitch));642 643 lpSurfaceGlobal->dwBlockSizeX = lPitch;644 lpSurfaceGlobal->dwBlockSizeY = lpSurfaceGlobal->wHeight;645 lpSurfaceGlobal->lPitch = lPitch;646 647 lpSurfaceDesc->lPitch = lpSurfaceGlobal->lPitch;648 lpSurfaceDesc->dwFlags |= DDSD_PITCH;649 }650 651 //652 // Modify surface descriptions as appropriate and let Direct653 // Draw perform the allocation if the surface was not the primary654 //655 if (lpSurfaceLocal->ddsCaps.dwCaps & DDSCAPS_PRIMARYSURFACE)656 {657 DISPDBG((0, "-> primary surface\n"));658 lpSurfaceGlobal->fpVidMem = 0;659 }660 else661 {662 DISPDBG((0, "-> secondary surface\n"));663 lpSurfaceGlobal->fpVidMem = DDHAL_PLEASEALLOC_BLOCKSIZE;664 }665 666 #ifdef VBOX_WITH_VIDEOHWACCEL667 612 if(pDev->vhwaInfo.bVHWAEnabled) 668 613 { 669 VBOXVHWACMD* pCmd = vboxVHWACommandCreate (pDev, VBOXVHWACMD_TYPE_SURF_CREATE, sizeof(VBOXVHWACMD_SURF_CREATE)); 614 VBOXVHWACMD* pCmd; 615 DDPIXELFORMAT * pFormat = &lpSurfaceGlobal->ddpfSurface; 616 617 if(lpSurfaceLocal->ddsCaps.dwCaps & DDSCAPS_PRIMARYSURFACE) 618 { 619 lBpp = pDev->ulBitCount; 620 lPitch = pDev->lDeltaScreen; 621 } 622 else 623 { 624 if (pFormat->dwFlags & DDPF_PALETTEINDEXED4) 625 { 626 lBpp = 4; 627 lPitch = lpSurfaceGlobal->wWidth/2; 628 lPitch = (lPitch + 31) & ~31; 629 } 630 else 631 if (pFormat->dwFlags & DDPF_PALETTEINDEXED8) 632 { 633 lBpp = 8; 634 lPitch = lpSurfaceGlobal->wWidth; 635 lPitch = (lPitch + 31) & ~31; 636 } 637 else 638 { 639 lBpp = pFormat->dwRGBBitCount; 640 lPitch = lpSurfaceGlobal->wWidth*(lBpp/8); 641 } 642 } 643 644 DISPDBG((0, "New surface (%d,%d)\n", lpSurfaceGlobal->wWidth, lpSurfaceGlobal->wHeight)); 645 DISPDBG((0, "BPP %d lPitch=%d\n", lBpp, lPitch)); 646 #if 0 647 lpSurfaceGlobal->dwBlockSizeX = lPitch; 648 lpSurfaceGlobal->dwBlockSizeY = lpSurfaceGlobal->wHeight; 649 lpSurfaceGlobal->lPitch = lPitch; 650 #else 651 lpSurfaceGlobal->dwBlockSizeX = lPitch * lpSurfaceGlobal->wHeight; 652 lpSurfaceGlobal->dwBlockSizeY = 1; 653 lpSurfaceGlobal->lPitch = lPitch; 654 #endif 655 656 #if 0 657 lpSurfaceDesc->lPitch = lpSurfaceGlobal->lPitch; 658 lpSurfaceDesc->dwFlags |= DDSD_PITCH; 659 #endif 660 661 // 662 // Modify surface descriptions as appropriate and let Direct 663 // Draw perform the allocation if the surface was not the primary 664 // 665 if (lpSurfaceLocal->ddsCaps.dwCaps & DDSCAPS_PRIMARYSURFACE) 666 { 667 DISPDBG((0, "-> primary surface\n")); 668 lpSurfaceGlobal->fpVidMem = 0; 669 } 670 else 671 { 672 DISPDBG((0, "-> secondary surface\n")); 673 lpSurfaceGlobal->fpVidMem = DDHAL_PLEASEALLOC_BLOCKSIZE; 674 } 675 676 pCmd = vboxVHWACommandCreate (pDev, VBOXVHWACMD_TYPE_SURF_CREATE, sizeof(VBOXVHWACMD_SURF_CREATE)); 670 677 if(pCmd) 671 678 { 672 679 VBOXVHWACMD_SURF_CREATE * pBody = VBOXVHWACMD_BODY(pCmd, VBOXVHWACMD_SURF_CREATE); 673 680 PVBOXVHWASURFDESC pDesc; 681 int rc; 682 674 683 memset(pBody, 0, sizeof(VBOXVHWACMD_SURF_CREATE)); 675 684 685 rc = vboxVHWAFromDDSURFACEDESC(&pBody->u.in.SurfInfo, lpSurfaceDesc); 686 676 687 pBody->u.in.SurfInfo.surfCaps = vboxVHWAFromDDSCAPS(lpSurfaceLocal->ddsCaps.dwCaps); 688 pBody->u.in.SurfInfo.flags |= DDSD_CAPS; 677 689 678 690 pBody->u.in.SurfInfo.height = lpSurfaceGlobal->wHeight; 679 691 pBody->u.in.SurfInfo.width = lpSurfaceGlobal->wWidth; 680 681 vboxVHWAFromDDPIXELFORMAT(&pBody->u.in.SurfInfo.PixelFormat, &lpSurfaceGlobal->ddpfSurface); 692 pBody->u.in.SurfInfo.flags |= DDSD_HEIGHT | DDSD_WIDTH; 693 694 vboxVHWAFromDDPIXELFORMAT(&pBody->u.in.SurfInfo.PixelFormat, pFormat); 695 pBody->u.in.SurfInfo.flags |= VBOXVHWA_SD_PIXELFORMAT; 682 696 683 697 if (lpSurfaceLocal->ddsCaps.dwCaps & DDSCAPS_PRIMARYSURFACE) … … 696 710 pDesc->cBitsPerPixel = lBpp; 697 711 vboxVHWACommandSubmit(pDev, pCmd); 712 Assert(pCmd->rc == VINF_SUCCESS); 698 713 if(pCmd->rc == VINF_SUCCESS) 699 714 { … … 710 725 vboxVHWACommandFree(pDev, pCmd); 711 726 } 712 } 713 #endif 727 return DDHAL_DRIVER_NOTHANDLED; 728 } 729 #endif 730 lpSurfaceGlobal->dwReserved1 = 0; 731 732 if (lpSurfaceDesc->ddpfPixelFormat.dwFlags & DDPF_PALETTEINDEXED4) 733 { 734 lBpp = 4; 735 lPitch = lpSurfaceGlobal->wWidth/2; 736 lPitch = (lPitch + 31) & ~31; 737 } 738 else 739 if (lpSurfaceDesc->ddpfPixelFormat.dwFlags & DDPF_PALETTEINDEXED8) 740 { 741 lBpp = 8; 742 lPitch = lpSurfaceGlobal->wWidth; 743 lPitch = (lPitch + 31) & ~31; 744 } 745 else 746 { 747 lBpp = lpSurfaceDesc->ddpfPixelFormat.dwRGBBitCount; 748 lPitch = lpSurfaceGlobal->wWidth*(lBpp/8); 749 } 750 DISPDBG((0, "New surface (%d,%d)\n", lpSurfaceGlobal->wWidth, lpSurfaceGlobal->wHeight)); 751 DISPDBG((0, "BPP %d lPitch=%d\n", lBpp, lPitch)); 752 753 lpSurfaceGlobal->dwBlockSizeX = lPitch; 754 lpSurfaceGlobal->dwBlockSizeY = lpSurfaceGlobal->wHeight; 755 lpSurfaceGlobal->lPitch = lPitch; 756 757 lpSurfaceDesc->lPitch = lpSurfaceGlobal->lPitch; 758 lpSurfaceDesc->dwFlags |= DDSD_PITCH; 759 760 // 761 // Modify surface descriptions as appropriate and let Direct 762 // Draw perform the allocation if the surface was not the primary 763 // 764 if (lpSurfaceLocal->ddsCaps.dwCaps & DDSCAPS_PRIMARYSURFACE) 765 { 766 DISPDBG((0, "-> primary surface\n")); 767 lpSurfaceGlobal->fpVidMem = 0; 768 } 769 else 770 { 771 DISPDBG((0, "-> secondary surface\n")); 772 lpSurfaceGlobal->fpVidMem = DDHAL_PLEASEALLOC_BLOCKSIZE; 773 } 774 714 775 return DDHAL_DRIVER_NOTHANDLED; 715 776 } … … 741 802 DISPDBG((0, "%s: %p\n", __FUNCTION__, pDev)); 742 803 743 if (lpDDS->ddsCaps.dwCaps & DDSCAPS_ZBUFFER)744 {745 DISPDBG((0, "No Z-Bufer support\n"));746 lpCanCreateSurface->ddRVal = DDERR_INVALIDPIXELFORMAT;747 return DDHAL_DRIVER_HANDLED;748 }749 if (lpDDS->ddsCaps.dwCaps & DDSCAPS_TEXTURE)750 {751 DISPDBG((0, "No texture support\n"));752 lpCanCreateSurface->ddRVal = DDERR_INVALIDPIXELFORMAT;753 return DDHAL_DRIVER_HANDLED;754 }755 756 804 #ifdef VBOX_WITH_VIDEOHWACCEL 757 805 if(pDev->vhwaInfo.bVHWAEnabled) … … 759 807 VBOXVHWACMD* pCmd; 760 808 uint32_t unsupportedSCaps = vboxVHWAUnsupportedDDSCAPS(lpDDS->ddsCaps.dwCaps); 809 Assert(!unsupportedSCaps); 761 810 if(unsupportedSCaps) 762 811 { … … 767 816 768 817 unsupportedSCaps = vboxVHWAUnsupportedDDPFS(lpDDS->ddpfPixelFormat.dwFlags); 818 Assert(!unsupportedSCaps); 769 819 if(unsupportedSCaps) 770 820 { … … 777 827 if(pCmd) 778 828 { 829 int rc; 779 830 VBOXVHWACMD_SURF_CANCREATE * pBody = VBOXVHWACMD_BODY(pCmd, VBOXVHWACMD_SURF_CANCREATE); 780 831 memset(pBody, 0, sizeof(VBOXVHWACMD_SURF_CANCREATE)); 781 832 782 pBody->u.in.SurfInfo.surfCaps = vboxVHWAFromDDSCAPS(lpDDS->ddsCaps.dwCaps); 783 784 pBody->u.in.SurfInfo.height = lpDDS->dwHeight; 785 pBody->u.in.SurfInfo.width = lpDDS->dwWidth; 786 vboxVHWAFromDDPIXELFORMAT(&pBody->u.in.SurfInfo.PixelFormat, &lpDDS->ddpfPixelFormat); 833 rc = vboxVHWAFromDDSURFACEDESC(&pBody->u.in.SurfInfo, lpDDS); 834 pBody->u.in.bIsDifferentPixelFormat = lpCanCreateSurface->bIsDifferentPixelFormat; 787 835 788 836 vboxVHWACommandSubmit(pDev, pCmd); … … 790 838 if(pCmd->rc == VINF_SUCCESS) 791 839 { 840 Assert(!pBody->u.out.ErrInfo); 792 841 if(pBody->u.out.ErrInfo) 793 842 { … … 812 861 } 813 862 #endif 863 864 if (lpDDS->ddsCaps.dwCaps & DDSCAPS_ZBUFFER) 865 { 866 DISPDBG((0, "No Z-Bufer support\n")); 867 lpCanCreateSurface->ddRVal = DDERR_INVALIDPIXELFORMAT; 868 return DDHAL_DRIVER_HANDLED; 869 } 870 if (lpDDS->ddsCaps.dwCaps & DDSCAPS_TEXTURE) 871 { 872 DISPDBG((0, "No texture support\n")); 873 lpCanCreateSurface->ddRVal = DDERR_INVALIDPIXELFORMAT; 874 return DDHAL_DRIVER_HANDLED; 875 } 814 876 if (lpCanCreateSurface->bIsDifferentPixelFormat && (lpDDS->ddpfPixelFormat.dwFlags & DDPF_FOURCC)) 815 877 { -
trunk/src/VBox/Additions/WINNT/Graphics/Display/driver.h
r20653 r20683 315 315 uint32_t vboxVHWAFromDDPFS(uint32_t caps); 316 316 uint32_t vboxVHWAToDDPFS(uint32_t caps); 317 void vboxVHWAFromDDPIXELFORMAT(VBOXVHWA_PIXELFORMAT *pVHWAFormat, DDPIXELFORMAT *pDdFormat); 317 int vboxVHWAFromDDPIXELFORMAT(VBOXVHWA_PIXELFORMAT *pVHWAFormat, DDPIXELFORMAT *pDdFormat); 318 int vboxVHWAFromDDSURFACEDESC(VBOXVHWA_SURFACEDESC *pVHWADesc, DDSURFACEDESC *pDdDesc); 318 319 void vboxVHWAFromRECTL(VBOXVHWA_RECTL *pDst, RECTL *pSrc); 319 320 PVBOXVHWASURFDESC vboxVHWASurfDescAlloc();
Note:
See TracChangeset
for help on using the changeset viewer.