Changeset 26556 in vbox
- Timestamp:
- Feb 15, 2010 10:10:11 PM (15 years ago)
- svn:sync-xref-src-repo-rev:
- 57735
- Location:
- trunk
- Files:
-
- 4 added
- 11 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/include/VBox/HGSMI/HGSMI.h
r25062 r26556 258 258 void HGSMIAreaClear (HGSMIAREA *pArea); 259 259 260 DECLINLINE(bool) HGSMIAreaContainsOffset(HGSMIAREA *pArea, HGSMIOFFSET offSet) 261 { 262 return pArea->offBase <= offSet && pArea->offBase + pArea->cbArea < offSet; 263 } 264 260 265 HGSMIOFFSET HGSMIBufferInitializeSingle (const HGSMIAREA *pArea, 261 266 HGSMIBUFFERHEADER *pHeader, -
trunk/include/VBox/HGSMI/HGSMIChSetup.h
r22652 r26556 50 50 #define HGSMIHOSTFLAGS_COMMANDS_PENDING 0x1 51 51 #define HGSMIHOSTFLAGS_IRQ 0x2 52 #ifdef VBOXVDMA 53 /* one or more guest commands is completed */ 54 # define HGSMIHOSTFLAGS_GCOMMAND_COMPLETED 0x4 55 #endif 52 56 53 57 typedef struct _HGSMIHOSTFLAGS -
trunk/include/VBox/VBoxVideo.h
r26296 r26556 797 797 # define VBVA_VHWA_CMD 9 798 798 #endif /* # ifdef VBOX_WITH_VIDEOHWACCEL */ 799 #ifdef VBOXVDMA 800 # define VBVA_VDMA_CTL 10 /* setup G<->H DMA channel info */ 801 # define VBVA_VDMA_CMD 11 /* G->H DMA command */ 802 #endif 799 803 800 804 /* host->guest commands */ 801 # define VBVAHG_EVENT 1 802 # define VBVAHG_DISPLAY_CUSTOM 2 805 # define VBVAHG_EVENT 1 806 # define VBVAHG_DISPLAY_CUSTOM 2 807 #ifdef VBOXVDMA 808 # define VBVAHG_SHGSMI_COMPLETION 3 809 #endif 803 810 804 811 # ifdef VBOX_WITH_VIDEOHWACCEL … … 988 995 #endif /* VBOX_WITH_HGSMI */ 989 996 997 #ifdef VBOXVDMA 998 # pragma pack(1) 999 1000 /* 1001 * VBOXSHGSMI made on top HGSMI and allows receiving notifications 1002 * about G->H command completion 1003 */ 1004 /* SHGSMI command header */ 1005 typedef struct VBOXSHGSMIHEADER 1006 { 1007 uint64_t pvNext; /*<- completion processing queue */ 1008 uint32_t fFlags; /*<- see VBOXSHGSMI_FLAG_XXX Flags */ 1009 uint32_t cRefs; /*<- command referece count */ 1010 uint64_t u64Info1; /*<- contents depends on the fFlags value */ 1011 uint64_t u64Info2; /*<- contents depends on the fFlags value */ 1012 } VBOXSHGSMIHEADER, *PVBOXSHGSMIHEADER; 1013 1014 /* the command processing was asynch, set by the host to indicate asynch command completion 1015 * must not be cleared once set, the command completion is performed by issuing a host->guest completion command 1016 * while keeping this flag unchanged */ 1017 #define VBOXSHGSMI_FLAG_HG_ASYNCH 0x00010000 1018 ///* if set - asynch completion is performed by issuing the event, 1019 // * if cleared - asynch completion is performed by calling a callback */ 1020 //#define VBOXSHGSMI_FLAG_GH_ASYNCH_EVENT 0x00000001 1021 /* issue interrupt on asynch completion, used for critical G->H commands, 1022 * i.e. for completion of which guest is waiting. */ 1023 #define VBOXSHGSMI_FLAG_GH_ASYNCH_IRQ 0x00000002 1024 /* guest does not do any op on completion of this command, 1025 * the host may copy the command and indicate that it does not need the command anymore 1026 * by not setting VBOXSHGSMI_FLAG_HG_ASYNCH */ 1027 #define VBOXSHGSMI_FLAG_GH_ASYNCH_NOCOMPLETION 0x00000004 1028 /* guest requires the command to be processed asynchronously, 1029 * not setting VBOXSHGSMI_FLAG_HG_ASYNCH by the host in this case is treated as command failure */ 1030 #define VBOXSHGSMI_FLAG_GH_ASYNCH_FORCE 0x00000008 1031 /* force IRQ on cmd completion */ 1032 #define VBOXSHGSMI_FLAG_GH_ASYNCH_IRQ_FORCE 0x00000010 1033 /* an IRQ-level callback is associated with the command */ 1034 #define VBOXSHGSMI_FLAG_GH_ASYNCH_CALLBACK_IRQ 0x00000020 1035 /* guest expects this command to be completed synchronously */ 1036 #define VBOXSHGSMI_FLAG_GH_SYNCH 0x00000040 1037 1038 /* VDMA - Video DMA */ 1039 1040 /* VDMA Control API */ 1041 /* VBOXVDMA_CTL::u32Flags */ 1042 #define VBOXVDMA_CTL_NONE 0x00000000 1043 #define VBOXVDMA_CTL_ENABLE 0x00000001 1044 #define VBOXVDMA_CTL_DISABLE 0x00000002 1045 #define VBOXVDMA_CTL_FLUSH 0x00000004 1046 1047 typedef struct VBOXVDMA_CTL 1048 { 1049 uint32_t u32Flags; 1050 uint32_t u32Offset; 1051 int32_t i32Result; 1052 } VBOXVDMA_CTL, *PVBOXVDMA_CTL; 1053 1054 typedef struct VBOXVDMA_RECTL 1055 { 1056 int16_t left; 1057 int16_t top; 1058 uint16_t width; 1059 uint16_t height; 1060 } VBOXVDMA_RECTL, *PVBOXVDMA_RECTL; 1061 1062 //typedef uint64_t VBOXVDMAPHADDRESS; 1063 typedef uint64_t VBOXVDMASURFHANDLE; 1064 1065 typedef enum 1066 { 1067 VBOXVDMACMD_TYPE_UNDEFINED = 0, 1068 VBOXVDMACMD_TYPE_DMATRANSFER = 1 1069 } VBOXVDMACMD_TYPE; 1070 1071 /* region specified as a rectangle, otherwize it is a size of memory pointed to by phys address */ 1072 #define VBOXVDMAOPERAND_FLAGS_RECTL 0x1 1073 /* Surface handle is valid */ 1074 #define VBOXVDMAOPERAND_FLAGS_PRIMARY 0x2 1075 /* address is offset in VRAM */ 1076 #define VBOXVDMAOPERAND_FLAGS_VRAMOFFSET 0x4 1077 1078 typedef struct VBOXVDMA_RANGE_RECTL 1079 { 1080 VBOXVDMA_RECTL RangeRectl; 1081 VBOXVDMA_RECTL SurfSize; 1082 }VBOXVDMA_RANGE_RECTL, *PVBOXVDMA_RANGE_RECTL; 1083 1084 typedef struct VBOXVDMA_RANGE_SIZE 1085 { 1086 uint32_t cbSize; 1087 uint32_t u32Reserved; 1088 }VBOXVDMA_RANGE_SIZE, *PVBOXVDMA_RANGE_SIZE; 1089 1090 typedef struct VBOXVDMAOPERAND 1091 { 1092 uint32_t fFlags; 1093 union 1094 { 1095 /* for Src specifies num of Dsts */ 1096 uint32_t cDsts; 1097 /* for Dst specifies Screen ID in case VBOXVDMAOPERAND_FLAGS_PRIMARY flag is present in fFlags */ 1098 uint32_t iScreen; 1099 } Info; 1100 RTGCPHYS phAddress; 1101 union 1102 { 1103 VBOXVDMA_RANGE_RECTL Rectl; 1104 VBOXVDMA_RANGE_SIZE Size; 1105 } Range; 1106 } VBOXVDMAOPERAND, *PVBOXVDMAOPERAND; 1107 1108 /* VBOXVDMACBUF_DR::phBuf specifies offset in VRAM */ 1109 #define VBOXVDMACBUF_FLAG_BUF_VRAM_OFFSET 0x00000001 1110 /* command buffer follows the VBOXVDMACBUF_DR in VRAM, VBOXVDMACBUF_DR::phBuf is ignored */ 1111 #define VBOXVDMACBUF_FLAG_BUF_FOLLOWS_DR 0x00000002 1112 1113 /* 1114 * We can not submit the DMA command via VRAM since we do not have control over 1115 * DMA command buffer [de]allocation, i.e. we only control the buffer contents. 1116 * In other words the system may call one of our callbacks to fill a command buffer 1117 * with the necessary commands and then discard the buffer w/o any notification. 1118 * 1119 * We have only DMA command buffer physical address at submission time. 1120 * 1121 * so the only way is to */ 1122 typedef struct VBOXVDMACBUF_DR 1123 { 1124 uint32_t fFlags; 1125 uint32_t cbBuf; 1126 uint32_t u32FenceId; 1127 /* RT_SUCCESS() - on success 1128 * VERR_INTERRUPTED - on preemption 1129 * VERR_xxx - on error */ 1130 int32_t rc; 1131 uint64_t phBuf; 1132 } VBOXVDMACBUF_DR, *PVBOXVDMACBUF_DR; 1133 1134 #define VBOXVDMACBUF_DR_TAIL(_pCmd, _t) ( (_t)(((uint8_t*)(_pCmd)) + sizeof (VBOXVDMACBUF_DR)) ) 1135 1136 typedef struct VBOXVDMACMD 1137 { 1138 VBOXVDMACMD_TYPE enmType; 1139 uint32_t cbCmd; 1140 } VBOXVDMACMD, *PVBOXVDMACMD; 1141 1142 #define VBOXVDMACMD_HEADER_SIZE() sizeof (VBOXVDMACMD) 1143 #define VBOXVDMACMD_BODY_SIZE(_pCmd) ((_pCmd)->cbBody) 1144 #define VBOXVDMACMD_SIZE(_pCmd) (VBOXVDMACMD_HEADER_SIZE() + VBOXVDMACMD_BODY_SIZE(_pCmd)) 1145 #define VBOXVDMACMD_BODY(_pCmd, _t) ( (_t)(((uint8_t*)(_pCmd)) + VBOXVDMACMD_HEADER_SIZE()) ) 1146 1147 typedef struct VBOXVDMACMD_DMATRANSFER 1148 { 1149 VBOXVDMAOPERAND Src; 1150 /* the size of aDst is specified in Src::u32CmdSpecific*/ 1151 VBOXVDMAOPERAND aDst[1]; 1152 } VBOXVDMACMD_DMATRANSFER, *PVBOXVDMACMD_DMATRANSFER; 1153 # pragma pack() 1154 #endif /* #ifdef VBOXVDMA */ 1155 990 1156 #endif -
trunk/src/VBox/Additions/WINNT/Graphics/Miniport/Makefile.kmk
r26493 r26556 82 82 VBoxVideoWddm_NOINST = true 83 83 endif 84 84 85 VBoxVideoWddm_SDKS=WINDDKWLH 85 86 VBoxVideoWddm_DEFS += LOG_TO_BACKDOOR VBOX_WITH_8BPP_MODES 86 VBoxVideoWddm_DEFS += VBOX_WITH_HGSMI VBOXWDDM 87 VBoxVideoWddm_DEFS += VBOX_WITH_HGSMI VBOXWDDM VBOXVDMA 87 88 ifdef VBOX_WITH_VIDEOHWACCEL 88 89 VBoxVideoWddm_DEFS += VBOX_WITH_VIDEOHWACCEL … … 98 99 wddm/VBoxVideoWddm.cpp \ 99 100 wddm/VBoxVideoVidPn.cpp \ 101 wddm/VBoxVideoVdma.cpp \ 102 wddm/VBoxVideoShgsmi.cpp \ 100 103 wddm/VBoxVideoWddm.def \ 101 104 wddm/VBoxVideoWddm.rc -
trunk/src/VBox/Additions/WINNT/Graphics/Miniport/VBoxVideo.cpp
r26493 r26556 263 263 264 264 /* size of the VRAM in bytes */ 265 266 #ifndef VBOXWDDM 265 267 ULONG vramSize = DeviceExtension->pPrimary->u.primary.ulMaxFrameBufferSize; 266 267 gNumVideoModes = 0;268 #ifdef VBOXWDDM 268 #else 269 ULONG vramSize = vboxWddmVramReportedSize(DeviceExtension); 270 269 271 gPreferredVideoMode = 0; 270 272 #endif 273 274 gNumVideoModes = 0; 271 275 272 276 size_t numModesCurrentColorDepth; … … 751 755 || (gCustomXRes || gCustomYRes || gCustomBPP)) 752 756 { 757 #ifndef VBOXWDDM 753 758 dprintf(("VBoxVideo: adding custom video mode as #%d, current mode: %d \n", gNumVideoModes + 1, DeviceExtension->CurrentMode)); 754 759 /* handle the startup case */ 755 760 if (DeviceExtension->CurrentMode == 0) 761 #else 762 if (!DeviceExtension->cSources || !DeviceExtension->aSources[0].ulFrameBufferSize) 763 #endif 756 764 { 757 765 /* Use the stored custom resolution values only if nothing was read from host. … … 771 779 xres &= 0xfff8; 772 780 /* take the current values for the fields that are not set */ 781 #ifndef VBOXWDDM 773 782 if (DeviceExtension->CurrentMode != 0) 774 783 { … … 780 789 bpp = DeviceExtension->CurrentModeBPP; 781 790 } 791 #else 792 if (DeviceExtension->cSources && DeviceExtension->aSources[0].ulFrameBufferSize) 793 { 794 if (!xres) 795 xres = DeviceExtension->aSources[0].VisScreenWidth; 796 if (!yres) 797 yres = DeviceExtension->aSources[0].VisScreenHeight; 798 if (!bpp) 799 bpp = DeviceExtension->aSources[0].BitsPerPlane; 800 } 801 #endif 782 802 783 803 /* Use a default value. */ … … 801 821 { 802 822 /* we need an alternating index */ 823 #ifndef VBOXWDDM 803 824 if (DeviceExtension->CurrentMode != 0) 825 #else 826 if (DeviceExtension->cSources && DeviceExtension->aSources[0].ulFrameBufferSize) 827 #endif 804 828 { 805 829 if (gInvocationCounter % 2) … … 877 901 878 902 /* for the startup case, we need this mode twice due to the alternating mode number */ 903 #ifndef VBOXWDDM 879 904 if (DeviceExtension->CurrentMode == 0) 905 #else 906 if (!DeviceExtension->cSources || !DeviceExtension->aSources[0].ulFrameBufferSize) 907 #endif 880 908 { 881 909 dprintf(("VBoxVideo: making a copy of the custom mode as #%d\n", gNumVideoModes + 1)); … … 918 946 { 919 947 int i; 948 #ifndef VBOXWDDM 920 949 dprintf(("VBoxVideo: VideoModes (CurrentMode = %d)\n", DeviceExtension->CurrentMode)); 950 #endif 921 951 for (i=0; i<MAX_VIDEO_MODES + 2; i++) 922 952 { … … 965 995 } 966 996 967 #e ndif997 #else 968 998 969 999 /* Computes the size of a framebuffer. DualView has a few framebuffers of the computed size. */ … … 1033 1063 } 1034 1064 } 1065 1066 #endif 1035 1067 1036 1068 int VBoxMapAdapterMemory (PDEVICE_EXTENSION PrimaryExtension, void **ppv, ULONG ulOffset, ULONG ulSize) … … 1087 1119 VideoPortUnmapMemory(PrimaryExtension, *ppv, NULL); 1088 1120 #else 1089 MmUnmapIoSpace(*ppv, ulSize); 1121 NTSTATUS ntStatus = PrimaryExtension->u.primary.DxgkInterface.DxgkCbUnmapMemory(PrimaryExtension->u.primary.DxgkInterface.DeviceHandle, 1122 *ppv); 1123 Assert(ntStatus == STATUS_SUCCESS); 1090 1124 #endif 1091 1125 } … … 2430 2464 } 2431 2465 2432 #ifndef VBOXWDDM2433 2434 2466 /** 2435 2467 * VBoxVideoSetCurrentMode … … 2438 2470 */ 2439 2471 BOOLEAN FASTCALL VBoxVideoSetCurrentMode(PDEVICE_EXTENSION DeviceExtension, 2440 PVIDEO_MODE RequestedMode, PSTATUS_BLOCK StatusBlock) 2441 { 2472 #ifndef VBOXWDDM 2473 PVIDEO_MODE RequestedMode, PSTATUS_BLOCK StatusBlock 2474 #else 2475 D3DDDI_VIDEO_PRESENT_SOURCE_ID srcId, 2476 PVBOXWDDM_SOURCE ModeInfo 2477 #endif 2478 ) 2479 { 2480 #ifndef VBOXWDDM 2442 2481 PVIDEO_MODE_INFORMATION ModeInfo; 2443 2482 … … 2459 2498 return TRUE; 2460 2499 } 2500 #else 2501 Assert(!srcId); 2502 2503 if (srcId) 2504 { 2505 dprintf(("VBoxVideo::VBoxVideoSetCurrentMode: Skipping for ? non-primary ? source ? %d\n", 2506 srcId)); 2507 return TRUE; 2508 } 2509 #endif 2461 2510 2462 2511 /* set the mode characteristics */ … … 2481 2530 } 2482 2531 2532 #ifndef VBOXWDDM 2533 2483 2534 /* 2484 2535 * VBoxVideoResetDevice … … 2677 2728 return TRUE; 2678 2729 } 2730 2731 #ifndef VBOXWDDM 2679 2732 2680 2733 VP_STATUS VBoxVideoGetChildDescriptor( … … 2870 2923 return rc; 2871 2924 } 2925 #endif -
trunk/src/VBox/Additions/WINNT/Graphics/Miniport/VBoxVideo.h
r26505 r26556 117 117 #else 118 118 #include <VBox/VBoxVideo.h> 119 #include "wddm/VBoxVideoShgsmi.h" 120 #include "wddm/VBoxVideoVdma.h" 119 121 120 122 typedef KSPIN_LOCK VBOXVCMNSPIN_LOCK, *PVBOXVCMNSPIN_LOCK; … … 125 127 typedef HANDLE VBOXCMNREG; 126 128 127 typedef enum128 {129 VBOXWDDM_CMD_UNEFINED = 0,130 VBOXWDDM_CMD_DMA_TRANSFER131 } VBOXWDDM_CMD_TYPE;132 133 129 typedef struct VBOXWDDM_SOURCE 134 130 { 135 HGSMIHEAP hgsmiDisplayHeap; 136 // VBVABUFFER *pVBVA; /* Pointer to the pjScreen + layout->offVBVABuffer. NULL if VBVA is not enabled. */ 131 ULONG VisScreenWidth; 132 ULONG VisScreenHeight; 133 ULONG BitsPerPlane; 134 135 ULONG ulFrameBufferOffset; /* The framebuffer position in the VRAM. */ 136 ULONG ulFrameBufferSize; /* The size of the current framebuffer. */ 137 137 } VBOXWDDM_SOURCE, *PVBOXWDDM_SOURCE; 138 138 … … 211 211 DXGK_DEVICEINFO DeviceInfo; 212 212 } VBOXWDDM_DEVICE, *PVBOXWDDM_DEVICE; 213 214 213 #endif 215 214 … … 219 218 * The primary extension is the first one. 220 219 */ 221 220 #ifndef VBOXWDDM 222 221 struct _DEVICE_EXTENSION *pPrimary; /* Pointer to the primary device extension. */ 223 222 224 223 ULONG iDevice; /* Device index: 0 for primary, otherwise a secondary device. */ 225 226 224 227 225 ULONG CurrentMode; /* Saved information about video modes */ … … 232 230 ULONG ulFrameBufferOffset; /* The framebuffer position in the VRAM. */ 233 231 ULONG ulFrameBufferSize; /* The size of the current framebuffer. */ 234 232 #endif 235 233 union { 236 234 /* Information that is only relevant to the primary device or is the same for all devices. */ … … 258 256 * This is mapped by miniport separately. 259 257 */ 258 #ifdef VBOXWDDM 259 VBOXVDMAINFO Vdma; 260 #endif 261 260 262 #ifdef VBOX_WITH_HGSMI 261 263 volatile HGSMIHOSTFLAGS * pHostFlags; /* HGSMI host flags */ … … 315 317 PDEVICE_OBJECT pPDO; 316 318 319 VBOXSHGSMILIST CtlList; 320 VBOXSHGSMILIST DmaCmdList; 321 BOOL bSetNotifyDxDpc; 322 BOOL bNotifyDxDpc; 323 317 324 ULONG cSources; 318 325 /* currently we define the array for the max possible size since we do not know … … 326 333 } DEVICE_EXTENSION, *PDEVICE_EXTENSION; 327 334 335 #ifndef VBOXWDDM 328 336 #define DEV_MOUSE_HIDDEN(dev) ((dev)->pPrimary->u.primary.fMouseHidden) 329 337 #define DEV_SET_MOUSE_HIDDEN(dev) \ … … 335 343 (dev)->pPrimary->u.primary.fMouseHidden = FALSE; \ 336 344 } while (0) 337 345 #else 346 #define DEV_MOUSE_HIDDEN(dev) ((dev)->u.primary.fMouseHidden) 347 #define DEV_SET_MOUSE_HIDDEN(dev) \ 348 do { \ 349 (dev)->u.primary.fMouseHidden = TRUE; \ 350 } while (0) 351 #define DEV_SET_MOUSE_SHOWN(dev) \ 352 do { \ 353 (dev)->u.primary.fMouseHidden = FALSE; \ 354 } while (0) 355 #endif 338 356 extern "C" 339 357 { … … 626 644 VOID VBoxWddmGetModesTable(PDEVICE_EXTENSION DeviceExtension, bool bRebuildTable, 627 645 VIDEO_MODE_INFORMATION ** ppModes, uint32_t * pcModes, uint32_t * pPreferrableMode, 628 D3DKMDT_2DREGION **p Resolutions, uint32_t * pcResolutions);646 D3DKMDT_2DREGION **ppResolutions, uint32_t * pcResolutions); 629 647 630 648 D3DDDIFORMAT vboxWddmCalcPixelFormat(VIDEO_MODE_INFORMATION *pInfo); 631 649 UINT vboxWddmCalcBitsPerPixel(D3DDDIFORMAT format); 650 651 DECLINLINE(ULONG) vboxWddmVramReportedSize(PDEVICE_EXTENSION pDevExt) 652 { 653 return pDevExt->u.primary.Vdma.CmdHeap.area.offBase; 654 } 632 655 633 656 NTSTATUS vboxVidPnCheckTopology(const D3DKMDT_HVIDPN hDesiredVidPn, … … 764 787 DECLINLINE(void) VBoxHGSMIHostWrite(PDEVICE_EXTENSION PrimaryExtension, ULONG data) 765 788 { 789 #ifndef VBOXWDDM 766 790 VBoxVideoCmnPortWriteUlong((PULONG)PrimaryExtension->pPrimary->u.primary.IOPortHost, data); 791 #else 792 VBoxVideoCmnPortWriteUlong((PULONG)PrimaryExtension->u.primary.IOPortHost, data); 793 #endif 767 794 } 768 795 769 796 DECLINLINE(ULONG) VBoxHGSMIHostRead(PDEVICE_EXTENSION PrimaryExtension) 770 797 { 798 #ifndef VBOXWDDM 771 799 return VBoxVideoCmnPortReadUlong((PULONG)PrimaryExtension->pPrimary->u.primary.IOPortHost); 800 #else 801 return VBoxVideoCmnPortReadUlong((PULONG)PrimaryExtension->u.primary.IOPortHost); 802 #endif 772 803 } 773 804 774 805 DECLINLINE(void) VBoxHGSMIGuestWrite(PDEVICE_EXTENSION PrimaryExtension, ULONG data) 775 806 { 807 #ifndef VBOXWDDM 776 808 VBoxVideoCmnPortWriteUlong((PULONG)PrimaryExtension->pPrimary->u.primary.IOPortGuest, data); 809 #else 810 VBoxVideoCmnPortWriteUlong((PULONG)PrimaryExtension->u.primary.IOPortGuest, data); 811 #endif 777 812 } 778 813 779 814 DECLINLINE(ULONG) VBoxHGSMIGuestRead(PDEVICE_EXTENSION PrimaryExtension) 780 815 { 816 #ifndef VBOXWDDM 781 817 return VBoxVideoCmnPortReadUlong((PULONG)PrimaryExtension->pPrimary->u.primary.IOPortGuest); 818 #else 819 return VBoxVideoCmnPortReadUlong((PULONG)PrimaryExtension->u.primary.IOPortGuest); 820 #endif 782 821 } 783 822 … … 792 831 PVIDEO_POINTER_ATTRIBUTES pointerAttr, 793 832 uint32_t cbLength); 833 #ifndef VBOXWDDM 794 834 DECLCALLBACK(void) hgsmiHostCmdComplete (HVBOXVIDEOHGSMI hHGSMI, struct _VBVAHOSTCMD * pCmd); 795 835 DECLCALLBACK(int) hgsmiHostCmdRequest (HVBOXVIDEOHGSMI hHGSMI, uint8_t u8Channel, struct _VBVAHOSTCMD ** ppCmd); 836 #endif 796 837 797 838 -
trunk/src/VBox/Additions/WINNT/Graphics/Miniport/VBoxVideoHGSMI.cpp
r26505 r26556 186 186 typedef FNHGSMICALLFINALIZE *PFNHGSMICALLFINALIZE; 187 187 188 void* VBoxHGSMIBufferAlloc (PDEVICE_EXTENSION PrimaryExtension, 189 HGSMISIZE cbData, 190 uint8_t u8Ch, 191 uint16_t u16Op) 192 { 193 #ifdef VBOXWDDM 194 /* @todo: add synchronization */ 195 #endif 196 return HGSMIHeapAlloc (&PrimaryExtension->u.primary.hgsmiAdapterHeap, cbData, u8Ch, u16Op); 197 } 198 199 void* VBoxHGSMIBufferAlloc (PDEVICE_EXTENSION PrimaryExtension, 200 uint8_t u8Ch, 201 uint16_t u16Op, 202 HGSMISIZE cbData) 203 { 204 #ifdef VBOXWDDM 205 /* @todo: add synchronization */ 206 #endif 207 return HGSMIHeapAlloc (&PrimaryExtension->u.primary.hgsmiAdapterHeap, cbData, u8Ch, u16Op); 208 } 209 210 void VBoxHGSMIBufferFree (PDEVICE_EXTENSION PrimaryExtension, void *pvBuffer) 211 { 212 #ifdef VBOXWDDM 213 /* @todo: add synchronization */ 214 #endif 215 HGSMIHeapFree (&PrimaryExtension->u.primary.hgsmiAdapterHeap, pvBuffer); 216 } 217 218 int VBoxHGSMIBufferSubmit (PDEVICE_EXTENSION PrimaryExtension, void *pvBuffer) 219 { 220 /* Initialize the buffer and get the offset for port IO. */ 221 HGSMIOFFSET offBuffer = HGSMIHeapBufferOffset (&PrimaryExtension->u.primary.hgsmiAdapterHeap, pvBuffer); 222 223 Assert(offBuffer != HGSMIOFFSET_VOID); 224 if (offBuffer != HGSMIOFFSET_VOID) 225 { 226 /* Submit the buffer to the host. */ 227 VBoxHGSMIGuestWrite(PrimaryExtension, offBuffer); 228 return VINF_SUCCESS; 229 } 230 231 return VERR_INVALID_PARAMETER; 232 } 233 188 234 static int vboxCallChannel (PDEVICE_EXTENSION PrimaryExtension, 189 235 uint8_t u8Ch, … … 197 243 198 244 /* Allocate the IO buffer. */ 245 #ifndef VBOXWDDM 199 246 if (PrimaryExtension->pPrimary != PrimaryExtension) 200 247 { … … 202 249 return VERR_INVALID_PARAMETER; 203 250 } 251 #endif 204 252 205 253 void *p = HGSMIHeapAlloc (&PrimaryExtension->u.primary.hgsmiAdapterHeap, cbData, u8Ch, u16Op); … … 315 363 return rc; 316 364 } 317 365 #ifndef VBOXWDDM 318 366 static int vbvaInitInfoDisplay (PDEVICE_EXTENSION PrimaryExtension, void *pvContext, void *pvData) 319 367 { … … 348 396 return VERR_INTERNAL_ERROR; 349 397 } 398 #endif 350 399 351 400 static int vbvaInitInfoHeap (PDEVICE_EXTENSION PrimaryExtension, void *pvContext, void *pvData) … … 389 438 if(RT_SUCCESS (rc)) 390 439 { 440 #ifndef VBOXWDDM 391 441 rc = vboxCallVBVA (PrimaryExtension, 392 442 VBVA_INFO_VIEW, … … 397 447 AssertRC(rc); 398 448 if (RT_SUCCESS (rc)) 449 #else 450 /* in case of WDDM we do not control the framebuffer location, 451 * i.e. it is assigned by Video Memory Manager, 452 * The FB information should be passed to guest from our DxgkDdiSetVidPnSourceAddress callback */ 453 #endif 399 454 { 400 455 /* Report the host heap location. */ … … 660 715 */ 661 716 PrimaryExtension->pNext = NULL; 717 #ifndef VBOXWDDM 662 718 PrimaryExtension->pPrimary = PrimaryExtension; 663 719 PrimaryExtension->iDevice = 0; 664 720 PrimaryExtension->ulFrameBufferOffset = 0; 665 721 PrimaryExtension->ulFrameBufferSize = 0; 722 #endif 666 723 PrimaryExtension->u.primary.ulVbvaEnabled = 0; 667 724 PrimaryExtension->u.primary.bVBoxVideoSupported = FALSE; … … 861 918 } 862 919 920 #ifndef VBOXWDDM 863 921 /* Now when the number of monitors is known and extensions are created, 864 922 * calculate the layout of framebuffers. 865 923 */ 866 924 VBoxComputeFrameBufferSizes (PrimaryExtension); 925 #endif 867 926 868 927 if (PrimaryExtension->u.primary.bHGSMI) … … 876 935 } 877 936 } 937 938 #ifdef VBOXWDDM 939 if (PrimaryExtension->u.primary.bHGSMI) 940 { 941 ULONG ulAvailable = PrimaryExtension->u.primary.cbVRAM 942 - PrimaryExtension->u.primary.cbMiniportHeap 943 - VBVA_ADAPTER_INFORMATION_SIZE; 944 945 /* use 25% od VRAM for DMA command buffer 946 * @todo: ^^^? */ 947 ULONG ulSize = ulAvailable / 4; 948 949 /* Align down to 4096 bytes. */ 950 ulSize &= ~0xFFF; 951 ULONG offset = ulAvailable - ulSize; 952 953 Assert(!(offset & 0xFFF)); 954 955 rc = vboxVdmaCreate (PrimaryExtension, &PrimaryExtension->u.primary.Vdma, offset, ulSize); 956 AssertRC(rc); 957 if (RT_SUCCESS(rc)) 958 { 959 /* can enable it right away since the host does not need any screen/FB info 960 * for basic DMA functionality */ 961 rc = vboxVdmaEnable(PrimaryExtension, &PrimaryExtension->u.primary.Vdma); 962 AssertRC(rc); 963 if (RT_FAILURE(rc)) 964 vboxVdmaDestroy(PrimaryExtension, &PrimaryExtension->u.primary.Vdma); 965 } 966 967 if (RT_FAILURE(rc)) 968 PrimaryExtension->u.primary.bHGSMI = FALSE; 969 } 970 #endif 878 971 879 972 if (!PrimaryExtension->u.primary.bHGSMI) … … 953 1046 uint32_t cbLength) 954 1047 { 1048 #ifndef VBOXWDDM 955 1049 PDEVICE_EXTENSION PrimaryExtension = DeviceExtension->pPrimary; 956 1050 … … 977 1071 return TRUE; 978 1072 } 1073 #else 1074 PDEVICE_EXTENSION PrimaryExtension = DeviceExtension; 1075 #endif 979 1076 980 1077 uint32_t cbData = 0; … … 1116 1213 } 1117 1214 1215 #ifndef VBOXWDDM 1118 1216 DECLCALLBACK(void) hgsmiHostCmdComplete (HVBOXVIDEOHGSMI hHGSMI, struct _VBVAHOSTCMD * pCmd) 1119 1217 { … … 1164 1262 return VERR_INVALID_PARAMETER; 1165 1263 } 1264 #endif 1166 1265 1167 1266 static DECLCALLBACK(int) vboxVBVAChannelGenericHandler(void *pvHandler, uint16_t u16ChannelInfo, void *pvBuffer, HGSMISIZE cbBuffer) -
trunk/src/VBox/Additions/WINNT/Graphics/Miniport/wddm/VBoxVideoVidPn.cpp
r26324 r26556 508 508 pNewVidPnTargetModeInfo->VideoSignalInfo.VSyncFreq.Numerator = 60000; 509 509 pNewVidPnTargetModeInfo->VideoSignalInfo.VSyncFreq.Denominator = 1000; 510 pNewVidPnTargetModeInfo->VideoSignalInfo.HSyncFreq.Numerator = pNewVidPnTargetModeInfo->VideoSignalInfo.ActiveSize.cy * 6 0 * 1.05;510 pNewVidPnTargetModeInfo->VideoSignalInfo.HSyncFreq.Numerator = pNewVidPnTargetModeInfo->VideoSignalInfo.ActiveSize.cy * 63; /* 63 is (60 * 1.05)*/ 511 511 pNewVidPnTargetModeInfo->VideoSignalInfo.HSyncFreq.Denominator = 1; 512 512 pNewVidPnTargetModeInfo->VideoSignalInfo.PixelRate = 165000; /* @todo: ? */ … … 543 543 if (Status == STATUS_SUCCESS) 544 544 { 545 if ( iPreferredMomde == i)545 if (bPreferred) 546 546 { 547 547 Status = pNewVidPnTargetModeSetInterface->pfnPinMode(hNewVidPnTargetModeSet, modeId); -
trunk/src/VBox/Additions/WINNT/Graphics/Miniport/wddm/VBoxVideoWddm.cpp
r26324 r26556 39 39 ExFreePool(pvMem); 40 40 } 41 42 void vboxSHGSMICbCommandWrite(struct _HGSMIHEAP * pHeap, HGSMIOFFSET data) 43 { 44 /* @todo: this should be taken from PDEVICE_EXTENSION */ 45 //VBoxHGSMIGuestWrite(pDevExt, data); 46 VBoxVideoCmnPortWriteUlong((PULONG)VGA_PORT_HGSMI_GUEST, data); 47 } 48 49 #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 else 64 { 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 86 NTSTATUS vboxWddmGhInitPrimary(PDEVICE_EXTENSION pDevExt, D3DDDI_VIDEO_PRESENT_SOURCE_ID srcId, D3DKMDT_VIDPN_SOURCE_MODE *pVidPnSourceModeInfo) 87 { 88 NTSTATUS Status; 89 PVBOXWDDM_SOURCE pSourceInfo = &pDevExt->aSources[srcId]; 90 memset(pSourceInfo, 0, sizeof (VBOXWDDM_SOURCE)); 91 pSourceInfo->VisScreenWidth = pVidPnSourceModeInfo->Format.Graphics.PrimSurfSize.cx; 92 pSourceInfo->VisScreenHeight = pVidPnSourceModeInfo->Format.Graphics.PrimSurfSize.cy; 93 pSourceInfo->BitsPerPlane = vboxWddmCalcBitsPerPixel(pVidPnSourceModeInfo->Format.Graphics.PixelFormat); 94 Assert(pSourceInfo->BitsPerPlane); 95 if (pSourceInfo->BitsPerPlane) 96 { 97 /* 98 * Set the current mode into the hardware. 99 */ 100 if (VBoxVideoSetCurrentMode(pDevExt, srcId, pSourceInfo)) 101 { 102 103 104 } 105 else 106 { 107 AssertBreakpoint(); 108 109 } 110 } 111 else 112 { 113 drprintf((__FUNCTION__":ERROR: failed to caltulate bpp from pixel format (%d)\n", 114 pVidPnSourceModeInfo->Format.Graphics.PixelFormat)); 115 return STATUS_INVALID_PARAMETER; 116 } 117 118 return Status; 119 120 121 122 // DWORD returnedDataLength; 123 // DWORD MaxWidth, MaxHeight; 124 // VIDEO_MEMORY videoMemory; 125 // VIDEO_MEMORY_INFORMATION videoMemoryInformation; 126 // ULONG RemappingNeeded = 0; 127 128 129 /* 130 * don't need to map anything here, we use one common HGSMI heap for all sources 131 */ 132 133 // If this is the first time we enable the surface we need to map in the 134 // memory also. 135 // 136 137 if (bFirst || RemappingNeeded) 138 { 139 // videoMemory.RequestedVirtualAddress = NULL; 140 // 141 // if (EngDeviceIoControl(ppdev->hDriver, 142 // IOCTL_VIDEO_MAP_VIDEO_MEMORY, 143 // &videoMemory, 144 // sizeof(VIDEO_MEMORY), 145 // &videoMemoryInformation, 146 // sizeof(VIDEO_MEMORY_INFORMATION), 147 // &returnedDataLength)) 148 // { 149 // DISPDBG((1, "DISP bInitSURF failed IOCTL_VIDEO_MAP\n")); 150 // return(FALSE); 151 // } 152 // 153 // ppdev->pjScreen = (PBYTE)(videoMemoryInformation.FrameBufferBase); 154 // 155 // if (videoMemoryInformation.FrameBufferBase != 156 // videoMemoryInformation.VideoRamBase) 157 // { 158 // DISPDBG((0, "VideoRamBase does not correspond to FrameBufferBase\n")); 159 // } 160 // 161 // // 162 // // Make sure we can access this video memory 163 // // 164 // 165 // *(PULONG)(ppdev->pjScreen) = 0xaa55aa55; 166 // 167 // if (*(PULONG)(ppdev->pjScreen) != 0xaa55aa55) { 168 // 169 // DISPDBG((1, "Frame buffer memory is not accessible.\n")); 170 // return(FALSE); 171 // } 172 // 173 // /* Clear VRAM to avoid distortions during the video mode change. */ 174 // RtlZeroMemory(ppdev->pjScreen, 175 // ppdev->cyScreen * (ppdev->lDeltaScreen > 0? ppdev->lDeltaScreen: -ppdev->lDeltaScreen)); 176 // 177 // // 178 // // Initialize the head of the offscreen list to NULL. 179 // // 180 // 181 // ppdev->pOffscreenList = NULL; 182 // 183 // // It's a hardware pointer; set up pointer attributes. 184 // 185 // MaxHeight = ppdev->PointerCapabilities.MaxHeight; 186 // 187 // // Allocate space for two DIBs (data/mask) for the pointer. If this 188 // // device supports a color Pointer, we will allocate a larger bitmap. 189 // // If this is a color bitmap we allocate for the largest possible 190 // // bitmap because we have no idea of what the pixel depth might be. 191 // 192 // // Width rounded up to nearest byte multiple 193 // 194 // if (!(ppdev->PointerCapabilities.Flags & VIDEO_MODE_COLOR_POINTER)) 195 // { 196 // MaxWidth = (ppdev->PointerCapabilities.MaxWidth + 7) / 8; 197 // } 198 // else 199 // { 200 // MaxWidth = ppdev->PointerCapabilities.MaxWidth * sizeof(DWORD); 201 // } 202 // 203 // ppdev->cjPointerAttributes = 204 // sizeof(VIDEO_POINTER_ATTRIBUTES) + 205 // ((sizeof(UCHAR) * MaxWidth * MaxHeight) * 2); 206 // 207 // ppdev->pPointerAttributes = (PVIDEO_POINTER_ATTRIBUTES) 208 // EngAllocMem(0, ppdev->cjPointerAttributes, ALLOC_TAG); 209 // 210 // if (ppdev->pPointerAttributes == NULL) { 211 // 212 // DISPDBG((0, "bInitPointer EngAllocMem failed\n")); 213 // return(FALSE); 214 // } 215 // 216 // ppdev->pPointerAttributes->Flags = ppdev->PointerCapabilities.Flags; 217 // ppdev->pPointerAttributes->WidthInBytes = MaxWidth; 218 // ppdev->pPointerAttributes->Width = ppdev->PointerCapabilities.MaxWidth; 219 // ppdev->pPointerAttributes->Height = MaxHeight; 220 // ppdev->pPointerAttributes->Column = 0; 221 // ppdev->pPointerAttributes->Row = 0; 222 // ppdev->pPointerAttributes->Enable = 0; 223 224 vboxInitVBoxVideo (ppdev, &videoMemoryInformation); 225 226 #ifndef VBOX_WITH_HGSMI 227 if (ppdev->bVBoxVideoSupported) 228 { 229 /* Setup the display information. */ 230 vboxSetupDisplayInfo (ppdev, &videoMemoryInformation); 231 } 232 #endif /* !VBOX_WITH_HGSMI */ 233 } 234 235 236 DISPDBG((1, "DISP bInitSURF: ppdev->ulBitCount %d\n", ppdev->ulBitCount)); 237 238 if ( ppdev->ulBitCount == 16 239 || ppdev->ulBitCount == 24 240 || ppdev->ulBitCount == 32) 241 { 242 #ifndef VBOX_WITH_HGSMI 243 if (ppdev->pInfo) /* Do not use VBVA on old hosts. */ 244 { 245 /* Enable VBVA for this video mode. */ 246 vboxVbvaEnable (ppdev); 247 } 248 #else 249 if (ppdev->bHGSMISupported) 250 { 251 /* Enable VBVA for this video mode. */ 252 ppdev->bHGSMISupported = vboxVbvaEnable (ppdev); 253 LogRel(("VBoxDisp[%d]: VBVA %senabled\n", ppdev->iDevice, ppdev->bHGSMISupported? "": "not ")); 254 } 255 #endif /* VBOX_WITH_HGSMI */ 256 } 257 258 DISPDBG((1, "DISP bInitSURF success\n")); 259 260 #ifndef VBOX_WITH_HGSMI 261 /* Update the display information. */ 262 vboxUpdateDisplayInfo (ppdev); 263 #else 264 /* Inform the host about this screen layout. */ 265 DISPDBG((1, "bInitSURF: %d,%d\n", ppdev->ptlDevOrg.x, ppdev->ptlDevOrg.y)); 266 VBoxProcessDisplayInfo (ppdev); 267 #endif /* VBOX_WITH_HGSMI */ 268 269 #ifdef VBOX_WITH_VIDEOHWACCEL 270 /* tells we can process host commands */ 271 vboxVHWAEnable(ppdev); 272 #endif 273 274 return(TRUE); 275 } 276 #endif 277 278 HGSMIHEAP* vboxWddmHgsmiGetHeapFromCmdOffset(PDEVICE_EXTENSION pDevExt, HGSMIOFFSET offCmd) 279 { 280 if(HGSMIAreaContainsOffset(&pDevExt->u.primary.Vdma.CmdHeap.area, offCmd)) 281 return &pDevExt->u.primary.Vdma.CmdHeap; 282 if (HGSMIAreaContainsOffset(&pDevExt->u.primary.hgsmiAdapterHeap.area, offCmd)) 283 return &pDevExt->u.primary.hgsmiAdapterHeap; 284 return NULL; 285 } 286 287 typedef enum 288 { 289 VBOXWDDM_HGSMICMD_TYPE_UNDEFINED = 0, 290 VBOXWDDM_HGSMICMD_TYPE_CTL = 1, 291 VBOXWDDM_HGSMICMD_TYPE_DMACMD = 2 292 } VBOXWDDM_HGSMICMD_TYPE; 293 294 VBOXWDDM_HGSMICMD_TYPE vboxWddmHgsmiGetCmdTypeFromOffset(PDEVICE_EXTENSION pDevExt, HGSMIOFFSET offCmd) 295 { 296 if(HGSMIAreaContainsOffset(&pDevExt->u.primary.Vdma.CmdHeap.area, offCmd)) 297 return VBOXWDDM_HGSMICMD_TYPE_DMACMD; 298 if (HGSMIAreaContainsOffset(&pDevExt->u.primary.hgsmiAdapterHeap.area, offCmd)) 299 return VBOXWDDM_HGSMICMD_TYPE_CTL; 300 return VBOXWDDM_HGSMICMD_TYPE_UNDEFINED; 301 } 302 41 303 42 304 #define VBOXWDDM_REG_DRVKEY_PREFIX L"\\Registry\\Machine\\System\\CurrentControlSet\\Control\\Class\\" … … 491 753 ) 492 754 { 493 return false; 755 PDEVICE_EXTENSION pDevExt = (PDEVICE_EXTENSION)MiniportDeviceContext; 756 BOOLEAN bOur = FALSE; 757 if (pDevExt->u.primary.pHostFlags) /* If HGSMI is enabled at all. */ 758 { 759 VBOXSHGSMILIST CtlList; 760 VBOXSHGSMILIST DmaCmdList; 761 vboxSHGSMIListInit(&CtlList); 762 vboxSHGSMIListInit(&DmaCmdList); 763 do 764 { 765 uint32_t flags = pDevExt->u.primary.pHostFlags->u32HostFlags; 766 if (flags & HGSMIHOSTFLAGS_GCOMMAND_COMPLETED) 767 { 768 bOur = TRUE; 769 /* read the command offset */ 770 HGSMIOFFSET offCmd = VBoxHGSMIGuestRead(pDevExt); 771 Assert(offCmd != HGSMIOFFSET_VOID); 772 if (offCmd != HGSMIOFFSET_VOID) 773 { 774 VBOXWDDM_HGSMICMD_TYPE enmType = vboxWddmHgsmiGetCmdTypeFromOffset(pDevExt, offCmd); 775 PVBOXSHGSMILIST pList; 776 HGSMIHEAP * pHeap = NULL; 777 switch (enmType) 778 { 779 case VBOXWDDM_HGSMICMD_TYPE_DMACMD: 780 pList = &DmaCmdList; 781 pHeap = &pDevExt->u.primary.Vdma.CmdHeap; 782 break; 783 case VBOXWDDM_HGSMICMD_TYPE_CTL: 784 pList = &CtlList; 785 pHeap = &pDevExt->u.primary.hgsmiAdapterHeap; 786 break; 787 default: 788 AssertBreakpoint(); 789 } 790 791 if (pHeap) 792 { 793 int rc = VBoxSHGSMICommandProcessCompletion (pHeap, offCmd, TRUE /*bool bIrq*/ , pList); 794 AssertRC(rc); 795 } 796 } 797 } 798 else if (flags & HGSMIHOSTFLAGS_COMMANDS_PENDING) 799 { 800 bOur = TRUE; 801 AssertBreakpoint(); 802 /* @todo: FIXME: implement !!! */ 803 } 804 else if (flags & HGSMIHOSTFLAGS_IRQ) 805 { 806 bOur = TRUE; 807 AssertBreakpoint(); 808 /* unknown command */ 809 } 810 else 811 break; 812 } while (1); 813 814 if (!vboxSHGSMIListIsEmpty(&CtlList)) 815 vboxSHGSMIListCat(&pDevExt->CtlList, &CtlList); 816 817 if (!vboxSHGSMIListIsEmpty(&DmaCmdList)) 818 vboxSHGSMIListCat(&pDevExt->DmaCmdList, &DmaCmdList); 819 820 if (pDevExt->bSetNotifyDxDpc) 821 { 822 pDevExt->bNotifyDxDpc = TRUE; 823 pDevExt->bSetNotifyDxDpc = FALSE; 824 } 825 826 if (bOur) 827 HGSMIClearIrq (pDevExt); 828 } 829 830 return bOur; 831 } 832 833 834 typedef struct VBOXWDDM_DPCDATA 835 { 836 VBOXSHGSMILIST CtlList; 837 VBOXSHGSMILIST DmaCmdList; 838 BOOL bNotifyDpc; 839 } VBOXWDDM_DPCDATA, *PVBOXWDDM_DPCDATA; 840 841 typedef struct VBOXWDDM_GETDPCDATA_CONTEXT 842 { 843 PDEVICE_EXTENSION pDevExt; 844 VBOXWDDM_DPCDATA data; 845 } VBOXWDDM_GETDPCDATA_CONTEXT, *PVBOXWDDM_GETDPCDATA_CONTEXT; 846 847 BOOLEAN vboxWddmGetDPCDataCallback(PVOID Context) 848 { 849 PVBOXWDDM_GETDPCDATA_CONTEXT pdc = (PVBOXWDDM_GETDPCDATA_CONTEXT)Context; 850 851 vboxSHGSMICmdListDetach2List(&pdc->pDevExt->CtlList, &pdc->data.CtlList); 852 vboxSHGSMICmdListDetach2List(&pdc->pDevExt->DmaCmdList, &pdc->data.DmaCmdList); 853 pdc->data.bNotifyDpc = pdc->pDevExt->bNotifyDxDpc; 854 pdc->pDevExt->bNotifyDxDpc = FALSE; 855 return TRUE; 494 856 } 495 857 … … 498 860 ) 499 861 { 500 862 PDEVICE_EXTENSION pDevExt = (PDEVICE_EXTENSION)MiniportDeviceContext; 863 864 VBOXWDDM_DPCDATA dpcData = {0}; 865 BOOLEAN bRet; 866 867 /* get DPC data at IRQL */ 868 NTSTATUS Status = pDevExt->u.primary.DxgkInterface.DxgkCbSynchronizeExecution( 869 pDevExt->u.primary.DxgkInterface.DeviceHandle, 870 vboxWddmGetDPCDataCallback, 871 &dpcData, 872 0, 873 &bRet); 874 Assert(Status == STATUS_SUCCESS); 875 876 if (!vboxSHGSMIListIsEmpty(&dpcData.CtlList)) 877 { 878 int rc = VBoxSHGSMICommandPostprocessCompletion (&pDevExt->u.primary.hgsmiAdapterHeap, &dpcData.CtlList); 879 AssertRC(rc); 880 } 881 882 if (!vboxSHGSMIListIsEmpty(&dpcData.DmaCmdList)) 883 { 884 int rc = VBoxSHGSMICommandPostprocessCompletion (&pDevExt->u.primary.Vdma.CmdHeap, &dpcData.DmaCmdList); 885 AssertRC(rc); 886 } 887 888 if (dpcData.bNotifyDpc) 889 pDevExt->u.primary.DxgkInterface.DxgkCbNotifyDpc(pDevExt->u.primary.DxgkInterface.DeviceHandle); 501 890 } 502 891 … … 976 1365 } 977 1366 1367 /** 1368 * 1369 */ 978 1370 NTSTATUS 979 1371 APIENTRY … … 1507 1899 VBOXVIDPNCOFUNCMODALITY CbContext = {0}; 1508 1900 CbContext.pEnumCofuncModalityArg = pEnumCofuncModalityArg; 1509 VBoxWddmGetModesTable(pContext, true, &CbContext.pModes, &CbContext.cModes, &CbContext.iPreferredMode, &CbContext.cResolutions, &CbContext.pResolutions); 1901 VBoxWddmGetModesTable(pContext, /* PDEVICE_EXTENSION DeviceExtension */ 1902 true, /* bool bRebuildTable*/ 1903 &CbContext.pModes, /* VIDEO_MODE_INFORMATION ** ppModes*/ 1904 &CbContext.cModes, /* uint32_t * pcModes */ 1905 &CbContext.iPreferredMode, /* uint32_t * pPreferrableMode*/ 1906 &CbContext.pResolutions, /* D3DKMDT_2DREGION **ppResolutions */ 1907 &CbContext.cResolutions /* uint32_t * pcResolutions */); 1510 1908 Assert(CbContext.cModes); 1511 1909 Assert(CbContext.cModes > CbContext.iPreferredMode); -
trunk/src/VBox/Devices/Graphics/HGSMI/HGSMIHost.cpp
r25226 r26556 152 152 HGSMILIST hostFIFOProcessed; /* Processed by the guest. */ 153 153 HGSMILIST hostFIFOFree; /* Buffers for reuse. */ 154 #ifdef VBOXVDMA 155 HGSMILIST guestCmdCompleted; /* list of completed guest commands to be returned to the guest*/ 156 #endif 154 157 RTCRITSECT hostFIFOCritSect; /* FIFO serialization lock. */ 155 158 … … 198 201 #define HGSMILISTENTRY_2_FIFOENTRY(_pe) \ 199 202 ( (HGSMIHOSTFIFOENTRY*)((uint8_t *)(_pe) - RT_OFFSETOF(HGSMIHOSTFIFOENTRY, entry)) ) 203 200 204 //AssertCompile(RT_OFFSETOF(HGSMIHOSTFIFOENTRY, entry) == 0); 201 205 … … 209 213 210 214 static DECLCALLBACK(void) hgsmiHostCommandFreeCallback (void *pvCallback); 215 216 #ifdef VBOXVDMA 217 218 typedef struct _HGSMIGUESTCOMPLENTRY 219 { 220 /* The list field. Must be the first field. */ 221 HGSMILISTENTRY entry; 222 /* guest command buffer */ 223 HGSMIOFFSET offBuffer; 224 } HGSMIGUESTCOMPLENTRY; 225 226 #define HGSMILISTENTRY_2_HGSMIGUESTCOMPLENTRY(_pe) \ 227 ( (HGSMIGUESTCOMPLENTRY*)((uint8_t *)(_pe) - RT_OFFSETOF(HGSMIGUESTCOMPLENTRY, entry)) ) 228 229 static void hgsmiGuestCompletionFIFOFree (HGSMIINSTANCE *pIns, HGSMIGUESTCOMPLENTRY *pEntry) 230 { 231 NOREF (pIns); 232 RTMemFree (pEntry); 233 } 234 235 static int hgsmiGuestCompletionFIFOAlloc (HGSMIINSTANCE *pIns, HGSMIGUESTCOMPLENTRY **ppEntry) 236 { 237 int rc = VINF_SUCCESS; 238 239 NOREF (pIns); 240 241 HGSMIGUESTCOMPLENTRY *pEntry = (HGSMIGUESTCOMPLENTRY *)RTMemAllocZ (sizeof (HGSMIGUESTCOMPLENTRY)); 242 243 if (pEntry) 244 *ppEntry = pEntry; 245 else 246 rc = VERR_NO_MEMORY; 247 248 return rc; 249 } 250 251 #endif 211 252 212 253 static int hgsmiLock (HGSMIINSTANCE *pIns) … … 341 382 VM_ASSERT_EMT(pIns->pVM); 342 383 384 #ifndef VBOXVDMA 343 385 /* Currently there is no functionality here. */ 344 386 NOREF(pIns); 345 387 346 388 return HGSMIOFFSET_VOID; 389 #else 390 /* use this to speedup guest cmd completion 391 * this mechanism is alternative to submitting H->G command for notification */ 392 HGSMIOFFSET offCmd = HGSMIOFFSET_VOID; 393 int rc = hgsmiFIFOLock(pIns); 394 AssertRC(rc); 395 if(RT_SUCCESS(rc)) 396 { 397 /* Get the host FIFO head entry. */ 398 HGSMILISTENTRY *pHead = pIns->guestCmdCompleted.pHead; 399 if(pHead) 400 hgsmiListRemove (&pIns->guestCmdCompleted, pHead, NULL); 401 402 if(!pIns->guestCmdCompleted.pHead) 403 pIns->pHGFlags->u32HostFlags &= (~HGSMIHOSTFLAGS_GCOMMAND_COMPLETED); 404 405 hgsmiFIFOUnlock(pIns); 406 407 if (pHead) 408 { 409 HGSMIGUESTCOMPLENTRY *pEntry = HGSMILISTENTRY_2_HGSMIGUESTCOMPLENTRY(pHead); 410 offCmd = pEntry->offBuffer; 411 412 LogFlowFunc(("host FIFO head %p.\n", pEntry)); 413 414 hgsmiGuestCompletionFIFOFree (pIns, pEntry); 415 } 416 } 417 /* Special value that means there is no host buffers to be processed. */ 418 return offCmd; 419 #endif 347 420 } 348 421 … … 1596 1669 LogFlowFunc(("leave\n")); 1597 1670 } 1671 1672 #ifdef VBOXVDMA 1673 1674 static int hgsmiGuestCommandComplete (HGSMIINSTANCE *pIns, HGSMIOFFSET offMem) 1675 { 1676 HGSMIGUESTCOMPLENTRY *pEntry; 1677 1678 int rc = hgsmiGuestCompletionFIFOAlloc (pIns, &pEntry); 1679 1680 if (RT_SUCCESS (rc)) 1681 { 1682 pEntry->offBuffer = offMem; 1683 1684 rc = hgsmiFIFOLock(pIns); 1685 if (RT_SUCCESS (rc)) 1686 { 1687 hgsmiListAppend (&pIns->guestCmdCompleted, &pEntry->entry); 1688 pIns->pHGFlags->u32HostFlags |= HGSMIHOSTFLAGS_GCOMMAND_COMPLETED; 1689 1690 hgsmiFIFOUnlock(pIns); 1691 } 1692 else 1693 { 1694 hgsmiGuestCompletionFIFOFree(pIns, pEntry); 1695 } 1696 } 1697 1698 return rc; 1699 } 1700 1701 int hgsmiCompleteGuestCommand(PHGSMIINSTANCE pIns, 1702 HGSMIOFFSET offBuffer, 1703 bool bDoIrq) 1704 { 1705 int rc = hgsmiGuestCommandComplete (pIns, offBuffer); 1706 if (RT_SUCCESS (rc)) 1707 { 1708 if(bDoIrq) 1709 { 1710 /* Now guest can read the FIFO, the notification is informational. */ 1711 hgsmiNotifyGuest (pIns); 1712 } 1713 } 1714 return rc; 1715 } 1716 1717 int HGSMICompleteGuestCommand(PHGSMIINSTANCE pIns, 1718 void *pvMem, 1719 bool bDoIrq) 1720 { 1721 LogFlowFunc(("pIns = %p, pvMem = %p\n", pIns, pvMem)); 1722 1723 VM_ASSERT_OTHER_THREAD(pIns->pVM); 1724 1725 int rc = VINF_SUCCESS; 1726 HGSMIOFFSET offBuffer = HGSMIHeapBufferOffset (&pIns->hostHeap, pvMem); 1727 Assert(offBuffer != HGSMIOFFSET_VOID); 1728 if (offBuffer != HGSMIOFFSET_VOID) 1729 { 1730 rc = hgsmiCompleteGuestCommand (pIns, offBuffer, bDoIrq); 1731 AssertRC (rc); 1732 } 1733 else 1734 { 1735 LogRel(("invalid cmd offset \n")); 1736 rc = VERR_INVALID_PARAMETER; 1737 } 1738 1739 LogFlowFunc(("rc = %Rrc\n", rc)); 1740 1741 return rc; 1742 } 1743 #endif -
trunk/src/VBox/Devices/Makefile.kmk
r26523 r26556 340 340 341 341 endif 342 ifdef VBOXVDMA 343 DevicesR3_DEFS += VBOXVDMA 344 endif 345 342 346 ifdef VBOX_WITH_VIDEOHWACCEL 343 347 DevicesR3_DEFS += VBOX_WITH_VIDEOHWACCEL … … 571 575 VBoxDDGC_DEFS += VBOX_WITH_HGSMI 572 576 endif 577 ifdef VBOXVDMA 578 VBoxDDGC_DEFS += VBOXVDMA 579 endif 573 580 574 581 ifdef VBOX_WITH_USB … … 588 595 VBoxDDGC_DEFS += VBOX_WITH_HGSMI 589 596 endif 597 ifdef VBOXVDMA 598 VBoxDDGC_DEFS += VBOXVDMA 599 endif 600 590 601 ifdef VBOX_WITH_VIDEOHWACCEL 591 602 VBoxDDGC_DEFS += VBOX_WITH_VIDEOHWACCEL … … 669 680 VBoxDDR0_DEFS += VBOX_WITH_HGSMI 670 681 endif 682 ifdef VBOXVDMA 683 VBoxDDR0_DEFS += VBOXVDMA 684 endif 685 671 686 672 687 ifdef VBOX_WITH_USB … … 706 721 ifdef VBOX_WITH_VIDEOHWACCEL 707 722 VBoxDDR0_DEFS += VBOX_WITH_VIDEOHWACCEL 723 endif 724 ifdef VBOXVDMA 725 VBoxDDR0_DEFS += VBOXVDMA 708 726 endif 709 727
Note:
See TracChangeset
for help on using the changeset viewer.