[XBOXVMP] Add Xbox video miniport driver
authorStanislav Motylkov <x86corez@gmail.com>
Mon, 12 Aug 2019 09:34:29 +0000 (12:34 +0300)
committerHermès BÉLUSCA - MAÏTO <hermes.belusca-maito@reactos.org>
Fri, 30 Aug 2019 22:19:03 +0000 (00:19 +0200)
Also make XboxVmp driver compatible with Video Port driver, specify
vendor id and device id explicitly in VideoPortGetAccessRanges() call

CORE-16317

boot/bootdata/txtsetup.sif
media/inf/display.inf
win32ss/drivers/miniport/xboxvmp/CMakeLists.txt
win32ss/drivers/miniport/xboxvmp/xboxvmp.c
win32ss/drivers/miniport/xboxvmp/xboxvmp_reg.inf [new file with mode: 0644]

index f3f6ba6..feeae24 100644 (file)
@@ -282,11 +282,13 @@ vbe_1600x1200x8  = "VESA Display (1600x1200x8)",,VBE,1600,1200,8
 vbe_1600x1200x16 = "VESA Display (1600x1200x16)",,VBE,1600,1200,16
 vbe_1600x1200x24 = "VESA Display (1600x1200x24)",,VBE,1600,1200,24
 vbe_1600x1200x32 = "VESA Display (1600x1200x32)",,VBE,1600,1200,32
+xbox             = "Original Xbox NV2A Framebuffer (640x480x32)",,XboxVmp,640,480,32
 
 [Map.Display]
 ;<id> = <pnp id string>
 vga = "VGA Display"
 vbe = "VBE Display"
+xboxvmp = "NV2A Framebuffer"
 
 [Keyboard]
 Default = "XT-, AT- or extended keyboard (83-105 keys)"
index 59a511b..87ebba7 100644 (file)
@@ -40,6 +40,7 @@ CopyFiles = VGA.Miniport_CopyFiles.NT, VGA.Display_CopyFiles.NT
 [VGA.Miniport_CopyFiles.NT]
 vgamp.sys
 vbemp.sys
+xboxvmp.sys
 
 [VGA.Display_CopyFiles.NT]
 vgaddi.dll
@@ -49,6 +50,7 @@ framebuf.dll
 AddService = , 0x00000002
 ;AddService = VGA, , VGA_Service_Inst
 ;AddService = VBE, 0x00000003, VBE_Service_Inst ; SPSVCINST_TAGTOFRONT + SPSVCINST_ASSOCSERVICE
+;AddService = XboxVmp, 0x00000003, XBOX_Service_Inst
 
 [VGA_Service_Inst]
 ServiceType   = 1
@@ -64,6 +66,13 @@ ErrorControl  = 0
 ServiceBinary = %12%\vbemp.sys
 LoadOrderGroup = Video Save
 
+[XBOX_Service_Inst]
+ServiceType   = 1
+StartType     = 1
+ErrorControl  = 0
+ServiceBinary = %12%\xboxvmp.sys
+LoadOrderGroup = Video Save
+
 ;-------------------------------- STRINGS -------------------------------
 
 [Strings]
index 02ffb3e..d5f9f13 100644 (file)
@@ -2,3 +2,5 @@
 add_library(xboxvmp MODULE xboxvmp.c xboxvmp.rc)
 set_module_type(xboxvmp kernelmodedriver)
 add_importlibs(xboxvmp ntoskrnl videoprt)
+add_cd_file(TARGET xboxvmp DESTINATION reactos/system32/drivers FOR all)
+add_registry_inf(xboxvmp_reg.inf)
index 6841930..6fabde0 100644 (file)
@@ -71,19 +71,21 @@ XboxVmpFindAdapter(
   PXBOXVMP_DEVICE_EXTENSION XboxVmpDeviceExtension;
   VIDEO_ACCESS_RANGE AccessRanges[3];
   VP_STATUS Status;
+  USHORT VendorId = 0x10DE; /* NVIDIA Corporation */
+  USHORT DeviceId = 0x02A0; /* NV2A XGPU */
 
   VideoPortDebugPrint(Trace, "XboxVmpFindAdapter\n");
 
   XboxVmpDeviceExtension = (PXBOXVMP_DEVICE_EXTENSION) HwDeviceExtension;
   Status = VideoPortGetAccessRanges(HwDeviceExtension, 0, NULL, 3, AccessRanges,
-                                    NULL, NULL, NULL);
+                                    &VendorId, &DeviceId, NULL);
 
-  if (NO_ERROR == Status)
-    {
+  if (Status == NO_ERROR)
+  {
       XboxVmpDeviceExtension->PhysControlStart = AccessRanges[0].RangeStart;
       XboxVmpDeviceExtension->ControlLength = AccessRanges[0].RangeLength;
       XboxVmpDeviceExtension->PhysFrameBufferStart = AccessRanges[1].RangeStart;
-    }
+  }
 
   return Status;
 }
diff --git a/win32ss/drivers/miniport/xboxvmp/xboxvmp_reg.inf b/win32ss/drivers/miniport/xboxvmp/xboxvmp_reg.inf
new file mode 100644 (file)
index 0000000..e7c2a3c
--- /dev/null
@@ -0,0 +1,13 @@
+; Xbox Nvidia driver
+[AddReg]
+HKLM,"SYSTEM\CurrentControlSet\Services\XboxVmp","ErrorControl",0x00010001,0x00000000
+HKLM,"SYSTEM\CurrentControlSet\Services\XboxVmp","Group",0x00000000,"Video Save"
+HKLM,"SYSTEM\CurrentControlSet\Services\XboxVmp","ImagePath",0x00020000,"system32\drivers\xboxvmp.sys"
+HKLM,"SYSTEM\CurrentControlSet\Services\XboxVmp","Start",0x00010001,0x00000004
+HKLM,"SYSTEM\CurrentControlSet\Services\XboxVmp","Type",0x00010001,0x00000001
+HKLM,"SYSTEM\CurrentControlSet\Enum\PCI\VEN_10DE&DEV_02A0&SUBSYS_00000000&REV_A1\0000","Service",0x00000000,"XboxVmp"
+
+HKLM,"SYSTEM\CurrentControlSet\Hardware Profiles\Current\System\CurrentControlSet\Services\XboxVmp\Device0","InstalledDisplayDrivers",0x00010000,"framebuf"
+
+; This is not true but it allows to use 3rd party drivers while having the XboxVmp driver installed
+HKLM,"SYSTEM\CurrentControlSet\Hardware Profiles\Current\System\CurrentControlSet\Services\XboxVmp\Device0","VgaCompatible",0x00010001,1