Changeset 26767 in vbox for trunk/src/VBox/Additions/WINNT/Graphics/Miniport/wddm
- Timestamp:
- Feb 24, 2010 7:48:02 PM (15 years ago)
- Location:
- trunk/src/VBox/Additions/WINNT/Graphics/Miniport/wddm
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Additions/WINNT/Graphics/Miniport/wddm/VBoxVideoWddm.cpp
r26667 r26767 47 47 } 48 48 49 //VBOXVIDEOOFFSET vboxWddmVRAMAddressToOffset(PDEVICE_EXTENSION pDevExt, PHYSICAL_ADDRESS phAddress) 50 //{ 51 // Assert(phAddress.QuadPart >= VBE_DISPI_LFB_PHYSICAL_ADDRESS); 52 // if (phAddress.QuadPart < VBE_DISPI_LFB_PHYSICAL_ADDRESS) 53 // return VBOXVIDEOOFFSET_VOID; 54 // 55 // VBOXVIDEOOFFSET off = phAddress.QuadPart - VBE_DISPI_LFB_PHYSICAL_ADDRESS; 56 // Assert(off < pDevExt->u.primary.cbVRAM); 57 // if (off >= pDevExt->u.primary.cbVRAM) 58 // return VBOXVIDEOOFFSET_VOID; 59 // 60 // return off; 61 //} 62 63 VBOXVIDEOOFFSET vboxWddmValidatePrimary(PVBOXWDDM_ALLOCATION pAllocation) 64 { 65 Assert(pAllocation); 66 if (!pAllocation) 67 { 68 drprintf((__FUNCTION__": no allocation specified for Source\n")); 69 return VBOXVIDEOOFFSET_VOID; 70 } 71 72 Assert(pAllocation->SegmentId); 73 if (!pAllocation->SegmentId) 74 { 75 drprintf((__FUNCTION__": allocation is not paged in\n")); 76 return VBOXVIDEOOFFSET_VOID; 77 } 78 79 VBOXVIDEOOFFSET offVram = pAllocation->offVram; 80 Assert(offVram != VBOXVIDEOOFFSET_VOID); 81 if (offVram == VBOXVIDEOOFFSET_VOID) 82 drprintf((__FUNCTION__": VRAM pffset is not defined\n")); 83 84 return offVram; 85 } 86 87 NTSTATUS vboxWddmGhDisplayPostInfoScreen (PDEVICE_EXTENSION pDevExt, PVBOXWDDM_ALLOCATION pAllocation) 88 { 89 VBOXVIDEOOFFSET offVram = pAllocation->offVram; 90 Assert(offVram != VBOXVIDEOOFFSET_VOID); 91 if (offVram == VBOXVIDEOOFFSET_VOID) 92 return STATUS_INVALID_PARAMETER; 93 94 PVBOXWDDM_ALLOCATION_SHAREDPRIMARYSURFACE pPrimaryInfo = VBOXWDDM_ALLOCATION_BODY(pAllocation, VBOXWDDM_ALLOCATION_SHAREDPRIMARYSURFACE); 95 /* Issue the screen info command. */ 96 void *p = vboxHGSMIBufferAlloc (pDevExt, 97 sizeof (VBVAINFOSCREEN), 98 HGSMI_CH_VBVA, 99 VBVA_INFO_SCREEN); 100 Assert(p); 101 if (p) 102 { 103 VBVAINFOSCREEN *pScreen = (VBVAINFOSCREEN *)p; 104 105 pScreen->u32ViewIndex = pPrimaryInfo->VidPnSourceId; 106 pScreen->i32OriginX = 0; 107 pScreen->i32OriginY = 0; 108 pScreen->u32StartOffset = offVram; 109 pScreen->u32LineSize = pAllocation->u.SurfInfo.pitch; 110 pScreen->u32Width = pAllocation->u.SurfInfo.width; 111 pScreen->u32Height = pAllocation->u.SurfInfo.height; 112 pScreen->u16BitsPerPixel = (uint16_t)pAllocation->u.SurfInfo.bpp; 113 pScreen->u16Flags = VBVA_SCREEN_F_ACTIVE; 114 115 vboxHGSMIBufferSubmit (pDevExt, p); 116 117 vboxHGSMIBufferFree (pDevExt, p); 118 } 119 120 return STATUS_SUCCESS; 121 } 122 123 NTSTATUS vboxWddmGhDisplayPostInfoView (PDEVICE_EXTENSION pDevExt, PVBOXWDDM_ALLOCATION pAllocation) 124 { 125 VBOXVIDEOOFFSET offVram = pAllocation->offVram; 126 Assert(offVram != VBOXVIDEOOFFSET_VOID); 127 if (offVram == VBOXVIDEOOFFSET_VOID) 128 return STATUS_INVALID_PARAMETER; 129 130 PVBOXWDDM_ALLOCATION_SHAREDPRIMARYSURFACE pPrimaryInfo = VBOXWDDM_ALLOCATION_BODY(pAllocation, VBOXWDDM_ALLOCATION_SHAREDPRIMARYSURFACE); 131 /* Issue the screen info command. */ 132 void *p = vboxHGSMIBufferAlloc (pDevExt, 133 sizeof (VBVAINFOVIEW), 134 HGSMI_CH_VBVA, 135 VBVA_INFO_VIEW); 136 Assert(p); 137 if (p) 138 { 139 VBVAINFOVIEW *pView = (VBVAINFOVIEW *)p; 140 141 pView->u32ViewIndex = pPrimaryInfo->VidPnSourceId; 142 pView->u32ViewOffset = offVram; 143 pView->u32ViewSize = vboxWddmVramReportedSize(pDevExt)/pDevExt->u.primary.cDisplays; 144 145 pView->u32MaxScreenSize = pView->u32ViewSize; 146 147 vboxHGSMIBufferSubmit (pDevExt, p); 148 149 vboxHGSMIBufferFree (pDevExt, p); 150 } 151 152 return STATUS_SUCCESS; 153 } 154 155 NTSTATUS vboxWddmGhDisplaySetMode (PDEVICE_EXTENSION pDevExt, PVBOXWDDM_ALLOCATION pAllocation) 156 { 157 PVBOXWDDM_ALLOCATION_SHAREDPRIMARYSURFACE pPrimaryInfo = VBOXWDDM_ALLOCATION_BODY(pAllocation, VBOXWDDM_ALLOCATION_SHAREDPRIMARYSURFACE); 158 if (pPrimaryInfo->VidPnSourceId) 159 return STATUS_SUCCESS; 160 161 if (VBoxVideoSetCurrentModePerform(pDevExt, pAllocation->u.SurfInfo.width, 162 pAllocation->u.SurfInfo.height, pAllocation->u.SurfInfo.bpp)) 163 return STATUS_SUCCESS; 164 165 AssertBreakpoint(); 166 drprintf((__FUNCTION__": VBoxVideoSetCurrentModePerform failed\n")); 167 return STATUS_UNSUCCESSFUL; 168 } 169 170 171 NTSTATUS vboxWddmGhDisplaySetInfo(PDEVICE_EXTENSION pDevExt, PVBOXWDDM_SOURCE pSource) 172 { 173 PVBOXWDDM_ALLOCATION pAllocation = pSource->pAllocation; 174 VBOXVIDEOOFFSET offVram = vboxWddmValidatePrimary(pAllocation); 175 Assert(offVram != VBOXVIDEOOFFSET_VOID); 176 if (offVram == VBOXVIDEOOFFSET_VOID) 177 return STATUS_INVALID_PARAMETER; 178 179 /* 180 * Set the current mode into the hardware. 181 */ 182 NTSTATUS Status = vboxWddmGhDisplaySetMode (pDevExt, pAllocation); 183 Assert(Status == STATUS_SUCCESS); 184 if (Status == STATUS_SUCCESS) 185 { 186 Status = vboxWddmGhDisplayPostInfoView (pDevExt, pAllocation); 187 Assert(Status == STATUS_SUCCESS); 188 if (Status == STATUS_SUCCESS) 189 { 190 Status = vboxWddmGhDisplayPostInfoScreen (pDevExt, pAllocation); 191 Assert(Status == STATUS_SUCCESS); 192 if (Status != STATUS_SUCCESS) 193 drprintf((__FUNCTION__": vboxWddmGhDisplayPostInfoScreen failed\n")); 194 } 195 else 196 drprintf((__FUNCTION__": vboxWddmGhDisplayPostInfoView failed\n")); 197 } 198 else 199 drprintf((__FUNCTION__": vboxWddmGhDisplaySetMode failed\n")); 200 201 return Status; 202 } 203 49 204 #if 0 50 void vboxWddmProcessDisplayInfo (PPDEV ppdev)51 {52 if (ppdev->bHGSMISupported)53 {54 /* Issue the screen info command. */55 void *p = HGSMIHeapAlloc (&ppdev->hgsmiDisplayHeap,56 sizeof (VBVAINFOSCREEN),57 HGSMI_CH_VBVA,58 VBVA_INFO_SCREEN);59 if (!p)60 {61 DISPDBG((0, "VBoxDISP::VBoxProcessDisplayInfo: HGSMIHeapAlloc failed\n"));62 }63 else64 {65 VBVAINFOSCREEN *pScreen = (VBVAINFOSCREEN *)p;66 67 pScreen->u32ViewIndex = ppdev->iDevice;68 pScreen->i32OriginX = ppdev->ptlDevOrg.x;69 pScreen->i32OriginY = ppdev->ptlDevOrg.y;70 pScreen->u32StartOffset = 0;71 pScreen->u32LineSize = ppdev->lDeltaScreen > 0?ppdev->lDeltaScreen: -ppdev->lDeltaScreen;72 pScreen->u32Width = ppdev->cxScreen;73 pScreen->u32Height = ppdev->cyScreen;74 pScreen->u16BitsPerPixel = (uint16_t)ppdev->ulBitCount;75 pScreen->u16Flags = VBVA_SCREEN_F_ACTIVE;76 77 vboxHGSMIBufferSubmit (ppdev, p);78 79 HGSMIHeapFree (&ppdev->hgsmiDisplayHeap, p);80 }81 }82 83 return;84 }85 205 86 206 NTSTATUS vboxWddmGhInitPrimary(PDEVICE_EXTENSION pDevExt, D3DDDI_VIDEO_PRESENT_SOURCE_ID srcId, D3DKMDT_VIDPN_SOURCE_MODE *pVidPnSourceModeInfo) … … 1107 1227 /* make sure the size is page aligned */ 1108 1228 /* @todo: need to setup VBVA buffers and adjust the mem size here */ 1109 pQsOut->pSegmentDescriptor->Size = (pContext->u.primary.cbVRAM - VBVA_ADAPTER_INFORMATION_SIZE - pContext->u.primary.cbMiniportHeap) & (~0xfffUL);1229 pQsOut->pSegmentDescriptor->Size = vboxWddmVramReportedSize(pContext); 1110 1230 pQsOut->pSegmentDescriptor->NbOfBanks = 0; 1111 1231 pQsOut->pSegmentDescriptor->pBankRangeTable = 0; … … 1517 1637 Assert(pPatchList->AllocationIndex < pPatch->AllocationListSize); 1518 1638 const DXGK_ALLOCATIONLIST *pAllocationList = &pPatch->pAllocationList[pPatchList->AllocationIndex]; 1519 if (pAllocationList-> PhysicalAddress.QuadPart)1639 if (pAllocationList->SegmentId) 1520 1640 { 1521 1641 Assert(pPatchList->PatchOffset < (pPatch->DmaBufferPrivateDataSubmissionEndOffset - pPatch->DmaBufferPrivateDataSubmissionStartOffset)); 1522 *(( PHYSICAL_ADDRESS*)(pBuf+pPatchList->PatchOffset)) = pAllocationList->PhysicalAddress;1642 *((VBOXVIDEOOFFSET*)(pBuf+pPatchList->PatchOffset)) = (VBOXVIDEOOFFSET)pAllocationList->PhysicalAddress.QuadPart; 1523 1643 } 1524 1644 else … … 2079 2199 Assert(pAllocation->enmType == VBOXWDDM_ALLOC_TYPE_STD_SHAREDPRIMARYSURFACE); 2080 2200 PVBOXWDDM_ALLOCATION_SHAREDPRIMARYSURFACE pPrimary = VBOXWDDM_ALLOCATION_BODY(pAllocation, VBOXWDDM_ALLOCATION_SHAREDPRIMARYSURFACE); 2081 pAllocation->phAddress = pSetVidPnSourceAddress->PrimaryAddress; 2201 pAllocation->offVram = (VBOXVIDEOOFFSET)pSetVidPnSourceAddress->PrimaryAddress.QuadPart; 2202 pAllocation->SegmentId = pSetVidPnSourceAddress->PrimarySegment; 2203 Assert (pAllocation->SegmentId); 2082 2204 Assert (!pPrimary->bVisible); 2083 2205 if (pPrimary->bVisible) 2084 2206 { 2085 /* @todo: should not generally happen, but still inform host*/ 2207 /* should not generally happen, but still inform host*/ 2208 Status = vboxWddmGhDisplaySetInfo(pDevExt, pSource); 2209 Assert(Status == STATUS_SUCCESS); 2210 if (Status != STATUS_SUCCESS) 2211 drprintf((__FUNCTION__": vboxWddmGhDisplaySetInfo failed, Status (0x%x)\n", Status)); 2086 2212 } 2087 2213 } … … 2110 2236 ) 2111 2237 { 2112 return STATUS_NOT_IMPLEMENTED; 2238 /* DxgkDdiSetVidPnSourceVisibility should be made pageable. */ 2239 PAGED_CODE(); 2240 2241 dfprintf(("==> "__FUNCTION__ ", context(0x%x)\n", hAdapter)); 2242 2243 NTSTATUS Status = STATUS_SUCCESS; 2244 PDEVICE_EXTENSION pDevExt = (PDEVICE_EXTENSION)hAdapter; 2245 Assert(pDevExt->cSources > pSetVidPnSourceVisibility->VidPnSourceId); 2246 if (pDevExt->cSources > pSetVidPnSourceVisibility->VidPnSourceId) 2247 { 2248 PVBOXWDDM_SOURCE pSource = &pDevExt->aSources[pSetVidPnSourceVisibility->VidPnSourceId]; 2249 PVBOXWDDM_ALLOCATION pAllocation = pSource->pAllocation; 2250 PVBOXWDDM_ALLOCATION_SHAREDPRIMARYSURFACE pPrimary = VBOXWDDM_ALLOCATION_BODY(pAllocation, VBOXWDDM_ALLOCATION_SHAREDPRIMARYSURFACE); 2251 2252 Assert(pPrimary->bVisible != pSetVidPnSourceVisibility->Visible); 2253 if (pPrimary->bVisible != pSetVidPnSourceVisibility->Visible) 2254 { 2255 pPrimary->bVisible = pSetVidPnSourceVisibility->Visible; 2256 if (pPrimary->bVisible) 2257 { 2258 Status = vboxWddmGhDisplaySetInfo(pDevExt, pSource); 2259 Assert(Status == STATUS_SUCCESS); 2260 if (Status != STATUS_SUCCESS) 2261 drprintf((__FUNCTION__": vboxWddmGhDisplaySetInfo failed, Status (0x%x)\n", Status)); 2262 } 2263 } 2264 } 2265 else 2266 { 2267 drprintf((__FUNCTION__": invalid VidPnSourceId (%d), should be smaller than (%d)\n", pSetVidPnSourceVisibility->VidPnSourceId, pDevExt->cSources)); 2268 Status = STATUS_INVALID_PARAMETER; 2269 } 2270 2271 dfprintf(("<== "__FUNCTION__ ", status(0x%x), context(0x%x)\n", Status, hAdapter)); 2272 2273 return Status; 2113 2274 } 2114 2275 … … 2120 2281 ) 2121 2282 { 2283 2122 2284 return STATUS_NOT_IMPLEMENTED; 2123 2285 } … … 2368 2530 if (vboxWddmPixFormatConversionSupported(pSrcAlloc->u.SurfInfo.format, pDstAlloc->u.SurfInfo.format)) 2369 2531 { 2370 memset(pPresent->pPatchLocationListOut, 0, 3*sizeof (D3DDDI_PATCHLOCATIONLIST)); 2371 pPresent->pPatchLocationListOut->PatchOffset = 0; 2532 memset(pPresent->pPatchLocationListOut, 0, 2*sizeof (D3DDDI_PATCHLOCATIONLIST)); 2533 // pPresent->pPatchLocationListOut->PatchOffset = 0; 2534 // ++pPresent->pPatchLocationListOut; 2535 pPresent->pPatchLocationListOut->PatchOffset = VBOXVDMACMD_BODY_FIELD_OFFSET(UINT, VBOXVDMACMD_DMA_PRESENT_BLT, offSrc); 2536 pPresent->pPatchLocationListOut->AllocationIndex = 0; 2372 2537 ++pPresent->pPatchLocationListOut; 2373 pPresent->pPatchLocationListOut->PatchOffset = VBOXVDMACMD_BODY_FIELD_OFFSET(UINT, VBOXVDMACMD_DMA_PRESENT_BLT, phSrc); 2374 pPresent->pPatchLocationListOut->AllocationIndex = DXGK_PRESENT_SOURCE_INDEX; 2375 ++pPresent->pPatchLocationListOut; 2376 pPresent->pPatchLocationListOut->PatchOffset = VBOXVDMACMD_BODY_FIELD_OFFSET(UINT, VBOXVDMACMD_DMA_PRESENT_BLT, phDst); 2377 pPresent->pPatchLocationListOut->AllocationIndex = DXGK_PRESENT_DESTINATION_INDEX; 2538 pPresent->pPatchLocationListOut->PatchOffset = VBOXVDMACMD_BODY_FIELD_OFFSET(UINT, VBOXVDMACMD_DMA_PRESENT_BLT, offDst); 2539 pPresent->pPatchLocationListOut->AllocationIndex = 1; 2378 2540 ++pPresent->pPatchLocationListOut; 2379 2541 … … 2381 2543 pCmd->u32CmdSpecific = 0; 2382 2544 PVBOXVDMACMD_DMA_PRESENT_BLT pTransfer = VBOXVDMACMD_BODY(pCmd, VBOXVDMACMD_DMA_PRESENT_BLT); 2383 pTransfer-> phSrc =pSrc->PhysicalAddress.QuadPart;2384 pTransfer-> phDst =pDst->PhysicalAddress.QuadPart;2545 pTransfer->offSrc = (VBOXVIDEOOFFSET)pSrc->PhysicalAddress.QuadPart; 2546 pTransfer->offDst = (VBOXVIDEOOFFSET)pDst->PhysicalAddress.QuadPart; 2385 2547 vboxWddmSurfDescFromAllocation(pSrcAlloc, &pTransfer->srcDesc); 2386 2548 vboxWddmSurfDescFromAllocation(pDstAlloc, &pTransfer->dstDesc); -
trunk/src/VBox/Additions/WINNT/Graphics/Miniport/wddm/VBoxVideoWddm.h
r26667 r26767 67 67 { 68 68 VBOXWDDM_ALLOC_TYPE enmType; 69 PHYSICAL_ADDRESS phAddress;70 BOOLEAN bPagedIn;69 VBOXVIDEOOFFSET offVram; 70 UINT SegmentId; 71 71 union 72 72 {
Note:
See TracChangeset
for help on using the changeset viewer.